@lbdudc/linea-git 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.
Files changed (152) hide show
  1. package/README.md +47 -2
  2. package/dist/access.d.ts +18 -0
  3. package/dist/access.js +18 -0
  4. package/dist/access.js.map +1 -0
  5. package/dist/auth.d.ts +11 -0
  6. package/dist/auth.js +16 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/changelog/generate.d.ts +18 -0
  9. package/dist/changelog/generate.js +166 -0
  10. package/dist/changelog/generate.js.map +1 -0
  11. package/dist/changelog/index.d.ts +5 -0
  12. package/dist/changelog/index.js +3 -0
  13. package/dist/changelog/index.js.map +1 -0
  14. package/dist/changelog/parse.d.ts +43 -0
  15. package/dist/changelog/parse.js +91 -0
  16. package/dist/changelog/parse.js.map +1 -0
  17. package/dist/changelog/types.d.ts +85 -0
  18. package/dist/changelog/types.js +2 -0
  19. package/dist/changelog/types.js.map +1 -0
  20. package/dist/checkout/credential.d.ts +14 -0
  21. package/dist/checkout/credential.js +29 -0
  22. package/dist/checkout/credential.js.map +1 -0
  23. package/dist/checkout/git.d.ts +78 -0
  24. package/dist/checkout/git.js +191 -0
  25. package/dist/checkout/git.js.map +1 -0
  26. package/dist/checkout/index.d.ts +3 -0
  27. package/dist/checkout/index.js +4 -0
  28. package/dist/checkout/index.js.map +1 -0
  29. package/dist/checkout/sync.d.ts +156 -0
  30. package/dist/checkout/sync.js +211 -0
  31. package/dist/checkout/sync.js.map +1 -0
  32. package/dist/closing.d.ts +1 -0
  33. package/dist/closing.js +14 -0
  34. package/dist/closing.js.map +1 -0
  35. package/dist/config.d.ts +53 -0
  36. package/dist/config.js +40 -0
  37. package/dist/config.js.map +1 -0
  38. package/dist/deletion.d.ts +19 -0
  39. package/dist/deletion.js +27 -0
  40. package/dist/deletion.js.map +1 -0
  41. package/dist/errors.d.ts +26 -0
  42. package/dist/errors.js +47 -0
  43. package/dist/errors.js.map +1 -0
  44. package/dist/factory.d.ts +20 -0
  45. package/dist/factory.js +46 -0
  46. package/dist/factory.js.map +1 -0
  47. package/dist/github/client.d.ts +44 -0
  48. package/dist/github/client.js +145 -0
  49. package/dist/github/client.js.map +1 -0
  50. package/dist/github/config.d.ts +24 -0
  51. package/dist/github/config.js +11 -0
  52. package/dist/github/config.js.map +1 -0
  53. package/dist/github/provider.d.ts +510 -0
  54. package/dist/github/provider.js +1009 -0
  55. package/dist/github/provider.js.map +1 -0
  56. package/dist/gitlab/client.d.ts +50 -0
  57. package/dist/gitlab/client.js +228 -0
  58. package/dist/gitlab/client.js.map +1 -0
  59. package/dist/gitlab/provider.d.ts +487 -0
  60. package/dist/gitlab/provider.js +719 -0
  61. package/dist/gitlab/provider.js.map +1 -0
  62. package/dist/host.d.ts +27 -0
  63. package/dist/host.js +45 -0
  64. package/dist/host.js.map +1 -0
  65. package/dist/index.d.ts +46 -0
  66. package/dist/index.js +31 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/local/diff.d.ts +3 -0
  69. package/dist/local/diff.js +43 -0
  70. package/dist/local/diff.js.map +1 -0
  71. package/dist/local/git.d.ts +24 -0
  72. package/dist/local/git.js +51 -0
  73. package/dist/local/git.js.map +1 -0
  74. package/dist/local/health.d.ts +36 -0
  75. package/dist/local/health.js +57 -0
  76. package/dist/local/health.js.map +1 -0
  77. package/dist/local/hooks.d.ts +2 -0
  78. package/dist/local/hooks.js +44 -0
  79. package/dist/local/hooks.js.map +1 -0
  80. package/dist/local/http.d.ts +35 -0
  81. package/dist/local/http.js +160 -0
  82. package/dist/local/http.js.map +1 -0
  83. package/dist/local/provider.d.ts +571 -0
  84. package/dist/local/provider.js +1237 -0
  85. package/dist/local/provider.js.map +1 -0
  86. package/dist/local/store.d.ts +136 -0
  87. package/dist/local/store.js +171 -0
  88. package/dist/local/store.js.map +1 -0
  89. package/dist/packages/github-source.d.ts +69 -0
  90. package/dist/packages/github-source.js +133 -0
  91. package/dist/packages/github-source.js.map +1 -0
  92. package/dist/packages/gitlab-source.d.ts +59 -0
  93. package/dist/packages/gitlab-source.js +214 -0
  94. package/dist/packages/gitlab-source.js.map +1 -0
  95. package/dist/packages/index.d.ts +30 -0
  96. package/dist/packages/index.js +45 -0
  97. package/dist/packages/index.js.map +1 -0
  98. package/dist/packages/provider-source.d.ts +34 -0
  99. package/dist/packages/provider-source.js +57 -0
  100. package/dist/packages/provider-source.js.map +1 -0
  101. package/dist/packages/repository-files.d.ts +12 -0
  102. package/dist/packages/repository-files.js +16 -0
  103. package/dist/packages/repository-files.js.map +1 -0
  104. package/dist/provider.d.ts +888 -0
  105. package/dist/provider.js +29 -0
  106. package/dist/provider.js.map +1 -0
  107. package/dist/read-cache.d.ts +5 -0
  108. package/dist/read-cache.js +101 -0
  109. package/dist/read-cache.js.map +1 -0
  110. package/dist/registry/catalog.d.ts +55 -0
  111. package/dist/registry/catalog.js +143 -0
  112. package/dist/registry/catalog.js.map +1 -0
  113. package/dist/registry/kinds.d.ts +21 -0
  114. package/dist/registry/kinds.js +43 -0
  115. package/dist/registry/kinds.js.map +1 -0
  116. package/dist/registry/packages.d.ts +165 -0
  117. package/dist/registry/packages.js +290 -0
  118. package/dist/registry/packages.js.map +1 -0
  119. package/dist/registry/publish.d.ts +35 -0
  120. package/dist/registry/publish.js +155 -0
  121. package/dist/registry/publish.js.map +1 -0
  122. package/dist/registry/release.d.ts +63 -0
  123. package/dist/registry/release.js +79 -0
  124. package/dist/registry/release.js.map +1 -0
  125. package/dist/restoration.d.ts +14 -0
  126. package/dist/restoration.js +33 -0
  127. package/dist/restoration.js.map +1 -0
  128. package/dist/templates.d.ts +8 -0
  129. package/dist/templates.js +39 -0
  130. package/dist/templates.js.map +1 -0
  131. package/dist/testing/contract.d.ts +43 -0
  132. package/dist/testing/contract.js +713 -0
  133. package/dist/testing/contract.js.map +1 -0
  134. package/dist/testing/diff.d.ts +1 -0
  135. package/dist/testing/diff.js +65 -0
  136. package/dist/testing/diff.js.map +1 -0
  137. package/dist/testing/git-http.d.ts +12 -0
  138. package/dist/testing/git-http.js +308 -0
  139. package/dist/testing/git-http.js.map +1 -0
  140. package/dist/testing/github-double.d.ts +151 -0
  141. package/dist/testing/github-double.js +1129 -0
  142. package/dist/testing/github-double.js.map +1 -0
  143. package/dist/testing/gitlab-double.d.ts +161 -0
  144. package/dist/testing/gitlab-double.js +1554 -0
  145. package/dist/testing/gitlab-double.js.map +1 -0
  146. package/dist/testing/index.d.ts +7 -0
  147. package/dist/testing/index.js +8 -0
  148. package/dist/testing/index.js.map +1 -0
  149. package/dist/version.d.ts +2 -0
  150. package/dist/version.js +12 -0
  151. package/dist/version.js.map +1 -0
  152. package/package.json +66 -4
