@kevisual/cnb 0.0.57 → 0.0.58
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/agent/routes/org/index.ts +2 -0
- package/agent/routes/org/list.ts +137 -0
- package/agent/routes/org/org.ts +241 -0
- package/dist/cli.js +81 -0
- package/dist/npc.js +81 -0
- package/dist/opencode.js +81 -0
- package/dist/routes.d.ts +408 -0
- package/dist/routes.js +81 -0
- package/package.json +1 -1
- package/src/index.ts +7 -1
- package/src/org/index.ts +574 -0
package/dist/opencode.js
CHANGED
|
@@ -23232,6 +23232,83 @@ class PackageManagement extends CNBCore {
|
|
|
23232
23232
|
});
|
|
23233
23233
|
}
|
|
23234
23234
|
}
|
|
23235
|
+
// src/org/index.ts
|
|
23236
|
+
class Organization extends CNBCore {
|
|
23237
|
+
constructor(options) {
|
|
23238
|
+
super(options);
|
|
23239
|
+
}
|
|
23240
|
+
create(params) {
|
|
23241
|
+
return this.post({
|
|
23242
|
+
url: "/groups",
|
|
23243
|
+
data: params
|
|
23244
|
+
});
|
|
23245
|
+
}
|
|
23246
|
+
listTopGroups(params) {
|
|
23247
|
+
return this.get({
|
|
23248
|
+
url: "/user/groups",
|
|
23249
|
+
params
|
|
23250
|
+
});
|
|
23251
|
+
}
|
|
23252
|
+
listGroups(slug, params) {
|
|
23253
|
+
return this.get({
|
|
23254
|
+
url: `/user/groups/${slug}`,
|
|
23255
|
+
params
|
|
23256
|
+
});
|
|
23257
|
+
}
|
|
23258
|
+
getGroupsByUsername(username, params) {
|
|
23259
|
+
return this.get({
|
|
23260
|
+
url: `/users/${username}/groups`,
|
|
23261
|
+
params
|
|
23262
|
+
});
|
|
23263
|
+
}
|
|
23264
|
+
getGroup(group) {
|
|
23265
|
+
return this.get({
|
|
23266
|
+
url: `/${group}`
|
|
23267
|
+
});
|
|
23268
|
+
}
|
|
23269
|
+
updateGroup(group, params) {
|
|
23270
|
+
return this.put({
|
|
23271
|
+
url: `/${group}`,
|
|
23272
|
+
data: params
|
|
23273
|
+
});
|
|
23274
|
+
}
|
|
23275
|
+
deleteGroup(group, identityTicket) {
|
|
23276
|
+
return this.delete({
|
|
23277
|
+
url: `/${group}`,
|
|
23278
|
+
headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
|
|
23279
|
+
});
|
|
23280
|
+
}
|
|
23281
|
+
transfer(group, params) {
|
|
23282
|
+
return this.post({
|
|
23283
|
+
url: `/${group}/-/transfer`,
|
|
23284
|
+
data: params
|
|
23285
|
+
});
|
|
23286
|
+
}
|
|
23287
|
+
uploadLogo(group, params) {
|
|
23288
|
+
return this.post({
|
|
23289
|
+
url: `/${group}/-/upload/logos`,
|
|
23290
|
+
data: params
|
|
23291
|
+
});
|
|
23292
|
+
}
|
|
23293
|
+
getSetting(slug) {
|
|
23294
|
+
return this.get({
|
|
23295
|
+
url: `/${slug}/-/settings`
|
|
23296
|
+
});
|
|
23297
|
+
}
|
|
23298
|
+
updateSetting(slug, params) {
|
|
23299
|
+
return this.put({
|
|
23300
|
+
url: `/${slug}/-/settings`,
|
|
23301
|
+
data: params
|
|
23302
|
+
});
|
|
23303
|
+
}
|
|
23304
|
+
listSubgroups(slug, params) {
|
|
23305
|
+
return this.get({
|
|
23306
|
+
url: `/${slug}/-/sub-groups`,
|
|
23307
|
+
params
|
|
23308
|
+
});
|
|
23309
|
+
}
|
|
23310
|
+
}
|
|
23311
|
+
|
|
23235
23312
|
// src/index.ts
|
|
23236
23313
|
class CNB extends CNBCore {
|
|
23237
23314
|
workspace;
|
|
@@ -23244,6 +23321,7 @@ class CNB extends CNBCore {
|
|
|
23244
23321
|
ai;
|
|
23245
23322
|
labels;
|
|
23246
23323
|
packages;
|
|
23324
|
+
org;
|
|
23247
23325
|
constructor(options) {
|
|
23248
23326
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
23249
23327
|
this.init(options);
|
|
@@ -23270,6 +23348,7 @@ class CNB extends CNBCore {
|
|
|
23270
23348
|
registry: new RegistryPackage(options),
|
|
23271
23349
|
package: new PackageManagement(options)
|
|
23272
23350
|
};
|
|
23351
|
+
this.org = new Organization(options);
|
|
23273
23352
|
}
|
|
23274
23353
|
setToken(token) {
|
|
23275
23354
|
this.token = token;
|
|
@@ -23283,6 +23362,7 @@ class CNB extends CNBCore {
|
|
|
23283
23362
|
this.labels.issueLabel.token = token;
|
|
23284
23363
|
this.packages.registry.token = token;
|
|
23285
23364
|
this.packages.package.token = token;
|
|
23365
|
+
this.org.token = token;
|
|
23286
23366
|
}
|
|
23287
23367
|
setCookie(cookie) {
|
|
23288
23368
|
this.cookie = cookie;
|
|
@@ -23296,6 +23376,7 @@ class CNB extends CNBCore {
|
|
|
23296
23376
|
this.labels.issueLabel.cookie = cookie;
|
|
23297
23377
|
this.packages.registry.cookie = cookie;
|
|
23298
23378
|
this.packages.package.cookie = cookie;
|
|
23379
|
+
this.org.cookie = cookie;
|
|
23299
23380
|
}
|
|
23300
23381
|
getCNBVersion = getCNBVersion;
|
|
23301
23382
|
}
|
package/dist/routes.d.ts
CHANGED
|
@@ -1288,6 +1288,413 @@ declare class PackageManagement extends CNBCore {
|
|
|
1288
1288
|
}): Promise<Result<any>>;
|
|
1289
1289
|
}
|
|
1290
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* @title 组织管理模块
|
|
1293
|
+
* @description 提供组织(Organizations)的管理功能,包括创建、更新、删除组织,获取组织列表、子组织、组织设置等
|
|
1294
|
+
* @tags organization, group, team, cnb, api
|
|
1295
|
+
* @createdAt 2025-12-04
|
|
1296
|
+
*/
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* 组织角色枚举
|
|
1300
|
+
*/
|
|
1301
|
+
declare enum AccessRole {
|
|
1302
|
+
Guest = "Guest",
|
|
1303
|
+
Reporter = "Reporter",
|
|
1304
|
+
Developer = "Developer",
|
|
1305
|
+
Master = "Master",
|
|
1306
|
+
Owner = "Owner"
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* 创建组织请求参数
|
|
1310
|
+
*/
|
|
1311
|
+
interface CreateGroupParams {
|
|
1312
|
+
/** 组织路径 */
|
|
1313
|
+
path: string;
|
|
1314
|
+
/** 组织描述 */
|
|
1315
|
+
description?: string;
|
|
1316
|
+
/** 根组织绑定的域名 */
|
|
1317
|
+
bind_domain?: string;
|
|
1318
|
+
/** 备注 */
|
|
1319
|
+
remark?: string;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* 更新组织信息请求参数
|
|
1323
|
+
*/
|
|
1324
|
+
interface UpdateGroupParams {
|
|
1325
|
+
/** 组织描述 */
|
|
1326
|
+
description?: string;
|
|
1327
|
+
/** 组织展示名称 */
|
|
1328
|
+
remark?: string;
|
|
1329
|
+
/** 组织网站 */
|
|
1330
|
+
site?: string;
|
|
1331
|
+
/** 组织联系邮箱 */
|
|
1332
|
+
email?: string;
|
|
1333
|
+
/** 绑定的域名 */
|
|
1334
|
+
domain?: string;
|
|
1335
|
+
/** 微信公众号 */
|
|
1336
|
+
wechat_mp?: string;
|
|
1337
|
+
/** README 仓库 ID */
|
|
1338
|
+
readme_repo_id?: number;
|
|
1339
|
+
/** README 仓库路径 */
|
|
1340
|
+
readme_repo_path?: string;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* 转移组织请求参数
|
|
1344
|
+
*/
|
|
1345
|
+
interface TransferGroupParams {
|
|
1346
|
+
/** 源组织路径 */
|
|
1347
|
+
source: string;
|
|
1348
|
+
/** 目标组织路径 */
|
|
1349
|
+
target: string;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* 上传 Logo 请求参数
|
|
1353
|
+
*/
|
|
1354
|
+
interface UploadLogoParams {
|
|
1355
|
+
/** 文件名 */
|
|
1356
|
+
name: string;
|
|
1357
|
+
/** 文件大小(字节) */
|
|
1358
|
+
size: number;
|
|
1359
|
+
/** 额外参数 */
|
|
1360
|
+
ext?: Record<string, string>;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* 更新组织设置请求参数
|
|
1364
|
+
*/
|
|
1365
|
+
interface UpdateGroupSettingParams {
|
|
1366
|
+
/** 是否对外隐藏组织成员,0 - 否, 1 - 是 */
|
|
1367
|
+
hide_members?: number;
|
|
1368
|
+
/** 是否对外隐藏子组织,0 - 否, 1 - 是 */
|
|
1369
|
+
hide_sub_groups?: number;
|
|
1370
|
+
/** 是否对外显示私有仓库水印,0 - 否, 1 - 是 */
|
|
1371
|
+
show_private_repo_watermark?: number;
|
|
1372
|
+
/** 组织保护开关,0 - 关闭,1 - 打开 */
|
|
1373
|
+
group_protection?: number;
|
|
1374
|
+
/** 组织限制指定邮箱认证才能加入 */
|
|
1375
|
+
email_verification?: string[];
|
|
1376
|
+
/** 组织设置值,多个选项用逗号拼接 */
|
|
1377
|
+
values?: string;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* 组织信息(包含访问权限)
|
|
1381
|
+
*/
|
|
1382
|
+
interface OrganizationAccess {
|
|
1383
|
+
/** 用户在当前资源的最大权限 */
|
|
1384
|
+
access_role?: AccessRole;
|
|
1385
|
+
/** 所有层级成员总数 */
|
|
1386
|
+
all_member_count?: number;
|
|
1387
|
+
/** 所有层级子组织数量 */
|
|
1388
|
+
all_sub_group_count?: number;
|
|
1389
|
+
/** 所有层级子任务数量 */
|
|
1390
|
+
all_sub_mission_count?: number;
|
|
1391
|
+
/** 所有层级制品库数量 */
|
|
1392
|
+
all_sub_registry_count?: number;
|
|
1393
|
+
/** 所有层级仓库数量 */
|
|
1394
|
+
all_sub_repo_count?: number;
|
|
1395
|
+
/** 创建时间 */
|
|
1396
|
+
created_at?: string;
|
|
1397
|
+
/** 组织描述 */
|
|
1398
|
+
description?: string;
|
|
1399
|
+
/** 绑定的域名 */
|
|
1400
|
+
domain?: string;
|
|
1401
|
+
/** 组织邮箱 */
|
|
1402
|
+
email?: string;
|
|
1403
|
+
/** 关注数量 */
|
|
1404
|
+
follow_count?: number;
|
|
1405
|
+
/** 是否冻结 */
|
|
1406
|
+
freeze?: boolean;
|
|
1407
|
+
/** 是否有子组织 */
|
|
1408
|
+
has_sub_group?: boolean;
|
|
1409
|
+
/** 组织 ID */
|
|
1410
|
+
id?: string;
|
|
1411
|
+
/** 直接成员数量 */
|
|
1412
|
+
member_count?: number;
|
|
1413
|
+
/** 组织展示名称 */
|
|
1414
|
+
name?: string;
|
|
1415
|
+
/** 组织路径 */
|
|
1416
|
+
path?: string;
|
|
1417
|
+
/** 是否置顶 */
|
|
1418
|
+
pinned?: boolean;
|
|
1419
|
+
/** 置顶时间 */
|
|
1420
|
+
pinned_time?: string;
|
|
1421
|
+
/** README 仓库路径 */
|
|
1422
|
+
readme_repo_path?: string;
|
|
1423
|
+
/** 备注 */
|
|
1424
|
+
remark?: string;
|
|
1425
|
+
/** 组织网站 */
|
|
1426
|
+
site?: string;
|
|
1427
|
+
/** 下一级子组织数量 */
|
|
1428
|
+
sub_group_count?: number;
|
|
1429
|
+
/** 下一级子任务数量 */
|
|
1430
|
+
sub_mission_count?: number;
|
|
1431
|
+
/** 下一级制品库数量 */
|
|
1432
|
+
sub_registry_count?: number;
|
|
1433
|
+
/** 下一级仓库数量 */
|
|
1434
|
+
sub_repo_count?: number;
|
|
1435
|
+
/** 更新时间 */
|
|
1436
|
+
updated_at?: string;
|
|
1437
|
+
/** 微信公众号 */
|
|
1438
|
+
wechat_mp?: string;
|
|
1439
|
+
}
|
|
1440
|
+
/**
|
|
1441
|
+
* 组织信息(联合类型)
|
|
1442
|
+
*/
|
|
1443
|
+
interface OrganizationUnion {
|
|
1444
|
+
/** 所有层级成员总数 */
|
|
1445
|
+
all_member_count?: number;
|
|
1446
|
+
/** 所有层级子组织数量 */
|
|
1447
|
+
all_sub_group_count?: number;
|
|
1448
|
+
/** 所有层级子任务数量 */
|
|
1449
|
+
all_sub_mission_count?: number;
|
|
1450
|
+
/** 所有层级制品库数量 */
|
|
1451
|
+
all_sub_registry_count?: number;
|
|
1452
|
+
/** 所有层级仓库数量 */
|
|
1453
|
+
all_sub_repo_count?: number;
|
|
1454
|
+
/** 创建时间 */
|
|
1455
|
+
created_at?: string;
|
|
1456
|
+
/** 组织描述 */
|
|
1457
|
+
description?: string;
|
|
1458
|
+
/** 绑定的域名 */
|
|
1459
|
+
domain?: string;
|
|
1460
|
+
/** 组织邮箱 */
|
|
1461
|
+
email?: string;
|
|
1462
|
+
/** 关注数量 */
|
|
1463
|
+
follow_count?: number;
|
|
1464
|
+
/** 是否冻结 */
|
|
1465
|
+
freeze?: boolean;
|
|
1466
|
+
/** 是否有子组织 */
|
|
1467
|
+
has_sub_group?: boolean;
|
|
1468
|
+
/** 组织 ID */
|
|
1469
|
+
id?: string;
|
|
1470
|
+
/** 直接成员数量 */
|
|
1471
|
+
member_count?: number;
|
|
1472
|
+
/** 组织展示名称 */
|
|
1473
|
+
name?: string;
|
|
1474
|
+
/** 组织路径 */
|
|
1475
|
+
path?: string;
|
|
1476
|
+
/** 是否置顶 */
|
|
1477
|
+
pinned?: boolean;
|
|
1478
|
+
/** 置顶时间 */
|
|
1479
|
+
pinned_time?: string;
|
|
1480
|
+
/** README 仓库路径 */
|
|
1481
|
+
readme_repo_path?: string;
|
|
1482
|
+
/** 备注 */
|
|
1483
|
+
remark?: string;
|
|
1484
|
+
/** 组织网站 */
|
|
1485
|
+
site?: string;
|
|
1486
|
+
/** 下一级子组织数量 */
|
|
1487
|
+
sub_group_count?: number;
|
|
1488
|
+
/** 下一级子任务数量 */
|
|
1489
|
+
sub_mission_count?: number;
|
|
1490
|
+
/** 下一级制品库数量 */
|
|
1491
|
+
sub_registry_count?: number;
|
|
1492
|
+
/** 下一级仓库数量 */
|
|
1493
|
+
sub_repo_count?: number;
|
|
1494
|
+
/** 更新时间 */
|
|
1495
|
+
updated_at?: string;
|
|
1496
|
+
/** 微信公众号 */
|
|
1497
|
+
wechat_mp?: string;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* 上传 Logo 响应
|
|
1501
|
+
*/
|
|
1502
|
+
interface UploadLogoResponse {
|
|
1503
|
+
/** 上传后的文件信息 */
|
|
1504
|
+
assets?: {
|
|
1505
|
+
/** 文件大小 */
|
|
1506
|
+
size?: number;
|
|
1507
|
+
/** 文件名 */
|
|
1508
|
+
name?: string;
|
|
1509
|
+
/** 文件路径 */
|
|
1510
|
+
path?: string;
|
|
1511
|
+
/** 内容类型 */
|
|
1512
|
+
content_type?: string;
|
|
1513
|
+
/** 额外信息 */
|
|
1514
|
+
ext?: Record<string, string>;
|
|
1515
|
+
};
|
|
1516
|
+
/** 上传表单字段 */
|
|
1517
|
+
form?: Record<string, string>;
|
|
1518
|
+
/** 上传 URL */
|
|
1519
|
+
upload_url?: string;
|
|
1520
|
+
/** 后续确认接口使用的 token */
|
|
1521
|
+
token?: string;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* 组织设置值
|
|
1525
|
+
*/
|
|
1526
|
+
interface SettingValues {
|
|
1527
|
+
/** 禁用组织 README */
|
|
1528
|
+
disable_organization_readme?: boolean;
|
|
1529
|
+
/** 云原生开发限制 */
|
|
1530
|
+
cloud_native_dev_only?: boolean;
|
|
1531
|
+
/** 根组织分支保护规则限制 */
|
|
1532
|
+
user_root_group_branch_protection_only?: boolean;
|
|
1533
|
+
/** 禁止重定义分支保护 */
|
|
1534
|
+
forbid_redefine_branch_protection?: boolean;
|
|
1535
|
+
/** TAPD 访问 */
|
|
1536
|
+
enable_tapd_access?: boolean;
|
|
1537
|
+
/** 私有任务水印 */
|
|
1538
|
+
enable_show_private_mission_water_mark?: boolean;
|
|
1539
|
+
/** 禁止组织创建 */
|
|
1540
|
+
prevent_organization_creation?: boolean;
|
|
1541
|
+
/** 禁止仓库创建 */
|
|
1542
|
+
prevent_repository_creation?: boolean;
|
|
1543
|
+
/** 禁止任务集创建 */
|
|
1544
|
+
prevent_mission_creation?: boolean;
|
|
1545
|
+
/** 禁止制品库创建 */
|
|
1546
|
+
prevent_registry_creation?: boolean;
|
|
1547
|
+
/** 禁止邀请 */
|
|
1548
|
+
disable_invitation?: boolean;
|
|
1549
|
+
/** 禁止可见性修改 */
|
|
1550
|
+
prevent_visibility_modification?: boolean;
|
|
1551
|
+
/** 禁止资源删除 */
|
|
1552
|
+
prevent_resource_deletion?: boolean;
|
|
1553
|
+
/** 禁止仓库归档 */
|
|
1554
|
+
prevent_repository_archival?: boolean;
|
|
1555
|
+
/** 禁止组织转移 */
|
|
1556
|
+
prevent_organization_transfer?: boolean;
|
|
1557
|
+
/** 禁止仓库转移 */
|
|
1558
|
+
prevent_repository_transfer?: boolean;
|
|
1559
|
+
/** 禁止任务集转移 */
|
|
1560
|
+
prevent_mission_transfer?: boolean;
|
|
1561
|
+
/** 禁止制品库转移 */
|
|
1562
|
+
prevent_registry_transfer?: boolean;
|
|
1563
|
+
/** 使用组织 Git 配额 */
|
|
1564
|
+
use_group_git_quota?: boolean;
|
|
1565
|
+
/** 使用组织 Git 对象限制 */
|
|
1566
|
+
use_group_git_object_limit?: boolean;
|
|
1567
|
+
/** 仅根组织可添加成员 */
|
|
1568
|
+
enable_add_member_only_root?: boolean;
|
|
1569
|
+
/** 使用根组织 Git 推送限制 */
|
|
1570
|
+
use_root_group_git_push_limit?: boolean;
|
|
1571
|
+
/** 允许添加成员 */
|
|
1572
|
+
enable_add_member?: boolean;
|
|
1573
|
+
/** 仅根组织可修改成员角色 */
|
|
1574
|
+
enable_change_member_role_only_root?: boolean;
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* 组织设置信息(包含父级继承)
|
|
1578
|
+
*/
|
|
1579
|
+
interface OrganizationSettingWithParent {
|
|
1580
|
+
/** 上级是否隐藏成员,true - 上级禁止显示 */
|
|
1581
|
+
can_show_members?: boolean;
|
|
1582
|
+
/** 上级是否隐藏子组织,true - 上级禁止显示 */
|
|
1583
|
+
can_show_sub_groups?: boolean;
|
|
1584
|
+
/** 是否可以显示水印 */
|
|
1585
|
+
can_show_watermark?: boolean;
|
|
1586
|
+
/** 邮箱验证配置 */
|
|
1587
|
+
email_verification?: string[];
|
|
1588
|
+
/** 组织保护开关 */
|
|
1589
|
+
group_protection?: number;
|
|
1590
|
+
/** 是否对外隐藏组织成员,0 - 否, 1 - 是 */
|
|
1591
|
+
hide_members?: number;
|
|
1592
|
+
/** 是否对外隐藏子组织,0 - 否, 1 - 是 */
|
|
1593
|
+
hide_sub_groups?: number;
|
|
1594
|
+
/** 根组织邮箱验证配置 */
|
|
1595
|
+
root_email_verification?: string[];
|
|
1596
|
+
/** 根组织保护开关 */
|
|
1597
|
+
root_group_protection?: boolean;
|
|
1598
|
+
/** 根组织设置值 */
|
|
1599
|
+
root_values?: SettingValues;
|
|
1600
|
+
/** 是否对外显示私有仓库水印 */
|
|
1601
|
+
show_private_repo_watermark?: number;
|
|
1602
|
+
/** 当前组织设置值 */
|
|
1603
|
+
values?: SettingValues;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* 组织管理模块
|
|
1607
|
+
* https://api.cnb.cool/#/operations/GetGroup
|
|
1608
|
+
*/
|
|
1609
|
+
declare class Organization extends CNBCore {
|
|
1610
|
+
constructor(options: CNBCoreOptions);
|
|
1611
|
+
/**
|
|
1612
|
+
* 创建新组织
|
|
1613
|
+
* @param params 组织信息
|
|
1614
|
+
*/
|
|
1615
|
+
create(params: CreateGroupParams): Promise<Result$2<OrganizationAccess>>;
|
|
1616
|
+
/**
|
|
1617
|
+
* 获取当前用户拥有权限的顶层组织列表
|
|
1618
|
+
* @param params 查询参数
|
|
1619
|
+
*/
|
|
1620
|
+
listTopGroups(params?: {
|
|
1621
|
+
page?: number;
|
|
1622
|
+
page_size?: number;
|
|
1623
|
+
search?: string;
|
|
1624
|
+
role?: AccessRole;
|
|
1625
|
+
}): Promise<Result$2<OrganizationAccess[]>>;
|
|
1626
|
+
/**
|
|
1627
|
+
* 查询当前用户在指定组织下拥有指定权限的子组织列表
|
|
1628
|
+
* @param slug 组织路径
|
|
1629
|
+
* @param params 查询参数
|
|
1630
|
+
*/
|
|
1631
|
+
listGroups(slug: string, params?: {
|
|
1632
|
+
page?: number;
|
|
1633
|
+
page_size?: number;
|
|
1634
|
+
access?: number;
|
|
1635
|
+
}): Promise<Result$2<OrganizationAccess[]>>;
|
|
1636
|
+
/**
|
|
1637
|
+
* 获取指定用户拥有权限的顶层组织列表
|
|
1638
|
+
* @param username 用户名
|
|
1639
|
+
* @param params 查询参数
|
|
1640
|
+
*/
|
|
1641
|
+
getGroupsByUsername(username: string, params?: {
|
|
1642
|
+
search?: string;
|
|
1643
|
+
page?: number;
|
|
1644
|
+
page_size?: number;
|
|
1645
|
+
}): Promise<Result$2<OrganizationUnion>>;
|
|
1646
|
+
/**
|
|
1647
|
+
* 获取指定组织信息
|
|
1648
|
+
* @param group 组织路径
|
|
1649
|
+
*/
|
|
1650
|
+
getGroup(group: string): Promise<Result$2<OrganizationAccess>>;
|
|
1651
|
+
/**
|
|
1652
|
+
* 更新组织信息,可更新的内容为:组织描述、组织展示名称、组织网站、组织联系邮箱
|
|
1653
|
+
* @param group 组织路径
|
|
1654
|
+
* @param params 更新内容
|
|
1655
|
+
*/
|
|
1656
|
+
updateGroup(group: string, params: UpdateGroupParams): Promise<Result$2<OrganizationAccess>>;
|
|
1657
|
+
/**
|
|
1658
|
+
* 删除指定组织
|
|
1659
|
+
* @param group 组织路径
|
|
1660
|
+
* @param identityTicket 微信身份验证票据
|
|
1661
|
+
*/
|
|
1662
|
+
deleteGroup(group: string, identityTicket?: string): Promise<Result$2<void>>;
|
|
1663
|
+
/**
|
|
1664
|
+
* 转移组织
|
|
1665
|
+
* @param group 组织路径
|
|
1666
|
+
* @param params 转移参数
|
|
1667
|
+
*/
|
|
1668
|
+
transfer(group: string, params: TransferGroupParams): Promise<Result$2<void>>;
|
|
1669
|
+
/**
|
|
1670
|
+
* 上传 Logo,发起上传请求,返回上传文件的 URL,请使用 PUT 发起流式上传
|
|
1671
|
+
* @param group 组织路径
|
|
1672
|
+
* @param params 上传参数
|
|
1673
|
+
*/
|
|
1674
|
+
uploadLogo(group: string, params: UploadLogoParams): Promise<Result$2<UploadLogoResponse>>;
|
|
1675
|
+
/**
|
|
1676
|
+
* 获取指定组织的配置详情
|
|
1677
|
+
* @param slug 组织路径
|
|
1678
|
+
*/
|
|
1679
|
+
getSetting(slug: string): Promise<Result$2<OrganizationSettingWithParent>>;
|
|
1680
|
+
/**
|
|
1681
|
+
* 更新指定组织的配置
|
|
1682
|
+
* @param slug 组织路径
|
|
1683
|
+
* @param params 设置参数
|
|
1684
|
+
*/
|
|
1685
|
+
updateSetting(slug: string, params: UpdateGroupSettingParams): Promise<Result$2<void>>;
|
|
1686
|
+
/**
|
|
1687
|
+
* 获取指定组织下的子组织列表
|
|
1688
|
+
* @param slug 组织路径
|
|
1689
|
+
* @param params 查询参数
|
|
1690
|
+
*/
|
|
1691
|
+
listSubgroups(slug: string, params?: {
|
|
1692
|
+
search?: string;
|
|
1693
|
+
page?: number;
|
|
1694
|
+
page_size?: number;
|
|
1695
|
+
}): Promise<Result$2<OrganizationUnion[]>>;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1291
1698
|
type CNBOptions = CNBCoreOptions<{}>;
|
|
1292
1699
|
declare class CNB extends CNBCore {
|
|
1293
1700
|
workspace: Workspace;
|
|
@@ -1306,6 +1713,7 @@ declare class CNB extends CNBCore {
|
|
|
1306
1713
|
registry: RegistryPackage;
|
|
1307
1714
|
package: PackageManagement;
|
|
1308
1715
|
};
|
|
1716
|
+
org: Organization;
|
|
1309
1717
|
constructor(options: CNBOptions);
|
|
1310
1718
|
init(cnbOptions?: CNBOptions): void;
|
|
1311
1719
|
setToken(token: string): void;
|
package/dist/routes.js
CHANGED
|
@@ -23232,6 +23232,83 @@ class PackageManagement extends CNBCore {
|
|
|
23232
23232
|
});
|
|
23233
23233
|
}
|
|
23234
23234
|
}
|
|
23235
|
+
// src/org/index.ts
|
|
23236
|
+
class Organization extends CNBCore {
|
|
23237
|
+
constructor(options) {
|
|
23238
|
+
super(options);
|
|
23239
|
+
}
|
|
23240
|
+
create(params) {
|
|
23241
|
+
return this.post({
|
|
23242
|
+
url: "/groups",
|
|
23243
|
+
data: params
|
|
23244
|
+
});
|
|
23245
|
+
}
|
|
23246
|
+
listTopGroups(params) {
|
|
23247
|
+
return this.get({
|
|
23248
|
+
url: "/user/groups",
|
|
23249
|
+
params
|
|
23250
|
+
});
|
|
23251
|
+
}
|
|
23252
|
+
listGroups(slug, params) {
|
|
23253
|
+
return this.get({
|
|
23254
|
+
url: `/user/groups/${slug}`,
|
|
23255
|
+
params
|
|
23256
|
+
});
|
|
23257
|
+
}
|
|
23258
|
+
getGroupsByUsername(username, params) {
|
|
23259
|
+
return this.get({
|
|
23260
|
+
url: `/users/${username}/groups`,
|
|
23261
|
+
params
|
|
23262
|
+
});
|
|
23263
|
+
}
|
|
23264
|
+
getGroup(group) {
|
|
23265
|
+
return this.get({
|
|
23266
|
+
url: `/${group}`
|
|
23267
|
+
});
|
|
23268
|
+
}
|
|
23269
|
+
updateGroup(group, params) {
|
|
23270
|
+
return this.put({
|
|
23271
|
+
url: `/${group}`,
|
|
23272
|
+
data: params
|
|
23273
|
+
});
|
|
23274
|
+
}
|
|
23275
|
+
deleteGroup(group, identityTicket) {
|
|
23276
|
+
return this.delete({
|
|
23277
|
+
url: `/${group}`,
|
|
23278
|
+
headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
|
|
23279
|
+
});
|
|
23280
|
+
}
|
|
23281
|
+
transfer(group, params) {
|
|
23282
|
+
return this.post({
|
|
23283
|
+
url: `/${group}/-/transfer`,
|
|
23284
|
+
data: params
|
|
23285
|
+
});
|
|
23286
|
+
}
|
|
23287
|
+
uploadLogo(group, params) {
|
|
23288
|
+
return this.post({
|
|
23289
|
+
url: `/${group}/-/upload/logos`,
|
|
23290
|
+
data: params
|
|
23291
|
+
});
|
|
23292
|
+
}
|
|
23293
|
+
getSetting(slug) {
|
|
23294
|
+
return this.get({
|
|
23295
|
+
url: `/${slug}/-/settings`
|
|
23296
|
+
});
|
|
23297
|
+
}
|
|
23298
|
+
updateSetting(slug, params) {
|
|
23299
|
+
return this.put({
|
|
23300
|
+
url: `/${slug}/-/settings`,
|
|
23301
|
+
data: params
|
|
23302
|
+
});
|
|
23303
|
+
}
|
|
23304
|
+
listSubgroups(slug, params) {
|
|
23305
|
+
return this.get({
|
|
23306
|
+
url: `/${slug}/-/sub-groups`,
|
|
23307
|
+
params
|
|
23308
|
+
});
|
|
23309
|
+
}
|
|
23310
|
+
}
|
|
23311
|
+
|
|
23235
23312
|
// src/index.ts
|
|
23236
23313
|
class CNB extends CNBCore {
|
|
23237
23314
|
workspace;
|
|
@@ -23244,6 +23321,7 @@ class CNB extends CNBCore {
|
|
|
23244
23321
|
ai;
|
|
23245
23322
|
labels;
|
|
23246
23323
|
packages;
|
|
23324
|
+
org;
|
|
23247
23325
|
constructor(options) {
|
|
23248
23326
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
23249
23327
|
this.init(options);
|
|
@@ -23270,6 +23348,7 @@ class CNB extends CNBCore {
|
|
|
23270
23348
|
registry: new RegistryPackage(options),
|
|
23271
23349
|
package: new PackageManagement(options)
|
|
23272
23350
|
};
|
|
23351
|
+
this.org = new Organization(options);
|
|
23273
23352
|
}
|
|
23274
23353
|
setToken(token) {
|
|
23275
23354
|
this.token = token;
|
|
@@ -23283,6 +23362,7 @@ class CNB extends CNBCore {
|
|
|
23283
23362
|
this.labels.issueLabel.token = token;
|
|
23284
23363
|
this.packages.registry.token = token;
|
|
23285
23364
|
this.packages.package.token = token;
|
|
23365
|
+
this.org.token = token;
|
|
23286
23366
|
}
|
|
23287
23367
|
setCookie(cookie) {
|
|
23288
23368
|
this.cookie = cookie;
|
|
@@ -23296,6 +23376,7 @@ class CNB extends CNBCore {
|
|
|
23296
23376
|
this.labels.issueLabel.cookie = cookie;
|
|
23297
23377
|
this.packages.registry.cookie = cookie;
|
|
23298
23378
|
this.packages.package.cookie = cookie;
|
|
23379
|
+
this.org.cookie = cookie;
|
|
23299
23380
|
}
|
|
23300
23381
|
getCNBVersion = getCNBVersion;
|
|
23301
23382
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Mission } from "./mission/index.ts";
|
|
|
9
9
|
import { AiBase } from "./ai/index.ts";
|
|
10
10
|
import { RepoLabel, IssueLabel } from "./labels/index.ts";
|
|
11
11
|
import { RegistryPackage, PackageManagement } from "./package/index.ts";
|
|
12
|
+
import { Organization } from "./org/index.ts";
|
|
12
13
|
|
|
13
14
|
type CNBOptions = CNBCoreOptions<{
|
|
14
15
|
}>;
|
|
@@ -30,6 +31,7 @@ export class CNB extends CNBCore {
|
|
|
30
31
|
registry: RegistryPackage;
|
|
31
32
|
package: PackageManagement;
|
|
32
33
|
};
|
|
34
|
+
org!: Organization;
|
|
33
35
|
constructor(options: CNBOptions) {
|
|
34
36
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
35
37
|
this.init(options);
|
|
@@ -56,6 +58,7 @@ export class CNB extends CNBCore {
|
|
|
56
58
|
registry: new RegistryPackage(options),
|
|
57
59
|
package: new PackageManagement(options),
|
|
58
60
|
};
|
|
61
|
+
this.org = new Organization(options);
|
|
59
62
|
}
|
|
60
63
|
setToken(token: string) {
|
|
61
64
|
this.token = token;
|
|
@@ -69,6 +72,7 @@ export class CNB extends CNBCore {
|
|
|
69
72
|
this.labels.issueLabel.token = token;
|
|
70
73
|
this.packages.registry.token = token;
|
|
71
74
|
this.packages.package.token = token;
|
|
75
|
+
this.org.token = token;
|
|
72
76
|
}
|
|
73
77
|
setCookie(cookie: string) {
|
|
74
78
|
this.cookie = cookie;
|
|
@@ -82,6 +86,7 @@ export class CNB extends CNBCore {
|
|
|
82
86
|
this.labels.issueLabel.cookie = cookie;
|
|
83
87
|
this.packages.registry.cookie = cookie;
|
|
84
88
|
this.packages.package.cookie = cookie;
|
|
89
|
+
this.org.cookie = cookie;
|
|
85
90
|
}
|
|
86
91
|
getCNBVersion = getCNBVersion
|
|
87
92
|
}
|
|
@@ -109,4 +114,5 @@ type VersionInfo = {
|
|
|
109
114
|
|
|
110
115
|
export * from './issue/npc/env.ts'
|
|
111
116
|
export * from './labels/index.ts'
|
|
112
|
-
export * from './package/index.ts'
|
|
117
|
+
export * from './package/index.ts'
|
|
118
|
+
export * from './org/index.ts'
|