@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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3918 @@
|
|
|
1
|
+
//#region src/env.d.ts
|
|
2
|
+
/** One Server Env value of a Forge. */
|
|
3
|
+
interface ForgeEnvField {
|
|
4
|
+
/** Host variable names in lookup order. The `VITEHUB_` name comes first, then the `forges` name. */
|
|
5
|
+
names: readonly [string, ...string[]];
|
|
6
|
+
secret?: true;
|
|
7
|
+
}
|
|
8
|
+
/** Server Env fields of each Forge. */
|
|
9
|
+
type ForgeEnv = {
|
|
10
|
+
github: Record<"appId" | "installationId" | "appOwner" | "appInstallations" | "privateKey" | "privateKeyPath" | "token" | "webhookSecret", ForgeEnvField>;
|
|
11
|
+
gitlab: Record<"baseUrl" | "token" | "webhookSecret", ForgeEnvField>;
|
|
12
|
+
forgejo: Record<"baseUrl" | "token" | "webhookSecret", ForgeEnvField>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Server Env of each Forge, keyed by the `env.server.<forge>.<field>` path.
|
|
16
|
+
* Channels, Capabilities, Workspaces and Sources read the same names.
|
|
17
|
+
* `FORGES_*` names are the ones that `forgesFromEnv()` in the `forges` library reads.
|
|
18
|
+
* Fields without a `forges` equivalent have only a `VITEHUB_` name.
|
|
19
|
+
*/
|
|
20
|
+
export declare const forgeEnv: ForgeEnv;
|
|
21
|
+
/**
|
|
22
|
+
* The first value of `field` that is set, in its lookup order.
|
|
23
|
+
* `env` is a record, such as `process.env`, or a reader, such as a Cloudflare binding lookup. Default: `process.env`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readForgeEnv(field: ForgeEnvField, env?: Record<string, unknown> | ((name: string) => unknown)): string | undefined;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/model-C_dXr71E.d.mts
|
|
28
|
+
//#region src/model.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* Every public type in this module is JSON-serialisable except `Date`, which
|
|
31
|
+
* serialises to an ISO 8601 string through `JSON.stringify`, and the bytes of
|
|
32
|
+
* a binary {@link FileContent}. `raw` and `payload` fields hold the forge's
|
|
33
|
+
* own JSON.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Identifier of a forge implementation. Unknown forges are permitted so that
|
|
37
|
+
* third-party providers can be registered without a core release.
|
|
38
|
+
*/
|
|
39
|
+
type ForgeKind$1 = KnownForgeKind | (string & {});
|
|
40
|
+
/** The forges this package ships providers for. */
|
|
41
|
+
type KnownForgeKind = "github" | "gitlab" | "bitbucket" | "forgejo" | "gitea" | "tangled" | "gitee" | "azure-devops" | "cursor-origin" | "pushin" | "cloudflare-artifacts" | "sourcehut";
|
|
42
|
+
/**
|
|
43
|
+
* Capability flag. Every value other than `false` and `'not_applicable'` means the
|
|
44
|
+
* operation is available:
|
|
45
|
+
*
|
|
46
|
+
* - `true`: native.
|
|
47
|
+
* - `'emulated'`: composed from other calls, so it costs more requests or the
|
|
48
|
+
* result is approximate.
|
|
49
|
+
* - `false`: not available, for any reason.
|
|
50
|
+
* - `'not_applicable'`: the forge has no such operation, so there is nothing to
|
|
51
|
+
* implement.
|
|
52
|
+
*/
|
|
53
|
+
type Support = boolean | "emulated" | "not_applicable";
|
|
54
|
+
/** Host of a single forge deployment, for example `github.com` or `codeberg.org`. */
|
|
55
|
+
type ForgeInstance = string;
|
|
56
|
+
/** Where an object comes from: the forge and the instance of that forge. */
|
|
57
|
+
interface ForgeOrigin {
|
|
58
|
+
forge: ForgeKind$1;
|
|
59
|
+
/** The host of the instance, such as `github.com` or `git.example.com`. */
|
|
60
|
+
instance: ForgeInstance;
|
|
61
|
+
}
|
|
62
|
+
/** Addresses a repository by its forge, instance, owner and name. */
|
|
63
|
+
interface RepoRef extends ForgeOrigin {
|
|
64
|
+
/**
|
|
65
|
+
* Full namespace path. On forges with nested groups (GitLab) this contains
|
|
66
|
+
* slashes, for example `acme/platform`; `name` never does.
|
|
67
|
+
*/
|
|
68
|
+
owner: string;
|
|
69
|
+
/** Repository name. Empty for namespace-scoped refs. */
|
|
70
|
+
name: string;
|
|
71
|
+
/**
|
|
72
|
+
* `'namespace'` for an organisation, group, workspace or project, and for subjects that belong to one rather than
|
|
73
|
+
* to a repository (GitLab epics). Absent means a repository. {@link namespaceRef} builds a namespace ref.
|
|
74
|
+
*/
|
|
75
|
+
kind?: "repo" | "namespace";
|
|
76
|
+
/**
|
|
77
|
+
* Stable forge-native identifier that survives renames and transfers: a
|
|
78
|
+
* GitHub, Forgejo or Gitea numeric id, a GitLab project or group id, a
|
|
79
|
+
* Bitbucket UUID or a Tangled repo DID. {@link repoKey} prefers it over
|
|
80
|
+
* `owner` and `name`.
|
|
81
|
+
*/
|
|
82
|
+
externalId?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Who can see a repository. */
|
|
85
|
+
type RepoVisibility = "public" | "private" | "internal";
|
|
86
|
+
/** The authenticated account's access to a repository. */
|
|
87
|
+
interface RepoPermissions {
|
|
88
|
+
/** Full administrative access. */
|
|
89
|
+
admin: boolean;
|
|
90
|
+
/** Manage the repository without access to sensitive or destructive settings. */
|
|
91
|
+
maintain: boolean;
|
|
92
|
+
push: boolean;
|
|
93
|
+
/** Manage issues and pull requests without write access. */
|
|
94
|
+
triage: boolean;
|
|
95
|
+
/** Read and clone the repository. */
|
|
96
|
+
pull: boolean;
|
|
97
|
+
}
|
|
98
|
+
/** Which subjects a repository has switched on, where the forge makes them per repository. */
|
|
99
|
+
interface RepoFeatures {
|
|
100
|
+
issues: boolean;
|
|
101
|
+
pullRequests: boolean;
|
|
102
|
+
discussions: boolean;
|
|
103
|
+
wiki: boolean;
|
|
104
|
+
projects: boolean;
|
|
105
|
+
releases: boolean;
|
|
106
|
+
}
|
|
107
|
+
/** A collaborator's role, highest first. `'none'` is an explicit absence of access. */
|
|
108
|
+
type RepoRole = "admin" | "maintain" | "write" | "triage" | "read" | "none";
|
|
109
|
+
/** An account with a role on a repository. */
|
|
110
|
+
interface Collaborator {
|
|
111
|
+
actor: Actor;
|
|
112
|
+
role: RepoRole;
|
|
113
|
+
/** Forge-native role name, for example `maintainer` or `reporter`. */
|
|
114
|
+
roleRaw?: string;
|
|
115
|
+
/** What the role allows. */
|
|
116
|
+
permissions?: RepoPermissions;
|
|
117
|
+
raw: unknown;
|
|
118
|
+
}
|
|
119
|
+
/** A commit author on a repository, as `repos.contributors()` reads it. */
|
|
120
|
+
interface Contributor {
|
|
121
|
+
/** The account, where the forge links the author to one. */
|
|
122
|
+
actor?: Actor;
|
|
123
|
+
/** The git author name, where the forge reports one. */
|
|
124
|
+
name?: string;
|
|
125
|
+
/** The git author email, where the forge reports one. */
|
|
126
|
+
email?: string;
|
|
127
|
+
/** Commits attributed to the contributor, as the forge counts them. */
|
|
128
|
+
contributions: number;
|
|
129
|
+
raw: unknown;
|
|
130
|
+
}
|
|
131
|
+
/** A contributor's commit activity over time, as `repos.contributorStats()` reads it. */
|
|
132
|
+
interface ContributorStats {
|
|
133
|
+
/** The account, where the forge links the commits to one. */
|
|
134
|
+
actor?: Actor;
|
|
135
|
+
/** Commits by the contributor across all weeks. */
|
|
136
|
+
commits: number;
|
|
137
|
+
/** One entry per week, oldest first. */
|
|
138
|
+
weeks: ContributorWeek[];
|
|
139
|
+
raw: unknown;
|
|
140
|
+
}
|
|
141
|
+
/** One week of a contributor's commit activity. */
|
|
142
|
+
interface ContributorWeek {
|
|
143
|
+
/** Start of the week. */
|
|
144
|
+
week: Date;
|
|
145
|
+
/** Lines added. */
|
|
146
|
+
additions: number;
|
|
147
|
+
/** Lines deleted. */
|
|
148
|
+
deletions: number;
|
|
149
|
+
/** Commits that week. */
|
|
150
|
+
commits: number;
|
|
151
|
+
}
|
|
152
|
+
/** An issue or pull request template of a repository, as `repos.templates()` reads it. */
|
|
153
|
+
interface RepoTemplate {
|
|
154
|
+
/** What the template opens. */
|
|
155
|
+
kind: "issue" | "pull_request";
|
|
156
|
+
/** The name of the template, where the forge's API parses one, or its file name. */
|
|
157
|
+
name: string;
|
|
158
|
+
/** The file the template lives in. Not available on GitLab. */
|
|
159
|
+
path?: string;
|
|
160
|
+
/** `'form'` for a form written in YAML, `'markdown'` for the rest. */
|
|
161
|
+
format: "markdown" | "form";
|
|
162
|
+
/** The template as the repository stores it: Markdown with any front matter, or the YAML of a form. */
|
|
163
|
+
body: string;
|
|
164
|
+
/** The title a new thread starts with, where the forge parses one. */
|
|
165
|
+
title?: string;
|
|
166
|
+
/** What the template is for, where the forge parses it. */
|
|
167
|
+
about?: string;
|
|
168
|
+
/** Labels a new thread gets, where the forge parses them. */
|
|
169
|
+
labels?: string[];
|
|
170
|
+
/** The fields of a form, where the forge parses them. */
|
|
171
|
+
fields?: RepoTemplateField[];
|
|
172
|
+
/** Where the template comes from when the forge falls back to another repository, like GitHub's `.github`. */
|
|
173
|
+
source?: RepoRef;
|
|
174
|
+
raw: unknown;
|
|
175
|
+
}
|
|
176
|
+
/** One field of an issue form, as the forge parses it. */
|
|
177
|
+
interface RepoTemplateField {
|
|
178
|
+
/** The kind of input, such as `'input'`, `'textarea'`, `'dropdown'`, `'checkboxes'` or `'markdown'`. */
|
|
179
|
+
type: string;
|
|
180
|
+
id?: string;
|
|
181
|
+
/** The field's label, description, options and default value, as the form declares them. */
|
|
182
|
+
attributes: Record<string, unknown>;
|
|
183
|
+
/** Whether the field is required, and other checks the form declares. */
|
|
184
|
+
validations?: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
/** What `repos.addCollaborator()` did. */
|
|
187
|
+
interface AddCollaboratorResult {
|
|
188
|
+
/**
|
|
189
|
+
* `'invited'` when the account has to accept an invitation before it has the role, `'added'` when it has the
|
|
190
|
+
* role now, including an account that already had access.
|
|
191
|
+
*/
|
|
192
|
+
status: "invited" | "added";
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Reference to a team of an organisation. A team belongs to the organisation,
|
|
196
|
+
* not to a repository, so the ref carries the namespace ref of the
|
|
197
|
+
* organisation rather than a repository.
|
|
198
|
+
*/
|
|
199
|
+
interface TeamRef extends ForgeOrigin {
|
|
200
|
+
/** The organisation, group or workspace the team belongs to. */
|
|
201
|
+
org: RepoRef;
|
|
202
|
+
/** Forge-native team id. Where it is set, `orgs.teamMembers()` prefers it to `slug` on forges that address teams by id. */
|
|
203
|
+
id?: string;
|
|
204
|
+
/**
|
|
205
|
+
* URL-safe identifier unique within the organisation. GitHub has a slug; on
|
|
206
|
+
* GitLab it is the subgroup's path below the group, such as `platform/web`;
|
|
207
|
+
* Forgejo and Gitea have none, so the team's name stands in.
|
|
208
|
+
*/
|
|
209
|
+
slug: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A team of an organisation, as `orgs.teams()` lists them. GitLab has no teams
|
|
213
|
+
* of its own, so a subgroup plays the role of one.
|
|
214
|
+
*/
|
|
215
|
+
interface Team {
|
|
216
|
+
ref: TeamRef;
|
|
217
|
+
name: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
/** Forge-native repository permission the team grants, where the forge reports one. */
|
|
220
|
+
permission?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Forge-native privacy or visibility value, where the forge reports one:
|
|
223
|
+
* GitHub's `privacy` (`closed` or `secret`), or a GitLab subgroup's
|
|
224
|
+
* `visibility` (`public`, `internal` or `private`).
|
|
225
|
+
*/
|
|
226
|
+
visibilityRaw?: string;
|
|
227
|
+
/**
|
|
228
|
+
* The team's parent team, where the forge nests teams: a GitHub parent team,
|
|
229
|
+
* or the GitLab subgroup a nested subgroup belongs to.
|
|
230
|
+
*/
|
|
231
|
+
parent?: TeamRef;
|
|
232
|
+
/** Web page of the team, where the forge has one. */
|
|
233
|
+
url?: string;
|
|
234
|
+
raw: unknown;
|
|
235
|
+
}
|
|
236
|
+
/** A repository as every forge reports it. Fields that not every forge has, such as `openPullCount`, are optional. */
|
|
237
|
+
interface Repo {
|
|
238
|
+
ref: RepoRef;
|
|
239
|
+
/** The repository's name where `ref.name` is an identifier rather than the name (a Tangled record key). */
|
|
240
|
+
displayName?: string;
|
|
241
|
+
description?: string;
|
|
242
|
+
defaultBranch?: string;
|
|
243
|
+
/** Who can see the repository. */
|
|
244
|
+
visibility: RepoVisibility;
|
|
245
|
+
visibilityRaw?: string;
|
|
246
|
+
isFork: boolean;
|
|
247
|
+
/** The repository is archived and read-only. */
|
|
248
|
+
isArchived: boolean;
|
|
249
|
+
/** The repository that this one was forked from. */
|
|
250
|
+
parent?: RepoRef;
|
|
251
|
+
/** Topics, also called tags, that describe the repository. */
|
|
252
|
+
topics: string[];
|
|
253
|
+
url?: string;
|
|
254
|
+
/** Git remotes. Tangled maps the hosting knot to its SSH host. */
|
|
255
|
+
cloneUrls?: {
|
|
256
|
+
https?: string;
|
|
257
|
+
ssh?: string;
|
|
258
|
+
};
|
|
259
|
+
createdAt?: Date;
|
|
260
|
+
updatedAt?: Date;
|
|
261
|
+
/** Last push, where the listing endpoint reports it. */
|
|
262
|
+
pushedAt?: Date;
|
|
263
|
+
/**
|
|
264
|
+
* Open issues only, never combined with pull requests. Absent where the
|
|
265
|
+
* forge reports only the combined count (GitHub).
|
|
266
|
+
*/
|
|
267
|
+
openIssueCount?: number;
|
|
268
|
+
/** The number of open pull requests, where the forge reports it. */
|
|
269
|
+
openPullCount?: number;
|
|
270
|
+
/** The account or organisation that owns the repository, where the forge reports one. */
|
|
271
|
+
owner?: Actor;
|
|
272
|
+
/** Primary language, as the forge detects it. */
|
|
273
|
+
language?: string;
|
|
274
|
+
/** Project website, apart from the repository's own `url`. */
|
|
275
|
+
homepage?: string;
|
|
276
|
+
/**
|
|
277
|
+
* SPDX identifier of the licence the forge detects, for example `MIT`. SPDX identifiers are case-insensitive, and
|
|
278
|
+
* GitLab reports them in lower case, such as `mit`.
|
|
279
|
+
*/
|
|
280
|
+
licence?: string;
|
|
281
|
+
stars?: number;
|
|
282
|
+
forks?: number;
|
|
283
|
+
/** Accounts watching the repository's activity, apart from stars. */
|
|
284
|
+
watchers?: number;
|
|
285
|
+
/** What the authenticated account may do. */
|
|
286
|
+
permissions?: RepoPermissions;
|
|
287
|
+
/** Merge methods the repository allows, where the forge reports them. Empty means the forge reported none. */
|
|
288
|
+
mergeMethods?: MergeMethod[];
|
|
289
|
+
/** The repository's default merge method, where the forge reports one. On GitLab, a project that squashes by default reports `squash`, not its base method. */
|
|
290
|
+
defaultMergeMethod?: MergeMethod;
|
|
291
|
+
/** The repository's setting for deleting the head branch after a merge, where the forge reports it. Forgejo and Gitea before 1.25 apply it only in their web UI, so `merge()` keeps the branch there. On GitLab it seeds merge requests when they are opened. */
|
|
292
|
+
deleteBranchOnMerge?: boolean;
|
|
293
|
+
/** Default text of a merge commit (`merge`) and a squashed one (`squash`) as `MergeCommitDefaults`, where the forge reports it. */
|
|
294
|
+
mergeCommit?: {
|
|
295
|
+
merge?: MergeCommitDefaults;
|
|
296
|
+
squash?: MergeCommitDefaults;
|
|
297
|
+
};
|
|
298
|
+
features?: RepoFeatures;
|
|
299
|
+
raw: unknown;
|
|
300
|
+
}
|
|
301
|
+
/** Kind of thread. */
|
|
302
|
+
type ThreadKind = "issue" | "pull_request" | "discussion";
|
|
303
|
+
/**
|
|
304
|
+
* Reference to a thread. A thread `number` is unique only within its repo, so
|
|
305
|
+
* the repo is always carried alongside it.
|
|
306
|
+
*/
|
|
307
|
+
interface ThreadRef extends ForgeOrigin {
|
|
308
|
+
repo: RepoRef;
|
|
309
|
+
kind: ThreadKind;
|
|
310
|
+
/** Forge-native subject type, for example `PullRequest` or `MergeRequest`. */
|
|
311
|
+
typeRaw?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Per-repo thread number. Absent when the forge did not identify the
|
|
314
|
+
* thread; such a ref cannot be fetched or keyed until enriched.
|
|
315
|
+
*/
|
|
316
|
+
number?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Human-facing per-repo number, when it differs from `number`. Tangled
|
|
319
|
+
* identifies threads by AT-URI but shows numbers in its UI and webhooks.
|
|
320
|
+
*/
|
|
321
|
+
displayNumber?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Globally unique forge-native identifier, where one exists: a GitHub
|
|
324
|
+
* `node_id`, a GitLab global id, or an atproto record URI.
|
|
325
|
+
*/
|
|
326
|
+
externalId?: string;
|
|
327
|
+
}
|
|
328
|
+
/** A release, as a notification subject or event target. */
|
|
329
|
+
interface ReleaseRef extends ForgeOrigin {
|
|
330
|
+
repo: RepoRef;
|
|
331
|
+
/** Forge-native release id; the tag name on forges that key releases by tag. */
|
|
332
|
+
id: string;
|
|
333
|
+
tag?: string;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Reference to a registered webhook. `target` is the repository, or a
|
|
337
|
+
* namespace ref ({@link namespaceRef}) for an organisation or workspace hook.
|
|
338
|
+
*/
|
|
339
|
+
interface WebhookRef extends ForgeOrigin {
|
|
340
|
+
/** The repository or namespace that the hook is registered on. */
|
|
341
|
+
target: RepoRef;
|
|
342
|
+
/** Forge-native hook id. */
|
|
343
|
+
id: string;
|
|
344
|
+
}
|
|
345
|
+
/** Reference to one delivery of a webhook. */
|
|
346
|
+
interface WebhookDeliveryRef extends ForgeOrigin {
|
|
347
|
+
hook: WebhookRef;
|
|
348
|
+
id: string;
|
|
349
|
+
/** Delivery guid, where the forge needs it to redeliver. */
|
|
350
|
+
guid?: string;
|
|
351
|
+
}
|
|
352
|
+
/** A normalised event a provider can deliver, optionally narrowed to one action. */
|
|
353
|
+
interface WebhookEventType {
|
|
354
|
+
kind: EventKind;
|
|
355
|
+
action?: EventAction;
|
|
356
|
+
}
|
|
357
|
+
/** A registered webhook. The secret is never readable, so it is never returned. */
|
|
358
|
+
interface Webhook {
|
|
359
|
+
ref: WebhookRef;
|
|
360
|
+
url: string;
|
|
361
|
+
/** Normalised kinds the subscription covers, derived from `nativeEvents`. */
|
|
362
|
+
events: EventKind[];
|
|
363
|
+
/** Forge-native event names exactly as the forge stores them. */
|
|
364
|
+
nativeEvents: string[];
|
|
365
|
+
active: boolean;
|
|
366
|
+
/** `'json'` or `'form'` where the forge offers a choice. */
|
|
367
|
+
contentType?: "json" | "form";
|
|
368
|
+
createdAt?: Date;
|
|
369
|
+
updatedAt?: Date;
|
|
370
|
+
/** Never returned: no forge reads a webhook secret back. */
|
|
371
|
+
secret?: never;
|
|
372
|
+
raw: unknown;
|
|
373
|
+
}
|
|
374
|
+
/** What `webhooks.create()` needs to register a hook. */
|
|
375
|
+
interface WebhookInput {
|
|
376
|
+
url: string;
|
|
377
|
+
/** Normalised kinds, translated to the forge's own event names. */
|
|
378
|
+
events?: EventKind[];
|
|
379
|
+
/** Forge-native event names, sent as given and merged with the translation of `events`. */
|
|
380
|
+
nativeEvents?: string[];
|
|
381
|
+
/** The secret that signs the deliveries. */
|
|
382
|
+
secret?: string;
|
|
383
|
+
/** How to encode the delivery body. */
|
|
384
|
+
contentType?: "json" | "form";
|
|
385
|
+
/**
|
|
386
|
+
* @default true
|
|
387
|
+
*/
|
|
388
|
+
active?: boolean;
|
|
389
|
+
}
|
|
390
|
+
/** A change to a registered webhook. Fields left out are left as they are. */
|
|
391
|
+
type WebhookUpdate = Partial<WebhookInput>;
|
|
392
|
+
/** One recorded delivery attempt. */
|
|
393
|
+
interface WebhookDeliveryRecord {
|
|
394
|
+
ref: WebhookDeliveryRef;
|
|
395
|
+
/** Forge-native event name of the delivery. */
|
|
396
|
+
event: string;
|
|
397
|
+
/** The HTTP status that the receiver answered with. */
|
|
398
|
+
status: number;
|
|
399
|
+
/** `true` when the forge considered the delivery successful. */
|
|
400
|
+
ok: boolean;
|
|
401
|
+
deliveredAt?: Date;
|
|
402
|
+
/** Round trip in milliseconds, where the forge reports it. */
|
|
403
|
+
duration?: number;
|
|
404
|
+
raw: unknown;
|
|
405
|
+
}
|
|
406
|
+
/** What an alert is about. `other` is a kind that the model does not name. */
|
|
407
|
+
type SecurityAlertKind = "dependency" | "code_scanning" | "secret" | "advisory" | "other";
|
|
408
|
+
/** A security alert: a vulnerable dependency, a code scanning result, a leaked secret or an advisory. */
|
|
409
|
+
interface SecurityAlertRef extends ForgeOrigin {
|
|
410
|
+
repo: RepoRef;
|
|
411
|
+
/** Forge-native alert id. GitHub numbers each alert kind separately, so `kind` is needed to address one. */
|
|
412
|
+
id: string;
|
|
413
|
+
kind?: SecurityAlertKind;
|
|
414
|
+
severityRaw?: string;
|
|
415
|
+
}
|
|
416
|
+
/** One check run, commit status or CI job. */
|
|
417
|
+
interface CheckRef extends ForgeOrigin {
|
|
418
|
+
repo: RepoRef;
|
|
419
|
+
id: string;
|
|
420
|
+
/** What the id addresses: a check run, a commit status, a CI job, or a branch policy evaluation. */
|
|
421
|
+
type: "check_run" | "status" | "job" | "policy";
|
|
422
|
+
/** Slug of the app that created the check run, where the forge reports one, such as `github-actions`. */
|
|
423
|
+
app?: string;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Reference to a notification. Distinct from {@link ThreadRef}: a notification
|
|
427
|
+
* is a per-user delivery record whose lifetime and identity are independent of
|
|
428
|
+
* the thread it points at.
|
|
429
|
+
*/
|
|
430
|
+
interface NotificationRef extends ForgeOrigin {
|
|
431
|
+
/** Forge-native notification identifier, used for read/done/unsubscribe writes. */
|
|
432
|
+
id: string;
|
|
433
|
+
}
|
|
434
|
+
/** An account: a user, an organisation or a bot. */
|
|
435
|
+
interface Actor extends ForgeOrigin {
|
|
436
|
+
login: string;
|
|
437
|
+
/**
|
|
438
|
+
* Forge-native account id: the numeric id on GitHub (`databaseId` in its GraphQL API, not the node id), GitLab,
|
|
439
|
+
* Forgejo, Gitea and Gitee, the UUID on Bitbucket, the identity id on Azure DevOps and the DID on Tangled.
|
|
440
|
+
*/
|
|
441
|
+
id: string;
|
|
442
|
+
name?: string;
|
|
443
|
+
avatarUrl?: string;
|
|
444
|
+
url?: string;
|
|
445
|
+
/** Forge-reported account type, retained verbatim for callers that classify further. */
|
|
446
|
+
typeRaw?: string;
|
|
447
|
+
/**
|
|
448
|
+
* Hint derived from forge metadata that the actor is automation. Callers own
|
|
449
|
+
* the classification policy.
|
|
450
|
+
*/
|
|
451
|
+
isBotHint: boolean;
|
|
452
|
+
/** The app behind a bot account, where the forge ties one to it (GitHub Apps' `slug[bot]` users). */
|
|
453
|
+
app?: {
|
|
454
|
+
slug: string;
|
|
455
|
+
id?: string;
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
/** A user or organisation account, as `users.get()` reads it. */
|
|
459
|
+
interface User extends Actor {
|
|
460
|
+
bio?: string;
|
|
461
|
+
company?: string;
|
|
462
|
+
location?: string;
|
|
463
|
+
websiteUrl?: string;
|
|
464
|
+
createdAt?: Date;
|
|
465
|
+
followers?: number;
|
|
466
|
+
following?: number;
|
|
467
|
+
publicRepos?: number;
|
|
468
|
+
raw: unknown;
|
|
469
|
+
}
|
|
470
|
+
/** A label that a repository defines. */
|
|
471
|
+
interface Label {
|
|
472
|
+
name: string;
|
|
473
|
+
/** The colour as hex digits, without a leading `#`. */
|
|
474
|
+
colour?: string;
|
|
475
|
+
description?: string;
|
|
476
|
+
}
|
|
477
|
+
/** What a label is created or updated with. */
|
|
478
|
+
interface LabelInput {
|
|
479
|
+
name: string;
|
|
480
|
+
/** Six-digit hex, without the leading `#`. */
|
|
481
|
+
colour?: string;
|
|
482
|
+
description?: string;
|
|
483
|
+
}
|
|
484
|
+
/** Every name {@link ReactionContent} covers. */
|
|
485
|
+
declare const REACTION_CONTENTS: readonly ["+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"];
|
|
486
|
+
/**
|
|
487
|
+
* The reactions every forge with reactions has in common, named as GitHub
|
|
488
|
+
* names them. A {@link Reaction} whose forge-native name has no entry here
|
|
489
|
+
* has `content: 'other'`, with the forge-native name in `contentRaw`.
|
|
490
|
+
*/
|
|
491
|
+
type ReactionContent = (typeof REACTION_CONTENTS)[number];
|
|
492
|
+
/** One reaction left on a thread or a comment, as `threads.reactions()` lists them. */
|
|
493
|
+
interface Reaction {
|
|
494
|
+
/** `'other'` where the forge's name has no entry in {@link ReactionContent}. */
|
|
495
|
+
content: ReactionContent | "other";
|
|
496
|
+
/** The forge's own name for the reaction, such as a GitLab award emoji or a Forgejo emoji. */
|
|
497
|
+
contentRaw: string;
|
|
498
|
+
actor: Actor;
|
|
499
|
+
createdAt?: Date;
|
|
500
|
+
raw: unknown;
|
|
501
|
+
}
|
|
502
|
+
/** The reactions on a thread or comment, counted. */
|
|
503
|
+
interface ReactionSummary {
|
|
504
|
+
/** The number of reactions of every kind. */
|
|
505
|
+
total: number;
|
|
506
|
+
/** The number of reactions of each kind. A reaction with no {@link ReactionContent} entry has no key here. */
|
|
507
|
+
counts: Partial<Record<ReactionContent, number>>;
|
|
508
|
+
/** Reactions the authenticated account has left. Absent when the forge does not report them. */
|
|
509
|
+
viewerReacted?: ReactionContent[];
|
|
510
|
+
}
|
|
511
|
+
/** A milestone that groups threads. */
|
|
512
|
+
interface Milestone {
|
|
513
|
+
/** Forge-native milestone id, as `threads.setMilestone` takes it. */
|
|
514
|
+
id: string;
|
|
515
|
+
title: string;
|
|
516
|
+
state: "open" | "closed";
|
|
517
|
+
description?: string;
|
|
518
|
+
dueOn?: Date;
|
|
519
|
+
url?: string;
|
|
520
|
+
raw: unknown;
|
|
521
|
+
}
|
|
522
|
+
/** A kind of issue, such as a bug or a feature, from the set its repository offers. */
|
|
523
|
+
interface IssueType {
|
|
524
|
+
/** Forge-native id: a node id on GitHub, the name on Azure DevOps. */
|
|
525
|
+
id: string;
|
|
526
|
+
name: string;
|
|
527
|
+
description?: string;
|
|
528
|
+
/** The forge's own colour, a name such as `red` on GitHub. */
|
|
529
|
+
colour?: string;
|
|
530
|
+
/** Whether issues can be given the type. */
|
|
531
|
+
enabled?: boolean;
|
|
532
|
+
raw: unknown;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Thread state. `'unknown'` is distinct from any real state and signals that
|
|
536
|
+
* the value was not present in the payload, so the caller may enrich it with
|
|
537
|
+
* `threads.get()`. Draft status is orthogonal; see `Thread.isDraft`.
|
|
538
|
+
*/
|
|
539
|
+
type ThreadState = "open" | "closed" | "merged" | "unknown";
|
|
540
|
+
/** What a review or a reviewer says about a pull request. `unknown` is a state that the model does not name. */
|
|
541
|
+
type ReviewState = "approved" | "changes_requested" | "commented" | "pending" | "dismissed" | "unknown";
|
|
542
|
+
/** Reference to a review on a pull request. */
|
|
543
|
+
interface ReviewRef extends ForgeOrigin {
|
|
544
|
+
thread: ThreadRef;
|
|
545
|
+
/** Forge-native review id; a synthesised `approval:<login>` where the forge has approvals but no review objects. */
|
|
546
|
+
id: string;
|
|
547
|
+
}
|
|
548
|
+
/** A review ref whose thread is resolved. Every review read from a forge carries one. */
|
|
549
|
+
interface ResolvedReviewRef extends ReviewRef {
|
|
550
|
+
thread: ResolvedThreadRef;
|
|
551
|
+
}
|
|
552
|
+
/** A comment left on a line of the diff as part of a review. */
|
|
553
|
+
interface ReviewComment {
|
|
554
|
+
ref?: ResolvedCommentRef;
|
|
555
|
+
body: string;
|
|
556
|
+
author?: Actor;
|
|
557
|
+
path?: string;
|
|
558
|
+
/** Line in the file the comment is anchored to, in the side it is anchored to. */
|
|
559
|
+
line?: number;
|
|
560
|
+
/** `'left'` is the base of the diff, `'right'` the head. */
|
|
561
|
+
side?: "left" | "right";
|
|
562
|
+
/** Forge-native id of the comment this one replies to. */
|
|
563
|
+
inReplyTo?: string;
|
|
564
|
+
/** The resolvable conversation the comment belongs to, where the forge has one. */
|
|
565
|
+
thread?: {
|
|
566
|
+
id: string;
|
|
567
|
+
resolved: boolean;
|
|
568
|
+
};
|
|
569
|
+
createdAt?: Date;
|
|
570
|
+
url?: string;
|
|
571
|
+
raw: unknown;
|
|
572
|
+
}
|
|
573
|
+
/** A review of a pull request. */
|
|
574
|
+
interface Review {
|
|
575
|
+
ref: ResolvedReviewRef;
|
|
576
|
+
author?: Actor;
|
|
577
|
+
state: ReviewState;
|
|
578
|
+
stateRaw?: string;
|
|
579
|
+
body?: string;
|
|
580
|
+
submittedAt?: Date;
|
|
581
|
+
/**
|
|
582
|
+
* Inline comments submitted with the review. `false` where the forge has
|
|
583
|
+
* approvals but no review objects to hang comments on.
|
|
584
|
+
*/
|
|
585
|
+
comments: ReviewComment[] | false;
|
|
586
|
+
url?: string;
|
|
587
|
+
raw: unknown;
|
|
588
|
+
}
|
|
589
|
+
/** What a review does when it is submitted. Omitted creates a pending review where the forge has them. */
|
|
590
|
+
type ReviewEvent = "approve" | "request_changes" | "comment";
|
|
591
|
+
/** An inline comment to send with a review. */
|
|
592
|
+
interface ReviewCommentInput {
|
|
593
|
+
path: string;
|
|
594
|
+
/** Line in the diff, in `side`. */
|
|
595
|
+
line?: number;
|
|
596
|
+
side?: "left" | "right";
|
|
597
|
+
/** First line of a multi-line comment. */
|
|
598
|
+
startLine?: number;
|
|
599
|
+
body: string;
|
|
600
|
+
}
|
|
601
|
+
/** What `threads.createReview()` needs. */
|
|
602
|
+
interface ReviewInput {
|
|
603
|
+
/** Omitted creates a pending review, where the forge has them; submit it with `submitReview`. */
|
|
604
|
+
event?: ReviewEvent;
|
|
605
|
+
body?: string;
|
|
606
|
+
/** Inline comments to send with the review. */
|
|
607
|
+
comments?: ReviewCommentInput[];
|
|
608
|
+
}
|
|
609
|
+
/** A reviewer who was asked to review a pull request, and what they said. */
|
|
610
|
+
interface Reviewer {
|
|
611
|
+
actor: Actor;
|
|
612
|
+
state: ReviewState;
|
|
613
|
+
stateRaw?: string;
|
|
614
|
+
/** True when the reviewer is a team rather than an account. */
|
|
615
|
+
isTeam?: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* When the pending review was last requested. Absent where the forge doesn't report it; on GitHub,
|
|
618
|
+
* `threads.getMany()` reports it.
|
|
619
|
+
*/
|
|
620
|
+
requestedAt?: Date;
|
|
621
|
+
}
|
|
622
|
+
/** The branches of a pull request. */
|
|
623
|
+
interface PullBranches {
|
|
624
|
+
/** `sha` is absent on forges where a pull is a patch rather than a branch (Tangled). */
|
|
625
|
+
head: {
|
|
626
|
+
ref: string;
|
|
627
|
+
sha?: string;
|
|
628
|
+
/** The repository that holds the head branch, which differs for a fork. */
|
|
629
|
+
repo?: RepoRef;
|
|
630
|
+
};
|
|
631
|
+
base: {
|
|
632
|
+
ref: string;
|
|
633
|
+
sha?: string;
|
|
634
|
+
};
|
|
635
|
+
/** The merge commit, once the pull request is merged. */
|
|
636
|
+
mergeCommitSha?: string;
|
|
637
|
+
}
|
|
638
|
+
/** The size of a pull request's change. Each count is absent where the forge doesn't report it exactly. */
|
|
639
|
+
interface PullStats {
|
|
640
|
+
/** Lines added. */
|
|
641
|
+
additions?: number;
|
|
642
|
+
/** Lines removed. */
|
|
643
|
+
deletions?: number;
|
|
644
|
+
/** Files changed. */
|
|
645
|
+
changedFileCount?: number;
|
|
646
|
+
/** Commits on the pull request. */
|
|
647
|
+
commitCount?: number;
|
|
648
|
+
}
|
|
649
|
+
/** Where a pull request sits in a stack of pull requests. */
|
|
650
|
+
interface ThreadStack {
|
|
651
|
+
/** Forge-native stack id, where the forge names stacks. */
|
|
652
|
+
id?: string;
|
|
653
|
+
/** The pull request this one is stacked on. Absent for the root of the stack. */
|
|
654
|
+
parent?: ResolvedThreadRef;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Combined state of the checks on a pull request's head commit. `failure`
|
|
658
|
+
* when any check failed, else `pending` while any runs, else `success`.
|
|
659
|
+
*/
|
|
660
|
+
interface ChecksSummary {
|
|
661
|
+
state: "pending" | "success" | "failure" | "unknown";
|
|
662
|
+
stateRaw?: string;
|
|
663
|
+
/** Absent when the forge reports only a combined state. */
|
|
664
|
+
total?: number;
|
|
665
|
+
failed?: number;
|
|
666
|
+
url?: string;
|
|
667
|
+
}
|
|
668
|
+
/** `neutral` covers skipped and informational results, which neither pass nor fail. */
|
|
669
|
+
type CheckState = "pending" | "success" | "failure" | "neutral" | "unknown";
|
|
670
|
+
/** One check on a commit: a check run, a commit status, a job or a policy evaluation. */
|
|
671
|
+
interface Check {
|
|
672
|
+
ref: CheckRef;
|
|
673
|
+
name: string;
|
|
674
|
+
state: CheckState;
|
|
675
|
+
/** Forge-native status, for example `in_progress` or `running`. */
|
|
676
|
+
stateRaw: string;
|
|
677
|
+
/** Forge-native conclusion, where the forge reports one apart from the status. */
|
|
678
|
+
conclusionRaw?: string;
|
|
679
|
+
url?: string;
|
|
680
|
+
startedAt?: Date;
|
|
681
|
+
completedAt?: Date;
|
|
682
|
+
/** The CI run the check is a job of, where the forge's own CI created it. */
|
|
683
|
+
run?: CiRunRef;
|
|
684
|
+
raw: unknown;
|
|
685
|
+
}
|
|
686
|
+
/** What `checks.report` writes: a commit status everywhere, a check run on GitHub under app auth. */
|
|
687
|
+
interface CheckReportInput {
|
|
688
|
+
/** Status context or check run name. */
|
|
689
|
+
name: string;
|
|
690
|
+
state: Exclude<CheckState, "unknown">;
|
|
691
|
+
/** A short description of the state. */
|
|
692
|
+
description?: string;
|
|
693
|
+
/** Where a person goes to see the detail. */
|
|
694
|
+
url?: string;
|
|
695
|
+
/** The caller's own id for the check, where the forge stores one. */
|
|
696
|
+
externalId?: string;
|
|
697
|
+
}
|
|
698
|
+
/** A CI run: a workflow run, a pipeline, or a build. */
|
|
699
|
+
interface CiRunRef extends ForgeOrigin {
|
|
700
|
+
repo: RepoRef;
|
|
701
|
+
id: string;
|
|
702
|
+
}
|
|
703
|
+
/** One job inside a run. `run` is absent when the job was addressed on its own. */
|
|
704
|
+
interface CiJobRef extends ForgeOrigin {
|
|
705
|
+
repo: RepoRef;
|
|
706
|
+
id: string;
|
|
707
|
+
run?: CiRunRef;
|
|
708
|
+
}
|
|
709
|
+
/** A CI run, such as a workflow run or a pipeline. */
|
|
710
|
+
interface CiRun {
|
|
711
|
+
ref: CiRunRef;
|
|
712
|
+
name: string;
|
|
713
|
+
state: CheckState;
|
|
714
|
+
stateRaw: string;
|
|
715
|
+
/** Per-repo run number, where the forge has one. */
|
|
716
|
+
number?: string;
|
|
717
|
+
/** What triggered the run, as the forge names it. */
|
|
718
|
+
eventRaw?: string;
|
|
719
|
+
branch?: string;
|
|
720
|
+
/** The commit that the run ran on. */
|
|
721
|
+
sha?: string;
|
|
722
|
+
url?: string;
|
|
723
|
+
actor?: Actor;
|
|
724
|
+
createdAt?: Date;
|
|
725
|
+
startedAt?: Date;
|
|
726
|
+
completedAt?: Date;
|
|
727
|
+
raw: unknown;
|
|
728
|
+
}
|
|
729
|
+
/** One job of a CI run. */
|
|
730
|
+
interface CiJob {
|
|
731
|
+
ref: CiJobRef;
|
|
732
|
+
name: string;
|
|
733
|
+
state: CheckState;
|
|
734
|
+
stateRaw: string;
|
|
735
|
+
/** Stage or group the job belongs to, where the forge has one. */
|
|
736
|
+
stage?: string;
|
|
737
|
+
url?: string;
|
|
738
|
+
startedAt?: Date;
|
|
739
|
+
completedAt?: Date;
|
|
740
|
+
raw: unknown;
|
|
741
|
+
}
|
|
742
|
+
/** Filters for `ci.runs()`. */
|
|
743
|
+
interface CiRunQuery extends PageOptions {
|
|
744
|
+
branch?: string;
|
|
745
|
+
/** Normalised state; forges that filter on their own names translate it. */
|
|
746
|
+
state?: Exclude<CheckState, "unknown">;
|
|
747
|
+
}
|
|
748
|
+
/** A commit addressed by its full sha. */
|
|
749
|
+
interface CommitRef extends ForgeOrigin {
|
|
750
|
+
repo: RepoRef;
|
|
751
|
+
/** The full sha of the commit. */
|
|
752
|
+
sha: string;
|
|
753
|
+
}
|
|
754
|
+
/** What a forge reports about a file, apart from its content. */
|
|
755
|
+
interface FileMetadata {
|
|
756
|
+
/** The path from the repository root. */
|
|
757
|
+
path: string;
|
|
758
|
+
/** Blob sha, where the forge reports one. */
|
|
759
|
+
sha?: string;
|
|
760
|
+
size?: number;
|
|
761
|
+
/** Web page for the file at this ref, where the forge has one. */
|
|
762
|
+
url?: string;
|
|
763
|
+
}
|
|
764
|
+
/** A file's contents. Narrow on `encoding` to get text or bytes. */
|
|
765
|
+
type FileContent = FileMetadata & {
|
|
766
|
+
encoding: "utf-8";
|
|
767
|
+
content: string;
|
|
768
|
+
} | FileMetadata & {
|
|
769
|
+
encoding: "binary";
|
|
770
|
+
content: Uint8Array;
|
|
771
|
+
};
|
|
772
|
+
/** Options for `contents.getFile()`. */
|
|
773
|
+
interface FileOptions extends BaseOptions {
|
|
774
|
+
/** Branch, tag or sha. Defaults to the repository's default branch. */
|
|
775
|
+
ref?: string;
|
|
776
|
+
/**
|
|
777
|
+
* `'text'` decodes as UTF-8 and rejects with {@link ContentNotTextError} when the bytes are not text.
|
|
778
|
+
* @default 'binary'
|
|
779
|
+
*/
|
|
780
|
+
as?: "text" | "binary";
|
|
781
|
+
/**
|
|
782
|
+
* `false` reads the content alone, through a cheaper endpoint where the forge has one, so the result may lack `sha` and `url`.
|
|
783
|
+
* @default true
|
|
784
|
+
*/
|
|
785
|
+
metadata?: boolean;
|
|
786
|
+
}
|
|
787
|
+
/** A file that `contents.commitFiles()` writes or deletes. */
|
|
788
|
+
interface FileChange {
|
|
789
|
+
/** The path from the repository root. */
|
|
790
|
+
path: string;
|
|
791
|
+
/** The new contents, with a string written as UTF-8, or `null` to delete the file. */
|
|
792
|
+
content: string | Uint8Array | null;
|
|
793
|
+
}
|
|
794
|
+
/** The commit that `contents.commitFiles()` makes. */
|
|
795
|
+
interface CommitFilesInput {
|
|
796
|
+
/** The branch to commit to. */
|
|
797
|
+
branch: string;
|
|
798
|
+
/** The commit message. */
|
|
799
|
+
message: string;
|
|
800
|
+
/** The files to write or delete. A file that exists is overwritten. */
|
|
801
|
+
changes: FileChange[];
|
|
802
|
+
/** The sha that the branch must point at. When the branch has moved, the commit rejects with `BranchMovedError`. */
|
|
803
|
+
expectedHead?: string;
|
|
804
|
+
/** Creates `branch` from this branch, tag or sha. The branch must not exist yet. */
|
|
805
|
+
createFrom?: string;
|
|
806
|
+
/** Who wrote the change. Defaults to the account of the credential. Some forges record it as the committer too. */
|
|
807
|
+
author?: {
|
|
808
|
+
name: string;
|
|
809
|
+
email: string;
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
/** What a tree entry is. */
|
|
813
|
+
type TreeEntryType = "file" | "directory" | "symlink" | "submodule";
|
|
814
|
+
/** One entry of a repository tree. */
|
|
815
|
+
interface TreeEntry {
|
|
816
|
+
/** Path from the repository root, without a leading slash. */
|
|
817
|
+
path: string;
|
|
818
|
+
type: TreeEntryType;
|
|
819
|
+
sha?: string;
|
|
820
|
+
/** The size in bytes, for a file. */
|
|
821
|
+
size?: number;
|
|
822
|
+
/** POSIX mode as the forge reports it, for example `100644`. */
|
|
823
|
+
mode?: string;
|
|
824
|
+
url?: string;
|
|
825
|
+
}
|
|
826
|
+
/** Options for `contents.tree()`. */
|
|
827
|
+
interface TreeOptions extends PageOptions {
|
|
828
|
+
/** Branch, tag or sha. Defaults to the repository's default branch. */
|
|
829
|
+
ref?: string;
|
|
830
|
+
/** Subdirectory to list; the root when omitted. */
|
|
831
|
+
path?: string;
|
|
832
|
+
/** Every descendant rather than one level. Unsupported on some forges, which then warn. */
|
|
833
|
+
recursive?: boolean;
|
|
834
|
+
}
|
|
835
|
+
/** A branch of a repository. */
|
|
836
|
+
interface Branch {
|
|
837
|
+
name: string;
|
|
838
|
+
/** The commit that the branch points at. */
|
|
839
|
+
sha: string;
|
|
840
|
+
isDefault?: boolean;
|
|
841
|
+
isProtected?: boolean;
|
|
842
|
+
url?: string;
|
|
843
|
+
raw: unknown;
|
|
844
|
+
}
|
|
845
|
+
/** A check that has to pass before a pull request can merge into a branch. */
|
|
846
|
+
interface RequiredCheck {
|
|
847
|
+
/** The name of the check run or the context of the commit status. On Forgejo and Gitea it can be a glob, such as `ci / **`. */
|
|
848
|
+
name: string;
|
|
849
|
+
/** The id of the app that has to report the check, where the rule names one, such as `15368` for GitHub Actions. */
|
|
850
|
+
appId?: string;
|
|
851
|
+
}
|
|
852
|
+
/** What a branch asks of a pull request before it can merge, as `repos.branchRules()` reads it. */
|
|
853
|
+
interface BranchRules {
|
|
854
|
+
branch: string;
|
|
855
|
+
/** The checks that have to pass, empty when the branch names none. */
|
|
856
|
+
requiredChecks: RequiredCheck[];
|
|
857
|
+
/** True when the whole pipeline has to pass, as GitLab's "Pipelines must succeed" asks, whatever `requiredChecks` names. */
|
|
858
|
+
requiresAllChecks?: boolean;
|
|
859
|
+
/** The approvals a pull request needs, absent when the credential can't read any rule that sets them. */
|
|
860
|
+
requiredApprovals?: number;
|
|
861
|
+
/** The rules the credential couldn't read. With one here, the result can ask for less than the forge does. */
|
|
862
|
+
warnings?: ForgeWarning[];
|
|
863
|
+
raw: unknown;
|
|
864
|
+
}
|
|
865
|
+
/** A tag of a repository. */
|
|
866
|
+
interface Tag {
|
|
867
|
+
name: string;
|
|
868
|
+
/** Commit the tag points at, after dereferencing an annotated tag where the forge does so. */
|
|
869
|
+
sha: string;
|
|
870
|
+
url?: string;
|
|
871
|
+
raw: unknown;
|
|
872
|
+
}
|
|
873
|
+
/** Git authorship, with the forge account behind it where the forge matched one. */
|
|
874
|
+
interface CommitSignature {
|
|
875
|
+
/** The account, where the forge can match it. */
|
|
876
|
+
actor?: Actor;
|
|
877
|
+
name?: string;
|
|
878
|
+
email?: string;
|
|
879
|
+
/** When the commit was authored or committed. */
|
|
880
|
+
date?: Date;
|
|
881
|
+
}
|
|
882
|
+
/** How a commit or pull request changed a file. */
|
|
883
|
+
type FileStatus = "added" | "modified" | "removed" | "renamed" | "copied" | "changed";
|
|
884
|
+
/** A file that a commit or pull request changed. */
|
|
885
|
+
interface ChangedFile {
|
|
886
|
+
path: string;
|
|
887
|
+
/** Path before a rename or copy. */
|
|
888
|
+
previousPath?: string;
|
|
889
|
+
status: FileStatus;
|
|
890
|
+
statusRaw?: string;
|
|
891
|
+
additions?: number;
|
|
892
|
+
deletions?: number;
|
|
893
|
+
/** Unified diff for the file, where the forge returns one inline. */
|
|
894
|
+
patch?: string;
|
|
895
|
+
/** Blob sha after the change. */
|
|
896
|
+
sha?: string;
|
|
897
|
+
/** The file is binary, so it has no patch. */
|
|
898
|
+
isBinary?: boolean;
|
|
899
|
+
}
|
|
900
|
+
/** A commit. */
|
|
901
|
+
interface Commit {
|
|
902
|
+
ref: CommitRef;
|
|
903
|
+
/** The full sha. */
|
|
904
|
+
sha: string;
|
|
905
|
+
message: string;
|
|
906
|
+
/** Who wrote the change. */
|
|
907
|
+
author?: CommitSignature;
|
|
908
|
+
/** Who recorded the change. */
|
|
909
|
+
committer?: CommitSignature;
|
|
910
|
+
parents: string[];
|
|
911
|
+
url?: string;
|
|
912
|
+
stats?: {
|
|
913
|
+
additions: number;
|
|
914
|
+
deletions: number;
|
|
915
|
+
total?: number;
|
|
916
|
+
};
|
|
917
|
+
/** Present on `commits.get`; absent from listings. */
|
|
918
|
+
files?: ChangedFile[];
|
|
919
|
+
raw: unknown;
|
|
920
|
+
}
|
|
921
|
+
/** Filters for `commits.list()`. */
|
|
922
|
+
interface CommitQuery extends PageOptions {
|
|
923
|
+
/** Branch, tag or sha to walk back from. */
|
|
924
|
+
ref?: string;
|
|
925
|
+
/** Only commits at or after this time. */
|
|
926
|
+
since?: Date;
|
|
927
|
+
/** Only commits at or before this time. */
|
|
928
|
+
until?: Date;
|
|
929
|
+
/** Only commits touching this path. */
|
|
930
|
+
path?: string;
|
|
931
|
+
/** Login or email, as the forge matches it. */
|
|
932
|
+
author?: string;
|
|
933
|
+
}
|
|
934
|
+
/** Options for `contents.compare()`. */
|
|
935
|
+
interface CompareOptions extends BaseOptions {
|
|
936
|
+
/**
|
|
937
|
+
* The most commits to return. The comparison keeps the newest ones. Where the forge can't send fewer, the provider
|
|
938
|
+
* drops the rest. `aheadBy` still counts every commit where the forge reports the count.
|
|
939
|
+
*/
|
|
940
|
+
commitLimit?: number;
|
|
941
|
+
/**
|
|
942
|
+
* Whether to read the changed files. With `false`, `files` is empty and the commits carry no files.
|
|
943
|
+
* @default true
|
|
944
|
+
*/
|
|
945
|
+
files?: boolean;
|
|
946
|
+
}
|
|
947
|
+
/** The difference between two revisions. */
|
|
948
|
+
interface Comparison {
|
|
949
|
+
/** The revision that the comparison starts from. */
|
|
950
|
+
base: string;
|
|
951
|
+
/** The revision that the comparison ends at. */
|
|
952
|
+
head: string;
|
|
953
|
+
/** The number of commits that `head` has and `base` lacks. */
|
|
954
|
+
aheadBy?: number;
|
|
955
|
+
/** The number of commits that `base` has and `head` lacks. */
|
|
956
|
+
behindBy?: number;
|
|
957
|
+
/** The commits between the two revisions, newest first. Forges that cap the list leave out the oldest. */
|
|
958
|
+
commits: Commit[];
|
|
959
|
+
files: ChangedFile[];
|
|
960
|
+
/** The merge base, where the forge reports it. */
|
|
961
|
+
mergeBaseSha?: string;
|
|
962
|
+
raw: unknown;
|
|
963
|
+
}
|
|
964
|
+
/** A file that a code search found. A file whose excerpts span two pages comes back on both. */
|
|
965
|
+
interface CodeMatch {
|
|
966
|
+
repo: RepoRef;
|
|
967
|
+
path: string;
|
|
968
|
+
/** The branch, tag or sha the forge searched, where it reports one. */
|
|
969
|
+
ref?: string;
|
|
970
|
+
/** The excerpts of the file that matched. */
|
|
971
|
+
fragments: CodeFragment[];
|
|
972
|
+
url?: string;
|
|
973
|
+
raw: unknown;
|
|
974
|
+
}
|
|
975
|
+
/** An excerpt of a file that matched a code search. */
|
|
976
|
+
interface CodeFragment {
|
|
977
|
+
text: string;
|
|
978
|
+
/** The line the excerpt starts on, where the forge reports it. */
|
|
979
|
+
line?: number;
|
|
980
|
+
}
|
|
981
|
+
/** A release asset, addressable for download with `releases.downloadAsset`. */
|
|
982
|
+
interface ReleaseAssetRef extends ForgeOrigin {
|
|
983
|
+
repo: RepoRef;
|
|
984
|
+
release: ReleaseRef;
|
|
985
|
+
/** Forge-native asset id; the asset name, or the link id, on forges that have no asset id. */
|
|
986
|
+
id: string;
|
|
987
|
+
}
|
|
988
|
+
/** Options for `releases.downloadAsset()`. */
|
|
989
|
+
interface DownloadAssetOptions extends BaseOptions {
|
|
990
|
+
/**
|
|
991
|
+
* `'binary'` reads the whole asset into a `Uint8Array`, and `'text'` decodes it as UTF-8, rejecting with
|
|
992
|
+
* {@link ContentNotTextError} when the bytes are not text. `'stream'` returns the bytes as they arrive.
|
|
993
|
+
* @default 'stream'
|
|
994
|
+
*/
|
|
995
|
+
as?: "stream" | "binary" | "text";
|
|
996
|
+
}
|
|
997
|
+
/** A file attached to a release. */
|
|
998
|
+
interface ReleaseAsset {
|
|
999
|
+
/** Absent where the forge publishes a download URL but nothing to address the asset by. */
|
|
1000
|
+
ref?: ReleaseAssetRef;
|
|
1001
|
+
name: string;
|
|
1002
|
+
url: string;
|
|
1003
|
+
size?: number;
|
|
1004
|
+
downloadCount?: number;
|
|
1005
|
+
/** The media type. */
|
|
1006
|
+
contentType?: string;
|
|
1007
|
+
}
|
|
1008
|
+
/** A release of a repository. */
|
|
1009
|
+
interface Release {
|
|
1010
|
+
ref: ReleaseRef;
|
|
1011
|
+
name?: string;
|
|
1012
|
+
tag: string;
|
|
1013
|
+
/** The release notes. */
|
|
1014
|
+
body?: string;
|
|
1015
|
+
isDraft: boolean;
|
|
1016
|
+
isPrerelease: boolean;
|
|
1017
|
+
/**
|
|
1018
|
+
* The release is immutable: its tag and assets are locked. `true` where the
|
|
1019
|
+
* forge supports immutable releases and this one is published as immutable
|
|
1020
|
+
* (GitHub). The name, notes, prerelease and latest flags stay editable.
|
|
1021
|
+
*/
|
|
1022
|
+
immutable?: boolean;
|
|
1023
|
+
author?: Actor;
|
|
1024
|
+
publishedAt?: Date;
|
|
1025
|
+
createdAt?: Date;
|
|
1026
|
+
url?: string;
|
|
1027
|
+
assets?: ReleaseAsset[];
|
|
1028
|
+
raw: unknown;
|
|
1029
|
+
}
|
|
1030
|
+
/** The fields that `releases.create()` sets. */
|
|
1031
|
+
interface ReleaseInput {
|
|
1032
|
+
/** The tag to release. The forge creates it from `target` when it does not exist yet. */
|
|
1033
|
+
tag: string;
|
|
1034
|
+
name?: string;
|
|
1035
|
+
/** The release notes. */
|
|
1036
|
+
body?: string;
|
|
1037
|
+
/** Saves the release unpublished. `true` rejects with `UnsupportedOperationError` on a forge without drafts. */
|
|
1038
|
+
draft?: boolean;
|
|
1039
|
+
/** Marks the release as a prerelease. `true` rejects with `UnsupportedOperationError` on a forge without prereleases. */
|
|
1040
|
+
prerelease?: boolean;
|
|
1041
|
+
/**
|
|
1042
|
+
* The branch or commit sha to create the tag from when it does not exist yet. GitHub, Forgejo and Gitea
|
|
1043
|
+
* default to the default branch; GitLab requires it for a new tag.
|
|
1044
|
+
*/
|
|
1045
|
+
target?: string;
|
|
1046
|
+
}
|
|
1047
|
+
/** The fields that `releases.update()` changes. Fields left out stay as they are. */
|
|
1048
|
+
type ReleaseUpdate = Partial<ReleaseInput>;
|
|
1049
|
+
/** How severe an alert is. `unknown` is a level that the model does not name. */
|
|
1050
|
+
type SecuritySeverity = "critical" | "high" | "medium" | "low" | "unknown";
|
|
1051
|
+
/** A security alert on a repository. */
|
|
1052
|
+
interface SecurityAlert {
|
|
1053
|
+
ref: SecurityAlertRef;
|
|
1054
|
+
kind: SecurityAlertKind;
|
|
1055
|
+
kindRaw: string;
|
|
1056
|
+
severity: SecuritySeverity;
|
|
1057
|
+
severityRaw?: string;
|
|
1058
|
+
state: "open" | "fixed" | "dismissed" | "unknown";
|
|
1059
|
+
stateRaw: string;
|
|
1060
|
+
/** A short description of the problem. */
|
|
1061
|
+
title: string;
|
|
1062
|
+
/** `ecosystem` is absent where the forge reports only the package name. */
|
|
1063
|
+
package?: {
|
|
1064
|
+
ecosystem?: string;
|
|
1065
|
+
name: string;
|
|
1066
|
+
vulnerableRange?: string;
|
|
1067
|
+
fixedIn?: string;
|
|
1068
|
+
};
|
|
1069
|
+
url?: string;
|
|
1070
|
+
createdAt?: Date;
|
|
1071
|
+
updatedAt?: Date;
|
|
1072
|
+
dismissedAt?: Date;
|
|
1073
|
+
raw: unknown;
|
|
1074
|
+
}
|
|
1075
|
+
/** Filters for `securityAlerts.list()`. */
|
|
1076
|
+
interface SecurityAlertListOptions extends PageOptions {
|
|
1077
|
+
/** Omitted lists every kind the provider can read, one after another. */
|
|
1078
|
+
kind?: Exclude<SecurityAlertKind, "other">;
|
|
1079
|
+
/**
|
|
1080
|
+
* `'closed'` is fixed or dismissed.
|
|
1081
|
+
* @default 'open'
|
|
1082
|
+
*/
|
|
1083
|
+
state?: "open" | "closed" | "all";
|
|
1084
|
+
}
|
|
1085
|
+
/** The warning codes providers emit; providers may add codes in a minor release. */
|
|
1086
|
+
type ForgeWarningCode = "checks_unreadable" | "collaborators_unreachable" | "discussion_unresolved" | "feed_throttled" | "files_approximate" | "filter_unsupported" | "index_possibly_stale" | "insufficient_scope" | "kind_unsupported" | "notifications_failed" | "record_unreachable" | "recursive_unsupported" | "search_failed" | "search_incomplete" | "sort_unsupported" | "state_record_unreachable" | "thread_unreadable" | "thread_unresolved" | "tree_truncated" | (string & {});
|
|
1087
|
+
/** A non-fatal problem encountered while producing a result. */
|
|
1088
|
+
interface ForgeWarning {
|
|
1089
|
+
/** Stable machine-readable code. */
|
|
1090
|
+
code: ForgeWarningCode;
|
|
1091
|
+
/** A description of the problem, for a person. */
|
|
1092
|
+
message: string;
|
|
1093
|
+
/** Key or URI of the item the warning concerns, when it concerns one. */
|
|
1094
|
+
subject?: string;
|
|
1095
|
+
cause?: {
|
|
1096
|
+
name: string;
|
|
1097
|
+
message: string;
|
|
1098
|
+
status?: number;
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* How the author of a thread or comment relates to its repository:
|
|
1103
|
+
*
|
|
1104
|
+
* - `owner` owns the repository.
|
|
1105
|
+
* - `member` belongs to the organisation that owns it.
|
|
1106
|
+
* - `collaborator` was invited to collaborate on it.
|
|
1107
|
+
* - `contributor` has committed to it before.
|
|
1108
|
+
* - `first_time_contributor` has not committed to it before.
|
|
1109
|
+
* - `first_timer` has not committed to any repository on the forge before.
|
|
1110
|
+
* - `none` has none of these, or is a placeholder for an unclaimed account.
|
|
1111
|
+
* - `unknown` is an association with no normalised value; `authorAssociationRaw` names it.
|
|
1112
|
+
*/
|
|
1113
|
+
type AuthorAssociation = "owner" | "member" | "collaborator" | "contributor" | "first_time_contributor" | "first_timer" | "none" | "unknown";
|
|
1114
|
+
/** An issue, pull request or discussion. */
|
|
1115
|
+
interface Thread {
|
|
1116
|
+
ref: ResolvedThreadRef;
|
|
1117
|
+
kind: ThreadKind;
|
|
1118
|
+
title: string;
|
|
1119
|
+
body?: string;
|
|
1120
|
+
state: ThreadState;
|
|
1121
|
+
/** Forge-native state string the normalised `state` was derived from. */
|
|
1122
|
+
stateRaw?: string;
|
|
1123
|
+
/** Forge-native state qualifier, for example `completed` or `not_planned`. */
|
|
1124
|
+
stateReason?: string;
|
|
1125
|
+
isDraft: boolean;
|
|
1126
|
+
author?: Actor;
|
|
1127
|
+
/** How the author relates to the repository, where the forge reports it. */
|
|
1128
|
+
authorAssociation?: AuthorAssociation;
|
|
1129
|
+
/** Forge-native association the normalised `authorAssociation` was derived from. */
|
|
1130
|
+
authorAssociationRaw?: string;
|
|
1131
|
+
assignees: Actor[];
|
|
1132
|
+
/**
|
|
1133
|
+
* Reviewers the thread read reports. Some forges report outstanding requests
|
|
1134
|
+
* only, others each reviewer's verdict; `threads.reviews()` has every
|
|
1135
|
+
* submitted review.
|
|
1136
|
+
*/
|
|
1137
|
+
reviewers: Reviewer[];
|
|
1138
|
+
labels: Label[];
|
|
1139
|
+
url?: string;
|
|
1140
|
+
createdAt?: Date;
|
|
1141
|
+
updatedAt?: Date;
|
|
1142
|
+
closedAt?: Date;
|
|
1143
|
+
/** When the pull request was merged, where the forge reports it. */
|
|
1144
|
+
mergedAt?: Date;
|
|
1145
|
+
/** The account that merged the pull request, where the forge reports it. */
|
|
1146
|
+
mergedBy?: Actor;
|
|
1147
|
+
/** Latest activity the forge reports for the thread. */
|
|
1148
|
+
lastActivityAt?: Date;
|
|
1149
|
+
locked?: boolean;
|
|
1150
|
+
commentCount?: number;
|
|
1151
|
+
/** Everyone who authored or commented on the thread, where the forge reports them. */
|
|
1152
|
+
participants?: Actor[];
|
|
1153
|
+
/** The authenticated account's subscription, where the thread read already carries it. */
|
|
1154
|
+
subscription?: SubscriptionState;
|
|
1155
|
+
milestone?: Milestone;
|
|
1156
|
+
/** Issues only, where the forge has issue types and the issue has one. */
|
|
1157
|
+
issueType?: IssueType;
|
|
1158
|
+
reactions?: ReactionSummary;
|
|
1159
|
+
/** Pull requests only. */
|
|
1160
|
+
branches?: PullBranches;
|
|
1161
|
+
/** Pull requests only. */
|
|
1162
|
+
checks?: ChecksSummary;
|
|
1163
|
+
/** Pull requests only, where the forge reports counts with the pull request. */
|
|
1164
|
+
stats?: PullStats;
|
|
1165
|
+
/** Pull requests in a stack: a chain of dependent pull requests, each based on the one before. */
|
|
1166
|
+
stack?: ThreadStack;
|
|
1167
|
+
/** Non-fatal problems hit while reading the thread, for example an unreachable record. */
|
|
1168
|
+
warnings?: ForgeWarning[];
|
|
1169
|
+
/** Unnormalised forge payload, retained for fidelity. */
|
|
1170
|
+
raw: unknown;
|
|
1171
|
+
}
|
|
1172
|
+
/** Reference to a comment on a thread. */
|
|
1173
|
+
interface CommentRef extends ForgeOrigin {
|
|
1174
|
+
thread: ThreadRef;
|
|
1175
|
+
/** Forge-native comment id; an AT-URI on Tangled. */
|
|
1176
|
+
id: string;
|
|
1177
|
+
}
|
|
1178
|
+
/** Reference to a comment on a commit. */
|
|
1179
|
+
interface CommitCommentRef extends ForgeOrigin {
|
|
1180
|
+
commit: CommitRef;
|
|
1181
|
+
/** Forge-native comment id. */
|
|
1182
|
+
id: string;
|
|
1183
|
+
}
|
|
1184
|
+
/** A comment on a thread. */
|
|
1185
|
+
interface Comment {
|
|
1186
|
+
ref: ResolvedCommentRef;
|
|
1187
|
+
body: string;
|
|
1188
|
+
author?: Actor;
|
|
1189
|
+
/** How the author relates to the repository, where the forge reports it. */
|
|
1190
|
+
authorAssociation?: AuthorAssociation;
|
|
1191
|
+
/** Forge-native association the normalised `authorAssociation` was derived from. */
|
|
1192
|
+
authorAssociationRaw?: string;
|
|
1193
|
+
createdAt?: Date;
|
|
1194
|
+
updatedAt?: Date;
|
|
1195
|
+
url?: string;
|
|
1196
|
+
reactions?: ReactionSummary;
|
|
1197
|
+
/** The resolvable conversation the comment belongs to, where the forge has one; `resolveReviewThread()` takes its id. */
|
|
1198
|
+
thread?: {
|
|
1199
|
+
id: string;
|
|
1200
|
+
resolved: boolean;
|
|
1201
|
+
};
|
|
1202
|
+
raw: unknown;
|
|
1203
|
+
}
|
|
1204
|
+
/** A comment on a commit. */
|
|
1205
|
+
interface CommitComment extends Omit<Comment, "ref" | "thread"> {
|
|
1206
|
+
ref: CommitCommentRef;
|
|
1207
|
+
}
|
|
1208
|
+
/** Whether the account gets notifications for a thread. */
|
|
1209
|
+
type SubscriptionState = "subscribed" | "ignored" | "none";
|
|
1210
|
+
/** What an event is about. */
|
|
1211
|
+
type EventKind = "comment" | "review" | "review_comment" | "commit" | "label" | "state_change" | "assignment" | "mention" | "referenced" | "reaction" | "push" | "ref" | "repo" | "installation" | "membership" | "release" | "star" | "fork" | "wiki" | "issue_type" | "other";
|
|
1212
|
+
/** A commit as a push delivery reports it. */
|
|
1213
|
+
interface PushCommit {
|
|
1214
|
+
sha: string;
|
|
1215
|
+
message?: string;
|
|
1216
|
+
author?: string;
|
|
1217
|
+
url?: string;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* What happened, independent of `kind`, so "anything that closed" is
|
|
1221
|
+
* `action === 'closed'` whatever the subject.
|
|
1222
|
+
*/
|
|
1223
|
+
type EventAction = "opened" | "closed" | "reopened" | "merged" | "edited" | "created" | "deleted" | "submitted" | "labelled" | "unlabelled" | "assigned" | "unassigned" | "review_requested" | "synchronised" | "ready_for_review" | "converted_to_draft" | "published" | "renamed" | "transferred" | "archived" | "unarchived" | "added" | "removed" | "typed" | "untyped" | "other";
|
|
1224
|
+
/** Typed detail for an event. Discriminated by `type`. */
|
|
1225
|
+
type EventDetail = {
|
|
1226
|
+
type: "comment";
|
|
1227
|
+
comment?: CommentRef | CommitCommentRef;
|
|
1228
|
+
body?: string;
|
|
1229
|
+
} | {
|
|
1230
|
+
type: "review_comment";
|
|
1231
|
+
comment?: CommentRef;
|
|
1232
|
+
body?: string;
|
|
1233
|
+
path?: string;
|
|
1234
|
+
line?: number;
|
|
1235
|
+
} | {
|
|
1236
|
+
type: "review";
|
|
1237
|
+
state: ReviewState;
|
|
1238
|
+
stateRaw?: string;
|
|
1239
|
+
body?: string;
|
|
1240
|
+
review?: ReviewRef;
|
|
1241
|
+
} | {
|
|
1242
|
+
type: "state_change";
|
|
1243
|
+
state?: ThreadState;
|
|
1244
|
+
draft?: boolean;
|
|
1245
|
+
reason?: string;
|
|
1246
|
+
} | {
|
|
1247
|
+
type: "label";
|
|
1248
|
+
label: string;
|
|
1249
|
+
} | {
|
|
1250
|
+
type: "assignment";
|
|
1251
|
+
assignee?: Actor;
|
|
1252
|
+
} | {
|
|
1253
|
+
type: "push";
|
|
1254
|
+
ref: string;
|
|
1255
|
+
before?: string;
|
|
1256
|
+
after?: string;
|
|
1257
|
+
commitCount?: number;
|
|
1258
|
+
forced: boolean;
|
|
1259
|
+
commits: PushCommit[];
|
|
1260
|
+
} | {
|
|
1261
|
+
type: "ref";
|
|
1262
|
+
ref: string;
|
|
1263
|
+
refType: "branch" | "tag" | (string & {});
|
|
1264
|
+
} | {
|
|
1265
|
+
type: "repo_renamed";
|
|
1266
|
+
from: string;
|
|
1267
|
+
to: string;
|
|
1268
|
+
} | {
|
|
1269
|
+
type: "repo_transferred";
|
|
1270
|
+
fromOwner?: string;
|
|
1271
|
+
toOwner?: string;
|
|
1272
|
+
} | {
|
|
1273
|
+
type: "repo_archived";
|
|
1274
|
+
archived: boolean;
|
|
1275
|
+
} | {
|
|
1276
|
+
type: "installation";
|
|
1277
|
+
actionRaw: string;
|
|
1278
|
+
installationId?: string;
|
|
1279
|
+
added: RepoRef[];
|
|
1280
|
+
removed: RepoRef[];
|
|
1281
|
+
} | {
|
|
1282
|
+
type: "membership";
|
|
1283
|
+
actionRaw: string;
|
|
1284
|
+
member?: Actor;
|
|
1285
|
+
} | {
|
|
1286
|
+
type: "release";
|
|
1287
|
+
release?: ReleaseRef;
|
|
1288
|
+
tag?: string;
|
|
1289
|
+
name?: string;
|
|
1290
|
+
body?: string;
|
|
1291
|
+
isPrerelease?: boolean;
|
|
1292
|
+
isDraft?: boolean;
|
|
1293
|
+
url?: string;
|
|
1294
|
+
} | {
|
|
1295
|
+
type: "fork";
|
|
1296
|
+
fork?: RepoRef;
|
|
1297
|
+
} | {
|
|
1298
|
+
type: "wiki";
|
|
1299
|
+
title?: string;
|
|
1300
|
+
url?: string;
|
|
1301
|
+
} | {
|
|
1302
|
+
type: "issue_type";
|
|
1303
|
+
issueType: IssueType;
|
|
1304
|
+
} | {
|
|
1305
|
+
type: "repo_visibility";
|
|
1306
|
+
isPublic: boolean;
|
|
1307
|
+
} | {
|
|
1308
|
+
type: "referenced";
|
|
1309
|
+
from?: ThreadRef | CommitRef;
|
|
1310
|
+
fromRepo?: RepoRef;
|
|
1311
|
+
text?: string;
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* Fields of a {@link Thread} that an event's source carries. A field is absent
|
|
1315
|
+
* when the source does not report it; `labels: []` means the source listed no
|
|
1316
|
+
* labels. `threads.get()` reads the rest.
|
|
1317
|
+
*/
|
|
1318
|
+
interface ThreadSnapshot {
|
|
1319
|
+
title?: string;
|
|
1320
|
+
body?: string;
|
|
1321
|
+
state?: Exclude<ThreadState, "unknown">;
|
|
1322
|
+
stateRaw?: string;
|
|
1323
|
+
stateReason?: string;
|
|
1324
|
+
isDraft?: boolean;
|
|
1325
|
+
author?: Actor;
|
|
1326
|
+
labels?: Label[];
|
|
1327
|
+
/** Absent both when the issue has no type and when the source doesn't report one. */
|
|
1328
|
+
issueType?: IssueType;
|
|
1329
|
+
url?: string;
|
|
1330
|
+
branches?: PullBranches;
|
|
1331
|
+
stats?: PullStats;
|
|
1332
|
+
mergedBy?: Actor;
|
|
1333
|
+
}
|
|
1334
|
+
/** An event on a forge, such as a comment, a state change or a push. */
|
|
1335
|
+
interface ForgeEvent extends ForgeOrigin {
|
|
1336
|
+
id: string;
|
|
1337
|
+
kind: EventKind;
|
|
1338
|
+
/** Forge-native event name the normalised `kind` was derived from. */
|
|
1339
|
+
kindRaw?: string;
|
|
1340
|
+
/** Normalised verb; `other` when the forge's wording has no equivalent. */
|
|
1341
|
+
action: EventAction;
|
|
1342
|
+
/** Forge-native verb `action` was derived from. */
|
|
1343
|
+
actionRaw?: string;
|
|
1344
|
+
/** Single line describing the event, suitable for a list row. */
|
|
1345
|
+
summary: string;
|
|
1346
|
+
/** When the event happened, from the forge's own timestamp unless `undated` is set. */
|
|
1347
|
+
occurredAt: Date;
|
|
1348
|
+
/** Whether the forge reported no time for the event. `occurredAt` is then the time the event reached `forges` (or Jetstream, for a Tangled subscription), or the Unix epoch for an entry of a thread's timeline. */
|
|
1349
|
+
undated?: boolean;
|
|
1350
|
+
actor?: Actor;
|
|
1351
|
+
repo?: RepoRef;
|
|
1352
|
+
thread?: ThreadRef;
|
|
1353
|
+
/** The commit the event concerns, such as the commit of a commit comment. */
|
|
1354
|
+
commit?: CommitRef;
|
|
1355
|
+
/** What the event's source says about `thread`, as of when the forge built the payload. */
|
|
1356
|
+
threadSnapshot?: ThreadSnapshot;
|
|
1357
|
+
/** Whether anyone can see the event, where the forge says so. `false` covers private and internal repositories alike. */
|
|
1358
|
+
isPublic?: boolean;
|
|
1359
|
+
/** The details that belong to the kind of event. */
|
|
1360
|
+
detail?: EventDetail;
|
|
1361
|
+
/** App installation the delivery belongs to, for app webhooks. */
|
|
1362
|
+
installationId?: string;
|
|
1363
|
+
/** Delivery mechanism the event arrived through. */
|
|
1364
|
+
source: SourceKind;
|
|
1365
|
+
/** Unnormalised forge payload, retained for fidelity. */
|
|
1366
|
+
payload: unknown;
|
|
1367
|
+
}
|
|
1368
|
+
/** How an event reached the caller. */
|
|
1369
|
+
type SourceKind = "poll" | "webhook" | "stream";
|
|
1370
|
+
/**
|
|
1371
|
+
* Why a notification was delivered. `'unknown'` covers forges that report no
|
|
1372
|
+
* reason and native reasons with no normalised equivalent; `reasonRaw` keeps
|
|
1373
|
+
* the original.
|
|
1374
|
+
*/
|
|
1375
|
+
type NotificationReason = "access_requested" | "approval_requested" | "assigned" | "author" | "ci_activity" | "comment" | "followed" | "invitation" | "manual" | "mention" | "merge_blocked" | "review_requested" | "review_submitted" | "security_alert" | "starred" | "state_change" | "subscribed" | "team_mention" | "unknown";
|
|
1376
|
+
/** What a notification is about. Not every notification concerns a thread. */
|
|
1377
|
+
type NotificationSubject = {
|
|
1378
|
+
type: "thread";
|
|
1379
|
+
thread: ThreadRef;
|
|
1380
|
+
} | {
|
|
1381
|
+
type: "commit";
|
|
1382
|
+
commit: CommitRef;
|
|
1383
|
+
} | {
|
|
1384
|
+
type: "repo";
|
|
1385
|
+
repo: RepoRef;
|
|
1386
|
+
} | {
|
|
1387
|
+
type: "actor";
|
|
1388
|
+
actor: Actor;
|
|
1389
|
+
} | {
|
|
1390
|
+
type: "release";
|
|
1391
|
+
release: ReleaseRef;
|
|
1392
|
+
} | {
|
|
1393
|
+
type: "security_alert";
|
|
1394
|
+
alert: SecurityAlertRef;
|
|
1395
|
+
} | {
|
|
1396
|
+
type: "other";
|
|
1397
|
+
typeRaw: string;
|
|
1398
|
+
repo?: RepoRef;
|
|
1399
|
+
id?: string;
|
|
1400
|
+
url?: string;
|
|
1401
|
+
};
|
|
1402
|
+
/** A notification of the authenticated account. */
|
|
1403
|
+
interface Notification {
|
|
1404
|
+
ref: NotificationRef;
|
|
1405
|
+
subject: NotificationSubject;
|
|
1406
|
+
/** Why the account got the notification. */
|
|
1407
|
+
reason: NotificationReason;
|
|
1408
|
+
/** Forge-native reason string. Absent when the forge reports no reason at all. */
|
|
1409
|
+
reasonRaw?: string;
|
|
1410
|
+
/** Forge-native subject type, for example `PullRequest`, `Release` or `followed`. */
|
|
1411
|
+
subjectTypeRaw?: string;
|
|
1412
|
+
unread: boolean;
|
|
1413
|
+
title: string;
|
|
1414
|
+
/** State of a thread subject as reported by the notification payload. */
|
|
1415
|
+
subjectState: ThreadState;
|
|
1416
|
+
subjectStateRaw?: string;
|
|
1417
|
+
updatedAt: Date;
|
|
1418
|
+
lastReadAt?: Date;
|
|
1419
|
+
url?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* The latest comment on a thread or commit subject, where the forge links it. Read it with `threads.getComment()`
|
|
1422
|
+
* or `commits.getComment()`. Absent when the latest activity is not a comment on the subject, such as a review comment.
|
|
1423
|
+
*/
|
|
1424
|
+
latestComment?: ResolvedCommentRef | CommitCommentRef;
|
|
1425
|
+
/** Unnormalised forge payload, retained for fidelity. */
|
|
1426
|
+
raw: unknown;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Opaque-ish resumption token. Fields are optional because forges differ in
|
|
1430
|
+
* what they support; callers should persist the whole object and hand it back.
|
|
1431
|
+
*/
|
|
1432
|
+
interface Cursor {
|
|
1433
|
+
/** Absolute URL of the next page, from a `Link` header or the body, on the requested origin. */
|
|
1434
|
+
nextUrl?: string;
|
|
1435
|
+
/** The `etag` of a first page, sent as `If-None-Match` when the cursor has neither `nextUrl` nor `token`. */
|
|
1436
|
+
etag?: string;
|
|
1437
|
+
/** Opaque forge-native cursor, for example a GraphQL `endCursor`. */
|
|
1438
|
+
token?: string;
|
|
1439
|
+
}
|
|
1440
|
+
/** Request budget the forge reported on the response, where it reports one. */
|
|
1441
|
+
interface RateLimit {
|
|
1442
|
+
/** The size of the request budget. */
|
|
1443
|
+
limit?: number;
|
|
1444
|
+
/** The number of requests left in the budget. */
|
|
1445
|
+
remaining?: number;
|
|
1446
|
+
/** When `remaining` resets. */
|
|
1447
|
+
resetAt?: Date;
|
|
1448
|
+
/**
|
|
1449
|
+
* The name of the budget, where the forge has several and names them, such as GitHub's `core`, `search` or
|
|
1450
|
+
* `graphql`, or GitLab's `throttle_authenticated_api`.
|
|
1451
|
+
*/
|
|
1452
|
+
resource?: string;
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* One page of a listing: its `items`, and the `cursor` to pass back for the next page. The cursor is absent on the
|
|
1456
|
+
* last page.
|
|
1457
|
+
*/
|
|
1458
|
+
interface Page<T> {
|
|
1459
|
+
items: T[];
|
|
1460
|
+
/**
|
|
1461
|
+
* The forge's reported total for the whole listing, when it reports one.
|
|
1462
|
+
* Absent when the forge reports no total, so an absent value is unknown and
|
|
1463
|
+
* not zero.
|
|
1464
|
+
*/
|
|
1465
|
+
total?: number;
|
|
1466
|
+
/** From the response headers of the request behind this page. */
|
|
1467
|
+
rateLimit?: RateLimit;
|
|
1468
|
+
/** Absent when the listing is exhausted. */
|
|
1469
|
+
cursor?: Cursor;
|
|
1470
|
+
/**
|
|
1471
|
+
* Validator of the first page, where the forge supports conditional
|
|
1472
|
+
* requests. Pass it back as `cursor: { etag }` to read the first page again.
|
|
1473
|
+
* Absent on later pages, and on listings that read more than one endpoint.
|
|
1474
|
+
*/
|
|
1475
|
+
etag?: string;
|
|
1476
|
+
/** True when the forge reported no change since `cursor.etag`. The page then has no items and no `cursor`. */
|
|
1477
|
+
notModified?: boolean;
|
|
1478
|
+
/**
|
|
1479
|
+
* True when the provider sent no request, because the forge asked to wait longer between reads of this feed. The
|
|
1480
|
+
* page has no items and a `feed_throttled` warning; read it again later, or pass `force: true`.
|
|
1481
|
+
*/
|
|
1482
|
+
throttled?: boolean;
|
|
1483
|
+
/**
|
|
1484
|
+
* The earliest time the forge allows the first page to be read again, as GitHub sets with `X-Poll-Interval`.
|
|
1485
|
+
* Until then, a read of the first page returns a `throttled` page unless it passes `force: true`.
|
|
1486
|
+
*/
|
|
1487
|
+
nextPollAt?: Date;
|
|
1488
|
+
/** The non-fatal problems that came up while reading the page. */
|
|
1489
|
+
warnings?: ForgeWarning[];
|
|
1490
|
+
}
|
|
1491
|
+
/** Options for listings that can start from a point in time: events, comments, reactions. */
|
|
1492
|
+
interface ListOptions extends PageOptions {
|
|
1493
|
+
/** Only items updated at or after this time. */
|
|
1494
|
+
since?: Date;
|
|
1495
|
+
}
|
|
1496
|
+
/** Options for `repos.events()` and `users.events()`. */
|
|
1497
|
+
interface EventFeedOptions extends PageOptions {
|
|
1498
|
+
/**
|
|
1499
|
+
* Read the first page even when the forge asked to wait longer between reads, as GitHub does with
|
|
1500
|
+
* `X-Poll-Interval`. Without it, such a read returns a `throttled` page.
|
|
1501
|
+
* @default false
|
|
1502
|
+
*/
|
|
1503
|
+
force?: boolean;
|
|
1504
|
+
}
|
|
1505
|
+
/** Options for `notifications.list()`. */
|
|
1506
|
+
interface NotificationListOptions extends ListOptions {
|
|
1507
|
+
/**
|
|
1508
|
+
* Include notifications already marked read.
|
|
1509
|
+
* @default false
|
|
1510
|
+
*/
|
|
1511
|
+
all?: boolean;
|
|
1512
|
+
/**
|
|
1513
|
+
* Read the first page even when the forge asked to wait longer between reads, as GitHub does with
|
|
1514
|
+
* `X-Poll-Interval`. Without it, such a read returns a `throttled` page.
|
|
1515
|
+
* @default false
|
|
1516
|
+
*/
|
|
1517
|
+
force?: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/** Filters for `threads.list()`. */
|
|
1520
|
+
interface ThreadQuery extends PageOptions {
|
|
1521
|
+
/** Omitted lists every listable kind; forges that list kinds separately emit them one after another. */
|
|
1522
|
+
kind?: "issue" | "pull_request" | "discussion";
|
|
1523
|
+
/**
|
|
1524
|
+
* `'closed'` includes merged pull requests; `'merged'` lists pull requests only,
|
|
1525
|
+
* and lists nothing for another `kind`.
|
|
1526
|
+
* @default 'open'
|
|
1527
|
+
*/
|
|
1528
|
+
state?: "open" | "closed" | "merged" | "all";
|
|
1529
|
+
/** Threads carrying every one of these labels. */
|
|
1530
|
+
labels?: string[];
|
|
1531
|
+
/** Author login. */
|
|
1532
|
+
author?: string;
|
|
1533
|
+
/** Assignee login. */
|
|
1534
|
+
assignee?: string;
|
|
1535
|
+
/**
|
|
1536
|
+
* Threads the login authored, is assigned, commented on or was mentioned in.
|
|
1537
|
+
* A listing without this filter ignores it and warns with `filter_unsupported`, as for `mentions` and `milestone`.
|
|
1538
|
+
*/
|
|
1539
|
+
involves?: string;
|
|
1540
|
+
/** Threads the login was mentioned in. */
|
|
1541
|
+
mentions?: string;
|
|
1542
|
+
/** Milestone title, or `'none'` for threads with no milestone. */
|
|
1543
|
+
milestone?: string;
|
|
1544
|
+
/** Updated at or after. */
|
|
1545
|
+
since?: Date;
|
|
1546
|
+
/** Created at or after. */
|
|
1547
|
+
createdAfter?: Date;
|
|
1548
|
+
/**
|
|
1549
|
+
* Unsupported orders produce a warning and the forge's own order.
|
|
1550
|
+
* @default 'created'
|
|
1551
|
+
*/
|
|
1552
|
+
sort?: "created" | "updated" | "comments";
|
|
1553
|
+
/**
|
|
1554
|
+
* @default 'desc'
|
|
1555
|
+
*/
|
|
1556
|
+
direction?: "asc" | "desc";
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* A structured search. Providers translate it into their own syntax; a
|
|
1560
|
+
* field the forge cannot filter on becomes a `filter_unsupported` warning
|
|
1561
|
+
* on the page rather than a filter applied client-side.
|
|
1562
|
+
*/
|
|
1563
|
+
interface ThreadSearchQuery extends PageOptions {
|
|
1564
|
+
/** Free text, matched against title and body. */
|
|
1565
|
+
text?: string;
|
|
1566
|
+
/**
|
|
1567
|
+
* Forge-native query syntax, added to the query as is, for qualifiers the
|
|
1568
|
+
* other fields don't cover. Forges whose search has no query syntax ignore
|
|
1569
|
+
* it with a `filter_unsupported` warning.
|
|
1570
|
+
*/
|
|
1571
|
+
queryRaw?: string;
|
|
1572
|
+
/** Limit to one repository. */
|
|
1573
|
+
repo?: RepoRef;
|
|
1574
|
+
/** Limit to the repositories of one account or namespace; `repo` wins when both are set. */
|
|
1575
|
+
owner?: string;
|
|
1576
|
+
kind?: "issue" | "pull_request";
|
|
1577
|
+
/** Defaults to every state. */
|
|
1578
|
+
state?: "open" | "closed" | "all";
|
|
1579
|
+
author?: string;
|
|
1580
|
+
/** Threads the login authored, is assigned, commented on or was mentioned in. */
|
|
1581
|
+
involves?: string;
|
|
1582
|
+
assignee?: string;
|
|
1583
|
+
/** Threads carrying every one of these labels. */
|
|
1584
|
+
labels?: string[];
|
|
1585
|
+
/** Updated at or after. */
|
|
1586
|
+
since?: Date;
|
|
1587
|
+
/** Defaults to the forge's relevance order. */
|
|
1588
|
+
sort?: "created" | "updated" | "comments" | "relevance";
|
|
1589
|
+
/**
|
|
1590
|
+
* @default 'desc'
|
|
1591
|
+
*/
|
|
1592
|
+
direction?: "asc" | "desc";
|
|
1593
|
+
}
|
|
1594
|
+
/** A search for commits. */
|
|
1595
|
+
interface CommitSearchQuery extends PageOptions {
|
|
1596
|
+
/** Free text, matched against the commit message. */
|
|
1597
|
+
text?: string;
|
|
1598
|
+
/** Forge-native query syntax; see {@link ThreadSearchQuery.queryRaw}. */
|
|
1599
|
+
queryRaw?: string;
|
|
1600
|
+
/** Limit to one repository. */
|
|
1601
|
+
repo?: RepoRef;
|
|
1602
|
+
/** Commits whose author is this login. */
|
|
1603
|
+
author?: string;
|
|
1604
|
+
/** Commits whose committer is this login. */
|
|
1605
|
+
committer?: string;
|
|
1606
|
+
/** Authored or committed at or after. */
|
|
1607
|
+
since?: Date;
|
|
1608
|
+
/** Authored or committed at or before. */
|
|
1609
|
+
until?: Date;
|
|
1610
|
+
/** Defaults to the forge's relevance order. */
|
|
1611
|
+
sort?: "author_date" | "committer_date";
|
|
1612
|
+
/**
|
|
1613
|
+
* @default 'desc'
|
|
1614
|
+
*/
|
|
1615
|
+
direction?: "asc" | "desc";
|
|
1616
|
+
}
|
|
1617
|
+
/** A search for repositories. */
|
|
1618
|
+
interface RepoSearchQuery extends PageOptions {
|
|
1619
|
+
text?: string;
|
|
1620
|
+
/** Forge-native query syntax; see {@link ThreadSearchQuery.queryRaw}. */
|
|
1621
|
+
queryRaw?: string;
|
|
1622
|
+
/** Limit to one account or namespace. */
|
|
1623
|
+
owner?: string;
|
|
1624
|
+
/** The main language of the repository. */
|
|
1625
|
+
language?: string;
|
|
1626
|
+
/** Defaults to the forge's relevance order. */
|
|
1627
|
+
sort?: "created" | "updated" | "stars" | "relevance";
|
|
1628
|
+
/**
|
|
1629
|
+
* @default desc
|
|
1630
|
+
*/
|
|
1631
|
+
direction?: "asc" | "desc";
|
|
1632
|
+
}
|
|
1633
|
+
/** A search for code. */
|
|
1634
|
+
interface CodeSearchQuery extends PageOptions {
|
|
1635
|
+
/** Free text, matched against the contents of files. */
|
|
1636
|
+
text?: string;
|
|
1637
|
+
/** Forge-native query syntax; see {@link ThreadSearchQuery.queryRaw}. */
|
|
1638
|
+
queryRaw?: string;
|
|
1639
|
+
/** Limit to one repository. */
|
|
1640
|
+
repo?: RepoRef;
|
|
1641
|
+
/** Limit to one account or namespace. */
|
|
1642
|
+
owner?: string;
|
|
1643
|
+
}
|
|
1644
|
+
/** Options accepted by every operation that sends requests; the other options types extend it. */
|
|
1645
|
+
interface BaseOptions {
|
|
1646
|
+
/**
|
|
1647
|
+
* Aborts the operation's requests, and the operation rejects with the signal's reason.
|
|
1648
|
+
* Writes the forge has already received are not undone.
|
|
1649
|
+
*/
|
|
1650
|
+
signal?: AbortSignal;
|
|
1651
|
+
}
|
|
1652
|
+
/** Options for `repos.templates()`. */
|
|
1653
|
+
interface RepoTemplateOptions extends BaseOptions {
|
|
1654
|
+
/** Only templates for this kind of thread. Defaults to both. */
|
|
1655
|
+
kind?: "issue" | "pull_request";
|
|
1656
|
+
}
|
|
1657
|
+
/** Options for listings that take no filters: releases, installations, labels. */
|
|
1658
|
+
interface PageOptions extends BaseOptions {
|
|
1659
|
+
/** How many items to ask for. The forge may return fewer. */
|
|
1660
|
+
perPage?: number;
|
|
1661
|
+
/** Resume after the page that returned this cursor. */
|
|
1662
|
+
cursor?: Cursor;
|
|
1663
|
+
}
|
|
1664
|
+
/** How the account is attached to the repositories it lists. */
|
|
1665
|
+
type RepoAffiliation = "owner" | "collaborator" | "organisation_member";
|
|
1666
|
+
/** Filters for `repos.list()`. */
|
|
1667
|
+
interface RepoQuery extends PageOptions {
|
|
1668
|
+
/** Defaults to every affiliation the forge lists. Unsupported values produce a `filter_unsupported` warning. */
|
|
1669
|
+
affiliation?: RepoAffiliation[];
|
|
1670
|
+
/** Only repositories with this visibility. */
|
|
1671
|
+
visibility?: RepoVisibility | "all";
|
|
1672
|
+
/** Defaults to the forge's own order. Unsupported orders produce a `sort_unsupported` warning. */
|
|
1673
|
+
sort?: "created" | "updated" | "pushed" | "name";
|
|
1674
|
+
/** Defaults to the forge's own direction. */
|
|
1675
|
+
direction?: "asc" | "desc";
|
|
1676
|
+
}
|
|
1677
|
+
/** Filters for `repos.contributors()`. */
|
|
1678
|
+
interface ContributorQuery extends PageOptions {
|
|
1679
|
+
/**
|
|
1680
|
+
* Includes contributors the forge has not linked to an account, as GitHub's `anon=1` does. GitHub links
|
|
1681
|
+
* only the first 500 author emails of a repository to accounts, and reports the rest with a `name` and an
|
|
1682
|
+
* `email` but no `actor`. GitLab and Gitee link no accounts, so all of theirs are already unlinked: `true`
|
|
1683
|
+
* changes nothing there, while `false` warns, since it asks for a list neither forge can report.
|
|
1684
|
+
*
|
|
1685
|
+
* @default false
|
|
1686
|
+
*/
|
|
1687
|
+
includeUnlinked?: boolean;
|
|
1688
|
+
}
|
|
1689
|
+
/** Filters for `repos.byOwner()`. */
|
|
1690
|
+
interface OwnerRepoQuery extends PageOptions {
|
|
1691
|
+
/** Only repositories with this visibility. */
|
|
1692
|
+
visibility?: RepoVisibility | "all";
|
|
1693
|
+
/**
|
|
1694
|
+
* Includes the repositories of nested groups, on forges that have them (GitLab).
|
|
1695
|
+
* @default false
|
|
1696
|
+
*/
|
|
1697
|
+
subgroups?: boolean;
|
|
1698
|
+
/** Defaults to the forge's own order. Unsupported orders produce a `sort_unsupported` warning. */
|
|
1699
|
+
sort?: "created" | "updated" | "pushed" | "name";
|
|
1700
|
+
/** Defaults to the forge's own direction. */
|
|
1701
|
+
direction?: "asc" | "desc";
|
|
1702
|
+
}
|
|
1703
|
+
/** What `threads.create()` needs. */
|
|
1704
|
+
interface ThreadInput {
|
|
1705
|
+
kind: "issue" | "pull_request" | "discussion";
|
|
1706
|
+
title: string;
|
|
1707
|
+
body?: string;
|
|
1708
|
+
/** Names of the labels to add. */
|
|
1709
|
+
labels?: string[];
|
|
1710
|
+
/** Logins, or actors where the forge needs ids. */
|
|
1711
|
+
assignees?: Array<string | Actor>;
|
|
1712
|
+
/** Pull requests: source branch, optionally `owner:branch` for forks. */
|
|
1713
|
+
head?: string;
|
|
1714
|
+
/** Pull requests: target branch. */
|
|
1715
|
+
base?: string;
|
|
1716
|
+
/** Open the pull request as a draft. */
|
|
1717
|
+
draft?: boolean;
|
|
1718
|
+
/** Discussions: category name or id. */
|
|
1719
|
+
category?: string;
|
|
1720
|
+
}
|
|
1721
|
+
/** The fields that `threads.update()` changes. Fields left out stay as they are. */
|
|
1722
|
+
interface ThreadUpdate {
|
|
1723
|
+
title?: string;
|
|
1724
|
+
body?: string;
|
|
1725
|
+
/** Closes or reopens the thread. To give a reason, use `threads.close()`. */
|
|
1726
|
+
state?: "open" | "closed";
|
|
1727
|
+
/** Names of the labels to replace the current ones; `[]` clears them. */
|
|
1728
|
+
labels?: string[];
|
|
1729
|
+
/** Logins, or actors where the forge needs ids, to replace the assignees; `[]` clears them. */
|
|
1730
|
+
assignees?: Array<string | Actor>;
|
|
1731
|
+
}
|
|
1732
|
+
/** One `threads.getMany()` entry, in input order; narrow on `ok`. */
|
|
1733
|
+
type GetManyResult = {
|
|
1734
|
+
ok: true;
|
|
1735
|
+
ref: ThreadRef;
|
|
1736
|
+
thread: Thread;
|
|
1737
|
+
} | {
|
|
1738
|
+
ok: false;
|
|
1739
|
+
ref: ThreadRef;
|
|
1740
|
+
warning: ForgeWarning;
|
|
1741
|
+
};
|
|
1742
|
+
/** A short-lived token that acts as one app installation. */
|
|
1743
|
+
interface InstallationToken {
|
|
1744
|
+
token: string;
|
|
1745
|
+
expiresAt: Date;
|
|
1746
|
+
permissions: Record<string, string>;
|
|
1747
|
+
/** Whether the token reaches all repositories or only selected ones. */
|
|
1748
|
+
repositorySelection?: string;
|
|
1749
|
+
}
|
|
1750
|
+
/** Maximum lengths the forge accepts, in characters. */
|
|
1751
|
+
interface TextLimits {
|
|
1752
|
+
bodyLength?: number;
|
|
1753
|
+
commentLength?: number;
|
|
1754
|
+
labelLength?: number;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* The ref of a repository on `origin` from the `owner/name` that people type. The name is what follows the last
|
|
1758
|
+
* slash, so a GitLab subgroup stays in `owner`.
|
|
1759
|
+
* @param origin The forge and instance, such as a provider.
|
|
1760
|
+
* @param slug The repository, such as `acme/widgets` or `acme/platform/widgets`.
|
|
1761
|
+
* @throws {TypeError} When `slug` has no owner or no name.
|
|
1762
|
+
* @example
|
|
1763
|
+
* ```ts
|
|
1764
|
+
* const repo = repoRef(provider, 'acme/widgets')
|
|
1765
|
+
* ```
|
|
1766
|
+
*/
|
|
1767
|
+
declare function repoRef(origin: ForgeOrigin, slug: string): RepoRef;
|
|
1768
|
+
/**
|
|
1769
|
+
* A thread ref whose number is known, and which can therefore be keyed and
|
|
1770
|
+
* fetched. Every thread, comment and review read from a forge carries one.
|
|
1771
|
+
*/
|
|
1772
|
+
interface ResolvedThreadRef extends ThreadRef {
|
|
1773
|
+
/** Per-repo thread number. */
|
|
1774
|
+
number: string;
|
|
1775
|
+
}
|
|
1776
|
+
/** A comment ref whose thread is resolved, and which can therefore be keyed. Every comment read from a forge carries one. */
|
|
1777
|
+
interface ResolvedCommentRef extends CommentRef {
|
|
1778
|
+
thread: ResolvedThreadRef;
|
|
1779
|
+
}
|
|
1780
|
+
/** How a pull request is merged. */
|
|
1781
|
+
type MergeMethod = "merge" | "squash" | "rebase" | "rebase_merge" | "fast_forward_only";
|
|
1782
|
+
/** Where the default title and message of a merge or squash commit come from. */
|
|
1783
|
+
interface MergeCommitDefaults {
|
|
1784
|
+
/** The pull request title, the commit's own title when there's just one, or the classic `Merge pull request #1 from acme/fix`. */
|
|
1785
|
+
title?: "pull_request_title" | "commit_or_pull_request_title" | "merge_message";
|
|
1786
|
+
/** The forge's own value, which stays set when `title` is a value this library doesn't know. */
|
|
1787
|
+
titleRaw?: string;
|
|
1788
|
+
/** The pull request body or title, its commit messages, or nothing at all. */
|
|
1789
|
+
message?: "pull_request_body" | "pull_request_title" | "commit_messages" | "blank";
|
|
1790
|
+
/** The forge's own value, which stays set when `message` is a value this library doesn't know. */
|
|
1791
|
+
messageRaw?: string;
|
|
1792
|
+
/** A template for the whole message, with placeholders such as GitLab's `%{title}`. Absent while the forge sticks to its built-in one. */
|
|
1793
|
+
template?: string;
|
|
1794
|
+
}
|
|
1795
|
+
/** Options for `threads.merge()`. */
|
|
1796
|
+
interface MergeOptions extends BaseOptions {
|
|
1797
|
+
/** Defaults to the repository's only allowed method. */
|
|
1798
|
+
method?: MergeMethod;
|
|
1799
|
+
/** Expected head sha; the merge is refused if the branch has moved. */
|
|
1800
|
+
sha?: string;
|
|
1801
|
+
/** Merge commit title. Where the forge takes a single message, it goes above `message`, separated by a blank line. */
|
|
1802
|
+
title?: string;
|
|
1803
|
+
/** Merge commit body, where the forge takes one. Where the forge takes a single message and `title` is unset, this is the whole message. */
|
|
1804
|
+
message?: string;
|
|
1805
|
+
/** Queue the merge until required checks pass, where the forge supports it. */
|
|
1806
|
+
whenChecksPass?: boolean;
|
|
1807
|
+
}
|
|
1808
|
+
/** What `threads.merge()` resolves with. */
|
|
1809
|
+
interface MergeResult {
|
|
1810
|
+
/**
|
|
1811
|
+
* `'merged'` once the pull request has merged. `'queued'` when the forge merges it later: with `whenChecksPass`,
|
|
1812
|
+
* or where it completes the merge in the background (Azure DevOps, and Bitbucket when the merge outlasts its timeout).
|
|
1813
|
+
*/
|
|
1814
|
+
status: "merged" | "queued";
|
|
1815
|
+
/** The commit that the merge made on the base branch, where the response reports it. */
|
|
1816
|
+
sha?: string;
|
|
1817
|
+
/** Unnormalised forge payload, retained for fidelity. Absent where the merge response has no body. */
|
|
1818
|
+
raw?: unknown;
|
|
1819
|
+
}
|
|
1820
|
+
/** How `threads.updateBranch()` brings the base branch into a pull request's head branch. */
|
|
1821
|
+
type UpdateBranchMethod = "merge" | "rebase";
|
|
1822
|
+
/** Options for `threads.updateBranch()`. */
|
|
1823
|
+
interface UpdateBranchOptions extends BaseOptions {
|
|
1824
|
+
/** Defaults to `'merge'`, or `'rebase'` where the forge can only rebase (GitLab). */
|
|
1825
|
+
method?: UpdateBranchMethod;
|
|
1826
|
+
/** Expected head sha; the update is refused with `BranchMovedError` if the branch has moved. */
|
|
1827
|
+
sha?: string;
|
|
1828
|
+
}
|
|
1829
|
+
/** What `threads.updateBranch()` resolves with. */
|
|
1830
|
+
interface UpdateBranchResult {
|
|
1831
|
+
/** `'updated'` once the head branch has the base in it. `'queued'` when the forge updates it in the background (GitHub, GitLab). */
|
|
1832
|
+
status: "updated" | "queued";
|
|
1833
|
+
/** Unnormalised forge payload, retained for fidelity. Absent where the response has no body. */
|
|
1834
|
+
raw?: unknown;
|
|
1835
|
+
}
|
|
1836
|
+
/** An app installation on an account, with its own credential scope. */
|
|
1837
|
+
interface Installation extends ForgeOrigin {
|
|
1838
|
+
id: string;
|
|
1839
|
+
account?: Actor;
|
|
1840
|
+
/** Forge-native target type, for example `Organization` or `User`. */
|
|
1841
|
+
targetTypeRaw?: string;
|
|
1842
|
+
/** Forge-native repository selection, for example `all` or `selected`. */
|
|
1843
|
+
repositorySelectionRaw?: string;
|
|
1844
|
+
raw: unknown;
|
|
1845
|
+
}
|
|
1846
|
+
//#endregion
|
|
1847
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/fetch-BmQltM0Y.d.mts
|
|
1848
|
+
//#region src/errors.d.ts
|
|
1849
|
+
/** Where an error happened: the forge, the instance and the request. */
|
|
1850
|
+
interface ForgeErrorContext {
|
|
1851
|
+
forge?: ForgeKind$1;
|
|
1852
|
+
instance?: ForgeInstance;
|
|
1853
|
+
url?: string;
|
|
1854
|
+
method?: string;
|
|
1855
|
+
}
|
|
1856
|
+
/** Base class for every error that forges throws. */
|
|
1857
|
+
declare class ForgeError extends Error {
|
|
1858
|
+
override name: string;
|
|
1859
|
+
/** The forge that the request went to. */
|
|
1860
|
+
readonly forge?: ForgeKind$1;
|
|
1861
|
+
readonly instance?: ForgeInstance;
|
|
1862
|
+
readonly url?: string;
|
|
1863
|
+
readonly method?: string;
|
|
1864
|
+
constructor(message: string, context?: ForgeErrorContext, options?: ErrorOptions);
|
|
1865
|
+
}
|
|
1866
|
+
/** The forge responded with an error. */
|
|
1867
|
+
declare class ForgeApiError extends ForgeError {
|
|
1868
|
+
override name: string;
|
|
1869
|
+
readonly status: number;
|
|
1870
|
+
/** Truncated response body, for diagnostics. */
|
|
1871
|
+
readonly body: string;
|
|
1872
|
+
constructor(message: string, status: number, body: string, context?: ForgeErrorContext, options?: ErrorOptions);
|
|
1873
|
+
}
|
|
1874
|
+
/** A 404: the resource does not exist, or the credential cannot see it. Many forges respond the same way to both. */
|
|
1875
|
+
declare class NotFoundError extends ForgeApiError {
|
|
1876
|
+
override name: string;
|
|
1877
|
+
}
|
|
1878
|
+
/** The forge rate limited the request and a retry didn't help. Every rate limit rejects with this class, primary or secondary. */
|
|
1879
|
+
declare class RateLimitedError extends ForgeApiError {
|
|
1880
|
+
override name: string;
|
|
1881
|
+
/** When to send again: after the forge's `retry-after`, or when a used-up budget resets. Absent when the forge names neither. */
|
|
1882
|
+
readonly resetAt?: Date;
|
|
1883
|
+
/**
|
|
1884
|
+
* Whether the forge applied a secondary limit, such as a limit on concurrent requests or on content creation,
|
|
1885
|
+
* rather than a used-up request budget. No remaining-request counter predicts it.
|
|
1886
|
+
*/
|
|
1887
|
+
readonly secondary: boolean;
|
|
1888
|
+
constructor(message: string, status: number, body: string, options?: {
|
|
1889
|
+
resetAt?: Date;
|
|
1890
|
+
secondary?: boolean;
|
|
1891
|
+
} & ForgeErrorContext, errorOptions?: ErrorOptions);
|
|
1892
|
+
}
|
|
1893
|
+
/** The pull request cannot be merged yet, typically because of failing or pending checks or branch protection. */
|
|
1894
|
+
declare class MergeBlockedError extends ForgeApiError {
|
|
1895
|
+
override name: string;
|
|
1896
|
+
}
|
|
1897
|
+
/** `contents.commitFiles()` was given an `expectedHead`, or `threads.updateBranch()` a `sha`, and the branch no longer points at it. */
|
|
1898
|
+
declare class BranchMovedError extends ForgeApiError {
|
|
1899
|
+
override name: string;
|
|
1900
|
+
}
|
|
1901
|
+
/** A request or a pending merge exceeded `timeout`. */
|
|
1902
|
+
declare class ForgeTimeoutError extends ForgeError {
|
|
1903
|
+
override name: string;
|
|
1904
|
+
/** The timeout that was exceeded, in milliseconds. */
|
|
1905
|
+
readonly timeout: number;
|
|
1906
|
+
constructor(message: string, timeout: number, context?: ForgeErrorContext, options?: ErrorOptions);
|
|
1907
|
+
}
|
|
1908
|
+
/** Options for one request of a fetcher. */
|
|
1909
|
+
interface RequestOptions extends Omit<RequestInit, "signal"> {
|
|
1910
|
+
/** Query parameters. Parameters that are `undefined` are left out. */
|
|
1911
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
1912
|
+
signal?: AbortSignal;
|
|
1913
|
+
/** Send `If-None-Match`, and resolve with `notModified` instead of throwing. */
|
|
1914
|
+
etag?: string;
|
|
1915
|
+
/** Serialised as the JSON request body, with a matching `content-type`. */
|
|
1916
|
+
json?: unknown;
|
|
1917
|
+
/** Rewrites a failure from this request, for endpoints whose statuses mean something specific. */
|
|
1918
|
+
mapError?: (error: unknown) => unknown;
|
|
1919
|
+
}
|
|
1920
|
+
/** A response whose body is read as it arrives rather than parsed. */
|
|
1921
|
+
interface RawResponse {
|
|
1922
|
+
status: number;
|
|
1923
|
+
headers: Headers;
|
|
1924
|
+
/** The body, read as it arrives. */
|
|
1925
|
+
body: ReadableStream<Uint8Array>;
|
|
1926
|
+
}
|
|
1927
|
+
/** Options for `provider.request()`. */
|
|
1928
|
+
interface ForgeRequestOptions extends BaseOptions {
|
|
1929
|
+
/** Query parameters. Parameters that are `undefined` are left out. */
|
|
1930
|
+
query?: RequestOptions["query"];
|
|
1931
|
+
/** Native fetch bodies and strings are sent as-is; other values are sent as JSON. */
|
|
1932
|
+
body?: unknown;
|
|
1933
|
+
/** Headers to send. They add to the provider's default headers. */
|
|
1934
|
+
headers?: Record<string, string>;
|
|
1935
|
+
/** Caller-declared mutation. Defaults to `false` for GET/HEAD/OPTIONS, otherwise `true`. */
|
|
1936
|
+
mutates?: boolean;
|
|
1937
|
+
}
|
|
1938
|
+
/** The result of `provider.request()`. */
|
|
1939
|
+
interface ForgeResponse<T> {
|
|
1940
|
+
status: number;
|
|
1941
|
+
/** The parsed JSON body, or the text of a body that is not JSON. */
|
|
1942
|
+
data: T;
|
|
1943
|
+
headers: Headers;
|
|
1944
|
+
/** The rate limit that the response headers report, when there is one. */
|
|
1945
|
+
rateLimit?: RateLimit;
|
|
1946
|
+
}
|
|
1947
|
+
/** `request()` with `raw`, for endpoints that respond with bytes rather than JSON. */
|
|
1948
|
+
interface ForgeRawRequestOptions extends ForgeRequestOptions {
|
|
1949
|
+
raw: true;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* `provider.request()`: sends a request with the provider's credentials, for endpoints that the model does not cover.
|
|
1953
|
+
*/
|
|
1954
|
+
interface ForgeRequest {
|
|
1955
|
+
(method: string, path: string, options: ForgeRawRequestOptions): Promise<RawResponse>;
|
|
1956
|
+
<T = unknown>(method: string, path: string, options?: ForgeRequestOptions): Promise<ForgeResponse<T>>;
|
|
1957
|
+
}
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/web-BB1at9UM.d.mts
|
|
1960
|
+
//#region src/web.d.ts
|
|
1961
|
+
/** A repository's section, for linking to the section itself rather than one entry in it. */
|
|
1962
|
+
type RepoSection = "issues" | "pullRequests" | "compare" | "releases" | "stargazers" | "forks" | "watchers";
|
|
1963
|
+
/**
|
|
1964
|
+
* Something with a web page. A revision (`at`, `base` or `head`) is a branch,
|
|
1965
|
+
* tag or commit sha; Azure DevOps reads anything but a full commit sha as a branch.
|
|
1966
|
+
*/
|
|
1967
|
+
type UrlTarget = {
|
|
1968
|
+
repo: RepoRef;
|
|
1969
|
+
} | {
|
|
1970
|
+
repo: RepoRef;
|
|
1971
|
+
section: RepoSection;
|
|
1972
|
+
} | {
|
|
1973
|
+
thread: ThreadRef;
|
|
1974
|
+
} | {
|
|
1975
|
+
comment: CommentRef;
|
|
1976
|
+
} | {
|
|
1977
|
+
release: ReleaseRef;
|
|
1978
|
+
} | {
|
|
1979
|
+
file: {
|
|
1980
|
+
repo: RepoRef;
|
|
1981
|
+
path: string;
|
|
1982
|
+
at: string;
|
|
1983
|
+
line?: number;
|
|
1984
|
+
};
|
|
1985
|
+
} | {
|
|
1986
|
+
raw: {
|
|
1987
|
+
repo: RepoRef;
|
|
1988
|
+
path: string;
|
|
1989
|
+
at: string;
|
|
1990
|
+
};
|
|
1991
|
+
} | {
|
|
1992
|
+
commit: {
|
|
1993
|
+
repo: RepoRef;
|
|
1994
|
+
sha: string;
|
|
1995
|
+
};
|
|
1996
|
+
} | {
|
|
1997
|
+
compare: {
|
|
1998
|
+
repo: RepoRef;
|
|
1999
|
+
base: string;
|
|
2000
|
+
head: string;
|
|
2001
|
+
};
|
|
2002
|
+
};
|
|
2003
|
+
/** What a forge web URL points at. `repo` is always set; the rest when the URL is that specific. */
|
|
2004
|
+
interface ParsedForgeUrl {
|
|
2005
|
+
repo: RepoRef;
|
|
2006
|
+
thread?: ThreadRef;
|
|
2007
|
+
comment?: CommentRef;
|
|
2008
|
+
commit?: CommitRef;
|
|
2009
|
+
release?: ReleaseRef;
|
|
2010
|
+
/** The tag of a tag page that is not a release page, such as GitLab's `-/tags/{tag}`. */
|
|
2011
|
+
tag?: string;
|
|
2012
|
+
/** The revisions of a page that compares two, such as `compare/{base}...{head}` or `compare/{base}..{head}`. */
|
|
2013
|
+
compare?: {
|
|
2014
|
+
base: string;
|
|
2015
|
+
head: string;
|
|
2016
|
+
};
|
|
2017
|
+
/**
|
|
2018
|
+
* A file page: the repository-relative `path`, the revision `at` and the first selected `line`.
|
|
2019
|
+
* `at` is unset when the URL leaves the revision to the default branch. An unencoded `/` in
|
|
2020
|
+
* a branch name reads as the start of `path`. Forges that address files and folders
|
|
2021
|
+
* alike, such as Forgejo, Bitbucket and Azure DevOps, also set this for a folder.
|
|
2022
|
+
*/
|
|
2023
|
+
file?: {
|
|
2024
|
+
path: string;
|
|
2025
|
+
at?: string;
|
|
2026
|
+
line?: number;
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
/** Options for `provider.referenceFor()`. */
|
|
2030
|
+
interface ReferenceOptions {
|
|
2031
|
+
/** Repository the reference is written in; a reference within it is the short form. */
|
|
2032
|
+
from?: RepoRef;
|
|
2033
|
+
/** Request the reference expanded to its title, where the forge supports it (GitLab's `+` suffix). */
|
|
2034
|
+
expand?: boolean;
|
|
2035
|
+
}
|
|
2036
|
+
/** Options for `provider.parseReferences()`. */
|
|
2037
|
+
interface ParseReferencesOptions {
|
|
2038
|
+
/** Repository the text is written in, which a short reference such as `#42` points into. */
|
|
2039
|
+
from: RepoRef;
|
|
2040
|
+
}
|
|
2041
|
+
/** A reference that `parseReferences()` found in text. */
|
|
2042
|
+
interface ParsedReference {
|
|
2043
|
+
/** The offset of the reference's first character. */
|
|
2044
|
+
start: number;
|
|
2045
|
+
/** The offset just past the reference. */
|
|
2046
|
+
end: number;
|
|
2047
|
+
/** The thread or commit it refers to. A commit `sha` is as written, so it can be abbreviated. */
|
|
2048
|
+
ref: ThreadRef | CommitRef;
|
|
2049
|
+
}
|
|
2050
|
+
//#endregion
|
|
2051
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/provider-DLQInvPp.d.mts
|
|
2052
|
+
/**
|
|
2053
|
+
* Rows omit what follows from the rest. `verbs` defaults to the capability,
|
|
2054
|
+
* and `spec` to the capability, or its page for a `listing` (`repos.labels`
|
|
2055
|
+
* is declared as `repos.labelsPage`), unless the row is `derived`. Traits
|
|
2056
|
+
* have no verbs.
|
|
2057
|
+
*/
|
|
2058
|
+
declare const TABLE: readonly [{
|
|
2059
|
+
readonly capability: "experimental";
|
|
2060
|
+
readonly derived: "experimental";
|
|
2061
|
+
readonly verbs: readonly [];
|
|
2062
|
+
}, {
|
|
2063
|
+
readonly capability: "sources.stream";
|
|
2064
|
+
}, {
|
|
2065
|
+
readonly capability: "repos.get";
|
|
2066
|
+
}, {
|
|
2067
|
+
readonly capability: "users.get";
|
|
2068
|
+
}, {
|
|
2069
|
+
readonly capability: "users.me";
|
|
2070
|
+
readonly account: true;
|
|
2071
|
+
}, {
|
|
2072
|
+
readonly capability: "users.sponsorable";
|
|
2073
|
+
readonly account: true;
|
|
2074
|
+
}, {
|
|
2075
|
+
readonly capability: "users.events";
|
|
2076
|
+
readonly listing: true;
|
|
2077
|
+
}, {
|
|
2078
|
+
readonly capability: "users.block";
|
|
2079
|
+
readonly write: true;
|
|
2080
|
+
readonly account: true;
|
|
2081
|
+
readonly spec: "users.blocking";
|
|
2082
|
+
readonly verbs: readonly ["users.block", "users.unblock"];
|
|
2083
|
+
}, {
|
|
2084
|
+
readonly capability: "repos.list";
|
|
2085
|
+
readonly account: true;
|
|
2086
|
+
readonly listing: true;
|
|
2087
|
+
}, {
|
|
2088
|
+
readonly capability: "repos.byOwner";
|
|
2089
|
+
readonly listing: true;
|
|
2090
|
+
}, {
|
|
2091
|
+
readonly capability: "repos.labels";
|
|
2092
|
+
readonly listing: true;
|
|
2093
|
+
}, {
|
|
2094
|
+
readonly capability: "repos.createLabel";
|
|
2095
|
+
readonly write: true;
|
|
2096
|
+
}, {
|
|
2097
|
+
readonly capability: "repos.milestones";
|
|
2098
|
+
readonly listing: true;
|
|
2099
|
+
}, {
|
|
2100
|
+
readonly capability: "repos.issueTypes";
|
|
2101
|
+
}, {
|
|
2102
|
+
readonly capability: "repos.collaborators";
|
|
2103
|
+
readonly listing: true;
|
|
2104
|
+
}, {
|
|
2105
|
+
readonly capability: "repos.contributors";
|
|
2106
|
+
readonly listing: true;
|
|
2107
|
+
}, {
|
|
2108
|
+
readonly capability: "repos.contributorStats";
|
|
2109
|
+
}, {
|
|
2110
|
+
readonly capability: "repos.templates";
|
|
2111
|
+
}, {
|
|
2112
|
+
readonly capability: "repos.permissionFor";
|
|
2113
|
+
}, {
|
|
2114
|
+
readonly capability: "repos.branchRules";
|
|
2115
|
+
}, {
|
|
2116
|
+
readonly capability: "repos.addCollaborator";
|
|
2117
|
+
readonly write: true;
|
|
2118
|
+
}, {
|
|
2119
|
+
readonly capability: "repos.assignableUsers";
|
|
2120
|
+
readonly listing: true;
|
|
2121
|
+
}, {
|
|
2122
|
+
readonly capability: "repos.reviewerCandidates";
|
|
2123
|
+
readonly listing: true;
|
|
2124
|
+
}, {
|
|
2125
|
+
readonly capability: "repos.events";
|
|
2126
|
+
readonly listing: true;
|
|
2127
|
+
}, {
|
|
2128
|
+
readonly capability: "orgs.teams";
|
|
2129
|
+
readonly listing: true;
|
|
2130
|
+
}, {
|
|
2131
|
+
readonly capability: "orgs.teamMembers";
|
|
2132
|
+
readonly listing: true;
|
|
2133
|
+
readonly account: true;
|
|
2134
|
+
}, {
|
|
2135
|
+
readonly capability: "orgs.block";
|
|
2136
|
+
readonly write: true;
|
|
2137
|
+
readonly spec: "orgs.blocking";
|
|
2138
|
+
readonly verbs: readonly ["orgs.block", "orgs.unblock"];
|
|
2139
|
+
}, {
|
|
2140
|
+
readonly capability: "threads.get";
|
|
2141
|
+
readonly perKind: true;
|
|
2142
|
+
}, {
|
|
2143
|
+
readonly capability: "threads.list";
|
|
2144
|
+
readonly listing: true;
|
|
2145
|
+
readonly perKind: true;
|
|
2146
|
+
}, {
|
|
2147
|
+
readonly capability: "threads.getMany";
|
|
2148
|
+
}, {
|
|
2149
|
+
readonly capability: "threads.closingIssues";
|
|
2150
|
+
readonly listing: true;
|
|
2151
|
+
}, {
|
|
2152
|
+
readonly capability: "threads.closingPullRequests";
|
|
2153
|
+
readonly listing: true;
|
|
2154
|
+
}, {
|
|
2155
|
+
readonly capability: "threads.events";
|
|
2156
|
+
readonly listing: true;
|
|
2157
|
+
readonly spec: "threads.eventsPage";
|
|
2158
|
+
readonly derived: "threadEvents";
|
|
2159
|
+
}, {
|
|
2160
|
+
readonly capability: "threads.comments";
|
|
2161
|
+
readonly listing: true;
|
|
2162
|
+
readonly perKind: true;
|
|
2163
|
+
}, {
|
|
2164
|
+
readonly capability: "threads.getComment";
|
|
2165
|
+
readonly spec: "threads.getComment";
|
|
2166
|
+
readonly derived: "getComment";
|
|
2167
|
+
readonly perKind: true;
|
|
2168
|
+
}, {
|
|
2169
|
+
readonly capability: "threads.createComment";
|
|
2170
|
+
readonly write: true;
|
|
2171
|
+
readonly perKind: true;
|
|
2172
|
+
}, {
|
|
2173
|
+
readonly capability: "threads.updateComment";
|
|
2174
|
+
readonly write: true;
|
|
2175
|
+
readonly perKind: true;
|
|
2176
|
+
}, {
|
|
2177
|
+
readonly capability: "threads.deleteComment";
|
|
2178
|
+
readonly write: true;
|
|
2179
|
+
readonly perKind: true;
|
|
2180
|
+
}, {
|
|
2181
|
+
readonly capability: "threads.hideComment";
|
|
2182
|
+
readonly write: true;
|
|
2183
|
+
readonly spec: "threads.hiding";
|
|
2184
|
+
readonly perKind: true;
|
|
2185
|
+
readonly verbs: readonly ["threads.hideComment", "threads.unhideComment"];
|
|
2186
|
+
}, {
|
|
2187
|
+
readonly capability: "threads.reactions";
|
|
2188
|
+
readonly listing: true;
|
|
2189
|
+
readonly perKind: true;
|
|
2190
|
+
}, {
|
|
2191
|
+
readonly capability: "threads.react";
|
|
2192
|
+
readonly write: true;
|
|
2193
|
+
readonly spec: "threads.reactions";
|
|
2194
|
+
readonly perKind: true;
|
|
2195
|
+
readonly verbs: readonly ["threads.react", "threads.unreact"];
|
|
2196
|
+
}, {
|
|
2197
|
+
readonly capability: "threads.create";
|
|
2198
|
+
readonly write: true;
|
|
2199
|
+
readonly perKind: true;
|
|
2200
|
+
}, {
|
|
2201
|
+
readonly capability: "threads.update";
|
|
2202
|
+
readonly write: true;
|
|
2203
|
+
readonly perKind: true;
|
|
2204
|
+
}, {
|
|
2205
|
+
readonly capability: "threads.close";
|
|
2206
|
+
readonly write: true;
|
|
2207
|
+
readonly perKind: true;
|
|
2208
|
+
}, {
|
|
2209
|
+
readonly capability: "threads.reopen";
|
|
2210
|
+
readonly write: true;
|
|
2211
|
+
readonly perKind: true;
|
|
2212
|
+
}, {
|
|
2213
|
+
readonly capability: "threads.lock";
|
|
2214
|
+
readonly write: true;
|
|
2215
|
+
readonly spec: "threads.locking";
|
|
2216
|
+
readonly perKind: true;
|
|
2217
|
+
readonly verbs: readonly ["threads.lock", "threads.unlock"];
|
|
2218
|
+
}, {
|
|
2219
|
+
readonly capability: "threads.setLabels";
|
|
2220
|
+
readonly write: true;
|
|
2221
|
+
readonly perKind: true;
|
|
2222
|
+
}, {
|
|
2223
|
+
readonly capability: "threads.addLabels";
|
|
2224
|
+
readonly write: true;
|
|
2225
|
+
readonly perKind: true;
|
|
2226
|
+
}, {
|
|
2227
|
+
readonly capability: "threads.removeLabels";
|
|
2228
|
+
readonly write: true;
|
|
2229
|
+
readonly perKind: true;
|
|
2230
|
+
}, {
|
|
2231
|
+
readonly capability: "threads.setMilestone";
|
|
2232
|
+
readonly write: true;
|
|
2233
|
+
readonly perKind: true;
|
|
2234
|
+
}, {
|
|
2235
|
+
readonly capability: "threads.setIssueType";
|
|
2236
|
+
readonly write: true;
|
|
2237
|
+
readonly perKind: true;
|
|
2238
|
+
}, {
|
|
2239
|
+
readonly capability: "threads.setAssignees";
|
|
2240
|
+
readonly write: true;
|
|
2241
|
+
readonly perKind: true;
|
|
2242
|
+
}, {
|
|
2243
|
+
readonly capability: "threads.requestReview";
|
|
2244
|
+
readonly write: true;
|
|
2245
|
+
readonly perKind: true;
|
|
2246
|
+
}, {
|
|
2247
|
+
readonly capability: "threads.merge";
|
|
2248
|
+
readonly write: true;
|
|
2249
|
+
}, {
|
|
2250
|
+
readonly capability: "threads.updateBranch";
|
|
2251
|
+
readonly write: true;
|
|
2252
|
+
}, {
|
|
2253
|
+
readonly capability: "threads.transfer";
|
|
2254
|
+
readonly write: true;
|
|
2255
|
+
}, {
|
|
2256
|
+
readonly capability: "threads.markDuplicate";
|
|
2257
|
+
readonly write: true;
|
|
2258
|
+
}, {
|
|
2259
|
+
readonly capability: "threads.subscription";
|
|
2260
|
+
readonly account: true;
|
|
2261
|
+
readonly spec: "threads.subscriptions";
|
|
2262
|
+
readonly perKind: true;
|
|
2263
|
+
}, {
|
|
2264
|
+
readonly capability: "threads.subscribe";
|
|
2265
|
+
readonly write: true;
|
|
2266
|
+
readonly derived: "subscriptionSet";
|
|
2267
|
+
readonly verbs: readonly ["threads.subscribe", "threads.unsubscribe"];
|
|
2268
|
+
}, {
|
|
2269
|
+
readonly capability: "threads.checks";
|
|
2270
|
+
readonly perKind: true;
|
|
2271
|
+
}, {
|
|
2272
|
+
readonly capability: "threads.files";
|
|
2273
|
+
readonly listing: true;
|
|
2274
|
+
}, {
|
|
2275
|
+
readonly capability: "threads.commits";
|
|
2276
|
+
readonly listing: true;
|
|
2277
|
+
}, {
|
|
2278
|
+
readonly capability: "threads.reviews";
|
|
2279
|
+
readonly listing: true;
|
|
2280
|
+
}, {
|
|
2281
|
+
readonly capability: "threads.getReview";
|
|
2282
|
+
readonly spec: "threads.getReview";
|
|
2283
|
+
readonly derived: "getReview";
|
|
2284
|
+
}, {
|
|
2285
|
+
readonly capability: "threads.createReview";
|
|
2286
|
+
readonly write: true;
|
|
2287
|
+
}, {
|
|
2288
|
+
readonly capability: "threads.submitReview";
|
|
2289
|
+
readonly write: true;
|
|
2290
|
+
}, {
|
|
2291
|
+
readonly capability: "threads.approve";
|
|
2292
|
+
readonly write: true;
|
|
2293
|
+
readonly spec: "threads.approve";
|
|
2294
|
+
readonly derived: "approve";
|
|
2295
|
+
}, {
|
|
2296
|
+
readonly capability: "threads.replyToReviewComment";
|
|
2297
|
+
readonly write: true;
|
|
2298
|
+
}, {
|
|
2299
|
+
readonly capability: "threads.resolveReviewThread";
|
|
2300
|
+
readonly write: true;
|
|
2301
|
+
readonly spec: "threads.reviewThreads";
|
|
2302
|
+
readonly verbs: readonly ["threads.resolveReviewThread", "threads.unresolveReviewThread"];
|
|
2303
|
+
}, {
|
|
2304
|
+
readonly capability: "notifications.list";
|
|
2305
|
+
readonly account: true;
|
|
2306
|
+
readonly listing: true;
|
|
2307
|
+
}, {
|
|
2308
|
+
readonly capability: "notifications.markRead";
|
|
2309
|
+
readonly account: true;
|
|
2310
|
+
readonly write: true;
|
|
2311
|
+
}, {
|
|
2312
|
+
readonly capability: "notifications.markDone";
|
|
2313
|
+
readonly account: true;
|
|
2314
|
+
readonly write: true;
|
|
2315
|
+
}, {
|
|
2316
|
+
readonly capability: "notifications.unsubscribe";
|
|
2317
|
+
readonly account: true;
|
|
2318
|
+
readonly write: true;
|
|
2319
|
+
}, {
|
|
2320
|
+
readonly capability: "notifications.markAllRead";
|
|
2321
|
+
readonly account: true;
|
|
2322
|
+
readonly write: true;
|
|
2323
|
+
}, {
|
|
2324
|
+
readonly capability: "notifications.markAllDone";
|
|
2325
|
+
readonly account: true;
|
|
2326
|
+
readonly write: true;
|
|
2327
|
+
}, {
|
|
2328
|
+
readonly capability: "notifications.unreadCount";
|
|
2329
|
+
readonly account: true;
|
|
2330
|
+
}, {
|
|
2331
|
+
readonly capability: "installations.list";
|
|
2332
|
+
readonly account: true;
|
|
2333
|
+
readonly spec: "installations";
|
|
2334
|
+
readonly verbs: readonly ["installations.list", "installations.get", "installations.token", "installations.repos", "installations.provider", "installations.providers"];
|
|
2335
|
+
readonly listings: readonly ["installations.list", "installations.repos"];
|
|
2336
|
+
}, {
|
|
2337
|
+
readonly capability: "checks.list";
|
|
2338
|
+
}, {
|
|
2339
|
+
readonly capability: "checks.get";
|
|
2340
|
+
}, {
|
|
2341
|
+
readonly capability: "checks.report";
|
|
2342
|
+
readonly write: true;
|
|
2343
|
+
}, {
|
|
2344
|
+
readonly capability: "checks.rerun";
|
|
2345
|
+
readonly write: true;
|
|
2346
|
+
}, {
|
|
2347
|
+
readonly capability: "ci.runs";
|
|
2348
|
+
readonly listing: true;
|
|
2349
|
+
}, {
|
|
2350
|
+
readonly capability: "ci.getRun";
|
|
2351
|
+
}, {
|
|
2352
|
+
readonly capability: "ci.jobs";
|
|
2353
|
+
readonly listing: true;
|
|
2354
|
+
}, {
|
|
2355
|
+
readonly capability: "ci.getJob";
|
|
2356
|
+
readonly spec: "ci.getJob";
|
|
2357
|
+
readonly derived: "ciJob";
|
|
2358
|
+
}, {
|
|
2359
|
+
readonly capability: "ci.log";
|
|
2360
|
+
}, {
|
|
2361
|
+
readonly capability: "ci.rerunFailed";
|
|
2362
|
+
readonly write: true;
|
|
2363
|
+
}, {
|
|
2364
|
+
readonly capability: "contents.getFile";
|
|
2365
|
+
}, {
|
|
2366
|
+
readonly capability: "contents.tree";
|
|
2367
|
+
readonly listing: true;
|
|
2368
|
+
}, {
|
|
2369
|
+
readonly capability: "contents.branches";
|
|
2370
|
+
readonly listing: true;
|
|
2371
|
+
}, {
|
|
2372
|
+
readonly capability: "contents.tags";
|
|
2373
|
+
readonly listing: true;
|
|
2374
|
+
}, {
|
|
2375
|
+
readonly capability: "contents.resolveRef";
|
|
2376
|
+
}, {
|
|
2377
|
+
readonly capability: "contents.compare";
|
|
2378
|
+
}, {
|
|
2379
|
+
readonly capability: "contents.commitFiles";
|
|
2380
|
+
readonly write: true;
|
|
2381
|
+
}, {
|
|
2382
|
+
readonly capability: "commits.list";
|
|
2383
|
+
readonly listing: true;
|
|
2384
|
+
}, {
|
|
2385
|
+
readonly capability: "commits.get";
|
|
2386
|
+
}, {
|
|
2387
|
+
readonly capability: "commits.comments";
|
|
2388
|
+
readonly listing: true;
|
|
2389
|
+
}, {
|
|
2390
|
+
readonly capability: "commits.getComment";
|
|
2391
|
+
readonly spec: "commits.getComment";
|
|
2392
|
+
readonly derived: "commitComment";
|
|
2393
|
+
}, {
|
|
2394
|
+
readonly capability: "commits.createComment";
|
|
2395
|
+
readonly write: true;
|
|
2396
|
+
}, {
|
|
2397
|
+
readonly capability: "commits.updateComment";
|
|
2398
|
+
readonly write: true;
|
|
2399
|
+
}, {
|
|
2400
|
+
readonly capability: "commits.deleteComment";
|
|
2401
|
+
readonly write: true;
|
|
2402
|
+
}, {
|
|
2403
|
+
readonly capability: "commits.hideComment";
|
|
2404
|
+
readonly write: true;
|
|
2405
|
+
readonly spec: "commits.commentHiding";
|
|
2406
|
+
readonly verbs: readonly ["commits.hideComment", "commits.unhideComment"];
|
|
2407
|
+
}, {
|
|
2408
|
+
readonly capability: "releases.list";
|
|
2409
|
+
readonly listing: true;
|
|
2410
|
+
}, {
|
|
2411
|
+
readonly capability: "releases.get";
|
|
2412
|
+
}, {
|
|
2413
|
+
readonly capability: "releases.latest";
|
|
2414
|
+
}, {
|
|
2415
|
+
readonly capability: "releases.getByTag";
|
|
2416
|
+
}, {
|
|
2417
|
+
readonly capability: "releases.downloadAsset";
|
|
2418
|
+
}, {
|
|
2419
|
+
readonly capability: "releases.create";
|
|
2420
|
+
readonly write: true;
|
|
2421
|
+
}, {
|
|
2422
|
+
readonly capability: "releases.update";
|
|
2423
|
+
readonly write: true;
|
|
2424
|
+
}, {
|
|
2425
|
+
readonly capability: "webhooks.ingest";
|
|
2426
|
+
readonly derived: "webhook";
|
|
2427
|
+
readonly verbs: readonly ["webhooks.verify", "webhooks.ingest"];
|
|
2428
|
+
}, {
|
|
2429
|
+
readonly capability: "webhooks.list";
|
|
2430
|
+
readonly account: true;
|
|
2431
|
+
readonly listing: true;
|
|
2432
|
+
}, {
|
|
2433
|
+
readonly capability: "webhooks.create";
|
|
2434
|
+
readonly write: true;
|
|
2435
|
+
}, {
|
|
2436
|
+
readonly capability: "webhooks.update";
|
|
2437
|
+
readonly write: true;
|
|
2438
|
+
}, {
|
|
2439
|
+
readonly capability: "webhooks.delete";
|
|
2440
|
+
readonly write: true;
|
|
2441
|
+
}, {
|
|
2442
|
+
readonly capability: "webhooks.rotateSecret";
|
|
2443
|
+
readonly write: true;
|
|
2444
|
+
}, {
|
|
2445
|
+
readonly capability: "webhooks.deliveries";
|
|
2446
|
+
readonly account: true;
|
|
2447
|
+
readonly listing: true;
|
|
2448
|
+
}, {
|
|
2449
|
+
readonly capability: "webhooks.redeliver";
|
|
2450
|
+
readonly write: true;
|
|
2451
|
+
}, {
|
|
2452
|
+
readonly capability: "search.threads";
|
|
2453
|
+
readonly listing: true;
|
|
2454
|
+
}, {
|
|
2455
|
+
readonly capability: "search.repos";
|
|
2456
|
+
readonly listing: true;
|
|
2457
|
+
}, {
|
|
2458
|
+
readonly capability: "search.commits";
|
|
2459
|
+
readonly listing: true;
|
|
2460
|
+
}, {
|
|
2461
|
+
readonly capability: "search.code";
|
|
2462
|
+
readonly listing: true;
|
|
2463
|
+
}, {
|
|
2464
|
+
readonly capability: "securityAlerts.list";
|
|
2465
|
+
readonly listing: true;
|
|
2466
|
+
readonly derived: "alertKinds";
|
|
2467
|
+
}, {
|
|
2468
|
+
readonly capability: "eventKinds";
|
|
2469
|
+
readonly derived: "eventKinds";
|
|
2470
|
+
readonly verbs: readonly [];
|
|
2471
|
+
}, {
|
|
2472
|
+
readonly capability: "authKinds";
|
|
2473
|
+
readonly derived: "authKinds";
|
|
2474
|
+
readonly verbs: readonly [];
|
|
2475
|
+
}, {
|
|
2476
|
+
readonly capability: "limits";
|
|
2477
|
+
readonly derived: "limits";
|
|
2478
|
+
readonly verbs: readonly [];
|
|
2479
|
+
}];
|
|
2480
|
+
type VerbsOf<R> = R extends {
|
|
2481
|
+
verbs: readonly (infer V extends string)[];
|
|
2482
|
+
} ? V : R extends {
|
|
2483
|
+
capability: infer C extends string;
|
|
2484
|
+
} ? C : never;
|
|
2485
|
+
/** A provider verb, named by its path on `ForgeProvider`. */
|
|
2486
|
+
type ForgeVerb = VerbsOf<(typeof TABLE)[number]>;
|
|
2487
|
+
/** The credential types that a provider can accept. */
|
|
2488
|
+
type AuthKind = "token" | "basic" | "app" | "app_password" | "oauth" | "anonymous";
|
|
2489
|
+
/** Per-thread-kind support. */
|
|
2490
|
+
type PerKind = Record<ThreadKind, Support>;
|
|
2491
|
+
/** Support per security alert kind. */
|
|
2492
|
+
type AlertSupport = Record<"dependency" | "code_scanning" | "secret" | "advisory", Support>;
|
|
2493
|
+
/**
|
|
2494
|
+
* What a provider supports, operation by operation. It is computed without a request, and
|
|
2495
|
+
* `refreshCapabilities()` refines it with the instance version. Each verb has an entry at its
|
|
2496
|
+
* path on the provider, and the [capability matrix](/reference/capability-matrix) lists them
|
|
2497
|
+
* for every forge.
|
|
2498
|
+
*/
|
|
2499
|
+
interface ForgeCapabilities {
|
|
2500
|
+
/** Instance version the capabilities were computed for, when known. */
|
|
2501
|
+
version?: string;
|
|
2502
|
+
/** The forge's API as a whole is unstable, so the provider can change with it. */
|
|
2503
|
+
experimental?: true;
|
|
2504
|
+
sources: {
|
|
2505
|
+
/** Support for `sources.stream()`, a long-lived push stream; see {@link SourcesApi}. */
|
|
2506
|
+
stream: Support;
|
|
2507
|
+
};
|
|
2508
|
+
repos: {
|
|
2509
|
+
/** Support for `repos.get()`. */
|
|
2510
|
+
get: Support;
|
|
2511
|
+
/** Support for `repos.list()`. */
|
|
2512
|
+
list: Support;
|
|
2513
|
+
/** Support for `repos.byOwner()`. */
|
|
2514
|
+
byOwner: Support;
|
|
2515
|
+
/** Support for `repos.labels()`. */
|
|
2516
|
+
labels: Support;
|
|
2517
|
+
/** Support for `repos.createLabel()`. */
|
|
2518
|
+
createLabel: Support;
|
|
2519
|
+
/** Support for `repos.milestones()`. */
|
|
2520
|
+
milestones: Support;
|
|
2521
|
+
/** Support for `repos.issueTypes()`. */
|
|
2522
|
+
issueTypes: Support;
|
|
2523
|
+
/** Support for `repos.collaborators()`. */
|
|
2524
|
+
collaborators: Support;
|
|
2525
|
+
/** Support for `repos.contributors()`. */
|
|
2526
|
+
contributors: Support;
|
|
2527
|
+
/** Support for `repos.contributorStats()`. */
|
|
2528
|
+
contributorStats: Support;
|
|
2529
|
+
/** Support for `repos.templates()`. */
|
|
2530
|
+
templates: Support;
|
|
2531
|
+
/** Support for `repos.permissionFor()`. */
|
|
2532
|
+
permissionFor: Support;
|
|
2533
|
+
/** Support for `repos.branchRules()`. */
|
|
2534
|
+
branchRules: Support;
|
|
2535
|
+
/** Support for `repos.addCollaborator()`. */
|
|
2536
|
+
addCollaborator: Support;
|
|
2537
|
+
/** Support for `repos.assignableUsers()`. */
|
|
2538
|
+
assignableUsers: Support;
|
|
2539
|
+
/** Support for `repos.reviewerCandidates()`. */
|
|
2540
|
+
reviewerCandidates: Support;
|
|
2541
|
+
/** Support for `repos.events()`. */
|
|
2542
|
+
events: Support;
|
|
2543
|
+
};
|
|
2544
|
+
users: {
|
|
2545
|
+
/** Support for `users.get()`. */
|
|
2546
|
+
get: Support;
|
|
2547
|
+
/** Support for `users.me()`. */
|
|
2548
|
+
me: Support;
|
|
2549
|
+
/** Support for `users.sponsorable()`. */
|
|
2550
|
+
sponsorable: Support;
|
|
2551
|
+
/** Support for `users.events()`. */
|
|
2552
|
+
events: Support;
|
|
2553
|
+
/** Support for `users.block()`. */
|
|
2554
|
+
block: Support;
|
|
2555
|
+
/** Support for `users.unblock()`. */
|
|
2556
|
+
unblock: Support;
|
|
2557
|
+
};
|
|
2558
|
+
/** An organisation's teams and their members, where the forge has teams, and the accounts it blocks. */
|
|
2559
|
+
orgs: {
|
|
2560
|
+
/** Support for `orgs.teams()`. */
|
|
2561
|
+
teams: Support;
|
|
2562
|
+
/** Support for `orgs.teamMembers()`. */
|
|
2563
|
+
teamMembers: Support;
|
|
2564
|
+
/** Support for `orgs.block()`. */
|
|
2565
|
+
block: Support;
|
|
2566
|
+
/** Support for `orgs.unblock()`. */
|
|
2567
|
+
unblock: Support;
|
|
2568
|
+
};
|
|
2569
|
+
threads: {
|
|
2570
|
+
/** Support for `threads.get()`, per thread kind. */
|
|
2571
|
+
get: PerKind;
|
|
2572
|
+
/** Support for `threads.list()`, per thread kind. */
|
|
2573
|
+
list: PerKind;
|
|
2574
|
+
/** Support for `threads.getMany()`. */
|
|
2575
|
+
getMany: Support;
|
|
2576
|
+
/** Support for `threads.closingIssues()`. */
|
|
2577
|
+
closingIssues: Support;
|
|
2578
|
+
/** Support for `threads.closingPullRequests()`. */
|
|
2579
|
+
closingPullRequests: Support;
|
|
2580
|
+
/** Support for `threads.events()`, per thread kind. */
|
|
2581
|
+
events: PerKind;
|
|
2582
|
+
/** Support for `threads.comments()`, per thread kind. */
|
|
2583
|
+
comments: PerKind;
|
|
2584
|
+
/** Support for `threads.getComment()`, per thread kind. */
|
|
2585
|
+
getComment: PerKind;
|
|
2586
|
+
/** Support for `threads.createComment()`, per thread kind. */
|
|
2587
|
+
createComment: PerKind;
|
|
2588
|
+
/** Support for `threads.updateComment()`, per thread kind. */
|
|
2589
|
+
updateComment: PerKind;
|
|
2590
|
+
/** Support for `threads.deleteComment()`, per thread kind. */
|
|
2591
|
+
deleteComment: PerKind;
|
|
2592
|
+
/** Support for `threads.hideComment()`, per thread kind. */
|
|
2593
|
+
hideComment: PerKind;
|
|
2594
|
+
/** Support for `threads.unhideComment()`, per thread kind. */
|
|
2595
|
+
unhideComment: PerKind;
|
|
2596
|
+
/** Support for `threads.reactions()`, per thread kind. */
|
|
2597
|
+
reactions: PerKind;
|
|
2598
|
+
/** Support for `threads.react()`, per thread kind. */
|
|
2599
|
+
react: PerKind;
|
|
2600
|
+
/** Support for `threads.unreact()`, per thread kind. */
|
|
2601
|
+
unreact: PerKind;
|
|
2602
|
+
/** Support for `threads.create()`, per thread kind. */
|
|
2603
|
+
create: PerKind;
|
|
2604
|
+
/** Support for `threads.update()`, per thread kind. */
|
|
2605
|
+
update: PerKind;
|
|
2606
|
+
/** Support for `threads.close()`, per thread kind. */
|
|
2607
|
+
close: PerKind;
|
|
2608
|
+
/** Support for `threads.reopen()`, per thread kind. */
|
|
2609
|
+
reopen: PerKind;
|
|
2610
|
+
/** Support for `threads.lock()`, per thread kind. */
|
|
2611
|
+
lock: PerKind;
|
|
2612
|
+
/** Support for `threads.unlock()`, per thread kind. */
|
|
2613
|
+
unlock: PerKind;
|
|
2614
|
+
/** Support for `threads.setLabels()`, per thread kind. */
|
|
2615
|
+
setLabels: PerKind;
|
|
2616
|
+
/** Support for `threads.addLabels()`, per thread kind. */
|
|
2617
|
+
addLabels: PerKind;
|
|
2618
|
+
/** Support for `threads.removeLabels()`, per thread kind. */
|
|
2619
|
+
removeLabels: PerKind;
|
|
2620
|
+
/** Support for `threads.setMilestone()`, per thread kind. */
|
|
2621
|
+
setMilestone: PerKind;
|
|
2622
|
+
/** Support for `threads.setIssueType()`, per thread kind. */
|
|
2623
|
+
setIssueType: PerKind;
|
|
2624
|
+
/** Support for `threads.setAssignees()`, per thread kind. */
|
|
2625
|
+
setAssignees: PerKind;
|
|
2626
|
+
/** Support for `threads.requestReview()`, per thread kind. */
|
|
2627
|
+
requestReview: PerKind;
|
|
2628
|
+
/** Support for `threads.merge()`. */
|
|
2629
|
+
merge: Support;
|
|
2630
|
+
/** Support for `threads.updateBranch()`. */
|
|
2631
|
+
updateBranch: Support;
|
|
2632
|
+
/** Support for `threads.transfer()`. */
|
|
2633
|
+
transfer: Support;
|
|
2634
|
+
/** Support for `threads.markDuplicate()`. */
|
|
2635
|
+
markDuplicate: Support;
|
|
2636
|
+
/** Support for `threads.subscription()`, per thread kind. */
|
|
2637
|
+
subscription: PerKind;
|
|
2638
|
+
/** Support for `threads.subscribe()`, per thread kind. */
|
|
2639
|
+
subscribe: PerKind;
|
|
2640
|
+
/** Support for `threads.unsubscribe()`, per thread kind. */
|
|
2641
|
+
unsubscribe: PerKind;
|
|
2642
|
+
/** Support for `threads.checks()` and `Thread.checks`, per thread kind. */
|
|
2643
|
+
checks: PerKind;
|
|
2644
|
+
/** Support for `threads.files()`. */
|
|
2645
|
+
files: Support;
|
|
2646
|
+
/** Support for `threads.commits()`. */
|
|
2647
|
+
commits: Support;
|
|
2648
|
+
/** Support for `threads.reviews()`. `'emulated'` where reviews are synthesised from approvals or votes. */
|
|
2649
|
+
reviews: Support;
|
|
2650
|
+
/** Support for `threads.getReview()`. */
|
|
2651
|
+
getReview: Support;
|
|
2652
|
+
/** Support for `threads.createReview()`. Where reviews are emulated, it covers only the events the forge's approval endpoint can express. */
|
|
2653
|
+
createReview: Support;
|
|
2654
|
+
/** Support for `threads.submitReview()`. */
|
|
2655
|
+
submitReview: Support;
|
|
2656
|
+
/** Support for `threads.approve()`. */
|
|
2657
|
+
approve: Support;
|
|
2658
|
+
/** Support for `threads.replyToReviewComment()`. */
|
|
2659
|
+
replyToReviewComment: Support;
|
|
2660
|
+
/** Support for `threads.resolveReviewThread()`. */
|
|
2661
|
+
resolveReviewThread: Support;
|
|
2662
|
+
/** Support for `threads.unresolveReviewThread()`. */
|
|
2663
|
+
unresolveReviewThread: Support;
|
|
2664
|
+
};
|
|
2665
|
+
notifications: {
|
|
2666
|
+
/** Support for `notifications.list()`. */
|
|
2667
|
+
list: Support;
|
|
2668
|
+
/** Support for `notifications.markRead()`. */
|
|
2669
|
+
markRead: Support;
|
|
2670
|
+
/** Support for `notifications.markDone()`. */
|
|
2671
|
+
markDone: Support;
|
|
2672
|
+
/** Support for `notifications.unsubscribe()`. */
|
|
2673
|
+
unsubscribe: Support;
|
|
2674
|
+
/** Support for `notifications.markAllRead()`. */
|
|
2675
|
+
markAllRead: Support;
|
|
2676
|
+
/** Support for `notifications.markAllDone()`. */
|
|
2677
|
+
markAllDone: Support;
|
|
2678
|
+
/** Support for `notifications.unreadCount()`. */
|
|
2679
|
+
unreadCount: Support;
|
|
2680
|
+
};
|
|
2681
|
+
installations: {
|
|
2682
|
+
/** Support for `installations.list()`. */
|
|
2683
|
+
list: Support;
|
|
2684
|
+
/** Support for `installations.get()`. */
|
|
2685
|
+
get: Support;
|
|
2686
|
+
/** Support for `installations.token()`. */
|
|
2687
|
+
token: Support;
|
|
2688
|
+
/** Support for `installations.repos()`. */
|
|
2689
|
+
repos: Support;
|
|
2690
|
+
/** Support for `installations.provider()`. */
|
|
2691
|
+
provider: Support;
|
|
2692
|
+
/** Support for `installations.providers()`. */
|
|
2693
|
+
providers: Support;
|
|
2694
|
+
};
|
|
2695
|
+
checks: {
|
|
2696
|
+
/** Support for `checks.list()`. */
|
|
2697
|
+
list: Support;
|
|
2698
|
+
/** Support for `checks.get()`. */
|
|
2699
|
+
get: Support;
|
|
2700
|
+
/** Support for `checks.report()`. It writes a commit status unless the credential can write check runs. */
|
|
2701
|
+
report: Support;
|
|
2702
|
+
/** Support for `checks.rerun()`. */
|
|
2703
|
+
rerun: Support;
|
|
2704
|
+
};
|
|
2705
|
+
ci: {
|
|
2706
|
+
/** Support for `ci.runs()`. */
|
|
2707
|
+
runs: Support;
|
|
2708
|
+
/** Support for `ci.getRun()`. */
|
|
2709
|
+
getRun: Support;
|
|
2710
|
+
/** Support for `ci.jobs()`. */
|
|
2711
|
+
jobs: Support;
|
|
2712
|
+
/** Support for `ci.getJob()`. */
|
|
2713
|
+
getJob: Support;
|
|
2714
|
+
/** Support for `ci.log()`. `false` where job logs are not reachable over the API. */
|
|
2715
|
+
log: Support;
|
|
2716
|
+
/** Support for `ci.rerunFailed()`. */
|
|
2717
|
+
rerunFailed: Support;
|
|
2718
|
+
};
|
|
2719
|
+
contents: {
|
|
2720
|
+
/** Support for `contents.getFile()`. */
|
|
2721
|
+
getFile: Support;
|
|
2722
|
+
/** Support for `contents.tree()`. `'emulated'` where recursion is walked level by level. */
|
|
2723
|
+
tree: Support;
|
|
2724
|
+
/** Support for `contents.branches()`. */
|
|
2725
|
+
branches: Support;
|
|
2726
|
+
/** Support for `contents.tags()`. */
|
|
2727
|
+
tags: Support;
|
|
2728
|
+
/** Support for `contents.resolveRef()`. */
|
|
2729
|
+
resolveRef: Support;
|
|
2730
|
+
/** Support for `contents.compare()`. */
|
|
2731
|
+
compare: Support;
|
|
2732
|
+
/** Support for `contents.commitFiles()`. */
|
|
2733
|
+
commitFiles: Support;
|
|
2734
|
+
};
|
|
2735
|
+
commits: {
|
|
2736
|
+
/** Support for `commits.list()`. */
|
|
2737
|
+
list: Support;
|
|
2738
|
+
/** Support for `commits.get()`. */
|
|
2739
|
+
get: Support;
|
|
2740
|
+
/** Support for `commits.comments()`. */
|
|
2741
|
+
comments: Support;
|
|
2742
|
+
/** Support for `commits.getComment()`. */
|
|
2743
|
+
getComment: Support;
|
|
2744
|
+
/** Support for `commits.createComment()`. */
|
|
2745
|
+
createComment: Support;
|
|
2746
|
+
/** Support for `commits.updateComment()`. */
|
|
2747
|
+
updateComment: Support;
|
|
2748
|
+
/** Support for `commits.deleteComment()`. */
|
|
2749
|
+
deleteComment: Support;
|
|
2750
|
+
/** Support for `commits.hideComment()`. */
|
|
2751
|
+
hideComment: Support;
|
|
2752
|
+
/** Support for `commits.unhideComment()`. */
|
|
2753
|
+
unhideComment: Support;
|
|
2754
|
+
};
|
|
2755
|
+
releases: {
|
|
2756
|
+
/** Support for `releases.list()`. */
|
|
2757
|
+
list: Support;
|
|
2758
|
+
/** Support for `releases.get()`. */
|
|
2759
|
+
get: Support;
|
|
2760
|
+
/** Support for `releases.latest()`. */
|
|
2761
|
+
latest: Support;
|
|
2762
|
+
/** Support for `releases.getByTag()`. */
|
|
2763
|
+
getByTag: Support;
|
|
2764
|
+
/** Support for `releases.downloadAsset()`. */
|
|
2765
|
+
downloadAsset: Support;
|
|
2766
|
+
/** Support for `releases.create()`. */
|
|
2767
|
+
create: Support;
|
|
2768
|
+
/** Support for `releases.update()`. */
|
|
2769
|
+
update: Support;
|
|
2770
|
+
};
|
|
2771
|
+
/** Receiving deliveries and managing registered webhooks. */
|
|
2772
|
+
webhooks: {
|
|
2773
|
+
/** Support for `webhooks.verify()`. */
|
|
2774
|
+
verify: Support;
|
|
2775
|
+
/** Support for `webhooks.ingest()`. */
|
|
2776
|
+
ingest: Support;
|
|
2777
|
+
/** Support for `webhooks.list()`. */
|
|
2778
|
+
list: Support;
|
|
2779
|
+
/** Support for `webhooks.create()`. */
|
|
2780
|
+
create: Support;
|
|
2781
|
+
/** Support for `webhooks.update()`. */
|
|
2782
|
+
update: Support;
|
|
2783
|
+
/** Support for `webhooks.delete()`. */
|
|
2784
|
+
delete: Support;
|
|
2785
|
+
/** Support for `webhooks.rotateSecret()`. */
|
|
2786
|
+
rotateSecret: Support;
|
|
2787
|
+
/** Support for `webhooks.deliveries()`. */
|
|
2788
|
+
deliveries: Support;
|
|
2789
|
+
/** Support for `webhooks.redeliver()`. */
|
|
2790
|
+
redeliver: Support;
|
|
2791
|
+
};
|
|
2792
|
+
search: {
|
|
2793
|
+
/** Support for `search.threads()`. */
|
|
2794
|
+
threads: Support;
|
|
2795
|
+
/** Support for `search.repos()`. */
|
|
2796
|
+
repos: Support;
|
|
2797
|
+
/** Support for `search.commits()`. */
|
|
2798
|
+
commits: Support;
|
|
2799
|
+
/** Support for `search.code()`. */
|
|
2800
|
+
code: Support;
|
|
2801
|
+
};
|
|
2802
|
+
securityAlerts: {
|
|
2803
|
+
/** Support for `securityAlerts.list()`, per alert kind. */
|
|
2804
|
+
list: AlertSupport;
|
|
2805
|
+
};
|
|
2806
|
+
/**
|
|
2807
|
+
* `'heuristic'` when event kinds are inferred from free text (GitLab system
|
|
2808
|
+
* notes) rather than reported by the forge, so `kind` may be `'other'` or
|
|
2809
|
+
* wrong for unrecognised wording; `kindRaw` and `payload` stay exact.
|
|
2810
|
+
*/
|
|
2811
|
+
eventKinds: "native" | "heuristic";
|
|
2812
|
+
/** Auth types the provider accepts. The type this provider was created with is `ForgeProvider.authKind`. */
|
|
2813
|
+
authKinds: readonly AuthKind[];
|
|
2814
|
+
/** Maximum text lengths the forge accepts. */
|
|
2815
|
+
limits?: TextLimits;
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* An async iterable that also collects non-fatal warnings as it runs. Read
|
|
2819
|
+
* `warnings` during or after iteration.
|
|
2820
|
+
*/
|
|
2821
|
+
interface ForgeIterable<T> extends AsyncIterable<T> {
|
|
2822
|
+
/** The non-fatal warnings collected so far. Read it during or after iteration. */
|
|
2823
|
+
readonly warnings: ForgeWarning[];
|
|
2824
|
+
}
|
|
2825
|
+
/**
|
|
2826
|
+
* A listing: iterate it to read every item, or call `page()` to read one page.
|
|
2827
|
+
* @example
|
|
2828
|
+
* ```ts
|
|
2829
|
+
* const first = await provider.threads.comments(ref, { perPage: 20 }).page()
|
|
2830
|
+
* const next = first.cursor && await provider.threads.comments(ref, { perPage: 20, cursor: first.cursor }).page()
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
interface ForgeListing<T> extends ForgeIterable<T> {
|
|
2834
|
+
/** Reads one page: the first, or the one after the `cursor` the listing was called with. */
|
|
2835
|
+
page: () => Promise<Page<T>>;
|
|
2836
|
+
}
|
|
2837
|
+
/** A webhook delivery as received: its headers, its raw body and, optionally, the secret to verify it with. */
|
|
2838
|
+
interface WebhookDelivery {
|
|
2839
|
+
/** The request headers, which carry the signature and the event name. */
|
|
2840
|
+
headers: Headers | Record<string, string>;
|
|
2841
|
+
/** Raw body exactly as received; signatures are computed over these bytes. */
|
|
2842
|
+
body: string | Uint8Array;
|
|
2843
|
+
/** Overrides the provider-level `webhookSecret` for this delivery. */
|
|
2844
|
+
secret?: string;
|
|
2845
|
+
}
|
|
2846
|
+
/** Options for `markAllRead()` and `markAllDone()`. */
|
|
2847
|
+
interface BulkNotificationOptions extends BaseOptions {
|
|
2848
|
+
/** Limit to one repository. */
|
|
2849
|
+
repo?: RepoRef;
|
|
2850
|
+
/** Only notifications updated before this time. */
|
|
2851
|
+
before?: Date;
|
|
2852
|
+
}
|
|
2853
|
+
/** Reading and clearing the notifications of the authenticated account. */
|
|
2854
|
+
interface NotificationsApi {
|
|
2855
|
+
/** Lists the account's notifications. */
|
|
2856
|
+
list: (options?: NotificationListOptions) => ForgeListing<Notification>;
|
|
2857
|
+
/** Marks a notification as read. */
|
|
2858
|
+
markRead: (ref: NotificationRef, options?: BaseOptions) => Promise<void>;
|
|
2859
|
+
/** Marks a notification as done, which clears it from the inbox where the forge has that state. */
|
|
2860
|
+
markDone: (ref: NotificationRef, options?: NotificationWriteOptions) => Promise<void>;
|
|
2861
|
+
/** Stops notifications for the notification's thread, and on some forges also clears the notification. */
|
|
2862
|
+
unsubscribe: (ref: NotificationRef, options?: NotificationWriteOptions) => Promise<void>;
|
|
2863
|
+
/** Marks every notification as read, or those of one repository. */
|
|
2864
|
+
markAllRead: (options?: BulkNotificationOptions) => Promise<void>;
|
|
2865
|
+
/** Marks every notification as done, or those of one repository. */
|
|
2866
|
+
markAllDone: (options?: BulkNotificationOptions) => Promise<void>;
|
|
2867
|
+
/** The number of unread notifications. */
|
|
2868
|
+
unreadCount: (options?: BaseOptions) => Promise<number>;
|
|
2869
|
+
}
|
|
2870
|
+
/** Options for changing one notification. */
|
|
2871
|
+
interface NotificationWriteOptions extends BaseOptions {
|
|
2872
|
+
/**
|
|
2873
|
+
* The thread the notification points at, when the caller already holds it.
|
|
2874
|
+
* Providers that would otherwise look it up skip that request.
|
|
2875
|
+
*/
|
|
2876
|
+
thread?: ThreadRef;
|
|
2877
|
+
}
|
|
2878
|
+
/** Why a thread was closed. */
|
|
2879
|
+
type CloseReason = "completed" | "not_planned" | "duplicate";
|
|
2880
|
+
/** Options for `threads.close()`. */
|
|
2881
|
+
interface CloseOptions extends BaseOptions {
|
|
2882
|
+
/**
|
|
2883
|
+
* Mapped to the forge's own reason where it has one; forges without close
|
|
2884
|
+
* reasons close the thread without one.
|
|
2885
|
+
*/
|
|
2886
|
+
reason?: CloseReason;
|
|
2887
|
+
/** Forge-native reason, sent as is; takes precedence over `reason`. */
|
|
2888
|
+
reasonRaw?: string;
|
|
2889
|
+
}
|
|
2890
|
+
/** Why a conversation was locked. */
|
|
2891
|
+
type LockReason = "off_topic" | "too_heated" | "resolved" | "spam";
|
|
2892
|
+
/** Options for `threads.lock()`. */
|
|
2893
|
+
interface LockOptions extends BaseOptions {
|
|
2894
|
+
/** Forges without lock reasons lock the conversation without one. */
|
|
2895
|
+
reason?: LockReason;
|
|
2896
|
+
}
|
|
2897
|
+
/** Why a comment was hidden. */
|
|
2898
|
+
type HideCommentReason = "abuse" | "duplicate" | "low_quality" | "off_topic" | "outdated" | "resolved" | "spam";
|
|
2899
|
+
/**
|
|
2900
|
+
* Issues, pull requests and the other kinds of discussion: reading, creating, commenting, labelling,
|
|
2901
|
+
* reviewing and merging them.
|
|
2902
|
+
*/
|
|
2903
|
+
interface ThreadsApi {
|
|
2904
|
+
/**
|
|
2905
|
+
* Reads an issue, pull request or discussion by its ref. Rejects with `NotFoundError` when it does not exist or the
|
|
2906
|
+
* credential cannot see it.
|
|
2907
|
+
*/
|
|
2908
|
+
get: (ref: ThreadRef, options?: BaseOptions) => Promise<Thread>;
|
|
2909
|
+
/**
|
|
2910
|
+
* Reads several threads, batched where the forge allows. Failures become per-item warnings, except a rate limit
|
|
2911
|
+
* (`RateLimitedError`) or a rejected credential (`TokenRevokedError`), which reject the call.
|
|
2912
|
+
*/
|
|
2913
|
+
getMany: (refs: ThreadRef[], options?: BaseOptions) => Promise<GetManyResult[]>;
|
|
2914
|
+
/** Lists the threads of a repository. */
|
|
2915
|
+
list: (repo: RepoRef, query?: ThreadQuery) => ForgeListing<Thread>;
|
|
2916
|
+
/**
|
|
2917
|
+
* Lists the issues that a pull request closes when it merges, such as those its description names after `Fixes`.
|
|
2918
|
+
* They can be in other repositories. GitHub also lists the issues linked to the pull request by hand.
|
|
2919
|
+
* @example
|
|
2920
|
+
* ```ts
|
|
2921
|
+
* for await (const issue of provider.threads.closingIssues(pull)) {
|
|
2922
|
+
* console.log(`#${issue.ref.number} ${issue.title}`)
|
|
2923
|
+
* }
|
|
2924
|
+
* ```
|
|
2925
|
+
*/
|
|
2926
|
+
closingIssues: (ref: ThreadRef, options?: PageOptions) => ForgeListing<Thread>;
|
|
2927
|
+
/** Lists the pull requests that close an issue when they merge, whether they are open, closed or merged. */
|
|
2928
|
+
closingPullRequests: (ref: ThreadRef, options?: PageOptions) => ForgeListing<Thread>;
|
|
2929
|
+
/** Lists the events on a thread, such as comments, label changes and state changes. */
|
|
2930
|
+
events: (ref: ThreadRef, options?: ListOptions) => ForgeListing<ForgeEvent>;
|
|
2931
|
+
/** Conversation comments. Inline review comments are events, not comments. */
|
|
2932
|
+
comments: (ref: ThreadRef, options?: ListOptions) => ForgeListing<Comment>;
|
|
2933
|
+
/**
|
|
2934
|
+
* Reads one conversation comment, as `comments()` lists them, so not an inline review comment. Where the forge has
|
|
2935
|
+
* no endpoint for it (`capabilities.threads.getComment` is `'emulated'`), it lists the comments of the thread page by page
|
|
2936
|
+
* until the id matches, which costs a request for each page read.
|
|
2937
|
+
*/
|
|
2938
|
+
getComment: (ref: CommentRef, options?: BaseOptions) => Promise<Comment>;
|
|
2939
|
+
/**
|
|
2940
|
+
* Adds a comment to a thread. A repeat posts a second comment; to make it safe to retry, mark the body with
|
|
2941
|
+
* `withCommentMarker()` and retry with `upsertComment()`, both from `forges/helpers`.
|
|
2942
|
+
* @example
|
|
2943
|
+
* ```ts
|
|
2944
|
+
* await provider.threads.createComment(ref, 'Deployed to staging')
|
|
2945
|
+
* ```
|
|
2946
|
+
*/
|
|
2947
|
+
createComment: (ref: ThreadRef, body: string, options?: BaseOptions) => Promise<Comment>;
|
|
2948
|
+
/** Replaces the body of a comment. */
|
|
2949
|
+
updateComment: (ref: CommentRef, body: string, options?: BaseOptions) => Promise<Comment>;
|
|
2950
|
+
/** Deletes a comment. A repeat can reject with `NotFoundError` once the comment is gone. */
|
|
2951
|
+
deleteComment: (ref: CommentRef, options?: BaseOptions) => Promise<void>;
|
|
2952
|
+
/**
|
|
2953
|
+
* Hides a comment behind a note of the reason, as GitHub does when it minimises a comment. A repeat leaves it hidden.
|
|
2954
|
+
* @example
|
|
2955
|
+
* ```ts
|
|
2956
|
+
* await provider.threads.hideComment(comment.ref, 'spam')
|
|
2957
|
+
* ```
|
|
2958
|
+
*/
|
|
2959
|
+
hideComment: (ref: CommentRef, reason: HideCommentReason, options?: BaseOptions) => Promise<void>;
|
|
2960
|
+
/** Shows a hidden comment again. A repeat leaves it shown. */
|
|
2961
|
+
unhideComment: (ref: CommentRef, options?: BaseOptions) => Promise<void>;
|
|
2962
|
+
/**
|
|
2963
|
+
* Creates an issue, pull request or discussion. A pull request needs `head` and `base`. A repeat creates a second
|
|
2964
|
+
* thread, though most forges reject a second open pull request from the same `head` to the same `base`.
|
|
2965
|
+
*/
|
|
2966
|
+
create: (repo: RepoRef, input: ThreadInput, options?: BaseOptions) => Promise<Thread>;
|
|
2967
|
+
/**
|
|
2968
|
+
* Changes the title, body, state, labels or assignees of a thread. Fields left out stay as they are.
|
|
2969
|
+
* This is one request where the forge accepts every field together. Elsewhere it makes the same calls as
|
|
2970
|
+
* `close()`, `setLabels()` and `setAssignees()`, so a failed call can leave earlier fields changed.
|
|
2971
|
+
* A field the forge cannot set on this kind of thread throws `UnsupportedOperationError` before anything is written.
|
|
2972
|
+
* @example
|
|
2973
|
+
* ```ts
|
|
2974
|
+
* await provider.threads.update(ref, { state: 'closed', labels: ['wontfix'], assignees: [] })
|
|
2975
|
+
* ```
|
|
2976
|
+
*/
|
|
2977
|
+
update: (ref: ThreadRef, input: ThreadUpdate, options?: BaseOptions) => Promise<Thread>;
|
|
2978
|
+
/**
|
|
2979
|
+
* Replaces the thread's labels.
|
|
2980
|
+
* @returns The labels the thread carries afterwards. GitLab and Azure DevOps report only their names.
|
|
2981
|
+
*/
|
|
2982
|
+
setLabels: (ref: ThreadRef, labels: string[], options?: BaseOptions) => Promise<Label[]>;
|
|
2983
|
+
/**
|
|
2984
|
+
* Adds labels, leaving the rest in place.
|
|
2985
|
+
* @returns The labels the thread carries afterwards. GitLab reports only their names.
|
|
2986
|
+
*/
|
|
2987
|
+
addLabels: (ref: ThreadRef, labels: string[], options?: BaseOptions) => Promise<Label[]>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Removes labels, leaving the rest in place. Labels the thread does not carry are ignored.
|
|
2990
|
+
* @returns The labels the thread carries afterwards. GitLab reports only their names. Forgejo, Gitea and Gitee read the labels after removing them, and GitHub reads them when it removes none.
|
|
2991
|
+
*/
|
|
2992
|
+
removeLabels: (ref: ThreadRef, labels: string[], options?: BaseOptions) => Promise<Label[]>;
|
|
2993
|
+
/**
|
|
2994
|
+
* Sets the thread's milestone, by milestone, id or title, or clears it with `undefined`.
|
|
2995
|
+
* @returns The milestone the thread is in afterwards, or `undefined` once it is cleared.
|
|
2996
|
+
*/
|
|
2997
|
+
setMilestone: (ref: ThreadRef, milestone: Milestone | string | undefined, options?: BaseOptions) => Promise<Milestone | undefined>;
|
|
2998
|
+
/**
|
|
2999
|
+
* Sets the issue's type, by issue type or name, or clears it with `undefined`. GitHub leaves the type as it was,
|
|
3000
|
+
* without an error, when the account cannot push to the repository, so compare the result with what you asked for.
|
|
3001
|
+
* @returns The type the issue has afterwards, or `undefined` once it is cleared.
|
|
3002
|
+
* @example
|
|
3003
|
+
* ```ts
|
|
3004
|
+
* const bug = (await provider.repos.issueTypes(repo)).find(type => type.name === 'Bug')
|
|
3005
|
+
* await provider.threads.setIssueType(ref, bug)
|
|
3006
|
+
* ```
|
|
3007
|
+
*/
|
|
3008
|
+
setIssueType: (ref: ThreadRef, issueType: IssueType | string | undefined, options?: BaseOptions) => Promise<IssueType | undefined>;
|
|
3009
|
+
/** Reactions left on the thread or on one of its comments. */
|
|
3010
|
+
reactions: (target: ThreadRef | CommentRef, options?: ListOptions) => ForgeListing<Reaction>;
|
|
3011
|
+
/**
|
|
3012
|
+
* Reacts as the authenticated account, to the thread or to one of its comments.
|
|
3013
|
+
* @param target The thread or comment to react to.
|
|
3014
|
+
* @param reaction The reaction to leave.
|
|
3015
|
+
*/
|
|
3016
|
+
react: (target: ThreadRef | CommentRef, reaction: ReactionContent, options?: BaseOptions) => Promise<void>;
|
|
3017
|
+
/** Removes the account's reaction from the thread or comment. */
|
|
3018
|
+
unreact: (target: ThreadRef | CommentRef, reaction: ReactionContent, options?: BaseOptions) => Promise<void>;
|
|
3019
|
+
/** Moves the thread to another repository, and returns its ref there. A repeat can reject once the thread has moved. */
|
|
3020
|
+
transfer: (ref: ThreadRef, repo: RepoRef, options?: BaseOptions) => Promise<ResolvedThreadRef>;
|
|
3021
|
+
/** Marks the thread a duplicate of `canonical`, which must be in the same repository on most forges. */
|
|
3022
|
+
markDuplicate: (ref: ThreadRef, canonical: ThreadRef, options?: BaseOptions) => Promise<void>;
|
|
3023
|
+
/**
|
|
3024
|
+
* Replaces the thread's assignees.
|
|
3025
|
+
* @returns The accounts assigned afterwards.
|
|
3026
|
+
*/
|
|
3027
|
+
setAssignees: (ref: ThreadRef, assignees: Array<string | Actor>, options?: BaseOptions) => Promise<Actor[]>;
|
|
3028
|
+
/** Adds reviewers to a pull request. */
|
|
3029
|
+
requestReview: (ref: ThreadRef, reviewers: Array<string | Actor>, options?: BaseOptions) => Promise<void>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Closes a thread, optionally with a reason.
|
|
3032
|
+
* @returns The thread, closed. Tangled reads the thread after writing the state record.
|
|
3033
|
+
*/
|
|
3034
|
+
close: (ref: ThreadRef, options?: CloseOptions) => Promise<Thread>;
|
|
3035
|
+
/**
|
|
3036
|
+
* Reopens a closed thread.
|
|
3037
|
+
* @returns The thread, open. Tangled reads the thread after writing the state record.
|
|
3038
|
+
*/
|
|
3039
|
+
reopen: (ref: ThreadRef, options?: BaseOptions) => Promise<Thread>;
|
|
3040
|
+
/**
|
|
3041
|
+
* Locks the conversation on a thread, so that only collaborators can comment. A repeat leaves it locked.
|
|
3042
|
+
* @example
|
|
3043
|
+
* ```ts
|
|
3044
|
+
* await provider.threads.lock(ref, { reason: 'too_heated' })
|
|
3045
|
+
* ```
|
|
3046
|
+
*/
|
|
3047
|
+
lock: (ref: ThreadRef, options?: LockOptions) => Promise<void>;
|
|
3048
|
+
/** Unlocks the conversation on a thread. A repeat leaves it unlocked. */
|
|
3049
|
+
unlock: (ref: ThreadRef, options?: BaseOptions) => Promise<void>;
|
|
3050
|
+
/**
|
|
3051
|
+
* Merges a pull request. Without a merge method, the repository must allow exactly one. A repeat rejects once the
|
|
3052
|
+
* pull request has merged, so after a failure read the pull request to see whether it did.
|
|
3053
|
+
* @param ref The pull request to merge.
|
|
3054
|
+
* @param options The merge method, the head `sha` to expect and the commit message.
|
|
3055
|
+
* @returns Whether the pull request merged or the forge queued the merge, and the merge commit where the response
|
|
3056
|
+
* reports it. Forgejo, Gitea and Tangled report no merge commit.
|
|
3057
|
+
* @example
|
|
3058
|
+
* ```ts
|
|
3059
|
+
* const { status, sha } = await provider.threads.merge(ref, { method: 'squash' })
|
|
3060
|
+
* ```
|
|
3061
|
+
*/
|
|
3062
|
+
merge: (ref: ThreadRef, options?: MergeOptions) => Promise<MergeResult>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Brings the base branch into a pull request's head branch, by a merge commit or a rebase. A repeat once the branch
|
|
3065
|
+
* is up to date rejects on GitHub, Forgejo and Gitea, and leaves the branch as it is on GitLab.
|
|
3066
|
+
* @param ref The pull request to update.
|
|
3067
|
+
* @param options The update `method`, and the head `sha` to expect. GitHub checks `sha` as it updates; Forgejo, Gitea
|
|
3068
|
+
* and GitLab read the pull request first and compare.
|
|
3069
|
+
* @returns Whether the branch was updated or the forge queued the update. GitHub and GitLab update in the background,
|
|
3070
|
+
* so read the pull request later to see the new head.
|
|
3071
|
+
* @example
|
|
3072
|
+
* ```ts
|
|
3073
|
+
* await provider.threads.updateBranch(ref, { method: 'rebase', sha: pull.branches?.head.sha })
|
|
3074
|
+
* ```
|
|
3075
|
+
*/
|
|
3076
|
+
updateBranch: (ref: ThreadRef, options?: UpdateBranchOptions) => Promise<UpdateBranchResult>;
|
|
3077
|
+
/** The authenticated account's subscription to the thread. */
|
|
3078
|
+
subscription: (ref: ThreadRef, options?: BaseOptions) => Promise<SubscriptionState>;
|
|
3079
|
+
/** Subscribes the account to the notifications of a thread. */
|
|
3080
|
+
subscribe: (ref: ThreadRef, options?: BaseOptions) => Promise<void>;
|
|
3081
|
+
/** Stops the account's notifications for a thread, leaving existing notifications alone. */
|
|
3082
|
+
unsubscribe: (ref: ThreadRef, options?: BaseOptions) => Promise<void>;
|
|
3083
|
+
/** Every check on the pull's head, in one page; `warnings` names the sources that could not be read. */
|
|
3084
|
+
checks: (ref: ThreadRef, options?: BaseOptions) => Promise<Page<Check>>;
|
|
3085
|
+
/**
|
|
3086
|
+
* Reviews on a pull request. Forges with approvals but no review objects
|
|
3087
|
+
* (GitLab approvals, Azure DevOps votes, Bitbucket participants) synthesise
|
|
3088
|
+
* one review per approver, with `comments: false`.
|
|
3089
|
+
*/
|
|
3090
|
+
reviews: (ref: ThreadRef, options?: PageOptions) => ForgeListing<Review>;
|
|
3091
|
+
/**
|
|
3092
|
+
* Reads one review by its ref. Where the forge has no endpoint for it (`capabilities.threads.getReview` is `'emulated'`),
|
|
3093
|
+
* it lists the reviews of the pull request page by page until the id matches, which costs a request for each page
|
|
3094
|
+
* read.
|
|
3095
|
+
*/
|
|
3096
|
+
getReview: (ref: ReviewRef, options?: BaseOptions) => Promise<Review>;
|
|
3097
|
+
/** Creates a review. Without `event` the review is pending where the forge has pending reviews. A repeat adds a second review. */
|
|
3098
|
+
createReview: (ref: ThreadRef, input: ReviewInput, options?: BaseOptions) => Promise<Review>;
|
|
3099
|
+
/** Submits a pending review. A repeat can reject once the review is submitted. */
|
|
3100
|
+
submitReview: (ref: ReviewRef, event: ReviewEvent, body?: string, options?: BaseOptions) => Promise<Review>;
|
|
3101
|
+
/**
|
|
3102
|
+
* Approves without merging; `createReview({ event: 'approve' })` with nothing else to say. A repeat adds a second
|
|
3103
|
+
* approving review where the forge keeps reviews, and sets the same vote or rejects where it keeps votes.
|
|
3104
|
+
* @returns The approval, as `createReview()` returns it. GitLab reads the signed-in account once per provider to
|
|
3105
|
+
* pick the approval out of a response with more than one approver.
|
|
3106
|
+
*/
|
|
3107
|
+
approve: (ref: ThreadRef, body?: string, options?: BaseOptions) => Promise<Review>;
|
|
3108
|
+
/** Files a pull request changes, with a per-file `patch` where the forge returns one. */
|
|
3109
|
+
files: (ref: ThreadRef, options?: PageOptions) => ForgeListing<ChangedFile>;
|
|
3110
|
+
/** Commits on a pull request. */
|
|
3111
|
+
commits: (ref: ThreadRef, options?: PageOptions) => ForgeListing<Commit>;
|
|
3112
|
+
/**
|
|
3113
|
+
* Replies to a review comment in its conversation. Pass the comment as `reviews()` or `comments()` returns it:
|
|
3114
|
+
* GitHub uses its `inReplyTo` or `ref`, Gitea its `ref`, and GitLab the discussion in its `thread`. A repeat posts a
|
|
3115
|
+
* second reply.
|
|
3116
|
+
*/
|
|
3117
|
+
replyToReviewComment: (ref: ThreadRef, comment: Pick<ReviewComment, "ref" | "thread" | "inReplyTo">, body: string, options?: BaseOptions) => Promise<ReviewComment>;
|
|
3118
|
+
/** Resolves a review conversation, by the id on {@link ReviewComment.thread} or {@link Comment.thread}. */
|
|
3119
|
+
resolveReviewThread: (ref: ThreadRef, id: string, options?: BaseOptions) => Promise<void>;
|
|
3120
|
+
/** Reopens a resolved review conversation, by the id on `ReviewComment.thread` or `Comment.thread`. */
|
|
3121
|
+
unresolveReviewThread: (ref: ThreadRef, id: string, options?: BaseOptions) => Promise<void>;
|
|
3122
|
+
}
|
|
3123
|
+
/** Reading and reporting the checks on a commit. */
|
|
3124
|
+
interface ChecksApi {
|
|
3125
|
+
/** Every check on a commit: check runs, commit statuses, jobs or policy evaluations. */
|
|
3126
|
+
list: (repo: RepoRef, sha: string, options?: BaseOptions) => Promise<Page<Check>>;
|
|
3127
|
+
/** Reads one check. Rejects for a `CheckRef.type` the forge cannot read on its own. */
|
|
3128
|
+
get: (ref: CheckRef, options?: BaseOptions) => Promise<Check>;
|
|
3129
|
+
/**
|
|
3130
|
+
* Writes a commit status, or a check run where the credential can (GitHub app auth). A repeat writes a second check
|
|
3131
|
+
* run; a second commit status with the same name takes the place of the first, except on GitLab, which rejects a
|
|
3132
|
+
* repeat of a status that is still pending.
|
|
3133
|
+
*/
|
|
3134
|
+
report: (repo: RepoRef, sha: string, input: CheckReportInput, options?: BaseOptions) => Promise<Check>;
|
|
3135
|
+
/** Re-runs a check. Rejects for a `CheckRef.type` the forge cannot re-run. A repeat can start another run. */
|
|
3136
|
+
rerun: (ref: CheckRef, options?: BaseOptions) => Promise<void>;
|
|
3137
|
+
}
|
|
3138
|
+
/** Reading CI runs and their jobs, and re-running the jobs that failed. */
|
|
3139
|
+
interface CiApi {
|
|
3140
|
+
/** Lists the CI runs of a repository. */
|
|
3141
|
+
runs: (repo: RepoRef, query?: CiRunQuery) => ForgeListing<CiRun>;
|
|
3142
|
+
/** Reads one CI run. */
|
|
3143
|
+
getRun: (ref: CiRunRef, options?: BaseOptions) => Promise<CiRun>;
|
|
3144
|
+
/** Lists the jobs of a CI run. */
|
|
3145
|
+
jobs: (ref: CiRunRef, options?: PageOptions) => ForgeListing<CiJob>;
|
|
3146
|
+
/**
|
|
3147
|
+
* Reads one CI job. Where the forge has no endpoint for it (`capabilities.ci.getJob` is `'emulated'`), it lists the jobs
|
|
3148
|
+
* of the ref's `run` page by page until the id matches, which costs a request for each page read, so the ref must
|
|
3149
|
+
* name its run.
|
|
3150
|
+
*/
|
|
3151
|
+
getJob: (ref: CiJobRef, options?: BaseOptions) => Promise<CiJob>;
|
|
3152
|
+
/** The job's log as it arrives. */
|
|
3153
|
+
log: (ref: CiJobRef, options?: BaseOptions) => Promise<ReadableStream<Uint8Array>>;
|
|
3154
|
+
/** Re-runs the jobs of a CI run that failed, and the jobs that depend on them. A repeat can start another attempt. */
|
|
3155
|
+
rerunFailed: (ref: CiRunRef, options?: BaseOptions) => Promise<void>;
|
|
3156
|
+
}
|
|
3157
|
+
/** Commits of a repository and the comments on them. */
|
|
3158
|
+
interface CommitsApi {
|
|
3159
|
+
/** Lists the commits that lead to `ref`, or to the default branch. */
|
|
3160
|
+
list: (repo: RepoRef, query?: CommitQuery) => ForgeListing<Commit>;
|
|
3161
|
+
/** One commit, with its files and stats. */
|
|
3162
|
+
get: (ref: CommitRef, options?: BaseOptions) => Promise<Commit>;
|
|
3163
|
+
/** Lists the comments on a commit. */
|
|
3164
|
+
comments: (ref: CommitRef, options?: PageOptions) => ForgeListing<CommitComment>;
|
|
3165
|
+
/**
|
|
3166
|
+
* Reads one comment on a commit. Where the forge has no endpoint for it (`capabilities.commits.getComment` is
|
|
3167
|
+
* `'emulated'`), it lists the comments of the commit page by page until the id matches, which costs a request for
|
|
3168
|
+
* each page read.
|
|
3169
|
+
*/
|
|
3170
|
+
getComment: (ref: CommitCommentRef, options?: BaseOptions) => Promise<CommitComment>;
|
|
3171
|
+
/** Comments on a commit. */
|
|
3172
|
+
createComment: (ref: CommitRef, body: string, options?: BaseOptions) => Promise<CommitComment>;
|
|
3173
|
+
/** Replaces the body of a comment on a commit. */
|
|
3174
|
+
updateComment: (ref: CommitCommentRef, body: string, options?: BaseOptions) => Promise<CommitComment>;
|
|
3175
|
+
/** Deletes a comment on a commit. A repeat can reject with `NotFoundError` once the comment is gone. */
|
|
3176
|
+
deleteComment: (ref: CommitCommentRef, options?: BaseOptions) => Promise<void>;
|
|
3177
|
+
/** Hides a comment on a commit behind a note of the reason, as `threads.hideComment()` does for a thread comment. A repeat leaves it hidden. */
|
|
3178
|
+
hideComment: (ref: CommitCommentRef, reason: HideCommentReason, options?: BaseOptions) => Promise<void>;
|
|
3179
|
+
/** Shows a hidden comment on a commit again. A repeat leaves it shown. */
|
|
3180
|
+
unhideComment: (ref: CommitCommentRef, options?: BaseOptions) => Promise<void>;
|
|
3181
|
+
}
|
|
3182
|
+
/** Files, trees, branches and tags of a repository, comparisons between refs, and commits that write files. */
|
|
3183
|
+
interface ContentsApi {
|
|
3184
|
+
/**
|
|
3185
|
+
* One file's contents. Binary-safe: `content` is a `Uint8Array` unless the
|
|
3186
|
+
* forge reports text and `as: 'text'` was asked for. Files past the forge's
|
|
3187
|
+
* inline limit (1 MB on GitHub) are read from the raw or blob endpoint
|
|
3188
|
+
* instead of failing.
|
|
3189
|
+
* @param repo The repository to read from.
|
|
3190
|
+
* @param path The path of the file from the repository root.
|
|
3191
|
+
* @param options The revision to read, and whether to decode the content as text.
|
|
3192
|
+
* @example
|
|
3193
|
+
* ```ts
|
|
3194
|
+
* const file = await provider.contents.getFile(repo, 'package.json', { as: 'text' })
|
|
3195
|
+
* const manifest = JSON.parse(file.content as string)
|
|
3196
|
+
* ```
|
|
3197
|
+
*/
|
|
3198
|
+
getFile: (repo: RepoRef, path: string, options?: FileOptions) => Promise<FileContent>;
|
|
3199
|
+
/** One level, or every descendant with `recursive`. Truncated listings carry a `tree_truncated` warning. */
|
|
3200
|
+
tree: (repo: RepoRef, options?: TreeOptions) => ForgeListing<TreeEntry>;
|
|
3201
|
+
/** Lists the branches of a repository. */
|
|
3202
|
+
branches: (repo: RepoRef, options?: PageOptions) => ForgeListing<Branch>;
|
|
3203
|
+
/** Lists the tags of a repository. */
|
|
3204
|
+
tags: (repo: RepoRef, options?: PageOptions) => ForgeListing<Tag>;
|
|
3205
|
+
/** Resolves a branch, tag or sha to a full commit sha; a full sha is returned as is. */
|
|
3206
|
+
resolveRef: (repo: RepoRef, ref: string, options?: BaseOptions) => Promise<string>;
|
|
3207
|
+
/** Commits and files between two refs. */
|
|
3208
|
+
compare: (repo: RepoRef, base: string, head: string, options?: CompareOptions) => Promise<Comparison>;
|
|
3209
|
+
/**
|
|
3210
|
+
* Writes and deletes files in one commit on a branch, and moves the branch to it. A repeat with `expectedHead` or
|
|
3211
|
+
* `createFrom` rejects once the first attempt has moved or created the branch; without them, it adds a second commit.
|
|
3212
|
+
* @param repo The repository to commit to.
|
|
3213
|
+
* @param input The branch, the message and the files, with the head the branch must have and the ref to create it from.
|
|
3214
|
+
* @throws `BranchMovedError` when the branch no longer points at `expectedHead`.
|
|
3215
|
+
* @throws `NotFoundError` when a file to delete does not exist.
|
|
3216
|
+
* @example
|
|
3217
|
+
* ```ts
|
|
3218
|
+
* const commit = await provider.contents.commitFiles(repo, {
|
|
3219
|
+
* branch: 'docs/readme',
|
|
3220
|
+
* createFrom: 'main',
|
|
3221
|
+
* message: 'docs: update readme',
|
|
3222
|
+
* changes: [
|
|
3223
|
+
* { path: 'README.md', content: '# widgets\n' },
|
|
3224
|
+
* { path: 'OLD.md', content: null },
|
|
3225
|
+
* ],
|
|
3226
|
+
* })
|
|
3227
|
+
* ```
|
|
3228
|
+
*/
|
|
3229
|
+
commitFiles: (repo: RepoRef, input: CommitFilesInput, options?: BaseOptions) => Promise<Commit>;
|
|
3230
|
+
}
|
|
3231
|
+
/** Reading, creating and updating the releases of a repository, and downloading their assets. */
|
|
3232
|
+
interface ReleasesApi {
|
|
3233
|
+
/** Lists the releases of a repository, including drafts and pre-releases where the credential can see them. */
|
|
3234
|
+
list: (repo: RepoRef, options?: PageOptions) => ForgeListing<Release>;
|
|
3235
|
+
/** Reads a release by its ref. */
|
|
3236
|
+
get: (ref: ReleaseRef, options?: BaseOptions) => Promise<Release>;
|
|
3237
|
+
/** The release for a tag name. */
|
|
3238
|
+
getByTag: (repo: RepoRef, tag: string, options?: BaseOptions) => Promise<Release>;
|
|
3239
|
+
/**
|
|
3240
|
+
* Downloads a release asset, as a stream of its bytes, a `Uint8Array` with `as: 'binary'` or a string with
|
|
3241
|
+
* `as: 'text'`. A redirect to a CDN host is followed without the `Authorization` header, which those hosts reject.
|
|
3242
|
+
* @example
|
|
3243
|
+
* ```ts
|
|
3244
|
+
* const release = await provider.releases.getByTag(repo, 'v1.0.0')
|
|
3245
|
+
* const asset = release.assets?.find(asset => asset.name.endsWith('.pdf'))
|
|
3246
|
+
* if (asset?.ref) {
|
|
3247
|
+
* const bytes = await provider.releases.downloadAsset(asset.ref, { as: 'binary' })
|
|
3248
|
+
* }
|
|
3249
|
+
* ```
|
|
3250
|
+
*/
|
|
3251
|
+
downloadAsset: {
|
|
3252
|
+
(ref: ReleaseAssetRef, options?: DownloadAssetOptions & {
|
|
3253
|
+
as?: "stream";
|
|
3254
|
+
}): Promise<ReadableStream<Uint8Array>>;
|
|
3255
|
+
(ref: ReleaseAssetRef, options: DownloadAssetOptions & {
|
|
3256
|
+
as: "binary";
|
|
3257
|
+
}): Promise<Uint8Array>;
|
|
3258
|
+
(ref: ReleaseAssetRef, options: DownloadAssetOptions & {
|
|
3259
|
+
as: "text";
|
|
3260
|
+
}): Promise<string>;
|
|
3261
|
+
};
|
|
3262
|
+
/** The most recent published release that is not a draft or prerelease, if any. */
|
|
3263
|
+
latest: (repo: RepoRef, options?: BaseOptions) => Promise<Release | undefined>;
|
|
3264
|
+
/**
|
|
3265
|
+
* Creates a release, and its tag from `target` when the tag does not exist yet. A repeat for the same tag rejects on
|
|
3266
|
+
* forges that hold one release per tag; read it back with `getByTag()`.
|
|
3267
|
+
* @param repo The repository to release.
|
|
3268
|
+
* @param input The tag, the name, the notes and whether the release is a draft or a prerelease.
|
|
3269
|
+
* @throws `UnsupportedOperationError` for `draft: true` or `prerelease: true` on a forge without drafts or prereleases.
|
|
3270
|
+
* @example
|
|
3271
|
+
* ```ts
|
|
3272
|
+
* const release = await provider.releases.create(repo, { tag: 'v1.2.0', body: notes, draft: true })
|
|
3273
|
+
* ```
|
|
3274
|
+
*/
|
|
3275
|
+
create: (repo: RepoRef, input: ReleaseInput, options?: BaseOptions) => Promise<Release>;
|
|
3276
|
+
/**
|
|
3277
|
+
* Changes a release. Fields left out stay as they are, so `{ draft: false }` publishes a draft.
|
|
3278
|
+
* @throws `UnsupportedOperationError` for a change the forge cannot make, such as a new tag on GitLab.
|
|
3279
|
+
* @throws `ForbiddenError` with reason `immutable_release` when the forge refuses the write because the
|
|
3280
|
+
* release is immutable (GitHub); its name, notes, prerelease and `latest` flags stay editable.
|
|
3281
|
+
*/
|
|
3282
|
+
update: (ref: ReleaseRef, update: ReleaseUpdate, options?: BaseOptions) => Promise<Release>;
|
|
3283
|
+
}
|
|
3284
|
+
/** Searching issues and pull requests, repositories, commits and code across the forge. */
|
|
3285
|
+
interface SearchApi {
|
|
3286
|
+
/**
|
|
3287
|
+
* Issues and pull requests across repositories. Fields the forge cannot
|
|
3288
|
+
* filter on come back as a `filter_unsupported` warning on the page.
|
|
3289
|
+
*/
|
|
3290
|
+
threads: (query: ThreadSearchQuery) => ForgeListing<Thread>;
|
|
3291
|
+
/** Searches repositories. */
|
|
3292
|
+
repos: (query: RepoSearchQuery) => ForgeListing<Repo>;
|
|
3293
|
+
/** Commits across repositories, where the forge indexes them. */
|
|
3294
|
+
commits: (query: CommitSearchQuery) => ForgeListing<Commit>;
|
|
3295
|
+
/** Searches the contents of files, where the forge indexes them. */
|
|
3296
|
+
code: (query: CodeSearchQuery) => ForgeListing<CodeMatch>;
|
|
3297
|
+
}
|
|
3298
|
+
/** Reading the security alerts of a repository. */
|
|
3299
|
+
interface SecurityAlertsApi {
|
|
3300
|
+
/** Lists the security alerts of a repository. */
|
|
3301
|
+
list: (repo: RepoRef, options?: SecurityAlertListOptions) => ForgeListing<SecurityAlert>;
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Options for `repos.get()`.
|
|
3305
|
+
*/
|
|
3306
|
+
interface RepoGetOptions extends BaseOptions {
|
|
3307
|
+
/**
|
|
3308
|
+
* Includes the repository's licence in `Repo.licence`. GitLab reports it only on request, because detecting it
|
|
3309
|
+
* scans the repository; other forges ignore this option.
|
|
3310
|
+
*/
|
|
3311
|
+
licence?: boolean;
|
|
3312
|
+
}
|
|
3313
|
+
/** Repositories, and the labels, milestones and collaborators that belong to them. */
|
|
3314
|
+
interface ReposApi {
|
|
3315
|
+
/**
|
|
3316
|
+
* Reads a repository by its ref. Rejects with `NotFoundError` when it does not exist or the credential cannot see
|
|
3317
|
+
* it.
|
|
3318
|
+
*/
|
|
3319
|
+
get: (ref: RepoRef, options?: RepoGetOptions) => Promise<Repo>;
|
|
3320
|
+
/** The authenticated account's repositories, or the installation's under app auth. */
|
|
3321
|
+
list: (options?: RepoQuery) => ForgeListing<Repo>;
|
|
3322
|
+
/**
|
|
3323
|
+
* The repositories of a user, organisation, group, workspace or project that the credential can see.
|
|
3324
|
+
* @param owner A namespace ref, such as `namespaceRef(provider, 'acme')`.
|
|
3325
|
+
*/
|
|
3326
|
+
byOwner: (owner: RepoRef, query?: OwnerRepoQuery) => ForgeListing<Repo>;
|
|
3327
|
+
/** Every label defined on the repository, whether or not a thread carries it. */
|
|
3328
|
+
labels: (repo: RepoRef, options?: PageOptions) => ForgeListing<Label>;
|
|
3329
|
+
/** Creates a label in a repository. A repeat rejects on most forges, because the name is taken. */
|
|
3330
|
+
createLabel: (repo: RepoRef, label: LabelInput, options?: BaseOptions) => Promise<Label>;
|
|
3331
|
+
/** Lists the milestones of a repository. */
|
|
3332
|
+
milestones: (repo: RepoRef, options?: MilestoneListOptions) => ForgeListing<Milestone>;
|
|
3333
|
+
/** The issue types that issues in the repository can have. On GitHub, the enabled types of the account that owns it. */
|
|
3334
|
+
issueTypes: (repo: RepoRef, options?: BaseOptions) => Promise<IssueType[]>;
|
|
3335
|
+
/** Lists the collaborators of a repository, with their roles. */
|
|
3336
|
+
collaborators: (repo: RepoRef, options?: PageOptions) => ForgeListing<Collaborator>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Lists the commit authors of a repository with their commit counts, most commits first. Pass
|
|
3339
|
+
* `includeUnlinked: true` to include the contributors the forge has not linked to an account.
|
|
3340
|
+
*/
|
|
3341
|
+
contributors: (repo: RepoRef, options?: ContributorQuery) => ForgeListing<Contributor>;
|
|
3342
|
+
/**
|
|
3343
|
+
* Weekly commit activity of each contributor to a repository. Where the forge computes the statistics in the
|
|
3344
|
+
* background, the provider waits for them, and throws a `ForgeApiError` with status `202` if they are still not ready.
|
|
3345
|
+
*/
|
|
3346
|
+
contributorStats: (repo: RepoRef, options?: BaseOptions) => Promise<ContributorStats[]>;
|
|
3347
|
+
/**
|
|
3348
|
+
* The issue and pull request templates a repository offers, ready to fill in before `threads.create()`. On GitHub,
|
|
3349
|
+
* a repository without its own falls back to the owner's `.github` repository, same as the web UI.
|
|
3350
|
+
* @example
|
|
3351
|
+
* ```ts
|
|
3352
|
+
* const [template] = await provider.repos.templates(repo, { kind: 'pull_request' })
|
|
3353
|
+
* const body = template?.body ?? ''
|
|
3354
|
+
* ```
|
|
3355
|
+
*/
|
|
3356
|
+
templates: (repo: RepoRef, options?: RepoTemplateOptions) => Promise<RepoTemplate[]>;
|
|
3357
|
+
/** One account's role on the repository; `'none'` when it has no access. */
|
|
3358
|
+
permissionFor: (repo: RepoRef, actor: string | Actor, options?: BaseOptions) => Promise<RepoRole>;
|
|
3359
|
+
/**
|
|
3360
|
+
* The checks and approvals a pull request needs before it can merge into a branch. On GitHub it reads both
|
|
3361
|
+
* rulesets and classic branch protection, and only an admin can read the approvals that classic protection asks for.
|
|
3362
|
+
* @param repo The repository that holds the branch.
|
|
3363
|
+
* @param branch The name of the branch, which has to exist.
|
|
3364
|
+
* @example
|
|
3365
|
+
* ```ts
|
|
3366
|
+
* const rules = await provider.repos.branchRules(repo, 'main')
|
|
3367
|
+
* const names = rules.requiredChecks.map(check => check.name)
|
|
3368
|
+
* ```
|
|
3369
|
+
*/
|
|
3370
|
+
branchRules: (repo: RepoRef, branch: string, options?: BaseOptions) => Promise<BranchRules>;
|
|
3371
|
+
/**
|
|
3372
|
+
* Gives an account a role on a repository, or invites it where the forge asks the account to accept first. A repeat
|
|
3373
|
+
* can reject where the forge refuses to add an existing member (GitLab).
|
|
3374
|
+
*/
|
|
3375
|
+
addCollaborator: (repo: RepoRef, actor: string | Actor, role: RepoRole, options?: BaseOptions) => Promise<AddCollaboratorResult>;
|
|
3376
|
+
/** Accounts that can be assigned to a thread in the repository. */
|
|
3377
|
+
assignableUsers: (repo: RepoRef, options?: PageOptions) => ForgeListing<Actor>;
|
|
3378
|
+
/** Accounts that can be asked to review a given pull request. */
|
|
3379
|
+
reviewerCandidates: (ref: ThreadRef, options?: PageOptions) => ForgeListing<Actor>;
|
|
3380
|
+
/**
|
|
3381
|
+
* Lists the activity feed of a repository: pushes, new branches and tags, and changes to its threads and releases.
|
|
3382
|
+
* Events come in the order the forge added them to the feed, latest first, which can differ from `occurredAt`
|
|
3383
|
+
* where the forge adds events late. Each event has `source: 'poll'`.
|
|
3384
|
+
*
|
|
3385
|
+
* Where the forge supports conditional requests, the first page has an `etag`; pass it back as
|
|
3386
|
+
* `cursor: { etag }` to read the first page again, which has `notModified: true` and no items when the feed is
|
|
3387
|
+
* unchanged. Where the forge sets a minimum wait between reads, reading the first page again sooner sends no
|
|
3388
|
+
* request and returns a `throttled` page with a `feed_throttled` warning, unless you pass `force: true`.
|
|
3389
|
+
* Iterating then yields nothing, and the warning lands in `warnings`.
|
|
3390
|
+
* @example
|
|
3391
|
+
* ```ts
|
|
3392
|
+
* const page = await provider.repos.events(repo, { cursor: etag ? { etag } : undefined }).page()
|
|
3393
|
+
* if (!page.notModified) {
|
|
3394
|
+
* etag = page.etag
|
|
3395
|
+
* }
|
|
3396
|
+
* ```
|
|
3397
|
+
*/
|
|
3398
|
+
events: (repo: RepoRef, options?: EventFeedOptions) => ForgeListing<ForgeEvent>;
|
|
3399
|
+
}
|
|
3400
|
+
/** Options for `repos.milestones()`. */
|
|
3401
|
+
interface MilestoneListOptions extends PageOptions {
|
|
3402
|
+
/**
|
|
3403
|
+
* @default 'open'
|
|
3404
|
+
*/
|
|
3405
|
+
state?: "open" | "closed" | "all";
|
|
3406
|
+
}
|
|
3407
|
+
/**
|
|
3408
|
+
* The teams of an organisation and their members. An organisation is a
|
|
3409
|
+
* namespace ref, as `repos.byOwner()` takes one. GitLab has no teams of its
|
|
3410
|
+
* own, so its subgroups play the role of teams and their members are the
|
|
3411
|
+
* subgroup's members.
|
|
3412
|
+
*/
|
|
3413
|
+
interface OrgsApi {
|
|
3414
|
+
/**
|
|
3415
|
+
* Lists the teams of an organisation.
|
|
3416
|
+
* @param org A namespace ref, such as `namespaceRef(provider, 'acme')`.
|
|
3417
|
+
*/
|
|
3418
|
+
teams: (org: RepoRef, options?: PageOptions) => ForgeListing<Team>;
|
|
3419
|
+
/**
|
|
3420
|
+
* Lists the members of a team, as actors.
|
|
3421
|
+
* @param team A team's `ref` from `teams()`, or a ref with only `org` and `slug`, such as `{ forge, instance, org, slug: 'stewards' }`.
|
|
3422
|
+
*/
|
|
3423
|
+
teamMembers: (team: TeamRef, options?: PageOptions) => ForgeListing<Actor>;
|
|
3424
|
+
/**
|
|
3425
|
+
* Blocks an account from the repositories of an organisation. A repeat can reject with a `ForgeApiError` with
|
|
3426
|
+
* `status` 422.
|
|
3427
|
+
* @param org A namespace ref, as for `teams()`.
|
|
3428
|
+
* @param login The account to block.
|
|
3429
|
+
* @example
|
|
3430
|
+
* ```ts
|
|
3431
|
+
* await provider.orgs.block(namespaceRef(provider, 'acme'), 'spammer')
|
|
3432
|
+
* ```
|
|
3433
|
+
*/
|
|
3434
|
+
block: (org: RepoRef, login: string, options?: BaseOptions) => Promise<void>;
|
|
3435
|
+
/** Unblocks an account that `block()` blocked. A repeat can reject with a `ForgeApiError` with `status` 422. */
|
|
3436
|
+
unblock: (org: RepoRef, login: string, options?: BaseOptions) => Promise<void>;
|
|
3437
|
+
}
|
|
3438
|
+
/** The installations of the app that the provider authenticates as. */
|
|
3439
|
+
interface InstallationsApi {
|
|
3440
|
+
/** Lists the installations of the app. */
|
|
3441
|
+
list: (options?: PageOptions) => ForgeListing<Installation>;
|
|
3442
|
+
/** Reads one installation. */
|
|
3443
|
+
get: (installation: Installation | string, options?: BaseOptions) => Promise<Installation>;
|
|
3444
|
+
/** Mints (or reuses a cached) installation token. */
|
|
3445
|
+
token: (installation: Installation | string, options?: BaseOptions) => Promise<InstallationToken>;
|
|
3446
|
+
/** Lists the repositories that an installation can access. */
|
|
3447
|
+
repos: (installation: Installation | string, options?: PageOptions) => ForgeListing<Repo>;
|
|
3448
|
+
/** Provider authenticated as one installation, sharing this instance's app credentials. */
|
|
3449
|
+
provider: (installation: Installation | string) => ForgeProvider;
|
|
3450
|
+
/** One provider per installation. */
|
|
3451
|
+
providers: () => AsyncIterable<{
|
|
3452
|
+
installation: Installation;
|
|
3453
|
+
provider: ForgeProvider;
|
|
3454
|
+
}>;
|
|
3455
|
+
}
|
|
3456
|
+
/** Receiving webhook deliveries, and managing the hooks registered on the forge. */
|
|
3457
|
+
interface WebhooksApi {
|
|
3458
|
+
/** Checks a delivery's signature or token against the secret. */
|
|
3459
|
+
verify: (delivery: WebhookDelivery) => Promise<boolean>;
|
|
3460
|
+
/**
|
|
3461
|
+
* Verifies the delivery, then translates it into normalised events.
|
|
3462
|
+
* @param delivery The headers and the raw body of the request, exactly as received.
|
|
3463
|
+
* @example
|
|
3464
|
+
* ```ts
|
|
3465
|
+
* const events = await provider.webhooks.ingest({
|
|
3466
|
+
* headers: request.headers,
|
|
3467
|
+
* body: await request.text(),
|
|
3468
|
+
* })
|
|
3469
|
+
* ```
|
|
3470
|
+
*/
|
|
3471
|
+
ingest: (delivery: WebhookDelivery) => Promise<ForgeEvent[]>;
|
|
3472
|
+
/** Normalised kinds and actions this provider can deliver, whatever a hook is subscribed to. */
|
|
3473
|
+
readonly events: WebhookEventType[];
|
|
3474
|
+
/** Hooks on a repository, or on an organisation or workspace when `target` is a namespace ref. */
|
|
3475
|
+
list: (target: RepoRef, options?: PageOptions) => ForgeListing<Webhook>;
|
|
3476
|
+
/** Registers a webhook. A repeat registers a second one, or rejects where the forge refuses a second hook for the same URL. */
|
|
3477
|
+
create: (target: RepoRef, input: WebhookInput, options?: BaseOptions) => Promise<Webhook>;
|
|
3478
|
+
/** Changes a webhook. */
|
|
3479
|
+
update: (ref: WebhookRef, update: WebhookUpdate, options?: BaseOptions) => Promise<Webhook>;
|
|
3480
|
+
/** Deletes a webhook. A repeat can reject with `NotFoundError` once the webhook is gone. */
|
|
3481
|
+
delete: (ref: WebhookRef, options?: BaseOptions) => Promise<void>;
|
|
3482
|
+
/** Replaces the signing secret in place. `false` where the forge can only do it by recreating the hook. */
|
|
3483
|
+
rotateSecret: (ref: WebhookRef, secret: string, options?: BaseOptions) => Promise<Webhook>;
|
|
3484
|
+
/** Lists the recent deliveries of a webhook. */
|
|
3485
|
+
deliveries: (ref: WebhookRef, options?: PageOptions) => ForgeListing<WebhookDeliveryRecord>;
|
|
3486
|
+
/** Sends a past delivery again. A repeat sends it once more. */
|
|
3487
|
+
redeliver: (ref: WebhookDeliveryRef, options?: BaseOptions) => Promise<void>;
|
|
3488
|
+
}
|
|
3489
|
+
/**
|
|
3490
|
+
* What a credential needs for a verb, as data. Nothing in the library reads
|
|
3491
|
+
* it; it is there so a consumer can build a consent screen or explain a 403.
|
|
3492
|
+
*/
|
|
3493
|
+
interface VerbScopes {
|
|
3494
|
+
/** OAuth or personal access token scopes. */
|
|
3495
|
+
token?: string[];
|
|
3496
|
+
/** Fine-grained token or app permissions, by permission name. */
|
|
3497
|
+
permissions?: Record<string, "read" | "write" | "admin">;
|
|
3498
|
+
/** How the forge expresses access where scopes do not apply. */
|
|
3499
|
+
note?: string;
|
|
3500
|
+
}
|
|
3501
|
+
/** Options for `sources.stream()`. */
|
|
3502
|
+
interface StreamOptions {
|
|
3503
|
+
/** Resume after this cursor, as yielded by an earlier {@link StreamItem}. */
|
|
3504
|
+
cursor?: string;
|
|
3505
|
+
/** Aborting closes the connection and ends iteration without an error. */
|
|
3506
|
+
signal?: AbortSignal;
|
|
3507
|
+
}
|
|
3508
|
+
/** One item from `sources.stream()`. */
|
|
3509
|
+
interface StreamItem {
|
|
3510
|
+
event: ForgeEvent;
|
|
3511
|
+
/** Opaque position after `event`; persist it and pass it back to resume. */
|
|
3512
|
+
cursor: string;
|
|
3513
|
+
}
|
|
3514
|
+
/** Reading accounts. */
|
|
3515
|
+
interface UsersApi {
|
|
3516
|
+
/** Reads an account by login, without needing a credential where the forge allows it. */
|
|
3517
|
+
get: (login: string, options?: BaseOptions) => Promise<User>;
|
|
3518
|
+
/**
|
|
3519
|
+
* The account the provider's credential belongs to.
|
|
3520
|
+
* @example
|
|
3521
|
+
* ```ts
|
|
3522
|
+
* const me = await provider.users.me()
|
|
3523
|
+
* console.log(me.login)
|
|
3524
|
+
* ```
|
|
3525
|
+
*/
|
|
3526
|
+
me: (options?: BaseOptions) => Promise<User>;
|
|
3527
|
+
/**
|
|
3528
|
+
* Whether an account accepts sponsorship on the forge, such as through a GitHub Sponsors listing. Rejects with
|
|
3529
|
+
* `NotFoundError` when no account has the login.
|
|
3530
|
+
* @param login The account to check.
|
|
3531
|
+
* @example
|
|
3532
|
+
* ```ts
|
|
3533
|
+
* if (await provider.users.sponsorable('danielroe')) {
|
|
3534
|
+
* console.log('https://github.com/sponsors/danielroe')
|
|
3535
|
+
* }
|
|
3536
|
+
* ```
|
|
3537
|
+
*/
|
|
3538
|
+
sponsorable: (login: string, options?: BaseOptions) => Promise<boolean>;
|
|
3539
|
+
/**
|
|
3540
|
+
* Lists what an account did across the repositories the credential can see, in the feed's order as for
|
|
3541
|
+
* {@link ReposApi.events}, with the same conditional requests and throttling. Each event has `source: 'poll'`.
|
|
3542
|
+
*/
|
|
3543
|
+
events: (login: string, options?: EventFeedOptions) => ForgeListing<ForgeEvent>;
|
|
3544
|
+
/**
|
|
3545
|
+
* Blocks an account on behalf of the account the credential belongs to. A repeat can reject with a
|
|
3546
|
+
* `ForgeApiError` with `status` 422.
|
|
3547
|
+
* @param login The account to block.
|
|
3548
|
+
*/
|
|
3549
|
+
block: (login: string, options?: BaseOptions) => Promise<void>;
|
|
3550
|
+
/** Unblocks an account that `block()` blocked. A repeat can reject with a `ForgeApiError` with `status` 422. */
|
|
3551
|
+
unblock: (login: string, options?: BaseOptions) => Promise<void>;
|
|
3552
|
+
}
|
|
3553
|
+
/** Long-lived push streams of events. */
|
|
3554
|
+
interface SourcesApi {
|
|
3555
|
+
/**
|
|
3556
|
+
* Push delivery over a long-lived connection. Iteration ends when the signal
|
|
3557
|
+
* aborts or the consumer stops iterating; a dropped connection throws
|
|
3558
|
+
* `StreamClosedError` carrying the last cursor. There is no automatic
|
|
3559
|
+
* reconnection.
|
|
3560
|
+
*/
|
|
3561
|
+
stream: (options?: StreamOptions) => AsyncIterable<StreamItem>;
|
|
3562
|
+
}
|
|
3563
|
+
/** A connection to one forge, with its identity, its capabilities and the namespaces of operations. */
|
|
3564
|
+
interface ForgeProvider<HasWeb extends boolean = boolean> {
|
|
3565
|
+
/**
|
|
3566
|
+
* Requests endpoints relative to `baseUrl` or absolute HTTP(S) URLs.
|
|
3567
|
+
* Other origins omit default headers and provider credentials; explicit headers apply.
|
|
3568
|
+
*/
|
|
3569
|
+
readonly request: ForgeRequest;
|
|
3570
|
+
/** The forge this provider sends requests to; matches `forge` on every ref it returns. */
|
|
3571
|
+
readonly forge: ForgeKind$1;
|
|
3572
|
+
readonly instance: ForgeInstance;
|
|
3573
|
+
readonly baseUrl: string;
|
|
3574
|
+
/** The `auth.type` the provider was created with; `'anonymous'` when it sends no credentials. */
|
|
3575
|
+
readonly authKind: AuthKind;
|
|
3576
|
+
/** Static, no-network capabilities until `refreshCapabilities()` resolves. */
|
|
3577
|
+
readonly capabilities: ForgeCapabilities;
|
|
3578
|
+
/**
|
|
3579
|
+
* Re-derives capabilities from the instance version. The version is read
|
|
3580
|
+
* once per provider (GHES `/meta`, GitLab, Forgejo and Gitea `/version`).
|
|
3581
|
+
* Updates `capabilities` and returns it.
|
|
3582
|
+
*/
|
|
3583
|
+
refreshCapabilities: () => Promise<ForgeCapabilities>;
|
|
3584
|
+
/**
|
|
3585
|
+
* The request budgets of the latest responses, one per `resource`, read without sending a request. GitHub keeps
|
|
3586
|
+
* a budget per resource, such as `core`, `search` and `graphql`; other forges report one budget with no
|
|
3587
|
+
* `resource`. Empty until a response reports a budget. A budget whose `resetAt` has passed is left out.
|
|
3588
|
+
* @example
|
|
3589
|
+
* ```ts
|
|
3590
|
+
* const core = forge.rateLimits().find(budget => !budget.resource || budget.resource === 'core')
|
|
3591
|
+
* if (core?.remaining !== undefined && core.limit && core.remaining / core.limit < 0.1) {
|
|
3592
|
+
* await slowDown(core.resetAt)
|
|
3593
|
+
* }
|
|
3594
|
+
* ```
|
|
3595
|
+
*/
|
|
3596
|
+
rateLimits: () => RateLimit[];
|
|
3597
|
+
/** Rewrites Markdown into the dialect the forge renders; returns it unchanged where the forge renders CommonMark. */
|
|
3598
|
+
normaliseMarkdown: (body: string) => string;
|
|
3599
|
+
readonly repos: ReposApi;
|
|
3600
|
+
readonly notifications: NotificationsApi;
|
|
3601
|
+
readonly sources: SourcesApi;
|
|
3602
|
+
readonly threads: ThreadsApi;
|
|
3603
|
+
readonly webhooks: WebhooksApi;
|
|
3604
|
+
readonly installations: InstallationsApi;
|
|
3605
|
+
readonly releases: ReleasesApi;
|
|
3606
|
+
readonly contents: ContentsApi;
|
|
3607
|
+
readonly commits: CommitsApi;
|
|
3608
|
+
readonly checks: ChecksApi;
|
|
3609
|
+
readonly ci: CiApi;
|
|
3610
|
+
readonly users: UsersApi;
|
|
3611
|
+
readonly search: SearchApi;
|
|
3612
|
+
readonly securityAlerts: SecurityAlertsApi;
|
|
3613
|
+
readonly orgs: OrgsApi;
|
|
3614
|
+
/**
|
|
3615
|
+
* Whether `verb` is supported, for `kind` where support differs by kind,
|
|
3616
|
+
* including version gates. Every verb is always present and rejects with
|
|
3617
|
+
* `UnsupportedOperationError` when this is `false`: the capability is the
|
|
3618
|
+
* question, the method is the action.
|
|
3619
|
+
* @param verb The operation, named by its path on the provider, such as `threads.createComment`.
|
|
3620
|
+
* @param kind The thread kind, for an operation whose support differs by kind.
|
|
3621
|
+
* @example
|
|
3622
|
+
* ```ts
|
|
3623
|
+
* if (provider.can('threads.merge')) {
|
|
3624
|
+
* await provider.threads.merge(ref)
|
|
3625
|
+
* }
|
|
3626
|
+
* ```
|
|
3627
|
+
*/
|
|
3628
|
+
can: (verb: ForgeVerb, kind?: ThreadKind | SecurityAlertKind) => boolean;
|
|
3629
|
+
/**
|
|
3630
|
+
* How well `verb` is supported: `true`, `'emulated'`, `'not_applicable'`
|
|
3631
|
+
* or `false`, for `kind` where support differs by kind. `can()` is `true`
|
|
3632
|
+
* for every level but `false` and `'not_applicable'`. Without `kind`, a
|
|
3633
|
+
* per-kind verb reports its strongest level across kinds.
|
|
3634
|
+
* @param verb The operation, named by its path on the provider, such as `threads.createComment`.
|
|
3635
|
+
* @param kind The thread kind, for an operation whose support differs by kind.
|
|
3636
|
+
*/
|
|
3637
|
+
support: (verb: ForgeVerb, kind?: ThreadKind | SecurityAlertKind) => Support;
|
|
3638
|
+
/**
|
|
3639
|
+
* The web page for `target`, built without a request; `undefined` when the forge has no such page.
|
|
3640
|
+
* @param target What to link to: a repository or one of its sections (`issues`, `pullRequests`, `compare`, `releases`, `stargazers`, `forks` or `watchers`), thread, comment, release, file, raw file, commit or comparison.
|
|
3641
|
+
*/
|
|
3642
|
+
urlFor: {
|
|
3643
|
+
(target: {
|
|
3644
|
+
repo: RepoRef;
|
|
3645
|
+
section?: undefined;
|
|
3646
|
+
}): HasWeb extends true ? string : string | undefined;
|
|
3647
|
+
(target: UrlTarget): string | undefined;
|
|
3648
|
+
};
|
|
3649
|
+
/**
|
|
3650
|
+
* The canonical origin of the forge's website for this instance, such as `https://github.com`
|
|
3651
|
+
* (without any deployment path), or `undefined` when the forge has no website. Useful for
|
|
3652
|
+
* resolving root-relative links and for building a content security policy.
|
|
3653
|
+
*/
|
|
3654
|
+
readonly webOrigin: HasWeb extends true ? string : string | undefined;
|
|
3655
|
+
/**
|
|
3656
|
+
* Token scopes or app permissions `verb` needs on this forge, as data for a
|
|
3657
|
+
* consent screen or a 403 explanation. Nothing in the library reads it, and
|
|
3658
|
+
* an unmapped verb returns `{}`.
|
|
3659
|
+
* @param verb The operation, named by its path on the provider.
|
|
3660
|
+
*/
|
|
3661
|
+
scopesFor: (verb: ForgeVerb) => VerbScopes;
|
|
3662
|
+
/**
|
|
3663
|
+
* Reads a web URL, clone URL or npm `repository` value (`git+https://`, `github:owner/name`) on this provider's instance into refs; `undefined` for anything else.
|
|
3664
|
+
* @param url The URL to read.
|
|
3665
|
+
*/
|
|
3666
|
+
parseUrl: (url: string | URL) => ParsedForgeUrl | undefined;
|
|
3667
|
+
/**
|
|
3668
|
+
* How to mention `ref` in Markdown on this forge (`#42`, `!42`,
|
|
3669
|
+
* `acme/widgets#42`, `acme/widgets@abc1234`), short when written in `from`;
|
|
3670
|
+
* the page URL where the forge has no reference syntax.
|
|
3671
|
+
* @param ref The thread or commit to mention.
|
|
3672
|
+
* @param options The repository the reference is written in, so that a reference within it is short.
|
|
3673
|
+
*/
|
|
3674
|
+
referenceFor: (ref: ThreadRef | CommitRef, options?: ReferenceOptions) => string | undefined;
|
|
3675
|
+
/**
|
|
3676
|
+
* The references to threads and commits in `text`, as `referenceFor()` writes them and people type them
|
|
3677
|
+
* (`#42`, `!42`, `GH-42`, `acme/widgets#42`, `acme/widgets@abc1234` or a bare sha), with their offsets,
|
|
3678
|
+
* in order. `#42` reads as an issue where issues and pull requests share numbers; `threads.get()`
|
|
3679
|
+
* returns the thread with its kind. A bare sha has 7 to 40 hex characters, with a letter and a digit.
|
|
3680
|
+
* Text inside a URL is skipped, but code spans are not, so leave them out of `text`. Empty when `from`
|
|
3681
|
+
* is on another instance, or the forge has no reference syntax.
|
|
3682
|
+
* @param text The text to read, such as a Markdown text node.
|
|
3683
|
+
* @param options The repository the text is written in, which a short reference points into.
|
|
3684
|
+
*/
|
|
3685
|
+
parseReferences: (text: string, options: ParseReferencesOptions) => ParsedReference[];
|
|
3686
|
+
}
|
|
3687
|
+
//#endregion
|
|
3688
|
+
//#region ../../node_modules/.pnpm/forges@https+++pkg.pr.new+danielroe+forges@40d50b2f8bdc5585becfae405e1a3b8a325f7202/node_modules/forges/dist/index-DR1bBfMh.d.mts
|
|
3689
|
+
/**
|
|
3690
|
+
* A GraphQL document that carries the types of its result and variables, such as a `TypedDocumentString`
|
|
3691
|
+
* from GraphQL Code Generator with `documentMode: 'string'`.
|
|
3692
|
+
*/
|
|
3693
|
+
interface TypedGraphQLDocument<TResult, TVariables> {
|
|
3694
|
+
/** The text of the document. */
|
|
3695
|
+
valueOf: () => string;
|
|
3696
|
+
/** Carries the types; it has no value at runtime. */
|
|
3697
|
+
__apiType?: (variables: TVariables) => TResult;
|
|
3698
|
+
}
|
|
3699
|
+
/** `provider.graphql()`: the result type comes from a {@link TypedGraphQLDocument}, or from the type argument of a plain string. */
|
|
3700
|
+
interface GitHubGraphQL {
|
|
3701
|
+
<TResult, TVariables>(document: TypedGraphQLDocument<TResult, TVariables>, ...args: Record<string, never> extends TVariables ? [variables?: TVariables, options?: BaseOptions] : [variables: TVariables, options?: BaseOptions]): Promise<TResult>;
|
|
3702
|
+
<T = unknown>(query: string, variables?: Record<string, unknown>, options?: BaseOptions): Promise<T>;
|
|
3703
|
+
}
|
|
3704
|
+
/** A provider that `github()` creates: every {@link ForgeProvider} member, and GitHub's GraphQL API. */
|
|
3705
|
+
interface GitHubProvider extends ForgeProvider<true> {
|
|
3706
|
+
/**
|
|
3707
|
+
* Runs a GraphQL query or mutation against the provider's GitHub API and returns its `data`. A read-only provider
|
|
3708
|
+
* runs queries and rejects mutations with `ReadOnlyError`. Variables are required when the document is typed
|
|
3709
|
+
* and declares a required variable.
|
|
3710
|
+
* @throws {InsufficientScopeError} When the token lacks a scope that a field needs.
|
|
3711
|
+
* @throws {RateLimitedError} When the response reports a rate limit, which GitHub sends with a `200`.
|
|
3712
|
+
* @throws {ForgeApiError} When the response carries other errors or no data.
|
|
3713
|
+
* @example
|
|
3714
|
+
* ```ts
|
|
3715
|
+
* const { viewer } = await provider.graphql<{ viewer: { login: string } }>('query { viewer { login } }')
|
|
3716
|
+
* ```
|
|
3717
|
+
*/
|
|
3718
|
+
graphql: GitHubGraphQL;
|
|
3719
|
+
}
|
|
3720
|
+
//#endregion
|
|
3721
|
+
//#region src/gaps/archive.d.ts
|
|
3722
|
+
interface ForgeArchiveOptions {
|
|
3723
|
+
/** Branch, tag or commit sha. */
|
|
3724
|
+
ref: string;
|
|
3725
|
+
/** Only `tar.gz` is supported. */
|
|
3726
|
+
format?: "tar.gz";
|
|
3727
|
+
signal?: AbortSignal;
|
|
3728
|
+
}
|
|
3729
|
+
/**
|
|
3730
|
+
* The repository tree at `ref` as a gzipped tarball stream.
|
|
3731
|
+
* Gap: `forges` has no `contents.archive()`. Proposed upstream as `provider.contents.archive(repo, options)`.
|
|
3732
|
+
*/
|
|
3733
|
+
export declare function forgeArchive(provider: ForgeProvider, repo: RepoRef, options: ForgeArchiveOptions): Promise<ReadableStream<Uint8Array>>;
|
|
3734
|
+
//#endregion
|
|
3735
|
+
//#region src/gaps/blob.d.ts
|
|
3736
|
+
/**
|
|
3737
|
+
* The bytes of one Git blob, by its sha. The blob of a symlink holds the link target.
|
|
3738
|
+
* Gap: `forges` reads files by path only, and GitHub follows a symlink path to its target.
|
|
3739
|
+
* Proposed upstream as `provider.contents.blob(repo, sha, options)`.
|
|
3740
|
+
*/
|
|
3741
|
+
export declare function forgeBlob(provider: ForgeProvider, repo: RepoRef, sha: string, options?: {
|
|
3742
|
+
signal?: AbortSignal;
|
|
3743
|
+
}): Promise<Uint8Array>;
|
|
3744
|
+
//#endregion
|
|
3745
|
+
//#region src/gaps/branch-rules.d.ts
|
|
3746
|
+
/** What GitHub branch rules ask for beyond `BranchRules` from `provider.repos.branchRules()`. */
|
|
3747
|
+
interface GitHubBranchRuleDetails {
|
|
3748
|
+
/** An active ruleset requires workflows, which cannot be reduced to check names. */
|
|
3749
|
+
requiredWorkflows: boolean;
|
|
3750
|
+
/** Merge methods that every active pull request rule allows. Undefined when no rule limits them. */
|
|
3751
|
+
mergeMethods?: MergeMethod[];
|
|
3752
|
+
/**
|
|
3753
|
+
* Where the classic protection came from. `branch-summary` means the credential cannot read the protection
|
|
3754
|
+
* endpoint (no admin access): the required checks are complete, the required approvals are not.
|
|
3755
|
+
*/
|
|
3756
|
+
classicSource: "protection-endpoint" | "branch-summary" | "unprotected-branch";
|
|
3757
|
+
}
|
|
3758
|
+
/**
|
|
3759
|
+
* Read the GitHub-only details from the `raw` answer of `provider.repos.branchRules()`. Throws `FORGE_R0007`
|
|
3760
|
+
* when the answer is not complete GitHub branch rules, so a caller never mistakes unknown rules for no rules.
|
|
3761
|
+
*/
|
|
3762
|
+
export declare function githubBranchRuleDetails(rules: BranchRules): GitHubBranchRuleDetails;
|
|
3763
|
+
//#endregion
|
|
3764
|
+
//#region src/gaps/commit-files.d.ts
|
|
3765
|
+
/** Git file modes: a regular file, an executable file and a symlink. The content of a symlink is its target. */
|
|
3766
|
+
type ForgeFileMode = "100644" | "100755" | "120000";
|
|
3767
|
+
interface ForgeFileChange extends FileChange {
|
|
3768
|
+
mode?: ForgeFileMode;
|
|
3769
|
+
}
|
|
3770
|
+
interface ForgeCommitFilesInput extends Omit<CommitFilesInput, "changes"> {
|
|
3771
|
+
changes: ForgeFileChange[];
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* `provider.contents.commitFiles()` with Git file modes, and the sha of the new commit.
|
|
3775
|
+
* Without a `mode`, the call goes to `commitFiles()`. When one change has a `mode`, every write without one is `100644`.
|
|
3776
|
+
* Rejects with `BranchMovedError` when the branch no longer points at `expectedHead`, as `commitFiles()` does.
|
|
3777
|
+
* Gap: `FileChange` has no mode, so `commitFiles()` cannot write a symlink or an executable file.
|
|
3778
|
+
* Proposed upstream as `FileChange.mode`.
|
|
3779
|
+
*/
|
|
3780
|
+
export declare function forgeCommitFiles(provider: ForgeProvider, repo: RepoRef, input: ForgeCommitFilesInput, options?: BaseOptions): Promise<string>;
|
|
3781
|
+
//#endregion
|
|
3782
|
+
//#region src/provider.d.ts
|
|
3783
|
+
/** The Forges that ViteHub supports. */
|
|
3784
|
+
type ForgeKind = "github" | "gitlab" | "forgejo";
|
|
3785
|
+
interface ForgeConnection {
|
|
3786
|
+
forge: ForgeKind;
|
|
3787
|
+
/** GitHub: API base. GitLab and Forgejo: instance root. */
|
|
3788
|
+
baseUrl?: string;
|
|
3789
|
+
/** Omitted: anonymous public reads. */
|
|
3790
|
+
token?: string;
|
|
3791
|
+
readOnly?: boolean;
|
|
3792
|
+
fetch?: typeof fetch;
|
|
3793
|
+
/** Default "vitehub". */
|
|
3794
|
+
userAgent?: string;
|
|
3795
|
+
/** Request timeout in milliseconds. Default 30000. */
|
|
3796
|
+
timeout?: number;
|
|
3797
|
+
}
|
|
3798
|
+
/**
|
|
3799
|
+
* Create the library provider for one Forge. Internal to ViteHub packages: return it from a public API only
|
|
3800
|
+
* where the API owns the Forge credentials, such as `GitHubHost.forge()` in `@vite-hub/agent`.
|
|
3801
|
+
* A GitHub provider also has `graphql()`.
|
|
3802
|
+
*/
|
|
3803
|
+
export declare function forgeProvider(connection: ForgeConnection & {
|
|
3804
|
+
forge: "github";
|
|
3805
|
+
}): Promise<GitHubProvider>;
|
|
3806
|
+
export declare function forgeProvider(connection: ForgeConnection): Promise<ForgeProvider>;
|
|
3807
|
+
/** A Forge response that succeeded but did not include the expected data. */
|
|
3808
|
+
export declare class ForgeResponseError extends Error {
|
|
3809
|
+
override name: string;
|
|
3810
|
+
}
|
|
3811
|
+
/** The HTTP status of a failed Forge request, or undefined for other errors. */
|
|
3812
|
+
export declare function forgeErrorStatus(error: unknown): number | undefined;
|
|
3813
|
+
/** The error that a cancelled Forge operation rejects with. */
|
|
3814
|
+
export declare function abortError(signal: AbortSignal): Error;
|
|
3815
|
+
/** Reject with the abort reason when `signal` aborts before `promise` settles. */
|
|
3816
|
+
export declare function withSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
3817
|
+
//#endregion
|
|
3818
|
+
//#region src/gaps/git-credentials.d.ts
|
|
3819
|
+
interface ForgeGitCredentialsInput {
|
|
3820
|
+
forge: ForgeKind;
|
|
3821
|
+
/** The same `baseUrl` as `forgeProvider()`. GitHub: API base. GitLab and Forgejo: instance root. */
|
|
3822
|
+
baseUrl?: string;
|
|
3823
|
+
/** Omitted: anonymous clone. */
|
|
3824
|
+
token?: string;
|
|
3825
|
+
/** `owner/name`. GitLab accepts nested groups, such as `group/subgroup/name`. */
|
|
3826
|
+
repository: string;
|
|
3827
|
+
}
|
|
3828
|
+
/** Git smart HTTP remote and the basic auth pair to send to it. */
|
|
3829
|
+
interface ForgeGitCredentials {
|
|
3830
|
+
url: string;
|
|
3831
|
+
username?: string;
|
|
3832
|
+
password?: string;
|
|
3833
|
+
}
|
|
3834
|
+
/**
|
|
3835
|
+
* Git smart HTTP remote and credentials for one repository.
|
|
3836
|
+
* Gap: `forges` exposes `Repo.cloneUrls` but no transport credential.
|
|
3837
|
+
*/
|
|
3838
|
+
export declare function forgeGitCredentials(input: ForgeGitCredentialsInput): ForgeGitCredentials;
|
|
3839
|
+
/**
|
|
3840
|
+
* The `http.<url>.extraheader` config entry that sends the credentials to the remote only.
|
|
3841
|
+
* Pass it through `GIT_CONFIG_KEY_<n>` and `GIT_CONFIG_VALUE_<n>`, not `-c`, so the token is not in process arguments.
|
|
3842
|
+
* Undefined for anonymous credentials.
|
|
3843
|
+
*/
|
|
3844
|
+
export declare function forgeGitAuthHeader(credentials: ForgeGitCredentials): {
|
|
3845
|
+
key: string;
|
|
3846
|
+
value: string;
|
|
3847
|
+
} | undefined;
|
|
3848
|
+
//#endregion
|
|
3849
|
+
//#region src/gaps/retarget.d.ts
|
|
3850
|
+
/** Change the base branch of a GitHub pull request. */
|
|
3851
|
+
export declare function retargetPullRequest(provider: ForgeProvider, thread: ThreadRef, base: string, options?: BaseOptions): Promise<void>;
|
|
3852
|
+
//#endregion
|
|
3853
|
+
//#region src/gaps/review-threads.d.ts
|
|
3854
|
+
/** A resolvable review conversation on a pull request. */
|
|
3855
|
+
interface ReviewThread {
|
|
3856
|
+
/** The id that `threads.resolveReviewThread()` takes. */
|
|
3857
|
+
id: string;
|
|
3858
|
+
resolved: boolean;
|
|
3859
|
+
outdated: boolean;
|
|
3860
|
+
path?: string;
|
|
3861
|
+
line?: number;
|
|
3862
|
+
startLine?: number;
|
|
3863
|
+
originalLine?: number;
|
|
3864
|
+
originalStartLine?: number;
|
|
3865
|
+
/** Every comment in the conversation: its GraphQL id and its REST id. */
|
|
3866
|
+
comments: Array<{
|
|
3867
|
+
id: string;
|
|
3868
|
+
restId?: string;
|
|
3869
|
+
}>;
|
|
3870
|
+
/** The GraphQL node without its comment connection. */
|
|
3871
|
+
raw: Record<string, unknown>;
|
|
3872
|
+
}
|
|
3873
|
+
/** A review conversation and the pull request it belongs to. */
|
|
3874
|
+
interface ReviewThreadOwner {
|
|
3875
|
+
id: string;
|
|
3876
|
+
resolved: boolean;
|
|
3877
|
+
/** The GraphQL id of the pull request. */
|
|
3878
|
+
pullRequestId: string;
|
|
3879
|
+
}
|
|
3880
|
+
/** List every review conversation of a GitHub pull request, with the identity of every comment in it. */
|
|
3881
|
+
export declare function listReviewThreads(provider: ForgeProvider, thread: ThreadRef, options?: BaseOptions): Promise<ReviewThread[]>;
|
|
3882
|
+
/** Look up one review conversation by its id. Returns undefined when the id names no review conversation. */
|
|
3883
|
+
export declare function getReviewThread(provider: ForgeProvider, id: string, options?: BaseOptions): Promise<ReviewThreadOwner | undefined>;
|
|
3884
|
+
//#endregion
|
|
3885
|
+
//#region src/github-app.d.ts
|
|
3886
|
+
interface GitHubAppCredentials {
|
|
3887
|
+
installationToken(installationId: number | string, options?: {
|
|
3888
|
+
refresh?: boolean;
|
|
3889
|
+
signal?: AbortSignal;
|
|
3890
|
+
}): Promise<{
|
|
3891
|
+
token: string;
|
|
3892
|
+
expiresAt: Date;
|
|
3893
|
+
}>;
|
|
3894
|
+
/** GET /repos/{repository}/installation with the app JWT. */
|
|
3895
|
+
installation(repository: string, signal?: AbortSignal): Promise<number>;
|
|
3896
|
+
/** GET /app. */
|
|
3897
|
+
app(signal?: AbortSignal): Promise<{
|
|
3898
|
+
id: number;
|
|
3899
|
+
slug: string;
|
|
3900
|
+
login: string;
|
|
3901
|
+
}>;
|
|
3902
|
+
}
|
|
3903
|
+
interface GitHubAppInput {
|
|
3904
|
+
appId: number | string;
|
|
3905
|
+
privateKey: string;
|
|
3906
|
+
baseUrl?: string;
|
|
3907
|
+
fetch?: typeof fetch;
|
|
3908
|
+
userAgent?: string;
|
|
3909
|
+
}
|
|
3910
|
+
/**
|
|
3911
|
+
* GitHub App credentials. App providers are cached per API base, App, private key, user agent,
|
|
3912
|
+
* fetch function, and installation, so installation tokens are minted once and reused until they expire.
|
|
3913
|
+
*/
|
|
3914
|
+
export declare function githubAppCredentials(input: GitHubAppInput): GitHubAppCredentials;
|
|
3915
|
+
/** Read a GitHub App private key from an inline value or a file path. Escaped "\\n" becomes a newline. */
|
|
3916
|
+
export declare function readGitHubAppPrivateKey(inline: string | undefined, path: string | undefined): Promise<string | undefined>;
|
|
3917
|
+
//#endregion
|
|
3918
|
+
export { type BaseOptions, BranchMovedError, type BranchRules, type Check, type CiRun, type CiRunRef, type Commit, ForgeApiError, type ForgeArchiveOptions, type ForgeCommitFilesInput, type ForgeConnection, type ForgeEnv, type ForgeEnvField, type ForgeFileChange, type ForgeFileMode, type ForgeGitCredentials, type ForgeGitCredentialsInput, type ForgeKind, type ForgeProvider, ForgeTimeoutError, type GitHubAppCredentials, type GitHubAppInput, type GitHubBranchRuleDetails, type GitHubProvider, MergeBlockedError, type MergeMethod, NotFoundError, type Page, RateLimitedError, type RepoRef, type RequiredCheck, type ReviewThread, type ReviewThreadOwner, type Thread, type ThreadRef, type TreeEntry, repoRef };
|