@lovrabet/rabetbase-cli 2.3.6 → 2.3.7-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/local-file.js +1 -0
- 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/file/index.js +1 -0
- 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
|
-
|
|
1
|
+
const a142_0x44f620=a142_0x5d15;(function(_0x177559,_0x3a7cae){const _0x4b34cd=a142_0x5d15,_0x25620e=_0x177559();while(!![]){try{const _0x11e3a4=parseInt(_0x4b34cd(0x15a))/0x1+-parseInt(_0x4b34cd(0x15b))/0x2*(-parseInt(_0x4b34cd(0x155))/0x3)+parseInt(_0x4b34cd(0x152))/0x4*(-parseInt(_0x4b34cd(0x15e))/0x5)+-parseInt(_0x4b34cd(0x15d))/0x6+parseInt(_0x4b34cd(0x150))/0x7+-parseInt(_0x4b34cd(0x154))/0x8+-parseInt(_0x4b34cd(0x159))/0x9*(-parseInt(_0x4b34cd(0x157))/0xa);if(_0x11e3a4===_0x3a7cae)break;else _0x25620e['push'](_0x25620e['shift']());}catch(_0x25f2de){_0x25620e['push'](_0x25620e['shift']());}}}(a142_0x2a3d,0xa5b94));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{getRoleById,projectRole,ROLE_ID_FLAG}from'../../commands/role/shared.js';function a142_0x5d15(_0x114e47,_0xf3338b){_0x114e47=_0x114e47-0x14f;const _0x2a3de4=a142_0x2a3d();let _0x5d159f=_0x2a3de4[_0x114e47];return _0x5d159f;}function a142_0x2a3d(){const _0x148f00=['4432141bghTQk','roleType','4RDkHCo','num','4547816hYooaX','182883XUanCw','roleName','24101740xSCZTI','read','9AzFLWW','692713DarCOL','2zWbYwQ','detail','7182114MVSWHg','6763555ovjnzF','Role\x20'];a142_0x2a3d=function(){return _0x148f00;};return a142_0x2a3d();}export const roleDetail={'service':'role','command':a142_0x44f620(0x15c),'description':'Show\x20a\x20single\x20role\x27s\x20detail','risk':a142_0x44f620(0x158),'flags':[ROLE_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x118ac9){const _0x2649cd=a142_0x44f620,_0x2df979=_0x118ac9[_0x2649cd(0x153)]('id'),_0x2bcfe3=await getRoleById(_0x118ac9['appCode'],_0x2df979);return{'ok':!![],'data':{'role':projectRole(_0x2bcfe3)},'message':_0x2649cd(0x14f)+_0x2bcfe3[_0x2649cd(0x156)]+'\x20('+_0x2bcfe3[_0x2649cd(0x151)]+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x20b137,_0x16fc78){const _0x540548=a143_0x2df9,_0x33a2f=_0x20b137();while(!![]){try{const _0x40e291=parseInt(_0x540548(0x133))/0x1+parseInt(_0x540548(0x139))/0x2+-parseInt(_0x540548(0x130))/0x3*(parseInt(_0x540548(0x13a))/0x4)+-parseInt(_0x540548(0x136))/0x5*(parseInt(_0x540548(0x132))/0x6)+-parseInt(_0x540548(0x131))/0x7*(parseInt(_0x540548(0x138))/0x8)+-parseInt(_0x540548(0x13b))/0x9*(-parseInt(_0x540548(0x134))/0xa)+parseInt(_0x540548(0x137))/0xb*(-parseInt(_0x540548(0x135))/0xc);if(_0x40e291===_0x16fc78)break;else _0x33a2f['push'](_0x33a2f['shift']());}catch(_0x5aa744){_0x33a2f['push'](_0x33a2f['shift']());}}}(a143_0x4766,0xdbc9c));import{roleList}from'../../commands/role/list.js';import{roleDetail}from'../../commands/role/detail.js';function a143_0x4766(){const _0x5c631d=['576bAbRVX','31077bZAGnB','7LyxTSv','25242ChEWrD','589262IcejtD','143270JxBxQG','6698892GKbFpp','575MmuVFE','11JmQLjj','357688ouVVWH','3095592smbAaM','412FTCSDG'];a143_0x4766=function(){return _0x5c631d;};return a143_0x4766();}import{roleCreate}from'../../commands/role/create.js';import{roleUpdate}from'../../commands/role/update.js';import{roleDelete}from'../../commands/role/delete.js';import{roleUserResolve}from'../../commands/role/user-resolve.js';import{roleUserAdd}from'../../commands/role/user-add.js';import{roleUserRemove}from'../../commands/role/user-remove.js';function a143_0x2df9(_0x21bdf5,_0x5e95b3){_0x21bdf5=_0x21bdf5-0x130;const _0x4766fc=a143_0x4766();let _0x2df97e=_0x4766fc[_0x21bdf5];return _0x2df97e;}export const roleDefinitions=[roleList,roleDetail,roleCreate,roleUpdate,roleDelete,roleUserResolve,roleUserAdd,roleUserRemove];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a144_0x45e292=a144_0x30ec;function a144_0x30ec(_0x88fd67,_0x35134a){_0x88fd67=_0x88fd67-0x11f;const _0x2a7d84=a144_0x2a7d();let _0x30ec9c=_0x2a7d84[_0x88fd67];return _0x30ec9c;}(function(_0xfea005,_0x410d3e){const _0x1e3c38=a144_0x30ec,_0x1c31f1=_0xfea005();while(!![]){try{const _0x34ba12=parseInt(_0x1e3c38(0x121))/0x1+parseInt(_0x1e3c38(0x130))/0x2+-parseInt(_0x1e3c38(0x123))/0x3*(parseInt(_0x1e3c38(0x139))/0x4)+parseInt(_0x1e3c38(0x136))/0x5+-parseInt(_0x1e3c38(0x13b))/0x6+parseInt(_0x1e3c38(0x12f))/0x7*(parseInt(_0x1e3c38(0x127))/0x8)+parseInt(_0x1e3c38(0x138))/0x9*(-parseInt(_0x1e3c38(0x143))/0xa);if(_0x34ba12===_0x410d3e)break;else _0x1c31f1['push'](_0x1c31f1['shift']());}catch(_0x29f9f2){_0x1c31f1['push'](_0x1c31f1['shift']());}}}(a144_0x2a7d,0x258ae));import{listAppRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a144_0x2a7d(){const _0xe886d3=['Page\x20size\x20(1-100)','page','type','includes','10YLJTbN','Invalid\x20--type\x20\x22','List\x20user\x20groups\x20(roles)\x20for\x20the\x20current\x20app','number','list','135328ofQJSN','USER','3rdHSAU','ADMIN','pagesize','validation','80oJvMWl','string','length','--pagesize\x20must\x20be\x20between\x201\x20and\x20100.','join','\x20role(s)','read','--page\x20must\x20be\x20greater\x20than\x20or\x20equal\x20to\x201.','211512kAshUZ','592884JXpDRt','DEV','num','toUpperCase','roleType','trim','1425250IZpNot','str','4418937qhWjpv','962068fxfmTy','filter','802176DNvbUR','Use\x20one\x20of:\x20','Filter\x20by\x20role\x20type','Page\x20index\x20(1-based)'];a144_0x2a7d=function(){return _0xe886d3;};return a144_0x2a7d();}import{projectRole}from'../../commands/role/shared.js';const ROLE_TYPES=[a144_0x45e292(0x124),a144_0x45e292(0x131),a144_0x45e292(0x122),'CUSTOM'];export const roleList={'service':'role','command':a144_0x45e292(0x120),'description':a144_0x45e292(0x145),'risk':a144_0x45e292(0x12d),'flags':[APPCODE_FLAG_OPTIONAL,{'name':a144_0x45e292(0x141),'type':a144_0x45e292(0x128),'required':![],'description':a144_0x45e292(0x13d),'enum':ROLE_TYPES},{'name':a144_0x45e292(0x140),'type':a144_0x45e292(0x11f),'description':a144_0x45e292(0x13e),'default':0x1},{'name':a144_0x45e292(0x125),'type':a144_0x45e292(0x11f),'description':a144_0x45e292(0x13f),'default':0x64}],async 'validate'(_0x9df23){const _0x2dc7de=a144_0x45e292,_0x48df71=_0x9df23[_0x2dc7de(0x137)]('type')[_0x2dc7de(0x135)]();if(_0x48df71&&!ROLE_TYPES[_0x2dc7de(0x142)](_0x48df71['toUpperCase']()))throw CliErrors[_0x2dc7de(0x126)](_0x2dc7de(0x144)+_0x48df71+'\x22.',_0x2dc7de(0x13c)+ROLE_TYPES[_0x2dc7de(0x12b)](',\x20')+'.');const _0x41a8cf=_0x9df23['num'](_0x2dc7de(0x140),0x1),_0x39b1f4=_0x9df23[_0x2dc7de(0x132)](_0x2dc7de(0x125),0x64);if(_0x41a8cf<0x1)throw CliErrors['validation'](_0x2dc7de(0x12e));if(_0x39b1f4<0x1||_0x39b1f4>0x64)throw CliErrors['validation'](_0x2dc7de(0x12a));},async 'execute'(_0x480ee3){const _0x47cbcb=a144_0x45e292,_0x3a1bfc=_0x480ee3['num'](_0x47cbcb(0x140),0x1)||0x1,_0x57c34c=_0x480ee3[_0x47cbcb(0x132)](_0x47cbcb(0x125),0x64)||0x64,_0x1d3664=_0x480ee3['str'](_0x47cbcb(0x141))[_0x47cbcb(0x135)]()[_0x47cbcb(0x133)](),{items:_0x272ba5,paging:_0x6fe783}=await listAppRoles(_0x480ee3['appCode'],{'currentPage':_0x3a1bfc,'pageSize':_0x57c34c}),_0x14a6e2=_0x1d3664?_0x272ba5[_0x47cbcb(0x13a)](_0x3193f1=>_0x3193f1[_0x47cbcb(0x134)]===_0x1d3664):_0x272ba5,_0xea2cc2=_0x14a6e2['map'](projectRole);return{'ok':!![],'data':{'roles':_0xea2cc2,'paging':_0x6fe783},'message':'Found\x20'+_0xea2cc2[_0x47cbcb(0x129)]+_0x47cbcb(0x12c)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a143_0x212a93=a143_0x24ad;function a143_0x5b37(){const _0x254a87=['roleType','DEV','userList','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','push','ADMIN','Missing\x20user\x20reference.','Pass\x20--role\x20<id|name>.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','\x22\x20is\x20ambiguous\x20(ids:\x20','196473AkSfdo','number','\x20member(s)\x20but\x20role\x20has\x20','role','\x20not\x20found\x20in\x20app\x20','find','tenant_code','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Role\x20name\x20\x22','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','filter','includes','USER','12KukfTF','\x20not\x20found\x20in\x20the\x20user-role\x20list.','name','splice','userId','Disambiguate\x20with\x20--user\x20<id>.','user','validation','authRequired','userCount','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','join','expect-user-count','remark','string','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','roleName','flagMissing','map','test','Cannot\x20','trim','user-add','4022ZRuONB','nickname','/smartapi/permit/user-role/update-user-list','\x22\x20not\x20found\x20in\x20app\x20','No\x20tenant\x20member\x20matches\x20\x22','Anti-drift\x20check\x20failed:\x20expected\x20','Pass\x20--user\x20<id|name>.','permitCount','\x20is\x20not\x20a\x20member\x20of\x20role\x20','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','POST','Disambiguate\x20with\x20--role\x20<id>.','CUSTOM','4628150iDRosw',';\x20no\x20change.','str','toLowerCase','username','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Optional\x20role\x20remark/description','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','1206Xivgye','length','78095NhvjLP','31129xeFeEi','flag','129SibSvY','10936gODqKz','User\x20','tenant','Role\x20id\x20','\x22:\x20','findIndex','\x20built-in\x20role\x20','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','334684NGMQLQ','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Role\x20id\x20(from\x20`role\x20list`)','appCode','expectUserCount'];a143_0x5b37=function(){return _0x254a87;};return a143_0x5b37();}(function(_0x127eed,_0x540321){const _0x311ab0=a143_0x24ad,_0x502c72=_0x127eed();while(!![]){try{const _0x5d929d=parseInt(_0x311ab0(0xbc))/0x1+-parseInt(_0x311ab0(0x89))/0x2*(-parseInt(_0x311ab0(0xa4))/0x3)+parseInt(_0x311ab0(0xad))/0x4+parseInt(_0x311ab0(0xa1))/0x5+parseInt(_0x311ab0(0x72))/0x6*(parseInt(_0x311ab0(0xa2))/0x7)+-parseInt(_0x311ab0(0xa5))/0x8*(-parseInt(_0x311ab0(0x9f))/0x9)+-parseInt(_0x311ab0(0x96))/0xa;if(_0x5d929d===_0x540321)break;else _0x502c72['push'](_0x502c72['shift']());}catch(_0x4fac52){_0x502c72['push'](_0x502c72['shift']());}}}(a143_0x5b37,0x1b385));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';function a143_0x24ad(_0xbbf427,_0x55db0b){_0xbbf427=_0xbbf427-0x6a;const _0x5b3767=a143_0x5b37();let _0x24ad3f=_0x5b3767[_0xbbf427];return _0x24ad3f;}import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a143_0x212a93(0xbd),'required':!![],'description':a143_0x212a93(0xaf)};export const ROLE_REF_FLAG={'name':a143_0x212a93(0xbf),'type':a143_0x212a93(0x80),'required':!![],'description':a143_0x212a93(0x6b)};export const USER_REF_FLAG={'name':'user','type':a143_0x212a93(0x80),'required':!![],'description':a143_0x212a93(0xac)};export const NAME_FLAG={'name':'name','type':a143_0x212a93(0x80),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':'name','type':a143_0x212a93(0x80),'required':!![],'description':a143_0x212a93(0x9c)};export const REMARK_FLAG={'name':a143_0x212a93(0x7f),'type':a143_0x212a93(0x80),'required':![],'description':a143_0x212a93(0x9d)};export const EXPECT_USER_COUNT_FLAG={'name':a143_0x212a93(0x7e),'type':a143_0x212a93(0xbd),'required':![],'description':a143_0x212a93(0x6e)};export const BUILTIN_ROLE_TYPES=[a143_0x212a93(0xb7),a143_0x212a93(0xb3),a143_0x212a93(0x71)];export function isBuiltinRole(_0x1adaf2){return BUILTIN_ROLE_TYPES['includes'](_0x1adaf2);}export function assertCustomRole(_0x52b9ac,_0x4ace83){const _0x39d186=a143_0x212a93;if(_0x52b9ac[_0x39d186(0xb2)]!==_0x39d186(0x95))throw CliErrors[_0x39d186(0x79)](_0x39d186(0x86)+_0x4ace83+_0x39d186(0xab)+_0x52b9ac['roleName']+'\x20('+_0x52b9ac[_0x39d186(0xb2)]+').',_0x39d186(0x9e));}export function assertPermConfigurable(_0xf6b897){const _0x55596b=a143_0x212a93;if(_0xf6b897[_0x55596b(0xb2)]===_0x55596b(0xb3)||_0xf6b897[_0x55596b(0xb2)]===_0x55596b(0xb7))throw CliErrors[_0x55596b(0x79)](_0x55596b(0x92)+_0xf6b897['roleName']+'\x20('+_0xf6b897[_0x55596b(0xb2)]+').',_0x55596b(0x6c));}export function projectRole(_0x24c8ae){const _0x3502fd=a143_0x212a93;return{'id':_0x24c8ae['id'],'roleName':_0x24c8ae[_0x3502fd(0x82)],'roleType':_0x24c8ae[_0x3502fd(0xb2)],'remark':_0x24c8ae[_0x3502fd(0x7f)],'userCount':_0x24c8ae[_0x3502fd(0x7b)],'permitCount':_0x24c8ae[_0x3502fd(0x90)],'builtin':isBuiltinRole(_0x24c8ae[_0x3502fd(0xb2)])};}export async function resolveRoleRef(_0x703074,_0x1d5a98){const _0x4326ac=a143_0x212a93,_0x2b5c77=_0x1d5a98[_0x4326ac(0x87)]();if(!_0x2b5c77)throw CliErrors['validation']('Missing\x20role\x20reference.','Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x2b5c77))return getRoleById(_0x703074,Number(_0x2b5c77));const _0x5c0331=await listAllAppRoles(_0x703074),_0x3aa34f=_0x5c0331[_0x4326ac(0x6f)](_0x5c7389=>_0x5c7389[_0x4326ac(0x82)]===_0x2b5c77);if(_0x3aa34f[_0x4326ac(0xa0)]===0x0)throw CliErrors[_0x4326ac(0x79)](_0x4326ac(0x6d)+_0x2b5c77+_0x4326ac(0x8c)+_0x703074+'.',_0x4326ac(0xba));if(_0x3aa34f[_0x4326ac(0xa0)]>0x1){const _0x7be9cb=_0x3aa34f['map'](_0x33846e=>_0x33846e['id'])[_0x4326ac(0x7d)](',\x20');throw CliErrors[_0x4326ac(0x79)](_0x4326ac(0x6d)+_0x2b5c77+_0x4326ac(0xbb)+_0x7be9cb+').',_0x4326ac(0x94));}return _0x3aa34f[0x0];}export async function getRoleById(_0x559a66,_0x4f132c){const _0x4578ac=a143_0x212a93,_0x2873e5=await getAppRole(_0x4f132c);if(!_0x2873e5)throw CliErrors[_0x4578ac(0x79)](_0x4578ac(0xa8)+_0x4f132c+_0x4578ac(0xc0)+_0x559a66+'.',_0x4578ac(0xae));return _0x2873e5;}async function listAllAppRoles(_0x226060){const _0x25e40d=a143_0x212a93,_0x106952=0x64,_0x1eb374=[];for(let _0x41fd6e=0x1;;_0x41fd6e+=0x1){const {items:_0x50ec10,paging:_0x5cf9d5}=await listAppRoles(_0x226060,{'currentPage':_0x41fd6e,'pageSize':_0x106952});_0x1eb374[_0x25e40d(0xb6)](..._0x50ec10);if(_0x50ec10[_0x25e40d(0xa0)]<_0x106952||_0x5cf9d5&&_0x1eb374[_0x25e40d(0xa0)]>=_0x5cf9d5['totalCount'])return _0x1eb374;}}export async function resolveTenantCode(){const _0x582a69=a143_0x212a93,_0x583c4b=await getSessionUserInfo(),_0x5a7ded=_0x583c4b?.[_0x582a69(0x78)]?.[_0x582a69(0xa7)]?.[_0x582a69(0x6a)];if(!_0x5a7ded)throw CliErrors[_0x582a69(0x7a)](_0x582a69(0x81));return _0x5a7ded;}function matchMember(_0x46c117,_0x2eb3cc){const _0x2aaab6=a143_0x212a93,_0x4e504f=_0x2eb3cc[_0x2aaab6(0x87)]()[_0x2aaab6(0x99)]();return(_0x46c117['nickname']??'')[_0x2aaab6(0x99)]()===_0x4e504f||(_0x46c117[_0x2aaab6(0x9a)]??'')[_0x2aaab6(0x99)]()===_0x4e504f;}export async function resolveUserRef(_0x441634){const _0x13c5bf=a143_0x212a93,_0xb251a5=_0x441634[_0x13c5bf(0x87)]();if(!_0xb251a5)throw CliErrors[_0x13c5bf(0x79)](_0x13c5bf(0xb8),_0x13c5bf(0x8f));const _0x661f5c=await resolveTenantCode(),_0x417b7f=await getTenantMembers(_0x661f5c);if(/^\d+$/[_0x13c5bf(0x85)](_0xb251a5)){const _0x18895c=Number(_0xb251a5),_0x51f2e0=_0x417b7f[_0x13c5bf(0xc1)](_0x19496d=>_0x19496d[_0x13c5bf(0x76)]===_0x18895c);return{'userId':_0x18895c,'username':_0x51f2e0?.[_0x13c5bf(0x9a)]??String(_0x18895c),'nickname':_0x51f2e0?.[_0x13c5bf(0x8a)],'matchedBy':'id'};}const _0x576209=_0x417b7f['filter'](_0x4e47c2=>matchMember(_0x4e47c2,_0xb251a5));if(_0x576209[_0x13c5bf(0xa0)]===0x0)throw CliErrors[_0x13c5bf(0x79)](_0x13c5bf(0x8d)+_0xb251a5+'\x22.',_0x13c5bf(0xb5));if(_0x576209[_0x13c5bf(0xa0)]>0x1){const _0x4171b9=_0x576209[_0x13c5bf(0x84)](_0x15b62d=>(_0x15b62d[_0x13c5bf(0x8a)]??_0x15b62d[_0x13c5bf(0x9a)]??'?')+'('+_0x15b62d[_0x13c5bf(0x76)]+')')[_0x13c5bf(0x7d)](',\x20');throw CliErrors['validation']('Multiple\x20tenant\x20members\x20match\x20\x22'+_0xb251a5+_0x13c5bf(0xa9)+_0x4171b9+'.',_0x13c5bf(0x77));}const _0xf3fc14=_0x576209[0x0];return{'userId':_0xf3fc14['userId'],'username':_0xf3fc14[_0x13c5bf(0x9a)]??String(_0xf3fc14[_0x13c5bf(0x76)]),'nickname':_0xf3fc14['nickname'],'matchedBy':_0x13c5bf(0x74)};}export const UPDATE_USER_LIST_PATH=a143_0x212a93(0x8b);function userIdsOf(_0x2d9335){const _0x285c39=a143_0x212a93;return(_0x2d9335?.[_0x285c39(0xb4)]??[])['map'](_0x170564=>_0x170564[_0x285c39(0x76)]);}export function computeRoleUserMutation(_0x4261cc){const _0x51f4bd=a143_0x212a93,{operation:_0x2a05f5,appCode:_0x5d5881,roleUsers:_0x213dff,targetRoleId:_0x403370,user:_0x291a9d}=_0x4261cc,_0xca37ba=_0x213dff[_0x51f4bd(0xc1)](_0x3f7dd1=>_0x3f7dd1['id']===_0x403370);if(!_0xca37ba)throw CliErrors['validation'](_0x51f4bd(0xa8)+_0x403370+_0x51f4bd(0x73),_0x51f4bd(0xae));const _0x20d015=userIdsOf(_0xca37ba),_0x5ee56f=[];if(_0x4261cc[_0x51f4bd(0xb1)]!==undefined&&_0x4261cc[_0x51f4bd(0xb1)]!==_0x20d015[_0x51f4bd(0xa0)])throw CliErrors[_0x51f4bd(0x79)](_0x51f4bd(0x8e)+_0x4261cc[_0x51f4bd(0xb1)]+_0x51f4bd(0xbe)+_0x20d015['length']+'.',_0x51f4bd(0x7c));const _0x5f4517=_0x20d015[_0x51f4bd(0x70)](_0x291a9d[_0x51f4bd(0x76)]);let _0x27795e=![];const _0x564adb=[..._0xca37ba[_0x51f4bd(0xb4)]];if(_0x2a05f5===_0x51f4bd(0x88))_0x5f4517?_0x5ee56f[_0x51f4bd(0xb6)]('User\x20'+_0x291a9d[_0x51f4bd(0x76)]+_0x51f4bd(0x9b)+_0xca37ba['roleName']+';\x20no\x20change.'):(_0x564adb['push']({'userId':_0x291a9d['userId'],'username':_0x291a9d[_0x51f4bd(0x9a)],..._0x291a9d[_0x51f4bd(0x8a)]?{'nickname':_0x291a9d[_0x51f4bd(0x8a)]}:{}}),_0x27795e=!![]);else{if(!_0x5f4517)_0x5ee56f[_0x51f4bd(0xb6)](_0x51f4bd(0xa6)+_0x291a9d[_0x51f4bd(0x76)]+_0x51f4bd(0x91)+_0xca37ba[_0x51f4bd(0x82)]+_0x51f4bd(0x97));else{const _0x4e49d5=_0x564adb[_0x51f4bd(0xaa)](_0x36c561=>_0x36c561[_0x51f4bd(0x76)]===_0x291a9d['userId']);if(_0x4e49d5>=0x0)_0x564adb[_0x51f4bd(0x75)](_0x4e49d5,0x1);_0x27795e=!![];}}const _0x1966d2=_0x213dff['map'](_0x41e91d=>_0x41e91d['id']===_0x403370?{..._0x41e91d,'userList':_0x564adb}:_0x41e91d),_0x55b482=_0x564adb['map'](_0x5c0b5d=>_0x5c0b5d['userId']),_0x2d6f5b={'operation':_0x2a05f5,'selector':{'appCode':_0x5d5881,'roleId':_0x403370,'roleName':_0xca37ba[_0x51f4bd(0x82)],'userId':_0x291a9d[_0x51f4bd(0x76)]},'before':{'userIds':_0x20d015},'after':{'userIds':_0x55b482},'dryRun':_0x4261cc['dryRun'],'backend':{'method':_0x51f4bd(0x93),'path':UPDATE_USER_LIST_PATH},'warnings':_0x5ee56f};return{'roleList':_0x1966d2,'mutation':_0x2d6f5b,'changed':_0x27795e};}export async function loadRoleUsers(_0x58b42b){return listRoleUsers(_0x58b42b);}export function readRoleRef(_0x22658a){const _0x3c49a5=a143_0x212a93,_0x27aa83=_0x22658a[_0x3c49a5(0x98)]('role')[_0x3c49a5(0x87)]();if(!_0x27aa83)throw CliErrors[_0x3c49a5(0x83)]('role',_0x3c49a5(0xb9));return _0x27aa83;}export async function prepareUserMutation(_0x4343fe,_0x2f7e42,_0x3d8643){const _0x29dc62=a143_0x212a93,_0x5c4eb0=readRoleRef(_0x4343fe),_0x8ddb46=_0x4343fe['str'](_0x29dc62(0x78))[_0x29dc62(0x87)]();if(!_0x8ddb46)throw CliErrors['flagMissing'](_0x29dc62(0x78),_0x29dc62(0x8f));const _0x1c9ad2=_0x4343fe[_0x29dc62(0xa3)](_0x29dc62(0x7e)),_0x2e1744=_0x1c9ad2===undefined||_0x1c9ad2===null?undefined:Number(_0x1c9ad2),_0x185c72=await resolveRoleRef(_0x4343fe[_0x29dc62(0xb0)],_0x5c4eb0),_0x3f6c27=await resolveUserRef(_0x8ddb46),_0x173428=await loadRoleUsers(_0x4343fe[_0x29dc62(0xb0)]);return computeRoleUserMutation({'operation':_0x2f7e42,'appCode':_0x4343fe[_0x29dc62(0xb0)],'roleUsers':_0x173428,'targetRoleId':_0x185c72['id'],'user':{'userId':_0x3f6c27[_0x29dc62(0x76)],'username':_0x3f6c27[_0x29dc62(0x9a)],'nickname':_0x3f6c27['nickname']},'dryRun':_0x3d8643,..._0x2e1744!==undefined?{'expectUserCount':_0x2e1744}:{}});}
|
|
1
|
+
const a145_0x5b0cc8=a145_0x5077;(function(_0x4ec0b0,_0x15c280){const _0x3b90f7=a145_0x5077,_0x187b6b=_0x4ec0b0();while(!![]){try{const _0xc977d=-parseInt(_0x3b90f7(0x19d))/0x1+-parseInt(_0x3b90f7(0x1bc))/0x2*(parseInt(_0x3b90f7(0x1b5))/0x3)+-parseInt(_0x3b90f7(0x1c4))/0x4+-parseInt(_0x3b90f7(0x19c))/0x5*(-parseInt(_0x3b90f7(0x1bd))/0x6)+parseInt(_0x3b90f7(0x1b7))/0x7+-parseInt(_0x3b90f7(0x1b8))/0x8+parseInt(_0x3b90f7(0x1d2))/0x9;if(_0xc977d===_0x15c280)break;else _0x187b6b['push'](_0x187b6b['shift']());}catch(_0x5d58bd){_0x187b6b['push'](_0x187b6b['shift']());}}}(a145_0x1230,0x33098));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':a145_0x5b0cc8(0x1aa),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a145_0x5b0cc8(0x195),'type':a145_0x5b0cc8(0x1cb),'required':!![],'description':a145_0x5b0cc8(0x1d7)};export const USER_REF_FLAG={'name':'user','type':a145_0x5b0cc8(0x1cb),'required':!![],'description':a145_0x5b0cc8(0x199)};function a145_0x1230(){const _0x304f0e=['string','name','\x20not\x20found\x20in\x20the\x20user-role\x20list.','Disambiguate\x20with\x20--role\x20<id>.','\x20not\x20found\x20in\x20app\x20','flagMissing','nickname','10323936SCZQlW','Pass\x20--user\x20<id|name>.','user-add','userCount','includes','Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)','filter','str','Role\x20id\x20',';\x20no\x20change.','expectUserCount','remark','\x20built-in\x20role\x20','role','Multiple\x20tenant\x20members\x20match\x20\x22','flag','Pass\x20--role\x20<id|name>.','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','userId','toLowerCase','138965LEzvar','127624PJetjD','test','findIndex','splice','length','appCode','Role\x20name','Missing\x20user\x20reference.','POST','roleType','Anti-drift\x20check\x20failed:\x20expected\x20','user','/smartapi/permit/user-role/update-user-list','number','join','totalCount','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','User\x20','validation','CUSTOM','permitCount','\x20is\x20not\x20a\x20member\x20of\x20role\x20','54YsQnva','\x22:\x20','21595LvvXmT','3337152HzFNWT','No\x20tenant\x20member\x20matches\x20\x22','username','push','32690sTjNeo','36naKaUD','tenant','userList','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','Missing\x20role\x20reference.','roleName','map','1075684PAKUMx','expect-user-count','find','ADMIN','DEV','dryRun','trim'];a145_0x1230=function(){return _0x304f0e;};return a145_0x1230();}export const NAME_FLAG={'name':a145_0x5b0cc8(0x1cc),'type':a145_0x5b0cc8(0x1cb),'required':!![],'description':a145_0x5b0cc8(0x1a3)};export const USER_NAME_FLAG={'name':'name','type':a145_0x5b0cc8(0x1cb),'required':!![],'description':a145_0x5b0cc8(0x1ad)};export const REMARK_FLAG={'name':a145_0x5b0cc8(0x193),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a145_0x5b0cc8(0x1c5),'type':a145_0x5b0cc8(0x1aa),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=['ADMIN',a145_0x5b0cc8(0x1c8),'USER'];export function isBuiltinRole(_0x4ce9e7){const _0x5df071=a145_0x5b0cc8;return BUILTIN_ROLE_TYPES[_0x5df071(0x1d6)](_0x4ce9e7);}export function assertCustomRole(_0x253e06,_0x50fe01){const _0x169dc0=a145_0x5b0cc8;if(_0x253e06[_0x169dc0(0x1a6)]!==_0x169dc0(0x1b2))throw CliErrors[_0x169dc0(0x1b1)]('Cannot\x20'+_0x50fe01+_0x169dc0(0x194)+_0x253e06[_0x169dc0(0x1c2)]+'\x20('+_0x253e06[_0x169dc0(0x1a6)]+').',_0x169dc0(0x1ae));}export function assertPermConfigurable(_0x1d9f03){const _0x835a84=a145_0x5b0cc8;if(_0x1d9f03[_0x835a84(0x1a6)]==='DEV'||_0x1d9f03[_0x835a84(0x1a6)]===_0x835a84(0x1c7))throw CliErrors[_0x835a84(0x1b1)]('Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20'+_0x1d9f03[_0x835a84(0x1c2)]+'\x20('+_0x1d9f03[_0x835a84(0x1a6)]+').','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.');}export function projectRole(_0x52b4c6){const _0x4b514e=a145_0x5b0cc8;return{'id':_0x52b4c6['id'],'roleName':_0x52b4c6[_0x4b514e(0x1c2)],'roleType':_0x52b4c6[_0x4b514e(0x1a6)],'remark':_0x52b4c6[_0x4b514e(0x193)],'userCount':_0x52b4c6[_0x4b514e(0x1d5)],'permitCount':_0x52b4c6[_0x4b514e(0x1b3)],'builtin':isBuiltinRole(_0x52b4c6[_0x4b514e(0x1a6)])};}export async function resolveRoleRef(_0x421343,_0x320b6f){const _0x4f3dc2=a145_0x5b0cc8,_0x5c6bf2=_0x320b6f['trim']();if(!_0x5c6bf2)throw CliErrors[_0x4f3dc2(0x1b1)](_0x4f3dc2(0x1c1),_0x4f3dc2(0x198));if(/^\d+$/[_0x4f3dc2(0x19e)](_0x5c6bf2))return getRoleById(_0x421343,Number(_0x5c6bf2));const _0x55ed0b=await listAllAppRoles(_0x421343),_0x4caf72=_0x55ed0b[_0x4f3dc2(0x18e)](_0x1bff60=>_0x1bff60[_0x4f3dc2(0x1c2)]===_0x5c6bf2);if(_0x4caf72[_0x4f3dc2(0x1a1)]===0x0)throw CliErrors['validation']('Role\x20name\x20\x22'+_0x5c6bf2+'\x22\x20not\x20found\x20in\x20app\x20'+_0x421343+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x4caf72['length']>0x1){const _0x48791b=_0x4caf72[_0x4f3dc2(0x1c3)](_0x17265e=>_0x17265e['id'])[_0x4f3dc2(0x1ab)](',\x20');throw CliErrors[_0x4f3dc2(0x1b1)]('Role\x20name\x20\x22'+_0x5c6bf2+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x48791b+').',_0x4f3dc2(0x1ce));}return _0x4caf72[0x0];}export async function getRoleById(_0x15a1a3,_0x42cca9){const _0xc67f6a=a145_0x5b0cc8,_0x4ff817=await getAppRole(_0x42cca9);if(!_0x4ff817)throw CliErrors['validation'](_0xc67f6a(0x190)+_0x42cca9+_0xc67f6a(0x1cf)+_0x15a1a3+'.',_0xc67f6a(0x1af));return _0x4ff817;}async function listAllAppRoles(_0x2dae3c){const _0x5afcd2=a145_0x5b0cc8,_0x23c540=0x64,_0x4fd008=[];for(let _0x2e9993=0x1;;_0x2e9993+=0x1){const {items:_0x4718c0,paging:_0x16c5f0}=await listAppRoles(_0x2dae3c,{'currentPage':_0x2e9993,'pageSize':_0x23c540});_0x4fd008[_0x5afcd2(0x1bb)](..._0x4718c0);if(_0x4718c0[_0x5afcd2(0x1a1)]<_0x23c540||_0x16c5f0&&_0x4fd008[_0x5afcd2(0x1a1)]>=_0x16c5f0[_0x5afcd2(0x1ac)])return _0x4fd008;}}export async function resolveTenantCode(){const _0x20d344=a145_0x5b0cc8,_0x47aae3=await getSessionUserInfo(),_0x399b1a=_0x47aae3?.[_0x20d344(0x1a8)]?.[_0x20d344(0x1be)]?.['tenant_code'];if(!_0x399b1a)throw CliErrors['authRequired']('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x399b1a;}function matchMember(_0x433a47,_0x37050b){const _0x52b575=a145_0x5b0cc8,_0x87215b=_0x37050b[_0x52b575(0x1ca)]()[_0x52b575(0x19b)]();return(_0x433a47[_0x52b575(0x1d1)]??'')[_0x52b575(0x19b)]()===_0x87215b||(_0x433a47[_0x52b575(0x1ba)]??'')[_0x52b575(0x19b)]()===_0x87215b;}export async function resolveUserRef(_0x46a4c0){const _0x43af47=a145_0x5b0cc8,_0x11c325=_0x46a4c0[_0x43af47(0x1ca)]();if(!_0x11c325)throw CliErrors[_0x43af47(0x1b1)](_0x43af47(0x1a4),'Pass\x20--user\x20<id|name>.');const _0xa19ee4=await resolveTenantCode(),_0x54de3f=await getTenantMembers(_0xa19ee4);if(/^\d+$/['test'](_0x11c325)){const _0x226cb6=Number(_0x11c325),_0x5a19a1=_0x54de3f[_0x43af47(0x1c6)](_0x10fc4b=>_0x10fc4b[_0x43af47(0x19a)]===_0x226cb6);return{'userId':_0x226cb6,'username':_0x5a19a1?.[_0x43af47(0x1ba)]??String(_0x226cb6),'nickname':_0x5a19a1?.[_0x43af47(0x1d1)],'matchedBy':'id'};}const _0x2a0747=_0x54de3f['filter'](_0x595067=>matchMember(_0x595067,_0x11c325));if(_0x2a0747[_0x43af47(0x1a1)]===0x0)throw CliErrors[_0x43af47(0x1b1)](_0x43af47(0x1b9)+_0x11c325+'\x22.',_0x43af47(0x1c0));if(_0x2a0747[_0x43af47(0x1a1)]>0x1){const _0x4cc8a1=_0x2a0747[_0x43af47(0x1c3)](_0x3a83fa=>(_0x3a83fa[_0x43af47(0x1d1)]??_0x3a83fa[_0x43af47(0x1ba)]??'?')+'('+_0x3a83fa[_0x43af47(0x19a)]+')')[_0x43af47(0x1ab)](',\x20');throw CliErrors[_0x43af47(0x1b1)](_0x43af47(0x196)+_0x11c325+_0x43af47(0x1b6)+_0x4cc8a1+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x4cb822=_0x2a0747[0x0];return{'userId':_0x4cb822['userId'],'username':_0x4cb822[_0x43af47(0x1ba)]??String(_0x4cb822[_0x43af47(0x19a)]),'nickname':_0x4cb822[_0x43af47(0x1d1)],'matchedBy':_0x43af47(0x1cc)};}export const UPDATE_USER_LIST_PATH=a145_0x5b0cc8(0x1a9);function userIdsOf(_0x38d545){const _0x360fae=a145_0x5b0cc8;return(_0x38d545?.[_0x360fae(0x1bf)]??[])['map'](_0x5e1430=>_0x5e1430[_0x360fae(0x19a)]);}function a145_0x5077(_0x4732f2,_0x3fa785){_0x4732f2=_0x4732f2-0x18e;const _0x1230f0=a145_0x1230();let _0x5077bf=_0x1230f0[_0x4732f2];return _0x5077bf;}export function computeRoleUserMutation(_0x2e9358){const _0x9a028e=a145_0x5b0cc8,{operation:_0x4fcc86,appCode:_0x3ea095,roleUsers:_0x391232,targetRoleId:_0x6867ba,user:_0x5af6d9}=_0x2e9358,_0x1fad28=_0x391232[_0x9a028e(0x1c6)](_0x23c562=>_0x23c562['id']===_0x6867ba);if(!_0x1fad28)throw CliErrors[_0x9a028e(0x1b1)](_0x9a028e(0x190)+_0x6867ba+_0x9a028e(0x1cd),'Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');const _0x164019=userIdsOf(_0x1fad28),_0x1abd62=[];if(_0x2e9358['expectUserCount']!==undefined&&_0x2e9358[_0x9a028e(0x192)]!==_0x164019[_0x9a028e(0x1a1)])throw CliErrors[_0x9a028e(0x1b1)](_0x9a028e(0x1a7)+_0x2e9358[_0x9a028e(0x192)]+'\x20member(s)\x20but\x20role\x20has\x20'+_0x164019['length']+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x334584=_0x164019['includes'](_0x5af6d9[_0x9a028e(0x19a)]);let _0x5a77bf=![];const _0x5078a3=[..._0x1fad28['userList']];if(_0x4fcc86===_0x9a028e(0x1d4))_0x334584?_0x1abd62[_0x9a028e(0x1bb)](_0x9a028e(0x1b0)+_0x5af6d9[_0x9a028e(0x19a)]+'\x20is\x20already\x20a\x20member\x20of\x20role\x20'+_0x1fad28['roleName']+';\x20no\x20change.'):(_0x5078a3[_0x9a028e(0x1bb)]({'userId':_0x5af6d9[_0x9a028e(0x19a)],'username':_0x5af6d9[_0x9a028e(0x1ba)],..._0x5af6d9['nickname']?{'nickname':_0x5af6d9[_0x9a028e(0x1d1)]}:{}}),_0x5a77bf=!![]);else{if(!_0x334584)_0x1abd62[_0x9a028e(0x1bb)]('User\x20'+_0x5af6d9[_0x9a028e(0x19a)]+_0x9a028e(0x1b4)+_0x1fad28[_0x9a028e(0x1c2)]+_0x9a028e(0x191));else{const _0x4ac2fc=_0x5078a3[_0x9a028e(0x19f)](_0x523e63=>_0x523e63['userId']===_0x5af6d9[_0x9a028e(0x19a)]);if(_0x4ac2fc>=0x0)_0x5078a3[_0x9a028e(0x1a0)](_0x4ac2fc,0x1);_0x5a77bf=!![];}}const _0x54683f=_0x391232[_0x9a028e(0x1c3)](_0x54c799=>_0x54c799['id']===_0x6867ba?{..._0x54c799,'userList':_0x5078a3}:_0x54c799),_0x266cb5=_0x5078a3[_0x9a028e(0x1c3)](_0x803b4e=>_0x803b4e[_0x9a028e(0x19a)]),_0x3ab11f={'operation':_0x4fcc86,'selector':{'appCode':_0x3ea095,'roleId':_0x6867ba,'roleName':_0x1fad28[_0x9a028e(0x1c2)],'userId':_0x5af6d9['userId']},'before':{'userIds':_0x164019},'after':{'userIds':_0x266cb5},'dryRun':_0x2e9358[_0x9a028e(0x1c9)],'backend':{'method':_0x9a028e(0x1a5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x1abd62};return{'roleList':_0x54683f,'mutation':_0x3ab11f,'changed':_0x5a77bf};}export async function loadRoleUsers(_0x6a4b87){return listRoleUsers(_0x6a4b87);}export function readRoleRef(_0x12ce1a){const _0x17a459=a145_0x5b0cc8,_0x58dcc4=_0x12ce1a['str']('role')[_0x17a459(0x1ca)]();if(!_0x58dcc4)throw CliErrors[_0x17a459(0x1d0)](_0x17a459(0x195),_0x17a459(0x198));return _0x58dcc4;}export async function prepareUserMutation(_0x40783f,_0x27ca88,_0xfdb42c){const _0x1d8e26=a145_0x5b0cc8,_0x3c3e6f=readRoleRef(_0x40783f),_0x144adb=_0x40783f[_0x1d8e26(0x18f)]('user')['trim']();if(!_0x144adb)throw CliErrors[_0x1d8e26(0x1d0)](_0x1d8e26(0x1a8),_0x1d8e26(0x1d3));const _0x20c6d7=_0x40783f[_0x1d8e26(0x197)]('expect-user-count'),_0x262fa7=_0x20c6d7===undefined||_0x20c6d7===null?undefined:Number(_0x20c6d7),_0x559365=await resolveRoleRef(_0x40783f['appCode'],_0x3c3e6f),_0x13b275=await resolveUserRef(_0x144adb),_0x5e10e5=await loadRoleUsers(_0x40783f[_0x1d8e26(0x1a2)]);return computeRoleUserMutation({'operation':_0x27ca88,'appCode':_0x40783f[_0x1d8e26(0x1a2)],'roleUsers':_0x5e10e5,'targetRoleId':_0x559365['id'],'user':{'userId':_0x13b275[_0x1d8e26(0x19a)],'username':_0x13b275['username'],'nickname':_0x13b275[_0x1d8e26(0x1d1)]},'dryRun':_0xfdb42c,..._0x262fa7!==undefined?{'expectUserCount':_0x262fa7}:{}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a146_0x5baf7f=a146_0x1c6e;(function(_0x2b53f8,_0x392529){const _0x2dd72c=a146_0x1c6e,_0x34e048=_0x2b53f8();while(!![]){try{const _0x20adb4=-parseInt(_0x2dd72c(0xf1))/0x1*(-parseInt(_0x2dd72c(0xf2))/0x2)+-parseInt(_0x2dd72c(0xea))/0x3*(-parseInt(_0x2dd72c(0xd7))/0x4)+parseInt(_0x2dd72c(0xeb))/0x5*(parseInt(_0x2dd72c(0xdf))/0x6)+-parseInt(_0x2dd72c(0xf3))/0x7+-parseInt(_0x2dd72c(0xda))/0x8*(parseInt(_0x2dd72c(0xd9))/0x9)+parseInt(_0x2dd72c(0xf5))/0xa+-parseInt(_0x2dd72c(0xdc))/0xb*(parseInt(_0x2dd72c(0xdb))/0xc);if(_0x20adb4===_0x392529)break;else _0x34e048['push'](_0x34e048['shift']());}catch(_0x455389){_0x34e048['push'](_0x34e048['shift']());}}}(a146_0x505f,0xd94ce));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 a146_0x505f(){const _0x5d6e07=['17116250OMRjyM','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','string','write','2971960mQSDdA','/smartapi/permit/role/update','31338WLSHLl','3088NCAZXe','77712fIeetv','1859bjBmLC','trim','remark','256428CduozR','POST','flag','name','roleName','appCode','validation','num','role','\x20(id=','--name\x20cannot\x20be\x20empty.','3fnwugH','25KkczBW','Updated\x20role\x20','length','New\x20role\x20name','Nothing\x20to\x20update.','update','64811HJKzZJ','38WwMXXM','3998092EpOZgS','Role\x20name\x20cannot\x20exceed\x2064\x20characters.'];a146_0x505f=function(){return _0x5d6e07;};return a146_0x505f();}import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a146_0x5baf7f(0xd8);function readPatch(_0x34b0c9){const _0x537097=a146_0x5baf7f,_0x394ad9=_0x34b0c9['flag'](_0x537097(0xe2)),_0xcdacc5=_0x34b0c9[_0x537097(0xe1)](_0x537097(0xde)),_0x11d549={};if(_0x394ad9!==undefined&&_0x394ad9!==null){const _0x2338fd=String(_0x394ad9)[_0x537097(0xdd)]();if(!_0x2338fd)throw CliErrors[_0x537097(0xe5)](_0x537097(0xe9));if(_0x2338fd[_0x537097(0xed)]>0x40)throw CliErrors[_0x537097(0xe5)](_0x537097(0xf4));_0x11d549['roleName']=_0x2338fd;}_0xcdacc5!==undefined&&_0xcdacc5!==null&&(_0x11d549['remark']=String(_0xcdacc5));if(_0x11d549[_0x537097(0xe3)]===undefined&&_0x11d549['remark']===undefined)throw CliErrors[_0x537097(0xe5)](_0x537097(0xef),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x11d549;}function a146_0x1c6e(_0x16659a,_0x577600){_0x16659a=_0x16659a-0xd5;const _0x505f36=a146_0x505f();let _0x1c6e96=_0x505f36[_0x16659a];return _0x1c6e96;}export const roleUpdate={'service':a146_0x5baf7f(0xe7),'command':a146_0x5baf7f(0xf0),'description':a146_0x5baf7f(0xf6),'risk':a146_0x5baf7f(0xd6),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a146_0x5baf7f(0xe2),'type':a146_0x5baf7f(0xd5),'required':![],'description':a146_0x5baf7f(0xee)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1c7e96){readPatch(_0x1c7e96);},async 'dryRun'(_0x3169c7){const _0x5d51fa=a146_0x5baf7f,_0x3ce66a=_0x3169c7[_0x5d51fa(0xe6)]('id'),_0x53f9b7=readPatch(_0x3169c7),_0x542cc3=await getRoleById(_0x3169c7[_0x5d51fa(0xe4)],_0x3ce66a);return assertCustomRole(_0x542cc3,_0x5d51fa(0xf0)),asDryRunResult({'operation':_0x5d51fa(0xf0),'selector':{'appCode':_0x3169c7['appCode'],'roleId':_0x3ce66a,'roleName':_0x542cc3[_0x5d51fa(0xe3)]},'before':projectRole(_0x542cc3),'after':projectRole({..._0x542cc3,..._0x53f9b7[_0x5d51fa(0xe3)]!==undefined?{'roleName':_0x53f9b7[_0x5d51fa(0xe3)]}:{},..._0x53f9b7[_0x5d51fa(0xde)]!==undefined?{'remark':_0x53f9b7['remark']}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x382884){const _0x3b3545=a146_0x5baf7f,_0x1b6fcc=_0x382884[_0x3b3545(0xe6)]('id'),_0x3a3c64=readPatch(_0x382884),_0x67cc91=await getRoleById(_0x382884[_0x3b3545(0xe4)],_0x1b6fcc);assertCustomRole(_0x67cc91,_0x3b3545(0xf0)),await updateAppRole({'id':_0x1b6fcc,'appCode':_0x382884[_0x3b3545(0xe4)],..._0x3a3c64[_0x3b3545(0xe3)]!==undefined?{'roleName':_0x3a3c64[_0x3b3545(0xe3)]}:{},..._0x3a3c64[_0x3b3545(0xde)]!==undefined?{'remark':_0x3a3c64[_0x3b3545(0xde)]}:{}});const _0x410407=await getRoleById(_0x382884[_0x3b3545(0xe4)],_0x1b6fcc);return{'ok':!![],'data':{'operation':_0x3b3545(0xf0),'selector':{'appCode':_0x382884[_0x3b3545(0xe4)],'roleId':_0x1b6fcc,'roleName':_0x410407['roleName']},'before':projectRole(_0x67cc91),'after':projectRole(_0x410407),'dryRun':![],'backend':{'method':_0x3b3545(0xe0),'path':UPDATE_PATH},'warnings':[]},'message':_0x3b3545(0xec)+_0x410407[_0x3b3545(0xe3)]+_0x3b3545(0xe8)+_0x1b6fcc+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a147_0x9684ff=a147_0x3179;(function(_0x9520b3,_0x57c67c){const _0x699912=a147_0x3179,_0x958073=_0x9520b3();while(!![]){try{const _0x3646b6=-parseInt(_0x699912(0x1a4))/0x1+-parseInt(_0x699912(0x1a3))/0x2*(-parseInt(_0x699912(0x1a5))/0x3)+parseInt(_0x699912(0x198))/0x4+parseInt(_0x699912(0x1a1))/0x5+parseInt(_0x699912(0x1aa))/0x6*(parseInt(_0x699912(0x1ac))/0x7)+parseInt(_0x699912(0x19c))/0x8+-parseInt(_0x699912(0x19e))/0x9*(parseInt(_0x699912(0x19b))/0xa);if(_0x3646b6===_0x57c67c)break;else _0x958073['push'](_0x958073['shift']());}catch(_0x2e72e7){_0x958073['push'](_0x958073['shift']());}}}(a147_0x1e88,0x3d62c));import{updateRoleUsers}from'../../core/api-client.js';function a147_0x3179(_0x17602f,_0x416890){_0x17602f=_0x17602f-0x197;const _0x1e88f1=a147_0x1e88();let _0x317928=_0x1e88f1[_0x17602f];return _0x317928;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a147_0x1e88(){const _0x38edf9=['userId','354912GGkxEJ','high-risk-write','28ZbZmDj','roleName','332492ccCjKT','\x20to\x20role\x20','\x20already\x20in\x20role\x20','10tuTvIL','3830480pAEiMN','appCode','3687489vqAEwP','role','No\x20change:\x20user\x20','388725QdrzkC','POST','2OIHYRN','225572VsovHq','31329JGHcgJ','selector','user-add','Added\x20user\x20'];a147_0x1e88=function(){return _0x38edf9;};return a147_0x1e88();}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':a147_0x9684ff(0x19f),'command':a147_0x9684ff(0x1a7),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','risk':a147_0x9684ff(0x1ab),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2c82b7){const _0x166531=a147_0x9684ff,{mutation:_0x41ba5b}=await prepareUserMutation(_0x2c82b7,_0x166531(0x1a7),!![]);return asDryRunResult(_0x41ba5b,{'method':_0x166531(0x1a2),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x562b33){const _0x3f35ab=a147_0x9684ff,{roleList:_0x41ffdc,mutation:_0x1799f3,changed:_0x3c8672}=await prepareUserMutation(_0x562b33,_0x3f35ab(0x1a7),![]);return _0x3c8672&&await updateRoleUsers(_0x562b33[_0x3f35ab(0x19d)],_0x41ffdc),{'ok':!![],'data':_0x1799f3,'message':_0x3c8672?_0x3f35ab(0x1a8)+_0x1799f3[_0x3f35ab(0x1a6)]['userId']+_0x3f35ab(0x199)+_0x1799f3[_0x3f35ab(0x1a6)]['roleName']:_0x3f35ab(0x1a0)+_0x1799f3[_0x3f35ab(0x1a6)][_0x3f35ab(0x1a9)]+_0x3f35ab(0x19a)+_0x1799f3[_0x3f35ab(0x1a6)][_0x3f35ab(0x197)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a148_0x5e7d75=a148_0x3da3;(function(_0xe85dfe,_0x3281ee){const _0x594e46=a148_0x3da3,_0x1c3c26=_0xe85dfe();while(!![]){try{const _0x407e21=parseInt(_0x594e46(0xeb))/0x1+-parseInt(_0x594e46(0xea))/0x2*(parseInt(_0x594e46(0xec))/0x3)+-parseInt(_0x594e46(0xf6))/0x4*(-parseInt(_0x594e46(0xf7))/0x5)+parseInt(_0x594e46(0xee))/0x6+parseInt(_0x594e46(0xfb))/0x7+parseInt(_0x594e46(0xf3))/0x8+-parseInt(_0x594e46(0xf5))/0x9;if(_0x407e21===_0x3281ee)break;else _0x1c3c26['push'](_0x1c3c26['shift']());}catch(_0x526323){_0x1c3c26['push'](_0x1c3c26['shift']());}}}(a148_0x3c0f,0x4c251));function a148_0x3c0f(){const _0xb18fa2=['high-risk-write','12270kOQmEy','342922voAztT','141NbfGKu','\x20from\x20role\x20','520602CbpFbv','\x20not\x20in\x20role\x20','POST','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','appCode','3654264eZsRPO','No\x20change:\x20user\x20','8569908ypMmoX','112KXvpLV','42095EqDjrd','user-remove','userId','selector','3011694ItLiLR','role'];a148_0x3c0f=function(){return _0xb18fa2;};return a148_0x3c0f();}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 a148_0x3da3(_0x2fa38b,_0x50ab19){_0x2fa38b=_0x2fa38b-0xe9;const _0x3c0fe5=a148_0x3c0f();let _0x3da347=_0x3c0fe5[_0x2fa38b];return _0x3da347;}export const roleUserRemove={'service':a148_0x5e7d75(0xfc),'command':a148_0x5e7d75(0xf8),'description':a148_0x5e7d75(0xf1),'risk':a148_0x5e7d75(0xe9),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x7549a5){const _0x31e775=a148_0x5e7d75,{mutation:_0x5a4960}=await prepareUserMutation(_0x7549a5,_0x31e775(0xf8),!![]);return asDryRunResult(_0x5a4960,{'method':_0x31e775(0xf0),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x5c6161){const _0x2c6091=a148_0x5e7d75,{roleList:_0x151878,mutation:_0x3b16fa,changed:_0x175917}=await prepareUserMutation(_0x5c6161,_0x2c6091(0xf8),![]);return _0x175917&&await updateRoleUsers(_0x5c6161[_0x2c6091(0xf2)],_0x151878),{'ok':!![],'data':_0x3b16fa,'message':_0x175917?'Removed\x20user\x20'+_0x3b16fa[_0x2c6091(0xfa)][_0x2c6091(0xf9)]+_0x2c6091(0xed)+_0x3b16fa[_0x2c6091(0xfa)]['roleName']:_0x2c6091(0xf4)+_0x3b16fa['selector'][_0x2c6091(0xf9)]+_0x2c6091(0xef)+_0x3b16fa[_0x2c6091(0xfa)]['roleName']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a149_0x18de(){const _0x1eaa3c=['6WSeupz','Pass\x20--name\x20<nickname|username>.','63nQLarq','9TLmSUA','userId','str','98087iyqlJX','13kutvGs','user-resolve','23442nQyEtZ','52DkyFEx','flagMissing','role','\x22\x20→\x20userId\x20','26165EsawXz','107356yduEnJ','matchedBy','trim','370XlOMga','269936kLlvWp','2496872JfIgpL','read','nickname','434424MHJpYP','name'];a149_0x18de=function(){return _0x1eaa3c;};return a149_0x18de();}const a149_0x4a052b=a149_0x383c;(function(_0x5edadf,_0x3bd6d9){const _0x110fa5=a149_0x383c,_0x241e8a=_0x5edadf();while(!![]){try{const _0x50c71d=-parseInt(_0x110fa5(0x85))/0x1+-parseInt(_0x110fa5(0x81))/0x2*(parseInt(_0x110fa5(0x8b))/0x3)+-parseInt(_0x110fa5(0x7c))/0x4*(parseInt(_0x110fa5(0x80))/0x5)+parseInt(_0x110fa5(0x7b))/0x6*(parseInt(_0x110fa5(0x74))/0x7)+-parseInt(_0x110fa5(0x86))/0x8*(-parseInt(_0x110fa5(0x75))/0x9)+parseInt(_0x110fa5(0x84))/0xa*(parseInt(_0x110fa5(0x78))/0xb)+parseInt(_0x110fa5(0x89))/0xc*(-parseInt(_0x110fa5(0x79))/0xd);if(_0x50c71d===_0x3bd6d9)break;else _0x241e8a['push'](_0x241e8a['shift']());}catch(_0x36d718){_0x241e8a['push'](_0x241e8a['shift']());}}}(a149_0x18de,0x2fc5e));import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a149_0x383c(_0x3d9670,_0x5e9e59){_0x3d9670=_0x3d9670-0x73;const _0x18deb2=a149_0x18de();let _0x383cae=_0x18deb2[_0x3d9670];return _0x383cae;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a149_0x4a052b(0x7e),'command':a149_0x4a052b(0x7a),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a149_0x4a052b(0x87),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x36a604){const _0x46fce7=a149_0x4a052b;if(!_0x36a604[_0x46fce7(0x77)](_0x46fce7(0x8a))[_0x46fce7(0x83)]())throw CliErrors[_0x46fce7(0x7d)]('name',_0x46fce7(0x73));},async 'execute'(_0x5846c0){const _0x3efdce=a149_0x4a052b,_0x4e3c35=_0x5846c0[_0x3efdce(0x77)](_0x3efdce(0x8a))[_0x3efdce(0x83)](),_0x23b05d=await resolveUserRef(_0x4e3c35);return{'ok':!![],'data':{'user':{'userId':_0x23b05d[_0x3efdce(0x76)],'username':_0x23b05d['username'],'nickname':_0x23b05d[_0x3efdce(0x88)],'matchedBy':_0x23b05d[_0x3efdce(0x82)]}},'message':'Resolved\x20\x22'+_0x4e3c35+_0x3efdce(0x7f)+_0x23b05d['userId']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a150_0x2001f7=a150_0x2ee5;(function(_0x1981b1,_0x28103b){const _0x2a11a5=a150_0x2ee5,_0x4fd8b2=_0x1981b1();while(!![]){try{const _0x3ce552=-parseInt(_0x2a11a5(0x10e))/0x1+-parseInt(_0x2a11a5(0x121))/0x2*(parseInt(_0x2a11a5(0x107))/0x3)+-parseInt(_0x2a11a5(0x10d))/0x4*(-parseInt(_0x2a11a5(0x139))/0x5)+parseInt(_0x2a11a5(0x10b))/0x6+parseInt(_0x2a11a5(0x120))/0x7+parseInt(_0x2a11a5(0x11e))/0x8+-parseInt(_0x2a11a5(0x11d))/0x9;if(_0x3ce552===_0x28103b)break;else _0x4fd8b2['push'](_0x4fd8b2['shift']());}catch(_0x2b4ede){_0x4fd8b2['push'](_0x4fd8b2['shift']());}}}(a150_0x4097,0x4a6b4));import{readFileSync,existsSync}from'node:fs';function a150_0x4097(){const _0x38c2eb=['\x0a\x20\x20Usage:\x20','join','inherit','(none)','needsUpgrade','vite','log','Enable\x20watch\x20mode\x20for\x20preview','preview','1579707LRVZdL','1717904Zhhupo','cwd','1885562edFPPv','1700TwRYhI','boolean','bun.lockb','close','vite\x20preview\x20exited\x20with\x20code\x20','Script\x20name\x20defined\x20in\x20package.json','parse','bool','scripts','package.json','\x20\x20\x20\x20','length','Available:\x20','push','node_modules','all','dev','has','script','\x0a\x20\x20Available\x20scripts:\x0a','error','\x20run\x20preview\x20--watch','\x22\x20not\x20found\x20in\x20package.json.','\x20run\x20start','15395xtaIuW','\x20exited\x20with\x20code\x20','pnpm-lock.yaml','.bin','\x20run\x20preview','Run\x20a\x20package.json\x20script','validation','--watch','start','1893rPEvCu','build','keys','bun.lock','3423540pLrVqm','run','348YkCbYN','305874FIRSCv','args','yarn','watch','\x20run\x20<script>\x0a','No\x20package.json\x20found\x20in\x20current\x20directory.'];a150_0x4097=function(){return _0x38c2eb;};return a150_0x4097();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a150_0x2001f7(0x106),a150_0x2001f7(0x131)]);function readPackageScripts(_0x3962c9){const _0x3e6d30=a150_0x2001f7,_0x6c0e9=resolve(_0x3962c9,_0x3e6d30(0x12a));if(!existsSync(_0x6c0e9))return null;try{const _0x52a9db=JSON[_0x3e6d30(0x127)](readFileSync(_0x6c0e9,'utf-8'));return _0x52a9db[_0x3e6d30(0x129)]??{};}catch{return null;}}function a150_0x2ee5(_0x3954a1,_0x1cff37){_0x3954a1=_0x3954a1-0xff;const _0x4097c8=a150_0x4097();let _0x2ee50d=_0x4097c8[_0x3954a1];return _0x2ee50d;}function detectPackageManager(_0x5d727d){const _0x36fe63=a150_0x2001f7;if(existsSync(resolve(_0x5d727d,_0x36fe63(0x123)))||existsSync(resolve(_0x5d727d,_0x36fe63(0x10a))))return'bun';if(existsSync(resolve(_0x5d727d,_0x36fe63(0x100))))return'pnpm';if(existsSync(resolve(_0x5d727d,'yarn.lock')))return _0x36fe63(0x110);return'npm';}async function versionCheck(_0xe4a096){const _0x19b898=a150_0x2001f7,_0x24b174=await checkCliVersion();(_0x24b174['needsUpgrade']||_0x24b174['belowMinimum'])&&(printCliUpgradeWarning(_0x24b174),assertCliVersionSupported(_0x24b174));const _0x559bfd=await checkSdkVersion(_0xe4a096);if(_0x559bfd[_0x19b898(0x118)])printSdkUpgradeWarning(_0x559bfd);}function spawnScript(_0x57de41,_0x20c1dd,_0x501a33,_0x2f71e4){return new Promise((_0x5aaa25,_0x5caadb)=>{const _0x196762=a150_0x2ee5,_0x3c9d4c=[_0x196762(0x10c),_0x20c1dd,..._0x501a33],_0x50be3c=spawn(_0x57de41,_0x3c9d4c,{'cwd':_0x2f71e4,'stdio':_0x196762(0x116),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2f71e4,_0x196762(0x12f),_0x196762(0x101))+delimiter+process.env.PATH}});_0x50be3c['on']('close',_0x13bf96=>{const _0x2a6b38=_0x196762;if(_0x13bf96===0x0||_0x13bf96===null)_0x5aaa25();else _0x5caadb(new Error(_0x57de41+'\x20run\x20'+_0x20c1dd+_0x2a6b38(0xff)+_0x13bf96));}),_0x50be3c['on'](_0x196762(0x135),_0x5caadb);});}function spawnViteBuildWatch(_0x7429bc){return new Promise((_0xb7cd40,_0x26b289)=>{const _0x23564a=a150_0x2ee5,_0x511117=spawn(_0x23564a(0x119),[_0x23564a(0x108),_0x23564a(0x105)],{'cwd':_0x7429bc,'stdio':_0x23564a(0x116),'shell':!![],'env':{...process.env,'PATH':''+join(_0x7429bc,_0x23564a(0x12f),_0x23564a(0x101))+delimiter+process.env.PATH}});_0x511117['on'](_0x23564a(0x124),_0x160598=>{if(_0x160598===0x0||_0x160598===null)_0xb7cd40();else _0x26b289(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x160598));}),_0x511117['on'](_0x23564a(0x135),_0x26b289);});}function spawnVitePreview(_0x3256f3){return new Promise((_0xcf1b01,_0x4460c1)=>{const _0x5cd302=a150_0x2ee5,_0x140aa1=spawn('vite',['preview'],{'cwd':_0x3256f3,'stdio':_0x5cd302(0x116),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3256f3,_0x5cd302(0x12f),_0x5cd302(0x101))+delimiter+process.env.PATH}});_0x140aa1['on'](_0x5cd302(0x124),_0x3b8242=>{const _0x2dbe1f=_0x5cd302;if(_0x3b8242===0x0||_0x3b8242===null)_0xcf1b01();else _0x4460c1(new Error(_0x2dbe1f(0x125)+_0x3b8242));}),_0x140aa1['on'](_0x5cd302(0x135),_0x4460c1);});}const runFlags=[{'name':a150_0x2001f7(0x111),'type':a150_0x2001f7(0x122),'description':a150_0x2001f7(0x11b),'default':![]}];export const runDefinition={'service':a150_0x2001f7(0x10c),'command':a150_0x2001f7(0x10c),'description':a150_0x2001f7(0x103),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a150_0x2001f7(0x133),'description':a150_0x2001f7(0x126),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x3e03c2=a150_0x2001f7,_0x45f421=[];return _0x45f421['push']('\x20\x20EXAMPLES'),_0x45f421[_0x3e03c2(0x12e)](_0x3e03c2(0x12b)+CLI_BIN_NAME+_0x3e03c2(0x138)),_0x45f421[_0x3e03c2(0x12e)](_0x3e03c2(0x12b)+CLI_BIN_NAME+'\x20run\x20build'),_0x45f421[_0x3e03c2(0x12e)](_0x3e03c2(0x12b)+CLI_BIN_NAME+_0x3e03c2(0x102)),_0x45f421[_0x3e03c2(0x12e)](_0x3e03c2(0x12b)+CLI_BIN_NAME+_0x3e03c2(0x136)),_0x45f421[_0x3e03c2(0x115)]('\x0a');},async 'execute'(_0x54bb4f){const _0x4a86d6=a150_0x2001f7,_0x5cd036=process[_0x4a86d6(0x11f)](),_0x3b4156=_0x54bb4f[_0x4a86d6(0x10f)][0x0],_0xb65597=_0x54bb4f[_0x4a86d6(0x10f)]['slice'](0x1),_0x4fef94=readPackageScripts(_0x5cd036);if(!_0x4fef94)throw CliErrors[_0x4a86d6(0x104)](_0x4a86d6(0x113));if(!_0x3b4156){const _0x41f86e=Object[_0x4a86d6(0x109)](_0x4fef94);if(_0x41f86e[_0x4a86d6(0x12c)]===0x0)console[_0x4a86d6(0x11a)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x4a86d6(0x11a)](_0x4a86d6(0x134));for(const _0x25a6d9 of _0x41f86e){console[_0x4a86d6(0x11a)](_0x4a86d6(0x12b)+_0x25a6d9);}console[_0x4a86d6(0x11a)](_0x4a86d6(0x114)+CLI_BIN_NAME+_0x4a86d6(0x112));}return{'ok':!![]};}if(!_0x4fef94[_0x3b4156])throw CliErrors['validation']('Script\x20\x22'+_0x3b4156+_0x4a86d6(0x137),_0x4a86d6(0x12d)+(Object[_0x4a86d6(0x109)](_0x4fef94)[_0x4a86d6(0x115)](',\x20')||_0x4a86d6(0x117)));const _0x328497=detectPackageManager(_0x5cd036);VERSION_CHECK_SCRIPTS[_0x4a86d6(0x132)](_0x3b4156)&&await versionCheck(_0x5cd036);if(_0x3b4156===_0x4a86d6(0x11c)&&_0x54bb4f[_0x4a86d6(0x128)]('watch'))return await Promise[_0x4a86d6(0x130)]([spawnViteBuildWatch(_0x5cd036),spawnVitePreview(_0x5cd036)]),{'ok':!![]};return await spawnScript(_0x328497,_0x3b4156,_0xb65597,_0x5cd036),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a151_0x53c91f=a151_0x551e;(function(_0x1f0e26,_0x35fd20){const _0x5e17b0=a151_0x551e,_0x22c581=_0x1f0e26();while(!![]){try{const _0xe8200f=parseInt(_0x5e17b0(0x16f))/0x1+parseInt(_0x5e17b0(0x173))/0x2+-parseInt(_0x5e17b0(0x16d))/0x3+-parseInt(_0x5e17b0(0x16a))/0x4+parseInt(_0x5e17b0(0x167))/0x5*(parseInt(_0x5e17b0(0x168))/0x6)+parseInt(_0x5e17b0(0x172))/0x7*(parseInt(_0x5e17b0(0x169))/0x8)+parseInt(_0x5e17b0(0x16c))/0x9;if(_0xe8200f===_0x35fd20)break;else _0x22c581['push'](_0x22c581['shift']());}catch(_0x41bb58){_0x22c581['push'](_0x22c581['shift']());}}}(a151_0x2a0a,0xcdbec));function a151_0x2a0a(){const _0x5243b7=['2702226csxZtU','json','29287aXZBdM','schema','read','100702bJbZVa','757654tNMVjR','699065eBZLeA','36baIEhV','168nuYWlV','5592112XrLsAG','export','14331636Uyrdvd'];a151_0x2a0a=function(){return _0x5243b7;};return a151_0x2a0a();}import{buildSchemaPayload}from'../framework/schema-export.js';function a151_0x551e(_0x536821,_0x3dce7f){_0x536821=_0x536821-0x167;const _0x2a0aac=a151_0x2a0a();let _0x551ea1=_0x2a0aac[_0x536821];return _0x551ea1;}async function execute(_0x22ab7b){const _0x504b06=await buildSchemaPayload();return{'ok':!![],'data':_0x504b06};}export const schemaDefinition={'service':a151_0x53c91f(0x170),'command':a151_0x53c91f(0x16b),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a151_0x53c91f(0x171),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a151_0x53c91f(0x16e),'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a150_0x551c5e=a150_0x512f;(function(_0x254201,_0x1eaed3){const _0xee77c0=a150_0x512f,_0x576820=_0x254201();while(!![]){try{const _0x191733=parseInt(_0xee77c0(0x200))/0x1+parseInt(_0xee77c0(0x204))/0x2+parseInt(_0xee77c0(0x20b))/0x3+-parseInt(_0xee77c0(0x1f4))/0x4+-parseInt(_0xee77c0(0x1e7))/0x5+-parseInt(_0xee77c0(0x208))/0x6*(parseInt(_0xee77c0(0x1d4))/0x7)+parseInt(_0xee77c0(0x1f5))/0x8*(-parseInt(_0xee77c0(0x1f3))/0x9);if(_0x191733===_0x1eaed3)break;else _0x576820['push'](_0x576820['shift']());}catch(_0x27cb1e){_0x576820['push'](_0x576820['shift']());}}}(a150_0x2ab3,0x25b36));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x41de33){const _0x5289c=a150_0x512f;if(_0x41de33===_0x5289c(0x1df))return[_0x5289c(0x1f2),_0x5289c(0x207),_0x5289c(0x1e8),'']['join']('\x0a');return[_0x5289c(0x20e),''][_0x5289c(0x203)]('\x0a');}export const sqlCreate={'service':a150_0x551c5e(0x209),'command':'create','description':a150_0x551c5e(0x1fa),'risk':a150_0x551c5e(0x20d),'flags':[{'name':a150_0x551c5e(0x1de),'type':a150_0x551c5e(0x1e1),'description':'SQL\x20query\x20display\x20name'},{'name':a150_0x551c5e(0x1eb),'type':a150_0x551c5e(0x206),'description':a150_0x551c5e(0x1f7)},{'name':a150_0x551c5e(0x1ea),'type':a150_0x551c5e(0x1e1),'enum':[a150_0x551c5e(0x209),a150_0x551c5e(0x1df)],'description':a150_0x551c5e(0x1d7)}],async 'validate'(_0x4eb253){const _0x53d74d=a150_0x551c5e;if(!_0x4eb253[_0x53d74d(0x1f6)])return;if(!_0x4eb253[_0x53d74d(0x1d6)](_0x53d74d(0x1de))[_0x53d74d(0x1ec)]())throw CliErrors[_0x53d74d(0x1fc)](_0x53d74d(0x1de),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x16b7ba=resolveProvidedDbId(_0x4eb253);if(typeof _0x16b7ba!==_0x53d74d(0x206)||!Number[_0x53d74d(0x202)](_0x16b7ba)||_0x16b7ba<=0x0)throw CliErrors['flagMissing'](_0x53d74d(0x1eb),_0x53d74d(0x1dd));if(!_0x4eb253[_0x53d74d(0x1d6)](_0x53d74d(0x1ea))[_0x53d74d(0x1ec)]())throw CliErrors[_0x53d74d(0x1fc)](_0x53d74d(0x1ea),_0x53d74d(0x213));},async 'dryRun'(_0x3fa9a1){const _0x2dc455=a150_0x551c5e,_0x1469aa=loadSqlProjectConfig(_0x3fa9a1['appCode']),{sqlName:_0x25e29e,dbId:_0x353f16,dbName:_0x542201,mode:_0x5e3bf3}=await resolveSqlNewInputs(_0x3fa9a1),_0x3623a3=buildSqlRelativePath(_0x2dc455(0x1e0),_0x25e29e,_0x542201,_0x5e3bf3,_0x353f16),_0x4307e5=_0x1469aa[_0x2dc455(0x211)]+'/'+_0x3623a3;return{'method':_0x2dc455(0x1e6),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x3fa9a1[_0x2dc455(0x1fe)],'sqlName':_0x25e29e,'dbId':_0x353f16,'mode':_0x5e3bf3,'localPath':_0x4307e5},'description':_0x2dc455(0x1f1)+_0x1469aa[_0x2dc455(0x211)]};},async 'execute'(_0x11ec55){const _0x1fdc20=a150_0x551c5e,_0x27b5ac=loadSqlProjectConfig(_0x11ec55[_0x1fdc20(0x1fe)]),{sqlName:_0x485ede,dbId:_0x1e96e2,dbName:_0x4b252b,mode:_0x6bcf5}=await resolveSqlNewInputs(_0x11ec55),_0x51ae5d=generateSqlTemplate(_0x6bcf5),_0x440304=await createSqlQuery({'appCode':_0x11ec55[_0x1fdc20(0x1fe)],'sqlName':_0x485ede,'dbId':_0x1e96e2,'sqlContent':_0x51ae5d}),_0x349ca5=ensureRemoteSqlContent(_0x440304),_0x1585a8=_0x4b252b||await getDbName(_0x11ec55[_0x1fdc20(0x1fe)],_0x1e96e2)[_0x1fdc20(0x1da)](()=>undefined),_0x26a135=buildSqlRelativePath(_0x440304[_0x1fdc20(0x1f9)],_0x440304[_0x1fdc20(0x1e2)],_0x1585a8,_0x6bcf5,_0x1e96e2),_0x29ca5d=_0x27b5ac[_0x1fdc20(0x211)]+'/'+_0x26a135,_0xdae4e1=buildLocalSqlFileContent({'sqlCode':_0x440304[_0x1fdc20(0x1f9)],'sqlName':_0x440304[_0x1fdc20(0x1e2)],'dbId':_0x440304[_0x1fdc20(0x1fb)]},_0x349ca5,{'dbName':_0x1585a8,'mode':_0x6bcf5,'syncedAt':new Date()[_0x1fdc20(0x20a)](),'description':_0x440304['description']});if(await fileExists(_0x29ca5d))throw CliErrors[_0x1fdc20(0x1e4)](_0x1fdc20(0x1d8)+_0x29ca5d);await ensureParentDirectory(_0x29ca5d),await writeFile(_0x29ca5d,_0xdae4e1,_0x1fdc20(0x1d2));const _0x207df8=await readSqlLockFile(_0x27b5ac[_0x1fdc20(0x1d3)]),{lockData:_0x1c5999,appLock:_0x19bd61}=ensureSqlLockScope(_0x207df8??createEmptySqlLock(),_0x27b5ac[_0x1fdc20(0x1fe)],_0x27b5ac[_0x1fdc20(0x20f)],_0x1fdc20(0x1f8));return _0x19bd61[_0x1fdc20(0x212)][_0x440304['sqlCode']]={...buildSqlLockEntry(_0x440304,_0x349ca5,computeSqlContentHash(_0xdae4e1),{'dbName':_0x1585a8}),'path':_0x26a135,'mode':_0x6bcf5},_0x19bd61['lastSync']=new Date()[_0x1fdc20(0x20a)](),await writeSqlLockFile(_0x27b5ac['lockFilePath'],_0x1c5999),{'ok':!![],'data':{'id':_0x440304['id'],'sqlCode':_0x440304['sqlCode'],'sqlName':_0x440304[_0x1fdc20(0x1e2)],'dbId':_0x440304['dbId'],'path':_0x29ca5d,'mode':_0x6bcf5},'message':'Created\x20SQL\x20query\x20'+_0x440304[_0x1fdc20(0x1f9)]};}};function a150_0x512f(_0x14431f,_0x441c43){_0x14431f=_0x14431f-0x1d2;const _0x2ab33c=a150_0x2ab3();let _0x512fc6=_0x2ab33c[_0x14431f];return _0x512fc6;}async function resolveSqlNewInputs(_0x3854ec){const _0x154b6b=await resolveSqlNameInput(_0x3854ec),{dbId:_0x5f120f,dbName:_0x35ea4d}=await resolveDbSelection(_0x3854ec),_0x1553fa=await resolveSqlModeInput(_0x3854ec);return{'sqlName':_0x154b6b,'dbId':_0x5f120f,'dbName':_0x35ea4d,'mode':_0x1553fa};}async function resolveSqlNameInput(_0x4ab22d){const _0x45a52a=a150_0x551c5e,_0x4755ff=_0x4ab22d['str'](_0x45a52a(0x1de))[_0x45a52a(0x1ec)]();if(_0x4755ff)return _0x4755ff;if(_0x4ab22d[_0x45a52a(0x1f6)])throw CliErrors[_0x45a52a(0x1fc)](_0x45a52a(0x1de),_0x45a52a(0x20c));return(await input({'message':_0x45a52a(0x1d5),'validate':_0x55596f=>_0x55596f[_0x45a52a(0x1ec)]()?!![]:_0x45a52a(0x1ed)}))['trim']();}async function resolveDbSelection(_0x1eed98){const _0x58811b=a150_0x551c5e,_0x5260bf=resolveProvidedDbId(_0x1eed98);if(typeof _0x5260bf===_0x58811b(0x206)&&Number[_0x58811b(0x202)](_0x5260bf)&&_0x5260bf>0x0)return{'dbId':_0x5260bf,'dbName':await getDbName(_0x1eed98[_0x58811b(0x1fe)],_0x5260bf)['catch'](()=>undefined)};if(_0x1eed98[_0x58811b(0x1f6)])throw CliErrors[_0x58811b(0x1fc)]('db-id','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x21169c=await listDatabases(_0x1eed98['appCode'])[_0x58811b(0x1da)](()=>[]);if(_0x21169c['length']===0x1)return{'dbId':_0x21169c[0x0][_0x58811b(0x1fb)],'dbName':_0x21169c[0x0][_0x58811b(0x1d9)]};if(_0x21169c[_0x58811b(0x1ff)]>0x1){const _0x17a00d=await select({'message':_0x58811b(0x210),'choices':[..._0x21169c['map'](_0x441115=>({'name':_0x441115[_0x58811b(0x1d9)]+'\x20('+_0x441115[_0x58811b(0x1fb)]+')','value':serializeDbSelection(_0x441115)})),{'name':'✎\x20手动输入\x20dbId','value':'__manual__'}]});if(_0x17a00d!==_0x58811b(0x1ee))return deserializeDbSelection(_0x17a00d);}const _0x108122=await input({'message':_0x58811b(0x1e3),'validate':_0x4047b4=>{const _0x210b65=_0x58811b,_0x330287=_0x4047b4[_0x210b65(0x1ec)]();if(!_0x330287)return _0x210b65(0x205);const _0x898aa7=Number(_0x330287);if(!Number['isInteger'](_0x898aa7)||_0x898aa7<=0x0)return _0x210b65(0x1e9);return!![];}});return{'dbId':Number(_0x108122[_0x58811b(0x1ec)]())};}async function resolveSqlModeInput(_0x585f28){const _0x11ccc1=a150_0x551c5e,_0x4ec02a=_0x585f28[_0x11ccc1(0x1d6)](_0x11ccc1(0x1ea))[_0x11ccc1(0x1ec)]();if(_0x4ec02a===_0x11ccc1(0x209)||_0x4ec02a===_0x11ccc1(0x1df))return _0x4ec02a;if(_0x585f28[_0x11ccc1(0x1f6)])throw CliErrors[_0x11ccc1(0x1fc)](_0x11ccc1(0x1ea),_0x11ccc1(0x213));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x11ccc1(0x1e5),'value':_0x11ccc1(0x209),'description':_0x11ccc1(0x201)},{'name':_0x11ccc1(0x1dc),'value':_0x11ccc1(0x1df),'description':_0x11ccc1(0x214)}]});}function a150_0x2ab3(){const _0x38e050=['--name\x20is\x20required\x20in\x20non-interactive\x20mode.','high-risk-write','SELECT\x201\x20AS\x20id;','sqlRoot','请选择目标数据库:','sqlRootDir','sqls','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','适合带动态标签的\x20MyBatis\x20XML\x20SQL','utf8','lockFilePath','434Xvbshf','请输入\x20SQL\x20名称:','str','Local\x20SQL\x20file\x20mode','File\x20already\x20exists:\x20','dbName','catch','flag','MyBatis\x20XML(mybatisXml)','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','name','mybatisXml','<server-generated-sqlCode>','string','sqlName','请输入目标数据库\x20dbId:','validation','普通\x20SQL(sql)','POST','1306740oTSDOz','</select>','dbId\x20必须为正整数','mode','db-id','trim','SQL\x20名称不能为空','__manual__','stringify','parse','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','730791TfrVxS','449320MVQkAJ','16zoksTt','nonInteractive','Target\x20database\x20ID','new','sqlCode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','dbId','flagMissing','Invalid\x20database\x20selection\x20payload:\x20','appCode','length','250996ruLJSJ','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','isFinite','join','583952rUXeHP','dbId\x20不能为空','number','\x20\x20SELECT\x201\x20AS\x20id','1956cdejCQ','sql','toISOString','503214SsWZDq'];a150_0x2ab3=function(){return _0x38e050;};return a150_0x2ab3();}function serializeDbSelection(_0x44ac0a){const _0x3d3352=a150_0x551c5e;return JSON[_0x3d3352(0x1ef)]({'dbId':_0x44ac0a[_0x3d3352(0x1fb)],'dbName':_0x44ac0a[_0x3d3352(0x1d9)]});}function deserializeDbSelection(_0x416185){const _0x13b28f=a150_0x551c5e;try{const _0x228d61=JSON[_0x13b28f(0x1f0)](_0x416185);if(typeof _0x228d61[_0x13b28f(0x1fb)]==='number'&&Number['isFinite'](_0x228d61[_0x13b28f(0x1fb)]))return{'dbId':_0x228d61[_0x13b28f(0x1fb)],'dbName':_0x228d61['dbName']};}catch{}throw CliErrors[_0x13b28f(0x1e4)](_0x13b28f(0x1fd)+_0x416185);}function resolveProvidedDbId(_0xdee31d){const _0x32db69=a150_0x551c5e,_0x2fb03c=_0xdee31d[_0x32db69(0x1db)](_0x32db69(0x1eb));if(typeof _0x2fb03c==='number'&&Number[_0x32db69(0x202)](_0x2fb03c))return _0x2fb03c;return undefined;}
|
|
1
|
+
const a152_0x34191c=a152_0x1c9a;(function(_0xd26d1e,_0x2a299c){const _0x132356=a152_0x1c9a,_0x393014=_0xd26d1e();while(!![]){try{const _0x1effc1=-parseInt(_0x132356(0x10f))/0x1*(parseInt(_0x132356(0xe7))/0x2)+-parseInt(_0x132356(0x113))/0x3+-parseInt(_0x132356(0xf5))/0x4*(-parseInt(_0x132356(0x108))/0x5)+-parseInt(_0x132356(0xe5))/0x6+parseInt(_0x132356(0xf6))/0x7+-parseInt(_0x132356(0x111))/0x8*(parseInt(_0x132356(0x127))/0x9)+parseInt(_0x132356(0x10c))/0xa;if(_0x1effc1===_0x2a299c)break;else _0x393014['push'](_0x393014['shift']());}catch(_0x2890d8){_0x393014['push'](_0x393014['shift']());}}}(a152_0x49f6,0xea48f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a152_0x1c9a(_0x1b7214,_0xe7f202){_0x1b7214=_0x1b7214-0xe3;const _0x49f694=a152_0x49f6();let _0x1c9a6f=_0x49f694[_0x1b7214];return _0x1c9a6f;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';function a152_0x49f6(){const _0x2ed4ec=['sqls','适合带动态标签的\x20MyBatis\x20XML\x20SQL','28TfwUgT','name','427104joheAF','description','3233454aeiNGw','join','POST','MyBatis\x20XML(mybatisXml)','validation','number','SQL\x20名称不能为空','请选择目标数据库:','isFinite','Target\x20database\x20ID','</select>','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','isInteger','sqlName','\x20\x20SELECT\x201\x20AS\x20id','请选择本地\x20SQL\x20模式:','File\x20already\x20exists:\x20','string','请输入\x20SQL\x20名称:','162XFajVd','SQL\x20query\x20display\x20name','db-id','2568312SAEfoG','catch','13778rOGzJy','Invalid\x20database\x20selection\x20payload:\x20','请输入目标数据库\x20dbId:','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','length','sql','SELECT\x201\x20AS\x20id;','__manual__','flagMissing','sqlCode','lastSync','utf8','appCode','dbName','1303556RXvMZf','235739szSsOT','high-risk-write','sqlRoot','toISOString','dbId','flag','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','普通\x20SQL(sql)','sqlRootDir','stringify','nonInteractive','mybatisXml','✎\x20手动输入\x20dbId','/smartapi/custom/saveUserCustomSql','create','dbId\x20必须为正整数','str','map','15VLiZKe','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','new','trim','26080330Iqikbc'];a152_0x49f6=function(){return _0x2ed4ec;};return a152_0x49f6();}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(_0x1265e2){const _0x1871b0=a152_0x1c9a;if(_0x1265e2==='mybatisXml')return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x1871b0(0x122),_0x1871b0(0x11d),'']['join']('\x0a');return[_0x1871b0(0xed),''][_0x1871b0(0x114)]('\x0a');}export const sqlCreate={'service':a152_0x34191c(0xec),'command':a152_0x34191c(0x104),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a152_0x34191c(0xf7),'flags':[{'name':a152_0x34191c(0x110),'type':'string','description':a152_0x34191c(0xe3)},{'name':'db-id','type':a152_0x34191c(0x118),'description':a152_0x34191c(0x11c)},{'name':'mode','type':a152_0x34191c(0x125),'enum':['sql',a152_0x34191c(0x101)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x22c360){const _0x3e8a6c=a152_0x34191c;if(!_0x22c360[_0x3e8a6c(0x100)])return;if(!_0x22c360[_0x3e8a6c(0x106)](_0x3e8a6c(0x110))[_0x3e8a6c(0x10b)]())throw CliErrors[_0x3e8a6c(0xef)](_0x3e8a6c(0x110),_0x3e8a6c(0xfc));const _0x19200b=resolveProvidedDbId(_0x22c360);if(typeof _0x19200b!=='number'||!Number[_0x3e8a6c(0x11b)](_0x19200b)||_0x19200b<=0x0)throw CliErrors[_0x3e8a6c(0xef)](_0x3e8a6c(0xe4),_0x3e8a6c(0xea));if(!_0x22c360[_0x3e8a6c(0x106)](_0x3e8a6c(0x11f))[_0x3e8a6c(0x10b)]())throw CliErrors[_0x3e8a6c(0xef)](_0x3e8a6c(0x11f),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x5d428a){const _0x196289=a152_0x34191c,_0x4924ad=loadSqlProjectConfig(_0x5d428a['appCode']),{sqlName:_0x3fa51d,dbId:_0x6e224b,dbName:_0x34cc32,mode:_0x215e6b}=await resolveSqlNewInputs(_0x5d428a),_0x229d43=buildSqlRelativePath('<server-generated-sqlCode>',_0x3fa51d,_0x34cc32,_0x215e6b,_0x6e224b),_0x55c0b8=_0x4924ad[_0x196289(0xfe)]+'/'+_0x229d43;return{'method':_0x196289(0x115),'url':_0x196289(0x103),'body':{'appCode':_0x5d428a['appCode'],'sqlName':_0x3fa51d,'dbId':_0x6e224b,'mode':_0x215e6b,'localPath':_0x55c0b8},'description':_0x196289(0x109)+_0x4924ad['sqlRootDir']};},async 'execute'(_0x290d58){const _0x1845ac=a152_0x34191c,_0x48cf21=loadSqlProjectConfig(_0x290d58['appCode']),{sqlName:_0x16f06e,dbId:_0x54f8ac,dbName:_0x422387,mode:_0x4a8248}=await resolveSqlNewInputs(_0x290d58),_0x468d87=generateSqlTemplate(_0x4a8248),_0xd47c97=await createSqlQuery({'appCode':_0x290d58[_0x1845ac(0xf3)],'sqlName':_0x16f06e,'dbId':_0x54f8ac,'sqlContent':_0x468d87}),_0xc35ff0=ensureRemoteSqlContent(_0xd47c97),_0x29a5cd=_0x422387||await getDbName(_0x290d58['appCode'],_0x54f8ac)[_0x1845ac(0xe6)](()=>undefined),_0x3b7472=buildSqlRelativePath(_0xd47c97['sqlCode'],_0xd47c97[_0x1845ac(0x121)],_0x29a5cd,_0x4a8248,_0x54f8ac),_0x5a0b08=_0x48cf21[_0x1845ac(0xfe)]+'/'+_0x3b7472,_0x3cabf4=buildLocalSqlFileContent({'sqlCode':_0xd47c97[_0x1845ac(0xf0)],'sqlName':_0xd47c97[_0x1845ac(0x121)],'dbId':_0xd47c97[_0x1845ac(0xfa)]},_0xc35ff0,{'dbName':_0x29a5cd,'mode':_0x4a8248,'syncedAt':new Date()[_0x1845ac(0xf9)](),'description':_0xd47c97[_0x1845ac(0x112)]});if(await fileExists(_0x5a0b08))throw CliErrors[_0x1845ac(0x117)](_0x1845ac(0x124)+_0x5a0b08);await ensureParentDirectory(_0x5a0b08),await writeFile(_0x5a0b08,_0x3cabf4,_0x1845ac(0xf2));const _0x571fac=await readSqlLockFile(_0x48cf21['lockFilePath']),{lockData:_0x436f9b,appLock:_0x40a57f}=ensureSqlLockScope(_0x571fac??createEmptySqlLock(),_0x48cf21[_0x1845ac(0xf3)],_0x48cf21[_0x1845ac(0xf8)],_0x1845ac(0x10a));return _0x40a57f[_0x1845ac(0x10d)][_0xd47c97[_0x1845ac(0xf0)]]={...buildSqlLockEntry(_0xd47c97,_0xc35ff0,computeSqlContentHash(_0x3cabf4),{'dbName':_0x29a5cd}),'path':_0x3b7472,'mode':_0x4a8248},_0x40a57f[_0x1845ac(0xf1)]=new Date()[_0x1845ac(0xf9)](),await writeSqlLockFile(_0x48cf21['lockFilePath'],_0x436f9b),{'ok':!![],'data':{'id':_0xd47c97['id'],'sqlCode':_0xd47c97[_0x1845ac(0xf0)],'sqlName':_0xd47c97[_0x1845ac(0x121)],'dbId':_0xd47c97[_0x1845ac(0xfa)],'path':_0x5a0b08,'mode':_0x4a8248},'message':'Created\x20SQL\x20query\x20'+_0xd47c97[_0x1845ac(0xf0)]};}};async function resolveSqlNewInputs(_0x3c89d4){const _0x42196a=await resolveSqlNameInput(_0x3c89d4),{dbId:_0x2516e0,dbName:_0x247f86}=await resolveDbSelection(_0x3c89d4),_0x3efc90=await resolveSqlModeInput(_0x3c89d4);return{'sqlName':_0x42196a,'dbId':_0x2516e0,'dbName':_0x247f86,'mode':_0x3efc90};}async function resolveSqlNameInput(_0x33b961){const _0x2580e5=a152_0x34191c,_0x1ee938=_0x33b961[_0x2580e5(0x106)](_0x2580e5(0x110))[_0x2580e5(0x10b)]();if(_0x1ee938)return _0x1ee938;if(_0x33b961[_0x2580e5(0x100)])throw CliErrors[_0x2580e5(0xef)]('name',_0x2580e5(0xfc));return(await input({'message':_0x2580e5(0x126),'validate':_0x2c7872=>_0x2c7872[_0x2580e5(0x10b)]()?!![]:_0x2580e5(0x119)}))[_0x2580e5(0x10b)]();}async function resolveDbSelection(_0x48e459){const _0x3bc509=a152_0x34191c,_0x24cda6=resolveProvidedDbId(_0x48e459);if(typeof _0x24cda6==='number'&&Number['isFinite'](_0x24cda6)&&_0x24cda6>0x0)return{'dbId':_0x24cda6,'dbName':await getDbName(_0x48e459[_0x3bc509(0xf3)],_0x24cda6)['catch'](()=>undefined)};if(_0x48e459['nonInteractive'])throw CliErrors[_0x3bc509(0xef)](_0x3bc509(0xe4),_0x3bc509(0xea));const _0x14eaa6=await listDatabases(_0x48e459['appCode'])['catch'](()=>[]);if(_0x14eaa6[_0x3bc509(0xeb)]===0x1)return{'dbId':_0x14eaa6[0x0][_0x3bc509(0xfa)],'dbName':_0x14eaa6[0x0][_0x3bc509(0xf4)]};if(_0x14eaa6[_0x3bc509(0xeb)]>0x1){const _0x86c6b5=await select({'message':_0x3bc509(0x11a),'choices':[..._0x14eaa6[_0x3bc509(0x107)](_0x32f6c6=>({'name':_0x32f6c6['dbName']+'\x20('+_0x32f6c6[_0x3bc509(0xfa)]+')','value':serializeDbSelection(_0x32f6c6)})),{'name':_0x3bc509(0x102),'value':_0x3bc509(0xee)}]});if(_0x86c6b5!==_0x3bc509(0xee))return deserializeDbSelection(_0x86c6b5);}const _0x10bff7=await input({'message':_0x3bc509(0xe9),'validate':_0x1a3c8f=>{const _0x330c39=_0x3bc509,_0x6b6d71=_0x1a3c8f[_0x330c39(0x10b)]();if(!_0x6b6d71)return'dbId\x20不能为空';const _0xf3409d=Number(_0x6b6d71);if(!Number[_0x330c39(0x120)](_0xf3409d)||_0xf3409d<=0x0)return _0x330c39(0x105);return!![];}});return{'dbId':Number(_0x10bff7['trim']())};}async function resolveSqlModeInput(_0x4bb57e){const _0x33e00f=a152_0x34191c,_0x1399a3=_0x4bb57e[_0x33e00f(0x106)]('mode')[_0x33e00f(0x10b)]();if(_0x1399a3===_0x33e00f(0xec)||_0x1399a3===_0x33e00f(0x101))return _0x1399a3;if(_0x4bb57e[_0x33e00f(0x100)])throw CliErrors[_0x33e00f(0xef)](_0x33e00f(0x11f),_0x33e00f(0x11e));return await select({'message':_0x33e00f(0x123),'choices':[{'name':_0x33e00f(0xfd),'value':_0x33e00f(0xec),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x33e00f(0x116),'value':_0x33e00f(0x101),'description':_0x33e00f(0x10e)}]});}function serializeDbSelection(_0x40b964){const _0x4186aa=a152_0x34191c;return JSON[_0x4186aa(0xff)]({'dbId':_0x40b964[_0x4186aa(0xfa)],'dbName':_0x40b964['dbName']});}function deserializeDbSelection(_0x172879){const _0x4c42b6=a152_0x34191c;try{const _0x24ca2c=JSON['parse'](_0x172879);if(typeof _0x24ca2c[_0x4c42b6(0xfa)]===_0x4c42b6(0x118)&&Number[_0x4c42b6(0x11b)](_0x24ca2c[_0x4c42b6(0xfa)]))return{'dbId':_0x24ca2c[_0x4c42b6(0xfa)],'dbName':_0x24ca2c['dbName']};}catch{}throw CliErrors[_0x4c42b6(0x117)](_0x4c42b6(0xe8)+_0x172879);}function resolveProvidedDbId(_0x4e33b9){const _0x4beb13=a152_0x34191c,_0x314485=_0x4e33b9[_0x4beb13(0xfb)](_0x4beb13(0xe4));if(typeof _0x314485===_0x4beb13(0x118)&&Number[_0x4beb13(0x11b)](_0x314485))return _0x314485;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a153_0x7f70(){const _0x13f485=['trashedTo','projectRoot','SQL\x20lock\x20file\x20not\x20found.','appCode','POST','6965490okMPNX','sqlRootDir','delete','\x20(local\x20file\x20moved\x20to\x20trash)','validation','lockFilePath','trashDir','sqls','Deleted\x20','sqlcode','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','5298460DIlmfm','9HEYaCV','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','72JNBovQ','sqlRoot','lastSync','replace','fromEntries','remoteId','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','2645370UWsPSU','Would\x20delete\x20SQL\x20','length','toISOString','str','1003778oUlIZi','973686BuTjBt','1990377PsiefP','5180658YsPajP','filter'];a153_0x7f70=function(){return _0x13f485;};return a153_0x7f70();}const a153_0x4f5b78=a153_0x4798;(function(_0x52b148,_0x46fe83){const _0x660ae0=a153_0x4798,_0x3f9036=_0x52b148();while(!![]){try{const _0x5c5795=-parseInt(_0x660ae0(0x11f))/0x1+-parseInt(_0x660ae0(0x11e))/0x2*(-parseInt(_0x660ae0(0x110))/0x3)+parseInt(_0x660ae0(0x134))/0x4+parseInt(_0x660ae0(0x119))/0x5+parseInt(_0x660ae0(0x128))/0x6+-parseInt(_0x660ae0(0x121))/0x7+-parseInt(_0x660ae0(0x112))/0x8*(parseInt(_0x660ae0(0x120))/0x9);if(_0x5c5795===_0x46fe83)break;else _0x3f9036['push'](_0x3f9036['shift']());}catch(_0x2b804c){_0x3f9036['push'](_0x3f9036['shift']());}}}(a153_0x7f70,0xc73f2));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':'sql','command':a153_0x4f5b78(0x12a),'description':a153_0x4f5b78(0x118),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x52fdc4){const _0x3e25ff=a153_0x4f5b78,_0x5c0d91=loadSqlProjectConfig(_0x52fdc4[_0x3e25ff(0x126)]),_0x5043a=await readSqlLockFile(_0x5c0d91['lockFilePath']);if(!_0x5043a)throw CliErrors[_0x3e25ff(0x12c)](_0x3e25ff(0x132));},async 'dryRun'(_0x312b04){const _0x2ec200=a153_0x4f5b78,_0x3eab94=loadSqlProjectConfig(_0x312b04[_0x2ec200(0x126)]),_0x30bebb=await readSqlLockFile(_0x3eab94[_0x2ec200(0x12d)]);if(!_0x30bebb)throw CliErrors['validation'](_0x2ec200(0x132));const {appLock:_0x159ab5}=ensureSqlLockScope(_0x30bebb,_0x312b04[_0x2ec200(0x126)],_0x3eab94[_0x2ec200(0x113)],_0x2ec200(0x12a)),_0x39c1e7=_0x312b04[_0x2ec200(0x11d)](_0x2ec200(0x131)),_0x3fe166=_0x159ab5[_0x2ec200(0x12f)][_0x39c1e7];if(!_0x3fe166)throw CliErrors[_0x2ec200(0x12c)](_0x2ec200(0x133)+_0x39c1e7+'\x22.');return{'method':_0x2ec200(0x127),'url':'/smartapi/custom/deleteUserCustomSql','body':{'sqlCode':_0x39c1e7,'id':_0x3fe166[_0x2ec200(0x117)],'localPath':resolveLocalSqlFilePath(_0x3eab94,_0x39c1e7,_0x3fe166)},'description':_0x2ec200(0x11a)+_0x39c1e7+_0x2ec200(0x111)+_0x3eab94[_0x2ec200(0x12e)]};},async 'execute'(_0x365748){const _0x3991e6=a153_0x4f5b78,_0x24918e=loadSqlProjectConfig(_0x365748[_0x3991e6(0x126)]),_0x3268e3=await readSqlLockFile(_0x24918e['lockFilePath']);if(!_0x3268e3)throw CliErrors[_0x3991e6(0x12c)](_0x3991e6(0x125));const {lockData:_0x29d8ce,appLock:_0x4324f0}=ensureSqlLockScope(_0x3268e3,_0x365748[_0x3991e6(0x126)],_0x24918e['sqlRoot'],_0x3991e6(0x12a)),_0x2f2dca=_0x365748[_0x3991e6(0x11d)](_0x3991e6(0x131)),_0x299da7=_0x4324f0[_0x3991e6(0x12f)][_0x2f2dca];if(!_0x299da7)throw CliErrors[_0x3991e6(0x12c)](_0x3991e6(0x133)+_0x2f2dca+'\x22.');await deleteSqlQuery({'id':_0x299da7[_0x3991e6(0x117)],'sqlCode':_0x2f2dca}),_0x4324f0[_0x3991e6(0x12f)]=Object[_0x3991e6(0x116)](Object['entries'](_0x4324f0[_0x3991e6(0x12f)])[_0x3991e6(0x122)](([_0x4c4c26])=>_0x4c4c26!==_0x2f2dca)),_0x4324f0[_0x3991e6(0x114)]=new Date()[_0x3991e6(0x11c)](),await writeSqlLockFile(_0x24918e[_0x3991e6(0x12d)],_0x29d8ce);const _0x2b88d0=resolveLocalSqlFilePath(_0x24918e,_0x2f2dca,_0x299da7);let _0x5c946a;await fileExists(_0x2b88d0)&&(_0x5c946a=await moveToTrash(_0x24918e[_0x3991e6(0x124)],_0x24918e[_0x3991e6(0x12e)],_0x2b88d0),await cleanupEmptyDirectories(dirname(_0x2b88d0),_0x24918e[_0x3991e6(0x129)]));const _0x4b2cf6={'deleted':_0x2f2dca,'remoteId':_0x299da7['remoteId']};if(_0x5c946a)_0x4b2cf6[_0x3991e6(0x123)]=_0x5c946a;return{'ok':!![],'data':_0x4b2cf6,'message':_0x3991e6(0x130)+_0x2f2dca+(_0x5c946a?_0x3991e6(0x12b):'')};}};function a153_0x4798(_0x18b8b1,_0x4b8259){_0x18b8b1=_0x18b8b1-0x110;const _0x7f703a=a153_0x7f70();let _0x4798fa=_0x7f703a[_0x18b8b1];return _0x4798fa;}async function moveToTrash(_0x542dfd,_0x321a56,_0x184c2){const _0x490207=a153_0x4f5b78,_0x2a057f=new Date()[_0x490207(0x11c)]()[_0x490207(0x115)](/[:.]/g,'-'),_0x2729ea=relative(_0x542dfd,_0x184c2),_0x296cf1=join(_0x321a56,_0x2a057f,_0x2729ea);return await mkdir(dirname(_0x296cf1),{'recursive':!![]}),await rename(_0x184c2,_0x296cf1),_0x296cf1;}async function cleanupEmptyDirectories(_0xdeb603,_0x538875){const _0x9441d8=a153_0x4f5b78;let _0x49f072=resolve(_0xdeb603);const _0x269ae6=resolve(_0x538875);while(_0x49f072['startsWith'](''+_0x269ae6+sep)||_0x49f072===_0x269ae6){if(_0x49f072===_0x269ae6)return;try{const _0x206d6c=await readdir(_0x49f072);if(_0x206d6c[_0x9441d8(0x11b)]>0x0)return;await rmdir(_0x49f072);}catch{return;}_0x49f072=dirname(_0x49f072);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a154_0x5994(){const _0x120ae3=['dbId','561fcwXeS','description','471260TvpyLo','99KECOzq','2tuclxV','446285OjLERf','appCode','1355094NAMFHU','51vJoKXp','43596lJwMYv','sql','boolean','bool','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','37192WkRZbx','sqlContent','str','verbose','44540lqwVSz','detail','read','125658fTqJMx'];a154_0x5994=function(){return _0x120ae3;};return a154_0x5994();}function a154_0x51b4(_0x349450,_0x248b1d){_0x349450=_0x349450-0x9c;const _0x599477=a154_0x5994();let _0x51b4b1=_0x599477[_0x349450];return _0x51b4b1;}const a154_0x1c6087=a154_0x51b4;(function(_0x4baaae,_0x195d20){const _0xa31a86=a154_0x51b4,_0xfaff4f=_0x4baaae();while(!![]){try{const _0x42531a=-parseInt(_0xa31a86(0xa9))/0x1*(-parseInt(_0xa31a86(0xaf))/0x2)+parseInt(_0xa31a86(0xb3))/0x3*(-parseInt(_0xa31a86(0xb4))/0x4)+parseInt(_0xa31a86(0xad))/0x5+parseInt(_0xa31a86(0xb2))/0x6+parseInt(_0xa31a86(0xb0))/0x7+-parseInt(_0xa31a86(0xa2))/0x8*(-parseInt(_0xa31a86(0xae))/0x9)+-parseInt(_0xa31a86(0xa6))/0xa*(parseInt(_0xa31a86(0xab))/0xb);if(_0x42531a===_0x195d20)break;else _0xfaff4f['push'](_0xfaff4f['shift']());}catch(_0x3318e4){_0xfaff4f['push'](_0xfaff4f['shift']());}}}(a154_0x5994,0x242f8));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':a154_0x1c6087(0x9c),'command':a154_0x1c6087(0xa7),'description':a154_0x1c6087(0xa1),'risk':a154_0x1c6087(0xa8),'flags':[SQLCODE_FLAG,{'name':a154_0x1c6087(0xa5),'type':a154_0x1c6087(0x9d),'description':a154_0x1c6087(0x9f)}],async 'execute'(_0x5c0df2){const _0x4b11ff=a154_0x1c6087,_0x59ced6=await getSqlQueryInfo(_0x5c0df2['appCode'],_0x5c0df2[_0x4b11ff(0xa4)]('sqlcode')),_0x3dd360=_0x5c0df2[_0x4b11ff(0x9e)]('verbose');if(_0x3dd360)return{'ok':!![],'data':_0x59ced6};const _0x147963=_0x59ced6[_0x4b11ff(0xaa)]?await getDbName(_0x5c0df2[_0x4b11ff(0xb1)],_0x59ced6[_0x4b11ff(0xaa)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x59ced6['sqlCode'],'sqlName':_0x59ced6[_0x4b11ff(0xa0)],'db':_0x147963?_0x147963+'\x20('+_0x59ced6[_0x4b11ff(0xaa)]+')':_0x59ced6[_0x4b11ff(0xaa)]??'','description':_0x59ced6[_0x4b11ff(0xac)]??'','sqlContent':_0x59ced6[_0x4b11ff(0xa3)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x3b039b=a155_0xae3d;function a155_0x4dfc(){const _0x72d51a=['\x20row(s)\x20in\x20','length','now','params','951720zLgEbA','Returned\x20','15551739lroUgl','appCode','str','isArray','execResult','2639832MgHUtW','string','2784816XKsbpA','sqlcode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','sql','3282cTklQC','exec','1016PrQCZG','286580DXTJDY','execError','SQL\x20execution\x20failed','read','973638gMtbJI','7RCdoWK'];a155_0x4dfc=function(){return _0x72d51a;};return a155_0x4dfc();}(function(_0x72071f,_0x39ad0e){const _0x1bbe15=a155_0xae3d,_0x32cf4d=_0x72071f();while(!![]){try{const _0x1a260a=-parseInt(_0x1bbe15(0x8f))/0x1+-parseInt(_0x1bbe15(0x93))/0x2+-parseInt(_0x1bbe15(0xa6))/0x3*(-parseInt(_0x1bbe15(0x8e))/0x4)+-parseInt(_0x1bbe15(0x99))/0x5+-parseInt(_0x1bbe15(0xa2))/0x6+parseInt(_0x1bbe15(0x94))/0x7*(-parseInt(_0x1bbe15(0xa0))/0x8)+parseInt(_0x1bbe15(0x9b))/0x9;if(_0x1a260a===_0x39ad0e)break;else _0x32cf4d['push'](_0x32cf4d['shift']());}catch(_0x48a150){_0x32cf4d['push'](_0x32cf4d['shift']());}}}(a155_0x4dfc,0x3c8b5));function a155_0xae3d(_0x37dc95,_0x3f9b45){_0x37dc95=_0x37dc95-0x8e;const _0x4dfc79=a155_0x4dfc();let _0xae3d16=_0x4dfc79[_0x37dc95];return _0xae3d16;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a155_0x3b039b(0xa5),'command':a155_0x3b039b(0xa7),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a155_0x3b039b(0x92),'flags':[SQLCODE_FLAG,{'name':a155_0x3b039b(0x98),'type':a155_0x3b039b(0xa1),'description':a155_0x3b039b(0xa4)}],async 'execute'(_0x317856){const _0x52f03c=a155_0x3b039b,_0x5ada1c=parseJsonParams(_0x317856[_0x52f03c(0x9d)](_0x52f03c(0x98))),_0x11d3bc=Date['now'](),_0x660790=await executeSql(_0x317856[_0x52f03c(0x9c)],_0x317856[_0x52f03c(0x9d)](_0x52f03c(0xa3)),_0x5ada1c),_0x49638f=Date[_0x52f03c(0x97)]()-_0x11d3bc,_0x12dbc2=_0x660790?.[_0x52f03c(0x9f)]??_0x660790,_0x59c0e3=_0x660790?.['execSuccess']??!![];if(!_0x59c0e3)return{'ok':![],'data':{'error':_0x660790?.[_0x52f03c(0x90)]||_0x52f03c(0x91),'elapsed':_0x49638f},'message':'SQL\x20execution\x20failed'};const _0x16967e=Array[_0x52f03c(0x9e)](_0x12dbc2)?_0x12dbc2:[];return{'ok':!![],'data':{'rows':_0x16967e,'rowCount':_0x16967e[_0x52f03c(0x96)],'elapsed':_0x49638f},'message':_0x52f03c(0x9a)+_0x16967e[_0x52f03c(0x96)]+_0x52f03c(0x95)+_0x49638f+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xd0808a,_0x412fb8){const _0x1c3e9d=a156_0x4a5a,_0x20294e=_0xd0808a();while(!![]){try{const _0x320c1f=-parseInt(_0x1c3e9d(0x135))/0x1+-parseInt(_0x1c3e9d(0x134))/0x2*(parseInt(_0x1c3e9d(0x139))/0x3)+parseInt(_0x1c3e9d(0x137))/0x4*(-parseInt(_0x1c3e9d(0x13b))/0x5)+-parseInt(_0x1c3e9d(0x133))/0x6+parseInt(_0x1c3e9d(0x138))/0x7+parseInt(_0x1c3e9d(0x136))/0x8+parseInt(_0x1c3e9d(0x13a))/0x9;if(_0x320c1f===_0x412fb8)break;else _0x20294e['push'](_0x20294e['shift']());}catch(_0x586cd3){_0x20294e['push'](_0x20294e['shift']());}}}(a156_0x395a,0x4a97c));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a156_0x395a(){const _0x5d909d=['120996aAevXi','1273307wrARUj','3ByfItH','13201101ePOTtU','90sLEJGE','2122854jftDKZ','990922mXQdkd','508694FeHubl','4474304GjgzxU'];a156_0x395a=function(){return _0x5d909d;};return a156_0x395a();}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';function a156_0x4a5a(_0x9f16cd,_0xdf393e){_0x9f16cd=_0x9f16cd-0x133;const _0x395ac0=a156_0x395a();let _0x4a5ae7=_0x395ac0[_0x9f16cd];return _0x4a5ae7;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a157_0x41cdfa=a157_0xc896;function a157_0xc896(_0xf0d3e6,_0xa2ca1e){_0xf0d3e6=_0xf0d3e6-0xfd;const _0x5c3930=a157_0x5c39();let _0xc89616=_0x5c3930[_0xf0d3e6];return _0xc89616;}(function(_0x30aff2,_0x29a417){const _0x9cd89b=a157_0xc896,_0x1afc47=_0x30aff2();while(!![]){try{const _0x2c8edf=parseInt(_0x9cd89b(0x116))/0x1*(-parseInt(_0x9cd89b(0x11d))/0x2)+-parseInt(_0x9cd89b(0x115))/0x3*(parseInt(_0x9cd89b(0x102))/0x4)+-parseInt(_0x9cd89b(0x106))/0x5*(parseInt(_0x9cd89b(0x112))/0x6)+-parseInt(_0x9cd89b(0x11a))/0x7+parseInt(_0x9cd89b(0x10b))/0x8+-parseInt(_0x9cd89b(0x107))/0x9+parseInt(_0x9cd89b(0xfe))/0xa;if(_0x2c8edf===_0x29a417)break;else _0x1afc47['push'](_0x1afc47['shift']());}catch(_0x158102){_0x1afc47['push'](_0x1afc47['shift']());}}}(a157_0x5c39,0x8765f));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a157_0x41cdfa(0x117),'command':a157_0x41cdfa(0x110),'description':a157_0x41cdfa(0x111),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a157_0x41cdfa(0x101),'description':a157_0x41cdfa(0x109)},{'name':a157_0x41cdfa(0x113),'type':'number','description':a157_0x41cdfa(0x108),'default':0x1},{'name':'pagesize','type':a157_0x41cdfa(0x10e),'description':'Page\x20size'},{'name':a157_0x41cdfa(0x10a),'type':'boolean','description':a157_0x41cdfa(0x11b)}],async 'execute'(_0x4ba977){const _0x3e4cb8=a157_0x41cdfa,_0xe0ef35=await listSqlQueries(_0x4ba977[_0x3e4cb8(0x10f)],{'sqlCode':_0x4ba977[_0x3e4cb8(0x104)](_0x3e4cb8(0x118))||undefined,'sqlName':_0x4ba977['str'](_0x3e4cb8(0x10c))||undefined,'currentPage':_0x4ba977['num'](_0x3e4cb8(0x113)),'pageSize':_0x4ba977[_0x3e4cb8(0x10d)](_0x3e4cb8(0x11e),0x32)}),_0x3bef07=_0x4ba977[_0x3e4cb8(0xfd)](_0x3e4cb8(0x10a)),_0x4e0cce=_0xe0ef35['tableData']??[],_0x24b7df=_0xe0ef35[_0x3e4cb8(0x119)]?.['totalCount']??_0x4e0cce[_0x3e4cb8(0x11f)];let _0x2a8863;return _0x3bef07?_0x2a8863=_0x4e0cce:_0x2a8863=await Promise[_0x3e4cb8(0x114)](_0x4e0cce[_0x3e4cb8(0x121)](async _0x4a5df6=>{const _0x42a51a=_0x3e4cb8;let _0x526ddd;try{_0x526ddd=_0x4a5df6[_0x42a51a(0x120)]?await getDbName(_0x4ba977[_0x42a51a(0x10f)],_0x4a5df6[_0x42a51a(0x120)]):undefined;}catch{}return{'sqlCode':_0x4a5df6[_0x42a51a(0x122)],'sqlName':_0x4a5df6[_0x42a51a(0x103)],'description':_0x4a5df6[_0x42a51a(0x11c)]??'','db':_0x526ddd?_0x526ddd+'\x20('+_0x4a5df6['dbId']+')':_0x4a5df6[_0x42a51a(0x120)]??''};})),{'ok':!![],'data':_0x2a8863,'message':_0x4e0cce[_0x3e4cb8(0x11f)]===0x0?_0x3e4cb8(0x105):_0x3e4cb8(0xff)+_0x4e0cce[_0x3e4cb8(0x11f)]+_0x3e4cb8(0x100)+_0x24b7df+').'};}};function a157_0x5c39(){const _0x295153=['167015TFJKSR','7366500KpnFGd','Page\x20number','Filter\x20by\x20SQL\x20name','verbose','138144RTrsIU','name','num','number','appCode','list','List\x20custom\x20SQL\x20queries','198sIyPuL','page','all','231327NjGnKo','1SKIoSg','sql','sqlcode','paging','5584439PXgBKN','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','2210966VMCQVg','pagesize','length','dbId','map','sqlCode','bool','52095810ecHGyz','Found\x20','\x20SQL\x20queries\x20(total:\x20','string','44HFhRFA','sqlName','str','No\x20custom\x20SQL\x20queries\x20found.'];a157_0x5c39=function(){return _0x295153;};return a157_0x5c39();}
|