@lovrabet/rabetbase-cli 2.3.5 → 2.3.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.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/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-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/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a140_0x26fe(){const _0x1b8583=['roleType','role','Role\x20','4bnadvN','detail','17997342HujwRr','1581185NMnWDT','num','2810664umBOoA','read','2uuBaDq','1476837FioBVI','157405ISYowl','10uNsUqK','832dMFhGI','Show\x20a\x20single\x20role\x27s\x20detail','roleName','4383837qStDlS','26306WXjtmk'];a140_0x26fe=function(){return _0x1b8583;};return a140_0x26fe();}const a140_0x549080=a140_0x4ff9;function a140_0x4ff9(_0x385431,_0x2f8056){_0x385431=_0x385431-0xf7;const _0x26feec=a140_0x26fe();let _0x4ff900=_0x26feec[_0x385431];return _0x4ff900;}(function(_0x4426e3,_0x574304){const _0x27d08f=a140_0x4ff9,_0x23e0a3=_0x4426e3();while(!![]){try{const _0x26fe00=parseInt(_0x27d08f(0x100))/0x1*(-parseInt(_0x27d08f(0xfe))/0x2)+-parseInt(_0x27d08f(0xff))/0x3+parseInt(_0x27d08f(0xf7))/0x4*(-parseInt(_0x27d08f(0xfa))/0x5)+parseInt(_0x27d08f(0xfc))/0x6+parseInt(_0x27d08f(0x106))/0x7*(-parseInt(_0x27d08f(0x102))/0x8)+parseInt(_0x27d08f(0x105))/0x9*(-parseInt(_0x27d08f(0x101))/0xa)+parseInt(_0x27d08f(0xf9))/0xb;if(_0x26fe00===_0x574304)break;else _0x23e0a3['push'](_0x23e0a3['shift']());}catch(_0x2e301f){_0x23e0a3['push'](_0x23e0a3['shift']());}}}(a140_0x26fe,0x3fa70));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';export const roleDetail={'service':a140_0x549080(0x108),'command':a140_0x549080(0xf8),'description':a140_0x549080(0x103),'risk':a140_0x549080(0xfd),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x2728d7){const _0x34b98a=a140_0x549080,_0x17ff7f=_0x2728d7[_0x34b98a(0xfb)]('id'),_0x542a5f=await getRoleById(_0x2728d7['appCode'],_0x17ff7f);return{'ok':!![],'data':{'role':projectRole(_0x542a5f)},'message':_0x34b98a(0x109)+_0x542a5f[_0x34b98a(0x104)]+'\x20('+_0x542a5f[_0x34b98a(0x107)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x26c62f,_0x30423c){const _0x571984=a141_0x5277,_0x3e5a4d=_0x26c62f();while(!![]){try{const _0x2ad734=-parseInt(_0x571984(0x115))/0x1+-parseInt(_0x571984(0x118))/0x2*(parseInt(_0x571984(0x112))/0x3)+parseInt(_0x571984(0x117))/0x4*(-parseInt(_0x571984(0x11a))/0x5)+parseInt(_0x571984(0x119))/0x6*(parseInt(_0x571984(0x11b))/0x7)+-parseInt(_0x571984(0x114))/0x8*(-parseInt(_0x571984(0x11d))/0x9)+parseInt(_0x571984(0x116))/0xa+parseInt(_0x571984(0x113))/0xb*(-parseInt(_0x571984(0x11c))/0xc);if(_0x2ad734===_0x30423c)break;else _0x3e5a4d['push'](_0x3e5a4d['shift']());}catch(_0x1b4805){_0x3e5a4d['push'](_0x3e5a4d['shift']());}}}(a141_0x8cdc,0x3bae5));import{roleList}from'../../commands/role/list.js';import{roleDetail}from'../../commands/role/detail.js';function a141_0x8cdc(){const _0x11d173=['44daHkrE','8WkZINi','215845LNbpxw','4270240GLXgkL','184YPXKIk','110428YRqoDJ','6vrlZvz','25495sbMyfH','380317hxyaxR','603984pphsGe','4230351gMWhVF','3ddZXgE'];a141_0x8cdc=function(){return _0x11d173;};return a141_0x8cdc();}import{roleCreate}from'../../commands/role/create.js';function a141_0x5277(_0x3d3e34,_0x5aafce){_0x3d3e34=_0x3d3e34-0x112;const _0x8cdcd9=a141_0x8cdc();let _0x5277ab=_0x8cdcd9[_0x3d3e34];return _0x5277ab;}import{roleUpdate}from'../../commands/role/update.js';import{roleDelete}from'../../commands/role/delete.js';import{roleUserResolve}from'../../commands/role/user-resolve.js';import{roleUserAdd}from'../../commands/role/user-add.js';import{roleUserRemove}from'../../commands/role/user-remove.js';export const roleDefinitions=[roleList,roleDetail,roleCreate,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a142_0x1172c6=a142_0x5214;(function(_0x9a4f99,_0x20932c){const _0x2867f9=a142_0x5214,_0x379afc=_0x9a4f99();while(!![]){try{const _0x35d8d9=parseInt(_0x2867f9(0x111))/0x1*(-parseInt(_0x2867f9(0x132))/0x2)+-parseInt(_0x2867f9(0x131))/0x3+parseInt(_0x2867f9(0x115))/0x4*(-parseInt(_0x2867f9(0x10c))/0x5)+-parseInt(_0x2867f9(0x112))/0x6+-parseInt(_0x2867f9(0x125))/0x7*(-parseInt(_0x2867f9(0x126))/0x8)+parseInt(_0x2867f9(0x118))/0x9+parseInt(_0x2867f9(0x12f))/0xa;if(_0x35d8d9===_0x20932c)break;else _0x379afc['push'](_0x379afc['shift']());}catch(_0x342532){_0x379afc['push'](_0x379afc['shift']());}}}(a142_0x536c,0x4cfd5));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a142_0x5214(_0x50887a,_0x14d25a){_0x50887a=_0x50887a-0x10c;const _0x536c50=a142_0x536c();let _0x5214cf=_0x536c50[_0x50887a];return _0x5214cf;}function a142_0x536c(){const _0x3d8262=['Found\x20','role','validation','type','num','Page\x20size\x20(1-100)','Page\x20index\x20(1-based)','toUpperCase','pagesize','map','page','Invalid\x20--type\x20\x22','7WuvtXf','3486808hFCPHm','length','CUSTOM','filter','Filter\x20by\x20role\x20type','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','appCode','DEV','join','8408040YSNQbm','string','366918kwtDSQ','3288icbpeT','5evmrpI','trim','number','USER','Use\x20one\x20of:\x20','90HvKOWb','3414840kgNMRW','includes','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','582796FwWClX','list','str','214191ZrTTqI'];a142_0x536c=function(){return _0x3d8262;};return a142_0x536c();}import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=['ADMIN',a142_0x1172c6(0x12d),a142_0x1172c6(0x10f),a142_0x1172c6(0x128)];export const roleList={'service':a142_0x1172c6(0x11a),'command':a142_0x1172c6(0x116),'description':a142_0x1172c6(0x12b),'risk':'read','flags':[APPCODE_FLAG_OPTIONAL,{'name':a142_0x1172c6(0x11c),'type':a142_0x1172c6(0x130),'required':![],'description':a142_0x1172c6(0x12a),'enum':ROLE_TYPES},{'name':a142_0x1172c6(0x123),'type':a142_0x1172c6(0x10e),'description':a142_0x1172c6(0x11f),'default':0x1},{'name':'pagesize','type':a142_0x1172c6(0x10e),'description':a142_0x1172c6(0x11e),'default':0x64}],async 'validate'(_0x52790e){const _0x2910a2=a142_0x1172c6,_0x29e562=_0x52790e[_0x2910a2(0x117)](_0x2910a2(0x11c))[_0x2910a2(0x10d)]();if(_0x29e562&&!ROLE_TYPES[_0x2910a2(0x113)](_0x29e562[_0x2910a2(0x120)]()))throw CliErrors[_0x2910a2(0x11b)](_0x2910a2(0x124)+_0x29e562+'\x22.',_0x2910a2(0x110)+ROLE_TYPES[_0x2910a2(0x12e)](',\x20')+'.');const _0x55d310=_0x52790e['num'](_0x2910a2(0x123),0x1),_0x40280b=_0x52790e[_0x2910a2(0x11d)](_0x2910a2(0x121),0x64);if(_0x55d310<0x1)throw CliErrors[_0x2910a2(0x11b)]('--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.');if(_0x40280b<0x1||_0x40280b>0x64)throw CliErrors['validation'](_0x2910a2(0x114));},async 'execute'(_0x3fe1e0){const _0x5ea1a9=a142_0x1172c6,_0x37c4a3=_0x3fe1e0['num']('page',0x1)||0x1,_0x39156b=_0x3fe1e0[_0x5ea1a9(0x11d)](_0x5ea1a9(0x121),0x64)||0x64,_0x487808=_0x3fe1e0['str'](_0x5ea1a9(0x11c))[_0x5ea1a9(0x10d)]()[_0x5ea1a9(0x120)](),{items:_0x12d43d,paging:_0x580d33}=await listAppRoles(_0x3fe1e0[_0x5ea1a9(0x12c)],{'currentPage':_0x37c4a3,'pageSize':_0x39156b}),_0x59818e=_0x487808?_0x12d43d[_0x5ea1a9(0x129)](_0x31c4b8=>_0x31c4b8['roleType']===_0x487808):_0x12d43d,_0x5a7e01=_0x59818e[_0x5ea1a9(0x122)](projectRole);return{'ok':!![],'data':{'roles':_0x5a7e01,'paging':_0x580d33},'message':_0x5ea1a9(0x119)+_0x5a7e01[_0x5ea1a9(0x127)]+'\x20role(s)'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a143_0x217e48=a143_0x40ed;(function(_0x464445,_0xd3cc87){const _0x611c87=a143_0x40ed,_0x4cf3e9=_0x464445();while(!![]){try{const _0x35dab7=-parseInt(_0x611c87(0x185))/0x1*(-parseInt(_0x611c87(0x19b))/0x2)+parseInt(_0x611c87(0x1ab))/0x3+-parseInt(_0x611c87(0x15f))/0x4+-parseInt(_0x611c87(0x169))/0x5+parseInt(_0x611c87(0x196))/0x6*(-parseInt(_0x611c87(0x179))/0x7)+-parseInt(_0x611c87(0x1aa))/0x8*(-parseInt(_0x611c87(0x194))/0x9)+-parseInt(_0x611c87(0x175))/0xa*(-parseInt(_0x611c87(0x19f))/0xb);if(_0x35dab7===_0xd3cc87)break;else _0x4cf3e9['push'](_0x4cf3e9['shift']());}catch(_0x4a58a1){_0x4cf3e9['push'](_0x4cf3e9['shift']());}}}(a143_0x395c,0x2ec7c));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':'number','required':!![],'description':a143_0x217e48(0x164)};export const ROLE_REF_FLAG={'name':a143_0x217e48(0x181),'type':'string','required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};function a143_0x40ed(_0x148aa5,_0x4f472f){_0x148aa5=_0x148aa5-0x15e;const _0x395cc6=a143_0x395c();let _0x40ed62=_0x395cc6[_0x148aa5];return _0x40ed62;}export const USER_REF_FLAG={'name':a143_0x217e48(0x180),'type':a143_0x217e48(0x19a),'required':!![],'description':a143_0x217e48(0x17d)};export const NAME_FLAG={'name':a143_0x217e48(0x19c),'type':'string','required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':'name','type':a143_0x217e48(0x19a),'required':!![],'description':a143_0x217e48(0x199)};export const REMARK_FLAG={'name':a143_0x217e48(0x184),'type':a143_0x217e48(0x19a),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a143_0x217e48(0x16a),'type':a143_0x217e48(0x165),'required':![],'description':a143_0x217e48(0x163)};export const BUILTIN_ROLE_TYPES=[a143_0x217e48(0x176),'DEV','USER'];export function isBuiltinRole(_0x854401){return BUILTIN_ROLE_TYPES['includes'](_0x854401);}export function assertCustomRole(_0x135cf5,_0x3924d5){const _0x3c5129=a143_0x217e48;if(_0x135cf5['roleType']!==_0x3c5129(0x170))throw CliErrors['validation'](_0x3c5129(0x166)+_0x3924d5+_0x3c5129(0x177)+_0x135cf5[_0x3c5129(0x1a0)]+'\x20('+_0x135cf5[_0x3c5129(0x189)]+').',_0x3c5129(0x19d));}function a143_0x395c(){const _0x3436c9=['Role\x20id\x20','Pass\x20--user\x20<id|name>.','dryRun','CUSTOM','join','flag','username','\x20is\x20already\x20a\x20member\x20of\x20role\x20','327750VlzXoH','ADMIN','\x20built-in\x20role\x20','permitCount','7irFgYe','Missing\x20user\x20reference.','totalCount','findIndex','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','POST','DEV','user','role','Disambiguate\x20with\x20--role\x20<id>.','Role\x20name\x20\x22','remark','5821EyrnSQ','push','map','toLowerCase','roleType','Missing\x20role\x20reference.','userId','userList','User\x20','Pass\x20--role\x20<id|name>.','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','trim','\x22\x20not\x20found\x20in\x20app\x20','1099665zNWgXV','\x22:\x20','554700yIDgyI','\x20is\x20not\x20a\x20member\x20of\x20role\x20','flagMissing','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','string','18HUGymV','name','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','165FXZfDE','roleName','splice','expectUserCount','userCount','test','validation','str','length','user-add','tenant_code','8yQWqQn','381855JvHArR',';\x20no\x20change.','nickname','863672KNiGXV','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','appCode','\x22\x20is\x20ambiguous\x20(ids:\x20','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Role\x20id\x20(from\x20`role\x20list`)','number','Cannot\x20','\x20not\x20found\x20in\x20app\x20','find','1467520oOTcEs','expect-user-count','authRequired','Anti-drift\x20check\x20failed:\x20expected\x20'];a143_0x395c=function(){return _0x3436c9;};return a143_0x395c();}export function assertPermConfigurable(_0x3b028b){const _0x4b0a27=a143_0x217e48;if(_0x3b028b['roleType']===_0x4b0a27(0x17f)||_0x3b028b[_0x4b0a27(0x189)]===_0x4b0a27(0x176))throw CliErrors[_0x4b0a27(0x1a5)](_0x4b0a27(0x160)+_0x3b028b['roleName']+'\x20('+_0x3b028b[_0x4b0a27(0x189)]+').',_0x4b0a27(0x18f));}export function projectRole(_0x3785d3){const _0x8dd903=a143_0x217e48;return{'id':_0x3785d3['id'],'roleName':_0x3785d3[_0x8dd903(0x1a0)],'roleType':_0x3785d3[_0x8dd903(0x189)],'remark':_0x3785d3[_0x8dd903(0x184)],'userCount':_0x3785d3[_0x8dd903(0x1a3)],'permitCount':_0x3785d3[_0x8dd903(0x178)],'builtin':isBuiltinRole(_0x3785d3['roleType'])};}export async function resolveRoleRef(_0x36099a,_0x11c598){const _0x55b099=a143_0x217e48,_0x2149c7=_0x11c598[_0x55b099(0x192)]();if(!_0x2149c7)throw CliErrors[_0x55b099(0x1a5)](_0x55b099(0x18a),_0x55b099(0x18e));if(/^\d+$/[_0x55b099(0x1a4)](_0x2149c7))return getRoleById(_0x36099a,Number(_0x2149c7));const _0x52f2f6=await listAllAppRoles(_0x36099a),_0x1544b5=_0x52f2f6['filter'](_0x2f09b2=>_0x2f09b2[_0x55b099(0x1a0)]===_0x2149c7);if(_0x1544b5[_0x55b099(0x1a7)]===0x0)throw CliErrors[_0x55b099(0x1a5)](_0x55b099(0x183)+_0x2149c7+_0x55b099(0x193)+_0x36099a+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x1544b5[_0x55b099(0x1a7)]>0x1){const _0x830479=_0x1544b5[_0x55b099(0x187)](_0x3a04fb=>_0x3a04fb['id'])[_0x55b099(0x171)](',\x20');throw CliErrors[_0x55b099(0x1a5)](_0x55b099(0x183)+_0x2149c7+_0x55b099(0x162)+_0x830479+').',_0x55b099(0x182));}return _0x1544b5[0x0];}export async function getRoleById(_0x1461a0,_0x2a9634){const _0x1a2227=a143_0x217e48,_0x18efc6=await getAppRole(_0x2a9634);if(!_0x18efc6)throw CliErrors['validation'](_0x1a2227(0x16d)+_0x2a9634+_0x1a2227(0x167)+_0x1461a0+'.',_0x1a2227(0x190));return _0x18efc6;}async function listAllAppRoles(_0x5b7b30){const _0x198d50=a143_0x217e48,_0x16c0f4=0x64,_0xff6b0=[];for(let _0x5512e1=0x1;;_0x5512e1+=0x1){const {items:_0x290f7d,paging:_0x3b7942}=await listAppRoles(_0x5b7b30,{'currentPage':_0x5512e1,'pageSize':_0x16c0f4});_0xff6b0[_0x198d50(0x186)](..._0x290f7d);if(_0x290f7d['length']<_0x16c0f4||_0x3b7942&&_0xff6b0[_0x198d50(0x1a7)]>=_0x3b7942[_0x198d50(0x17b)])return _0xff6b0;}}export async function resolveTenantCode(){const _0x4f326e=a143_0x217e48,_0x10deac=await getSessionUserInfo(),_0x15283a=_0x10deac?.[_0x4f326e(0x180)]?.['tenant']?.[_0x4f326e(0x1a9)];if(!_0x15283a)throw CliErrors[_0x4f326e(0x16b)](_0x4f326e(0x191));return _0x15283a;}function matchMember(_0x980d9c,_0x4f40e8){const _0x16c9e7=a143_0x217e48,_0x2e20ab=_0x4f40e8['trim']()['toLowerCase']();return(_0x980d9c[_0x16c9e7(0x15e)]??'')[_0x16c9e7(0x188)]()===_0x2e20ab||(_0x980d9c[_0x16c9e7(0x173)]??'')[_0x16c9e7(0x188)]()===_0x2e20ab;}export async function resolveUserRef(_0x5284c0){const _0x10a3f4=a143_0x217e48,_0x1ac75c=_0x5284c0[_0x10a3f4(0x192)]();if(!_0x1ac75c)throw CliErrors[_0x10a3f4(0x1a5)](_0x10a3f4(0x17a),_0x10a3f4(0x16e));const _0x5cc7aa=await resolveTenantCode(),_0x13c4b9=await getTenantMembers(_0x5cc7aa);if(/^\d+$/[_0x10a3f4(0x1a4)](_0x1ac75c)){const _0x3c89b8=Number(_0x1ac75c),_0x5ca09e=_0x13c4b9[_0x10a3f4(0x168)](_0x2f7422=>_0x2f7422[_0x10a3f4(0x18b)]===_0x3c89b8);return{'userId':_0x3c89b8,'username':_0x5ca09e?.[_0x10a3f4(0x173)]??String(_0x3c89b8),'nickname':_0x5ca09e?.[_0x10a3f4(0x15e)],'matchedBy':'id'};}const _0xb3579e=_0x13c4b9['filter'](_0x37a74b=>matchMember(_0x37a74b,_0x1ac75c));if(_0xb3579e[_0x10a3f4(0x1a7)]===0x0)throw CliErrors[_0x10a3f4(0x1a5)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x1ac75c+'\x22.',_0x10a3f4(0x19e));if(_0xb3579e[_0x10a3f4(0x1a7)]>0x1){const _0x55c5d8=_0xb3579e[_0x10a3f4(0x187)](_0xb3f327=>(_0xb3f327[_0x10a3f4(0x15e)]??_0xb3f327[_0x10a3f4(0x173)]??'?')+'('+_0xb3f327[_0x10a3f4(0x18b)]+')')[_0x10a3f4(0x171)](',\x20');throw CliErrors[_0x10a3f4(0x1a5)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x1ac75c+_0x10a3f4(0x195)+_0x55c5d8+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x5ed3c4=_0xb3579e[0x0];return{'userId':_0x5ed3c4['userId'],'username':_0x5ed3c4['username']??String(_0x5ed3c4[_0x10a3f4(0x18b)]),'nickname':_0x5ed3c4[_0x10a3f4(0x15e)],'matchedBy':_0x10a3f4(0x19c)};}export const UPDATE_USER_LIST_PATH='/smartapi/permit/user-role/update-user-list';function userIdsOf(_0x2615a6){const _0x739ffd=a143_0x217e48;return(_0x2615a6?.[_0x739ffd(0x18c)]??[])['map'](_0x2478ad=>_0x2478ad[_0x739ffd(0x18b)]);}export function computeRoleUserMutation(_0x1338c1){const _0x18cbbb=a143_0x217e48,{operation:_0x2248ba,appCode:_0x566199,roleUsers:_0x248a6c,targetRoleId:_0x130bd4,user:_0x1a371e}=_0x1338c1,_0x16b3e5=_0x248a6c[_0x18cbbb(0x168)](_0xb62c5d=>_0xb62c5d['id']===_0x130bd4);if(!_0x16b3e5)throw CliErrors[_0x18cbbb(0x1a5)](_0x18cbbb(0x16d)+_0x130bd4+'\x20not\x20found\x20in\x20the\x20user-role\x20list.',_0x18cbbb(0x190));const _0x31bc04=userIdsOf(_0x16b3e5),_0xd6a517=[];if(_0x1338c1[_0x18cbbb(0x1a2)]!==undefined&&_0x1338c1[_0x18cbbb(0x1a2)]!==_0x31bc04[_0x18cbbb(0x1a7)])throw CliErrors['validation'](_0x18cbbb(0x16c)+_0x1338c1[_0x18cbbb(0x1a2)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x31bc04['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x1e68b8=_0x31bc04['includes'](_0x1a371e['userId']);let _0x5b3358=![];const _0x3c08a5=[..._0x16b3e5[_0x18cbbb(0x18c)]];if(_0x2248ba===_0x18cbbb(0x1a8))_0x1e68b8?_0xd6a517['push'](_0x18cbbb(0x18d)+_0x1a371e['userId']+_0x18cbbb(0x174)+_0x16b3e5[_0x18cbbb(0x1a0)]+_0x18cbbb(0x1ac)):(_0x3c08a5['push']({'userId':_0x1a371e[_0x18cbbb(0x18b)],'username':_0x1a371e['username'],..._0x1a371e[_0x18cbbb(0x15e)]?{'nickname':_0x1a371e['nickname']}:{}}),_0x5b3358=!![]);else{if(!_0x1e68b8)_0xd6a517[_0x18cbbb(0x186)](_0x18cbbb(0x18d)+_0x1a371e[_0x18cbbb(0x18b)]+_0x18cbbb(0x197)+_0x16b3e5[_0x18cbbb(0x1a0)]+_0x18cbbb(0x1ac));else{const _0x2e09dd=_0x3c08a5[_0x18cbbb(0x17c)](_0x1c750d=>_0x1c750d[_0x18cbbb(0x18b)]===_0x1a371e['userId']);if(_0x2e09dd>=0x0)_0x3c08a5[_0x18cbbb(0x1a1)](_0x2e09dd,0x1);_0x5b3358=!![];}}const _0x56106b=_0x248a6c[_0x18cbbb(0x187)](_0x11a20f=>_0x11a20f['id']===_0x130bd4?{..._0x11a20f,'userList':_0x3c08a5}:_0x11a20f),_0x4ca262=_0x3c08a5['map'](_0x438087=>_0x438087[_0x18cbbb(0x18b)]),_0x36cde4={'operation':_0x2248ba,'selector':{'appCode':_0x566199,'roleId':_0x130bd4,'roleName':_0x16b3e5[_0x18cbbb(0x1a0)],'userId':_0x1a371e[_0x18cbbb(0x18b)]},'before':{'userIds':_0x31bc04},'after':{'userIds':_0x4ca262},'dryRun':_0x1338c1[_0x18cbbb(0x16f)],'backend':{'method':_0x18cbbb(0x17e),'path':UPDATE_USER_LIST_PATH},'warnings':_0xd6a517};return{'roleList':_0x56106b,'mutation':_0x36cde4,'changed':_0x5b3358};}export async function loadRoleUsers(_0x2460cd){return listRoleUsers(_0x2460cd);}export function readRoleRef(_0x36c1df){const _0x138032=a143_0x217e48,_0x344337=_0x36c1df[_0x138032(0x1a6)](_0x138032(0x181))[_0x138032(0x192)]();if(!_0x344337)throw CliErrors[_0x138032(0x198)](_0x138032(0x181),_0x138032(0x18e));return _0x344337;}export async function prepareUserMutation(_0x2f4a7a,_0x22846b,_0x371cb8){const _0x1e84b2=a143_0x217e48,_0x32f173=readRoleRef(_0x2f4a7a),_0x33244b=_0x2f4a7a[_0x1e84b2(0x1a6)](_0x1e84b2(0x180))[_0x1e84b2(0x192)]();if(!_0x33244b)throw CliErrors[_0x1e84b2(0x198)](_0x1e84b2(0x180),'Pass\x20--user\x20<id|name>.');const _0x2166d3=_0x2f4a7a[_0x1e84b2(0x172)]('expect-user-count'),_0x18135b=_0x2166d3===undefined||_0x2166d3===null?undefined:Number(_0x2166d3),_0x47cb76=await resolveRoleRef(_0x2f4a7a[_0x1e84b2(0x161)],_0x32f173),_0x3d2ba7=await resolveUserRef(_0x33244b),_0x530d41=await loadRoleUsers(_0x2f4a7a[_0x1e84b2(0x161)]);return computeRoleUserMutation({'operation':_0x22846b,'appCode':_0x2f4a7a['appCode'],'roleUsers':_0x530d41,'targetRoleId':_0x47cb76['id'],'user':{'userId':_0x3d2ba7['userId'],'username':_0x3d2ba7['username'],'nickname':_0x3d2ba7[_0x1e84b2(0x15e)]},'dryRun':_0x371cb8,..._0x18135b!==undefined?{'expectUserCount':_0x18135b}:{}});}
|
|
1
|
+
const a143_0x1a15e2=a143_0x2798;(function(_0x4f743d,_0x29fd4c){const _0x2ee093=a143_0x2798,_0x17070c=_0x4f743d();while(!![]){try{const _0x67a9bd=parseInt(_0x2ee093(0x116))/0x1*(parseInt(_0x2ee093(0xfd))/0x2)+parseInt(_0x2ee093(0x12d))/0x3*(-parseInt(_0x2ee093(0x105))/0x4)+-parseInt(_0x2ee093(0x12c))/0x5*(-parseInt(_0x2ee093(0x141))/0x6)+-parseInt(_0x2ee093(0xff))/0x7*(-parseInt(_0x2ee093(0xf6))/0x8)+parseInt(_0x2ee093(0x143))/0x9+parseInt(_0x2ee093(0x123))/0xa*(-parseInt(_0x2ee093(0x136))/0xb)+-parseInt(_0x2ee093(0x138))/0xc*(parseInt(_0x2ee093(0x107))/0xd);if(_0x67a9bd===_0x29fd4c)break;else _0x17070c['push'](_0x17070c['shift']());}catch(_0x1a60b7){_0x17070c['push'](_0x17070c['shift']());}}}(a143_0x3e70,0xe6869));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a143_0x1a15e2(0x142),'required':!![],'description':a143_0x1a15e2(0x100)};export const ROLE_REF_FLAG={'name':a143_0x1a15e2(0x112),'type':'string','required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a143_0x1a15e2(0x10e),'type':'string','required':!![],'description':a143_0x1a15e2(0x134)};export const NAME_FLAG={'name':a143_0x1a15e2(0xf8),'type':'string','required':!![],'description':a143_0x1a15e2(0x10a)};export const USER_NAME_FLAG={'name':a143_0x1a15e2(0xf8),'type':a143_0x1a15e2(0x137),'required':!![],'description':a143_0x1a15e2(0x120)};export const REMARK_FLAG={'name':a143_0x1a15e2(0x11c),'type':'string','required':![],'description':a143_0x1a15e2(0x130)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a143_0x1a15e2(0x142),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN','DEV',a143_0x1a15e2(0x13f)];export function isBuiltinRole(_0xc98dd){const _0x344566=a143_0x1a15e2;return BUILTIN_ROLE_TYPES[_0x344566(0x13b)](_0xc98dd);}function a143_0x3e70(){const _0x9960b1=['user-add','\x20not\x20found\x20in\x20the\x20user-role\x20list.','Role\x20name','tenant_code','userCount','str','user','\x20member(s)\x20but\x20role\x20has\x20','Disambiguate\x20with\x20--user\x20<id>.','permitCount','role',';\x20no\x20change.','userList','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','1hfDJrA','\x20is\x20already\x20a\x20member\x20of\x20role\x20','/smartapi/permit/user-role/update-user-list','Disambiguate\x20with\x20--role\x20<id>.','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','remark','roleType','Cannot\x20','findIndex','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','validation','username','30110mCuKEL','\x20not\x20found\x20in\x20app\x20','\x22\x20not\x20found\x20in\x20app\x20','trim','\x20built-in\x20role\x20','No\x20tenant\x20member\x20matches\x20\x22','expect-user-count','expectUserCount','test','215bKXXWp','3VRixbq','length','Role\x20id\x20','Optional\x20role\x20remark/description','join','splice','tenant','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Role\x20name\x20\x22','1562pMLrsT','string','37812mIvnIs','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','includes','userId','\x20is\x20not\x20a\x20member\x20of\x20role\x20','roleName','USER','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','188004MdYMvL','number','15789555SHmDWs','nickname','filter','push','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','flagMissing','Missing\x20role\x20reference.','976NQtyIz','map','name','Pass\x20--user\x20<id|name>.','toLowerCase','Pass\x20--role\x20<id|name>.','totalCount','1348684VlTGfU','\x22\x20is\x20ambiguous\x20(ids:\x20','52787xtRgkd','Role\x20id\x20(from\x20`role\x20list`)','User\x20','flag','Missing\x20user\x20reference.','POST','2369556Ebizyb','find','11271SMZMqS'];a143_0x3e70=function(){return _0x9960b1;};return a143_0x3e70();}export function assertCustomRole(_0x40a1f7,_0x41fe90){const _0x5d75c1=a143_0x1a15e2;if(_0x40a1f7['roleType']!=='CUSTOM')throw CliErrors[_0x5d75c1(0x121)](_0x5d75c1(0x11e)+_0x41fe90+_0x5d75c1(0x127)+_0x40a1f7[_0x5d75c1(0x13e)]+'\x20('+_0x40a1f7[_0x5d75c1(0x11d)]+').',_0x5d75c1(0x11b));}export function assertPermConfigurable(_0x3a02ad){const _0xc3c75e=a143_0x1a15e2;if(_0x3a02ad[_0xc3c75e(0x11d)]==='DEV'||_0x3a02ad['roleType']==='ADMIN')throw CliErrors[_0xc3c75e(0x121)](_0xc3c75e(0xf3)+_0x3a02ad[_0xc3c75e(0x13e)]+'\x20('+_0x3a02ad[_0xc3c75e(0x11d)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0x5322f3){const _0x507859=a143_0x1a15e2;return{'id':_0x5322f3['id'],'roleName':_0x5322f3[_0x507859(0x13e)],'roleType':_0x5322f3['roleType'],'remark':_0x5322f3['remark'],'userCount':_0x5322f3[_0x507859(0x10c)],'permitCount':_0x5322f3[_0x507859(0x111)],'builtin':isBuiltinRole(_0x5322f3[_0x507859(0x11d)])};}export async function resolveRoleRef(_0x4d6a70,_0x3c2e84){const _0x233e44=a143_0x1a15e2,_0x3b80c3=_0x3c2e84['trim']();if(!_0x3b80c3)throw CliErrors['validation'](_0x233e44(0xf5),_0x233e44(0xfb));if(/^\d+$/[_0x233e44(0x12b)](_0x3b80c3))return getRoleById(_0x4d6a70,Number(_0x3b80c3));const _0x39c551=await listAllAppRoles(_0x4d6a70),_0x31d332=_0x39c551[_0x233e44(0x145)](_0x384d3e=>_0x384d3e[_0x233e44(0x13e)]===_0x3b80c3);if(_0x31d332[_0x233e44(0x12e)]===0x0)throw CliErrors[_0x233e44(0x121)](_0x233e44(0x135)+_0x3b80c3+_0x233e44(0x125)+_0x4d6a70+'.',_0x233e44(0x115));if(_0x31d332[_0x233e44(0x12e)]>0x1){const _0x4499c4=_0x31d332[_0x233e44(0xf7)](_0x34ae9d=>_0x34ae9d['id'])['join'](',\x20');throw CliErrors[_0x233e44(0x121)]('Role\x20name\x20\x22'+_0x3b80c3+_0x233e44(0xfe)+_0x4499c4+').',_0x233e44(0x119));}return _0x31d332[0x0];}export async function getRoleById(_0x240433,_0x4451d2){const _0x341df9=a143_0x1a15e2,_0x17a532=await getAppRole(_0x4451d2);if(!_0x17a532)throw CliErrors[_0x341df9(0x121)](_0x341df9(0x12f)+_0x4451d2+_0x341df9(0x124)+_0x240433+'.',_0x341df9(0x140));return _0x17a532;}async function listAllAppRoles(_0x3ce4fb){const _0x554e70=a143_0x1a15e2,_0x5bcb7e=0x64,_0x4e6517=[];for(let _0x4b32ff=0x1;;_0x4b32ff+=0x1){const {items:_0x526f9d,paging:_0x1543cf}=await listAppRoles(_0x3ce4fb,{'currentPage':_0x4b32ff,'pageSize':_0x5bcb7e});_0x4e6517[_0x554e70(0xf2)](..._0x526f9d);if(_0x526f9d[_0x554e70(0x12e)]<_0x5bcb7e||_0x1543cf&&_0x4e6517['length']>=_0x1543cf[_0x554e70(0xfc)])return _0x4e6517;}}export async function resolveTenantCode(){const _0x2cb1cd=a143_0x1a15e2,_0x1b3f79=await getSessionUserInfo(),_0x4552e2=_0x1b3f79?.[_0x2cb1cd(0x10e)]?.[_0x2cb1cd(0x133)]?.[_0x2cb1cd(0x10b)];if(!_0x4552e2)throw CliErrors['authRequired'](_0x2cb1cd(0x13a));return _0x4552e2;}function matchMember(_0x370594,_0x2d939d){const _0x153764=a143_0x1a15e2,_0xf667ed=_0x2d939d[_0x153764(0x126)]()[_0x153764(0xfa)]();return(_0x370594[_0x153764(0x144)]??'')[_0x153764(0xfa)]()===_0xf667ed||(_0x370594[_0x153764(0x122)]??'')['toLowerCase']()===_0xf667ed;}export async function resolveUserRef(_0x3e34c6){const _0x5afc98=a143_0x1a15e2,_0x3d255c=_0x3e34c6[_0x5afc98(0x126)]();if(!_0x3d255c)throw CliErrors['validation'](_0x5afc98(0x103),_0x5afc98(0xf9));const _0x518dcd=await resolveTenantCode(),_0x4325ca=await getTenantMembers(_0x518dcd);if(/^\d+$/[_0x5afc98(0x12b)](_0x3d255c)){const _0x38b6e4=Number(_0x3d255c),_0x3d3158=_0x4325ca[_0x5afc98(0x106)](_0x1df63a=>_0x1df63a['userId']===_0x38b6e4);return{'userId':_0x38b6e4,'username':_0x3d3158?.[_0x5afc98(0x122)]??String(_0x38b6e4),'nickname':_0x3d3158?.[_0x5afc98(0x144)],'matchedBy':'id'};}const _0x50ec33=_0x4325ca[_0x5afc98(0x145)](_0x1bb34e=>matchMember(_0x1bb34e,_0x3d255c));if(_0x50ec33[_0x5afc98(0x12e)]===0x0)throw CliErrors[_0x5afc98(0x121)](_0x5afc98(0x128)+_0x3d255c+'\x22.',_0x5afc98(0x139));if(_0x50ec33[_0x5afc98(0x12e)]>0x1){const _0x184a13=_0x50ec33[_0x5afc98(0xf7)](_0x4d251f=>(_0x4d251f['nickname']??_0x4d251f[_0x5afc98(0x122)]??'?')+'('+_0x4d251f[_0x5afc98(0x13c)]+')')[_0x5afc98(0x131)](',\x20');throw CliErrors[_0x5afc98(0x121)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x3d255c+'\x22:\x20'+_0x184a13+'.',_0x5afc98(0x110));}const _0xf68bc5=_0x50ec33[0x0];return{'userId':_0xf68bc5[_0x5afc98(0x13c)],'username':_0xf68bc5[_0x5afc98(0x122)]??String(_0xf68bc5['userId']),'nickname':_0xf68bc5[_0x5afc98(0x144)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a143_0x1a15e2(0x118);function userIdsOf(_0x3015f3){const _0x357082=a143_0x1a15e2;return(_0x3015f3?.['userList']??[])[_0x357082(0xf7)](_0x2390d2=>_0x2390d2['userId']);}export function computeRoleUserMutation(_0x4bea58){const _0x11a931=a143_0x1a15e2,{operation:_0x14d4a4,appCode:_0x541e00,roleUsers:_0xbe3eee,targetRoleId:_0xb246dd,user:_0x6db5e6}=_0x4bea58,_0x218a13=_0xbe3eee[_0x11a931(0x106)](_0x53ac84=>_0x53ac84['id']===_0xb246dd);if(!_0x218a13)throw CliErrors[_0x11a931(0x121)]('Role\x20id\x20'+_0xb246dd+_0x11a931(0x109),'Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x371700=userIdsOf(_0x218a13),_0x4fc560=[];if(_0x4bea58[_0x11a931(0x12a)]!==undefined&&_0x4bea58['expectUserCount']!==_0x371700[_0x11a931(0x12e)])throw CliErrors[_0x11a931(0x121)]('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x4bea58[_0x11a931(0x12a)]+_0x11a931(0x10f)+_0x371700[_0x11a931(0x12e)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0xc861ce=_0x371700[_0x11a931(0x13b)](_0x6db5e6[_0x11a931(0x13c)]);let _0x5c2b31=![];const _0xb0b9a4=[..._0x218a13[_0x11a931(0x114)]];if(_0x14d4a4===_0x11a931(0x108))_0xc861ce?_0x4fc560[_0x11a931(0xf2)](_0x11a931(0x101)+_0x6db5e6[_0x11a931(0x13c)]+_0x11a931(0x117)+_0x218a13[_0x11a931(0x13e)]+_0x11a931(0x113)):(_0xb0b9a4[_0x11a931(0xf2)]({'userId':_0x6db5e6[_0x11a931(0x13c)],'username':_0x6db5e6[_0x11a931(0x122)],..._0x6db5e6[_0x11a931(0x144)]?{'nickname':_0x6db5e6[_0x11a931(0x144)]}:{}}),_0x5c2b31=!![]);else{if(!_0xc861ce)_0x4fc560['push'](_0x11a931(0x101)+_0x6db5e6[_0x11a931(0x13c)]+_0x11a931(0x13d)+_0x218a13['roleName']+_0x11a931(0x113));else{const _0x5ec770=_0xb0b9a4[_0x11a931(0x11f)](_0x26ee98=>_0x26ee98[_0x11a931(0x13c)]===_0x6db5e6[_0x11a931(0x13c)]);if(_0x5ec770>=0x0)_0xb0b9a4[_0x11a931(0x132)](_0x5ec770,0x1);_0x5c2b31=!![];}}const _0x3c64ec=_0xbe3eee[_0x11a931(0xf7)](_0x6251fd=>_0x6251fd['id']===_0xb246dd?{..._0x6251fd,'userList':_0xb0b9a4}:_0x6251fd),_0x19a71f=_0xb0b9a4[_0x11a931(0xf7)](_0x5372c6=>_0x5372c6[_0x11a931(0x13c)]),_0x15ef19={'operation':_0x14d4a4,'selector':{'appCode':_0x541e00,'roleId':_0xb246dd,'roleName':_0x218a13[_0x11a931(0x13e)],'userId':_0x6db5e6[_0x11a931(0x13c)]},'before':{'userIds':_0x371700},'after':{'userIds':_0x19a71f},'dryRun':_0x4bea58['dryRun'],'backend':{'method':_0x11a931(0x104),'path':UPDATE_USER_LIST_PATH},'warnings':_0x4fc560};return{'roleList':_0x3c64ec,'mutation':_0x15ef19,'changed':_0x5c2b31};}export async function loadRoleUsers(_0x22289b){return listRoleUsers(_0x22289b);}function a143_0x2798(_0x5a292b,_0x251ab9){_0x5a292b=_0x5a292b-0xf2;const _0x3e70b9=a143_0x3e70();let _0x279864=_0x3e70b9[_0x5a292b];return _0x279864;}export function readRoleRef(_0x24685b){const _0x34faf0=a143_0x1a15e2,_0x446c25=_0x24685b[_0x34faf0(0x10d)]('role')[_0x34faf0(0x126)]();if(!_0x446c25)throw CliErrors[_0x34faf0(0xf4)](_0x34faf0(0x112),_0x34faf0(0xfb));return _0x446c25;}export async function prepareUserMutation(_0x3f9ad6,_0x5b9e6c,_0x142422){const _0x50b118=a143_0x1a15e2,_0xe860a4=readRoleRef(_0x3f9ad6),_0x4e2c53=_0x3f9ad6[_0x50b118(0x10d)]('user')['trim']();if(!_0x4e2c53)throw CliErrors[_0x50b118(0xf4)](_0x50b118(0x10e),_0x50b118(0xf9));const _0x136618=_0x3f9ad6[_0x50b118(0x102)](_0x50b118(0x129)),_0x287808=_0x136618===undefined||_0x136618===null?undefined:Number(_0x136618),_0x3f1459=await resolveRoleRef(_0x3f9ad6['appCode'],_0xe860a4),_0xb00921=await resolveUserRef(_0x4e2c53),_0x246271=await loadRoleUsers(_0x3f9ad6['appCode']);return computeRoleUserMutation({'operation':_0x5b9e6c,'appCode':_0x3f9ad6[_0x50b118(0x11a)],'roleUsers':_0x246271,'targetRoleId':_0x3f1459['id'],'user':{'userId':_0xb00921['userId'],'username':_0xb00921[_0x50b118(0x122)],'nickname':_0xb00921['nickname']},'dryRun':_0x142422,..._0x287808!==undefined?{'expectUserCount':_0x287808}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a144_0x492db5=a144_0x538c;(function(_0x563eeb,_0x39ec90){const _0x37e026=a144_0x538c,_0x21412d=_0x563eeb();while(!![]){try{const _0xad7145=-parseInt(_0x37e026(0x1ee))/0x1+-parseInt(_0x37e026(0x204))/0x2*(-parseInt(_0x37e026(0x1fa))/0x3)+parseInt(_0x37e026(0x1f7))/0x4*(-parseInt(_0x37e026(0x1ed))/0x5)+-parseInt(_0x37e026(0x207))/0x6*(-parseInt(_0x37e026(0x202))/0x7)+parseInt(_0x37e026(0x1eb))/0x8*(parseInt(_0x37e026(0x1f8))/0x9)+parseInt(_0x37e026(0x1f6))/0xa+-parseInt(_0x37e026(0x1fd))/0xb*(-parseInt(_0x37e026(0x1fe))/0xc);if(_0xad7145===_0x39ec90)break;else _0x21412d['push'](_0x21412d['shift']());}catch(_0x57dcc7){_0x21412d['push'](_0x21412d['shift']());}}}(a144_0x2210,0x34233));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';function a144_0x2210(){const _0x1e8a67=['22GVCltB','583296uXYXEB','Updated\x20role\x20','length','name','364OujMTs','/smartapi/permit/role/update','116422XZzURk','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','update','8706gIKyGd','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','remark','validation','8yHjjaH','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','50CZQGat','333506JlrNlD','num','role','New\x20role\x20name','appCode','string','Nothing\x20to\x20update.','POST','3218190QDfLDD','120476NbpFuo','2659977DrcgMf','flag','3SPnCpN','roleName','\x20(id='];a144_0x2210=function(){return _0x1e8a67;};return a144_0x2210();}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a144_0x492db5(0x203);function readPatch(_0x3f1ab3){const _0x530f22=a144_0x492db5,_0x420923=_0x3f1ab3[_0x530f22(0x1f9)]('name'),_0x213d4b=_0x3f1ab3['flag']('remark'),_0x123038={};if(_0x420923!==undefined&&_0x420923!==null){const _0x35bdf9=String(_0x420923)['trim']();if(!_0x35bdf9)throw CliErrors[_0x530f22(0x20a)]('--name\x20cannot\x20be\x20empty.');if(_0x35bdf9[_0x530f22(0x200)]>0x40)throw CliErrors[_0x530f22(0x20a)](_0x530f22(0x1ec));_0x123038[_0x530f22(0x1fb)]=_0x35bdf9;}_0x213d4b!==undefined&&_0x213d4b!==null&&(_0x123038[_0x530f22(0x209)]=String(_0x213d4b));if(_0x123038[_0x530f22(0x1fb)]===undefined&&_0x123038['remark']===undefined)throw CliErrors[_0x530f22(0x20a)](_0x530f22(0x1f4),_0x530f22(0x205));return _0x123038;}function a144_0x538c(_0x18afc4,_0x3a3eca){_0x18afc4=_0x18afc4-0x1eb;const _0x221070=a144_0x2210();let _0x538c4a=_0x221070[_0x18afc4];return _0x538c4a;}export const roleUpdate={'service':a144_0x492db5(0x1f0),'command':a144_0x492db5(0x206),'description':a144_0x492db5(0x208),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a144_0x492db5(0x201),'type':a144_0x492db5(0x1f3),'required':![],'description':a144_0x492db5(0x1f1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3013db){readPatch(_0x3013db);},async 'dryRun'(_0x42f408){const _0x16d2cb=a144_0x492db5,_0x1fba4d=_0x42f408[_0x16d2cb(0x1ef)]('id'),_0x5196ce=readPatch(_0x42f408),_0xe9b3e0=await getRoleById(_0x42f408['appCode'],_0x1fba4d);return assertCustomRole(_0xe9b3e0,'update'),asDryRunResult({'operation':'update','selector':{'appCode':_0x42f408[_0x16d2cb(0x1f2)],'roleId':_0x1fba4d,'roleName':_0xe9b3e0[_0x16d2cb(0x1fb)]},'before':projectRole(_0xe9b3e0),'after':projectRole({..._0xe9b3e0,..._0x5196ce[_0x16d2cb(0x1fb)]!==undefined?{'roleName':_0x5196ce[_0x16d2cb(0x1fb)]}:{},..._0x5196ce[_0x16d2cb(0x209)]!==undefined?{'remark':_0x5196ce['remark']}:{}}),'dryRun':!![],'backend':{'method':_0x16d2cb(0x1f5),'path':UPDATE_PATH},'warnings':[]},{'method':_0x16d2cb(0x1f5),'url':UPDATE_PATH});},async 'execute'(_0x533ec9){const _0x483f45=a144_0x492db5,_0x2eb667=_0x533ec9['num']('id'),_0x455364=readPatch(_0x533ec9),_0x16d474=await getRoleById(_0x533ec9[_0x483f45(0x1f2)],_0x2eb667);assertCustomRole(_0x16d474,_0x483f45(0x206)),await updateAppRole({'id':_0x2eb667,'appCode':_0x533ec9[_0x483f45(0x1f2)],..._0x455364[_0x483f45(0x1fb)]!==undefined?{'roleName':_0x455364[_0x483f45(0x1fb)]}:{},..._0x455364[_0x483f45(0x209)]!==undefined?{'remark':_0x455364['remark']}:{}});const _0x119f7d=await getRoleById(_0x533ec9[_0x483f45(0x1f2)],_0x2eb667);return{'ok':!![],'data':{'operation':_0x483f45(0x206),'selector':{'appCode':_0x533ec9[_0x483f45(0x1f2)],'roleId':_0x2eb667,'roleName':_0x119f7d['roleName']},'before':projectRole(_0x16d474),'after':projectRole(_0x119f7d),'dryRun':![],'backend':{'method':_0x483f45(0x1f5),'path':UPDATE_PATH},'warnings':[]},'message':_0x483f45(0x1ff)+_0x119f7d[_0x483f45(0x1fb)]+_0x483f45(0x1fc)+_0x2eb667+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a145_0x1f89(){const _0x297eac=['664411fikFGx','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','user-add','userId','selector','1104WBtSgV','3hdlZSU','25999oNPyjz','88BkHCxv','90hkGhCS','Added\x20user\x20','1031096ISIDvq','high-risk-write','POST','appCode','19830HxUDTY','\x20already\x20in\x20role\x20','No\x20change:\x20user\x20','9055662MwOcFi','12657510VIJiMp','\x20to\x20role\x20','340444CWPuqv','roleName','564PxCJfV'];a145_0x1f89=function(){return _0x297eac;};return a145_0x1f89();}const a145_0x25b574=a145_0x713e;(function(_0x426f57,_0xa8250e){const _0x2d11ba=a145_0x713e,_0x25822d=_0x426f57();while(!![]){try{const _0x4df2ff=-parseInt(_0x2d11ba(0x195))/0x1*(parseInt(_0x2d11ba(0x196))/0x2)+parseInt(_0x2d11ba(0x194))/0x3*(parseInt(_0x2d11ba(0x1a3))/0x4)+parseInt(_0x2d11ba(0x19d))/0x5*(parseInt(_0x2d11ba(0x193))/0x6)+parseInt(_0x2d11ba(0x1a0))/0x7+-parseInt(_0x2d11ba(0x199))/0x8*(-parseInt(_0x2d11ba(0x197))/0x9)+parseInt(_0x2d11ba(0x1a1))/0xa+-parseInt(_0x2d11ba(0x1a6))/0xb*(parseInt(_0x2d11ba(0x1a5))/0xc);if(_0x4df2ff===_0xa8250e)break;else _0x25822d['push'](_0x25822d['shift']());}catch(_0xcb8cff){_0x25822d['push'](_0x25822d['shift']());}}}(a145_0x1f89,0xa6193));function a145_0x713e(_0x50fefb,_0x45ab2c){_0x50fefb=_0x50fefb-0x192;const _0x1f8981=a145_0x1f89();let _0x713e92=_0x1f8981[_0x50fefb];return _0x713e92;}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':'role','command':a145_0x25b574(0x1a8),'description':a145_0x25b574(0x1a7),'risk':a145_0x25b574(0x19a),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0xee1cee){const _0x3df4f0=a145_0x25b574,{mutation:_0x570220}=await prepareUserMutation(_0xee1cee,'user-add',!![]);return asDryRunResult(_0x570220,{'method':_0x3df4f0(0x19b),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x102e5c){const _0x220eaf=a145_0x25b574,{roleList:_0x587902,mutation:_0x3e70c6,changed:_0x27385d}=await prepareUserMutation(_0x102e5c,_0x220eaf(0x1a8),![]);return _0x27385d&&await updateRoleUsers(_0x102e5c[_0x220eaf(0x19c)],_0x587902),{'ok':!![],'data':_0x3e70c6,'message':_0x27385d?_0x220eaf(0x198)+_0x3e70c6[_0x220eaf(0x192)]['userId']+_0x220eaf(0x1a2)+_0x3e70c6[_0x220eaf(0x192)]['roleName']:_0x220eaf(0x19f)+_0x3e70c6[_0x220eaf(0x192)][_0x220eaf(0x1a9)]+_0x220eaf(0x19e)+_0x3e70c6[_0x220eaf(0x192)][_0x220eaf(0x1a4)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a146_0x3252(){const _0x4d9f25=['2WDpBQF','user-remove','Removed\x20user\x20','15999aEltZo','high-risk-write','313566yeaIbr','appCode','role','selector','4456qFtZYr','4788dRESlF','455022fxTQFc','\x20from\x20role\x20','No\x20change:\x20user\x20','\x20not\x20in\x20role\x20','278733JRpQis','25MZusXc','userId','2897972HmiHTv','372CHdGqS','2389680qAKWYi','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','roleName'];a146_0x3252=function(){return _0x4d9f25;};return a146_0x3252();}const a146_0x549fe1=a146_0xc205;(function(_0x4410aa,_0x341955){const _0xe0e36b=a146_0xc205,_0x3b4f6d=_0x4410aa();while(!![]){try{const _0xc1985f=parseInt(_0xe0e36b(0x157))/0x1*(parseInt(_0xe0e36b(0x145))/0x2)+-parseInt(_0xe0e36b(0x15a))/0x3*(-parseInt(_0xe0e36b(0x153))/0x4)+-parseInt(_0xe0e36b(0x150))/0x5*(-parseInt(_0xe0e36b(0x14b))/0x6)+-parseInt(_0xe0e36b(0x14f))/0x7+parseInt(_0xe0e36b(0x149))/0x8*(-parseInt(_0xe0e36b(0x14a))/0x9)+-parseInt(_0xe0e36b(0x154))/0xa+-parseInt(_0xe0e36b(0x152))/0xb;if(_0xc1985f===_0x341955)break;else _0x3b4f6d['push'](_0x3b4f6d['shift']());}catch(_0x189df0){_0x3b4f6d['push'](_0x3b4f6d['shift']());}}}(a146_0x3252,0x557cd));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';function a146_0xc205(_0x35a0da,_0x32c92c){_0x35a0da=_0x35a0da-0x145;const _0x32528a=a146_0x3252();let _0xc2051d=_0x32528a[_0x35a0da];return _0xc2051d;}export const roleUserRemove={'service':a146_0x549fe1(0x147),'command':'user-remove','description':a146_0x549fe1(0x155),'risk':a146_0x549fe1(0x15b),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x31297a){const {mutation:_0x2c8dbf}=await prepareUserMutation(_0x31297a,'user-remove',!![]);return asDryRunResult(_0x2c8dbf,{'method':'POST','url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x257c02){const _0x25d66a=a146_0x549fe1,{roleList:_0x525c85,mutation:_0x3b93a2,changed:_0x37ca6f}=await prepareUserMutation(_0x257c02,_0x25d66a(0x158),![]);return _0x37ca6f&&await updateRoleUsers(_0x257c02[_0x25d66a(0x146)],_0x525c85),{'ok':!![],'data':_0x3b93a2,'message':_0x37ca6f?_0x25d66a(0x159)+_0x3b93a2['selector']['userId']+_0x25d66a(0x14c)+_0x3b93a2[_0x25d66a(0x148)][_0x25d66a(0x156)]:_0x25d66a(0x14d)+_0x3b93a2[_0x25d66a(0x148)][_0x25d66a(0x151)]+_0x25d66a(0x14e)+_0x3b93a2[_0x25d66a(0x148)][_0x25d66a(0x156)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a147_0x549c6a=a147_0x3410;function a147_0x3410(_0x1c1428,_0x167850){_0x1c1428=_0x1c1428-0x76;const _0x5e5ff3=a147_0x5e5f();let _0x3410df=_0x5e5ff3[_0x1c1428];return _0x3410df;}(function(_0x939723,_0x54d8bf){const _0x2eba19=a147_0x3410,_0x5a1145=_0x939723();while(!![]){try{const _0x319523=parseInt(_0x2eba19(0x7b))/0x1+parseInt(_0x2eba19(0x76))/0x2+-parseInt(_0x2eba19(0x7e))/0x3*(-parseInt(_0x2eba19(0x81))/0x4)+-parseInt(_0x2eba19(0x7d))/0x5*(-parseInt(_0x2eba19(0x77))/0x6)+-parseInt(_0x2eba19(0x78))/0x7+parseInt(_0x2eba19(0x87))/0x8+parseInt(_0x2eba19(0x7f))/0x9*(-parseInt(_0x2eba19(0x79))/0xa);if(_0x319523===_0x54d8bf)break;else _0x5a1145['push'](_0x5a1145['shift']());}catch(_0x5302d9){_0x5a1145['push'](_0x5a1145['shift']());}}}(a147_0x5e5f,0xba3de));function a147_0x5e5f(){const _0x4a375c=['username','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','9716008SShgco','user-resolve','Resolved\x20\x22','userId','933456bZmwTB','2367252mVsBNq','115472XJVeDV','5095710KvCgkH','nickname','672530UKvaul','str','5ozmwqY','41595DqsigR','36BeODJS','flagMissing','20dnlghz','name','\x22\x20→\x20userId\x20','Pass\x20--name\x20<nickname|username>.'];a147_0x5e5f=function(){return _0x4a375c;};return a147_0x5e5f();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a147_0x549c6a(0x88),'description':a147_0x549c6a(0x86),'risk':'read','flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3ad7ae){const _0x4b5586=a147_0x549c6a;if(!_0x3ad7ae[_0x4b5586(0x7c)](_0x4b5586(0x82))['trim']())throw CliErrors[_0x4b5586(0x80)](_0x4b5586(0x82),_0x4b5586(0x84));},async 'execute'(_0x2e1373){const _0x45b906=a147_0x549c6a,_0x5035f1=_0x2e1373[_0x45b906(0x7c)](_0x45b906(0x82))['trim'](),_0x2ae2c1=await resolveUserRef(_0x5035f1);return{'ok':!![],'data':{'user':{'userId':_0x2ae2c1[_0x45b906(0x8a)],'username':_0x2ae2c1[_0x45b906(0x85)],'nickname':_0x2ae2c1[_0x45b906(0x7a)],'matchedBy':_0x2ae2c1['matchedBy']}},'message':_0x45b906(0x89)+_0x5035f1+_0x45b906(0x83)+_0x2ae2c1[_0x45b906(0x8a)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a148_0x3fb4cc=a148_0x2475;(function(_0x4e19e5,_0x37a993){const _0x292513=a148_0x2475,_0x5d6009=_0x4e19e5();while(!![]){try{const _0x2f29b1=parseInt(_0x292513(0xea))/0x1+-parseInt(_0x292513(0xb6))/0x2*(parseInt(_0x292513(0xc7))/0x3)+-parseInt(_0x292513(0xc9))/0x4*(parseInt(_0x292513(0xd2))/0x5)+parseInt(_0x292513(0xe9))/0x6+parseInt(_0x292513(0xce))/0x7+parseInt(_0x292513(0xb8))/0x8+-parseInt(_0x292513(0xc2))/0x9*(parseInt(_0x292513(0xcd))/0xa);if(_0x2f29b1===_0x37a993)break;else _0x5d6009['push'](_0x5d6009['shift']());}catch(_0x41d2e5){_0x5d6009['push'](_0x5d6009['shift']());}}}(a148_0x4426,0x41fb0));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';function a148_0x2475(_0x23f20c,_0x5ddac6){_0x23f20c=_0x23f20c-0xb0;const _0x442623=a148_0x4426();let _0x247555=_0x442623[_0x23f20c];return _0x247555;}import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a148_0x3fb4cc(0xe0),'dev']);function readPackageScripts(_0x398d39){const _0x23d8ee=a148_0x3fb4cc,_0x3c1f22=resolve(_0x398d39,_0x23d8ee(0xbb));if(!existsSync(_0x3c1f22))return null;try{const _0x119595=JSON[_0x23d8ee(0xb9)](readFileSync(_0x3c1f22,'utf-8'));return _0x119595[_0x23d8ee(0xeb)]??{};}catch{return null;}}function detectPackageManager(_0x2fe7c6){const _0x5b0c33=a148_0x3fb4cc;if(existsSync(resolve(_0x2fe7c6,_0x5b0c33(0xd6)))||existsSync(resolve(_0x2fe7c6,_0x5b0c33(0xc8))))return _0x5b0c33(0xd3);if(existsSync(resolve(_0x2fe7c6,_0x5b0c33(0xcc))))return _0x5b0c33(0xde);if(existsSync(resolve(_0x2fe7c6,_0x5b0c33(0xe5))))return _0x5b0c33(0xd0);return _0x5b0c33(0xc4);}async function versionCheck(_0x43872a){const _0xf079ba=await checkCliVersion();(_0xf079ba['needsUpgrade']||_0xf079ba['belowMinimum'])&&(printCliUpgradeWarning(_0xf079ba),assertCliVersionSupported(_0xf079ba));const _0x173f70=await checkSdkVersion(_0x43872a);if(_0x173f70['needsUpgrade'])printSdkUpgradeWarning(_0x173f70);}function spawnScript(_0x118ef8,_0x351b57,_0x4ac218,_0x5059f5){return new Promise((_0x1398d2,_0x18c97a)=>{const _0x3be121=a148_0x2475,_0x32652e=[_0x3be121(0xe3),_0x351b57,..._0x4ac218],_0x2380ed=spawn(_0x118ef8,_0x32652e,{'cwd':_0x5059f5,'stdio':_0x3be121(0xc5),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5059f5,_0x3be121(0xe6),_0x3be121(0xe2))+delimiter+process.env.PATH}});_0x2380ed['on'](_0x3be121(0xbc),_0x36a91a=>{const _0x4bce40=_0x3be121;if(_0x36a91a===0x0||_0x36a91a===null)_0x1398d2();else _0x18c97a(new Error(_0x118ef8+'\x20run\x20'+_0x351b57+_0x4bce40(0xdd)+_0x36a91a));}),_0x2380ed['on'](_0x3be121(0xdc),_0x18c97a);});}function spawnViteBuildWatch(_0x51bc94){return new Promise((_0x4b21c4,_0x356c29)=>{const _0x3741fd=a148_0x2475,_0x4e28d9=spawn(_0x3741fd(0xd1),[_0x3741fd(0xd4),_0x3741fd(0xbe)],{'cwd':_0x51bc94,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x51bc94,_0x3741fd(0xe6),_0x3741fd(0xe2))+delimiter+process.env.PATH}});_0x4e28d9['on'](_0x3741fd(0xbc),_0x424608=>{if(_0x424608===0x0||_0x424608===null)_0x4b21c4();else _0x356c29(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x424608));}),_0x4e28d9['on'](_0x3741fd(0xdc),_0x356c29);});}function spawnVitePreview(_0x5bbf19){return new Promise((_0x3eb70d,_0x14486b)=>{const _0x152e62=a148_0x2475,_0x31ebed=spawn(_0x152e62(0xd1),['preview'],{'cwd':_0x5bbf19,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5bbf19,'node_modules',_0x152e62(0xe2))+delimiter+process.env.PATH}});_0x31ebed['on'](_0x152e62(0xbc),_0x1208c6=>{const _0x5ce95d=_0x152e62;if(_0x1208c6===0x0||_0x1208c6===null)_0x3eb70d();else _0x14486b(new Error(_0x5ce95d(0xb2)+_0x1208c6));}),_0x31ebed['on']('error',_0x14486b);});}function a148_0x4426(){const _0x26c493=['2007936LMLtGT','Enable\x20watch\x20mode\x20for\x20preview','yarn','vite','332795BLCFHE','bun','build','slice','bun.lockb','\x20run\x20preview','\x20\x20\x20\x20','\x20run\x20preview\x20--watch','No\x20scripts\x20defined\x20in\x20package.json.','\x20run\x20start','error','\x20exited\x20with\x20code\x20','pnpm','join','start','log','.bin','run','No\x20package.json\x20found\x20in\x20current\x20directory.','yarn.lock','node_modules','args','push','3200532yQuvQp','279050buqXDZ','scripts','keys','watch','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20build','\x0a\x20\x20Available\x20scripts:\x0a','Script\x20name\x20defined\x20in\x20package.json','2vMUKmY','length','756192NXngxG','parse','cwd','package.json','close','(none)','--watch','\x22\x20not\x20found\x20in\x20package.json.','Available:\x20','\x0a\x20\x20Usage:\x20','9WZiKmz','read','npm','inherit','\x20run\x20<script>\x0a','1000551WiwxRP','bun.lock','24ghWGuQ','has','validation','pnpm-lock.yaml','1907170OqNjsa'];a148_0x4426=function(){return _0x26c493;};return a148_0x4426();}const runFlags=[{'name':a148_0x3fb4cc(0xb1),'type':'boolean','description':a148_0x3fb4cc(0xcf),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':a148_0x3fb4cc(0xc3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a148_0x3fb4cc(0xb5),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x42a921=a148_0x3fb4cc,_0x39b3f1=[];return _0x39b3f1[_0x42a921(0xe8)]('\x20\x20EXAMPLES'),_0x39b3f1['push'](_0x42a921(0xd8)+CLI_BIN_NAME+_0x42a921(0xdb)),_0x39b3f1['push'](_0x42a921(0xd8)+CLI_BIN_NAME+_0x42a921(0xb3)),_0x39b3f1['push'](_0x42a921(0xd8)+CLI_BIN_NAME+_0x42a921(0xd7)),_0x39b3f1[_0x42a921(0xe8)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x42a921(0xd9)),_0x39b3f1['join']('\x0a');},async 'execute'(_0x34ffcb){const _0x734da0=a148_0x3fb4cc,_0x374436=process[_0x734da0(0xba)](),_0x1a17f6=_0x34ffcb[_0x734da0(0xe7)][0x0],_0x59762c=_0x34ffcb[_0x734da0(0xe7)][_0x734da0(0xd5)](0x1),_0x269a0b=readPackageScripts(_0x374436);if(!_0x269a0b)throw CliErrors[_0x734da0(0xcb)](_0x734da0(0xe4));if(!_0x1a17f6){const _0x49e743=Object[_0x734da0(0xb0)](_0x269a0b);if(_0x49e743[_0x734da0(0xb7)]===0x0)console[_0x734da0(0xe1)](_0x734da0(0xda));else{console[_0x734da0(0xe1)](_0x734da0(0xb4));for(const _0x52e247 of _0x49e743){console['log'](_0x734da0(0xd8)+_0x52e247);}console['log'](_0x734da0(0xc1)+CLI_BIN_NAME+_0x734da0(0xc6));}return{'ok':!![]};}if(!_0x269a0b[_0x1a17f6])throw CliErrors[_0x734da0(0xcb)]('Script\x20\x22'+_0x1a17f6+_0x734da0(0xbf),_0x734da0(0xc0)+(Object[_0x734da0(0xb0)](_0x269a0b)[_0x734da0(0xdf)](',\x20')||_0x734da0(0xbd)));const _0x216197=detectPackageManager(_0x374436);VERSION_CHECK_SCRIPTS[_0x734da0(0xca)](_0x1a17f6)&&await versionCheck(_0x374436);if(_0x1a17f6==='preview'&&_0x34ffcb['bool'](_0x734da0(0xb1)))return await Promise['all']([spawnViteBuildWatch(_0x374436),spawnVitePreview(_0x374436)]),{'ok':!![]};return await spawnScript(_0x216197,_0x1a17f6,_0x59762c,_0x374436),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a149_0x14bc25=a149_0x4ebe;(function(_0x504a04,_0x4d1c1f){const _0x466186=a149_0x4ebe,_0x2fcf41=_0x504a04();while(!![]){try{const _0x5df4c9=parseInt(_0x466186(0x147))/0x1*(parseInt(_0x466186(0x14b))/0x2)+-parseInt(_0x466186(0x143))/0x3*(parseInt(_0x466186(0x13f))/0x4)+parseInt(_0x466186(0x14c))/0x5*(parseInt(_0x466186(0x146))/0x6)+-parseInt(_0x466186(0x140))/0x7+-parseInt(_0x466186(0x145))/0x8*(-parseInt(_0x466186(0x148))/0x9)+-parseInt(_0x466186(0x149))/0xa*(parseInt(_0x466186(0x141))/0xb)+parseInt(_0x466186(0x14a))/0xc;if(_0x5df4c9===_0x4d1c1f)break;else _0x2fcf41['push'](_0x2fcf41['shift']());}catch(_0x5f2937){_0x2fcf41['push'](_0x2fcf41['shift']());}}}(a149_0x408b,0x7ba2b));function a149_0x4ebe(_0x29bb18,_0x2d5cc4){_0x29bb18=_0x29bb18-0x13e;const _0x408b00=a149_0x408b();let _0x4ebe99=_0x408b00[_0x29bb18];return _0x4ebe99;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x467c2b){const _0x569404=await buildSchemaPayload();return{'ok':!![],'data':_0x569404};}function a149_0x408b(){const _0x265dba=['1631510AsJpUo','10856592tkkHgg','390686CzqlNF','27070qXflbi','schema','116664pPAEJL','5615078yIRodq','11uqSrlV','export','78ivkWbY','json','120dfmCPw','492ESGXjh','1GXaGwJ','411615kSfOqo'];a149_0x408b=function(){return _0x265dba;};return a149_0x408b();}export const schemaDefinition={'service':a149_0x14bc25(0x13e),'command':a149_0x14bc25(0x142),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a149_0x14bc25(0x144),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a150_0x188c14=a150_0x97ee;(function(_0x326162,_0x1de628){const _0x3f24f6=a150_0x97ee,_0x1485a3=_0x326162();while(!![]){try{const _0x474c7c=-parseInt(_0x3f24f6(0x1fc))/0x1*(parseInt(_0x3f24f6(0x1d7))/0x2)+parseInt(_0x3f24f6(0x1f3))/0x3+parseInt(_0x3f24f6(0x1f7))/0x4+-parseInt(_0x3f24f6(0x1f4))/0x5+-parseInt(_0x3f24f6(0x1e3))/0x6*(-parseInt(_0x3f24f6(0x1c6))/0x7)+-parseInt(_0x3f24f6(0x1e0))/0x8+-parseInt(_0x3f24f6(0x200))/0x9*(parseInt(_0x3f24f6(0x1e7))/0xa);if(_0x474c7c===_0x1de628)break;else _0x1485a3['push'](_0x1485a3['shift']());}catch(_0x547869){_0x1485a3['push'](_0x1485a3['shift']());}}}(a150_0x180c,0xb2634));import{writeFile}from'node:fs/promises';function a150_0x97ee(_0x2fad55,_0x3d189d){_0x2fad55=_0x2fad55-0x1bf;const _0x180ccc=a150_0x180c();let _0x97eef9=_0x180ccc[_0x2fad55];return _0x97eef9;}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(_0x23c331){const _0x33a081=a150_0x97ee;if(_0x23c331===_0x33a081(0x1d8))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x33a081(0x1cc),_0x33a081(0x1ca),''][_0x33a081(0x1ff)]('\x0a');return[_0x33a081(0x1f8),'']['join']('\x0a');}export const sqlCreate={'service':a150_0x188c14(0x1fb),'command':'create','description':a150_0x188c14(0x1f6),'risk':a150_0x188c14(0x1f5),'flags':[{'name':a150_0x188c14(0x1de),'type':a150_0x188c14(0x1d3),'description':a150_0x188c14(0x1ec)},{'name':a150_0x188c14(0x204),'type':'number','description':a150_0x188c14(0x1d9)},{'name':'mode','type':a150_0x188c14(0x1d3),'enum':[a150_0x188c14(0x1fb),a150_0x188c14(0x1d8)],'description':a150_0x188c14(0x1df)}],async 'validate'(_0x2231f6){const _0x4b756a=a150_0x188c14;if(!_0x2231f6[_0x4b756a(0x1fe)])return;if(!_0x2231f6[_0x4b756a(0x1dc)]('name')[_0x4b756a(0x1eb)]())throw CliErrors[_0x4b756a(0x1cb)]('name',_0x4b756a(0x1e1));const _0x133d1b=resolveProvidedDbId(_0x2231f6);if(typeof _0x133d1b!==_0x4b756a(0x1f9)||!Number[_0x4b756a(0x1c3)](_0x133d1b)||_0x133d1b<=0x0)throw CliErrors[_0x4b756a(0x1cb)]('db-id',_0x4b756a(0x202));if(!_0x2231f6['str'](_0x4b756a(0x1d4))[_0x4b756a(0x1eb)]())throw CliErrors[_0x4b756a(0x1cb)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x1e73d0){const _0x5e00da=a150_0x188c14,_0x3d88ba=loadSqlProjectConfig(_0x1e73d0[_0x5e00da(0x1fd)]),{sqlName:_0x4ac00d,dbId:_0x2a50a3,dbName:_0x28d7ab,mode:_0x122e49}=await resolveSqlNewInputs(_0x1e73d0),_0x216685=buildSqlRelativePath(_0x5e00da(0x1e8),_0x4ac00d,_0x28d7ab,_0x122e49,_0x2a50a3),_0x45f51b=_0x3d88ba['sqlRootDir']+'/'+_0x216685;return{'method':_0x5e00da(0x1f0),'url':_0x5e00da(0x1e5),'body':{'appCode':_0x1e73d0[_0x5e00da(0x1fd)],'sqlName':_0x4ac00d,'dbId':_0x2a50a3,'mode':_0x122e49,'localPath':_0x45f51b},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x3d88ba[_0x5e00da(0x1e9)]};},async 'execute'(_0x4ad6bc){const _0x1772c1=a150_0x188c14,_0x3739a8=loadSqlProjectConfig(_0x4ad6bc['appCode']),{sqlName:_0xaf047a,dbId:_0x58be28,dbName:_0xd47d82,mode:_0x51fc47}=await resolveSqlNewInputs(_0x4ad6bc),_0x1830d9=generateSqlTemplate(_0x51fc47),_0x5e10e6=await createSqlQuery({'appCode':_0x4ad6bc[_0x1772c1(0x1fd)],'sqlName':_0xaf047a,'dbId':_0x58be28,'sqlContent':_0x1830d9}),_0xff9e2b=ensureRemoteSqlContent(_0x5e10e6),_0x53576a=_0xd47d82||await getDbName(_0x4ad6bc[_0x1772c1(0x1fd)],_0x58be28)[_0x1772c1(0x1ef)](()=>undefined),_0x3d1c44=buildSqlRelativePath(_0x5e10e6[_0x1772c1(0x205)],_0x5e10e6[_0x1772c1(0x1fa)],_0x53576a,_0x51fc47,_0x58be28),_0x284e1d=_0x3739a8[_0x1772c1(0x1e9)]+'/'+_0x3d1c44,_0x3abe13=buildLocalSqlFileContent({'sqlCode':_0x5e10e6[_0x1772c1(0x205)],'sqlName':_0x5e10e6[_0x1772c1(0x1fa)],'dbId':_0x5e10e6[_0x1772c1(0x1d0)]},_0xff9e2b,{'dbName':_0x53576a,'mode':_0x51fc47,'syncedAt':new Date()['toISOString'](),'description':_0x5e10e6[_0x1772c1(0x1c1)]});if(await fileExists(_0x284e1d))throw CliErrors[_0x1772c1(0x1c0)]('File\x20already\x20exists:\x20'+_0x284e1d);await ensureParentDirectory(_0x284e1d),await writeFile(_0x284e1d,_0x3abe13,_0x1772c1(0x1ea));const _0x430b28=await readSqlLockFile(_0x3739a8[_0x1772c1(0x1ed)]),{lockData:_0x561c7f,appLock:_0x276014}=ensureSqlLockScope(_0x430b28??createEmptySqlLock(),_0x3739a8[_0x1772c1(0x1fd)],_0x3739a8[_0x1772c1(0x1ee)],_0x1772c1(0x201));return _0x276014[_0x1772c1(0x1dd)][_0x5e10e6['sqlCode']]={...buildSqlLockEntry(_0x5e10e6,_0xff9e2b,computeSqlContentHash(_0x3abe13),{'dbName':_0x53576a}),'path':_0x3d1c44,'mode':_0x51fc47},_0x276014[_0x1772c1(0x1bf)]=new Date()[_0x1772c1(0x1c4)](),await writeSqlLockFile(_0x3739a8[_0x1772c1(0x1ed)],_0x561c7f),{'ok':!![],'data':{'id':_0x5e10e6['id'],'sqlCode':_0x5e10e6['sqlCode'],'sqlName':_0x5e10e6[_0x1772c1(0x1fa)],'dbId':_0x5e10e6[_0x1772c1(0x1d0)],'path':_0x284e1d,'mode':_0x51fc47},'message':_0x1772c1(0x206)+_0x5e10e6[_0x1772c1(0x205)]};}};async function resolveSqlNewInputs(_0x47ba7f){const _0x367732=await resolveSqlNameInput(_0x47ba7f),{dbId:_0xb45f03,dbName:_0x1a1459}=await resolveDbSelection(_0x47ba7f),_0x477e37=await resolveSqlModeInput(_0x47ba7f);return{'sqlName':_0x367732,'dbId':_0xb45f03,'dbName':_0x1a1459,'mode':_0x477e37};}async function resolveSqlNameInput(_0x154642){const _0x4bd189=a150_0x188c14,_0x141873=_0x154642[_0x4bd189(0x1dc)](_0x4bd189(0x1de))[_0x4bd189(0x1eb)]();if(_0x141873)return _0x141873;if(_0x154642[_0x4bd189(0x1fe)])throw CliErrors[_0x4bd189(0x1cb)](_0x4bd189(0x1de),_0x4bd189(0x1e1));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x747119=>_0x747119[_0x4bd189(0x1eb)]()?!![]:_0x4bd189(0x1e4)}))[_0x4bd189(0x1eb)]();}function a150_0x180c(){const _0x250983=['适合带动态标签的\x20MyBatis\x20XML\x20SQL','138338djtZFo','mybatisXml','Target\x20database\x20ID','__manual__','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','str','sqls','name','Local\x20SQL\x20file\x20mode','1853696ODRlLn','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','请选择目标数据库:','2299182jEFxlO','SQL\x20名称不能为空','/smartapi/custom/saveUserCustomSql','dbId\x20必须为正整数','250xyuTji','<server-generated-sqlCode>','sqlRootDir','utf8','trim','SQL\x20query\x20display\x20name','lockFilePath','sqlRoot','catch','POST','stringify','parse','1092309zqkTcV','829910hudanH','high-risk-write','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','5681120ERzEIN','SELECT\x201\x20AS\x20id;','number','sqlName','sql','15UyAiNq','appCode','nonInteractive','join','603coCSDw','new','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20不能为空','db-id','sqlCode','Created\x20SQL\x20query\x20','lastSync','validation','description','请选择本地\x20SQL\x20模式:','isFinite','toISOString','Invalid\x20database\x20selection\x20payload:\x20','7UzdoRD','dbName','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','length','</select>','flagMissing','\x20\x20SELECT\x201\x20AS\x20id','isInteger','请输入目标数据库\x20dbId:','map','dbId','普通\x20SQL(sql)','flag','string','mode','MyBatis\x20XML(mybatisXml)'];a150_0x180c=function(){return _0x250983;};return a150_0x180c();}async function resolveDbSelection(_0x532401){const _0x4093ac=a150_0x188c14,_0x29252b=resolveProvidedDbId(_0x532401);if(typeof _0x29252b===_0x4093ac(0x1f9)&&Number['isFinite'](_0x29252b)&&_0x29252b>0x0)return{'dbId':_0x29252b,'dbName':await getDbName(_0x532401['appCode'],_0x29252b)[_0x4093ac(0x1ef)](()=>undefined)};if(_0x532401[_0x4093ac(0x1fe)])throw CliErrors[_0x4093ac(0x1cb)](_0x4093ac(0x204),_0x4093ac(0x202));const _0x6165aa=await listDatabases(_0x532401[_0x4093ac(0x1fd)])[_0x4093ac(0x1ef)](()=>[]);if(_0x6165aa['length']===0x1)return{'dbId':_0x6165aa[0x0]['dbId'],'dbName':_0x6165aa[0x0][_0x4093ac(0x1c7)]};if(_0x6165aa[_0x4093ac(0x1c9)]>0x1){const _0x3c5fed=await select({'message':_0x4093ac(0x1e2),'choices':[..._0x6165aa[_0x4093ac(0x1cf)](_0x4cc20b=>({'name':_0x4cc20b[_0x4093ac(0x1c7)]+'\x20('+_0x4cc20b[_0x4093ac(0x1d0)]+')','value':serializeDbSelection(_0x4cc20b)})),{'name':'✎\x20手动输入\x20dbId','value':_0x4093ac(0x1da)}]});if(_0x3c5fed!=='__manual__')return deserializeDbSelection(_0x3c5fed);}const _0x34bbd8=await input({'message':_0x4093ac(0x1ce),'validate':_0x5dfaf8=>{const _0x150392=_0x4093ac,_0x1450ce=_0x5dfaf8[_0x150392(0x1eb)]();if(!_0x1450ce)return _0x150392(0x203);const _0x3f1029=Number(_0x1450ce);if(!Number[_0x150392(0x1cd)](_0x3f1029)||_0x3f1029<=0x0)return _0x150392(0x1e6);return!![];}});return{'dbId':Number(_0x34bbd8[_0x4093ac(0x1eb)]())};}async function resolveSqlModeInput(_0x15671f){const _0xaa2edc=a150_0x188c14,_0x58cfb0=_0x15671f[_0xaa2edc(0x1dc)](_0xaa2edc(0x1d4))['trim']();if(_0x58cfb0==='sql'||_0x58cfb0===_0xaa2edc(0x1d8))return _0x58cfb0;if(_0x15671f[_0xaa2edc(0x1fe)])throw CliErrors[_0xaa2edc(0x1cb)]('mode',_0xaa2edc(0x1db));return await select({'message':_0xaa2edc(0x1c2),'choices':[{'name':_0xaa2edc(0x1d1),'value':_0xaa2edc(0x1fb),'description':_0xaa2edc(0x1c8)},{'name':_0xaa2edc(0x1d5),'value':_0xaa2edc(0x1d8),'description':_0xaa2edc(0x1d6)}]});}function serializeDbSelection(_0x13c51d){const _0xce856b=a150_0x188c14;return JSON[_0xce856b(0x1f1)]({'dbId':_0x13c51d[_0xce856b(0x1d0)],'dbName':_0x13c51d[_0xce856b(0x1c7)]});}function deserializeDbSelection(_0x21d757){const _0x1da942=a150_0x188c14;try{const _0x924420=JSON[_0x1da942(0x1f2)](_0x21d757);if(typeof _0x924420[_0x1da942(0x1d0)]===_0x1da942(0x1f9)&&Number[_0x1da942(0x1c3)](_0x924420[_0x1da942(0x1d0)]))return{'dbId':_0x924420[_0x1da942(0x1d0)],'dbName':_0x924420[_0x1da942(0x1c7)]};}catch{}throw CliErrors[_0x1da942(0x1c0)](_0x1da942(0x1c5)+_0x21d757);}function resolveProvidedDbId(_0x1877cd){const _0x5ac82d=a150_0x188c14,_0x2e6a47=_0x1877cd[_0x5ac82d(0x1d2)](_0x5ac82d(0x204));if(typeof _0x2e6a47===_0x5ac82d(0x1f9)&&Number[_0x5ac82d(0x1c3)](_0x2e6a47))return _0x2e6a47;return undefined;}
|
|
1
|
+
const a150_0x2a8dcd=a150_0x11cd;(function(_0x17af07,_0x37d403){const _0x17adc1=a150_0x11cd,_0x527730=_0x17af07();while(!![]){try{const _0x4ef1cc=parseInt(_0x17adc1(0x172))/0x1*(parseInt(_0x17adc1(0x17d))/0x2)+parseInt(_0x17adc1(0x17b))/0x3+parseInt(_0x17adc1(0x18e))/0x4+-parseInt(_0x17adc1(0x171))/0x5*(-parseInt(_0x17adc1(0x153))/0x6)+-parseInt(_0x17adc1(0x186))/0x7*(-parseInt(_0x17adc1(0x15a))/0x8)+-parseInt(_0x17adc1(0x189))/0x9*(parseInt(_0x17adc1(0x173))/0xa)+-parseInt(_0x17adc1(0x178))/0xb;if(_0x4ef1cc===_0x37d403)break;else _0x527730['push'](_0x527730['shift']());}catch(_0x5c6668){_0x527730['push'](_0x527730['shift']());}}}(a150_0x2623,0xc2da3));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';function a150_0x11cd(_0x42454c,_0x2c0d20){_0x42454c=_0x42454c-0x152;const _0x26235d=a150_0x2623();let _0x11cdbf=_0x26235d[_0x42454c];return _0x11cdbf;}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';function a150_0x2623(){const _0x19b8a7=['sqlName','1989808jTEuzj','请选择目标数据库:','validation','isFinite','number','utf8','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','普通\x20SQL(sql)','name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','join','dbName','appCode','string','Target\x20database\x20ID','description','/smartapi/custom/saveUserCustomSql','请输入目标数据库\x20dbId:','str','create','dbId\x20不能为空','isInteger','195iirEqP','3uhvIvu','10IwAjls','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','__manual__','17609163qnyYbU','lockFilePath','flagMissing','630414bNQUrM','nonInteractive','371386JvuxhX','MyBatis\x20XML(mybatisXml)','Local\x20SQL\x20file\x20mode','lastSync','stringify','SELECT\x201\x20AS\x20id;','sqlRootDir','length','mode','7XmzbtJ','trim','high-risk-write','2428209rKXrfe','File\x20already\x20exists:\x20','toISOString','SQL\x20query\x20display\x20name','parse','4217092TezPGu','dbId','db-id','dbId\x20必须为正整数','✎\x20手动输入\x20dbId','sql','\x20\x20SELECT\x201\x20AS\x20id','catch','92082YxvFZW','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','map','mybatisXml','new'];a150_0x2623=function(){return _0x19b8a7;};return a150_0x2623();}import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3d9050){const _0x582d35=a150_0x11cd;if(_0x3d9050==='mybatisXml')return[_0x582d35(0x160),_0x582d35(0x194),'</select>',''][_0x582d35(0x165)]('\x0a');return[_0x582d35(0x182),'']['join']('\x0a');}export const sqlCreate={'service':a150_0x2a8dcd(0x193),'command':a150_0x2a8dcd(0x16e),'description':a150_0x2a8dcd(0x176),'risk':a150_0x2a8dcd(0x188),'flags':[{'name':a150_0x2a8dcd(0x163),'type':'string','description':a150_0x2a8dcd(0x18c)},{'name':a150_0x2a8dcd(0x190),'type':'number','description':a150_0x2a8dcd(0x169)},{'name':a150_0x2a8dcd(0x185),'type':a150_0x2a8dcd(0x168),'enum':['sql',a150_0x2a8dcd(0x157)],'description':a150_0x2a8dcd(0x17f)}],async 'validate'(_0x3246b){const _0x3dea19=a150_0x2a8dcd;if(!_0x3246b[_0x3dea19(0x17c)])return;if(!_0x3246b[_0x3dea19(0x16d)](_0x3dea19(0x163))[_0x3dea19(0x187)]())throw CliErrors[_0x3dea19(0x17a)]('name',_0x3dea19(0x164));const _0x52352d=resolveProvidedDbId(_0x3246b);if(typeof _0x52352d!==_0x3dea19(0x15e)||!Number['isFinite'](_0x52352d)||_0x52352d<=0x0)throw CliErrors[_0x3dea19(0x17a)]('db-id',_0x3dea19(0x154));if(!_0x3246b['str']('mode')['trim']())throw CliErrors[_0x3dea19(0x17a)](_0x3dea19(0x185),_0x3dea19(0x174));},async 'dryRun'(_0x35ac0a){const _0x39b348=a150_0x2a8dcd,_0x24be9e=loadSqlProjectConfig(_0x35ac0a[_0x39b348(0x167)]),{sqlName:_0x3357de,dbId:_0x39c9d3,dbName:_0x57ef0,mode:_0x54bedc}=await resolveSqlNewInputs(_0x35ac0a),_0xa7b31a=buildSqlRelativePath('<server-generated-sqlCode>',_0x3357de,_0x57ef0,_0x54bedc,_0x39c9d3),_0x364db5=_0x24be9e[_0x39b348(0x183)]+'/'+_0xa7b31a;return{'method':'POST','url':_0x39b348(0x16b),'body':{'appCode':_0x35ac0a[_0x39b348(0x167)],'sqlName':_0x3357de,'dbId':_0x39c9d3,'mode':_0x54bedc,'localPath':_0x364db5},'description':_0x39b348(0x161)+_0x24be9e[_0x39b348(0x183)]};},async 'execute'(_0x39e316){const _0x1841b3=a150_0x2a8dcd,_0x4e6ff5=loadSqlProjectConfig(_0x39e316['appCode']),{sqlName:_0x187fb8,dbId:_0x5a33d5,dbName:_0x2b888d,mode:_0x32c66f}=await resolveSqlNewInputs(_0x39e316),_0x33305e=generateSqlTemplate(_0x32c66f),_0x39f969=await createSqlQuery({'appCode':_0x39e316['appCode'],'sqlName':_0x187fb8,'dbId':_0x5a33d5,'sqlContent':_0x33305e}),_0x1b3205=ensureRemoteSqlContent(_0x39f969),_0x31ebc6=_0x2b888d||await getDbName(_0x39e316[_0x1841b3(0x167)],_0x5a33d5)[_0x1841b3(0x152)](()=>undefined),_0x4cd7b7=buildSqlRelativePath(_0x39f969[_0x1841b3(0x155)],_0x39f969[_0x1841b3(0x159)],_0x31ebc6,_0x32c66f,_0x5a33d5),_0x5a5d89=_0x4e6ff5['sqlRootDir']+'/'+_0x4cd7b7,_0x1bdf7e=buildLocalSqlFileContent({'sqlCode':_0x39f969['sqlCode'],'sqlName':_0x39f969['sqlName'],'dbId':_0x39f969[_0x1841b3(0x18f)]},_0x1b3205,{'dbName':_0x31ebc6,'mode':_0x32c66f,'syncedAt':new Date()[_0x1841b3(0x18b)](),'description':_0x39f969[_0x1841b3(0x16a)]});if(await fileExists(_0x5a5d89))throw CliErrors[_0x1841b3(0x15c)](_0x1841b3(0x18a)+_0x5a5d89);await ensureParentDirectory(_0x5a5d89),await writeFile(_0x5a5d89,_0x1bdf7e,_0x1841b3(0x15f));const _0x2859d5=await readSqlLockFile(_0x4e6ff5[_0x1841b3(0x179)]),{lockData:_0x31a40c,appLock:_0xb66997}=ensureSqlLockScope(_0x2859d5??createEmptySqlLock(),_0x4e6ff5[_0x1841b3(0x167)],_0x4e6ff5['sqlRoot'],_0x1841b3(0x158));return _0xb66997['sqls'][_0x39f969[_0x1841b3(0x155)]]={...buildSqlLockEntry(_0x39f969,_0x1b3205,computeSqlContentHash(_0x1bdf7e),{'dbName':_0x31ebc6}),'path':_0x4cd7b7,'mode':_0x32c66f},_0xb66997[_0x1841b3(0x180)]=new Date()[_0x1841b3(0x18b)](),await writeSqlLockFile(_0x4e6ff5[_0x1841b3(0x179)],_0x31a40c),{'ok':!![],'data':{'id':_0x39f969['id'],'sqlCode':_0x39f969[_0x1841b3(0x155)],'sqlName':_0x39f969['sqlName'],'dbId':_0x39f969['dbId'],'path':_0x5a5d89,'mode':_0x32c66f},'message':'Created\x20SQL\x20query\x20'+_0x39f969[_0x1841b3(0x155)]};}};async function resolveSqlNewInputs(_0x5bce52){const _0x5ae605=await resolveSqlNameInput(_0x5bce52),{dbId:_0x5f3b51,dbName:_0x34eaf2}=await resolveDbSelection(_0x5bce52),_0x3a42b2=await resolveSqlModeInput(_0x5bce52);return{'sqlName':_0x5ae605,'dbId':_0x5f3b51,'dbName':_0x34eaf2,'mode':_0x3a42b2};}async function resolveSqlNameInput(_0x532d1f){const _0x6817d1=a150_0x2a8dcd,_0x9db41e=_0x532d1f[_0x6817d1(0x16d)](_0x6817d1(0x163))[_0x6817d1(0x187)]();if(_0x9db41e)return _0x9db41e;if(_0x532d1f['nonInteractive'])throw CliErrors[_0x6817d1(0x17a)](_0x6817d1(0x163),_0x6817d1(0x164));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x11c6f0=>_0x11c6f0['trim']()?!![]:'SQL\x20名称不能为空'}))[_0x6817d1(0x187)]();}async function resolveDbSelection(_0x7e60fd){const _0x456236=a150_0x2a8dcd,_0x3cb1bb=resolveProvidedDbId(_0x7e60fd);if(typeof _0x3cb1bb===_0x456236(0x15e)&&Number[_0x456236(0x15d)](_0x3cb1bb)&&_0x3cb1bb>0x0)return{'dbId':_0x3cb1bb,'dbName':await getDbName(_0x7e60fd[_0x456236(0x167)],_0x3cb1bb)[_0x456236(0x152)](()=>undefined)};if(_0x7e60fd['nonInteractive'])throw CliErrors[_0x456236(0x17a)](_0x456236(0x190),_0x456236(0x154));const _0x294a6a=await listDatabases(_0x7e60fd[_0x456236(0x167)])[_0x456236(0x152)](()=>[]);if(_0x294a6a[_0x456236(0x184)]===0x1)return{'dbId':_0x294a6a[0x0]['dbId'],'dbName':_0x294a6a[0x0][_0x456236(0x166)]};if(_0x294a6a[_0x456236(0x184)]>0x1){const _0x5c7d2a=await select({'message':_0x456236(0x15b),'choices':[..._0x294a6a[_0x456236(0x156)](_0x420ab4=>({'name':_0x420ab4['dbName']+'\x20('+_0x420ab4[_0x456236(0x18f)]+')','value':serializeDbSelection(_0x420ab4)})),{'name':_0x456236(0x192),'value':_0x456236(0x177)}]});if(_0x5c7d2a!=='__manual__')return deserializeDbSelection(_0x5c7d2a);}const _0x2583be=await input({'message':_0x456236(0x16c),'validate':_0x4d046c=>{const _0x244f74=_0x456236,_0x2cf962=_0x4d046c[_0x244f74(0x187)]();if(!_0x2cf962)return _0x244f74(0x16f);const _0x2a298e=Number(_0x2cf962);if(!Number[_0x244f74(0x170)](_0x2a298e)||_0x2a298e<=0x0)return _0x244f74(0x191);return!![];}});return{'dbId':Number(_0x2583be[_0x456236(0x187)]())};}async function resolveSqlModeInput(_0x3e2203){const _0x3ff984=a150_0x2a8dcd,_0x59a040=_0x3e2203[_0x3ff984(0x16d)]('mode')[_0x3ff984(0x187)]();if(_0x59a040==='sql'||_0x59a040==='mybatisXml')return _0x59a040;if(_0x3e2203['nonInteractive'])throw CliErrors['flagMissing'](_0x3ff984(0x185),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x3ff984(0x162),'value':_0x3ff984(0x193),'description':_0x3ff984(0x175)},{'name':_0x3ff984(0x17e),'value':'mybatisXml','description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x306b59){const _0x9b0c68=a150_0x2a8dcd;return JSON[_0x9b0c68(0x181)]({'dbId':_0x306b59[_0x9b0c68(0x18f)],'dbName':_0x306b59['dbName']});}function deserializeDbSelection(_0x42a384){const _0x7cc318=a150_0x2a8dcd;try{const _0x283ea0=JSON[_0x7cc318(0x18d)](_0x42a384);if(typeof _0x283ea0[_0x7cc318(0x18f)]===_0x7cc318(0x15e)&&Number[_0x7cc318(0x15d)](_0x283ea0[_0x7cc318(0x18f)]))return{'dbId':_0x283ea0['dbId'],'dbName':_0x283ea0['dbName']};}catch{}throw CliErrors[_0x7cc318(0x15c)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x42a384);}function resolveProvidedDbId(_0x46765b){const _0x33a11d=a150_0x2a8dcd,_0x1359ad=_0x46765b['flag'](_0x33a11d(0x190));if(typeof _0x1359ad===_0x33a11d(0x15e)&&Number[_0x33a11d(0x15d)](_0x1359ad))return _0x1359ad;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a151_0x2bf4ae=a151_0x210a;function a151_0x1e2a(){const _0x4876ac=['delete','52998aHMiZx','Deleted\x20','27mYoVWJ','sqlcode','remoteId','68079rxxUBZ','filter','1864910tcpehR','SQL\x20lock\x20file\x20not\x20found.','4irQwgV','lockFilePath','101750ZHsRbR','toISOString','projectRoot','appCode','sqls','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','4467344IcRJsb','length','sql','5942592BxyByx','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','/smartapi/custom/deleteUserCustomSql','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','14zGlPyA','828JhgFUi','372hSDVHj','sqlRoot','high-risk-write','fromEntries','trashDir','validation','3291339vSsgTs','startsWith','\x20(local\x20file\x20moved\x20to\x20trash)','POST'];a151_0x1e2a=function(){return _0x4876ac;};return a151_0x1e2a();}(function(_0x94546d,_0x37fbf0){const _0x163758=a151_0x210a,_0x26e6bc=_0x94546d();while(!![]){try{const _0x5a4088=parseInt(_0x163758(0x70))/0x1*(-parseInt(_0x163758(0x6e))/0x2)+-parseInt(_0x163758(0x69))/0x3*(-parseInt(_0x163758(0x77))/0x4)+-parseInt(_0x163758(0x75))/0x5+parseInt(_0x163758(0x82))/0x6+-parseInt(_0x163758(0x87))/0x7*(parseInt(_0x163758(0x7f))/0x8)+parseInt(_0x163758(0x88))/0x9*(parseInt(_0x163758(0x79))/0xa)+parseInt(_0x163758(0x73))/0xb*(-parseInt(_0x163758(0x89))/0xc);if(_0x5a4088===_0x37fbf0)break;else _0x26e6bc['push'](_0x26e6bc['shift']());}catch(_0x50d2bf){_0x26e6bc['push'](_0x26e6bc['shift']());}}}(a151_0x1e2a,0x98f3f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a151_0x2bf4ae(0x81),'command':a151_0x2bf4ae(0x6d),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a151_0x2bf4ae(0x65),'flags':[SQLCODE_FLAG],async 'validate'(_0x593555){const _0x57d1d8=a151_0x2bf4ae,_0x108ba1=loadSqlProjectConfig(_0x593555[_0x57d1d8(0x7c)]),_0x120735=await readSqlLockFile(_0x108ba1[_0x57d1d8(0x78)]);if(!_0x120735)throw CliErrors[_0x57d1d8(0x68)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x1a54e7){const _0x119e09=a151_0x2bf4ae,_0x2260be=loadSqlProjectConfig(_0x1a54e7[_0x119e09(0x7c)]),_0x5ef3bb=await readSqlLockFile(_0x2260be[_0x119e09(0x78)]);if(!_0x5ef3bb)throw CliErrors['validation'](_0x119e09(0x86));const {appLock:_0x431873}=ensureSqlLockScope(_0x5ef3bb,_0x1a54e7[_0x119e09(0x7c)],_0x2260be[_0x119e09(0x64)],_0x119e09(0x6d)),_0x52f4d0=_0x1a54e7['str']('sqlcode'),_0x15a471=_0x431873['sqls'][_0x52f4d0];if(!_0x15a471)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x52f4d0+'\x22.');return{'method':_0x119e09(0x6c),'url':_0x119e09(0x84),'body':{'sqlCode':_0x52f4d0,'id':_0x15a471['remoteId'],'localPath':resolveLocalSqlFilePath(_0x2260be,_0x52f4d0,_0x15a471)},'description':_0x119e09(0x85)+_0x52f4d0+_0x119e09(0x83)+_0x2260be[_0x119e09(0x67)]};},async 'execute'(_0x35eb8c){const _0x702cdf=a151_0x2bf4ae,_0x49d6ce=loadSqlProjectConfig(_0x35eb8c['appCode']),_0x56643a=await readSqlLockFile(_0x49d6ce['lockFilePath']);if(!_0x56643a)throw CliErrors['validation'](_0x702cdf(0x76));const {lockData:_0x18e22,appLock:_0x483f60}=ensureSqlLockScope(_0x56643a,_0x35eb8c['appCode'],_0x49d6ce['sqlRoot'],_0x702cdf(0x6d)),_0x1a8cc5=_0x35eb8c['str'](_0x702cdf(0x71)),_0x1bcf3d=_0x483f60[_0x702cdf(0x7d)][_0x1a8cc5];if(!_0x1bcf3d)throw CliErrors[_0x702cdf(0x68)](_0x702cdf(0x7e)+_0x1a8cc5+'\x22.');await deleteSqlQuery({'id':_0x1bcf3d[_0x702cdf(0x72)],'sqlCode':_0x1a8cc5}),_0x483f60[_0x702cdf(0x7d)]=Object[_0x702cdf(0x66)](Object['entries'](_0x483f60['sqls'])[_0x702cdf(0x74)](([_0x556070])=>_0x556070!==_0x1a8cc5)),_0x483f60['lastSync']=new Date()[_0x702cdf(0x7a)](),await writeSqlLockFile(_0x49d6ce[_0x702cdf(0x78)],_0x18e22);const _0x481faa=resolveLocalSqlFilePath(_0x49d6ce,_0x1a8cc5,_0x1bcf3d);let _0x82fda0;await fileExists(_0x481faa)&&(_0x82fda0=await moveToTrash(_0x49d6ce[_0x702cdf(0x7b)],_0x49d6ce[_0x702cdf(0x67)],_0x481faa),await cleanupEmptyDirectories(dirname(_0x481faa),_0x49d6ce['sqlRootDir']));const _0x17de7b={'deleted':_0x1a8cc5,'remoteId':_0x1bcf3d['remoteId']};if(_0x82fda0)_0x17de7b['trashedTo']=_0x82fda0;return{'ok':!![],'data':_0x17de7b,'message':_0x702cdf(0x6f)+_0x1a8cc5+(_0x82fda0?_0x702cdf(0x6b):'')};}};async function moveToTrash(_0x7cc14f,_0x491389,_0x8b1c61){const _0x2a76a8=a151_0x2bf4ae,_0x19d148=new Date()[_0x2a76a8(0x7a)]()['replace'](/[:.]/g,'-'),_0x34f027=relative(_0x7cc14f,_0x8b1c61),_0x39e1b5=join(_0x491389,_0x19d148,_0x34f027);return await mkdir(dirname(_0x39e1b5),{'recursive':!![]}),await rename(_0x8b1c61,_0x39e1b5),_0x39e1b5;}function a151_0x210a(_0x440a1e,_0x47f69a){_0x440a1e=_0x440a1e-0x64;const _0x1e2a2f=a151_0x1e2a();let _0x210a91=_0x1e2a2f[_0x440a1e];return _0x210a91;}async function cleanupEmptyDirectories(_0x433420,_0x401598){const _0x4f385d=a151_0x2bf4ae;let _0x22ca32=resolve(_0x433420);const _0x4aea4a=resolve(_0x401598);while(_0x22ca32[_0x4f385d(0x6a)](''+_0x4aea4a+sep)||_0x22ca32===_0x4aea4a){if(_0x22ca32===_0x4aea4a)return;try{const _0x42646f=await readdir(_0x22ca32);if(_0x42646f[_0x4f385d(0x80)]>0x0)return;await rmdir(_0x22ca32);}catch{return;}_0x22ca32=dirname(_0x22ca32);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a152_0x2e82b4=a152_0xcac7;(function(_0x1f3aa7,_0x5a6892){const _0x4d6730=a152_0xcac7,_0x337aaf=_0x1f3aa7();while(!![]){try{const _0xf46a97=parseInt(_0x4d6730(0x7f))/0x1+-parseInt(_0x4d6730(0x77))/0x2+parseInt(_0x4d6730(0x87))/0x3+-parseInt(_0x4d6730(0x85))/0x4+parseInt(_0x4d6730(0x82))/0x5*(-parseInt(_0x4d6730(0x79))/0x6)+-parseInt(_0x4d6730(0x81))/0x7+parseInt(_0x4d6730(0x88))/0x8;if(_0xf46a97===_0x5a6892)break;else _0x337aaf['push'](_0x337aaf['shift']());}catch(_0x51f141){_0x337aaf['push'](_0x337aaf['shift']());}}}(a152_0xb11f,0x78018));function a152_0xcac7(_0x155164,_0x3e0694){_0x155164=_0x155164-0x75;const _0xb11f2f=a152_0xb11f();let _0xcac7af=_0xb11f2f[_0x155164];return _0xcac7af;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a152_0x2e82b4(0x78),'command':a152_0x2e82b4(0x80),'description':a152_0x2e82b4(0x83),'risk':a152_0x2e82b4(0x75),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a152_0x2e82b4(0x7c),'description':a152_0x2e82b4(0x7b)}],async 'execute'(_0x24d9da){const _0x2b619f=a152_0x2e82b4,_0x181958=await getSqlQueryInfo(_0x24d9da['appCode'],_0x24d9da['str']('sqlcode')),_0xc0e9d6=_0x24d9da[_0x2b619f(0x86)]('verbose');if(_0xc0e9d6)return{'ok':!![],'data':_0x181958};const _0x5b3238=_0x181958['dbId']?await getDbName(_0x24d9da[_0x2b619f(0x84)],_0x181958[_0x2b619f(0x7a)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x181958[_0x2b619f(0x7e)],'sqlName':_0x181958[_0x2b619f(0x7d)],'db':_0x5b3238?_0x5b3238+'\x20('+_0x181958[_0x2b619f(0x7a)]+')':_0x181958[_0x2b619f(0x7a)]??'','description':_0x181958['description']??'','sqlContent':_0x181958[_0x2b619f(0x76)]??''}};}};function a152_0xb11f(){const _0x1ce6e8=['read','sqlContent','739658maRdIq','sql','30YcSLEu','dbId','Return\x20full\x20raw\x20SQL\x20query\x20object','boolean','sqlName','sqlCode','459419IJdinM','detail','5099402lkVKuM','345885oridXp','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','3585300oVwyTH','bool','700815tlRDVK','17112360znpzbT'];a152_0xb11f=function(){return _0x1ce6e8;};return a152_0xb11f();}
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a153_0x3d3c37=a153_0x6392;(function(_0x4765e0,_0xeece3d){const _0x3e7560=a153_0x6392,_0x1bf50d=_0x4765e0();while(!![]){try{const _0x498cb5=parseInt(_0x3e7560(0x1e9))/0x1*(-parseInt(_0x3e7560(0x1e4))/0x2)+-parseInt(_0x3e7560(0x1f0))/0x3*(-parseInt(_0x3e7560(0x1f5))/0x4)+parseInt(_0x3e7560(0x1e5))/0x5+parseInt(_0x3e7560(0x1f7))/0x6*(parseInt(_0x3e7560(0x1f6))/0x7)+parseInt(_0x3e7560(0x1f4))/0x8*(-parseInt(_0x3e7560(0x1e7))/0x9)+parseInt(_0x3e7560(0x1f2))/0xa+parseInt(_0x3e7560(0x1de))/0xb;if(_0x498cb5===_0xeece3d)break;else _0x1bf50d['push'](_0x1bf50d['shift']());}catch(_0xc12df3){_0x1bf50d['push'](_0x1bf50d['shift']());}}}(a153_0x4162,0xbf400));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a153_0x4162(){const _0x42bc6f=['SQL\x20execution\x20failed','execResult','Returned\x20','1101NNosaJ','execError','1797050nzwvJx','read','304nKxgKr','16600uOCrDm','23786MeXhzm','504iaFNGH','8112324SvZtHn','now','exec','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','string','length','4oRtQXW','4789765BoBkVj','isArray','338283WGoKsW','params','735979kOKmuF','sqlcode','\x20row(s)\x20in\x20','str'];a153_0x4162=function(){return _0x42bc6f;};return a153_0x4162();}function a153_0x6392(_0x3ec6da,_0x307b3f){_0x3ec6da=_0x3ec6da-0x1de;const _0x416249=a153_0x4162();let _0x6392d9=_0x416249[_0x3ec6da];return _0x6392d9;}export const sqlExec={'service':'sql','command':a153_0x3d3c37(0x1e0),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a153_0x3d3c37(0x1f3),'flags':[SQLCODE_FLAG,{'name':a153_0x3d3c37(0x1e8),'type':a153_0x3d3c37(0x1e2),'description':a153_0x3d3c37(0x1e1)}],async 'execute'(_0xd892e5){const _0x3e2b1b=a153_0x3d3c37,_0xfa7781=parseJsonParams(_0xd892e5[_0x3e2b1b(0x1ec)](_0x3e2b1b(0x1e8))),_0x42e2ad=Date[_0x3e2b1b(0x1df)](),_0x22fd2e=await executeSql(_0xd892e5['appCode'],_0xd892e5[_0x3e2b1b(0x1ec)](_0x3e2b1b(0x1ea)),_0xfa7781),_0x35cd8f=Date[_0x3e2b1b(0x1df)]()-_0x42e2ad,_0x2be5c9=_0x22fd2e?.[_0x3e2b1b(0x1ee)]??_0x22fd2e,_0x256e5e=_0x22fd2e?.['execSuccess']??!![];if(!_0x256e5e)return{'ok':![],'data':{'error':_0x22fd2e?.[_0x3e2b1b(0x1f1)]||_0x3e2b1b(0x1ed),'elapsed':_0x35cd8f},'message':'SQL\x20execution\x20failed'};const _0x253055=Array[_0x3e2b1b(0x1e6)](_0x2be5c9)?_0x2be5c9:[];return{'ok':!![],'data':{'rows':_0x253055,'rowCount':_0x253055[_0x3e2b1b(0x1e3)],'elapsed':_0x35cd8f},'message':_0x3e2b1b(0x1ef)+_0x253055['length']+_0x3e2b1b(0x1eb)+_0x35cd8f+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ecf22,_0x37e405){const _0x121762=a154_0x2f5c,_0x3bc9c6=_0x3ecf22();while(!![]){try{const _0x2ea3b2=parseInt(_0x121762(0x159))/0x1+parseInt(_0x121762(0x158))/0x2*(parseInt(_0x121762(0x156))/0x3)+parseInt(_0x121762(0x153))/0x4*(-parseInt(_0x121762(0x151))/0x5)+-parseInt(_0x121762(0x152))/0x6+parseInt(_0x121762(0x154))/0x7+parseInt(_0x121762(0x157))/0x8+-parseInt(_0x121762(0x155))/0x9;if(_0x2ea3b2===_0x37e405)break;else _0x3bc9c6['push'](_0x3bc9c6['shift']());}catch(_0x50f540){_0x3bc9c6['push'](_0x3bc9c6['shift']());}}}(a154_0x5c47,0xb4719));import{sqlList}from'../../commands/sql/list.js';function a154_0x2f5c(_0x146829,_0x4beb48){_0x146829=_0x146829-0x151;const _0x5c4753=a154_0x5c47();let _0x2f5c45=_0x5c4753[_0x146829];return _0x2f5c45;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a154_0x5c47(){const _0x34a5ce=['4876930NhSxKE','3468744fbJdVJ','4qqscWY','7806246MtkHhz','9594072hLAcWe','33729xULjsG','2989496PJslXo','142frnwBx','1071497hSaYbl'];a154_0x5c47=function(){return _0x34a5ce;};return a154_0x5c47();}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x1476d9=a155_0x45ba;(function(_0x1d9236,_0x12db25){const _0x211ca6=a155_0x45ba,_0x3d3526=_0x1d9236();while(!![]){try{const _0x44f505=-parseInt(_0x211ca6(0x18a))/0x1+-parseInt(_0x211ca6(0x18f))/0x2*(-parseInt(_0x211ca6(0x182))/0x3)+parseInt(_0x211ca6(0x19f))/0x4+-parseInt(_0x211ca6(0x194))/0x5+parseInt(_0x211ca6(0x18d))/0x6+parseInt(_0x211ca6(0x193))/0x7+-parseInt(_0x211ca6(0x18e))/0x8*(parseInt(_0x211ca6(0x199))/0x9);if(_0x44f505===_0x12db25)break;else _0x3d3526['push'](_0x3d3526['shift']());}catch(_0x5157cd){_0x3d3526['push'](_0x3d3526['shift']());}}}(a155_0x23a6,0x633f8));import{listSqlQueries}from'../../core/api-client.js';function a155_0x23a6(){const _0x14bc03=['boolean','tableData','dbId','page','27369KNQOZI','sqlName','read','str','pagesize','totalCount','1352112YgxFIZ','appCode','name','length','58728EBhRjd','No\x20custom\x20SQL\x20queries\x20found.','sqlcode','string','Page\x20number','num','Page\x20size','description','100945PzhcPd','Filter\x20by\x20SQL\x20name','Found\x20','3840162MUdMAZ','2360rWbhuf','54GOPpDy','list','sqlCode','\x20SQL\x20queries\x20(total:\x20','699685InimCt','1010010ljKSTq'];a155_0x23a6=function(){return _0x14bc03;};return a155_0x23a6();}import{getDbName}from'../../core/db-resolver.js';function a155_0x45ba(_0x4465b5,_0xb1b411){_0x4465b5=_0x4465b5-0x182;const _0x23a6d1=a155_0x23a6();let _0x45ba69=_0x23a6d1[_0x4465b5];return _0x45ba69;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a155_0x1476d9(0x190),'description':'List\x20custom\x20SQL\x20queries','risk':a155_0x1476d9(0x19b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a155_0x1476d9(0x1a1),'type':a155_0x1476d9(0x185),'description':a155_0x1476d9(0x18b)},{'name':a155_0x1476d9(0x198),'type':'number','description':a155_0x1476d9(0x186),'default':0x1},{'name':a155_0x1476d9(0x19d),'type':'number','description':a155_0x1476d9(0x188)},{'name':'verbose','type':a155_0x1476d9(0x195),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x56c433){const _0x41826f=a155_0x1476d9,_0x575130=await listSqlQueries(_0x56c433[_0x41826f(0x1a0)],{'sqlCode':_0x56c433[_0x41826f(0x19c)](_0x41826f(0x184))||undefined,'sqlName':_0x56c433[_0x41826f(0x19c)]('name')||undefined,'currentPage':_0x56c433[_0x41826f(0x187)]('page'),'pageSize':_0x56c433['num']('pagesize',0x32)}),_0x22d1b2=_0x56c433['bool']('verbose'),_0x4bde07=_0x575130[_0x41826f(0x196)]??[],_0x39944f=_0x575130['paging']?.[_0x41826f(0x19e)]??_0x4bde07[_0x41826f(0x1a2)];let _0x51fef8;return _0x22d1b2?_0x51fef8=_0x4bde07:_0x51fef8=await Promise['all'](_0x4bde07['map'](async _0x2a3fe7=>{const _0x4ddedf=_0x41826f;let _0x39cad5;try{_0x39cad5=_0x2a3fe7[_0x4ddedf(0x197)]?await getDbName(_0x56c433[_0x4ddedf(0x1a0)],_0x2a3fe7[_0x4ddedf(0x197)]):undefined;}catch{}return{'sqlCode':_0x2a3fe7[_0x4ddedf(0x191)],'sqlName':_0x2a3fe7[_0x4ddedf(0x19a)],'description':_0x2a3fe7[_0x4ddedf(0x189)]??'','db':_0x39cad5?_0x39cad5+'\x20('+_0x2a3fe7[_0x4ddedf(0x197)]+')':_0x2a3fe7[_0x4ddedf(0x197)]??''};})),{'ok':!![],'data':_0x51fef8,'message':_0x4bde07[_0x41826f(0x1a2)]===0x0?_0x41826f(0x183):_0x41826f(0x18c)+_0x4bde07['length']+_0x41826f(0x192)+_0x39944f+').'};}};
|