@kevisual/cnb 0.0.61 → 0.0.63
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/build/docker.ts +0 -1
- package/agent/routes/index.ts +2 -2
- package/agent/routes/package/package.ts +15 -5
- package/agent/routes/package/registry.ts +14 -3
- package/agent/routes/repo/list.ts +16 -7
- package/agent/routes/workspace/rerun.ts +12 -3
- package/package.json +8 -8
- package/src/repo/index.ts +1 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -56990
- package/dist/keep.d.ts +0 -47
- package/dist/keep.js +0 -3084
- package/dist/npc.d.ts +0 -2
- package/dist/npc.js +0 -57191
- package/dist/opencode.d.ts +0 -5
- package/dist/opencode.js +0 -69364
- package/dist/routes.d.ts +0 -1812
- package/dist/routes.js +0 -54171
package/dist/routes.d.ts
DELETED
|
@@ -1,1812 +0,0 @@
|
|
|
1
|
-
import { QueryRouterServer } from '@kevisual/router';
|
|
2
|
-
import { Result as Result$1 } from '@kevisual/query/query';
|
|
3
|
-
import { Result as Result$2 } from '@kevisual/query';
|
|
4
|
-
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
5
|
-
|
|
6
|
-
type CNBCoreOptions<T = {}> = {
|
|
7
|
-
token: string;
|
|
8
|
-
/**
|
|
9
|
-
* 对 cnb 界面操作定制模块功能时需要传入 cookie
|
|
10
|
-
*/
|
|
11
|
-
cookie?: string;
|
|
12
|
-
cnb?: CNBCore;
|
|
13
|
-
cors?: {
|
|
14
|
-
baseUrl?: string;
|
|
15
|
-
};
|
|
16
|
-
} & T;
|
|
17
|
-
type RequestOptions = {
|
|
18
|
-
url?: string;
|
|
19
|
-
method?: string;
|
|
20
|
-
data?: Record<string, any>;
|
|
21
|
-
body?: any;
|
|
22
|
-
params?: Record<string, any>;
|
|
23
|
-
headers?: Record<string, any>;
|
|
24
|
-
useCookie?: boolean;
|
|
25
|
-
useOrigin?: boolean;
|
|
26
|
-
};
|
|
27
|
-
declare class CNBCore {
|
|
28
|
-
baseURL: string;
|
|
29
|
-
hackURL: string;
|
|
30
|
-
token: string;
|
|
31
|
-
cookie?: string;
|
|
32
|
-
isCors: boolean;
|
|
33
|
-
constructor(options: CNBCoreOptions);
|
|
34
|
-
request({ url, method, data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any>;
|
|
35
|
-
makeUrl(url?: string): string;
|
|
36
|
-
get<T = any>({ url, ...REST }: RequestOptions): Promise<T>;
|
|
37
|
-
post<T = any>({ url, ...REST }: RequestOptions): Promise<T>;
|
|
38
|
-
put<T = any>({ url, ...REST }: RequestOptions): Promise<T>;
|
|
39
|
-
delete<T = any>({ url, ...REST }: RequestOptions): Promise<T>;
|
|
40
|
-
patch<T = any>({ url, ...REST }: RequestOptions): Promise<T>;
|
|
41
|
-
/**
|
|
42
|
-
* 通过 PUT 请求上传文件内容
|
|
43
|
-
* @param data 包含 URL、token 和文件内容
|
|
44
|
-
* @returns 上传结果
|
|
45
|
-
*/
|
|
46
|
-
putFile(data: {
|
|
47
|
-
url: string;
|
|
48
|
-
token: string;
|
|
49
|
-
content: string | Buffer;
|
|
50
|
-
}): Promise<any>;
|
|
51
|
-
}
|
|
52
|
-
type Result<T = any> = {
|
|
53
|
-
code: number;
|
|
54
|
-
message: string;
|
|
55
|
-
data: T;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @title 工作空间管理模块
|
|
60
|
-
* @description 提供云原生构建工作空间的管理功能,包括列表查询、创建、更新和删除工作空间,支持多种过滤条件和分页选项
|
|
61
|
-
* @tags workspace, cloud-native, development-environment, cnb, api
|
|
62
|
-
* @createdAt 2025-12-04
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 工作空间列表查询参数
|
|
67
|
-
*/
|
|
68
|
-
interface ListParams {
|
|
69
|
-
/** Git 分支名称,例如 "main" */
|
|
70
|
-
branch?: string;
|
|
71
|
-
/** 查询结束时间,格式 YYYY-MM-DD HH:mm:ssZZ,例如 2024-12-01 00:00:00+0800 */
|
|
72
|
-
end?: string;
|
|
73
|
-
/** 分页页码,默认为 1 */
|
|
74
|
-
page?: number;
|
|
75
|
-
/** 分页大小,默认 20,最大 100 */
|
|
76
|
-
pageSize?: number;
|
|
77
|
-
/** 仓库路径,例如 "groupname/reponame" */
|
|
78
|
-
slug?: string;
|
|
79
|
-
/** 查询开始时间,格式 YYYY-MM-DD HH:mm:ssZZ,例如 2024-12-01 00:00:00+0800 */
|
|
80
|
-
start?: string;
|
|
81
|
-
/** 开发环境状态,running: 开发环境已启动,closed: 开发环境已关闭 */
|
|
82
|
-
status?: 'running' | 'closed';
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 云原生开发环境管理模块
|
|
86
|
-
* https://api.cnb.cool/#/operations/GetWorkspaceDetail
|
|
87
|
-
*/
|
|
88
|
-
declare class Workspace extends CNBCore {
|
|
89
|
-
constructor(options: CNBCoreOptions);
|
|
90
|
-
/**
|
|
91
|
-
* 删除我的云原生开发环境
|
|
92
|
-
* @param params 删除参数,pipelineId 和 sn 二选一,优先使用 pipelineId
|
|
93
|
-
*/
|
|
94
|
-
deleteWorkspace(params: {
|
|
95
|
-
pipelineId?: string;
|
|
96
|
-
sn?: string;
|
|
97
|
-
}): Promise<{
|
|
98
|
-
code: number;
|
|
99
|
-
message: string;
|
|
100
|
-
}>;
|
|
101
|
-
/** 获取我的云原生开发环境列表 */
|
|
102
|
-
list(params?: ListParams): Promise<Result$1<WorkspaceResult>>;
|
|
103
|
-
/**
|
|
104
|
-
* 停止我的云原生开发环境
|
|
105
|
-
* @param params 停止参数,pipelineId 和 sn 二选一,优先使用 pipelineId
|
|
106
|
-
*/
|
|
107
|
-
stopWorkspace(params: {
|
|
108
|
-
pipelineId?: string;
|
|
109
|
-
sn?: string;
|
|
110
|
-
}): Promise<Result$1<{
|
|
111
|
-
buildLogUrl: string;
|
|
112
|
-
message: string;
|
|
113
|
-
sn: string;
|
|
114
|
-
}>>;
|
|
115
|
-
/**
|
|
116
|
-
* 根据流水线 SN 查询云原生开发访问地址
|
|
117
|
-
* @param repo 仓库路径,例如:groupname/reponame
|
|
118
|
-
* @param sn 流水线构建号
|
|
119
|
-
*/
|
|
120
|
-
getDetail(repo: string, sn: string): Promise<Result$1<WorkspaceLinkDetail>>;
|
|
121
|
-
/**
|
|
122
|
-
* 启动云原生开发环境,已存在环境则直接打开,否则重新创建开发环境
|
|
123
|
-
* @param repo 仓库路径,例如:groupname/reponame
|
|
124
|
-
* @param params 启动参数
|
|
125
|
-
* @returns 返回启动结果,包含以下字段:
|
|
126
|
-
*/
|
|
127
|
-
startWorkspace(repo: string, params: {
|
|
128
|
-
branch?: string;
|
|
129
|
-
ref?: string;
|
|
130
|
-
}): Promise<Result$1<{
|
|
131
|
-
/** 仅新创建开发环境时返回,表示创建开发环境的流水线日志地址 */
|
|
132
|
-
buildLogUrl?: string;
|
|
133
|
-
/** 仅新创建开发环境时返回,表示创建开发环境的提示信息 */
|
|
134
|
-
message?: string;
|
|
135
|
-
/** 仅新创建开发环境时返回,表示创建开发环境的流水线 sn */
|
|
136
|
-
sn?: string;
|
|
137
|
-
/** 如果存在开发环境,则返回 WebIDE 访问 url;如果不存在开发环境,则返回启动云原生开发的 loading 页面 url 地址 */
|
|
138
|
-
url: string;
|
|
139
|
-
}>>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加使用cookie获取工作空间访问权限的功能,适用于需要保持工作空间连接状态的场景,
|
|
142
|
-
* 例如使用 WebSocket 连接工作空间时需要携带 cookie 进行身份验证。
|
|
143
|
-
* https://cnb.cool/kevisual/dev-env/-/workspace/vscode-web/cnb-708-1ji9sog7o-001
|
|
144
|
-
* @param repo
|
|
145
|
-
* @param pipelineId
|
|
146
|
-
* @returns
|
|
147
|
-
*/
|
|
148
|
-
getWorkspaceCookie(repo: string, pipelineId: string): Promise<Result$1<{
|
|
149
|
-
value: string;
|
|
150
|
-
cookie: string;
|
|
151
|
-
cookieName: string;
|
|
152
|
-
}>>;
|
|
153
|
-
}
|
|
154
|
-
interface WorkspaceLinkDetail {
|
|
155
|
-
codebuddy: string;
|
|
156
|
-
codebuddycn: string;
|
|
157
|
-
cursor: string;
|
|
158
|
-
jetbrains: Record<string, string>;
|
|
159
|
-
jumpUrl: string;
|
|
160
|
-
remoteSsh: string;
|
|
161
|
-
ssh: string;
|
|
162
|
-
vscode: string;
|
|
163
|
-
'vscode-insiders': string;
|
|
164
|
-
webide: string;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* 工作空间信息接口
|
|
168
|
-
*/
|
|
169
|
-
interface WorkspaceInfo {
|
|
170
|
-
/** 分支名,例如:main */
|
|
171
|
-
branch: string;
|
|
172
|
-
/** 业务 ID */
|
|
173
|
-
business_id: string;
|
|
174
|
-
/** 备份的 commit 数 */
|
|
175
|
-
commit_count: number | null;
|
|
176
|
-
/** 开发环境创建时间,例如:2024-12-02T03:20:22.000Z */
|
|
177
|
-
create_time: string;
|
|
178
|
-
/** 开发环境持续时间,单位:ms(非实时更新) */
|
|
179
|
-
duration: number;
|
|
180
|
-
/** 备份的文件数 */
|
|
181
|
-
file_count: number;
|
|
182
|
-
/** 备份的文件列表,仅前五个备份文件相对路径 */
|
|
183
|
-
file_list: string;
|
|
184
|
-
/** 是否为预览环境,0: 否,1: 是 */
|
|
185
|
-
is_preview: number;
|
|
186
|
-
/** JetBrains IDE 列表 */
|
|
187
|
-
jetbrainsList: any[];
|
|
188
|
-
/** 环境销毁时远程最新的 commit short hash */
|
|
189
|
-
latest_sha: string | null;
|
|
190
|
-
/** 创建环境的子流水线 id */
|
|
191
|
-
pipeline_id: string;
|
|
192
|
-
/** 备份的 stash 数 */
|
|
193
|
-
remote_stash_count: number | null;
|
|
194
|
-
/** 仓库 ID */
|
|
195
|
-
repo_id: string;
|
|
196
|
-
/** 仓库地址 */
|
|
197
|
-
repo_url: string;
|
|
198
|
-
/** 恢复备份代码的流水线 id,如果有值表示备份代码已被恢复(重建环境时会恢复备份代码) */
|
|
199
|
-
restore_id: string | null;
|
|
200
|
-
/** 单个 stash 标识,1: 是,0: 否 */
|
|
201
|
-
single_stash: number;
|
|
202
|
-
/** 仓库路径,例如:groupname/reponame */
|
|
203
|
-
slug: string;
|
|
204
|
-
/** 创建开发环境的流水线 sn */
|
|
205
|
-
sn: string;
|
|
206
|
-
/** 开发环境是否支持 ssh 链接 */
|
|
207
|
-
ssh: boolean;
|
|
208
|
-
/** 本地 stash 数 */
|
|
209
|
-
stash_count: number;
|
|
210
|
-
/** 工作区状态,running: 开发环境已启动,closed:开发环境已关闭 */
|
|
211
|
-
status: string;
|
|
212
|
-
/** 用户名 */
|
|
213
|
-
user_name: string;
|
|
214
|
-
/** 开发环境默认工作区路径 */
|
|
215
|
-
workspace: string;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* 工作空间列表响应结果
|
|
219
|
-
*/
|
|
220
|
-
type WorkspaceResult = {
|
|
221
|
-
/** 是否有更多数据 */
|
|
222
|
-
hasMore: boolean;
|
|
223
|
-
/** 工作空间列表 */
|
|
224
|
-
list: WorkspaceInfo[];
|
|
225
|
-
/** 分页信息 */
|
|
226
|
-
pageInfo: {
|
|
227
|
-
/** 当前页码 */
|
|
228
|
-
page: number;
|
|
229
|
-
/** 每页大小 */
|
|
230
|
-
pageSize: number;
|
|
231
|
-
};
|
|
232
|
-
/** 总数量 */
|
|
233
|
-
total: number;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
declare class KnowledgeBase extends CNBCore {
|
|
237
|
-
constructor(options: CNBCoreOptions);
|
|
238
|
-
queryKnowledgeBase(repo: string, data: {
|
|
239
|
-
query: string;
|
|
240
|
-
score_threshold?: number;
|
|
241
|
-
top_k?: number;
|
|
242
|
-
metadata_filtering_conditions?: MetadataFilteringConditions;
|
|
243
|
-
}): Promise<Result<QueryRag[]>>;
|
|
244
|
-
getEmbeddingModels(repo: string): Promise<Result<Array<{
|
|
245
|
-
name: string;
|
|
246
|
-
dimensions: number;
|
|
247
|
-
}>>>;
|
|
248
|
-
getBase(repo: string): Promise<Result<any>>;
|
|
249
|
-
deleteBase(repo: string): Promise<Result<any>>;
|
|
250
|
-
/**
|
|
251
|
-
* 未暴露
|
|
252
|
-
* @param repo
|
|
253
|
-
* @param data
|
|
254
|
-
* @returns
|
|
255
|
-
*/
|
|
256
|
-
createKnowledgeBase(repo: string, data: {
|
|
257
|
-
embedding_model_name: string;
|
|
258
|
-
include: string;
|
|
259
|
-
exclude: string;
|
|
260
|
-
issue_sync_enabled?: boolean;
|
|
261
|
-
processing?: {
|
|
262
|
-
chunk_size: number;
|
|
263
|
-
chunk_overlap: number;
|
|
264
|
-
text_separator: string;
|
|
265
|
-
};
|
|
266
|
-
issue?: {
|
|
267
|
-
labels: string;
|
|
268
|
-
state: string;
|
|
269
|
-
};
|
|
270
|
-
}): Promise<Result<any>>;
|
|
271
|
-
/**
|
|
272
|
-
* 未暴露
|
|
273
|
-
* @param repo
|
|
274
|
-
* @param data
|
|
275
|
-
* @returns
|
|
276
|
-
*/
|
|
277
|
-
updateKnowledgeBase(repo: string, data: {
|
|
278
|
-
last_commit_sha?: string;
|
|
279
|
-
issue_last_sync_time?: string;
|
|
280
|
-
}): Promise<Result<any>>;
|
|
281
|
-
/**
|
|
282
|
-
* 未暴露
|
|
283
|
-
* @param repo
|
|
284
|
-
* @param text
|
|
285
|
-
* @returns
|
|
286
|
-
*/
|
|
287
|
-
getEmbedding(repo: string, text: string): Promise<Result<{
|
|
288
|
-
embedding: number[];
|
|
289
|
-
}>>;
|
|
290
|
-
/**
|
|
291
|
-
* 未暴露
|
|
292
|
-
* @param repo
|
|
293
|
-
* @param chunksData
|
|
294
|
-
* @returns
|
|
295
|
-
*/
|
|
296
|
-
addDocument(repo: string, chunksData: {
|
|
297
|
-
path: string;
|
|
298
|
-
chunks: Array<{
|
|
299
|
-
content: string;
|
|
300
|
-
hash: string;
|
|
301
|
-
offset: number;
|
|
302
|
-
size: number;
|
|
303
|
-
}>;
|
|
304
|
-
}): Promise<Result<any>>;
|
|
305
|
-
/**
|
|
306
|
-
* 未暴露
|
|
307
|
-
* @param repo
|
|
308
|
-
* @param paths
|
|
309
|
-
* @returns
|
|
310
|
-
*/
|
|
311
|
-
deleteDocument(repo: string, paths: string[]): Promise<Result<any>>;
|
|
312
|
-
/**
|
|
313
|
-
* 未暴露
|
|
314
|
-
* @param repo
|
|
315
|
-
* @param page
|
|
316
|
-
* @param page_size
|
|
317
|
-
* @returns
|
|
318
|
-
*/
|
|
319
|
-
listDocument(repo: string, page?: number, page_size?: number): Promise<Result<any[]>>;
|
|
320
|
-
}
|
|
321
|
-
type MetadataFilteringConditions = {
|
|
322
|
-
conditions: Array<{
|
|
323
|
-
comparison_operator?: 'is' | 'is not' | 'contains' | 'not contains' | 'start with' | 'end with' | 'is empty' | 'is not empty';
|
|
324
|
-
name?: "position" | "path" | "type";
|
|
325
|
-
/**
|
|
326
|
-
* "is empty" and "is not empty" 时候忽略该字段
|
|
327
|
-
*/
|
|
328
|
-
value?: string;
|
|
329
|
-
}>;
|
|
330
|
-
logical_operator?: 'and' | 'or';
|
|
331
|
-
};
|
|
332
|
-
type QueryRag = {
|
|
333
|
-
chunk: string;
|
|
334
|
-
score: number;
|
|
335
|
-
metadata: {
|
|
336
|
-
hash: string;
|
|
337
|
-
name: string;
|
|
338
|
-
path: string;
|
|
339
|
-
position: string;
|
|
340
|
-
type: string;
|
|
341
|
-
url: string;
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
declare class Repo extends CNBCore {
|
|
346
|
-
constructor(options: CNBCoreOptions);
|
|
347
|
-
/**
|
|
348
|
-
* 创建代码仓库
|
|
349
|
-
* @param data
|
|
350
|
-
* @returns
|
|
351
|
-
*/
|
|
352
|
-
createRepo(data: CreateRepoData): Promise<any>;
|
|
353
|
-
deleteRepoCookie(repo: string): Promise<any>;
|
|
354
|
-
deleteRepo(repo: string): Promise<any>;
|
|
355
|
-
/**
|
|
356
|
-
* 使用cookie创建提交,如果没有指定parent_commit_sha,则会自动获取最新的提交作为父提交
|
|
357
|
-
* @param repo
|
|
358
|
-
* @param data
|
|
359
|
-
* @returns
|
|
360
|
-
*/
|
|
361
|
-
createCommit(repo: string, data: CreateCommitData): Promise<any>;
|
|
362
|
-
createBlobs(repo: string, data: {
|
|
363
|
-
content: string;
|
|
364
|
-
encoding?: 'utf-8' | 'base64';
|
|
365
|
-
}): Promise<any>;
|
|
366
|
-
uploadFiles(repo: string, data: {
|
|
367
|
-
ext?: any;
|
|
368
|
-
name?: string;
|
|
369
|
-
path?: string;
|
|
370
|
-
size?: number;
|
|
371
|
-
}): Promise<any>;
|
|
372
|
-
getCommitList(repo: string, params: {
|
|
373
|
-
author?: string;
|
|
374
|
-
commiter?: string;
|
|
375
|
-
page?: number;
|
|
376
|
-
page_size?: number;
|
|
377
|
-
sha?: string;
|
|
378
|
-
since?: string;
|
|
379
|
-
until?: string;
|
|
380
|
-
}, opts?: RequestOptions): Promise<any>;
|
|
381
|
-
getRepoList(params: {
|
|
382
|
-
desc?: boolean;
|
|
383
|
-
filter_type?: 'private' | 'public' | 'secret';
|
|
384
|
-
flags?: 'KnowledgeBase';
|
|
385
|
-
order_by?: 'created_at' | 'last_updated_at' | 'stars' | 'slug_path' | 'forks';
|
|
386
|
-
page?: number;
|
|
387
|
-
page_size?: number;
|
|
388
|
-
role?: 'owner' | 'maintainer' | 'developer' | 'reporter' | 'guest';
|
|
389
|
-
search?: string;
|
|
390
|
-
status?: 'active' | 'archived';
|
|
391
|
-
}): Promise<Result<RepoItem[]>>;
|
|
392
|
-
updateRepoInfo(repo: string, params: UpdateRepoInfo): Promise<any>;
|
|
393
|
-
getRepo(repo: string): Promise<Result<RepoItem>>;
|
|
394
|
-
}
|
|
395
|
-
type UpdateRepoInfo = {
|
|
396
|
-
description?: string;
|
|
397
|
-
license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Unlicense';
|
|
398
|
-
site?: string;
|
|
399
|
-
topics?: string[];
|
|
400
|
-
};
|
|
401
|
-
type CreateRepoData = {
|
|
402
|
-
description: string;
|
|
403
|
-
license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Unlicense';
|
|
404
|
-
name: string;
|
|
405
|
-
visibility: 'private' | 'public' | 'secret';
|
|
406
|
-
};
|
|
407
|
-
type CreateCommitData = {
|
|
408
|
-
base_branch?: string;
|
|
409
|
-
new_branch?: string;
|
|
410
|
-
message?: string;
|
|
411
|
-
parent_commit_sha?: string;
|
|
412
|
-
files?: Array<{
|
|
413
|
-
content: string;
|
|
414
|
-
path: string;
|
|
415
|
-
encoding?: 'raw' | 'utf-8' | 'base64';
|
|
416
|
-
is_delete?: boolean;
|
|
417
|
-
is_executable?: boolean;
|
|
418
|
-
}>;
|
|
419
|
-
};
|
|
420
|
-
type RepoItem = {
|
|
421
|
-
id: string;
|
|
422
|
-
name: string;
|
|
423
|
-
freeze: boolean;
|
|
424
|
-
status: number;
|
|
425
|
-
visibility_level: 'Public' | 'Private' | 'Secret';
|
|
426
|
-
flags: string;
|
|
427
|
-
created_at: string;
|
|
428
|
-
updated_at: string;
|
|
429
|
-
description: string;
|
|
430
|
-
site: string;
|
|
431
|
-
topics: string;
|
|
432
|
-
license: string;
|
|
433
|
-
display_module: {
|
|
434
|
-
activity: boolean;
|
|
435
|
-
contributors: boolean;
|
|
436
|
-
release: boolean;
|
|
437
|
-
};
|
|
438
|
-
star_count: number;
|
|
439
|
-
fork_count: number;
|
|
440
|
-
mark_count: number;
|
|
441
|
-
last_updated_at: string | null;
|
|
442
|
-
web_url: string;
|
|
443
|
-
path: string;
|
|
444
|
-
tags: string[] | null;
|
|
445
|
-
open_issue_count: number;
|
|
446
|
-
open_pull_request_count: number;
|
|
447
|
-
languages: {
|
|
448
|
-
language: string;
|
|
449
|
-
color: string;
|
|
450
|
-
};
|
|
451
|
-
second_languages: {
|
|
452
|
-
language: string;
|
|
453
|
-
color: string;
|
|
454
|
-
};
|
|
455
|
-
last_update_username: string;
|
|
456
|
-
last_update_nickname: string;
|
|
457
|
-
access: string;
|
|
458
|
-
stared: boolean;
|
|
459
|
-
star_time: string;
|
|
460
|
-
pinned: boolean;
|
|
461
|
-
pinned_time: string;
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
declare class User extends CNBCore {
|
|
465
|
-
constructor(options: CNBCoreOptions<{}>);
|
|
466
|
-
/**
|
|
467
|
-
* 获取当前用户信息,使用 Cookie 认证
|
|
468
|
-
* @returns
|
|
469
|
-
*/
|
|
470
|
-
getCurrentUser(): Promise<Result$2<UserInfo>>;
|
|
471
|
-
/**
|
|
472
|
-
* 判断当前 Cookie 是否有效
|
|
473
|
-
* @returns
|
|
474
|
-
*/
|
|
475
|
-
checkCookieValid(): Promise<Result$2>;
|
|
476
|
-
/**
|
|
477
|
-
* 使用 Token 获取用户信息
|
|
478
|
-
* @returns
|
|
479
|
-
*/
|
|
480
|
-
getUser(): Promise<Result$2<UserInfo>>;
|
|
481
|
-
createAccessToken(data?: {
|
|
482
|
-
description?: string;
|
|
483
|
-
scope?: string;
|
|
484
|
-
}): Promise<AccessTokenResponse>;
|
|
485
|
-
getAccessTokens(params?: {
|
|
486
|
-
page?: number;
|
|
487
|
-
page_size?: number;
|
|
488
|
-
}): Promise<AccessTokenResponse[]>;
|
|
489
|
-
deleteAccessToken(tokenId: string): Promise<any>;
|
|
490
|
-
}
|
|
491
|
-
type AccessTokenResponse = {
|
|
492
|
-
token: string;
|
|
493
|
-
description: string;
|
|
494
|
-
};
|
|
495
|
-
type UserInfo = {
|
|
496
|
-
id: string;
|
|
497
|
-
username: string;
|
|
498
|
-
nickname: string;
|
|
499
|
-
type: number;
|
|
500
|
-
verified: number;
|
|
501
|
-
verified_expire_in: string;
|
|
502
|
-
created_at: string;
|
|
503
|
-
freeze: boolean;
|
|
504
|
-
locked: boolean;
|
|
505
|
-
avatar: string;
|
|
506
|
-
email: string;
|
|
507
|
-
next_updated_name_at: string;
|
|
508
|
-
updated_name_at: string;
|
|
509
|
-
updated_nick_at: string;
|
|
510
|
-
editable: {
|
|
511
|
-
avatar: boolean;
|
|
512
|
-
email: boolean;
|
|
513
|
-
logoff: boolean;
|
|
514
|
-
nickname: boolean;
|
|
515
|
-
'sync-data': boolean;
|
|
516
|
-
username: boolean;
|
|
517
|
-
};
|
|
518
|
-
language: string;
|
|
519
|
-
appearance: string;
|
|
520
|
-
gender: number;
|
|
521
|
-
bio: string;
|
|
522
|
-
company: string;
|
|
523
|
-
location: string;
|
|
524
|
-
site: string;
|
|
525
|
-
address: string;
|
|
526
|
-
wechat_mp: string;
|
|
527
|
-
wechat_mp_qrcode: string;
|
|
528
|
-
appreciate_status: number;
|
|
529
|
-
follow_count: number;
|
|
530
|
-
follower_count: number;
|
|
531
|
-
reward_count: number;
|
|
532
|
-
reward_amount: number;
|
|
533
|
-
stars_count: number;
|
|
534
|
-
group_count: number;
|
|
535
|
-
repo_count: number;
|
|
536
|
-
mission_count: number;
|
|
537
|
-
registry_count: number;
|
|
538
|
-
public_repo_count: number;
|
|
539
|
-
public_mission_count: number;
|
|
540
|
-
public_registry_count: number;
|
|
541
|
-
follow_repo_count: number;
|
|
542
|
-
follow_mission_count: number;
|
|
543
|
-
readme_repo_path: string;
|
|
544
|
-
last_login_at: string;
|
|
545
|
-
last_login_ip: string;
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
declare class Build extends CNBCore {
|
|
549
|
-
constructor(options: CNBCoreOptions);
|
|
550
|
-
startBuild(repo: string, data: StartBuildData): Promise<any>;
|
|
551
|
-
}
|
|
552
|
-
type StartBuildData = {
|
|
553
|
-
/**
|
|
554
|
-
* 触发分支,默认为主分支
|
|
555
|
-
*/
|
|
556
|
-
branch?: string;
|
|
557
|
-
/**
|
|
558
|
-
* 指定配置文件内容,yaml 格式
|
|
559
|
-
*/
|
|
560
|
-
config?: string;
|
|
561
|
-
/**
|
|
562
|
-
* 环境变量,对象格式
|
|
563
|
-
*/
|
|
564
|
-
env?: Record<string, string>;
|
|
565
|
-
/**
|
|
566
|
-
* 事件名,必须是 api_trigger 或以 api_trigger_ 开头,默认为 api_trigger
|
|
567
|
-
*/
|
|
568
|
-
event?: string;
|
|
569
|
-
/**
|
|
570
|
-
* commit id ,优先级比 tag 高,默认为分支最新提交记录
|
|
571
|
-
*/
|
|
572
|
-
sha?: string;
|
|
573
|
-
/**
|
|
574
|
-
* 是否等待构建正式触发,为false时会立刻返回 sn 和 buildLogUrl
|
|
575
|
-
*/
|
|
576
|
-
sync?: string;
|
|
577
|
-
/**
|
|
578
|
-
* 触发 tag,优先级比 branch 高
|
|
579
|
-
*/
|
|
580
|
-
tag?: string;
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
type DashboardTodoStatus = 'pending' | 'processing' | 'completed';
|
|
584
|
-
type DashboardIssueItem = {
|
|
585
|
-
todo_id: string;
|
|
586
|
-
pinned: boolean;
|
|
587
|
-
number: number;
|
|
588
|
-
slug: string;
|
|
589
|
-
slug_freeze: boolean;
|
|
590
|
-
title: string;
|
|
591
|
-
state: string;
|
|
592
|
-
priority: string;
|
|
593
|
-
labels: {
|
|
594
|
-
name: string;
|
|
595
|
-
description: string;
|
|
596
|
-
color: string;
|
|
597
|
-
}[];
|
|
598
|
-
associated_pull_request_counts: number;
|
|
599
|
-
comment_count: number;
|
|
600
|
-
creator: {
|
|
601
|
-
username: string;
|
|
602
|
-
nickname: string;
|
|
603
|
-
freeze: boolean;
|
|
604
|
-
};
|
|
605
|
-
author_context: Record<string, any>;
|
|
606
|
-
created_time: string;
|
|
607
|
-
updated_time: string;
|
|
608
|
-
};
|
|
609
|
-
type DashboardMineCreateIssue = {
|
|
610
|
-
todo_type: string;
|
|
611
|
-
issue_datas: DashboardIssueItem[];
|
|
612
|
-
};
|
|
613
|
-
declare class Dashboard extends CNBCore {
|
|
614
|
-
constructor(options: CNBCoreOptions);
|
|
615
|
-
/**
|
|
616
|
-
* 获取我创建的 Issue 仪表盘
|
|
617
|
-
* @param params
|
|
618
|
-
* @param params.todoStatus - 待办状态: pending | processing | completed
|
|
619
|
-
* @param params.page - 页码,默认 1
|
|
620
|
-
* @param params.page_size - 每页数量,默认 20
|
|
621
|
-
*/
|
|
622
|
-
getMineCreateIssue(params?: {
|
|
623
|
-
todoStatus?: DashboardTodoStatus;
|
|
624
|
-
page?: number;
|
|
625
|
-
page_size?: number;
|
|
626
|
-
}): Promise<Result<DashboardMineCreateIssue>>;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
type IssueAssignee = {
|
|
630
|
-
nickname: string;
|
|
631
|
-
username: string;
|
|
632
|
-
};
|
|
633
|
-
type IssueLabelItem = {
|
|
634
|
-
color: string;
|
|
635
|
-
description: string;
|
|
636
|
-
id: string;
|
|
637
|
-
name: string;
|
|
638
|
-
creator?: {
|
|
639
|
-
username: string;
|
|
640
|
-
nickname: string;
|
|
641
|
-
email: string;
|
|
642
|
-
is_npc: boolean;
|
|
643
|
-
};
|
|
644
|
-
applied_by?: {
|
|
645
|
-
username: string;
|
|
646
|
-
nickname: string;
|
|
647
|
-
email: string;
|
|
648
|
-
is_npc: boolean;
|
|
649
|
-
};
|
|
650
|
-
};
|
|
651
|
-
type IssueAuthor = {
|
|
652
|
-
name: string;
|
|
653
|
-
body: string;
|
|
654
|
-
comment_count: number;
|
|
655
|
-
created_at: string;
|
|
656
|
-
ended_at: string;
|
|
657
|
-
};
|
|
658
|
-
type IssueCommentUser = {
|
|
659
|
-
username: string;
|
|
660
|
-
nickname: string;
|
|
661
|
-
avatar: string;
|
|
662
|
-
is_npc: boolean;
|
|
663
|
-
};
|
|
664
|
-
type IssueCommentReaction = {};
|
|
665
|
-
type IssueComment = {
|
|
666
|
-
id: string;
|
|
667
|
-
body: string;
|
|
668
|
-
author: IssueCommentUser;
|
|
669
|
-
reactions: IssueCommentReaction[];
|
|
670
|
-
created_at: string;
|
|
671
|
-
updated_at: string;
|
|
672
|
-
};
|
|
673
|
-
type IssueItem = {
|
|
674
|
-
assignees: IssueAssignee[];
|
|
675
|
-
author: IssueAuthor;
|
|
676
|
-
labels: IssueLabelItem[];
|
|
677
|
-
body: string;
|
|
678
|
-
last_acted_at: string;
|
|
679
|
-
number: string;
|
|
680
|
-
priority: string;
|
|
681
|
-
started_at: string;
|
|
682
|
-
state: 'open' | 'closed';
|
|
683
|
-
/**
|
|
684
|
-
* state_reason must be one of completed, not_planned, reopened
|
|
685
|
-
*/
|
|
686
|
-
state_reason: 'completed' | 'not_planned' | 'reopened';
|
|
687
|
-
title: string;
|
|
688
|
-
updated_at: string;
|
|
689
|
-
};
|
|
690
|
-
declare class Issue extends CNBCore {
|
|
691
|
-
constructor(options: CNBCoreOptions);
|
|
692
|
-
createIssue(repo: string, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
693
|
-
updateIssue(repo: string, issueNumber: string | number, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
694
|
-
getItem(repo: string, issueNumber: string | number): Promise<Result<IssueItem>>;
|
|
695
|
-
getList(repo: string, params?: Partial<GetListParams>): Promise<Result<IssueItem[]>>;
|
|
696
|
-
getCommentList(repo: string, issueNumber: string | number, params?: {
|
|
697
|
-
page?: number;
|
|
698
|
-
page_size?: number;
|
|
699
|
-
}): Promise<Result<IssueComment[]>>;
|
|
700
|
-
getComment(repo: string, issueNumber: string | number, commentId: string | number): Promise<Result<IssueComment>>;
|
|
701
|
-
createComment(repo: string, issueNumber: string | number, body: string): Promise<Result<IssueComment>>;
|
|
702
|
-
updateComment(repo: string, issueNumber: string | number, commentId: string | number, body: string): Promise<Result<IssueComment>>;
|
|
703
|
-
setIssueProperty(repo: string, issueNumber: string | number, properties: {
|
|
704
|
-
[key: string]: any;
|
|
705
|
-
}[]): Promise<any>;
|
|
706
|
-
/**
|
|
707
|
-
* 获取alive issue的元数据
|
|
708
|
-
* @param repo
|
|
709
|
-
* @param issueNumber
|
|
710
|
-
* @returns
|
|
711
|
-
*/
|
|
712
|
-
getAliveMetadata(repo: string, issueNumber: string | number): Promise<Result<AliveMetadata>>;
|
|
713
|
-
useNPCEnv(): {
|
|
714
|
-
npcSlug: any;
|
|
715
|
-
npcSlugLabel: string;
|
|
716
|
-
npcName: any;
|
|
717
|
-
npcNameLabel: string;
|
|
718
|
-
npcSha: any;
|
|
719
|
-
npcShaLabel: string;
|
|
720
|
-
npcPrompt: any;
|
|
721
|
-
npcPromptLabel: string;
|
|
722
|
-
npcAvatar: any;
|
|
723
|
-
npcAvatarLabel: string;
|
|
724
|
-
npcEnableThinking: any;
|
|
725
|
-
npcEnableThinkingLabel: string;
|
|
726
|
-
};
|
|
727
|
-
useCommentEnv(): {
|
|
728
|
-
commentId: any;
|
|
729
|
-
commentIdLabel: string;
|
|
730
|
-
commentBody: any;
|
|
731
|
-
commentBodyLabel: string;
|
|
732
|
-
commentType: any;
|
|
733
|
-
commentTypeLabel: string;
|
|
734
|
-
commentFilePath: any;
|
|
735
|
-
commentFilePathLabel: string;
|
|
736
|
-
commentRange: any;
|
|
737
|
-
commentRangeLabel: string;
|
|
738
|
-
reviewId: any;
|
|
739
|
-
reviewIdLabel: string;
|
|
740
|
-
};
|
|
741
|
-
usePullRequestEnv(): {
|
|
742
|
-
pullRequest: any;
|
|
743
|
-
pullRequestLabel: string;
|
|
744
|
-
pullRequestLike: any;
|
|
745
|
-
pullRequestLikeLabel: string;
|
|
746
|
-
pullRequestProposer: any;
|
|
747
|
-
pullRequestProposerLabel: string;
|
|
748
|
-
pullRequestTitle: any;
|
|
749
|
-
pullRequestTitleLabel: string;
|
|
750
|
-
pullRequestBranch: any;
|
|
751
|
-
pullRequestBranchLabel: string;
|
|
752
|
-
pullRequestSha: any;
|
|
753
|
-
pullRequestShaLabel: string;
|
|
754
|
-
pullRequestTargetSha: any;
|
|
755
|
-
pullRequestTargetShaLabel: string;
|
|
756
|
-
pullRequestMergeSha: any;
|
|
757
|
-
pullRequestMergeShaLabel: string;
|
|
758
|
-
pullRequestSlug: any;
|
|
759
|
-
pullRequestSlugLabel: string;
|
|
760
|
-
pullRequestAction: any;
|
|
761
|
-
pullRequestActionLabel: string;
|
|
762
|
-
pullRequestId: any;
|
|
763
|
-
pullRequestIdLabel: string;
|
|
764
|
-
};
|
|
765
|
-
useRepoInfoEnv(): {
|
|
766
|
-
repoSlug: any;
|
|
767
|
-
repoSlugLabel: string;
|
|
768
|
-
repoSlugLowercase: any;
|
|
769
|
-
repoSlugLowercaseLabel: string;
|
|
770
|
-
repoName: any;
|
|
771
|
-
repoNameLabel: string;
|
|
772
|
-
repoNameLowercase: any;
|
|
773
|
-
repoNameLowercaseLabel: string;
|
|
774
|
-
repoId: any;
|
|
775
|
-
repoIdLabel: string;
|
|
776
|
-
repoUrlHttps: any;
|
|
777
|
-
repoUrlHttpsLabel: string;
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
type GetListParams = {
|
|
781
|
-
/** 问题指派人名称,例如: 张三, 李四, -; - 表示不指派给任何人 */
|
|
782
|
-
assignees?: string;
|
|
783
|
-
/** 问题作者名称,例如: 张三, 李四 */
|
|
784
|
-
authors?: string;
|
|
785
|
-
/** 问题关闭时间过滤-开始,例如: 2022-01-31 */
|
|
786
|
-
close_time_begin?: string;
|
|
787
|
-
/** 问题关闭时间过滤-结束,例如: 2022-01-31 */
|
|
788
|
-
close_time_end?: string;
|
|
789
|
-
/** 问题搜索关键词 */
|
|
790
|
-
keyword?: string;
|
|
791
|
-
/** 问题标签,例如: git, bug, feature */
|
|
792
|
-
labels?: string;
|
|
793
|
-
/** 问题标签操作符,例如: contains_any, contains_all,默认: contains_any */
|
|
794
|
-
labels_operator?: string;
|
|
795
|
-
/** 问题排序,例如: created_at, -updated_at, reference_count;'-' 前缀表示降序 */
|
|
796
|
-
order_by?: string;
|
|
797
|
-
/** 分页页码。如果值小于 1,将自动调整为 1,默认: 1 */
|
|
798
|
-
page?: number;
|
|
799
|
-
/** 分页每页大小。如果值大于 100,将自动调整为 100,默认: 30 */
|
|
800
|
-
page_size?: number;
|
|
801
|
-
/** 问题优先级,例如: -1P, -2P, P0, P1, P2, P3 */
|
|
802
|
-
priority?: string;
|
|
803
|
-
/** 问题状态:open 或 closed */
|
|
804
|
-
state?: string;
|
|
805
|
-
/** 问题更新时间过滤-开始,例如: 2022-01-31 */
|
|
806
|
-
updated_time_begin?: string;
|
|
807
|
-
/** 问题更新时间过滤-结束,例如: 2022-01-31 */
|
|
808
|
-
updated_time_end?: string;
|
|
809
|
-
};
|
|
810
|
-
type AliveMetadata = {
|
|
811
|
-
aliveSessionID: string;
|
|
812
|
-
aliveChannelID: string;
|
|
813
|
-
domain: string;
|
|
814
|
-
subscriptions: {
|
|
815
|
-
event: 'subscribe';
|
|
816
|
-
data: {
|
|
817
|
-
id: string;
|
|
818
|
-
off: number;
|
|
819
|
-
};
|
|
820
|
-
}[];
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
declare const fields: readonly [{
|
|
824
|
-
readonly name: "resource_type";
|
|
825
|
-
readonly interaction_type: "radio";
|
|
826
|
-
readonly operators: readonly [];
|
|
827
|
-
readonly value: readonly ["issues", "pull_requests"];
|
|
828
|
-
}, {
|
|
829
|
-
readonly name: "started_at";
|
|
830
|
-
readonly interaction_type: "time_selector";
|
|
831
|
-
readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
|
|
832
|
-
readonly value: readonly [];
|
|
833
|
-
}, {
|
|
834
|
-
readonly name: "ended_at";
|
|
835
|
-
readonly interaction_type: "time_selector";
|
|
836
|
-
readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
|
|
837
|
-
readonly value: readonly [];
|
|
838
|
-
}, {
|
|
839
|
-
readonly name: "closed_at";
|
|
840
|
-
readonly interaction_type: "time_selector";
|
|
841
|
-
readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
|
|
842
|
-
readonly value: readonly [];
|
|
843
|
-
}, {
|
|
844
|
-
readonly name: "assignee";
|
|
845
|
-
readonly interaction_type: "checkbox";
|
|
846
|
-
readonly operators: readonly ["contains", "contains_all", "not_contains", "equals", "not_equals", "empty", "not_empty"];
|
|
847
|
-
readonly value: readonly [{
|
|
848
|
-
readonly id: "";
|
|
849
|
-
readonly user_name: "";
|
|
850
|
-
readonly nick_name: "";
|
|
851
|
-
readonly user_type: 0;
|
|
852
|
-
}, {
|
|
853
|
-
readonly id: "2026622946958528512";
|
|
854
|
-
readonly user_name: "cnb.cAiAVfFPgKA";
|
|
855
|
-
readonly nick_name: "里海暗红色";
|
|
856
|
-
readonly user_type: 0;
|
|
857
|
-
}, {
|
|
858
|
-
readonly id: "1915352477005254656";
|
|
859
|
-
readonly user_name: "kevisual";
|
|
860
|
-
readonly nick_name: "科学和哲学";
|
|
861
|
-
readonly user_type: 0;
|
|
862
|
-
}, {
|
|
863
|
-
readonly id: "1935321989751226368";
|
|
864
|
-
readonly user_name: "xiongxiao";
|
|
865
|
-
readonly nick_name: "小熊猫呜呜呜";
|
|
866
|
-
readonly user_type: 0;
|
|
867
|
-
}];
|
|
868
|
-
}, {
|
|
869
|
-
readonly name: "repo";
|
|
870
|
-
readonly interaction_type: "checkbox";
|
|
871
|
-
readonly operators: readonly ["contains", "not_contains"];
|
|
872
|
-
readonly value: readonly ["kevisual/kevisual", "kevisual/cnb", "abearxiong/blog", "abearxiong/abearxiong"];
|
|
873
|
-
}, {
|
|
874
|
-
readonly name: "created_at";
|
|
875
|
-
readonly interaction_type: "time_selector";
|
|
876
|
-
readonly operators: readonly ["equals", "before", "after"];
|
|
877
|
-
readonly value: readonly [];
|
|
878
|
-
}, {
|
|
879
|
-
readonly name: "last_acted_at";
|
|
880
|
-
readonly interaction_type: "time_selector";
|
|
881
|
-
readonly operators: readonly ["equals", "before", "after"];
|
|
882
|
-
readonly value: readonly [];
|
|
883
|
-
}, {
|
|
884
|
-
readonly name: "priority";
|
|
885
|
-
readonly interaction_type: "checkbox";
|
|
886
|
-
readonly operators: readonly ["contains", "not_contains", "empty", "not_empty"];
|
|
887
|
-
readonly value: readonly ["-2P", "-1P", "P0", "P1", "P2", "P3", ""];
|
|
888
|
-
}, {
|
|
889
|
-
readonly name: "state";
|
|
890
|
-
readonly interaction_type: "radio";
|
|
891
|
-
readonly operators: readonly ["equals", "not_equals"];
|
|
892
|
-
readonly value: readonly ["open", "closed"];
|
|
893
|
-
}, {
|
|
894
|
-
readonly name: "label";
|
|
895
|
-
readonly interaction_type: "radio";
|
|
896
|
-
readonly operators: readonly ["equals", "not_equals"];
|
|
897
|
-
readonly value: readonly ["AICoding"];
|
|
898
|
-
}];
|
|
899
|
-
type FieldName = typeof fields[number]['name'];
|
|
900
|
-
|
|
901
|
-
type Selector = {
|
|
902
|
-
/**
|
|
903
|
-
* 字段名称,例如 resource_type、state 等
|
|
904
|
-
*/
|
|
905
|
-
field: FieldName;
|
|
906
|
-
operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'in' | 'not_in';
|
|
907
|
-
value: any;
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
declare class Mission extends CNBCore {
|
|
911
|
-
constructor(options: CNBCoreOptions);
|
|
912
|
-
/**
|
|
913
|
-
* 查询组织下用户有权限查看的任务集
|
|
914
|
-
* @param params 查询参数
|
|
915
|
-
* @returns 任务集列表
|
|
916
|
-
*/
|
|
917
|
-
getMissions(group: string, params?: GetMissionsParams): Promise<Result<Missions4User[]>>;
|
|
918
|
-
/**
|
|
919
|
-
* 创建任务集
|
|
920
|
-
* @param data 创建任务集数据
|
|
921
|
-
* @returns 创建结果
|
|
922
|
-
*/
|
|
923
|
-
createMission(repo: string, data: CreateMissionData): Promise<Result<any>>;
|
|
924
|
-
/**
|
|
925
|
-
* 删除任务集
|
|
926
|
-
* @param mission 任务集路径
|
|
927
|
-
* @param identityTicket 微信身份验证票据
|
|
928
|
-
* @returns 删除结果
|
|
929
|
-
*/
|
|
930
|
-
deleteMission(mission: string, identityTicket?: string): Promise<Result<any>>;
|
|
931
|
-
/**
|
|
932
|
-
* 获取任务集视图配置
|
|
933
|
-
* @param mission 任务集 slug
|
|
934
|
-
* @param viewId 视图 ID
|
|
935
|
-
* @returns 视图配置
|
|
936
|
-
*/
|
|
937
|
-
getMissionViewConfig(mission: string, viewId: string): Promise<Result<MissionViewConfig>>;
|
|
938
|
-
/**
|
|
939
|
-
* 设置任务集视图配置
|
|
940
|
-
* @param mission 任务集 slug
|
|
941
|
-
* @param config 视图配置
|
|
942
|
-
* @returns 设置结果
|
|
943
|
-
*/
|
|
944
|
-
setMissionViewConfig(mission: string, config: MissionViewConfig): Promise<Result<any>>;
|
|
945
|
-
/**
|
|
946
|
-
* 获取任务集视图列表
|
|
947
|
-
* @param mission 任务集 slug
|
|
948
|
-
* @returns 视图列表
|
|
949
|
-
*/
|
|
950
|
-
getMissionViewList(mission: string): Promise<Result<MissionView[]>>;
|
|
951
|
-
/**
|
|
952
|
-
* 添加或修改任务集视图
|
|
953
|
-
* @param mission 任务集 slug
|
|
954
|
-
* @param view 视图数据
|
|
955
|
-
* @returns 操作结果
|
|
956
|
-
*/
|
|
957
|
-
putMissionView(mission: string, view: MissionView): Promise<Result<any>>;
|
|
958
|
-
/**
|
|
959
|
-
* 排序任务集视图
|
|
960
|
-
* @param mission 任务集 slug
|
|
961
|
-
* @param data 排序数据
|
|
962
|
-
* @returns 操作结果
|
|
963
|
-
*/
|
|
964
|
-
sortMissionViews(mission: string, data: MissionPostViewReq): Promise<Result<any>>;
|
|
965
|
-
/**
|
|
966
|
-
* 改变任务集可见性
|
|
967
|
-
* @param mission 任务集路径
|
|
968
|
-
* @param visibility 可见性 (Private 或 Public)
|
|
969
|
-
* @returns 操作结果
|
|
970
|
-
*/
|
|
971
|
-
setVisibility(mission: string, visibility: 'Private' | 'Public'): Promise<Result<any>>;
|
|
972
|
-
/**
|
|
973
|
-
* 查询任务集资源
|
|
974
|
-
* @param repo 仓库路径
|
|
975
|
-
* @param selectors 查询条件
|
|
976
|
-
* @returns 资源列表
|
|
977
|
-
*/
|
|
978
|
-
queryResources(repo: string, selectors?: Selector[]): Promise<any>;
|
|
979
|
-
}
|
|
980
|
-
type GetMissionsParams = {
|
|
981
|
-
page?: number;
|
|
982
|
-
page_size?: number;
|
|
983
|
-
filter_type?: 'private' | 'public';
|
|
984
|
-
order_by?: 'created_at' | 'name';
|
|
985
|
-
desc?: boolean;
|
|
986
|
-
descendant?: 'all' | 'sub' | 'grand';
|
|
987
|
-
search?: string;
|
|
988
|
-
};
|
|
989
|
-
type CreateMissionData = {
|
|
990
|
-
name: string;
|
|
991
|
-
description?: string;
|
|
992
|
-
visibility?: 'Private' | 'Public';
|
|
993
|
-
};
|
|
994
|
-
type Missions4User = {
|
|
995
|
-
id: string;
|
|
996
|
-
name: string;
|
|
997
|
-
slug_path: string;
|
|
998
|
-
description: string;
|
|
999
|
-
visibility: 'Private' | 'Public';
|
|
1000
|
-
created_at: string;
|
|
1001
|
-
updated_at: string;
|
|
1002
|
-
web_url: string;
|
|
1003
|
-
};
|
|
1004
|
-
type MissionView = {
|
|
1005
|
-
id: string;
|
|
1006
|
-
name: string;
|
|
1007
|
-
description?: string;
|
|
1008
|
-
config?: MissionViewConfig;
|
|
1009
|
-
created_at?: string;
|
|
1010
|
-
updated_at?: string;
|
|
1011
|
-
};
|
|
1012
|
-
type MissionViewConfig = {
|
|
1013
|
-
id: string;
|
|
1014
|
-
name: string;
|
|
1015
|
-
description?: string;
|
|
1016
|
-
columns?: MissionViewColumn[];
|
|
1017
|
-
filters?: MissionViewFilter[];
|
|
1018
|
-
sort_by?: string;
|
|
1019
|
-
sort_order?: 'asc' | 'desc';
|
|
1020
|
-
};
|
|
1021
|
-
type MissionViewColumn = {
|
|
1022
|
-
key: string;
|
|
1023
|
-
label: string;
|
|
1024
|
-
width?: number;
|
|
1025
|
-
visible?: boolean;
|
|
1026
|
-
sortable?: boolean;
|
|
1027
|
-
};
|
|
1028
|
-
type MissionViewFilter = {
|
|
1029
|
-
key: string;
|
|
1030
|
-
operator?: 'eq' | 'ne' | 'contains' | 'gt' | 'lt' | 'gte' | 'lte';
|
|
1031
|
-
value?: any;
|
|
1032
|
-
};
|
|
1033
|
-
type MissionPostViewReq = {
|
|
1034
|
-
view_ids: string[];
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
declare class AiBase extends CNBCore {
|
|
1038
|
-
group: string;
|
|
1039
|
-
constructor(options: CNBCoreOptions);
|
|
1040
|
-
autoPr(repo: string, data: {
|
|
1041
|
-
body: string;
|
|
1042
|
-
branch?: string;
|
|
1043
|
-
title: string;
|
|
1044
|
-
}): Promise<Result<any>>;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
* 标签基础类型
|
|
1049
|
-
*/
|
|
1050
|
-
type Label = {
|
|
1051
|
-
/** 标签 ID */
|
|
1052
|
-
id: string;
|
|
1053
|
-
/** 标签名称 */
|
|
1054
|
-
name: string;
|
|
1055
|
-
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
1056
|
-
color: string;
|
|
1057
|
-
/** 标签描述 */
|
|
1058
|
-
description: string;
|
|
1059
|
-
};
|
|
1060
|
-
/**
|
|
1061
|
-
* 创建标签的表单数据
|
|
1062
|
-
*/
|
|
1063
|
-
type PostLabelForm = {
|
|
1064
|
-
/** 标签名称 */
|
|
1065
|
-
name: string;
|
|
1066
|
-
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
1067
|
-
color: string;
|
|
1068
|
-
/** 标签描述 */
|
|
1069
|
-
description?: string;
|
|
1070
|
-
};
|
|
1071
|
-
/**
|
|
1072
|
-
* 更新标签的表单数据
|
|
1073
|
-
*/
|
|
1074
|
-
type PatchLabelForm = {
|
|
1075
|
-
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
1076
|
-
color?: string;
|
|
1077
|
-
/** 标签描述 */
|
|
1078
|
-
description?: string;
|
|
1079
|
-
/** 新标签名称 */
|
|
1080
|
-
new_name?: string;
|
|
1081
|
-
};
|
|
1082
|
-
/**
|
|
1083
|
-
* 设置 Issue 标签的表单数据(完全替换)
|
|
1084
|
-
*/
|
|
1085
|
-
type PutIssueLabelsForm = {
|
|
1086
|
-
/** 标签名称数组 */
|
|
1087
|
-
labels: string[];
|
|
1088
|
-
};
|
|
1089
|
-
/**
|
|
1090
|
-
* 新增 Issue 标签的表单数据(追加)
|
|
1091
|
-
*/
|
|
1092
|
-
type PostIssueLabelsForm = {
|
|
1093
|
-
/** 标签名称数组 */
|
|
1094
|
-
labels: string[];
|
|
1095
|
-
};
|
|
1096
|
-
/**
|
|
1097
|
-
* 仓库标签管理
|
|
1098
|
-
*/
|
|
1099
|
-
declare class RepoLabel extends CNBCore {
|
|
1100
|
-
constructor(options: CNBCoreOptions);
|
|
1101
|
-
/**
|
|
1102
|
-
* 查询仓库的标签列表
|
|
1103
|
-
* @param repo 仓库路径
|
|
1104
|
-
* @param params 分页和搜索参数
|
|
1105
|
-
*/
|
|
1106
|
-
list(repo: string, params?: ListLabelsParams): Promise<Result<Label[]>>;
|
|
1107
|
-
/**
|
|
1108
|
-
* 创建一个标签
|
|
1109
|
-
* @param repo 仓库路径
|
|
1110
|
-
* @param data 标签数据
|
|
1111
|
-
*/
|
|
1112
|
-
create(repo: string, data: PostLabelForm): Promise<Result<Label>>;
|
|
1113
|
-
/**
|
|
1114
|
-
* 更新标签信息
|
|
1115
|
-
* @param repo 仓库路径
|
|
1116
|
-
* @param name 标签名称
|
|
1117
|
-
* @param data 更新数据
|
|
1118
|
-
*/
|
|
1119
|
-
update(repo: string, name: string, data: PatchLabelForm): Promise<Result<Label>>;
|
|
1120
|
-
/**
|
|
1121
|
-
* 删除指定的仓库标签
|
|
1122
|
-
* @param repo 仓库路径
|
|
1123
|
-
* @param name 标签名称
|
|
1124
|
-
*/
|
|
1125
|
-
remove(repo: string, name: string): Promise<Result<void>>;
|
|
1126
|
-
}
|
|
1127
|
-
type ListLabelsParams = {
|
|
1128
|
-
/** 分页页码 */
|
|
1129
|
-
page?: number;
|
|
1130
|
-
/** 分页每页大小 */
|
|
1131
|
-
page_size?: number;
|
|
1132
|
-
/** 标签搜索关键词 */
|
|
1133
|
-
keyword?: string;
|
|
1134
|
-
};
|
|
1135
|
-
/**
|
|
1136
|
-
* Issue 标签管理
|
|
1137
|
-
*/
|
|
1138
|
-
declare class IssueLabel extends CNBCore {
|
|
1139
|
-
constructor(options: CNBCoreOptions);
|
|
1140
|
-
/**
|
|
1141
|
-
* 查询 issue 的标签列表
|
|
1142
|
-
* @param repo 仓库路径
|
|
1143
|
-
* @param number Issue 编号
|
|
1144
|
-
* @param params 分页参数
|
|
1145
|
-
*/
|
|
1146
|
-
list(repo: string, number: string | number, params?: ListIssueLabelsParams): Promise<Result<Label[]>>;
|
|
1147
|
-
/**
|
|
1148
|
-
* 设置 issue 标签(完全替换现有标签)
|
|
1149
|
-
* @param repo 仓库路径
|
|
1150
|
-
* @param number Issue 编号
|
|
1151
|
-
* @param data 标签数据
|
|
1152
|
-
*/
|
|
1153
|
-
set(repo: string, number: string | number, data: PutIssueLabelsForm): Promise<Result<Label>>;
|
|
1154
|
-
/**
|
|
1155
|
-
* 新增 issue 标签(追加到现有标签)
|
|
1156
|
-
* @param repo 仓库路径
|
|
1157
|
-
* @param number Issue 编号
|
|
1158
|
-
* @param data 标签数据
|
|
1159
|
-
*/
|
|
1160
|
-
add(repo: string, number: string | number, data: PostIssueLabelsForm): Promise<Result<Label>>;
|
|
1161
|
-
/**
|
|
1162
|
-
* 清空 issue 标签(移除所有标签)
|
|
1163
|
-
* @param repo 仓库路径
|
|
1164
|
-
* @param number Issue 编号
|
|
1165
|
-
*/
|
|
1166
|
-
clear(repo: string, number: string | number): Promise<Result<void>>;
|
|
1167
|
-
/**
|
|
1168
|
-
* 删除 issue 标签(移除指定标签)
|
|
1169
|
-
* @param repo 仓库路径
|
|
1170
|
-
* @param number Issue 编号
|
|
1171
|
-
* @param name 标签名称
|
|
1172
|
-
*/
|
|
1173
|
-
remove(repo: string, number: string | number, name: string): Promise<Result<void>>;
|
|
1174
|
-
}
|
|
1175
|
-
type ListIssueLabelsParams = {
|
|
1176
|
-
/** 分页页码 */
|
|
1177
|
-
page?: number;
|
|
1178
|
-
/** 分页每页大小 */
|
|
1179
|
-
page_size?: number;
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
/**
|
|
1183
|
-
* 制品类型
|
|
1184
|
-
*/
|
|
1185
|
-
type PackageType = "all" | "docker" | "helm" | "docker-model" | "maven" | "npm" | "ohpm" | "pypi" | "nuget" | "composer" | "conan" | "cargo";
|
|
1186
|
-
/**
|
|
1187
|
-
* 制品库可见性类型
|
|
1188
|
-
*/
|
|
1189
|
-
type VisibilityType = "private" | "public";
|
|
1190
|
-
/**
|
|
1191
|
-
* 制品库排序类型
|
|
1192
|
-
*/
|
|
1193
|
-
type PackageOrderingType = "pull_count" | "last_push_at" | "name_ascend" | "name_descend";
|
|
1194
|
-
/**
|
|
1195
|
-
* 最后推送者信息
|
|
1196
|
-
*/
|
|
1197
|
-
type LastPusher = {
|
|
1198
|
-
is_frozen: boolean;
|
|
1199
|
-
is_lock: boolean;
|
|
1200
|
-
name: string;
|
|
1201
|
-
username: string;
|
|
1202
|
-
};
|
|
1203
|
-
/**
|
|
1204
|
-
* 制品基本信息
|
|
1205
|
-
*/
|
|
1206
|
-
type Package = {
|
|
1207
|
-
count: number;
|
|
1208
|
-
description: string;
|
|
1209
|
-
labels: string[];
|
|
1210
|
-
last_artifact_name: string;
|
|
1211
|
-
last_pusher: LastPusher;
|
|
1212
|
-
name: string;
|
|
1213
|
-
package: string;
|
|
1214
|
-
package_type: PackageType;
|
|
1215
|
-
pull_count: number;
|
|
1216
|
-
recent_pull_count: number;
|
|
1217
|
-
};
|
|
1218
|
-
/**
|
|
1219
|
-
* 制品库信息
|
|
1220
|
-
*/
|
|
1221
|
-
type Registry = {
|
|
1222
|
-
created_at: string;
|
|
1223
|
-
description: string;
|
|
1224
|
-
name: string;
|
|
1225
|
-
owner: string;
|
|
1226
|
-
type: PackageType;
|
|
1227
|
-
visibility: VisibilityType;
|
|
1228
|
-
};
|
|
1229
|
-
/**
|
|
1230
|
-
* 制品库列表查询参数
|
|
1231
|
-
*/
|
|
1232
|
-
type ListGroupRegistriesParams = {
|
|
1233
|
-
/** 页码 */
|
|
1234
|
-
page?: number;
|
|
1235
|
-
/** 每页数量 */
|
|
1236
|
-
page_size?: number;
|
|
1237
|
-
/** 制品仓库类型 */
|
|
1238
|
-
registry_type?: "npm" | "maven" | "ohpm";
|
|
1239
|
-
/** 制品仓库可见性类型 */
|
|
1240
|
-
filter_type?: VisibilityType;
|
|
1241
|
-
/** 排序字段 */
|
|
1242
|
-
order_by?: "created_at" | "name";
|
|
1243
|
-
};
|
|
1244
|
-
/**
|
|
1245
|
-
* 制品列表查询参数
|
|
1246
|
-
*/
|
|
1247
|
-
type ListPackagesParams = {
|
|
1248
|
-
/** 顺序类型 */
|
|
1249
|
-
ordering?: PackageOrderingType;
|
|
1250
|
-
/** 关键字,搜索制品名称 */
|
|
1251
|
-
name?: string;
|
|
1252
|
-
};
|
|
1253
|
-
/**
|
|
1254
|
-
* 制品库管理
|
|
1255
|
-
*/
|
|
1256
|
-
declare class RegistryPackage extends CNBCore {
|
|
1257
|
-
constructor(options: CNBCoreOptions);
|
|
1258
|
-
/**
|
|
1259
|
-
* 查询组织下面用户有权限查看到的制品仓库
|
|
1260
|
-
* @param slug 组织 slug
|
|
1261
|
-
* @param params 查询参数
|
|
1262
|
-
*/
|
|
1263
|
-
listGroupRegistries(slug: string, params?: ListGroupRegistriesParams): Promise<Result<Registry[]>>;
|
|
1264
|
-
/**
|
|
1265
|
-
* 设置制品库可见性
|
|
1266
|
-
* @param registry 制品库路径
|
|
1267
|
-
* @param data 可见性设置
|
|
1268
|
-
*/
|
|
1269
|
-
setVisibility(registry: string, data: {
|
|
1270
|
-
visibility: VisibilityType;
|
|
1271
|
-
}): Promise<Result<void>>;
|
|
1272
|
-
/**
|
|
1273
|
-
* 删除制品库
|
|
1274
|
-
* @param registry 制品库路径
|
|
1275
|
-
*/
|
|
1276
|
-
remove(registry: string): Promise<Result<void>>;
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
* 制品管理
|
|
1281
|
-
*/
|
|
1282
|
-
declare class PackageManagement extends CNBCore {
|
|
1283
|
-
constructor(options: CNBCoreOptions);
|
|
1284
|
-
/**
|
|
1285
|
-
* 查询制品列表
|
|
1286
|
-
* @param slug 资源路径
|
|
1287
|
-
* @param type 制品类型
|
|
1288
|
-
* @param params 查询参数
|
|
1289
|
-
*/
|
|
1290
|
-
list(slug: string, type: PackageType, params?: ListPackagesParams & {
|
|
1291
|
-
page?: number;
|
|
1292
|
-
page_size?: number;
|
|
1293
|
-
}): Promise<Result<Package[]>>;
|
|
1294
|
-
/**
|
|
1295
|
-
* 获取制品详情
|
|
1296
|
-
* @param slug 资源路径
|
|
1297
|
-
* @param type 制品类型
|
|
1298
|
-
* @param name 制品名称
|
|
1299
|
-
*/
|
|
1300
|
-
getOne(slug: string, type: PackageType, name: string): Promise<Result<any>>;
|
|
1301
|
-
/**
|
|
1302
|
-
* 删除制品
|
|
1303
|
-
* @param slug 资源路径
|
|
1304
|
-
* @param type 制品类型
|
|
1305
|
-
* @param name 制品名称
|
|
1306
|
-
*/
|
|
1307
|
-
remove(slug: string, type: PackageType, name: string): Promise<Result<void>>;
|
|
1308
|
-
/**
|
|
1309
|
-
* 获取制品标签详情
|
|
1310
|
-
* @param slug 资源路径
|
|
1311
|
-
* @param type 制品类型
|
|
1312
|
-
* @param name 制品名称
|
|
1313
|
-
* @param tag 标签名称
|
|
1314
|
-
*/
|
|
1315
|
-
getTag(slug: string, type: PackageType, name: string, tag: string): Promise<Result<any>>;
|
|
1316
|
-
/**
|
|
1317
|
-
* 删除制品标签
|
|
1318
|
-
* @param slug 资源路径
|
|
1319
|
-
* @param type 制品类型
|
|
1320
|
-
* @param name 制品名称
|
|
1321
|
-
* @param tag 标签名称
|
|
1322
|
-
*/
|
|
1323
|
-
removeTag(slug: string, type: PackageType, name: string, tag: string): Promise<Result<void>>;
|
|
1324
|
-
/**
|
|
1325
|
-
* 获取制品标签列表
|
|
1326
|
-
* @param slug 资源路径
|
|
1327
|
-
* @param type 制品类型
|
|
1328
|
-
* @param name 制品名称
|
|
1329
|
-
* @param params 查询参数
|
|
1330
|
-
*/
|
|
1331
|
-
listTags(slug: string, type: PackageType, name: string, params?: {
|
|
1332
|
-
page?: number;
|
|
1333
|
-
page_size?: number;
|
|
1334
|
-
}): Promise<Result<any>>;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
/**
|
|
1338
|
-
* @title 组织管理模块
|
|
1339
|
-
* @description 提供组织(Organizations)的管理功能,包括创建、更新、删除组织,获取组织列表、子组织、组织设置等
|
|
1340
|
-
* @tags organization, group, team, cnb, api
|
|
1341
|
-
* @createdAt 2025-12-04
|
|
1342
|
-
*/
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* 组织角色枚举
|
|
1346
|
-
*/
|
|
1347
|
-
declare enum AccessRole {
|
|
1348
|
-
Guest = "Guest",
|
|
1349
|
-
Reporter = "Reporter",
|
|
1350
|
-
Developer = "Developer",
|
|
1351
|
-
Master = "Master",
|
|
1352
|
-
Owner = "Owner"
|
|
1353
|
-
}
|
|
1354
|
-
/**
|
|
1355
|
-
* 创建组织请求参数
|
|
1356
|
-
*/
|
|
1357
|
-
interface CreateGroupParams {
|
|
1358
|
-
/** 组织路径 */
|
|
1359
|
-
path: string;
|
|
1360
|
-
/** 组织描述 */
|
|
1361
|
-
description?: string;
|
|
1362
|
-
/** 根组织绑定的域名 */
|
|
1363
|
-
bind_domain?: string;
|
|
1364
|
-
/** 备注 */
|
|
1365
|
-
remark?: string;
|
|
1366
|
-
}
|
|
1367
|
-
/**
|
|
1368
|
-
* 更新组织信息请求参数
|
|
1369
|
-
*/
|
|
1370
|
-
interface UpdateGroupParams {
|
|
1371
|
-
/** 组织描述 */
|
|
1372
|
-
description?: string;
|
|
1373
|
-
/** 组织展示名称 */
|
|
1374
|
-
remark?: string;
|
|
1375
|
-
/** 组织网站 */
|
|
1376
|
-
site?: string;
|
|
1377
|
-
/** 组织联系邮箱 */
|
|
1378
|
-
email?: string;
|
|
1379
|
-
/** 绑定的域名 */
|
|
1380
|
-
domain?: string;
|
|
1381
|
-
/** 微信公众号 */
|
|
1382
|
-
wechat_mp?: string;
|
|
1383
|
-
/** README 仓库 ID */
|
|
1384
|
-
readme_repo_id?: number;
|
|
1385
|
-
/** README 仓库路径 */
|
|
1386
|
-
readme_repo_path?: string;
|
|
1387
|
-
}
|
|
1388
|
-
/**
|
|
1389
|
-
* 转移组织请求参数
|
|
1390
|
-
*/
|
|
1391
|
-
interface TransferGroupParams {
|
|
1392
|
-
/** 源组织路径 */
|
|
1393
|
-
source: string;
|
|
1394
|
-
/** 目标组织路径 */
|
|
1395
|
-
target: string;
|
|
1396
|
-
}
|
|
1397
|
-
/**
|
|
1398
|
-
* 上传 Logo 请求参数
|
|
1399
|
-
*/
|
|
1400
|
-
interface UploadLogoParams {
|
|
1401
|
-
/** 文件名 */
|
|
1402
|
-
name: string;
|
|
1403
|
-
/** 文件大小(字节) */
|
|
1404
|
-
size: number;
|
|
1405
|
-
/** 额外参数 */
|
|
1406
|
-
ext?: Record<string, string>;
|
|
1407
|
-
}
|
|
1408
|
-
/**
|
|
1409
|
-
* 更新组织设置请求参数
|
|
1410
|
-
*/
|
|
1411
|
-
interface UpdateGroupSettingParams {
|
|
1412
|
-
/** 是否对外隐藏组织成员,0 - 否, 1 - 是 */
|
|
1413
|
-
hide_members?: number;
|
|
1414
|
-
/** 是否对外隐藏子组织,0 - 否, 1 - 是 */
|
|
1415
|
-
hide_sub_groups?: number;
|
|
1416
|
-
/** 是否对外显示私有仓库水印,0 - 否, 1 - 是 */
|
|
1417
|
-
show_private_repo_watermark?: number;
|
|
1418
|
-
/** 组织保护开关,0 - 关闭,1 - 打开 */
|
|
1419
|
-
group_protection?: number;
|
|
1420
|
-
/** 组织限制指定邮箱认证才能加入 */
|
|
1421
|
-
email_verification?: string[];
|
|
1422
|
-
/** 组织设置值,多个选项用逗号拼接 */
|
|
1423
|
-
values?: string;
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* 组织信息(包含访问权限)
|
|
1427
|
-
*/
|
|
1428
|
-
interface OrganizationAccess {
|
|
1429
|
-
/** 用户在当前资源的最大权限 */
|
|
1430
|
-
access_role?: AccessRole;
|
|
1431
|
-
/** 所有层级成员总数 */
|
|
1432
|
-
all_member_count?: number;
|
|
1433
|
-
/** 所有层级子组织数量 */
|
|
1434
|
-
all_sub_group_count?: number;
|
|
1435
|
-
/** 所有层级子任务数量 */
|
|
1436
|
-
all_sub_mission_count?: number;
|
|
1437
|
-
/** 所有层级制品库数量 */
|
|
1438
|
-
all_sub_registry_count?: number;
|
|
1439
|
-
/** 所有层级仓库数量 */
|
|
1440
|
-
all_sub_repo_count?: number;
|
|
1441
|
-
/** 创建时间 */
|
|
1442
|
-
created_at?: string;
|
|
1443
|
-
/** 组织描述 */
|
|
1444
|
-
description?: string;
|
|
1445
|
-
/** 绑定的域名 */
|
|
1446
|
-
domain?: string;
|
|
1447
|
-
/** 组织邮箱 */
|
|
1448
|
-
email?: string;
|
|
1449
|
-
/** 关注数量 */
|
|
1450
|
-
follow_count?: number;
|
|
1451
|
-
/** 是否冻结 */
|
|
1452
|
-
freeze?: boolean;
|
|
1453
|
-
/** 是否有子组织 */
|
|
1454
|
-
has_sub_group?: boolean;
|
|
1455
|
-
/** 组织 ID */
|
|
1456
|
-
id?: string;
|
|
1457
|
-
/** 直接成员数量 */
|
|
1458
|
-
member_count?: number;
|
|
1459
|
-
/** 组织展示名称 */
|
|
1460
|
-
name?: string;
|
|
1461
|
-
/** 组织路径 */
|
|
1462
|
-
path?: string;
|
|
1463
|
-
/** 是否置顶 */
|
|
1464
|
-
pinned?: boolean;
|
|
1465
|
-
/** 置顶时间 */
|
|
1466
|
-
pinned_time?: string;
|
|
1467
|
-
/** README 仓库路径 */
|
|
1468
|
-
readme_repo_path?: string;
|
|
1469
|
-
/** 备注 */
|
|
1470
|
-
remark?: string;
|
|
1471
|
-
/** 组织网站 */
|
|
1472
|
-
site?: string;
|
|
1473
|
-
/** 下一级子组织数量 */
|
|
1474
|
-
sub_group_count?: number;
|
|
1475
|
-
/** 下一级子任务数量 */
|
|
1476
|
-
sub_mission_count?: number;
|
|
1477
|
-
/** 下一级制品库数量 */
|
|
1478
|
-
sub_registry_count?: number;
|
|
1479
|
-
/** 下一级仓库数量 */
|
|
1480
|
-
sub_repo_count?: number;
|
|
1481
|
-
/** 更新时间 */
|
|
1482
|
-
updated_at?: string;
|
|
1483
|
-
/** 微信公众号 */
|
|
1484
|
-
wechat_mp?: string;
|
|
1485
|
-
}
|
|
1486
|
-
/**
|
|
1487
|
-
* 组织信息(联合类型)
|
|
1488
|
-
*/
|
|
1489
|
-
interface OrganizationUnion {
|
|
1490
|
-
/** 所有层级成员总数 */
|
|
1491
|
-
all_member_count?: number;
|
|
1492
|
-
/** 所有层级子组织数量 */
|
|
1493
|
-
all_sub_group_count?: number;
|
|
1494
|
-
/** 所有层级子任务数量 */
|
|
1495
|
-
all_sub_mission_count?: number;
|
|
1496
|
-
/** 所有层级制品库数量 */
|
|
1497
|
-
all_sub_registry_count?: number;
|
|
1498
|
-
/** 所有层级仓库数量 */
|
|
1499
|
-
all_sub_repo_count?: number;
|
|
1500
|
-
/** 创建时间 */
|
|
1501
|
-
created_at?: string;
|
|
1502
|
-
/** 组织描述 */
|
|
1503
|
-
description?: string;
|
|
1504
|
-
/** 绑定的域名 */
|
|
1505
|
-
domain?: string;
|
|
1506
|
-
/** 组织邮箱 */
|
|
1507
|
-
email?: string;
|
|
1508
|
-
/** 关注数量 */
|
|
1509
|
-
follow_count?: number;
|
|
1510
|
-
/** 是否冻结 */
|
|
1511
|
-
freeze?: boolean;
|
|
1512
|
-
/** 是否有子组织 */
|
|
1513
|
-
has_sub_group?: boolean;
|
|
1514
|
-
/** 组织 ID */
|
|
1515
|
-
id?: string;
|
|
1516
|
-
/** 直接成员数量 */
|
|
1517
|
-
member_count?: number;
|
|
1518
|
-
/** 组织展示名称 */
|
|
1519
|
-
name?: string;
|
|
1520
|
-
/** 组织路径 */
|
|
1521
|
-
path?: string;
|
|
1522
|
-
/** 是否置顶 */
|
|
1523
|
-
pinned?: boolean;
|
|
1524
|
-
/** 置顶时间 */
|
|
1525
|
-
pinned_time?: string;
|
|
1526
|
-
/** README 仓库路径 */
|
|
1527
|
-
readme_repo_path?: string;
|
|
1528
|
-
/** 备注 */
|
|
1529
|
-
remark?: string;
|
|
1530
|
-
/** 组织网站 */
|
|
1531
|
-
site?: string;
|
|
1532
|
-
/** 下一级子组织数量 */
|
|
1533
|
-
sub_group_count?: number;
|
|
1534
|
-
/** 下一级子任务数量 */
|
|
1535
|
-
sub_mission_count?: number;
|
|
1536
|
-
/** 下一级制品库数量 */
|
|
1537
|
-
sub_registry_count?: number;
|
|
1538
|
-
/** 下一级仓库数量 */
|
|
1539
|
-
sub_repo_count?: number;
|
|
1540
|
-
/** 更新时间 */
|
|
1541
|
-
updated_at?: string;
|
|
1542
|
-
/** 微信公众号 */
|
|
1543
|
-
wechat_mp?: string;
|
|
1544
|
-
}
|
|
1545
|
-
/**
|
|
1546
|
-
* 上传 Logo 响应
|
|
1547
|
-
*/
|
|
1548
|
-
interface UploadLogoResponse {
|
|
1549
|
-
/** 上传后的文件信息 */
|
|
1550
|
-
assets?: {
|
|
1551
|
-
/** 文件大小 */
|
|
1552
|
-
size?: number;
|
|
1553
|
-
/** 文件名 */
|
|
1554
|
-
name?: string;
|
|
1555
|
-
/** 文件路径 */
|
|
1556
|
-
path?: string;
|
|
1557
|
-
/** 内容类型 */
|
|
1558
|
-
content_type?: string;
|
|
1559
|
-
/** 额外信息 */
|
|
1560
|
-
ext?: Record<string, string>;
|
|
1561
|
-
};
|
|
1562
|
-
/** 上传表单字段 */
|
|
1563
|
-
form?: Record<string, string>;
|
|
1564
|
-
/** 上传 URL */
|
|
1565
|
-
upload_url?: string;
|
|
1566
|
-
/** 后续确认接口使用的 token */
|
|
1567
|
-
token?: string;
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
* 组织设置值
|
|
1571
|
-
*/
|
|
1572
|
-
interface SettingValues {
|
|
1573
|
-
/** 禁用组织 README */
|
|
1574
|
-
disable_organization_readme?: boolean;
|
|
1575
|
-
/** 云原生开发限制 */
|
|
1576
|
-
cloud_native_dev_only?: boolean;
|
|
1577
|
-
/** 根组织分支保护规则限制 */
|
|
1578
|
-
user_root_group_branch_protection_only?: boolean;
|
|
1579
|
-
/** 禁止重定义分支保护 */
|
|
1580
|
-
forbid_redefine_branch_protection?: boolean;
|
|
1581
|
-
/** TAPD 访问 */
|
|
1582
|
-
enable_tapd_access?: boolean;
|
|
1583
|
-
/** 私有任务水印 */
|
|
1584
|
-
enable_show_private_mission_water_mark?: boolean;
|
|
1585
|
-
/** 禁止组织创建 */
|
|
1586
|
-
prevent_organization_creation?: boolean;
|
|
1587
|
-
/** 禁止仓库创建 */
|
|
1588
|
-
prevent_repository_creation?: boolean;
|
|
1589
|
-
/** 禁止任务集创建 */
|
|
1590
|
-
prevent_mission_creation?: boolean;
|
|
1591
|
-
/** 禁止制品库创建 */
|
|
1592
|
-
prevent_registry_creation?: boolean;
|
|
1593
|
-
/** 禁止邀请 */
|
|
1594
|
-
disable_invitation?: boolean;
|
|
1595
|
-
/** 禁止可见性修改 */
|
|
1596
|
-
prevent_visibility_modification?: boolean;
|
|
1597
|
-
/** 禁止资源删除 */
|
|
1598
|
-
prevent_resource_deletion?: boolean;
|
|
1599
|
-
/** 禁止仓库归档 */
|
|
1600
|
-
prevent_repository_archival?: boolean;
|
|
1601
|
-
/** 禁止组织转移 */
|
|
1602
|
-
prevent_organization_transfer?: boolean;
|
|
1603
|
-
/** 禁止仓库转移 */
|
|
1604
|
-
prevent_repository_transfer?: boolean;
|
|
1605
|
-
/** 禁止任务集转移 */
|
|
1606
|
-
prevent_mission_transfer?: boolean;
|
|
1607
|
-
/** 禁止制品库转移 */
|
|
1608
|
-
prevent_registry_transfer?: boolean;
|
|
1609
|
-
/** 使用组织 Git 配额 */
|
|
1610
|
-
use_group_git_quota?: boolean;
|
|
1611
|
-
/** 使用组织 Git 对象限制 */
|
|
1612
|
-
use_group_git_object_limit?: boolean;
|
|
1613
|
-
/** 仅根组织可添加成员 */
|
|
1614
|
-
enable_add_member_only_root?: boolean;
|
|
1615
|
-
/** 使用根组织 Git 推送限制 */
|
|
1616
|
-
use_root_group_git_push_limit?: boolean;
|
|
1617
|
-
/** 允许添加成员 */
|
|
1618
|
-
enable_add_member?: boolean;
|
|
1619
|
-
/** 仅根组织可修改成员角色 */
|
|
1620
|
-
enable_change_member_role_only_root?: boolean;
|
|
1621
|
-
}
|
|
1622
|
-
/**
|
|
1623
|
-
* 组织设置信息(包含父级继承)
|
|
1624
|
-
*/
|
|
1625
|
-
interface OrganizationSettingWithParent {
|
|
1626
|
-
/** 上级是否隐藏成员,true - 上级禁止显示 */
|
|
1627
|
-
can_show_members?: boolean;
|
|
1628
|
-
/** 上级是否隐藏子组织,true - 上级禁止显示 */
|
|
1629
|
-
can_show_sub_groups?: boolean;
|
|
1630
|
-
/** 是否可以显示水印 */
|
|
1631
|
-
can_show_watermark?: boolean;
|
|
1632
|
-
/** 邮箱验证配置 */
|
|
1633
|
-
email_verification?: string[];
|
|
1634
|
-
/** 组织保护开关 */
|
|
1635
|
-
group_protection?: number;
|
|
1636
|
-
/** 是否对外隐藏组织成员,0 - 否, 1 - 是 */
|
|
1637
|
-
hide_members?: number;
|
|
1638
|
-
/** 是否对外隐藏子组织,0 - 否, 1 - 是 */
|
|
1639
|
-
hide_sub_groups?: number;
|
|
1640
|
-
/** 根组织邮箱验证配置 */
|
|
1641
|
-
root_email_verification?: string[];
|
|
1642
|
-
/** 根组织保护开关 */
|
|
1643
|
-
root_group_protection?: boolean;
|
|
1644
|
-
/** 根组织设置值 */
|
|
1645
|
-
root_values?: SettingValues;
|
|
1646
|
-
/** 是否对外显示私有仓库水印 */
|
|
1647
|
-
show_private_repo_watermark?: number;
|
|
1648
|
-
/** 当前组织设置值 */
|
|
1649
|
-
values?: SettingValues;
|
|
1650
|
-
}
|
|
1651
|
-
/**
|
|
1652
|
-
* 组织管理模块
|
|
1653
|
-
* https://api.cnb.cool/#/operations/GetGroup
|
|
1654
|
-
*/
|
|
1655
|
-
declare class Organization extends CNBCore {
|
|
1656
|
-
constructor(options: CNBCoreOptions);
|
|
1657
|
-
/**
|
|
1658
|
-
* 创建新组织
|
|
1659
|
-
* @param params 组织信息
|
|
1660
|
-
*/
|
|
1661
|
-
create(params: CreateGroupParams): Promise<Result$2<OrganizationAccess>>;
|
|
1662
|
-
/**
|
|
1663
|
-
* 获取当前用户拥有权限的顶层组织列表
|
|
1664
|
-
* @param params 查询参数
|
|
1665
|
-
*/
|
|
1666
|
-
listTopGroups(params?: {
|
|
1667
|
-
page?: number;
|
|
1668
|
-
page_size?: number;
|
|
1669
|
-
search?: string;
|
|
1670
|
-
role?: AccessRole;
|
|
1671
|
-
}): Promise<Result$2<OrganizationAccess[]>>;
|
|
1672
|
-
/**
|
|
1673
|
-
* 查询当前用户在指定组织下拥有指定权限的子组织列表
|
|
1674
|
-
* @param slug 组织路径
|
|
1675
|
-
* @param params 查询参数
|
|
1676
|
-
*/
|
|
1677
|
-
listGroups(slug: string, params?: {
|
|
1678
|
-
page?: number;
|
|
1679
|
-
page_size?: number;
|
|
1680
|
-
access?: number;
|
|
1681
|
-
}): Promise<Result$2<OrganizationAccess[]>>;
|
|
1682
|
-
/**
|
|
1683
|
-
* 获取指定用户拥有权限的顶层组织列表
|
|
1684
|
-
* @param username 用户名
|
|
1685
|
-
* @param params 查询参数
|
|
1686
|
-
*/
|
|
1687
|
-
getGroupsByUsername(username: string, params?: {
|
|
1688
|
-
search?: string;
|
|
1689
|
-
page?: number;
|
|
1690
|
-
page_size?: number;
|
|
1691
|
-
}): Promise<Result$2<OrganizationUnion>>;
|
|
1692
|
-
/**
|
|
1693
|
-
* 获取指定组织信息
|
|
1694
|
-
* @param group 组织路径
|
|
1695
|
-
*/
|
|
1696
|
-
getGroup(group: string): Promise<Result$2<OrganizationAccess>>;
|
|
1697
|
-
/**
|
|
1698
|
-
* 更新组织信息,可更新的内容为:组织描述、组织展示名称、组织网站、组织联系邮箱
|
|
1699
|
-
* @param group 组织路径
|
|
1700
|
-
* @param params 更新内容
|
|
1701
|
-
*/
|
|
1702
|
-
updateGroup(group: string, params: UpdateGroupParams): Promise<Result$2<OrganizationAccess>>;
|
|
1703
|
-
/**
|
|
1704
|
-
* 删除指定组织
|
|
1705
|
-
* @param group 组织路径
|
|
1706
|
-
* @param identityTicket 微信身份验证票据
|
|
1707
|
-
*/
|
|
1708
|
-
deleteGroup(group: string, identityTicket?: string): Promise<Result$2<void>>;
|
|
1709
|
-
/**
|
|
1710
|
-
* 转移组织
|
|
1711
|
-
* @param group 组织路径
|
|
1712
|
-
* @param params 转移参数
|
|
1713
|
-
*/
|
|
1714
|
-
transfer(group: string, params: TransferGroupParams): Promise<Result$2<void>>;
|
|
1715
|
-
/**
|
|
1716
|
-
* 上传 Logo,发起上传请求,返回上传文件的 URL,请使用 PUT 发起流式上传
|
|
1717
|
-
* @param group 组织路径
|
|
1718
|
-
* @param params 上传参数
|
|
1719
|
-
*/
|
|
1720
|
-
uploadLogo(group: string, params: UploadLogoParams): Promise<Result$2<UploadLogoResponse>>;
|
|
1721
|
-
/**
|
|
1722
|
-
* 获取指定组织的配置详情
|
|
1723
|
-
* @param slug 组织路径
|
|
1724
|
-
*/
|
|
1725
|
-
getSetting(slug: string): Promise<Result$2<OrganizationSettingWithParent>>;
|
|
1726
|
-
/**
|
|
1727
|
-
* 更新指定组织的配置
|
|
1728
|
-
* @param slug 组织路径
|
|
1729
|
-
* @param params 设置参数
|
|
1730
|
-
*/
|
|
1731
|
-
updateSetting(slug: string, params: UpdateGroupSettingParams): Promise<Result$2<void>>;
|
|
1732
|
-
/**
|
|
1733
|
-
* 获取指定组织下的子组织列表
|
|
1734
|
-
* @param slug 组织路径
|
|
1735
|
-
* @param params 查询参数
|
|
1736
|
-
*/
|
|
1737
|
-
listSubgroups(slug: string, params?: {
|
|
1738
|
-
search?: string;
|
|
1739
|
-
page?: number;
|
|
1740
|
-
page_size?: number;
|
|
1741
|
-
}): Promise<Result$2<OrganizationUnion[]>>;
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
type CNBOptions = CNBCoreOptions<{}>;
|
|
1745
|
-
declare class CNB extends CNBCore {
|
|
1746
|
-
workspace: Workspace;
|
|
1747
|
-
knowledgeBase: KnowledgeBase;
|
|
1748
|
-
repo: Repo;
|
|
1749
|
-
user: User;
|
|
1750
|
-
build: Build;
|
|
1751
|
-
issue: Issue;
|
|
1752
|
-
mission: Mission;
|
|
1753
|
-
ai: AiBase;
|
|
1754
|
-
labels: {
|
|
1755
|
-
repoLabel: RepoLabel;
|
|
1756
|
-
issueLabel: IssueLabel;
|
|
1757
|
-
};
|
|
1758
|
-
packages: {
|
|
1759
|
-
registry: RegistryPackage;
|
|
1760
|
-
package: PackageManagement;
|
|
1761
|
-
};
|
|
1762
|
-
org: Organization;
|
|
1763
|
-
dashboard: Dashboard;
|
|
1764
|
-
constructor(options: CNBOptions);
|
|
1765
|
-
init(cnbOptions?: CNBOptions): void;
|
|
1766
|
-
setToken(token: string): void;
|
|
1767
|
-
setCookie(cookie: string): void;
|
|
1768
|
-
getCNBVersion: () => Promise<VersionInfo>;
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
type VersionInfo = {
|
|
1772
|
-
version: string;
|
|
1773
|
-
commitID: string;
|
|
1774
|
-
hash: string;
|
|
1775
|
-
};
|
|
1776
|
-
|
|
1777
|
-
type CNBItem = {
|
|
1778
|
-
username: string;
|
|
1779
|
-
token: string;
|
|
1780
|
-
cookie?: string;
|
|
1781
|
-
runAt?: number;
|
|
1782
|
-
owner?: boolean;
|
|
1783
|
-
cnb: CNB;
|
|
1784
|
-
cnbAi: ReturnType<typeof createOpenAICompatible>;
|
|
1785
|
-
};
|
|
1786
|
-
declare class CNBManager {
|
|
1787
|
-
cnbMap: Map<string, CNBItem>;
|
|
1788
|
-
constructor();
|
|
1789
|
-
getDefaultCNB(): CNBItem;
|
|
1790
|
-
getCNB(opts?: {
|
|
1791
|
-
username?: string;
|
|
1792
|
-
kevisualToken?: string;
|
|
1793
|
-
}): Promise<CNBItem | null>;
|
|
1794
|
-
/**
|
|
1795
|
-
* 通过上下文获取 CNB 实例(直接返回 cnb 对象)
|
|
1796
|
-
* @param ctx
|
|
1797
|
-
* @returns CNB 实例
|
|
1798
|
-
*/
|
|
1799
|
-
getContext(ctx: any): Promise<CNB>;
|
|
1800
|
-
getCNBItem(ctx: any): Promise<CNBItem | null>;
|
|
1801
|
-
addCNB(opts: Partial<CNBItem>): CNBItem;
|
|
1802
|
-
clearExpiredCNB(expireTime?: number): void;
|
|
1803
|
-
clearUsername(username: string): void;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
declare const cnbManager: CNBManager;
|
|
1807
|
-
declare const app: QueryRouterServer<{
|
|
1808
|
-
[x: string]: any;
|
|
1809
|
-
}>;
|
|
1810
|
-
declare const notCNBCheck: (ctx: any) => boolean;
|
|
1811
|
-
|
|
1812
|
-
export { app, cnbManager, notCNBCheck };
|