@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
package/dist/routes.js
CHANGED
|
@@ -22853,6 +22853,24 @@ function useCommentEnv() {
|
|
|
22853
22853
|
};
|
|
22854
22854
|
}
|
|
22855
22855
|
|
|
22856
|
+
// src/issue/dashboard.ts
|
|
22857
|
+
class Dashboard extends CNBCore {
|
|
22858
|
+
constructor(options) {
|
|
22859
|
+
super(options);
|
|
22860
|
+
}
|
|
22861
|
+
getMineCreateIssue(params) {
|
|
22862
|
+
const url3 = `${this.hackURL}/user/dashboard/mine_create/issue`;
|
|
22863
|
+
return this.get({
|
|
22864
|
+
url: url3,
|
|
22865
|
+
params,
|
|
22866
|
+
useCookie: true,
|
|
22867
|
+
headers: {
|
|
22868
|
+
Accept: "application/vnd.cnb.web+json"
|
|
22869
|
+
}
|
|
22870
|
+
});
|
|
22871
|
+
}
|
|
22872
|
+
}
|
|
22873
|
+
|
|
22856
22874
|
// src/issue/index.ts
|
|
22857
22875
|
class Issue extends CNBCore {
|
|
22858
22876
|
constructor(options) {
|
|
@@ -23232,6 +23250,83 @@ class PackageManagement extends CNBCore {
|
|
|
23232
23250
|
});
|
|
23233
23251
|
}
|
|
23234
23252
|
}
|
|
23253
|
+
// src/org/index.ts
|
|
23254
|
+
class Organization extends CNBCore {
|
|
23255
|
+
constructor(options) {
|
|
23256
|
+
super(options);
|
|
23257
|
+
}
|
|
23258
|
+
create(params) {
|
|
23259
|
+
return this.post({
|
|
23260
|
+
url: "/groups",
|
|
23261
|
+
data: params
|
|
23262
|
+
});
|
|
23263
|
+
}
|
|
23264
|
+
listTopGroups(params) {
|
|
23265
|
+
return this.get({
|
|
23266
|
+
url: "/user/groups",
|
|
23267
|
+
params
|
|
23268
|
+
});
|
|
23269
|
+
}
|
|
23270
|
+
listGroups(slug, params) {
|
|
23271
|
+
return this.get({
|
|
23272
|
+
url: `/user/groups/${slug}`,
|
|
23273
|
+
params
|
|
23274
|
+
});
|
|
23275
|
+
}
|
|
23276
|
+
getGroupsByUsername(username, params) {
|
|
23277
|
+
return this.get({
|
|
23278
|
+
url: `/users/${username}/groups`,
|
|
23279
|
+
params
|
|
23280
|
+
});
|
|
23281
|
+
}
|
|
23282
|
+
getGroup(group) {
|
|
23283
|
+
return this.get({
|
|
23284
|
+
url: `/${group}`
|
|
23285
|
+
});
|
|
23286
|
+
}
|
|
23287
|
+
updateGroup(group, params) {
|
|
23288
|
+
return this.put({
|
|
23289
|
+
url: `/${group}`,
|
|
23290
|
+
data: params
|
|
23291
|
+
});
|
|
23292
|
+
}
|
|
23293
|
+
deleteGroup(group, identityTicket) {
|
|
23294
|
+
return this.delete({
|
|
23295
|
+
url: `/${group}`,
|
|
23296
|
+
headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
|
|
23297
|
+
});
|
|
23298
|
+
}
|
|
23299
|
+
transfer(group, params) {
|
|
23300
|
+
return this.post({
|
|
23301
|
+
url: `/${group}/-/transfer`,
|
|
23302
|
+
data: params
|
|
23303
|
+
});
|
|
23304
|
+
}
|
|
23305
|
+
uploadLogo(group, params) {
|
|
23306
|
+
return this.post({
|
|
23307
|
+
url: `/${group}/-/upload/logos`,
|
|
23308
|
+
data: params
|
|
23309
|
+
});
|
|
23310
|
+
}
|
|
23311
|
+
getSetting(slug) {
|
|
23312
|
+
return this.get({
|
|
23313
|
+
url: `/${slug}/-/settings`
|
|
23314
|
+
});
|
|
23315
|
+
}
|
|
23316
|
+
updateSetting(slug, params) {
|
|
23317
|
+
return this.put({
|
|
23318
|
+
url: `/${slug}/-/settings`,
|
|
23319
|
+
data: params
|
|
23320
|
+
});
|
|
23321
|
+
}
|
|
23322
|
+
listSubgroups(slug, params) {
|
|
23323
|
+
return this.get({
|
|
23324
|
+
url: `/${slug}/-/sub-groups`,
|
|
23325
|
+
params
|
|
23326
|
+
});
|
|
23327
|
+
}
|
|
23328
|
+
}
|
|
23329
|
+
|
|
23235
23330
|
// src/index.ts
|
|
23236
23331
|
class CNB extends CNBCore {
|
|
23237
23332
|
workspace;
|
|
@@ -23244,6 +23339,8 @@ class CNB extends CNBCore {
|
|
|
23244
23339
|
ai;
|
|
23245
23340
|
labels;
|
|
23246
23341
|
packages;
|
|
23342
|
+
org;
|
|
23343
|
+
dashboard;
|
|
23247
23344
|
constructor(options) {
|
|
23248
23345
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
23249
23346
|
this.init(options);
|
|
@@ -23270,6 +23367,8 @@ class CNB extends CNBCore {
|
|
|
23270
23367
|
registry: new RegistryPackage(options),
|
|
23271
23368
|
package: new PackageManagement(options)
|
|
23272
23369
|
};
|
|
23370
|
+
this.org = new Organization(options);
|
|
23371
|
+
this.dashboard = new Dashboard(options);
|
|
23273
23372
|
}
|
|
23274
23373
|
setToken(token) {
|
|
23275
23374
|
this.token = token;
|
|
@@ -23283,6 +23382,8 @@ class CNB extends CNBCore {
|
|
|
23283
23382
|
this.labels.issueLabel.token = token;
|
|
23284
23383
|
this.packages.registry.token = token;
|
|
23285
23384
|
this.packages.package.token = token;
|
|
23385
|
+
this.org.token = token;
|
|
23386
|
+
this.dashboard.token = token;
|
|
23286
23387
|
}
|
|
23287
23388
|
setCookie(cookie) {
|
|
23288
23389
|
this.cookie = cookie;
|
|
@@ -23296,6 +23397,8 @@ class CNB extends CNBCore {
|
|
|
23296
23397
|
this.labels.issueLabel.cookie = cookie;
|
|
23297
23398
|
this.packages.registry.cookie = cookie;
|
|
23298
23399
|
this.packages.package.cookie = cookie;
|
|
23400
|
+
this.org.cookie = cookie;
|
|
23401
|
+
this.dashboard.cookie = cookie;
|
|
23299
23402
|
}
|
|
23300
23403
|
getCNBVersion = getCNBVersion;
|
|
23301
23404
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,11 +4,12 @@ import { KnowledgeBase } from "./knowledge/index.ts";
|
|
|
4
4
|
import { Repo } from "./repo/index.ts";
|
|
5
5
|
import { User } from "./user/index.ts";
|
|
6
6
|
import { Build } from "./build/index.ts";
|
|
7
|
-
import { Issue } from "./issue/index.ts";
|
|
7
|
+
import { Issue, Dashboard } from "./issue/index.ts";
|
|
8
8
|
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,8 @@ export class CNB extends CNBCore {
|
|
|
30
31
|
registry: RegistryPackage;
|
|
31
32
|
package: PackageManagement;
|
|
32
33
|
};
|
|
34
|
+
org!: Organization;
|
|
35
|
+
dashboard!: Dashboard;
|
|
33
36
|
constructor(options: CNBOptions) {
|
|
34
37
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
35
38
|
this.init(options);
|
|
@@ -56,6 +59,8 @@ export class CNB extends CNBCore {
|
|
|
56
59
|
registry: new RegistryPackage(options),
|
|
57
60
|
package: new PackageManagement(options),
|
|
58
61
|
};
|
|
62
|
+
this.org = new Organization(options);
|
|
63
|
+
this.dashboard = new Dashboard(options);
|
|
59
64
|
}
|
|
60
65
|
setToken(token: string) {
|
|
61
66
|
this.token = token;
|
|
@@ -69,6 +74,8 @@ export class CNB extends CNBCore {
|
|
|
69
74
|
this.labels.issueLabel.token = token;
|
|
70
75
|
this.packages.registry.token = token;
|
|
71
76
|
this.packages.package.token = token;
|
|
77
|
+
this.org.token = token;
|
|
78
|
+
this.dashboard.token = token;
|
|
72
79
|
}
|
|
73
80
|
setCookie(cookie: string) {
|
|
74
81
|
this.cookie = cookie;
|
|
@@ -82,6 +89,8 @@ export class CNB extends CNBCore {
|
|
|
82
89
|
this.labels.issueLabel.cookie = cookie;
|
|
83
90
|
this.packages.registry.cookie = cookie;
|
|
84
91
|
this.packages.package.cookie = cookie;
|
|
92
|
+
this.org.cookie = cookie;
|
|
93
|
+
this.dashboard.cookie = cookie;
|
|
85
94
|
}
|
|
86
95
|
getCNBVersion = getCNBVersion
|
|
87
96
|
}
|
|
@@ -109,4 +118,5 @@ type VersionInfo = {
|
|
|
109
118
|
|
|
110
119
|
export * from './issue/npc/env.ts'
|
|
111
120
|
export * from './labels/index.ts'
|
|
112
|
-
export * from './package/index.ts'
|
|
121
|
+
export * from './package/index.ts'
|
|
122
|
+
export * from './org/index.ts'
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CNBCore, CNBCoreOptions, Result } from "../cnb-core.ts";
|
|
2
|
+
|
|
3
|
+
export type DashboardTodoStatus = 'pending' | 'processing' | 'completed';
|
|
4
|
+
|
|
5
|
+
export type DashboardIssueItem = {
|
|
6
|
+
todo_id: string;
|
|
7
|
+
pinned: boolean;
|
|
8
|
+
number: number;
|
|
9
|
+
slug: string;
|
|
10
|
+
slug_freeze: boolean;
|
|
11
|
+
title: string;
|
|
12
|
+
state: string;
|
|
13
|
+
priority: string;
|
|
14
|
+
labels: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
color: string;
|
|
18
|
+
}[];
|
|
19
|
+
associated_pull_request_counts: number;
|
|
20
|
+
comment_count: number;
|
|
21
|
+
creator: {
|
|
22
|
+
username: string;
|
|
23
|
+
nickname: string;
|
|
24
|
+
freeze: boolean;
|
|
25
|
+
};
|
|
26
|
+
author_context: Record<string, any>;
|
|
27
|
+
created_time: string;
|
|
28
|
+
updated_time: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type DashboardMineCreateIssue = {
|
|
32
|
+
// 'issue'
|
|
33
|
+
todo_type: string;
|
|
34
|
+
issue_datas: DashboardIssueItem[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class Dashboard extends CNBCore {
|
|
38
|
+
constructor(options: CNBCoreOptions) {
|
|
39
|
+
super(options);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 获取我创建的 Issue 仪表盘
|
|
44
|
+
* @param params
|
|
45
|
+
* @param params.todoStatus - 待办状态: pending | processing | completed
|
|
46
|
+
* @param params.page - 页码,默认 1
|
|
47
|
+
* @param params.page_size - 每页数量,默认 20
|
|
48
|
+
*/
|
|
49
|
+
getMineCreateIssue(params?: {
|
|
50
|
+
todoStatus?: DashboardTodoStatus;
|
|
51
|
+
page?: number;
|
|
52
|
+
page_size?: number;
|
|
53
|
+
}): Promise<Result<DashboardMineCreateIssue>> {
|
|
54
|
+
const url = `${this.hackURL}/user/dashboard/mine_create/issue`;
|
|
55
|
+
return this.get({
|
|
56
|
+
url,
|
|
57
|
+
params,
|
|
58
|
+
useCookie: true,
|
|
59
|
+
headers: {
|
|
60
|
+
'Accept': 'application/vnd.cnb.web+json',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/issue/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts";
|
|
2
2
|
import { extractAliveInfo } from "./issue-alive.ts";
|
|
3
3
|
import { useNPCEnv, useCommentEnv, usePullRequestEnv, useRepoInfoEnv } from "./npc/env.ts";
|
|
4
|
+
export { Dashboard, type DashboardIssueItem, type DashboardMineCreateIssue, type DashboardTodoStatus } from "./dashboard.ts";
|
|
4
5
|
export type IssueAssignee = {
|
|
5
6
|
nickname: string;
|
|
6
7
|
username: string;
|