@cloudbase/cli 3.0.0-alpha.6 → 3.0.0-alpha.8

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.
@@ -296103,6 +296103,1034 @@ function SchemaObject(obj) {
296103
296103
  module.exports = __webpack_require__(91010);
296104
296104
 
296105
296105
 
296106
+ /***/ }),
296107
+
296108
+ /***/ 2604:
296109
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
296110
+
296111
+ "use strict";
296112
+
296113
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
296114
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
296115
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
296116
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
296117
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
296118
+ };
296119
+ var __metadata = (this && this.__metadata) || function (k, v) {
296120
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
296121
+ };
296122
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
296123
+ return function (target, key) { decorator(target, key, paramIndex); }
296124
+ };
296125
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
296126
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
296127
+ return new (P || (P = Promise))(function (resolve, reject) {
296128
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
296129
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
296130
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
296131
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
296132
+ });
296133
+ };
296134
+ var __importDefault = (this && this.__importDefault) || function (mod) {
296135
+ return (mod && mod.__esModule) ? mod : { "default": mod };
296136
+ };
296137
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
296138
+ exports.RoleDeleteCommand = exports.RoleUpdateCommand = exports.RoleCreateCommand = exports.RoleGetCommand = exports.RoleListCommand = void 0;
296139
+ const common_1 = __webpack_require__(48431);
296140
+ const chalk_1 = __importDefault(__webpack_require__(15896));
296141
+ const decorators_1 = __webpack_require__(93480);
296142
+ const error_1 = __webpack_require__(66759);
296143
+ const utils_1 = __webpack_require__(82079);
296144
+ const i18n_1 = __webpack_require__(69258);
296145
+ const PRESET_POLICY_EFFECT_MAP = {
296146
+ AdministratorAccess: 'allow',
296147
+ FunctionsAccess: 'allow',
296148
+ StoragesAccess: 'allow',
296149
+ CloudrunAccess: 'allow',
296150
+ FunctionsDeny: 'deny',
296151
+ StoragesDeny: 'deny',
296152
+ CloudrunDeny: 'deny',
296153
+ };
296154
+ function getPermissionService(envId) {
296155
+ return __awaiter(this, void 0, void 0, function* () {
296156
+ const app = yield (0, utils_1.getMangerService)(envId);
296157
+ return app.permission;
296158
+ });
296159
+ }
296160
+ function printRole(role, log, detail, roleType) {
296161
+ const roleId = role.RoleId || '-';
296162
+ const name = role.RoleName || '-';
296163
+ const identity = role.RoleIdentity || '-';
296164
+ log.info(` ${(0, i18n_1.t)('• {{name}} ({{identity}})', {
296165
+ name: chalk_1.default.bold.cyan(name),
296166
+ identity: chalk_1.default.bold(identity)
296167
+ })}`);
296168
+ log.info(` ${(0, i18n_1.t)('角色ID')}: ${roleId}`);
296169
+ log.info(` ${(0, i18n_1.t)('类型')}: ${roleType}`);
296170
+ if (role.Description) {
296171
+ log.info(` ${(0, i18n_1.t)('描述')}: ${role.Description}`);
296172
+ }
296173
+ if (detail) {
296174
+ const members = role.Members || [];
296175
+ if (members.length === 0) {
296176
+ log.info(` ${(0, i18n_1.t)('成员')}: -`);
296177
+ }
296178
+ else {
296179
+ log.info(` ${(0, i18n_1.t)('成员')}: ${JSON.stringify(members, null, 2).split('\n').map((line, i) => i === 0 ? line : ' ' + line).join('\n')}`);
296180
+ }
296181
+ const policies = role.Policies || [];
296182
+ if (policies.length === 0) {
296183
+ log.info(` ${(0, i18n_1.t)('策略')}: -`);
296184
+ }
296185
+ else {
296186
+ log.info(` ${(0, i18n_1.t)('策略')}: ${JSON.stringify(policies, null, 2).split('\n').map((line, i) => i === 0 ? line : ' ' + line).join('\n')}`);
296187
+ }
296188
+ }
296189
+ }
296190
+ function parseUsers(usersInput) {
296191
+ if (!usersInput)
296192
+ return [];
296193
+ return usersInput
296194
+ .split(',')
296195
+ .map((item) => item.trim())
296196
+ .filter(Boolean);
296197
+ }
296198
+ function normalizeGatewayPolicy(item) {
296199
+ if (typeof item === 'string') {
296200
+ const code = item.trim();
296201
+ if (!code) {
296202
+ throw new error_1.CloudBaseError({
296203
+ message: (0, i18n_1.t)('策略 code 不能为空'),
296204
+ code: 'INVALID_PARAM'
296205
+ });
296206
+ }
296207
+ return {
296208
+ ResourceType: 'gateway',
296209
+ Resource: code,
296210
+ GatewayPolicyCode: code,
296211
+ Effect: PRESET_POLICY_EFFECT_MAP[code]
296212
+ };
296213
+ }
296214
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
296215
+ throw new error_1.CloudBaseError({
296216
+ message: (0, i18n_1.t)('策略项必须是字符串或对象'),
296217
+ code: 'INVALID_PARAM',
296218
+ solution: [(0, i18n_1.t)('示例: "FunctionsAccess" 或 {"code":"custom_api","expression":{...}}')]
296219
+ });
296220
+ }
296221
+ const code = (item.code || '').trim();
296222
+ if (!code) {
296223
+ throw new error_1.CloudBaseError({
296224
+ message: (0, i18n_1.t)('自定义策略缺少 code(GatewayPolicyCode)'),
296225
+ code: 'INVALID_PARAM',
296226
+ solution: [(0, i18n_1.t)('示例: {"code":"custom_api","name":"API策略","expression":{...}}')]
296227
+ });
296228
+ }
296229
+ let expression;
296230
+ if (item.expression !== undefined) {
296231
+ const isPlainObject = typeof item.expression === 'object' &&
296232
+ item.expression !== null &&
296233
+ !Array.isArray(item.expression);
296234
+ if (!isPlainObject) {
296235
+ throw new error_1.CloudBaseError({
296236
+ message: (0, i18n_1.t)('策略 expression 必须是 JSON 对象'),
296237
+ code: 'INVALID_PARAM',
296238
+ solution: [(0, i18n_1.t)('示例: {"expression":{"version":"1.0","statement":[...]}}')]
296239
+ });
296240
+ }
296241
+ expression = JSON.stringify(item.expression);
296242
+ }
296243
+ const rawEffect = String(item.effect || '').trim().toLowerCase();
296244
+ if (!rawEffect || (rawEffect !== 'allow' && rawEffect !== 'deny')) {
296245
+ throw new error_1.CloudBaseError({
296246
+ message: (0, i18n_1.t)('自定义策略必须指定 effect(allow 或 deny)'),
296247
+ code: 'INVALID_PARAM',
296248
+ solution: [(0, i18n_1.t)('示例: {"code":"custom_api","effect":"allow",...}')]
296249
+ });
296250
+ }
296251
+ const effect = rawEffect;
296252
+ return {
296253
+ ResourceType: 'gateway',
296254
+ Resource: code,
296255
+ Effect: effect,
296256
+ GatewayPolicyCode: code,
296257
+ GatewayPolicyName: item.name,
296258
+ GatewayPolicyDescription: item.description,
296259
+ GatewayPolicyExpression: expression
296260
+ };
296261
+ }
296262
+ function parsePolicies(policiesInput) {
296263
+ if (!policiesInput)
296264
+ return [];
296265
+ let raw;
296266
+ try {
296267
+ raw = JSON.parse(policiesInput);
296268
+ }
296269
+ catch (e) {
296270
+ throw new error_1.CloudBaseError({
296271
+ message: (0, i18n_1.t)('参数 --policies 不是合法 JSON'),
296272
+ code: 'INVALID_PARAM',
296273
+ solution: [(0, i18n_1.t)('示例: --policies \'["FunctionsAccess",{"code":"custom_api"}]\'')],
296274
+ original: e
296275
+ });
296276
+ }
296277
+ if (!Array.isArray(raw)) {
296278
+ throw new error_1.CloudBaseError({
296279
+ message: (0, i18n_1.t)('参数 --policies 必须是 JSON 数组'),
296280
+ code: 'INVALID_PARAM'
296281
+ });
296282
+ }
296283
+ return raw.map((item) => normalizeGatewayPolicy(item));
296284
+ }
296285
+ function validateRoleCreateInput(name, identity, users, policies) {
296286
+ if (!name) {
296287
+ throw new error_1.CloudBaseError({
296288
+ message: (0, i18n_1.t)('参数 --name 必填'),
296289
+ code: 'MISSING_PARAM'
296290
+ });
296291
+ }
296292
+ if (!identity) {
296293
+ throw new error_1.CloudBaseError({
296294
+ message: (0, i18n_1.t)('参数 --identity 必填'),
296295
+ code: 'MISSING_PARAM'
296296
+ });
296297
+ }
296298
+ if (name.length < 2 || name.length > 32) {
296299
+ throw new error_1.CloudBaseError({
296300
+ message: (0, i18n_1.t)('角色名称长度需为 2-32 字符'),
296301
+ code: 'INVALID_PARAM'
296302
+ });
296303
+ }
296304
+ if (!/^[A-Za-z\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5\\-_:@.]*$/.test(name)) {
296305
+ throw new error_1.CloudBaseError({
296306
+ message: (0, i18n_1.t)('角色名称格式不合法'),
296307
+ code: 'INVALID_PARAM',
296308
+ solution: [(0, i18n_1.t)('名称需中文/字母开头,仅支持中文、字母、数字和 -_:@.')]
296309
+ });
296310
+ }
296311
+ if (!/^[A-Za-z0-9_:@.-]+$/.test(identity)) {
296312
+ throw new error_1.CloudBaseError({
296313
+ message: (0, i18n_1.t)('角色标识格式不合法'),
296314
+ code: 'INVALID_PARAM',
296315
+ solution: [(0, i18n_1.t)('标识仅支持字母、数字和 _-:@.')]
296316
+ });
296317
+ }
296318
+ if (users.length > 100) {
296319
+ throw new error_1.CloudBaseError({
296320
+ message: (0, i18n_1.t)('用户列表最多支持 100 个'),
296321
+ code: 'INVALID_PARAM'
296322
+ });
296323
+ }
296324
+ if (policies.length > 50) {
296325
+ throw new error_1.CloudBaseError({
296326
+ message: (0, i18n_1.t)('策略列表最多支持 50 条'),
296327
+ code: 'INVALID_PARAM'
296328
+ });
296329
+ }
296330
+ }
296331
+ function parseRemovePolicies(policiesInput) {
296332
+ if (!policiesInput)
296333
+ return [];
296334
+ let raw;
296335
+ try {
296336
+ raw = JSON.parse(policiesInput);
296337
+ }
296338
+ catch (e) {
296339
+ throw new error_1.CloudBaseError({
296340
+ message: (0, i18n_1.t)('参数 --remove-policies 不是合法 JSON'),
296341
+ code: 'INVALID_PARAM',
296342
+ solution: [(0, i18n_1.t)('示例: --remove-policies \'["FunctionsAccess","StoragesDeny"]\'')],
296343
+ original: e
296344
+ });
296345
+ }
296346
+ if (!Array.isArray(raw)) {
296347
+ throw new error_1.CloudBaseError({
296348
+ message: (0, i18n_1.t)('参数 --remove-policies 必须是 JSON 数组'),
296349
+ code: 'INVALID_PARAM'
296350
+ });
296351
+ }
296352
+ return raw.map((item) => {
296353
+ if (typeof item === 'string') {
296354
+ const code = item.trim();
296355
+ if (!code) {
296356
+ throw new error_1.CloudBaseError({
296357
+ message: (0, i18n_1.t)('移除策略 code 不能为空'),
296358
+ code: 'INVALID_PARAM'
296359
+ });
296360
+ }
296361
+ return {
296362
+ ResourceType: 'gateway',
296363
+ Resource: code,
296364
+ GatewayPolicyCode: code
296365
+ };
296366
+ }
296367
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
296368
+ throw new error_1.CloudBaseError({
296369
+ message: (0, i18n_1.t)('移除策略项必须是字符串或对象'),
296370
+ code: 'INVALID_PARAM',
296371
+ solution: [(0, i18n_1.t)('示例: "FunctionsAccess" 或 {"code":"custom_api"}')]
296372
+ });
296373
+ }
296374
+ const code = String(item.code || '').trim();
296375
+ if (!code) {
296376
+ throw new error_1.CloudBaseError({
296377
+ message: (0, i18n_1.t)('移除策略 code 不能为空'),
296378
+ code: 'INVALID_PARAM'
296379
+ });
296380
+ }
296381
+ return {
296382
+ ResourceType: 'gateway',
296383
+ Resource: code,
296384
+ GatewayPolicyCode: code
296385
+ };
296386
+ });
296387
+ }
296388
+ let RoleListCommand = class RoleListCommand extends common_1.Command {
296389
+ get options() {
296390
+ return {
296391
+ cmd: 'role',
296392
+ childCmd: 'list',
296393
+ options: [
296394
+ {
296395
+ flags: '-e, --env-id <envId>',
296396
+ desc: (0, i18n_1.t)('环境 Id'),
296397
+ deprecatedName: 'envId'
296398
+ },
296399
+ {
296400
+ flags: '--type <type>',
296401
+ desc: (0, i18n_1.t)('过滤角色类型'),
296402
+ choices: ['system', 'custom']
296403
+ },
296404
+ {
296405
+ flags: '--limit <n>',
296406
+ desc: (0, i18n_1.t)('返回条数上限,默认 20'),
296407
+ default: 20
296408
+ },
296409
+ {
296410
+ flags: '--offset <n>',
296411
+ desc: (0, i18n_1.t)('跳过条数,默认 0'),
296412
+ default: 0
296413
+ },
296414
+ {
296415
+ flags: '--detail',
296416
+ desc: (0, i18n_1.t)('显示角色成员和权限策略')
296417
+ }
296418
+ ],
296419
+ desc: (0, i18n_1.t)('查询环境下的角色列表(系统角色 + 自定义角色)'),
296420
+ autoRunLogin: true,
296421
+ examples: [
296422
+ 'tcb role list --env-id xxx',
296423
+ 'tcb role list --type custom --env-id xxx',
296424
+ 'tcb role list --detail --env-id xxx',
296425
+ 'tcb role list --limit 50 --offset 0 --env-id xxx',
296426
+ 'tcb role list --json'
296427
+ ]
296428
+ };
296429
+ }
296430
+ execute(envId, options, log) {
296431
+ var _a, _b, _c, _d, _e, _f;
296432
+ return __awaiter(this, void 0, void 0, function* () {
296433
+ const limit = (_a = Number(options.limit)) !== null && _a !== void 0 ? _a : 20;
296434
+ const offset = (_b = Number(options.offset)) !== null && _b !== void 0 ? _b : 0;
296435
+ const type = options.type;
296436
+ const detail = !!options.detail;
296437
+ const pageSize = limit;
296438
+ const pageNumber = Math.floor(offset / limit) + 1;
296439
+ if (!(0, utils_1.isJsonOutput)()) {
296440
+ log.info((0, i18n_1.t)('正在查询角色列表...'));
296441
+ }
296442
+ try {
296443
+ const permissionService = yield getPermissionService(envId);
296444
+ const result = yield permissionService.describeRoleList({
296445
+ pageNumber,
296446
+ pageSize,
296447
+ loadDetails: detail
296448
+ });
296449
+ const systemRoles = ((_c = result.Data) === null || _c === void 0 ? void 0 : _c.SystemRoles) || [];
296450
+ const customRoles = ((_d = result.Data) === null || _d === void 0 ? void 0 : _d.CustomRoles) || [];
296451
+ const totalCount = (_f = (_e = result.Data) === null || _e === void 0 ? void 0 : _e.TotalCount) !== null && _f !== void 0 ? _f : 0;
296452
+ const filteredSystem = type === 'custom' ? [] : systemRoles;
296453
+ const filteredCustom = type === 'system' ? [] : customRoles;
296454
+ if ((0, utils_1.isJsonOutput)()) {
296455
+ if (type === 'system') {
296456
+ (0, utils_1.outputJson)(Object.assign(Object.assign({}, result), { Data: {
296457
+ SystemTotalCount: systemRoles.length,
296458
+ SystemRoles: systemRoles,
296459
+ } }));
296460
+ }
296461
+ else if (type === 'custom') {
296462
+ (0, utils_1.outputJson)(Object.assign(Object.assign({}, result), { Data: {
296463
+ CustomTotalCount: customRoles.length,
296464
+ CustomRoles: customRoles,
296465
+ } }));
296466
+ }
296467
+ else {
296468
+ (0, utils_1.outputJson)(result);
296469
+ }
296470
+ return;
296471
+ }
296472
+ const allRoles = [...filteredSystem, ...filteredCustom];
296473
+ if (allRoles.length === 0) {
296474
+ log.info((0, i18n_1.t)('未查询到角色'));
296475
+ return;
296476
+ }
296477
+ if (filteredSystem.length > 0) {
296478
+ log.info(`\n${(0, i18n_1.t)('系统角色')} (${filteredSystem.length}):`);
296479
+ for (const role of filteredSystem) {
296480
+ printRole(role, log, detail, 'system');
296481
+ }
296482
+ }
296483
+ if (filteredCustom.length > 0) {
296484
+ log.info(`\n${(0, i18n_1.t)('自定义角色')} (${filteredCustom.length}):`);
296485
+ for (const role of filteredCustom) {
296486
+ printRole(role, log, detail, 'custom');
296487
+ }
296488
+ }
296489
+ const displayCount = filteredSystem.length + filteredCustom.length;
296490
+ if (type) {
296491
+ const label = type === 'system' ? (0, i18n_1.t)('系统角色') : (0, i18n_1.t)('自定义角色');
296492
+ log.info(`\n${(0, i18n_1.t)('共 {{count}} 个{{label}}', { count: displayCount, label })}`);
296493
+ }
296494
+ else {
296495
+ log.info(`\n${(0, i18n_1.t)('共 {{count}} 个角色 (系统角色 {{system}}, 自定义角色 {{custom}})', { count: displayCount, system: filteredSystem.length, custom: filteredCustom.length })}`);
296496
+ }
296497
+ log.info((0, i18n_1.t)('\n下一步:'));
296498
+ log.info(` ${(0, i18n_1.t)('创建角色')} ${(0, utils_1.highlightCommand)(`tcb role create --env-id ${envId}`)}`);
296499
+ }
296500
+ catch (e) {
296501
+ throw new error_1.CloudBaseError({
296502
+ message: e.message || (0, i18n_1.t)('查询角色列表失败'),
296503
+ code: 'API_ERROR',
296504
+ solution: [
296505
+ (0, i18n_1.t)('请检查环境 ID 是否正确'),
296506
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
296507
+ ],
296508
+ original: e
296509
+ });
296510
+ }
296511
+ });
296512
+ }
296513
+ };
296514
+ __decorate([
296515
+ (0, decorators_1.InjectParams)(),
296516
+ __param(0, (0, decorators_1.EnvId)()),
296517
+ __param(1, (0, decorators_1.ArgsOptions)()),
296518
+ __param(2, (0, decorators_1.Log)()),
296519
+ __metadata("design:type", Function),
296520
+ __metadata("design:paramtypes", [String, Object, decorators_1.Logger]),
296521
+ __metadata("design:returntype", Promise)
296522
+ ], RoleListCommand.prototype, "execute", null);
296523
+ RoleListCommand = __decorate([
296524
+ (0, common_1.ICommand)()
296525
+ ], RoleListCommand);
296526
+ exports.RoleListCommand = RoleListCommand;
296527
+ let RoleGetCommand = class RoleGetCommand extends common_1.Command {
296528
+ get options() {
296529
+ return {
296530
+ cmd: 'role',
296531
+ childCmd: 'get',
296532
+ options: [
296533
+ {
296534
+ flags: '-e, --env-id <envId>',
296535
+ desc: (0, i18n_1.t)('环境 Id'),
296536
+ deprecatedName: 'envId'
296537
+ },
296538
+ {
296539
+ flags: '--id <roleId>',
296540
+ desc: (0, i18n_1.t)('按角色 ID 查询(精确)')
296541
+ },
296542
+ {
296543
+ flags: '--identity <identity>',
296544
+ desc: (0, i18n_1.t)('按角色标识查询(精确)')
296545
+ },
296546
+ {
296547
+ flags: '--name <name>',
296548
+ desc: (0, i18n_1.t)('按角色名称查询(模糊)')
296549
+ },
296550
+ {
296551
+ flags: '--detail',
296552
+ desc: (0, i18n_1.t)('显示角色成员和权限策略')
296553
+ }
296554
+ ],
296555
+ desc: (0, i18n_1.t)('查询指定角色的详细信息'),
296556
+ autoRunLogin: true,
296557
+ examples: [
296558
+ 'tcb role get --id 2032299359962361858 --env-id xxx',
296559
+ 'tcb role get --identity administrator --env-id xxx',
296560
+ 'tcb role get --name 开发者 --env-id xxx',
296561
+ 'tcb role get --identity administrator --detail --env-id xxx',
296562
+ 'tcb role get --identity administrator --json'
296563
+ ]
296564
+ };
296565
+ }
296566
+ execute(envId, options, log) {
296567
+ return __awaiter(this, void 0, void 0, function* () {
296568
+ const roleId = options.id;
296569
+ const roleIdentity = options.identity;
296570
+ const roleName = options.name;
296571
+ const detail = !!options.detail;
296572
+ const provided = [roleId, roleIdentity, roleName].filter(Boolean);
296573
+ if (provided.length !== 1) {
296574
+ throw new error_1.CloudBaseError({
296575
+ message: (0, i18n_1.t)('请且仅传入一个查询条件:--id / --identity / --name'),
296576
+ code: 'INVALID_PARAM',
296577
+ solution: [
296578
+ (0, i18n_1.t)('示例: tcb role get --id 2032299359962361858 --env-id xxx'),
296579
+ (0, i18n_1.t)('示例: tcb role get --identity administrator --env-id xxx'),
296580
+ (0, i18n_1.t)('示例: tcb role get --name 开发者 --env-id xxx')
296581
+ ]
296582
+ });
296583
+ }
296584
+ if (!(0, utils_1.isJsonOutput)()) {
296585
+ log.info((0, i18n_1.t)('正在查询角色详情...'));
296586
+ }
296587
+ try {
296588
+ const permissionService = yield getPermissionService(envId);
296589
+ const result = yield permissionService.describeRoleList(Object.assign(Object.assign(Object.assign(Object.assign({}, (roleId ? { roleId } : {})), (roleIdentity ? { roleIdentity } : {})), (roleName ? { roleName } : {})), { loadDetails: detail }));
296590
+ if ((0, utils_1.isJsonOutput)()) {
296591
+ (0, utils_1.outputJson)(result);
296592
+ return;
296593
+ }
296594
+ const roles = this.extractRoles(result);
296595
+ if (roles.length === 0) {
296596
+ if ((0, utils_1.isJsonOutput)()) {
296597
+ (0, utils_1.outputJson)([]);
296598
+ }
296599
+ else {
296600
+ log.info((0, i18n_1.t)('未查询到匹配角色'));
296601
+ }
296602
+ return;
296603
+ }
296604
+ if (roles.length > 1) {
296605
+ log.info(`\n${(0, i18n_1.t)('查询到 {{count}} 个角色', { count: roles.length })}:`);
296606
+ for (const item of roles) {
296607
+ printRole(item.role, log, detail, item.roleType);
296608
+ }
296609
+ }
296610
+ else {
296611
+ log.info(`\n${(0, i18n_1.t)('角色详情')}:`);
296612
+ const item = roles[0];
296613
+ printRole(item.role, log, detail, item.roleType);
296614
+ }
296615
+ log.info((0, i18n_1.t)('\n下一步:'));
296616
+ log.info(` ${(0, i18n_1.t)('查看角色列表')} ${(0, utils_1.highlightCommand)(`tcb role list --env-id ${envId}`)}`);
296617
+ }
296618
+ catch (e) {
296619
+ if (e instanceof error_1.CloudBaseError) {
296620
+ throw e;
296621
+ }
296622
+ throw new error_1.CloudBaseError({
296623
+ message: e.message || (0, i18n_1.t)('查询角色详情失败'),
296624
+ code: 'API_ERROR',
296625
+ solution: [
296626
+ (0, i18n_1.t)('请检查环境 ID 是否正确'),
296627
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
296628
+ ],
296629
+ original: e
296630
+ });
296631
+ }
296632
+ });
296633
+ }
296634
+ extractRoles(result) {
296635
+ var _a, _b;
296636
+ const systemRoles = (((_a = result.Data) === null || _a === void 0 ? void 0 : _a.SystemRoles) || []).map((role) => ({
296637
+ role,
296638
+ roleType: 'system'
296639
+ }));
296640
+ const customRoles = (((_b = result.Data) === null || _b === void 0 ? void 0 : _b.CustomRoles) || []).map((role) => ({
296641
+ role,
296642
+ roleType: 'custom'
296643
+ }));
296644
+ return [...systemRoles, ...customRoles];
296645
+ }
296646
+ };
296647
+ __decorate([
296648
+ (0, decorators_1.InjectParams)(),
296649
+ __param(0, (0, decorators_1.EnvId)()),
296650
+ __param(1, (0, decorators_1.ArgsOptions)()),
296651
+ __param(2, (0, decorators_1.Log)()),
296652
+ __metadata("design:type", Function),
296653
+ __metadata("design:paramtypes", [String, Object, decorators_1.Logger]),
296654
+ __metadata("design:returntype", Promise)
296655
+ ], RoleGetCommand.prototype, "execute", null);
296656
+ RoleGetCommand = __decorate([
296657
+ (0, common_1.ICommand)()
296658
+ ], RoleGetCommand);
296659
+ exports.RoleGetCommand = RoleGetCommand;
296660
+ let RoleCreateCommand = class RoleCreateCommand extends common_1.Command {
296661
+ get options() {
296662
+ return {
296663
+ cmd: 'role',
296664
+ childCmd: 'create',
296665
+ options: [
296666
+ {
296667
+ flags: '-e, --env-id <envId>',
296668
+ desc: (0, i18n_1.t)('环境 Id'),
296669
+ deprecatedName: 'envId'
296670
+ },
296671
+ {
296672
+ flags: '--name <name>',
296673
+ desc: (0, i18n_1.t)('角色名称(2-32 字符)')
296674
+ },
296675
+ {
296676
+ flags: '--identity <identity>',
296677
+ desc: (0, i18n_1.t)('角色标识(唯一)')
296678
+ },
296679
+ {
296680
+ flags: '--description <description>',
296681
+ desc: (0, i18n_1.t)('角色描述(最多 255 字符)')
296682
+ },
296683
+ {
296684
+ flags: '--users <uids>',
296685
+ desc: (0, i18n_1.t)('成员 UID 列表(逗号分隔)')
296686
+ },
296687
+ {
296688
+ flags: '--policies <json>',
296689
+ desc: [
296690
+ (0, i18n_1.t)('策略 JSON 数组,支持预设字符串和自定义对象混合'),
296691
+ (0, i18n_1.t)('预设: AdministratorAccess, FunctionsAccess, StoragesAccess, CloudrunAccess, FunctionsDeny, StoragesDeny, CloudrunDeny'),
296692
+ (0, i18n_1.t)('自定义对象字段: code, name, description, effect(allow|deny), expression'),
296693
+ (0, i18n_1.t)('expression 由 version 和 statement 构成,statement 是子语句数组,每条子语句包含 action, resource, effect, condition(非必填)'),
296694
+ (0, i18n_1.t)('action 格式: <功能类型>:<请求路径>,功能类型: storages/functions/cloudrun/model,路径为 * 表示全部'),
296695
+ (0, i18n_1.t)('resource 代表操作的资源,* 表示全部资源'),
296696
+ (0, i18n_1.t)('effect 取值 allow 或 deny,allow 和 deny 同时存在时 deny 优先'),
296697
+ (0, i18n_1.t)('示例: {"version":"1.0","statement":[{"action":"functions:*","resource":"*","effect":"allow"}]}')
296698
+ ].join('\n')
296699
+ }
296700
+ ],
296701
+ desc: (0, i18n_1.t)('创建自定义角色'),
296702
+ autoRunLogin: true,
296703
+ examples: [
296704
+ 'tcb role create --name 开发者 --identity developer --env-id xxx',
296705
+ 'tcb role create --name 开发者 --identity developer --users 1003,1005 --env-id xxx',
296706
+ 'tcb role create --name 网关角色 --identity gateway_role --policies \'["FunctionsAccess","StoragesDeny"]\' --env-id xxx',
296707
+ 'tcb role create --name 全栈开发者 --identity fullstack_dev --policies \'["FunctionsAccess",{"code":"custom_api","name":"API路径策略","description":"仅允许访问/api路径","expression":{"version":"1.0","statement":[{"action":"functions:/api/*","resource":"*","effect":"allow"}]}}]\' --users 1003,1005,1007 --env-id xxx',
296708
+ 'tcb role create --name 开发者 --identity developer --env-id xxx --json'
296709
+ ]
296710
+ };
296711
+ }
296712
+ execute(envId, options, log) {
296713
+ return __awaiter(this, void 0, void 0, function* () {
296714
+ const name = (options.name || '').trim();
296715
+ const identity = (options.identity || '').trim();
296716
+ const description = (options.description || '').trim();
296717
+ const usersInput = options.users;
296718
+ const policiesInput = options.policies;
296719
+ const users = parseUsers(usersInput);
296720
+ const policies = parsePolicies(policiesInput);
296721
+ validateRoleCreateInput(name, identity, users, policies);
296722
+ if (!(0, utils_1.isJsonOutput)()) {
296723
+ log.info((0, i18n_1.t)('正在创建角色...'));
296724
+ }
296725
+ try {
296726
+ const permissionService = yield getPermissionService(envId);
296727
+ const createOptions = {
296728
+ roleName: name,
296729
+ roleIdentity: identity
296730
+ };
296731
+ if (description) {
296732
+ createOptions.description = description;
296733
+ }
296734
+ if (users.length > 0) {
296735
+ createOptions.memberUids = users;
296736
+ }
296737
+ if (policies.length > 0) {
296738
+ createOptions.policies = policies;
296739
+ }
296740
+ const result = yield permissionService.createRole(createOptions);
296741
+ const data = result.Data || {};
296742
+ if ((0, utils_1.isJsonOutput)()) {
296743
+ (0, utils_1.outputJson)(result);
296744
+ return;
296745
+ }
296746
+ log.success((0, i18n_1.t)('角色创建成功'));
296747
+ log.info(` ${(0, i18n_1.t)('角色名称')}: ${name}`);
296748
+ log.info(` ${(0, i18n_1.t)('角色标识')}: ${identity}`);
296749
+ log.info(` ${(0, i18n_1.t)('角色ID')}: ${data.RoleId || '-'}`);
296750
+ if (users.length > 0) {
296751
+ const createdUsers = data.MemberUids || [];
296752
+ const usersText = createdUsers.length > 0 ? JSON.stringify(createdUsers) : '[]';
296753
+ log.info(` ${(0, i18n_1.t)('已添加成员')}: ${usersText}`);
296754
+ }
296755
+ if (policies.length > 0) {
296756
+ const createdPolicies = data.Policies || [];
296757
+ const policiesText = JSON.stringify(createdPolicies, null, 2)
296758
+ .split('\n')
296759
+ .map((line, i) => (i === 0 ? line : ` ${line}`))
296760
+ .join('\n');
296761
+ log.info(` ${(0, i18n_1.t)('已创建策略')}: ${policiesText}`);
296762
+ }
296763
+ log.info((0, i18n_1.t)('\n下一步:'));
296764
+ log.info(` ${(0, i18n_1.t)('查看角色列表')} ${(0, utils_1.highlightCommand)(`tcb role list --env-id ${envId}`)}`);
296765
+ if (data.RoleId) {
296766
+ log.info(` ${(0, i18n_1.t)('查看角色详情')} ${(0, utils_1.highlightCommand)(`tcb role get --id ${data.RoleId} --env-id ${envId}`)}`);
296767
+ }
296768
+ }
296769
+ catch (e) {
296770
+ if (e instanceof error_1.CloudBaseError) {
296771
+ throw e;
296772
+ }
296773
+ throw new error_1.CloudBaseError({
296774
+ message: e.message || (0, i18n_1.t)('创建角色失败'),
296775
+ code: 'API_ERROR',
296776
+ solution: [
296777
+ (0, i18n_1.t)('请检查参数是否正确'),
296778
+ (0, i18n_1.t)('请确认角色名称/角色标识未重复'),
296779
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
296780
+ ],
296781
+ original: e
296782
+ });
296783
+ }
296784
+ });
296785
+ }
296786
+ };
296787
+ __decorate([
296788
+ (0, decorators_1.InjectParams)(),
296789
+ __param(0, (0, decorators_1.EnvId)()),
296790
+ __param(1, (0, decorators_1.ArgsOptions)()),
296791
+ __param(2, (0, decorators_1.Log)()),
296792
+ __metadata("design:type", Function),
296793
+ __metadata("design:paramtypes", [String, Object, decorators_1.Logger]),
296794
+ __metadata("design:returntype", Promise)
296795
+ ], RoleCreateCommand.prototype, "execute", null);
296796
+ RoleCreateCommand = __decorate([
296797
+ (0, common_1.ICommand)()
296798
+ ], RoleCreateCommand);
296799
+ exports.RoleCreateCommand = RoleCreateCommand;
296800
+ let RoleUpdateCommand = class RoleUpdateCommand extends common_1.Command {
296801
+ get options() {
296802
+ return {
296803
+ cmd: 'role',
296804
+ childCmd: 'update',
296805
+ options: [
296806
+ {
296807
+ flags: '-e, --env-id <envId>',
296808
+ desc: (0, i18n_1.t)('环境 Id'),
296809
+ deprecatedName: 'envId'
296810
+ },
296811
+ {
296812
+ flags: '--id <roleId>',
296813
+ desc: (0, i18n_1.t)('角色 ID(必填)')
296814
+ },
296815
+ {
296816
+ flags: '--name <name>',
296817
+ desc: (0, i18n_1.t)('修改角色名称(2-32 字符)')
296818
+ },
296819
+ {
296820
+ flags: '--description <description>',
296821
+ desc: (0, i18n_1.t)('修改角色描述')
296822
+ },
296823
+ {
296824
+ flags: '--add-users <uids>',
296825
+ desc: (0, i18n_1.t)('添加成员(逗号分隔 UID)')
296826
+ },
296827
+ {
296828
+ flags: '--remove-users <uids>',
296829
+ desc: (0, i18n_1.t)('移除成员(逗号分隔 UID)')
296830
+ },
296831
+ {
296832
+ flags: '--add-policies <json>',
296833
+ desc: [
296834
+ (0, i18n_1.t)('策略 JSON 数组,支持预设字符串和自定义对象混合'),
296835
+ (0, i18n_1.t)('预设: AdministratorAccess, FunctionsAccess, StoragesAccess, CloudrunAccess, FunctionsDeny, StoragesDeny, CloudrunDeny'),
296836
+ (0, i18n_1.t)('自定义对象字段: code, name, description, effect(allow|deny), expression'),
296837
+ (0, i18n_1.t)('expression 由 version 和 statement 构成,statement 是子语句数组,每条子语句包含 action, resource, effect, condition(非必填)'),
296838
+ (0, i18n_1.t)('action 格式: <功能类型>:<请求路径>,功能类型: storages/functions/cloudrun/model,路径为 * 表示全部'),
296839
+ (0, i18n_1.t)('resource 代表操作的资源,* 表示全部资源'),
296840
+ (0, i18n_1.t)('effect 取值 allow 或 deny,allow 和 deny 同时存在时 deny 优先'),
296841
+ (0, i18n_1.t)('示例: {"version":"1.0","statement":[{"action":"functions:*","resource":"*","effect":"allow"}]}')
296842
+ ].join('\n')
296843
+ },
296844
+ {
296845
+ flags: '--remove-policies <json>',
296846
+ desc: [
296847
+ (0, i18n_1.t)('移除策略 JSON 数组,支持预设字符串和自定义对象混合'),
296848
+ (0, i18n_1.t)('预设: AdministratorAccess, FunctionsAccess, StoragesAccess, CloudrunAccess, FunctionsDeny, StoragesDeny, CloudrunDeny'),
296849
+ (0, i18n_1.t)('自定义对象需提供 code 字段'),
296850
+ (0, i18n_1.t)('示例: \'["FunctionsAccess", {"code": "custom_api"}]\'')
296851
+ ].join('\n')
296852
+ }
296853
+ ],
296854
+ desc: [
296855
+ (0, i18n_1.t)('更新角色信息(名称、描述、成员、策略)'),
296856
+ '',
296857
+ `${(0, i18n_1.t)('注意:')}\n`,
296858
+ ` · ${(0, i18n_1.t)('管理员角色:仅可修改成员,不可修改策略')}`,
296859
+ ` · ${(0, i18n_1.t)('注册用户/组织成员/匿名用户/所有用户:仅可修改策略,不可修改成员')}`,
296860
+ ` · ${(0, i18n_1.t)('所有系统角色:不可修改角色名称')}`,
296861
+ ` · ${(0, i18n_1.t)('自定义角色:以上均可修改')}`
296862
+ ].join('\n'),
296863
+ autoRunLogin: true,
296864
+ examples: [
296865
+ 'tcb role update --id 2032299359962361858 --name "高级开发者" --env-id xxx',
296866
+ 'tcb role update --id 2032299359962361858 --add-users "1001,1002" --remove-users "1003" --env-id xxx',
296867
+ 'tcb role update --id 2032299359962361858 --add-policies \'["FunctionsAccess"]\' --remove-policies \'["StoragesDeny"]\' --env-id xxx',
296868
+ 'tcb role update --id 2032299359962361858 --name "新名称" --add-users "1001" --env-id xxx --json'
296869
+ ]
296870
+ };
296871
+ }
296872
+ execute(envId, options, log) {
296873
+ var _a, _b, _c, _d;
296874
+ return __awaiter(this, void 0, void 0, function* () {
296875
+ const roleId = (options.id || '').trim();
296876
+ const name = options.name;
296877
+ const description = options.description;
296878
+ const addUsersInput = options.addUsers;
296879
+ const removeUsersInput = options.removeUsers;
296880
+ const addPoliciesInput = options.addPolicies;
296881
+ const removePoliciesInput = options.removePolicies;
296882
+ if (!roleId) {
296883
+ throw new error_1.CloudBaseError({
296884
+ message: (0, i18n_1.t)('参数 --id 必填'),
296885
+ code: 'MISSING_PARAM',
296886
+ solution: [(0, i18n_1.t)('示例: tcb role update --id <roleId> --name "新名称" --env-id xxx')]
296887
+ });
296888
+ }
296889
+ const updateFields = [name, description, addUsersInput, removeUsersInput, addPoliciesInput, removePoliciesInput];
296890
+ const hasUpdate = updateFields.some((f) => f !== undefined && f !== '');
296891
+ if (!hasUpdate) {
296892
+ throw new error_1.CloudBaseError({
296893
+ message: (0, i18n_1.t)('请至少指定一个更新字段'),
296894
+ code: 'MISSING_PARAM',
296895
+ solution: [
296896
+ (0, i18n_1.t)('可用选项: --name, --description, --add-users, --remove-users, --add-policies, --remove-policies'),
296897
+ (0, i18n_1.t)('示例: tcb role update --id {{id}} --name "新名称" --env-id xxx', { id: roleId })
296898
+ ]
296899
+ });
296900
+ }
296901
+ if (name) {
296902
+ const trimmedName = name.trim();
296903
+ if (trimmedName.length < 2 || trimmedName.length > 32) {
296904
+ throw new error_1.CloudBaseError({
296905
+ message: (0, i18n_1.t)('角色名称长度需为 2-32 字符'),
296906
+ code: 'INVALID_PARAM'
296907
+ });
296908
+ }
296909
+ if (!/^[A-Za-z\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5\\-_:@.]*$/.test(trimmedName)) {
296910
+ throw new error_1.CloudBaseError({
296911
+ message: (0, i18n_1.t)('角色名称格式不合法'),
296912
+ code: 'INVALID_PARAM',
296913
+ solution: [(0, i18n_1.t)('名称需中文/字母开头,仅支持中文、字母、数字和 -_:@.')]
296914
+ });
296915
+ }
296916
+ }
296917
+ const addUsers = parseUsers(addUsersInput);
296918
+ const removeUsers = parseUsers(removeUsersInput);
296919
+ const addPolicies = parsePolicies(addPoliciesInput);
296920
+ const removePolicies = parseRemovePolicies(removePoliciesInput);
296921
+ const confirmed = yield (0, utils_1.autoConfirm)((0, i18n_1.t)('确定要更新角色 {{id}} 吗?', { id: roleId }));
296922
+ if (!confirmed)
296923
+ return;
296924
+ if (!(0, utils_1.isJsonOutput)()) {
296925
+ log.info((0, i18n_1.t)('正在更新角色...'));
296926
+ }
296927
+ try {
296928
+ const permissionService = yield getPermissionService(envId);
296929
+ const modifyOptions = {
296930
+ roleId
296931
+ };
296932
+ if (name) {
296933
+ modifyOptions.roleName = name.trim();
296934
+ }
296935
+ if (description) {
296936
+ modifyOptions.description = description.trim();
296937
+ }
296938
+ if (addUsers.length > 0) {
296939
+ modifyOptions.addMemberUids = addUsers;
296940
+ }
296941
+ if (removeUsers.length > 0) {
296942
+ modifyOptions.removeMemberUids = removeUsers;
296943
+ }
296944
+ if (addPolicies.length > 0) {
296945
+ modifyOptions.addPolicies = addPolicies;
296946
+ }
296947
+ if (removePolicies.length > 0) {
296948
+ modifyOptions.removePolicies = removePolicies;
296949
+ }
296950
+ const result = yield permissionService.modifyRole(modifyOptions);
296951
+ const data = result.Data || {};
296952
+ if ((0, utils_1.isJsonOutput)()) {
296953
+ (0, utils_1.outputJson)(result);
296954
+ return;
296955
+ }
296956
+ log.success((0, i18n_1.t)('角色更新成功'));
296957
+ const hasBasicChange = !!name || !!description;
296958
+ const hasMemberChange = (((_a = data.AddedMemberUids) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0 || (((_b = data.RemovedMemberUids) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
296959
+ const hasPolicyChange = (((_c = data.AddedPolicies) === null || _c === void 0 ? void 0 : _c.length) || 0) > 0 || (((_d = data.RemovedPolicies) === null || _d === void 0 ? void 0 : _d.length) || 0) > 0;
296960
+ if (hasBasicChange) {
296961
+ log.info(`\n ${(0, i18n_1.t)('基本信息变更')}:`);
296962
+ if (name) {
296963
+ log.info(` ${(0, i18n_1.t)('角色名称')}: ${name.trim()}`);
296964
+ }
296965
+ if (description) {
296966
+ log.info(` ${(0, i18n_1.t)('描述')}: ${description.trim()}`);
296967
+ }
296968
+ }
296969
+ if (hasMemberChange) {
296970
+ log.info(`\n ${(0, i18n_1.t)('成员变更')}:`);
296971
+ const added = data.AddedMemberUids || [];
296972
+ const removed = data.RemovedMemberUids || [];
296973
+ if (added.length > 0) {
296974
+ log.info(` + ${(0, i18n_1.t)('已添加')}: ${JSON.stringify(added)}`);
296975
+ }
296976
+ if (removed.length > 0) {
296977
+ log.info(` - ${(0, i18n_1.t)('已移除')}: ${JSON.stringify(removed)}`);
296978
+ }
296979
+ }
296980
+ if (hasPolicyChange) {
296981
+ log.info(`\n ${(0, i18n_1.t)('策略变更')}:`);
296982
+ const addedPolicies = data.AddedPolicies || [];
296983
+ const removedPolicies = data.RemovedPolicies || [];
296984
+ if (addedPolicies.length > 0) {
296985
+ log.info(` + ${(0, i18n_1.t)('已添加策略')}: ${JSON.stringify(addedPolicies)}`);
296986
+ }
296987
+ if (removedPolicies.length > 0) {
296988
+ log.info(` - ${(0, i18n_1.t)('已移除策略')}: ${JSON.stringify(removedPolicies)}`);
296989
+ }
296990
+ }
296991
+ log.info((0, i18n_1.t)('\n下一步:'));
296992
+ log.info(` ${(0, i18n_1.t)('查看角色详情')} ${(0, utils_1.highlightCommand)(`tcb role get --id ${roleId} --env-id ${envId}`)}`);
296993
+ log.info(` ${(0, i18n_1.t)('查看角色列表')} ${(0, utils_1.highlightCommand)(`tcb role list --env-id ${envId}`)}`);
296994
+ }
296995
+ catch (e) {
296996
+ if (e instanceof error_1.CloudBaseError) {
296997
+ throw e;
296998
+ }
296999
+ throw new error_1.CloudBaseError({
297000
+ message: e.message || (0, i18n_1.t)('更新角色失败'),
297001
+ code: 'API_ERROR',
297002
+ solution: [
297003
+ (0, i18n_1.t)('请检查参数是否正确'),
297004
+ (0, i18n_1.t)('系统角色可能有修改限制,请参考帮助信息'),
297005
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
297006
+ ],
297007
+ original: e
297008
+ });
297009
+ }
297010
+ });
297011
+ }
297012
+ };
297013
+ __decorate([
297014
+ (0, decorators_1.InjectParams)(),
297015
+ __param(0, (0, decorators_1.EnvId)()),
297016
+ __param(1, (0, decorators_1.ArgsOptions)()),
297017
+ __param(2, (0, decorators_1.Log)()),
297018
+ __metadata("design:type", Function),
297019
+ __metadata("design:paramtypes", [String, Object, decorators_1.Logger]),
297020
+ __metadata("design:returntype", Promise)
297021
+ ], RoleUpdateCommand.prototype, "execute", null);
297022
+ RoleUpdateCommand = __decorate([
297023
+ (0, common_1.ICommand)()
297024
+ ], RoleUpdateCommand);
297025
+ exports.RoleUpdateCommand = RoleUpdateCommand;
297026
+ let RoleDeleteCommand = class RoleDeleteCommand extends common_1.Command {
297027
+ get options() {
297028
+ return {
297029
+ cmd: 'role',
297030
+ childCmd: 'delete <roleIds...>',
297031
+ options: [
297032
+ {
297033
+ flags: '-e, --env-id <envId>',
297034
+ desc: (0, i18n_1.t)('环境 Id'),
297035
+ deprecatedName: 'envId'
297036
+ }
297037
+ ],
297038
+ desc: (0, i18n_1.t)('删除自定义角色(不可撤销)'),
297039
+ autoRunLogin: true,
297040
+ examples: [
297041
+ 'tcb role delete 2037415874111574018 --env-id xxx',
297042
+ 'tcb role delete 2037415874111574018 2037420918731018242 --env-id xxx',
297043
+ 'tcb role delete 2037415874111574018 --env-id xxx --json'
297044
+ ]
297045
+ };
297046
+ }
297047
+ execute(envId, params, log) {
297048
+ var _a, _b;
297049
+ return __awaiter(this, void 0, void 0, function* () {
297050
+ const roleIds = [].concat((params === null || params === void 0 ? void 0 : params[0]) || [])
297051
+ .map((id) => String(id).trim())
297052
+ .filter(Boolean);
297053
+ if (roleIds.length === 0) {
297054
+ throw new error_1.CloudBaseError({
297055
+ message: (0, i18n_1.t)('请指定要删除的角色 ID,例如:tcb role delete <roleId>'),
297056
+ code: 'MISSING_PARAM',
297057
+ solution: [(0, i18n_1.t)('运行 {{cmd}} 查看角色列表', { cmd: (0, utils_1.highlightCommand)(`tcb role list --env-id ${envId}`) })]
297058
+ });
297059
+ }
297060
+ if (roleIds.length > 100) {
297061
+ throw new error_1.CloudBaseError({
297062
+ message: (0, i18n_1.t)('单次最多删除 100 个角色'),
297063
+ code: 'INVALID_PARAM',
297064
+ solution: [(0, i18n_1.t)('请分批删除,每次不超过 100 个')]
297065
+ });
297066
+ }
297067
+ const uniqueIds = [...new Set(roleIds)];
297068
+ if (!(0, utils_1.isJsonOutput)()) {
297069
+ log.warn(chalk_1.default.yellow((0, i18n_1.t)('确认删除以下角色?')));
297070
+ for (const id of uniqueIds) {
297071
+ log.info(` • ${id}`);
297072
+ }
297073
+ log.warn(chalk_1.default.red((0, i18n_1.t)('\n此操作不可撤销,是否继续?')));
297074
+ const confirmed = yield (0, utils_1.autoConfirm)((0, i18n_1.t)('确定要删除 {{count}} 个角色吗?', { count: uniqueIds.length }), false);
297075
+ if (!confirmed)
297076
+ return;
297077
+ }
297078
+ if (!(0, utils_1.isJsonOutput)()) {
297079
+ log.info((0, i18n_1.t)('正在删除角色...'));
297080
+ }
297081
+ try {
297082
+ const permissionService = yield getPermissionService(envId);
297083
+ const result = yield permissionService.deleteRoles({ roleIds: uniqueIds });
297084
+ const data = result.Data || {};
297085
+ const successCount = (_a = data.SuccessCount) !== null && _a !== void 0 ? _a : 0;
297086
+ const failedCount = (_b = data.FailedCount) !== null && _b !== void 0 ? _b : 0;
297087
+ if ((0, utils_1.isJsonOutput)()) {
297088
+ (0, utils_1.outputJson)(result);
297089
+ return;
297090
+ }
297091
+ if (failedCount > 0) {
297092
+ log.warn((0, i18n_1.t)('已删除 {{success}} 个,失败 {{failed}} 个', { success: successCount, failed: failedCount }));
297093
+ }
297094
+ else {
297095
+ log.success((0, i18n_1.t)('已删除 {{count}} 个角色', { count: successCount }));
297096
+ }
297097
+ log.info((0, i18n_1.t)('\n已删除:'));
297098
+ for (const id of uniqueIds) {
297099
+ log.info(` • ${id}`);
297100
+ }
297101
+ }
297102
+ catch (e) {
297103
+ if (e instanceof error_1.CloudBaseError) {
297104
+ throw e;
297105
+ }
297106
+ throw new error_1.CloudBaseError({
297107
+ message: e.message || (0, i18n_1.t)('删除角色失败'),
297108
+ code: 'API_ERROR',
297109
+ solution: [
297110
+ (0, i18n_1.t)('系统角色不可删除,只能删除自定义角色'),
297111
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
297112
+ ],
297113
+ original: e
297114
+ });
297115
+ }
297116
+ });
297117
+ }
297118
+ };
297119
+ __decorate([
297120
+ (0, decorators_1.InjectParams)(),
297121
+ __param(0, (0, decorators_1.EnvId)()),
297122
+ __param(1, (0, decorators_1.ArgsParams)()),
297123
+ __param(2, (0, decorators_1.Log)()),
297124
+ __metadata("design:type", Function),
297125
+ __metadata("design:paramtypes", [String, Array, decorators_1.Logger]),
297126
+ __metadata("design:returntype", Promise)
297127
+ ], RoleDeleteCommand.prototype, "execute", null);
297128
+ RoleDeleteCommand = __decorate([
297129
+ (0, common_1.ICommand)()
297130
+ ], RoleDeleteCommand);
297131
+ exports.RoleDeleteCommand = RoleDeleteCommand;
297132
+
297133
+
296106
297134
  /***/ }),
296107
297135
 
296108
297136
  /***/ 2608:
@@ -330981,7 +332009,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
330981
332009
  /***/ ((module) => {
330982
332010
 
330983
332011
  "use strict";
330984
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"3.0.0-alpha.6","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --verbose --testTimeout=120000","test:e2e":"node --experimental-vm-modules node_modules/jest/bin/jest.js --testPathPattern=\'test/e2e/\' --runInBand --forceExit --detectOpenHandles --verbose --testTimeout=120000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"node ./scripts/check-publish-source.js","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs && node build/scripts/copy-figlet-fonts.js","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","package:npm":"npm run build && npm run build:bundle && bash build/scripts/prepare-publish.sh","out:prune":"bash build/scripts/prune-out.sh","i18n:scan":"i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js","i18n:sync":"node locales/scripts/sync.js sync","publish":"node ./scripts/publish.js"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^2.7.3","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.14","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.11.0-alpha.9","@cloudbase/toolbox":"0.7.17","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","os-locale":"5.0.0","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@babel/parser":"^7.28.4","@babel/traverse":"^7.28.4","@babel/types":"^7.28.4","@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","i18next-scanner":"^4.6.0","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557","ai":{"skills":"./skills","skillsIndex":"./skills/index.json","compatible":["codebuddy","cursor","copilot","claude","windsurf"],"description":"CloudBase CLI - 腾讯云云开发命令行工具,支持云函数、云数据库、静态托管等全栈云开发能力"}}');
332012
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"3.0.0-alpha.8","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --verbose --testTimeout=120000","test:e2e":"node --experimental-vm-modules node_modules/jest/bin/jest.js --testPathPattern=\'test/e2e/\' --runInBand --forceExit --detectOpenHandles --verbose --testTimeout=120000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"node ./scripts/check-publish-source.js","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs && node build/scripts/copy-figlet-fonts.js","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","package:npm":"npm run build && npm run build:bundle && bash build/scripts/prepare-publish.sh","out:prune":"bash build/scripts/prune-out.sh","i18n:scan":"i18next-scanner --config locales/i18next-scanner.config.js && node locales/scripts/generate.js","i18n:sync":"node locales/scripts/sync.js sync","publish":"node ./scripts/publish.js"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^2.7.3","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.14","@cloudbase/lowcode-cli":"^0.23.0","@cloudbase/manager-node":"4.11.0-alpha.9","@cloudbase/toolbox":"0.7.17","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","os-locale":"5.0.0","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@babel/parser":"^7.28.4","@babel/traverse":"^7.28.4","@babel/types":"^7.28.4","@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","i18next-scanner":"^4.6.0","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557","ai":{"skills":"./skills","skillsIndex":"./skills/index.json","compatible":["codebuddy","cursor","copilot","claude","windsurf"],"description":"CloudBase CLI - 腾讯云云开发命令行工具,支持云函数、云数据库、静态托管等全栈云开发能力"}}');
330985
332013
 
330986
332014
  /***/ }),