@@ -0,0 +1,571 @@
1
+ import type { AuthConfig, Capabilities, ChangeRequest, CiRunners, Comment, CommitSummary, Comparison, Delivery, DiffPosition, FileAction, FileDiff, GitProvider, Id, Issue, IssueChanges, IssueFilter, Label, Member, MergeOptions, MergeRequest, MergeRequestChanges, MergeRequestFilter, Milestone, Namespace, Page, Pipeline, PipelineJob, Release, ReleaseChanges, Repository, RepositoryFile, Template, TemplateKind, Thread, Tokens, PendingDeletion } from '../provider.js';
2
+ import { LocalStore, type RepositoryRecord, type State } from './store.js';
3
+ /** Who a token is: the server tells (a local account, with the token LINEA gave it). */
4
+ export interface LocalUser {
5
+ username: string;
6
+ avatarUrl?: string | undefined;
7
+ /** An administrator can do everything everywhere. */
8
+ admin?: boolean | undefined;
9
+ }
10
+ export interface LocalProviderOptions {
11
+ /** The folder the repositories and their bookkeeping live in. */
12
+ dataDir: string;
13
+ /** Where the repositories are served by git over HTTP (`<baseUrl>/<group>/<name>.git`), and what links to them say. */
14
+ baseUrl?: string | undefined;
15
+ /** The address of the client: where a login would come back to (there is no OAuth here, so it is only reported). */
16
+ redirectUri?: string | undefined;
17
+ /** Whose token it is. Without it every token is the one user `local` (what a laptop with no accounts is). */
18
+ resolveUser?: ((token: string) => LocalUser | null | Promise<LocalUser | null>) | undefined;
19
+ /** Top-level groups only their owner and the administrators write in (the registry): everybody else reads (level 20), unless a member says more. */
20
+ readOnlyGroups?: string[] | undefined;
21
+ }
22
+ /** The path segment a name becomes. Never ends in `.git` (that is where a repository's address ends) or starts with a dot. */
23
+ export declare const slug: (name: string) => string;
24
+ /**
25
+ * Repositories kept on the machine LINEA runs on, as bare git repositories: LINEA works with no other git host. A person's token is
26
+ * LINEA's own (a local account); everybody on the server can work in every repository (level 40), the person who made it, and the
27
+ * administrators, own it (level 50).
28
+ *
29
+ * What the other hosts have besides git is kept in `state.json` (see store.ts): groups, topics, members, change requests. There is no
30
+ * CI here: a pipeline is what the host runs, and this one runs none.
31
+ */
32
+ export declare class LocalProvider implements GitProvider {
33
+ readonly kind: "local";
34
+ readonly nestsNamespaces = true;
35
+ readonly webhookPath = "/api/webhooks/local";
36
+ readonly store: LocalStore;
37
+ private readonly baseUrl;
38
+ private readonly redirectUri;
39
+ private readonly resolveUser;
40
+ private readonly undo;
41
+ private readonly readOnlyGroups;
42
+ constructor(options: LocalProviderOptions);
43
+ private remember;
44
+ private user;
45
+ private namespaceOf;
46
+ private repositoryOf;
47
+ private pathOf;
48
+ private dirOf;
49
+ private toRepository;
50
+ private toNamespace;
51
+ /** The repository and the folder of its git, once the caller is known to be allowed `level` on it. */
52
+ private open;
53
+ /**
54
+ * What a person may do in a repository, as a git host's access level: the owner and the administrators can do everything, a member
55
+ * has the level they were given, and everybody else works in it (maintainer) unless it is in a group only its owner writes in.
56
+ * The API and git over HTTP both ask this, so a person can do the same through either.
57
+ */
58
+ levelFor(state: State, record: RepositoryRecord, user: LocalUser): number;
59
+ private isReadOnly;
60
+ /** The level on a group: the same rule, for creating in it, renaming it and deleting it. */
61
+ private levelOnNamespace;
62
+ /** Whoever owns every repository under a group may also delete or rename it (the person who made a line owns the groups of its products). */
63
+ private ownsEverythingUnder;
64
+ private resolveCommit;
65
+ private mustResolve;
66
+ authConfig(): AuthConfig;
67
+ exchangeCode(): Promise<Tokens>;
68
+ refreshToken({ accessToken }: {
69
+ refreshToken: string | null;
70
+ accessToken: string;
71
+ }): Promise<Tokens>;
72
+ getUser({ token }: {
73
+ token: string;
74
+ }): Promise<{
75
+ username: string;
76
+ avatarUrl: string;
77
+ }>;
78
+ listNamespaces({ token }: {
79
+ token: string;
80
+ }): Promise<Namespace[]>;
81
+ findNamespace({ token, fullPath }: {
82
+ token: string;
83
+ fullPath: string;
84
+ }): Promise<Namespace | null>;
85
+ createNamespace({ token, name, parentId }: {
86
+ token: string;
87
+ name: string;
88
+ parentId?: Id | undefined;
89
+ }): Promise<Namespace>;
90
+ deleteNamespace({ token, id }: {
91
+ token: string;
92
+ id: Id;
93
+ }): Promise<unknown>;
94
+ private subtreeOf;
95
+ renameNamespace({ token, id, name }: {
96
+ token: string;
97
+ id: Id;
98
+ name: string;
99
+ }): Promise<unknown>;
100
+ createRepository({ token, name, namespaceId, topics, defaultBranch }: {
101
+ token: string;
102
+ name: string;
103
+ namespaceId?: Id | undefined;
104
+ topics?: string[];
105
+ defaultBranch?: string | undefined;
106
+ }): Promise<Repository>;
107
+ listPendingDeletion(): Promise<PendingDeletion[]>;
108
+ restoreRepository(): Promise<unknown>;
109
+ restoreNamespace(): Promise<unknown>;
110
+ deleteRepository({ token, id }: {
111
+ token: string;
112
+ id: Id;
113
+ }): Promise<unknown>;
114
+ private get trashDir();
115
+ /** Moves the git of a repository out of the way; returns where it went (null when there was nothing). */
116
+ private toTrash;
117
+ /** Forgets what has been in the trash for longer than `maxAgeMs` (a week by default). */
118
+ purgeTrash(maxAgeMs?: number): void;
119
+ private restore;
120
+ renameRepository({ token, id, name }: {
121
+ token: string;
122
+ id: Id;
123
+ name: string;
124
+ }): Promise<Repository>;
125
+ getRepository({ token, id }: {
126
+ token: string;
127
+ id: Id;
128
+ }): Promise<Repository>;
129
+ findRepository({ token, path: repoPath }: {
130
+ token: string;
131
+ path: string;
132
+ }): Promise<Repository | null>;
133
+ listRepositories({ token, topic }: {
134
+ token: string;
135
+ topic: string;
136
+ }): Promise<Repository[]>;
137
+ addTopic({ token, id, topic }: {
138
+ token: string;
139
+ id: Id;
140
+ topic: string;
141
+ }): Promise<void>;
142
+ setDefaultBranch({ token, id, branch }: {
143
+ token: string;
144
+ id: Id;
145
+ branch: string;
146
+ }): Promise<unknown>;
147
+ getMembers({ token, id }: {
148
+ token: string;
149
+ id: Id;
150
+ }): Promise<Member[]>;
151
+ getAccessLevel({ token, id, username }: {
152
+ token: string;
153
+ id: Id;
154
+ username: string;
155
+ }): Promise<number>;
156
+ private revisionOf;
157
+ getFile({ token, id, path: filePath, ref }: {
158
+ token: string;
159
+ id: Id;
160
+ path: string;
161
+ ref: string;
162
+ }): Promise<RepositoryFile>;
163
+ getFileRevision(args: {
164
+ token: string;
165
+ id: Id;
166
+ path: string;
167
+ ref: string;
168
+ }): Promise<RepositoryFile>;
169
+ readFile({ token, id, path: filePath, ref }: {
170
+ token: string;
171
+ id: Id;
172
+ path: string;
173
+ ref: string;
174
+ }): Promise<Buffer | null>;
175
+ listFiles({ token, id, ref }: {
176
+ token: string;
177
+ id: Id;
178
+ ref: string;
179
+ }): Promise<string[]>;
180
+ createFile({ token, id, path: filePath, branch, content }: {
181
+ token: string;
182
+ id: Id;
183
+ path: string;
184
+ branch: string;
185
+ content: string;
186
+ }): Promise<unknown>;
187
+ saveFile({ token, id, path: filePath, branch, content }: {
188
+ token: string;
189
+ id: Id;
190
+ path: string;
191
+ branch: string;
192
+ content: string;
193
+ }): Promise<unknown>;
194
+ commit({ token, id, branch, message, actions, track }: {
195
+ token: string;
196
+ id: Id;
197
+ branch: string;
198
+ message: string;
199
+ actions: FileAction[];
200
+ track?: boolean;
201
+ }): Promise<{
202
+ id: string;
203
+ }>;
204
+ downloadArchive({ token, id, ref }: {
205
+ token: string;
206
+ id: Id;
207
+ ref?: string;
208
+ }): Promise<NodeJS.ReadableStream>;
209
+ compare({ token, id, from, to }: {
210
+ token: string;
211
+ id: Id;
212
+ from: string;
213
+ to: string;
214
+ }): Promise<Comparison>;
215
+ getCommits({ token, id, ref, perPage }: {
216
+ token: string;
217
+ id: Id;
218
+ ref: string;
219
+ perPage?: number;
220
+ }): Promise<CommitSummary[]>;
221
+ createBranch({ token, id, branch, ref, track }: {
222
+ token: string;
223
+ id: Id;
224
+ branch: string;
225
+ ref: string;
226
+ track?: boolean;
227
+ }): Promise<unknown>;
228
+ listBranches({ token, id }: {
229
+ token: string;
230
+ id: Id;
231
+ }): Promise<string[]>;
232
+ getBranch({ token, id, branch }: {
233
+ token: string;
234
+ id: Id;
235
+ branch: string;
236
+ }): Promise<{
237
+ name: string;
238
+ lastCommit: CommitSummary | null;
239
+ }>;
240
+ listTags({ token, id }: {
241
+ token: string;
242
+ id: Id;
243
+ }): Promise<{
244
+ name: string;
245
+ }[]>;
246
+ getTag({ token, id, tag }: {
247
+ token: string;
248
+ id: Id;
249
+ tag: string;
250
+ }): Promise<{
251
+ name: string;
252
+ commitId: string;
253
+ message: string | null;
254
+ } | null>;
255
+ createTag({ token, id, tag, ref, message }: {
256
+ token: string;
257
+ id: Id;
258
+ tag: string;
259
+ ref: string;
260
+ message?: string;
261
+ }): Promise<unknown>;
262
+ private toRelease;
263
+ createRelease({ token, id, tag, name, description, prerelease }: {
264
+ token: string;
265
+ id: Id;
266
+ tag: string;
267
+ name?: string;
268
+ description?: string;
269
+ prerelease?: boolean;
270
+ }): Promise<Release>;
271
+ getRelease({ token, id, tag }: {
272
+ token: string;
273
+ id: Id;
274
+ tag: string;
275
+ }): Promise<Release | null>;
276
+ listReleases({ token, id }: {
277
+ token: string;
278
+ id: Id;
279
+ }): Promise<Release[]>;
280
+ updateRelease({ token, id, tag, changes }: {
281
+ token: string;
282
+ id: Id;
283
+ tag: string;
284
+ changes: ReleaseChanges;
285
+ }): Promise<Release>;
286
+ private conflicts;
287
+ private toChangeRequest;
288
+ createChangeRequest({ token, id, title, sourceBranch, targetBranch }: {
289
+ token: string;
290
+ id: Id;
291
+ title: string;
292
+ sourceBranch: string;
293
+ targetBranch: string;
294
+ }): Promise<ChangeRequest>;
295
+ /** Closes a change request without merging it (it was not wanted). A merged or closed one stays as it is. */
296
+ closeChangeRequest({ token, id, number }: {
297
+ token: string;
298
+ id: Id;
299
+ number: number;
300
+ }): Promise<void>;
301
+ createOrRenameChangeRequest({ token, id, title, sourceBranch, targetBranch }: {
302
+ token: string;
303
+ id: Id;
304
+ title: string;
305
+ sourceBranch: string;
306
+ targetBranch?: string;
307
+ }): Promise<ChangeRequest>;
308
+ listChangeRequests({ token, id, state: wanted, targetBranch }: {
309
+ token: string;
310
+ id: Id;
311
+ state?: 'opened' | 'merged' | 'closed' | 'all';
312
+ targetBranch?: string;
313
+ }): Promise<ChangeRequest[]>;
314
+ /**
315
+ * Merges a change request. Answers whether it has conflicts (`true`: nothing was merged, it has to be resolved by hand). Anything
316
+ * else that goes wrong is an error, not a conflict: git too old, a repository that cannot be read.
317
+ */
318
+ mergeChangeRequest({ token, id, number, deleteSourceBranch }: {
319
+ token: string;
320
+ id: Id;
321
+ number: number;
322
+ deleteSourceBranch?: boolean;
323
+ }): Promise<boolean>;
324
+ capabilities(): Capabilities;
325
+ private toIssue;
326
+ private issueOf;
327
+ private cleanList;
328
+ listIssues({ token, id, filter }: {
329
+ token: string;
330
+ id: Id;
331
+ filter?: IssueFilter;
332
+ }): Promise<Page<Issue>>;
333
+ getIssue({ token, id, number }: {
334
+ token: string;
335
+ id: Id;
336
+ number: number;
337
+ }): Promise<Issue>;
338
+ createIssue({ token, id, title, description, labels, assignees, milestone }: {
339
+ token: string;
340
+ id: Id;
341
+ title: string;
342
+ description?: string;
343
+ labels?: string[];
344
+ assignees?: string[];
345
+ milestone?: string | null;
346
+ }): Promise<Issue>;
347
+ updateIssue({ token, id, number, changes }: {
348
+ token: string;
349
+ id: Id;
350
+ number: number;
351
+ changes: IssueChanges;
352
+ }): Promise<Issue>;
353
+ listTemplates({ token, id, kind }: {
354
+ token: string;
355
+ id: Id;
356
+ kind: TemplateKind;
357
+ }): Promise<Template[]>;
358
+ saveTemplate({ token, id, kind, name, content }: {
359
+ token: string;
360
+ id: Id;
361
+ kind: TemplateKind;
362
+ name: string;
363
+ content: string;
364
+ }): Promise<Template>;
365
+ deleteTemplate({ token, id, kind, name }: {
366
+ token: string;
367
+ id: Id;
368
+ kind: TemplateKind;
369
+ name: string;
370
+ }): Promise<void>;
371
+ private closeIssues;
372
+ closeIssuesOfPush({ repositoryId, before, after }: {
373
+ repositoryId: number;
374
+ before: string | null;
375
+ after: string;
376
+ }): Promise<number[]>;
377
+ defaultBranchHead(repositoryId: number): Promise<string | null>;
378
+ private toComment;
379
+ listIssueComments({ token, id, number }: {
380
+ token: string;
381
+ id: Id;
382
+ number: number;
383
+ }): Promise<Comment[]>;
384
+ addIssueComment({ token, id, number, body }: {
385
+ token: string;
386
+ id: Id;
387
+ number: number;
388
+ body: string;
389
+ }): Promise<Comment>;
390
+ listLabels({ token, id }: {
391
+ token: string;
392
+ id: Id;
393
+ }): Promise<Label[]>;
394
+ listMilestones({ token, id }: {
395
+ token: string;
396
+ id: Id;
397
+ }): Promise<Milestone[]>;
398
+ private toMergeRequest;
399
+ private requestOf;
400
+ listMergeRequests({ token, id, filter }: {
401
+ token: string;
402
+ id: Id;
403
+ filter?: MergeRequestFilter;
404
+ }): Promise<Page<MergeRequest>>;
405
+ getMergeRequest({ token, id, number }: {
406
+ token: string;
407
+ id: Id;
408
+ number: number;
409
+ }): Promise<MergeRequest>;
410
+ createMergeRequest({ token, id, title, description, sourceBranch, targetBranch, labels, reviewers }: {
411
+ token: string;
412
+ id: Id;
413
+ title: string;
414
+ description?: string;
415
+ sourceBranch: string;
416
+ targetBranch: string;
417
+ labels?: string[];
418
+ reviewers?: string[];
419
+ }): Promise<MergeRequest>;
420
+ updateMergeRequest({ token, id, number, changes }: {
421
+ token: string;
422
+ id: Id;
423
+ number: number;
424
+ changes: MergeRequestChanges;
425
+ }): Promise<MergeRequest>;
426
+ getMergeRequestDiff({ token, id, number }: {
427
+ token: string;
428
+ id: Id;
429
+ number: number;
430
+ }): Promise<FileDiff[]>;
431
+ private toThread;
432
+ listMergeRequestThreads({ token, id, number }: {
433
+ token: string;
434
+ id: Id;
435
+ number: number;
436
+ }): Promise<Thread[]>;
437
+ addMergeRequestComment({ token, id, number, body, position, threadId }: {
438
+ token: string;
439
+ id: Id;
440
+ number: number;
441
+ body: string;
442
+ position?: DiffPosition;
443
+ threadId?: Id;
444
+ }): Promise<Thread>;
445
+ setThreadResolved({ token, id, number, threadId, resolved }: {
446
+ token: string;
447
+ id: Id;
448
+ number: number;
449
+ threadId: Id;
450
+ resolved: boolean;
451
+ }): Promise<Thread>;
452
+ mergeMergeRequest({ token, id, number, options }: {
453
+ token: string;
454
+ id: Id;
455
+ number: number;
456
+ options?: MergeOptions;
457
+ }): Promise<boolean>;
458
+ approveMergeRequest(_args: {
459
+ token: string;
460
+ id: Id;
461
+ number: number;
462
+ }): Promise<void>;
463
+ listChangeRequestPipelines(_args: {
464
+ token: string;
465
+ id: Id;
466
+ number: number;
467
+ }): Promise<Pipeline[]>;
468
+ getCiRunners(_args: {
469
+ token: string;
470
+ id: Id;
471
+ }): Promise<CiRunners>;
472
+ setInstanceRunners(_args: {
473
+ token: string;
474
+ id: Id;
475
+ enabled: boolean;
476
+ }): Promise<void>;
477
+ getLatestPipeline(_args: {
478
+ token: string;
479
+ id: Id;
480
+ ref: string;
481
+ }): Promise<Pipeline | null>;
482
+ listPipelines(_args: {
483
+ token: string;
484
+ id: Id;
485
+ ref?: string;
486
+ perPage?: number;
487
+ }): Promise<Pipeline[]>;
488
+ getPipelineJobs(_args: {
489
+ token: string;
490
+ id: Id;
491
+ pipelineId: Id;
492
+ }): Promise<PipelineJob[]>;
493
+ retryPipeline(_args: {
494
+ token: string;
495
+ id: Id;
496
+ pipelineId: Id;
497
+ }): Promise<void>;
498
+ enablePipelines(_args: {
499
+ token: string;
500
+ id: Id;
501
+ }): Promise<boolean>;
502
+ disablePipelines(_args: {
503
+ token: string;
504
+ id: Id;
505
+ }): Promise<boolean>;
506
+ pipelinesEnabled(_args: {
507
+ token: string;
508
+ id: Id;
509
+ }): Promise<boolean | null>;
510
+ cancelPipeline(_args: {
511
+ token: string;
512
+ id: Id;
513
+ pipelineId: Id;
514
+ }): Promise<void>;
515
+ cancelJob(_args: {
516
+ token: string;
517
+ id: Id;
518
+ jobId: Id;
519
+ }): Promise<void>;
520
+ getJobTrace(_args: {
521
+ token: string;
522
+ id: Id;
523
+ jobId: Id;
524
+ lines?: number;
525
+ }): Promise<string>;
526
+ ensureWebhook({ token, id, url, secret, branch }: {
527
+ token: string;
528
+ id: Id;
529
+ url: string;
530
+ secret: string;
531
+ branch?: string;
532
+ }): Promise<{
533
+ status: 'created' | 'already_exists';
534
+ hookId?: Id | null;
535
+ }>;
536
+ verifyWebhook({ headers, rawBody, secret }: Required<Delivery>): boolean;
537
+ parsePushEvent({ body }: {
538
+ headers: Record<string, string | undefined>;
539
+ body: any;
540
+ }): {
541
+ repositoryId: Id;
542
+ branch: string;
543
+ } | null;
544
+ /** Gives a person a level (reporter 20 .. maintainer 40) in a repository, or changes it. Only its owner (or an administrator) may; the owner's own level is not changed. */
545
+ setMember({ token, id, username, accessLevel }: {
546
+ token: string;
547
+ id: Id;
548
+ username: string;
549
+ accessLevel: number;
550
+ }): Promise<void>;
551
+ /** Takes a person's level away: they go back to what everybody has here (or nothing, in a group only its owner writes in). */
552
+ removeMember({ token, id, username }: {
553
+ token: string;
554
+ id: Id;
555
+ username: string;
556
+ }): Promise<void>;
557
+ /**
558
+ * Hands everything one person owns to another name (a person who leaves, a rename): the groups and repositories they made, and the
559
+ * places they were a member of. Names that nobody can sign in with (`deleted:ana`) leave them to the administrators.
560
+ */
561
+ transferOwnership({ from, to }: {
562
+ from: string;
563
+ to: string;
564
+ }): Promise<{
565
+ namespaces: number;
566
+ repositories: number;
567
+ }>;
568
+ rollback(): Promise<void>;
569
+ isAuthError(error: unknown): boolean;
570
+ isAlreadyExistsError(error: unknown): boolean;
571
+ }