@vite-hub/forge 0.0.0-stage → 0.1.0
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/LICENSE +201 -0
- package/README.md +78 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh.js +19 -0
- package/dist/events-7EBoeIPd-A2RUkJi5.js +354 -0
- package/dist/events-CRaLy7U3-3PNNp5WZ.js +214 -0
- package/dist/events-CeChclTf-CX-gD8oy.js +527 -0
- package/dist/events-DudKM7vq-Cj_PCDdt.js +124 -0
- package/dist/events-saDWbqbf-VX_k8jtr.js +131 -0
- package/dist/feed-CmBoYS3Z-CuC4i0fH.js +134 -0
- package/dist/feed-DsC7Vws1-M_de2nSK.js +248 -0
- package/dist/feed-Dyf730Ys-D0HgBba6.js +179 -0
- package/dist/forgejo-BN8ItCfl.js +2282 -0
- package/dist/gitee-DExkQP6X-BxJS2dRY.js +113 -0
- package/dist/github-DtncTfmv.js +4161 -0
- package/dist/gitlab-BoDm8-BC.js +2532 -0
- package/dist/graphql-DG5aJBT3-DceyFYdM.js +489 -0
- package/dist/index.d.ts +3918 -0
- package/dist/index.js +681 -0
- package/dist/knot-BpyTK9D7-CVIsX4I2.js +343 -0
- package/dist/tangled-DPt_0u21-zS41xdG5.js +43 -0
- package/dist/templates-Bn8a-pd2-D9DhJEVD.js +125 -0
- package/dist/utils-CA_4WJhJ-DNgT61X2.js +1517 -0
- package/dist/webhooks-DgHwxxYz-D1V2LOr1.js +1569 -0
- package/package.json +56 -3
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { $ as toDate } from "./utils-CA_4WJhJ-DNgT61X2.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/gitee-DExkQP6X.mjs
|
|
3
|
+
const FORGE = "gitee";
|
|
4
|
+
function toActor(instance, user) {
|
|
5
|
+
if (!user) return;
|
|
6
|
+
return {
|
|
7
|
+
forge: FORGE,
|
|
8
|
+
instance,
|
|
9
|
+
login: user.login,
|
|
10
|
+
id: String(user.id),
|
|
11
|
+
name: user.name,
|
|
12
|
+
avatarUrl: user.avatar_url,
|
|
13
|
+
url: user.html_url,
|
|
14
|
+
typeRaw: user.type,
|
|
15
|
+
isBotHint: user.type === "Bot" || /\[bot\]$|-bot$/i.test(user.login)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function toRepoRef(instance, repo) {
|
|
19
|
+
const [owner = repo.namespace?.path ?? "", name = repo.path] = repo.full_name.split("/");
|
|
20
|
+
return {
|
|
21
|
+
forge: FORGE,
|
|
22
|
+
instance,
|
|
23
|
+
owner,
|
|
24
|
+
name,
|
|
25
|
+
externalId: String(repo.id)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Gitee issues are `open`, `progressing`, `closed` or `rejected`; progressing work is still open. */
|
|
29
|
+
function toLabel(raw) {
|
|
30
|
+
return {
|
|
31
|
+
name: raw.name,
|
|
32
|
+
colour: raw.color ?? void 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function issueState(state) {
|
|
36
|
+
return state === "open" || state === "progressing" ? "open" : state === "closed" || state === "rejected" ? "closed" : "unknown";
|
|
37
|
+
}
|
|
38
|
+
function toIssueThread(ref, raw) {
|
|
39
|
+
const instance = ref.instance;
|
|
40
|
+
return {
|
|
41
|
+
ref: {
|
|
42
|
+
...ref,
|
|
43
|
+
kind: "issue",
|
|
44
|
+
number: raw.number,
|
|
45
|
+
externalId: String(raw.id)
|
|
46
|
+
},
|
|
47
|
+
kind: "issue",
|
|
48
|
+
title: raw.title,
|
|
49
|
+
body: raw.body ?? void 0,
|
|
50
|
+
state: issueState(raw.state),
|
|
51
|
+
stateRaw: raw.state,
|
|
52
|
+
stateReason: raw.state === "rejected" ? "not_planned" : void 0,
|
|
53
|
+
isDraft: false,
|
|
54
|
+
author: toActor(instance, raw.user),
|
|
55
|
+
assignees: raw.assignee ? [toActor(instance, raw.assignee)] : [],
|
|
56
|
+
reviewers: [],
|
|
57
|
+
labels: (raw.labels ?? []).map(toLabel),
|
|
58
|
+
url: raw.html_url,
|
|
59
|
+
createdAt: toDate(raw.created_at),
|
|
60
|
+
updatedAt: toDate(raw.updated_at),
|
|
61
|
+
closedAt: toDate(raw.finished_at),
|
|
62
|
+
lastActivityAt: toDate(raw.updated_at),
|
|
63
|
+
commentCount: raw.comments,
|
|
64
|
+
raw
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function toPullThread(ref, raw) {
|
|
68
|
+
const instance = ref.instance;
|
|
69
|
+
const state = raw.merged_at || raw.state === "merged" ? "merged" : raw.state === "open" ? "open" : raw.state === "closed" ? "closed" : "unknown";
|
|
70
|
+
return {
|
|
71
|
+
ref: {
|
|
72
|
+
...ref,
|
|
73
|
+
kind: "pull_request",
|
|
74
|
+
number: String(raw.number),
|
|
75
|
+
externalId: String(raw.id)
|
|
76
|
+
},
|
|
77
|
+
kind: "pull_request",
|
|
78
|
+
title: raw.title,
|
|
79
|
+
body: raw.body ?? void 0,
|
|
80
|
+
state,
|
|
81
|
+
stateRaw: raw.state,
|
|
82
|
+
isDraft: raw.draft ?? false,
|
|
83
|
+
author: toActor(instance, raw.user),
|
|
84
|
+
assignees: [],
|
|
85
|
+
reviewers: (raw.assignees ?? []).map((reviewer) => ({
|
|
86
|
+
actor: toActor(instance, reviewer),
|
|
87
|
+
state: reviewer.accept ? "approved" : "pending",
|
|
88
|
+
stateRaw: reviewer.accept ? "accepted" : "requested"
|
|
89
|
+
})),
|
|
90
|
+
labels: (raw.labels ?? []).map(toLabel),
|
|
91
|
+
url: raw.html_url,
|
|
92
|
+
createdAt: toDate(raw.created_at),
|
|
93
|
+
updatedAt: toDate(raw.updated_at),
|
|
94
|
+
closedAt: toDate(raw.closed_at),
|
|
95
|
+
mergedAt: toDate(raw.merged_at),
|
|
96
|
+
lastActivityAt: toDate(raw.updated_at),
|
|
97
|
+
locked: raw.locked,
|
|
98
|
+
branches: raw.head && raw.base ? {
|
|
99
|
+
head: {
|
|
100
|
+
ref: raw.head.ref,
|
|
101
|
+
sha: raw.head.sha,
|
|
102
|
+
repo: raw.head.repo ? toRepoRef(instance, raw.head.repo) : void 0
|
|
103
|
+
},
|
|
104
|
+
base: {
|
|
105
|
+
ref: raw.base.ref,
|
|
106
|
+
sha: raw.base.sha
|
|
107
|
+
}
|
|
108
|
+
} : void 0,
|
|
109
|
+
raw
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { toRepoRef as a, toPullThread as i, toActor as n, toIssueThread as r, FORGE as t };
|