330987
332015
 
@@ -386631,6 +387659,547 @@ return PromiseArray;
386631
387659
  };
386632
387660
 
386633
387661
 
387662
+ /***/ }),
387663
+
387664
+ /***/ 15771:
387665
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
387666
+
387667
+ "use strict";
387668
+
387669
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
387670
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
387671
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
387672
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
387673
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
387674
+ };
387675
+ var __metadata = (this && this.__metadata) || function (k, v) {
387676
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
387677
+ };
387678
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
387679
+ return function (target, key) { decorator(target, key, paramIndex); }
387680
+ };
387681
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
387682
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
387683
+ return new (P || (P = Promise))(function (resolve, reject) {
387684
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
387685
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
387686
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
387687
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
387688
+ });
387689
+ };
387690
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
387691
+ exports.PermissionGetCommand = exports.PermissionSetCommand = void 0;
387692
+ const common_1 = __webpack_require__(48431);
387693
+ const decorators_1 = __webpack_require__(93480);
387694
+ const error_1 = __webpack_require__(66759);
387695
+ const utils_1 = __webpack_require__(82079);
387696
+ const i18n_1 = __webpack_require__(69258);
387697
+ function getPermissionService(envId) {
387698
+ return __awaiter(this, void 0, void 0, function* () {
387699
+ const app = yield (0, utils_1.getMangerService)(envId);
387700
+ return app.permission;
387701
+ });
387702
+ }
387703
+ const VALID_RESOURCE_TYPES = ['function', 'storage', 'table', 'collection'];
387704
+ const VALID_LEVELS = {
387705
+ table: ['readonly', 'private', 'adminwrite', 'adminonly'],
387706
+ collection: ['readonly', 'private', 'adminwrite', 'adminonly', 'custom'],
387707
+ function: ['custom'],
387708
+ storage: ['readonly', 'private', 'adminwrite', 'adminonly', 'custom']
387709
+ };
387710
+ const LEVEL_MAP = {
387711
+ readonly: 'READONLY',
387712
+ private: 'PRIVATE',
387713
+ adminwrite: 'ADMINWRITE',
387714
+ adminonly: 'ADMINONLY',
387715
+ custom: 'CUSTOM'
387716
+ };
387717
+ const REVERSE_LEVEL_MAP = {
387718
+ READONLY: 'readonly',
387719
+ PRIVATE: 'private',
387720
+ ADMINWRITE: 'adminwrite',
387721
+ ADMINONLY: 'adminonly',
387722
+ CUSTOM: 'custom'
387723
+ };
387724
+ const LEVEL_DESCRIPTIONS = {
387725
+ table: {
387726
+ readonly: '读取全部数据,修改本人数据',
387727
+ private: '读取和修改本人数据',
387728
+ adminwrite: '读取全部数据,不可修改数据',
387729
+ adminonly: '无权限'
387730
+ },
387731
+ collection: {
387732
+ readonly: '读取全部数据,修改本人数据',
387733
+ private: '读取和修改本人数据',
387734
+ adminwrite: '读取全部数据,不可修改数据',
387735
+ adminonly: '无权限',
387736
+ custom: '自定义安全规则'
387737
+ },
387738
+ function: {
387739
+ custom: '自定义安全规则'
387740
+ },
387741
+ storage: {
387742
+ readonly: '所有用户可读,仅创建者和管理员可写',
387743
+ private: '仅创建者及管理员可读写',
387744
+ adminwrite: '所有用户可读,仅管理员可写',
387745
+ adminonly: '仅管理员可读写',
387746
+ custom: '自定义安全规则'
387747
+ }
387748
+ };
387749
+ function parseResourceArg(resourceArg) {
387750
+ if (!resourceArg) {
387751
+ throw new error_1.CloudBaseError({
387752
+ message: (0, i18n_1.t)('参数格式错误:请指定资源类型'),
387753
+ code: 'INVALID_PARAM',
387754
+ solution: [
387755
+ (0, i18n_1.t)('用法:tcb permission set <type>:<resource> --level <level>'),
387756
+ (0, i18n_1.t)('示例:tcb permission set table:users --level readonly'),
387757
+ (0, i18n_1.t)('云函数可省略资源名称:tcb permission set function --level custom --rule \'{"read": true}\''),
387758
+ (0, i18n_1.t)('支持的资源类型:{{types}}', { types: VALID_RESOURCE_TYPES.join(', ') })
387759
+ ]
387760
+ });
387761
+ }
387762
+ let resourceType;
387763
+ let resource;
387764
+ if (resourceArg.includes(':')) {
387765
+ const colonIndex = resourceArg.indexOf(':');
387766
+ resourceType = resourceArg.substring(0, colonIndex);
387767
+ resource = resourceArg.substring(colonIndex + 1);
387768
+ }
387769
+ else {
387770
+ resourceType = resourceArg;
387771
+ resource = '';
387772
+ }
387773
+ if (!VALID_RESOURCE_TYPES.includes(resourceType)) {
387774
+ throw new error_1.CloudBaseError({
387775
+ message: (0, i18n_1.t)('不支持的资源类型:{{type}}', { type: resourceType }),
387776
+ code: 'INVALID_ENUM',
387777
+ solution: [
387778
+ (0, i18n_1.t)('支持的资源类型:{{types}}', { types: VALID_RESOURCE_TYPES.join(', ') }),
387779
+ (0, i18n_1.t)('示例:tcb permission set table:users --level readonly')
387780
+ ]
387781
+ });
387782
+ }
387783
+ const typedResourceType = resourceType;
387784
+ if (!resource && typedResourceType !== 'function') {
387785
+ throw new error_1.CloudBaseError({
387786
+ message: (0, i18n_1.t)('资源名称不能为空'),
387787
+ code: 'INVALID_PARAM',
387788
+ solution: [
387789
+ (0, i18n_1.t)('用法:tcb permission set <type>:<resource> --level <level>'),
387790
+ ]
387791
+ });
387792
+ }
387793
+ return { resourceType: typedResourceType, resource };
387794
+ }
387795
+ function parseGetResourceArg(resourceArg) {
387796
+ const [rawType, rawResources = ''] = resourceArg.split(':');
387797
+ const resources = rawResources
387798
+ ? rawResources.split(',').map(r => r.trim()).filter(Boolean)
387799
+ : [];
387800
+ if (!VALID_RESOURCE_TYPES.includes(rawType)) {
387801
+ throw new error_1.CloudBaseError({
387802
+ message: (0, i18n_1.t)('不支持的资源类型:{{type}}', { type: rawType }),
387803
+ code: 'INVALID_ENUM',
387804
+ solution: [
387805
+ (0, i18n_1.t)('支持的资源类型:{{types}}', { types: VALID_RESOURCE_TYPES.join(', ') }),
387806
+ (0, i18n_1.t)('示例:tcb permission get table:users')
387807
+ ]
387808
+ });
387809
+ }
387810
+ if (resources.length > 100) {
387811
+ throw new error_1.CloudBaseError({
387812
+ message: (0, i18n_1.t)('资源列表不能超过 100 条,当前 {{count}} 条', { count: resources.length }),
387813
+ code: 'INVALID_PARAM'
387814
+ });
387815
+ }
387816
+ return { resourceType: rawType, resources };
387817
+ }
387818
+ function fetchResourceIdentifiers(resourceType, envId) {
387819
+ var _a, _b;
387820
+ return __awaiter(this, void 0, void 0, function* () {
387821
+ const app = yield (0, utils_1.getMangerService)(envId);
387822
+ switch (resourceType) {
387823
+ case 'function':
387824
+ return [];
387825
+ case 'storage': {
387826
+ const result = yield app.env.describeEnvs({ EnvId: envId });
387827
+ const storages = ((_b = (_a = result.EnvList) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Storages) || [];
387828
+ return storages.map(s => s.Bucket).filter(Boolean);
387829
+ }
387830
+ case 'collection': {
387831
+ const result = yield app.database.listCollections({});
387832
+ const collections = result.Collections || [];
387833
+ return collections.map(c => c.CollectionName);
387834
+ }
387835
+ case 'table': {
387836
+ const result = yield app.mysql.runSql({
387837
+ Sql: `SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${envId}' AND TABLE_TYPE='BASE TABLE' AND TABLE_NAME LIKE '%'`,
387838
+ ReadOnly: true
387839
+ });
387840
+ return (result.Items || []).map((item) => {
387841
+ try {
387842
+ const parsed = JSON.parse(item);
387843
+ return Array.isArray(parsed) ? parsed[0] : parsed.TABLE_NAME;
387844
+ }
387845
+ catch (_a) {
387846
+ return item;
387847
+ }
387848
+ });
387849
+ }
387850
+ default:
387851
+ return [];
387852
+ }
387853
+ });
387854
+ }
387855
+ let PermissionSetCommand = class PermissionSetCommand extends common_1.Command {
387856
+ get options() {
387857
+ return {
387858
+ cmd: 'permission',
387859
+ childCmd: 'set <resourceArg>',
387860
+ options: [
387861
+ {
387862
+ flags: '-e, --env-id <envId>',
387863
+ desc: (0, i18n_1.t)('环境 Id'),
387864
+ deprecatedName: 'envId'
387865
+ },
387866
+ {
387867
+ flags: '--level <level>',
387868
+ desc: (0, i18n_1.t)('权限级别'),
387869
+ choices: ['readonly', 'private', 'adminwrite', 'adminonly', 'custom']
387870
+ },
387871
+ {
387872
+ flags: '--rule <rule>',
387873
+ desc: (0, i18n_1.t)('自定义规则(JSON 字符串)')
387874
+ },
387875
+ ],
387876
+ desc: (0, i18n_1.t)('设置资源权限'),
387877
+ examples: [
387878
+ 'tcb permission set table:users --level readonly --env-id xxx',
387879
+ 'tcb permission set function --level custom --rule \'{"read": true}\' --env-id xxx',
387880
+ 'tcb permission set table:users --level readonly --env-id xxx --json'
387881
+ ]
387882
+ };
387883
+ }
387884
+ execute(envId, params, options, log) {
387885
+ var _a;
387886
+ return __awaiter(this, void 0, void 0, function* () {
387887
+ const resourceArg = params === null || params === void 0 ? void 0 : params[0];
387888
+ const { resourceType, resource } = parseResourceArg(resourceArg);
387889
+ const level = options.level;
387890
+ const rule = options.rule;
387891
+ if (!level && !rule) {
387892
+ throw new error_1.CloudBaseError({
387893
+ message: (0, i18n_1.t)('请指定权限级别或自定义规则'),
387894
+ code: 'MISSING_PARAM',
387895
+ solution: [
387896
+ (0, i18n_1.t)('使用 --level 指定权限级别:tcb permission set {{type}}:{{resource}} --level <level>', { type: resourceType, resource }),
387897
+ (0, i18n_1.t)('或使用 --rule 指定自定义规则:tcb permission set {{type}}:{{resource}} --rule \'<json>\'', { type: resourceType, resource }),
387898
+ (0, i18n_1.t)('{{type}} 支持的权限级别:{{levels}}', { type: resourceType, levels: VALID_LEVELS[resourceType].join(', ') })
387899
+ ]
387900
+ });
387901
+ }
387902
+ let finalLevel;
387903
+ if (level) {
387904
+ finalLevel = level;
387905
+ }
387906
+ else {
387907
+ finalLevel = 'custom';
387908
+ }
387909
+ const validLevels = VALID_LEVELS[resourceType];
387910
+ if (!validLevels.includes(finalLevel)) {
387911
+ throw new error_1.CloudBaseError({
387912
+ message: (0, i18n_1.t)('资源类型 {{type}} 不支持权限级别 {{level}}', { type: resourceType, level: finalLevel }),
387913
+ code: 'INVALID_PARAM',
387914
+ solution: [
387915
+ (0, i18n_1.t)('{{type}} 支持的权限级别:{{levels}}', { type: resourceType, levels: validLevels.join(', ') })
387916
+ ]
387917
+ });
387918
+ }
387919
+ if (finalLevel === 'custom' && !rule) {
387920
+ throw new error_1.CloudBaseError({
387921
+ message: (0, i18n_1.t)('权限级别为 custom 时,需要提供 --rule '),
387922
+ code: 'MISSING_PARAM',
387923
+ solution: [
387924
+ (0, i18n_1.t)('使用 --rule 指定规则:--rule \'{"read": true}\''),
387925
+ (0, i18n_1.t)('示例:tcb permission set {{type}}:{{resource}} --level custom --rule \'{"read": true}\'', { type: resourceType, resource })
387926
+ ]
387927
+ });
387928
+ }
387929
+ const apiOptions = {
387930
+ resourceType,
387931
+ resource,
387932
+ permission: LEVEL_MAP[finalLevel]
387933
+ };
387934
+ if (rule) {
387935
+ apiOptions.securityRule = rule;
387936
+ }
387937
+ const confirmed = yield (0, utils_1.autoConfirm)((0, i18n_1.t)('即将设置 {{type}}/{{resource}} 的权限为 {{level}},确认执行?', {
387938
+ type: resourceType, resource, level: finalLevel
387939
+ }));
387940
+ if (!confirmed)
387941
+ return;
387942
+ if (!(0, utils_1.isJsonOutput)()) {
387943
+ log.info((0, i18n_1.t)('正在设置 {{type}}/{{resource}} 的权限...', { type: resourceType, resource }));
387944
+ }
387945
+ try {
387946
+ const permissionService = yield getPermissionService(envId);
387947
+ const resp = yield permissionService.modifyResourcePermission(apiOptions);
387948
+ if ((0, utils_1.isJsonOutput)()) {
387949
+ (0, utils_1.outputJson)(resp);
387950
+ return;
387951
+ }
387952
+ log.success((0, i18n_1.t)('资源权限设置成功'));
387953
+ log.info('');
387954
+ log.info((0, i18n_1.t)('权限详情:'));
387955
+ log.info(` Resource: ${resourceType}/${resource}`);
387956
+ log.info(` Level: ${finalLevel}`);
387957
+ const description = (_a = LEVEL_DESCRIPTIONS[resourceType]) === null || _a === void 0 ? void 0 : _a[finalLevel];
387958
+ if (description) {
387959
+ log.info(` Description: ${description}`);
387960
+ }
387961
+ if (rule) {
387962
+ log.info(` Rule: ${rule}`);
387963
+ }
387964
+ log.info('');
387965
+ log.info((0, i18n_1.t)('下一步:'));
387966
+ log.info(` ${(0, i18n_1.t)('查看资源权限')} ${(0, utils_1.highlightCommand)(`tcb permission get ${resourceType}:${resource} --env-id ${envId}`)}`);
387967
+ }
387968
+ catch (e) {
387969
+ throw new error_1.CloudBaseError({
387970
+ message: e.message || (0, i18n_1.t)('设置资源权限失败'),
387971
+ code: 'API_ERROR',
387972
+ solution: [
387973
+ (0, i18n_1.t)('请检查资源名称是否正确'),
387974
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
387975
+ ],
387976
+ original: e
387977
+ });
387978
+ }
387979
+ });
387980
+ }
387981
+ };
387982
+ __decorate([
387983
+ (0, decorators_1.InjectParams)(),
387984
+ __param(0, (0, decorators_1.EnvId)()),
387985
+ __param(1, (0, decorators_1.ArgsParams)()),
387986
+ __param(2, (0, decorators_1.ArgsOptions)()),
387987
+ __param(3, (0, decorators_1.Log)()),
387988
+ __metadata("design:type", Function),
387989
+ __metadata("design:paramtypes", [String, Array, Object, decorators_1.Logger]),
387990
+ __metadata("design:returntype", Promise)
387991
+ ], PermissionSetCommand.prototype, "execute", null);
387992
+ PermissionSetCommand = __decorate([
387993
+ (0, common_1.ICommand)()
387994
+ ], PermissionSetCommand);
387995
+ exports.PermissionSetCommand = PermissionSetCommand;
387996
+ let PermissionGetCommand = class PermissionGetCommand extends common_1.Command {
387997
+ get options() {
387998
+ return {
387999
+ cmd: 'permission',
388000
+ childCmd: 'get [resourceArg]',
388001
+ options: [
388002
+ {
388003
+ flags: '-e, --env-id <envId>',
388004
+ desc: (0, i18n_1.t)('环境 Id'),
388005
+ deprecatedName: 'envId'
388006
+ }
388007
+ ],
388008
+ desc: (0, i18n_1.t)('查询资源权限'),
388009
+ autoRunLogin: true,
388010
+ examples: [
388011
+ 'tcb permission get --env-id xxx',
388012
+ 'tcb permission get table --env-id xxx',
388013
+ 'tcb permission get table:users --env-id xxx',
388014
+ 'tcb permission get table:users,orders --env-id xxx',
388015
+ 'tcb permission get function --env-id xxx',
388016
+ 'tcb permission get storage:my-bucket --env-id xxx',
388017
+ 'tcb permission get table --env-id xxx --json'
388018
+ ]
388019
+ };
388020
+ }
388021
+ execute(envId, params, options, log) {
388022
+ return __awaiter(this, void 0, void 0, function* () {
388023
+ const resourceArg = params === null || params === void 0 ? void 0 : params[0];
388024
+ let queryTypes;
388025
+ if (!resourceArg) {
388026
+ queryTypes = [...VALID_RESOURCE_TYPES];
388027
+ }
388028
+ else if (!resourceArg.includes(':')) {
388029
+ if (!VALID_RESOURCE_TYPES.includes(resourceArg)) {
388030
+ throw new error_1.CloudBaseError({
388031
+ message: (0, i18n_1.t)('不支持的资源类型:{{type}}', { type: resourceArg }),
388032
+ code: 'INVALID_ENUM',
388033
+ solution: [
388034
+ (0, i18n_1.t)('支持的资源类型:{{types}}', { types: VALID_RESOURCE_TYPES.join(', ') })
388035
+ ]
388036
+ });
388037
+ }
388038
+ queryTypes = [resourceArg];
388039
+ }
388040
+ else {
388041
+ const { resourceType, resources } = parseGetResourceArg(resourceArg);
388042
+ queryTypes = [resourceType];
388043
+ return this.executeWithResources(resourceType, resources, envId, log);
388044
+ }
388045
+ return this.executeForTypes(queryTypes, envId, log);
388046
+ });
388047
+ }
388048
+ executeWithResources(resourceType, resources, envId, log) {
388049
+ var _a, _b, _c;
388050
+ return __awaiter(this, void 0, void 0, function* () {
388051
+ if (!(0, utils_1.isJsonOutput)()) {
388052
+ const displayResources = resources.join(', ');
388053
+ log.info((0, i18n_1.t)('正在查询 {{type}} 的权限({{resources}})...', {
388054
+ type: resourceType,
388055
+ resources: displayResources
388056
+ }));
388057
+ }
388058
+ try {
388059
+ const permissionService = yield getPermissionService(envId);
388060
+ let finalResources = resources;
388061
+ if (finalResources.length === 0 && resourceType !== 'function') {
388062
+ finalResources = yield fetchResourceIdentifiers(resourceType, envId);
388063
+ }
388064
+ if (finalResources.length === 0) {
388065
+ if (!(0, utils_1.isJsonOutput)()) {
388066
+ log.info((0, i18n_1.t)('{{type}} 类型的资源列表为空,跳过查询', { type: resourceType }));
388067
+ }
388068
+ this.outputResult([], 0, log);
388069
+ return;
388070
+ }
388071
+ const resp = yield permissionService.describeResourcePermission({
388072
+ resourceType,
388073
+ resources: finalResources
388074
+ });
388075
+ this.outputResult(((_a = resp.Data) === null || _a === void 0 ? void 0 : _a.PermissionList) || [], (_c = (_b = resp.Data) === null || _b === void 0 ? void 0 : _b.TotalCount) !== null && _c !== void 0 ? _c : 0, log);
388076
+ }
388077
+ catch (e) {
388078
+ throw new error_1.CloudBaseError({
388079
+ message: e.message || (0, i18n_1.t)('查询资源权限失败'),
388080
+ code: 'API_ERROR',
388081
+ solution: [
388082
+ (0, i18n_1.t)('请检查资源名称是否正确'),
388083
+ (0, i18n_1.t)('运行 {{cmd}} 重新登录', { cmd: (0, utils_1.highlightCommand)('tcb login') })
388084
+ ],
388085
+ original: e
388086
+ });
388087
+ }
388088
+ });
388089
+ }
388090
+ executeForTypes(types, envId, log) {
388091
+ return __awaiter(this, void 0, void 0, function* () {
388092
+ const typeDisplay = types.length === VALID_RESOURCE_TYPES.length
388093
+ ? (0, i18n_1.t)('全部类型')
388094
+ : types.join(', ');
388095
+ if (!(0, utils_1.isJsonOutput)()) {
388096
+ log.info((0, i18n_1.t)('正在查询 {{types}} 的资源权限...', { types: typeDisplay }));
388097
+ }
388098
+ const permissionService = yield getPermissionService(envId);
388099
+ const results = yield Promise.all(types.map((type) => __awaiter(this, void 0, void 0, function* () {
388100
+ var _a, _b, _c, _d;
388101
+ try {
388102
+ const resources = yield fetchResourceIdentifiers(type, envId);
388103
+ if (type !== 'function' && resources.length === 0) {
388104
+ log.verbose(`[${type}] 无资源,跳过查询`);
388105
+ return { permissionList: [], totalCount: 0 };
388106
+ }
388107
+ const apiResources = type === 'function' ? undefined : resources;
388108
+ if (!(0, utils_1.isJsonOutput)()) {
388109
+ log.verbose(`[${type}] 获取到 ${(_a = apiResources === null || apiResources === void 0 ? void 0 : apiResources.length) !== null && _a !== void 0 ? _a : 0} 个资源标识`);
388110
+ }
388111
+ const resp = yield permissionService.describeResourcePermission({
388112
+ resourceType: type,
388113
+ resources: apiResources
388114
+ });
388115
+ return {
388116
+ permissionList: ((_b = resp.Data) === null || _b === void 0 ? void 0 : _b.PermissionList) || [],
388117
+ totalCount: (_d = (_c = resp.Data) === null || _c === void 0 ? void 0 : _c.TotalCount) !== null && _d !== void 0 ? _d : 0
388118
+ };
388119
+ }
388120
+ catch (e) {
388121
+ if (!(0, utils_1.isJsonOutput)()) {
388122
+ log.warn((0, i18n_1.t)('查询 {{type}} 权限失败: {{error}}', {
388123
+ type,
388124
+ error: e.message
388125
+ }));
388126
+ }
388127
+ return { permissionList: [], totalCount: 0 };
388128
+ }
388129
+ })));
388130
+ const allPermissions = results.reduce((list, r) => list.concat(r.permissionList), []);
388131
+ const totalCount = results.reduce((sum, r) => sum + r.totalCount, 0);
388132
+ this.outputResult(allPermissions, totalCount, log);
388133
+ });
388134
+ }
388135
+ outputResult(permissionList, totalCount, log) {
388136
+ if ((0, utils_1.isJsonOutput)()) {
388137
+ (0, utils_1.outputJson)({
388138
+ TotalCount: totalCount,
388139
+ PermissionList: permissionList
388140
+ });
388141
+ return;
388142
+ }
388143
+ if (permissionList.length === 0) {
388144
+ log.info((0, i18n_1.t)('未查询到权限记录'));
388145
+ return;
388146
+ }
388147
+ const head = [
388148
+ (0, i18n_1.t)('资源类型'),
388149
+ (0, i18n_1.t)('资源名称'),
388150
+ (0, i18n_1.t)('权限级别'),
388151
+ (0, i18n_1.t)('描述')
388152
+ ];
388153
+ const tableData = permissionList.map(item => {
388154
+ var _a;
388155
+ const type = item.ResourceType || '-';
388156
+ const resource = item.Resource || '-';
388157
+ const permission = item.Permission || '-';
388158
+ const lowerLevel = REVERSE_LEVEL_MAP[permission] || permission;
388159
+ const description = ((_a = LEVEL_DESCRIPTIONS[type]) === null || _a === void 0 ? void 0 : _a[lowerLevel]) || '-';
388160
+ return [type, resource, lowerLevel, description];
388161
+ });
388162
+ (0, utils_1.printHorizontalTable)(head, tableData);
388163
+ log.info((0, i18n_1.t)('共 {{count}} 条记录', { count: totalCount }));
388164
+ }
388165
+ };
388166
+ __decorate([
388167
+ (0, decorators_1.InjectParams)(),
388168
+ __param(0, (0, decorators_1.EnvId)()),
388169
+ __param(1, (0, decorators_1.ArgsParams)()),
388170
+ __param(2, (0, decorators_1.ArgsOptions)()),
388171
+ __param(3, (0, decorators_1.Log)()),
388172
+ __metadata("design:type", Function),
388173
+ __metadata("design:paramtypes", [String, Array, Object, decorators_1.Logger]),
388174
+ __metadata("design:returntype", Promise)
388175
+ ], PermissionGetCommand.prototype, "execute", null);
388176
+ __decorate([
388177
+ (0, decorators_1.InjectParams)(),
388178
+ __param(3, (0, decorators_1.Log)()),
388179
+ __metadata("design:type", Function),
388180
+ __metadata("design:paramtypes", [String, Array, String, decorators_1.Logger]),
388181
+ __metadata("design:returntype", Promise)
388182
+ ], PermissionGetCommand.prototype, "executeWithResources", null);
388183
+ __decorate([
388184
+ (0, decorators_1.InjectParams)(),
388185
+ __param(2, (0, decorators_1.Log)()),
388186
+ __metadata("design:type", Function),
388187
+ __metadata("design:paramtypes", [Array, String, decorators_1.Logger]),
388188
+ __metadata("design:returntype", Promise)
388189
+ ], PermissionGetCommand.prototype, "executeForTypes", null);
388190
+ __decorate([
388191
+ (0, decorators_1.InjectParams)(),
388192
+ __param(2, (0, decorators_1.Log)()),
388193
+ __metadata("design:type", Function),
388194
+ __metadata("design:paramtypes", [Array, Number, decorators_1.Logger]),
388195
+ __metadata("design:returntype", void 0)
388196
+ ], PermissionGetCommand.prototype, "outputResult", null);
388197
+ PermissionGetCommand = __decorate([
388198
+ (0, common_1.ICommand)()
388199
+ ], PermissionGetCommand);
388200
+ exports.PermissionGetCommand = PermissionGetCommand;
388201
+
388202
+
386634
388203
  /***/ }),
