@kevisual/cnb 0.0.57 → 0.0.59
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 +103 -0
- package/dist/npc.js +103 -0
- package/dist/opencode.js +103 -0
- package/dist/routes.d.ts +455 -0
- package/dist/routes.js +103 -0
- package/package.json +1 -1
- package/src/index.ts +12 -2
- package/src/issue/dashboard.ts +64 -0
- package/src/issue/index.ts +1 -0
- package/src/org/index.ts +574 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { createSkill } from '@kevisual/router';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { app, cnbManager } from '../../app.ts';
|
|
4
|
+
|
|
5
|
+
// 获取当前用户顶层组织列表
|
|
6
|
+
app.route({
|
|
7
|
+
path: 'cnb',
|
|
8
|
+
key: 'list-top-groups',
|
|
9
|
+
description: '获取当前用户拥有权限的顶层组织列表',
|
|
10
|
+
middleware: ['auth'],
|
|
11
|
+
metadata: {
|
|
12
|
+
tags: ['opencode'],
|
|
13
|
+
...createSkill({
|
|
14
|
+
skill: 'list-top-groups',
|
|
15
|
+
title: '获取顶层组织列表',
|
|
16
|
+
args: {
|
|
17
|
+
page: z.number().optional().describe('分页页码,默认: 1'),
|
|
18
|
+
page_size: z.number().optional().describe('分页每页大小,默认: 10'),
|
|
19
|
+
search: z.string().optional().describe('搜索过滤组织名称'),
|
|
20
|
+
role: z.enum(['Guest', 'Reporter', 'Developer', 'Master', 'Owner']).optional().describe('按角色过滤'),
|
|
21
|
+
},
|
|
22
|
+
summary: '获取当前用户拥有权限的顶层组织列表',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}).define(async (ctx) => {
|
|
26
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
27
|
+
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
28
|
+
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
29
|
+
const search = ctx.query?.search;
|
|
30
|
+
const role = ctx.query?.role;
|
|
31
|
+
|
|
32
|
+
const res = await cnb.org.listTopGroups({ page, page_size, search, role });
|
|
33
|
+
ctx.forward(res);
|
|
34
|
+
}).addTo(app);
|
|
35
|
+
|
|
36
|
+
// 获取指定组织下的子组织列表
|
|
37
|
+
app.route({
|
|
38
|
+
path: 'cnb',
|
|
39
|
+
key: 'list-groups',
|
|
40
|
+
description: '获取指定组织下的子组织列表',
|
|
41
|
+
middleware: ['auth'],
|
|
42
|
+
metadata: {
|
|
43
|
+
tags: ['opencode'],
|
|
44
|
+
...createSkill({
|
|
45
|
+
skill: 'list-groups',
|
|
46
|
+
title: '获取子组织列表',
|
|
47
|
+
args: {
|
|
48
|
+
slug: z.string().describe('组织路径,如 my-org'),
|
|
49
|
+
page: z.number().optional().describe('分页页码,默认: 1'),
|
|
50
|
+
page_size: z.number().optional().describe('分页每页大小,默认: 10'),
|
|
51
|
+
access: z.number().optional().describe('访问权限级别'),
|
|
52
|
+
},
|
|
53
|
+
summary: '获取指定组织下拥有权限的子组织列表',
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}).define(async (ctx) => {
|
|
57
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
58
|
+
const slug = ctx.query?.slug;
|
|
59
|
+
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
60
|
+
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
61
|
+
const access = ctx.query?.access ? Number(ctx.query.access) : undefined;
|
|
62
|
+
|
|
63
|
+
if (!slug) {
|
|
64
|
+
ctx.throw(400, '缺少参数 slug');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const res = await cnb.org.listGroups(slug, { page, page_size, access });
|
|
68
|
+
ctx.forward(res);
|
|
69
|
+
}).addTo(app);
|
|
70
|
+
|
|
71
|
+
// 获取指定组织下的子组织列表(不带权限过滤)
|
|
72
|
+
app.route({
|
|
73
|
+
path: 'cnb',
|
|
74
|
+
key: 'list-subgroups',
|
|
75
|
+
description: '获取指定组织下的子组织列表(不带权限过滤)',
|
|
76
|
+
middleware: ['auth'],
|
|
77
|
+
metadata: {
|
|
78
|
+
tags: ['opencode'],
|
|
79
|
+
...createSkill({
|
|
80
|
+
skill: 'list-subgroups',
|
|
81
|
+
title: '获取子组织列表',
|
|
82
|
+
args: {
|
|
83
|
+
slug: z.string().describe('组织路径,如 my-org'),
|
|
84
|
+
search: z.string().optional().describe('搜索过滤子组织名称'),
|
|
85
|
+
page: z.number().optional().describe('分页页码,默认: 1'),
|
|
86
|
+
page_size: z.number().optional().describe('分页每页大小,默认: 10'),
|
|
87
|
+
},
|
|
88
|
+
summary: '获取指定组织下的子组织列表',
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
}).define(async (ctx) => {
|
|
92
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
93
|
+
const slug = ctx.query?.slug;
|
|
94
|
+
const search = ctx.query?.search;
|
|
95
|
+
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
96
|
+
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
97
|
+
|
|
98
|
+
if (!slug) {
|
|
99
|
+
ctx.throw(400, '缺少参数 slug');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const res = await cnb.org.listSubgroups(slug, { search, page, page_size });
|
|
103
|
+
ctx.forward(res);
|
|
104
|
+
}).addTo(app);
|
|
105
|
+
|
|
106
|
+
// 获取指定用户拥有权限的组织列表
|
|
107
|
+
app.route({
|
|
108
|
+
path: 'cnb',
|
|
109
|
+
key: 'get-groups-by-username',
|
|
110
|
+
description: '获取指定用户拥有权限的组织列表',
|
|
111
|
+
middleware: ['auth'],
|
|
112
|
+
metadata: {
|
|
113
|
+
tags: [],
|
|
114
|
+
skill: 'get-groups-by-username',
|
|
115
|
+
title: '获取用户的组织列表',
|
|
116
|
+
args: {
|
|
117
|
+
username: z.string().describe('用户名'),
|
|
118
|
+
search: z.string().optional().describe('搜索过滤组织名称'),
|
|
119
|
+
page: z.number().optional().describe('分页页码,默认: 1'),
|
|
120
|
+
page_size: z.number().optional().describe('分页每页大小,默认: 10'),
|
|
121
|
+
},
|
|
122
|
+
summary: '获取指定用户拥有权限的组织列表',
|
|
123
|
+
}
|
|
124
|
+
}).define(async (ctx) => {
|
|
125
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
126
|
+
const username = ctx.query?.username;
|
|
127
|
+
const search = ctx.query?.search;
|
|
128
|
+
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
129
|
+
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
130
|
+
|
|
131
|
+
if (!username) {
|
|
132
|
+
ctx.throw(400, '缺少参数 username');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const res = await cnb.org.getGroupsByUsername(username, { search, page, page_size });
|
|
136
|
+
ctx.forward(res);
|
|
137
|
+
}).addTo(app);
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { createSkill } from '@kevisual/router';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { app, cnbManager } from '../../app.ts';
|
|
4
|
+
|
|
5
|
+
// 创建组织
|
|
6
|
+
app.route({
|
|
7
|
+
path: 'cnb',
|
|
8
|
+
key: 'create-organization',
|
|
9
|
+
description: '创建新组织',
|
|
10
|
+
middleware: ['auth'],
|
|
11
|
+
metadata: {
|
|
12
|
+
tags: ['opencode'],
|
|
13
|
+
skill: 'create-organization',
|
|
14
|
+
title: '创建组织',
|
|
15
|
+
args: {
|
|
16
|
+
path: z.string().describe('组织路径'),
|
|
17
|
+
description: z.string().optional().describe('组织描述'),
|
|
18
|
+
bind_domain: z.string().optional().describe('根组织绑定的域名'),
|
|
19
|
+
remark: z.string().optional().describe('组织展示名称'),
|
|
20
|
+
},
|
|
21
|
+
summary: '创建一个新组织',
|
|
22
|
+
}
|
|
23
|
+
}).define(async (ctx) => {
|
|
24
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
25
|
+
const path = ctx.query?.path;
|
|
26
|
+
const description = ctx.query?.description;
|
|
27
|
+
const bind_domain = ctx.query?.bind_domain;
|
|
28
|
+
const remark = ctx.query?.remark;
|
|
29
|
+
|
|
30
|
+
if (!path) {
|
|
31
|
+
ctx.throw(400, '缺少参数 path');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const res = await cnb.org.create({ path, description, bind_domain, remark });
|
|
35
|
+
ctx.forward(res);
|
|
36
|
+
}).addTo(app);
|
|
37
|
+
|
|
38
|
+
// 获取组织信息
|
|
39
|
+
app.route({
|
|
40
|
+
path: 'cnb',
|
|
41
|
+
key: 'get-organization',
|
|
42
|
+
description: '获取组织信息',
|
|
43
|
+
middleware: ['auth'],
|
|
44
|
+
metadata: {
|
|
45
|
+
tags: ['opencode'],
|
|
46
|
+
...createSkill({
|
|
47
|
+
skill: 'get-organization',
|
|
48
|
+
title: '获取组织信息',
|
|
49
|
+
args: {
|
|
50
|
+
group: z.string().describe('组织路径'),
|
|
51
|
+
},
|
|
52
|
+
summary: '获取指定组织的信息',
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}).define(async (ctx) => {
|
|
56
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
57
|
+
const group = ctx.query?.group;
|
|
58
|
+
|
|
59
|
+
if (!group) {
|
|
60
|
+
ctx.throw(400, '缺少参数 group');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const res = await cnb.org.getGroup(group);
|
|
64
|
+
ctx.forward(res);
|
|
65
|
+
}).addTo(app);
|
|
66
|
+
|
|
67
|
+
// 更新组织信息
|
|
68
|
+
app.route({
|
|
69
|
+
path: 'cnb',
|
|
70
|
+
key: 'update-organization',
|
|
71
|
+
description: '更新组织信息',
|
|
72
|
+
middleware: ['auth'],
|
|
73
|
+
metadata: {
|
|
74
|
+
tags: ['opencode'],
|
|
75
|
+
...createSkill({
|
|
76
|
+
skill: 'update-organization',
|
|
77
|
+
title: '更新组织信息',
|
|
78
|
+
args: {
|
|
79
|
+
group: z.string().describe('组织路径'),
|
|
80
|
+
description: z.string().optional().describe('组织描述'),
|
|
81
|
+
remark: z.string().optional().describe('组织展示名称'),
|
|
82
|
+
site: z.string().optional().describe('组织网站'),
|
|
83
|
+
email: z.string().optional().describe('组织联系邮箱'),
|
|
84
|
+
domain: z.string().optional().describe('绑定的域名'),
|
|
85
|
+
wechat_mp: z.string().optional().describe('微信公众号'),
|
|
86
|
+
},
|
|
87
|
+
summary: '更新组织信息,包括描述、展示名称、网站、邮箱等',
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}).define(async (ctx) => {
|
|
91
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
92
|
+
const group = ctx.query?.group;
|
|
93
|
+
const description = ctx.query?.description;
|
|
94
|
+
const remark = ctx.query?.remark;
|
|
95
|
+
const site = ctx.query?.site;
|
|
96
|
+
const email = ctx.query?.email;
|
|
97
|
+
const domain = ctx.query?.domain;
|
|
98
|
+
const wechat_mp = ctx.query?.wechat_mp;
|
|
99
|
+
|
|
100
|
+
if (!group) {
|
|
101
|
+
ctx.throw(400, '缺少参数 group');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const res = await cnb.org.updateGroup(group, { description, remark, site, email, domain, wechat_mp });
|
|
105
|
+
ctx.forward(res);
|
|
106
|
+
}).addTo(app);
|
|
107
|
+
|
|
108
|
+
// 删除组织
|
|
109
|
+
app.route({
|
|
110
|
+
path: 'cnb',
|
|
111
|
+
key: 'delete-organization',
|
|
112
|
+
description: '删除组织',
|
|
113
|
+
middleware: ['auth'],
|
|
114
|
+
metadata: {
|
|
115
|
+
skill: 'delete-organization',
|
|
116
|
+
title: '删除组织',
|
|
117
|
+
args: {
|
|
118
|
+
group: z.string().describe('组织路径'),
|
|
119
|
+
identityTicket: z.string().optional().describe('微信身份验证票据'),
|
|
120
|
+
},
|
|
121
|
+
summary: '删除指定组织',
|
|
122
|
+
}
|
|
123
|
+
}).define(async (ctx) => {
|
|
124
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
125
|
+
const group = ctx.query?.group;
|
|
126
|
+
const identityTicket = ctx.query?.identityTicket;
|
|
127
|
+
|
|
128
|
+
if (!group) {
|
|
129
|
+
ctx.throw(400, '缺少参数 group');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const res = await cnb.org.deleteGroup(group, identityTicket);
|
|
133
|
+
ctx.forward(res);
|
|
134
|
+
}).addTo(app);
|
|
135
|
+
|
|
136
|
+
// 转移组织
|
|
137
|
+
app.route({
|
|
138
|
+
path: 'cnb',
|
|
139
|
+
key: 'transfer-organization',
|
|
140
|
+
description: '转移组织',
|
|
141
|
+
middleware: ['auth'],
|
|
142
|
+
metadata: {
|
|
143
|
+
skill: 'transfer-organization',
|
|
144
|
+
title: '转移组织',
|
|
145
|
+
args: {
|
|
146
|
+
group: z.string().describe('组织路径'),
|
|
147
|
+
source: z.string().describe('源组织路径'),
|
|
148
|
+
target: z.string().describe('目标组织路径'),
|
|
149
|
+
},
|
|
150
|
+
summary: '将组织从源路径转移到目标路径',
|
|
151
|
+
}
|
|
152
|
+
}).define(async (ctx) => {
|
|
153
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
154
|
+
const group = ctx.query?.group;
|
|
155
|
+
const source = ctx.query?.source;
|
|
156
|
+
const target = ctx.query?.target;
|
|
157
|
+
|
|
158
|
+
if (!group || !source || !target) {
|
|
159
|
+
ctx.throw(400, '缺少参数 group, source 或 target');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const res = await cnb.org.transfer(group, { source, target });
|
|
163
|
+
ctx.forward(res);
|
|
164
|
+
}).addTo(app);
|
|
165
|
+
|
|
166
|
+
// 获取组织设置
|
|
167
|
+
app.route({
|
|
168
|
+
path: 'cnb',
|
|
169
|
+
key: 'get-organization-setting',
|
|
170
|
+
description: '获取组织配置详情',
|
|
171
|
+
middleware: ['auth'],
|
|
172
|
+
metadata: {
|
|
173
|
+
tags: ['opencode'],
|
|
174
|
+
...createSkill({
|
|
175
|
+
skill: 'get-organization-setting',
|
|
176
|
+
title: '获取组织设置',
|
|
177
|
+
args: {
|
|
178
|
+
slug: z.string().describe('组织路径'),
|
|
179
|
+
},
|
|
180
|
+
summary: '获取指定组织的配置详情,包括可见性设置、邮箱验证等',
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
}).define(async (ctx) => {
|
|
184
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
185
|
+
const slug = ctx.query?.slug;
|
|
186
|
+
|
|
187
|
+
if (!slug) {
|
|
188
|
+
ctx.throw(400, '缺少参数 slug');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const res = await cnb.org.getSetting(slug);
|
|
192
|
+
ctx.forward(res);
|
|
193
|
+
}).addTo(app);
|
|
194
|
+
|
|
195
|
+
// 更新组织设置
|
|
196
|
+
app.route({
|
|
197
|
+
path: 'cnb',
|
|
198
|
+
key: 'update-organization-setting',
|
|
199
|
+
description: '更新组织配置',
|
|
200
|
+
middleware: ['auth'],
|
|
201
|
+
metadata: {
|
|
202
|
+
tags: ['opencode'],
|
|
203
|
+
...createSkill({
|
|
204
|
+
skill: 'update-organization-setting',
|
|
205
|
+
title: '更新组织设置',
|
|
206
|
+
args: {
|
|
207
|
+
slug: z.string().describe('组织路径'),
|
|
208
|
+
hide_members: z.number().optional().describe('是否对外隐藏组织成员,0 - 否, 1 - 是'),
|
|
209
|
+
hide_sub_groups: z.number().optional().describe('是否对外隐藏子组织,0 - 否, 1 - 是'),
|
|
210
|
+
show_private_repo_watermark: z.number().optional().describe('是否对外显示私有仓库水印,0 - 否, 1 - 是'),
|
|
211
|
+
group_protection: z.number().optional().describe('组织保护开关,0 - 关闭,1 - 打开'),
|
|
212
|
+
email_verification: z.array(z.string()).optional().describe('限制指定邮箱认证才能加入'),
|
|
213
|
+
values: z.string().optional().describe('组织设置值,多个选项用逗号拼接'),
|
|
214
|
+
},
|
|
215
|
+
summary: '更新组织配置,包括成员可见性、子组织可见性、水印等',
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
}).define(async (ctx) => {
|
|
219
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
220
|
+
const slug = ctx.query?.slug;
|
|
221
|
+
const hide_members = ctx.query?.hide_members ? Number(ctx.query.hide_members) : undefined;
|
|
222
|
+
const hide_sub_groups = ctx.query?.hide_sub_groups ? Number(ctx.query.hide_sub_groups) : undefined;
|
|
223
|
+
const show_private_repo_watermark = ctx.query?.show_private_repo_watermark ? Number(ctx.query.show_private_repo_watermark) : undefined;
|
|
224
|
+
const group_protection = ctx.query?.group_protection ? Number(ctx.query.group_protection) : undefined;
|
|
225
|
+
const email_verification = ctx.query?.email_verification;
|
|
226
|
+
const values = ctx.query?.values;
|
|
227
|
+
|
|
228
|
+
if (!slug) {
|
|
229
|
+
ctx.throw(400, '缺少参数 slug');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const res = await cnb.org.updateSetting(slug, {
|
|
233
|
+
hide_members,
|
|
234
|
+
hide_sub_groups,
|
|
235
|
+
show_private_repo_watermark,
|
|
236
|
+
group_protection,
|
|
237
|
+
email_verification,
|
|
238
|
+
values,
|
|
239
|
+
});
|
|
240
|
+
ctx.forward(res);
|
|
241
|
+
}).addTo(app);
|
package/dist/cli.js
CHANGED
|
@@ -24946,6 +24946,24 @@ function useCommentEnv() {
|
|
|
24946
24946
|
};
|
|
24947
24947
|
}
|
|
24948
24948
|
|
|
24949
|
+
// src/issue/dashboard.ts
|
|
24950
|
+
class Dashboard extends CNBCore {
|
|
24951
|
+
constructor(options) {
|
|
24952
|
+
super(options);
|
|
24953
|
+
}
|
|
24954
|
+
getMineCreateIssue(params) {
|
|
24955
|
+
const url3 = `${this.hackURL}/user/dashboard/mine_create/issue`;
|
|
24956
|
+
return this.get({
|
|
24957
|
+
url: url3,
|
|
24958
|
+
params,
|
|
24959
|
+
useCookie: true,
|
|
24960
|
+
headers: {
|
|
24961
|
+
Accept: "application/vnd.cnb.web+json"
|
|
24962
|
+
}
|
|
24963
|
+
});
|
|
24964
|
+
}
|
|
24965
|
+
}
|
|
24966
|
+
|
|
24949
24967
|
// src/issue/index.ts
|
|
24950
24968
|
class Issue extends CNBCore {
|
|
24951
24969
|
constructor(options) {
|
|
@@ -25325,6 +25343,83 @@ class PackageManagement extends CNBCore {
|
|
|
25325
25343
|
});
|
|
25326
25344
|
}
|
|
25327
25345
|
}
|
|
25346
|
+
// src/org/index.ts
|
|
25347
|
+
class Organization extends CNBCore {
|
|
25348
|
+
constructor(options) {
|
|
25349
|
+
super(options);
|
|
25350
|
+
}
|
|
25351
|
+
create(params) {
|
|
25352
|
+
return this.post({
|
|
25353
|
+
url: "/groups",
|
|
25354
|
+
data: params
|
|
25355
|
+
});
|
|
25356
|
+
}
|
|
25357
|
+
listTopGroups(params) {
|
|
25358
|
+
return this.get({
|
|
25359
|
+
url: "/user/groups",
|
|
25360
|
+
params
|
|
25361
|
+
});
|
|
25362
|
+
}
|
|
25363
|
+
listGroups(slug, params) {
|
|
25364
|
+
return this.get({
|
|
25365
|
+
url: `/user/groups/${slug}`,
|
|
25366
|
+
params
|
|
25367
|
+
});
|
|
25368
|
+
}
|
|
25369
|
+
getGroupsByUsername(username, params) {
|
|
25370
|
+
return this.get({
|
|
25371
|
+
url: `/users/${username}/groups`,
|
|
25372
|
+
params
|
|
25373
|
+
});
|
|
25374
|
+
}
|
|
25375
|
+
getGroup(group) {
|
|
25376
|
+
return this.get({
|
|
25377
|
+
url: `/${group}`
|
|
25378
|
+
});
|
|
25379
|
+
}
|
|
25380
|
+
updateGroup(group, params) {
|
|
25381
|
+
return this.put({
|
|
25382
|
+
url: `/${group}`,
|
|
25383
|
+
data: params
|
|
25384
|
+
});
|
|
25385
|
+
}
|
|
25386
|
+
deleteGroup(group, identityTicket) {
|
|
25387
|
+
return this.delete({
|
|
25388
|
+
url: `/${group}`,
|
|
25389
|
+
headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
|
|
25390
|
+
});
|
|
25391
|
+
}
|
|
25392
|
+
transfer(group, params) {
|
|
25393
|
+
return this.post({
|
|
25394
|
+
url: `/${group}/-/transfer`,
|
|
25395
|
+
data: params
|
|
25396
|
+
});
|
|
25397
|
+
}
|
|
25398
|
+
uploadLogo(group, params) {
|
|
25399
|
+
return this.post({
|
|
25400
|
+
url: `/${group}/-/upload/logos`,
|
|
25401
|
+
data: params
|
|
25402
|
+
});
|
|
25403
|
+
}
|
|
25404
|
+
getSetting(slug) {
|
|
25405
|
+
return this.get({
|
|
25406
|
+
url: `/${slug}/-/settings`
|
|
25407
|
+
});
|
|
25408
|
+
}
|
|
25409
|
+
updateSetting(slug, params) {
|
|
25410
|
+
return this.put({
|
|
25411
|
+
url: `/${slug}/-/settings`,
|
|
25412
|
+
data: params
|
|
25413
|
+
});
|
|
25414
|
+
}
|
|
25415
|
+
listSubgroups(slug, params) {
|
|
25416
|
+
return this.get({
|
|
25417
|
+
url: `/${slug}/-/sub-groups`,
|
|
25418
|
+
params
|
|
25419
|
+
});
|
|
25420
|
+
}
|
|
25421
|
+
}
|
|
25422
|
+
|
|
25328
25423
|
// src/index.ts
|
|
25329
25424
|
class CNB extends CNBCore {
|
|
25330
25425
|
workspace;
|
|
@@ -25337,6 +25432,8 @@ class CNB extends CNBCore {
|
|
|
25337
25432
|
ai;
|
|
25338
25433
|
labels;
|
|
25339
25434
|
packages;
|
|
25435
|
+
org;
|
|
25436
|
+
dashboard;
|
|
25340
25437
|
constructor(options) {
|
|
25341
25438
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
25342
25439
|
this.init(options);
|
|
@@ -25363,6 +25460,8 @@ class CNB extends CNBCore {
|
|
|
25363
25460
|
registry: new RegistryPackage(options),
|
|
25364
25461
|
package: new PackageManagement(options)
|
|
25365
25462
|
};
|
|
25463
|
+
this.org = new Organization(options);
|
|
25464
|
+
this.dashboard = new Dashboard(options);
|
|
25366
25465
|
}
|
|
25367
25466
|
setToken(token) {
|
|
25368
25467
|
this.token = token;
|
|
@@ -25376,6 +25475,8 @@ class CNB extends CNBCore {
|
|
|
25376
25475
|
this.labels.issueLabel.token = token;
|
|
25377
25476
|
this.packages.registry.token = token;
|
|
25378
25477
|
this.packages.package.token = token;
|
|
25478
|
+
this.org.token = token;
|
|
25479
|
+
this.dashboard.token = token;
|
|
25379
25480
|
}
|
|
25380
25481
|
setCookie(cookie) {
|
|
25381
25482
|
this.cookie = cookie;
|
|
@@ -25389,6 +25490,8 @@ class CNB extends CNBCore {
|
|
|
25389
25490
|
this.labels.issueLabel.cookie = cookie;
|
|
25390
25491
|
this.packages.registry.cookie = cookie;
|
|
25391
25492
|
this.packages.package.cookie = cookie;
|
|
25493
|
+
this.org.cookie = cookie;
|
|
25494
|
+
this.dashboard.cookie = cookie;
|
|
25392
25495
|
}
|
|
25393
25496
|
getCNBVersion = getCNBVersion;
|
|
25394
25497
|
}
|
package/dist/npc.js
CHANGED
|
@@ -24980,6 +24980,24 @@ var useIssueEnv = () => {
|
|
|
24980
24980
|
};
|
|
24981
24981
|
};
|
|
24982
24982
|
|
|
24983
|
+
// src/issue/dashboard.ts
|
|
24984
|
+
class Dashboard extends CNBCore {
|
|
24985
|
+
constructor(options) {
|
|
24986
|
+
super(options);
|
|
24987
|
+
}
|
|
24988
|
+
getMineCreateIssue(params) {
|
|
24989
|
+
const url3 = `${this.hackURL}/user/dashboard/mine_create/issue`;
|
|
24990
|
+
return this.get({
|
|
24991
|
+
url: url3,
|
|
24992
|
+
params,
|
|
24993
|
+
useCookie: true,
|
|
24994
|
+
headers: {
|
|
24995
|
+
Accept: "application/vnd.cnb.web+json"
|
|
24996
|
+
}
|
|
24997
|
+
});
|
|
24998
|
+
}
|
|
24999
|
+
}
|
|
25000
|
+
|
|
24983
25001
|
// src/issue/index.ts
|
|
24984
25002
|
class Issue extends CNBCore {
|
|
24985
25003
|
constructor(options) {
|
|
@@ -25359,6 +25377,83 @@ class PackageManagement extends CNBCore {
|
|
|
25359
25377
|
});
|
|
25360
25378
|
}
|
|
25361
25379
|
}
|
|
25380
|
+
// src/org/index.ts
|
|
25381
|
+
class Organization extends CNBCore {
|
|
25382
|
+
constructor(options) {
|
|
25383
|
+
super(options);
|
|
25384
|
+
}
|
|
25385
|
+
create(params) {
|
|
25386
|
+
return this.post({
|
|
25387
|
+
url: "/groups",
|
|
25388
|
+
data: params
|
|
25389
|
+
});
|
|
25390
|
+
}
|
|
25391
|
+
listTopGroups(params) {
|
|
25392
|
+
return this.get({
|
|
25393
|
+
url: "/user/groups",
|
|
25394
|
+
params
|
|
25395
|
+
});
|
|
25396
|
+
}
|
|
25397
|
+
listGroups(slug, params) {
|
|
25398
|
+
return this.get({
|
|
25399
|
+
url: `/user/groups/${slug}`,
|
|
25400
|
+
params
|
|
25401
|
+
});
|
|
25402
|
+
}
|
|
25403
|
+
getGroupsByUsername(username, params) {
|
|
25404
|
+
return this.get({
|
|
25405
|
+
url: `/users/${username}/groups`,
|
|
25406
|
+
params
|
|
25407
|
+
});
|
|
25408
|
+
}
|
|
25409
|
+
getGroup(group) {
|
|
25410
|
+
return this.get({
|
|
25411
|
+
url: `/${group}`
|
|
25412
|
+
});
|
|
25413
|
+
}
|
|
25414
|
+
updateGroup(group, params) {
|
|
25415
|
+
return this.put({
|
|
25416
|
+
url: `/${group}`,
|
|
25417
|
+
data: params
|
|
25418
|
+
});
|
|
25419
|
+
}
|
|
25420
|
+
deleteGroup(group, identityTicket) {
|
|
25421
|
+
return this.delete({
|
|
25422
|
+
url: `/${group}`,
|
|
25423
|
+
headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
|
|
25424
|
+
});
|
|
25425
|
+
}
|
|
25426
|
+
transfer(group, params) {
|
|
25427
|
+
return this.post({
|
|
25428
|
+
url: `/${group}/-/transfer`,
|
|
25429
|
+
data: params
|
|
25430
|
+
});
|
|
25431
|
+
}
|
|
25432
|
+
uploadLogo(group, params) {
|
|
25433
|
+
return this.post({
|
|
25434
|
+
url: `/${group}/-/upload/logos`,
|
|
25435
|
+
data: params
|
|
25436
|
+
});
|
|
25437
|
+
}
|
|
25438
|
+
getSetting(slug) {
|
|
25439
|
+
return this.get({
|
|
25440
|
+
url: `/${slug}/-/settings`
|
|
25441
|
+
});
|
|
25442
|
+
}
|
|
25443
|
+
updateSetting(slug, params) {
|
|
25444
|
+
return this.put({
|
|
25445
|
+
url: `/${slug}/-/settings`,
|
|
25446
|
+
data: params
|
|
25447
|
+
});
|
|
25448
|
+
}
|
|
25449
|
+
listSubgroups(slug, params) {
|
|
25450
|
+
return this.get({
|
|
25451
|
+
url: `/${slug}/-/sub-groups`,
|
|
25452
|
+
params
|
|
25453
|
+
});
|
|
25454
|
+
}
|
|
25455
|
+
}
|
|
25456
|
+
|
|
25362
25457
|
// src/index.ts
|
|
25363
25458
|
class CNB extends CNBCore {
|
|
25364
25459
|
workspace;
|
|
@@ -25371,6 +25466,8 @@ class CNB extends CNBCore {
|
|
|
25371
25466
|
ai;
|
|
25372
25467
|
labels;
|
|
25373
25468
|
packages;
|
|
25469
|
+
org;
|
|
25470
|
+
dashboard;
|
|
25374
25471
|
constructor(options) {
|
|
25375
25472
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
25376
25473
|
this.init(options);
|
|
@@ -25397,6 +25494,8 @@ class CNB extends CNBCore {
|
|
|
25397
25494
|
registry: new RegistryPackage(options),
|
|
25398
25495
|
package: new PackageManagement(options)
|
|
25399
25496
|
};
|
|
25497
|
+
this.org = new Organization(options);
|
|
25498
|
+
this.dashboard = new Dashboard(options);
|
|
25400
25499
|
}
|
|
25401
25500
|
setToken(token) {
|
|
25402
25501
|
this.token = token;
|
|
@@ -25410,6 +25509,8 @@ class CNB extends CNBCore {
|
|
|
25410
25509
|
this.labels.issueLabel.token = token;
|
|
25411
25510
|
this.packages.registry.token = token;
|
|
25412
25511
|
this.packages.package.token = token;
|
|
25512
|
+
this.org.token = token;
|
|
25513
|
+
this.dashboard.token = token;
|
|
25413
25514
|
}
|
|
25414
25515
|
setCookie(cookie) {
|
|
25415
25516
|
this.cookie = cookie;
|
|
@@ -25423,6 +25524,8 @@ class CNB extends CNBCore {
|
|
|
25423
25524
|
this.labels.issueLabel.cookie = cookie;
|
|
25424
25525
|
this.packages.registry.cookie = cookie;
|
|
25425
25526
|
this.packages.package.cookie = cookie;
|
|
25527
|
+
this.org.cookie = cookie;
|
|
25528
|
+
this.dashboard.cookie = cookie;
|
|
25426
25529
|
}
|
|
25427
25530
|
getCNBVersion = getCNBVersion;
|
|
25428
25531
|
}
|