386635
388204
 
386636
388205
  /***/ 15782:
@@ -547274,6 +548843,32 @@ function sleep(time) {
547274
548843
  exports.sleep = sleep;
547275
548844
 
547276
548845
 
548846
+ /***/ }),
548847
+
548848
+ /***/ 41650:
548849
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
548850
+
548851
+ "use strict";
548852
+
548853
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
548854
+ if (k2 === undefined) k2 = k;
548855
+ var desc = Object.getOwnPropertyDescriptor(m, k);
548856
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
548857
+ desc = { enumerable: true, get: function() { return m[k]; } };
548858
+ }
548859
+ Object.defineProperty(o, k2, desc);
548860
+ }) : (function(o, m, k, k2) {
548861
+ if (k2 === undefined) k2 = k;
548862
+ o[k2] = m[k];
548863
+ }));
548864
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
548865
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
548866
+ };
548867
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
548868
+ __exportStar(__webpack_require__(15771), exports);
548869
+ __exportStar(__webpack_require__(2604), exports);
548870
+
548871
+
547277
548872
  /***/ }),
547278
548873
 
547279
548874
  /***/ 41665:
@@ -597880,6 +599475,7 @@ __exportStar(__webpack_require__(38001), exports);
597880
599475
  __exportStar(__webpack_require__(11502), exports);
597881
599476
  __exportStar(__webpack_require__(81106), exports);
597882
599477
  __exportStar(__webpack_require__(60928), exports);
599478
+ __exportStar(__webpack_require__(41650), exports);
597883
599479
 
597884
599480
 
597885
599481
  /***/ }),
@@ -939243,6 +940839,9 @@ const outputHelpInfo = () => {
939243
940839
  docs [cmd] ${(0, i18n_1.t)('云开发文档检索操作')}
939244
940840
  api [cmd] ${(0, i18n_1.t)('通用腾讯云 API 调用操作')}
939245
940841
  secrets [cmd] ${(0, i18n_1.t)('临时密钥管理操作')}
940842
+ user [cmd] ${(0, i18n_1.t)('用户管理操作')}
940843
+ permission [cmd] ${(0, i18n_1.t)('资源权限管理操作')}
940844
+ role [cmd] ${(0, i18n_1.t)('角色管理操作')}
939246
940845
  `;
939247
940846
  const options = `
939248
940847
  ${(0, i18n_1.t)('选项')}