@backstage/integration 0.6.6 → 0.6.10
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/CHANGELOG.md +27 -0
- package/dist/index.cjs.js +13 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +218 -57
- package/dist/index.esm.js +13 -12
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { RestEndpointMethodTypes } from '@octokit/rest';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Encapsulates a single SCM integration.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
6
8
|
*/
|
|
7
9
|
interface ScmIntegration {
|
|
8
10
|
/**
|
|
@@ -25,14 +27,19 @@ interface ScmIntegration {
|
|
|
25
27
|
* within the file tree of a certain repo, an absolute path of `/b.yaml` does
|
|
26
28
|
* not resolve to `https://hostname/b.yaml` but rather to
|
|
27
29
|
* `<repo root url>/b.yaml` inside the file tree of that same repo.
|
|
28
|
-
*
|
|
29
|
-
* @param options.url The (absolute or relative) URL or path to resolve
|
|
30
|
-
* @param options.base The base URL onto which this resolution happens
|
|
31
|
-
* @param options.lineNumber The line number in the target file to link to, starting with 1. Only applicable when linking to files.
|
|
32
30
|
*/
|
|
33
31
|
resolveUrl(options: {
|
|
32
|
+
/**
|
|
33
|
+
* The (absolute or relative) URL or path to resolve
|
|
34
|
+
*/
|
|
34
35
|
url: string;
|
|
36
|
+
/**
|
|
37
|
+
* The base URL onto which this resolution happens
|
|
38
|
+
*/
|
|
35
39
|
base: string;
|
|
40
|
+
/**
|
|
41
|
+
* The line number in the target file to link to, starting with 1. Only applicable when linking to files.
|
|
42
|
+
*/
|
|
36
43
|
lineNumber?: number;
|
|
37
44
|
}): string;
|
|
38
45
|
/**
|
|
@@ -44,12 +51,14 @@ interface ScmIntegration {
|
|
|
44
51
|
* If this is not possible, the integration can fall back to a URL to view
|
|
45
52
|
* the file in the web interface.
|
|
46
53
|
*
|
|
47
|
-
* @param url The absolute URL to the file that should be edited.
|
|
54
|
+
* @param url - The absolute URL to the file that should be edited.
|
|
48
55
|
*/
|
|
49
56
|
resolveEditUrl(url: string): string;
|
|
50
57
|
}
|
|
51
58
|
/**
|
|
52
59
|
* Encapsulates several integrations, that are all of the same type.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
53
62
|
*/
|
|
54
63
|
interface ScmIntegrationsGroup<T extends ScmIntegration> {
|
|
55
64
|
/**
|
|
@@ -59,22 +68,29 @@ interface ScmIntegrationsGroup<T extends ScmIntegration> {
|
|
|
59
68
|
/**
|
|
60
69
|
* Fetches an integration of this type by URL.
|
|
61
70
|
*
|
|
62
|
-
* @param url A URL that matches a registered integration of this type
|
|
71
|
+
* @param url - A URL that matches a registered integration of this type
|
|
63
72
|
*/
|
|
64
73
|
byUrl(url: string | URL): T | undefined;
|
|
65
74
|
/**
|
|
66
75
|
* Fetches an integration of this type by host name.
|
|
67
76
|
*
|
|
68
|
-
* @param
|
|
77
|
+
* @param host - A host name that matches a registered integration of this type
|
|
69
78
|
*/
|
|
70
79
|
byHost(host: string): T | undefined;
|
|
71
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* A factory function that creates an integration group based on configuration.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
72
86
|
declare type ScmIntegrationsFactory<T extends ScmIntegration> = (options: {
|
|
73
87
|
config: Config;
|
|
74
88
|
}) => ScmIntegrationsGroup<T>;
|
|
75
89
|
|
|
76
90
|
/**
|
|
77
91
|
* The configuration parameters for a single Azure provider.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
78
94
|
*/
|
|
79
95
|
declare type AzureIntegrationConfig = {
|
|
80
96
|
/**
|
|
@@ -93,17 +109,24 @@ declare type AzureIntegrationConfig = {
|
|
|
93
109
|
/**
|
|
94
110
|
* Reads a single Azure integration config.
|
|
95
111
|
*
|
|
96
|
-
* @param config The config object of a single integration
|
|
112
|
+
* @param config - The config object of a single integration
|
|
113
|
+
* @public
|
|
97
114
|
*/
|
|
98
115
|
declare function readAzureIntegrationConfig(config: Config): AzureIntegrationConfig;
|
|
99
116
|
/**
|
|
100
117
|
* Reads a set of Azure integration configs, and inserts some defaults for
|
|
101
118
|
* public Azure if not specified.
|
|
102
119
|
*
|
|
103
|
-
* @param configs All of the integration config objects
|
|
120
|
+
* @param configs - All of the integration config objects
|
|
121
|
+
* @public
|
|
104
122
|
*/
|
|
105
123
|
declare function readAzureIntegrationConfigs(configs: Config[]): AzureIntegrationConfig[];
|
|
106
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Microsoft Azure based integration.
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
107
130
|
declare class AzureIntegration implements ScmIntegration {
|
|
108
131
|
private readonly integrationConfig;
|
|
109
132
|
static factory: ScmIntegrationsFactory<AzureIntegration>;
|
|
@@ -123,35 +146,45 @@ declare class AzureIntegration implements ScmIntegration {
|
|
|
123
146
|
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
124
147
|
* for fetching the contents of the data.
|
|
125
148
|
*
|
|
149
|
+
* @remarks
|
|
150
|
+
*
|
|
126
151
|
* Converts
|
|
127
|
-
* from: https://dev.azure.com/{organization}/{project}/_git/reponame?path={path}&version=GB{commitOrBranch}&_a=contents
|
|
128
|
-
* to: https://dev.azure.com/{organization}/{project}/_apis/git/repositories/reponame/items?path={path}&version={commitOrBranch}
|
|
152
|
+
* - from: `https://dev.azure.com/{organization}/{project}/_git/reponame?path={path}&version=GB{commitOrBranch}&_a=contents`
|
|
153
|
+
* - to: `https://dev.azure.com/{organization}/{project}/_apis/git/repositories/reponame/items?path={path}&version={commitOrBranch}`
|
|
129
154
|
*
|
|
130
|
-
* @param url A URL pointing to a file
|
|
155
|
+
* @param url - A URL pointing to a file
|
|
156
|
+
* @public
|
|
131
157
|
*/
|
|
132
158
|
declare function getAzureFileFetchUrl(url: string): string;
|
|
133
159
|
/**
|
|
134
160
|
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
135
161
|
* for downloading the subtree.
|
|
136
162
|
*
|
|
137
|
-
* @param url A URL pointing to a path
|
|
163
|
+
* @param url - A URL pointing to a path
|
|
164
|
+
* @public
|
|
138
165
|
*/
|
|
139
166
|
declare function getAzureDownloadUrl(url: string): string;
|
|
140
167
|
/**
|
|
141
168
|
* Given a URL, return the API URL to fetch commits on the branch.
|
|
142
169
|
*
|
|
143
|
-
* @param url A URL pointing to a repository or a sub-path
|
|
170
|
+
* @param url - A URL pointing to a repository or a sub-path
|
|
171
|
+
* @public
|
|
144
172
|
*/
|
|
145
173
|
declare function getAzureCommitsUrl(url: string): string;
|
|
146
174
|
/**
|
|
147
175
|
* Gets the request options necessary to make requests to a given provider.
|
|
148
176
|
*
|
|
149
|
-
* @param config The relevant provider config
|
|
177
|
+
* @param config - The relevant provider config
|
|
178
|
+
* @public
|
|
150
179
|
*/
|
|
151
|
-
declare function getAzureRequestOptions(config: AzureIntegrationConfig, additionalHeaders?: Record<string, string>):
|
|
180
|
+
declare function getAzureRequestOptions(config: AzureIntegrationConfig, additionalHeaders?: Record<string, string>): {
|
|
181
|
+
headers: Record<string, string>;
|
|
182
|
+
};
|
|
152
183
|
|
|
153
184
|
/**
|
|
154
185
|
* The configuration parameters for a single Bitbucket API provider.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
155
188
|
*/
|
|
156
189
|
declare type BitbucketIntegrationConfig = {
|
|
157
190
|
/**
|
|
@@ -190,17 +223,24 @@ declare type BitbucketIntegrationConfig = {
|
|
|
190
223
|
/**
|
|
191
224
|
* Reads a single Bitbucket integration config.
|
|
192
225
|
*
|
|
193
|
-
* @param config The config object of a single integration
|
|
226
|
+
* @param config - The config object of a single integration
|
|
227
|
+
* @public
|
|
194
228
|
*/
|
|
195
229
|
declare function readBitbucketIntegrationConfig(config: Config): BitbucketIntegrationConfig;
|
|
196
230
|
/**
|
|
197
231
|
* Reads a set of Bitbucket integration configs, and inserts some defaults for
|
|
198
232
|
* public Bitbucket if not specified.
|
|
199
233
|
*
|
|
200
|
-
* @param configs All of the integration config objects
|
|
234
|
+
* @param configs - All of the integration config objects
|
|
235
|
+
* @public
|
|
201
236
|
*/
|
|
202
237
|
declare function readBitbucketIntegrationConfigs(configs: Config[]): BitbucketIntegrationConfig[];
|
|
203
238
|
|
|
239
|
+
/**
|
|
240
|
+
* A Bitbucket based integration.
|
|
241
|
+
*
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
204
244
|
declare class BitbucketIntegration implements ScmIntegration {
|
|
205
245
|
private readonly integrationConfig;
|
|
206
246
|
static factory: ScmIntegrationsFactory<BitbucketIntegration>;
|
|
@@ -219,39 +259,49 @@ declare class BitbucketIntegration implements ScmIntegration {
|
|
|
219
259
|
/**
|
|
220
260
|
* Given a URL pointing to a path on a provider, returns the default branch.
|
|
221
261
|
*
|
|
222
|
-
* @param url A URL pointing to a path
|
|
223
|
-
* @param config The relevant provider config
|
|
262
|
+
* @param url - A URL pointing to a path
|
|
263
|
+
* @param config - The relevant provider config
|
|
264
|
+
* @public
|
|
224
265
|
*/
|
|
225
266
|
declare function getBitbucketDefaultBranch(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
226
267
|
/**
|
|
227
268
|
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
228
269
|
* for downloading the subtree.
|
|
229
270
|
*
|
|
230
|
-
* @param url A URL pointing to a path
|
|
231
|
-
* @param config The relevant provider config
|
|
271
|
+
* @param url - A URL pointing to a path
|
|
272
|
+
* @param config - The relevant provider config
|
|
273
|
+
* @public
|
|
232
274
|
*/
|
|
233
275
|
declare function getBitbucketDownloadUrl(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
234
276
|
/**
|
|
235
277
|
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
236
278
|
* for fetching the contents of the data.
|
|
237
279
|
*
|
|
280
|
+
* @remarks
|
|
281
|
+
*
|
|
238
282
|
* Converts
|
|
239
283
|
* from: https://bitbucket.org/orgname/reponame/src/master/file.yaml
|
|
240
284
|
* to: https://api.bitbucket.org/2.0/repositories/orgname/reponame/src/master/file.yaml
|
|
241
285
|
*
|
|
242
|
-
* @param url A URL pointing to a file
|
|
243
|
-
* @param config The relevant provider config
|
|
286
|
+
* @param url - A URL pointing to a file
|
|
287
|
+
* @param config - The relevant provider config
|
|
288
|
+
* @public
|
|
244
289
|
*/
|
|
245
290
|
declare function getBitbucketFileFetchUrl(url: string, config: BitbucketIntegrationConfig): string;
|
|
246
291
|
/**
|
|
247
292
|
* Gets the request options necessary to make requests to a given provider.
|
|
248
293
|
*
|
|
249
|
-
* @param config The relevant provider config
|
|
294
|
+
* @param config - The relevant provider config
|
|
295
|
+
* @public
|
|
250
296
|
*/
|
|
251
|
-
declare function getBitbucketRequestOptions(config: BitbucketIntegrationConfig):
|
|
297
|
+
declare function getBitbucketRequestOptions(config: BitbucketIntegrationConfig): {
|
|
298
|
+
headers: Record<string, string>;
|
|
299
|
+
};
|
|
252
300
|
|
|
253
301
|
/**
|
|
254
302
|
* The configuration parameters for a single GitHub integration.
|
|
303
|
+
*
|
|
304
|
+
* @public
|
|
255
305
|
*/
|
|
256
306
|
declare type GitHubIntegrationConfig = {
|
|
257
307
|
/**
|
|
@@ -293,7 +343,12 @@ declare type GitHubIntegrationConfig = {
|
|
|
293
343
|
};
|
|
294
344
|
/**
|
|
295
345
|
* The configuration parameters for authenticating a GitHub Application.
|
|
296
|
-
*
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
*
|
|
349
|
+
* A GitHub Apps configuration can be generated using the `backstage-cli create-github-app` command.
|
|
350
|
+
*
|
|
351
|
+
* @public
|
|
297
352
|
*/
|
|
298
353
|
declare type GithubAppConfig = {
|
|
299
354
|
/**
|
|
@@ -329,24 +384,41 @@ declare type GithubAppConfig = {
|
|
|
329
384
|
/**
|
|
330
385
|
* Reads a single GitHub integration config.
|
|
331
386
|
*
|
|
332
|
-
* @param config The config object of a single integration
|
|
387
|
+
* @param config - The config object of a single integration
|
|
388
|
+
* @public
|
|
333
389
|
*/
|
|
334
390
|
declare function readGitHubIntegrationConfig(config: Config): GitHubIntegrationConfig;
|
|
335
391
|
/**
|
|
336
392
|
* Reads a set of GitHub integration configs, and inserts some defaults for
|
|
337
393
|
* public GitHub if not specified.
|
|
338
394
|
*
|
|
339
|
-
* @param configs All of the integration config objects
|
|
395
|
+
* @param configs - All of the integration config objects
|
|
396
|
+
* @public
|
|
340
397
|
*/
|
|
341
398
|
declare function readGitHubIntegrationConfigs(configs: Config[]): GitHubIntegrationConfig[];
|
|
342
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Corresponds to a Github installation which internally could hold several GitHub Apps.
|
|
402
|
+
*
|
|
403
|
+
* @public
|
|
404
|
+
*/
|
|
343
405
|
declare class GithubAppCredentialsMux {
|
|
344
406
|
private readonly apps;
|
|
345
407
|
constructor(config: GitHubIntegrationConfig);
|
|
346
408
|
getAllInstallations(): Promise<RestEndpointMethodTypes['apps']['listInstallations']['response']['data']>;
|
|
347
409
|
getAppToken(owner: string, repo?: string): Promise<string | undefined>;
|
|
348
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* The type of credentials produced by the credential provider.
|
|
413
|
+
*
|
|
414
|
+
* @public
|
|
415
|
+
*/
|
|
349
416
|
declare type GithubCredentialType = 'app' | 'token';
|
|
417
|
+
/**
|
|
418
|
+
* A set of credentials information for a GitHub integration.
|
|
419
|
+
*
|
|
420
|
+
* @public
|
|
421
|
+
*/
|
|
350
422
|
declare type GithubCredentials = {
|
|
351
423
|
headers?: {
|
|
352
424
|
[name: string]: string;
|
|
@@ -354,19 +426,38 @@ declare type GithubCredentials = {
|
|
|
354
426
|
token?: string;
|
|
355
427
|
type: GithubCredentialType;
|
|
356
428
|
};
|
|
429
|
+
/**
|
|
430
|
+
* Handles the creation and caching of credentials for GitHub integrations.
|
|
431
|
+
*
|
|
432
|
+
* @public
|
|
433
|
+
* @remarks
|
|
434
|
+
*
|
|
435
|
+
* TODO: Possibly move this to a backend only package so that it's not used in the frontend by mistake
|
|
436
|
+
*/
|
|
357
437
|
declare class GithubCredentialsProvider {
|
|
358
438
|
private readonly githubAppCredentialsMux;
|
|
359
439
|
private readonly token?;
|
|
360
440
|
static create(config: GitHubIntegrationConfig): GithubCredentialsProvider;
|
|
361
441
|
private constructor();
|
|
362
442
|
/**
|
|
363
|
-
* Returns GithubCredentials for
|
|
364
|
-
*
|
|
443
|
+
* Returns {@link GithubCredentials} for a given URL.
|
|
444
|
+
*
|
|
445
|
+
* @remarks
|
|
446
|
+
*
|
|
447
|
+
* Consecutive calls to this method with the same URL will return cached
|
|
448
|
+
* credentials.
|
|
449
|
+
*
|
|
365
450
|
* The shortest lifetime for a token returned is 10 minutes.
|
|
366
|
-
*
|
|
367
|
-
* @returns {Promise} of @type {GithubCredentials}.
|
|
451
|
+
*
|
|
368
452
|
* @example
|
|
369
|
-
*
|
|
453
|
+
* ```ts
|
|
454
|
+
* const { token, headers } = await getCredentials({
|
|
455
|
+
* url: 'github.com/backstage/foobar'
|
|
456
|
+
* })
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* @param opts - The organization or repository URL
|
|
460
|
+
* @returns A promise of {@link GithubCredentials}.
|
|
370
461
|
*/
|
|
371
462
|
getCredentials(opts: {
|
|
372
463
|
url: string;
|
|
@@ -377,23 +468,34 @@ declare class GithubCredentialsProvider {
|
|
|
377
468
|
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
378
469
|
* for fetching the contents of the data.
|
|
379
470
|
*
|
|
471
|
+
* @remarks
|
|
472
|
+
*
|
|
380
473
|
* Converts
|
|
381
474
|
* from: https://github.com/a/b/blob/branchname/path/to/c.yaml
|
|
382
475
|
* to: https://api.github.com/repos/a/b/contents/path/to/c.yaml?ref=branchname
|
|
383
476
|
* or: https://raw.githubusercontent.com/a/b/branchname/c.yaml
|
|
384
477
|
*
|
|
385
|
-
* @param url A URL pointing to a file
|
|
386
|
-
* @param config The relevant provider config
|
|
478
|
+
* @param url - A URL pointing to a file
|
|
479
|
+
* @param config - The relevant provider config
|
|
480
|
+
* @public
|
|
387
481
|
*/
|
|
388
482
|
declare function getGitHubFileFetchUrl(url: string, config: GitHubIntegrationConfig, credentials: GithubCredentials): string;
|
|
389
483
|
/**
|
|
390
484
|
* Gets the request options necessary to make requests to a given provider.
|
|
391
485
|
*
|
|
392
486
|
* @deprecated This function is no longer used internally
|
|
393
|
-
* @param config The relevant provider config
|
|
487
|
+
* @param config - The relevant provider config
|
|
488
|
+
* @public
|
|
394
489
|
*/
|
|
395
|
-
declare function getGitHubRequestOptions(config: GitHubIntegrationConfig, credentials: GithubCredentials):
|
|
490
|
+
declare function getGitHubRequestOptions(config: GitHubIntegrationConfig, credentials: GithubCredentials): {
|
|
491
|
+
headers: Record<string, string>;
|
|
492
|
+
};
|
|
396
493
|
|
|
494
|
+
/**
|
|
495
|
+
* A GitHub based integration.
|
|
496
|
+
*
|
|
497
|
+
* @public
|
|
498
|
+
*/
|
|
397
499
|
declare class GitHubIntegration implements ScmIntegration {
|
|
398
500
|
private readonly integrationConfig;
|
|
399
501
|
static factory: ScmIntegrationsFactory<GitHubIntegration>;
|
|
@@ -408,10 +510,19 @@ declare class GitHubIntegration implements ScmIntegration {
|
|
|
408
510
|
}): string;
|
|
409
511
|
resolveEditUrl(url: string): string;
|
|
410
512
|
}
|
|
411
|
-
|
|
513
|
+
/**
|
|
514
|
+
* Takes a GitHub URL and replaces the type part (blob, tree etc).
|
|
515
|
+
*
|
|
516
|
+
* @param url - The original URL
|
|
517
|
+
* @param type - The desired type, e.g. "blob"
|
|
518
|
+
* @public
|
|
519
|
+
*/
|
|
520
|
+
declare function replaceGitHubUrlType(url: string, type: 'blob' | 'tree' | 'edit'): string;
|
|
412
521
|
|
|
413
522
|
/**
|
|
414
523
|
* The configuration parameters for a single GitLab integration.
|
|
524
|
+
*
|
|
525
|
+
* @public
|
|
415
526
|
*/
|
|
416
527
|
declare type GitLabIntegrationConfig = {
|
|
417
528
|
/**
|
|
@@ -442,14 +553,16 @@ declare type GitLabIntegrationConfig = {
|
|
|
442
553
|
/**
|
|
443
554
|
* Reads a single GitLab integration config.
|
|
444
555
|
*
|
|
445
|
-
* @param config The config object of a single integration
|
|
556
|
+
* @param config - The config object of a single integration
|
|
557
|
+
* @public
|
|
446
558
|
*/
|
|
447
559
|
declare function readGitLabIntegrationConfig(config: Config): GitLabIntegrationConfig;
|
|
448
560
|
/**
|
|
449
561
|
* Reads a set of GitLab integration configs, and inserts some defaults for
|
|
450
562
|
* public GitLab if not specified.
|
|
451
563
|
*
|
|
452
|
-
* @param configs All of the integration config objects
|
|
564
|
+
* @param configs - All of the integration config objects
|
|
565
|
+
* @public
|
|
453
566
|
*/
|
|
454
567
|
declare function readGitLabIntegrationConfigs(configs: Config[]): GitLabIntegrationConfig[];
|
|
455
568
|
|
|
@@ -457,6 +570,8 @@ declare function readGitLabIntegrationConfigs(configs: Config[]): GitLabIntegrat
|
|
|
457
570
|
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
458
571
|
* for fetching the contents of the data.
|
|
459
572
|
*
|
|
573
|
+
* @remarks
|
|
574
|
+
*
|
|
460
575
|
* Converts
|
|
461
576
|
* from: https://gitlab.example.com/a/b/blob/master/c.yaml
|
|
462
577
|
* to: https://gitlab.example.com/a/b/raw/master/c.yaml
|
|
@@ -464,17 +579,26 @@ declare function readGitLabIntegrationConfigs(configs: Config[]): GitLabIntegrat
|
|
|
464
579
|
* from: https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/filepath
|
|
465
580
|
* to: https://gitlab.com/api/v4/projects/projectId/repository/files/filepath?ref=branch
|
|
466
581
|
*
|
|
467
|
-
* @param url A URL pointing to a file
|
|
468
|
-
* @param config The relevant provider config
|
|
582
|
+
* @param url - A URL pointing to a file
|
|
583
|
+
* @param config - The relevant provider config
|
|
584
|
+
* @public
|
|
469
585
|
*/
|
|
470
586
|
declare function getGitLabFileFetchUrl(url: string, config: GitLabIntegrationConfig): Promise<string>;
|
|
471
587
|
/**
|
|
472
588
|
* Gets the request options necessary to make requests to a given provider.
|
|
473
589
|
*
|
|
474
|
-
* @param config The relevant provider config
|
|
590
|
+
* @param config - The relevant provider config
|
|
591
|
+
* @public
|
|
475
592
|
*/
|
|
476
|
-
declare function getGitLabRequestOptions(config: GitLabIntegrationConfig):
|
|
593
|
+
declare function getGitLabRequestOptions(config: GitLabIntegrationConfig): {
|
|
594
|
+
headers: Record<string, string>;
|
|
595
|
+
};
|
|
477
596
|
|
|
597
|
+
/**
|
|
598
|
+
* A GitLab based integration.
|
|
599
|
+
*
|
|
600
|
+
* @public
|
|
601
|
+
*/
|
|
478
602
|
declare class GitLabIntegration implements ScmIntegration {
|
|
479
603
|
private readonly integrationConfig;
|
|
480
604
|
static factory: ScmIntegrationsFactory<GitLabIntegration>;
|
|
@@ -492,6 +616,8 @@ declare class GitLabIntegration implements ScmIntegration {
|
|
|
492
616
|
|
|
493
617
|
/**
|
|
494
618
|
* The configuration parameters for a single Google Cloud Storage provider.
|
|
619
|
+
*
|
|
620
|
+
* @public
|
|
495
621
|
*/
|
|
496
622
|
declare type GoogleGcsIntegrationConfig = {
|
|
497
623
|
/**
|
|
@@ -506,12 +632,15 @@ declare type GoogleGcsIntegrationConfig = {
|
|
|
506
632
|
/**
|
|
507
633
|
* Reads a single Google GCS integration config.
|
|
508
634
|
*
|
|
509
|
-
* @param config The config object of a single integration
|
|
635
|
+
* @param config - The config object of a single integration
|
|
636
|
+
* @public
|
|
510
637
|
*/
|
|
511
638
|
declare function readGoogleGcsIntegrationConfig(config: Config): GoogleGcsIntegrationConfig;
|
|
512
639
|
|
|
513
640
|
/**
|
|
514
641
|
* The configuration parameters for a single AWS S3 provider.
|
|
642
|
+
*
|
|
643
|
+
* @public
|
|
515
644
|
*/
|
|
516
645
|
declare type AwsS3IntegrationConfig = {
|
|
517
646
|
/**
|
|
@@ -536,11 +665,24 @@ declare type AwsS3IntegrationConfig = {
|
|
|
536
665
|
/**
|
|
537
666
|
* Reads a single Aws S3 integration config.
|
|
538
667
|
*
|
|
539
|
-
* @param config The config object of a single integration
|
|
668
|
+
* @param config - The config object of a single integration
|
|
669
|
+
* @public
|
|
540
670
|
*/
|
|
541
671
|
declare function readAwsS3IntegrationConfig(config: Config): AwsS3IntegrationConfig;
|
|
672
|
+
/**
|
|
673
|
+
* Reads a set of AWS S3 integration configs, and inserts some defaults for
|
|
674
|
+
* public Amazon AWS if not specified.
|
|
675
|
+
*
|
|
676
|
+
* @param configs - The config objects of the integrations
|
|
677
|
+
* @public
|
|
678
|
+
*/
|
|
542
679
|
declare function readAwsS3IntegrationConfigs(configs: Config[]): AwsS3IntegrationConfig[];
|
|
543
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Integrates with AWS S3 or compatible solutions.
|
|
683
|
+
*
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
544
686
|
declare class AwsS3Integration implements ScmIntegration {
|
|
545
687
|
private readonly integrationConfig;
|
|
546
688
|
static factory: ScmIntegrationsFactory<AwsS3Integration>;
|
|
@@ -557,8 +699,10 @@ declare class AwsS3Integration implements ScmIntegration {
|
|
|
557
699
|
}
|
|
558
700
|
|
|
559
701
|
/**
|
|
560
|
-
* Default implementation of ScmIntegration
|
|
561
|
-
* URL pathname based providers.
|
|
702
|
+
* Default implementation of {@link ScmIntegration} `resolveUrl`, that only
|
|
703
|
+
* works with URL pathname based providers.
|
|
704
|
+
*
|
|
705
|
+
* @public
|
|
562
706
|
*/
|
|
563
707
|
declare function defaultScmResolveUrl(options: {
|
|
564
708
|
url: string;
|
|
@@ -568,6 +712,8 @@ declare function defaultScmResolveUrl(options: {
|
|
|
568
712
|
|
|
569
713
|
/**
|
|
570
714
|
* Holds all registered SCM integrations, of all types.
|
|
715
|
+
*
|
|
716
|
+
* @public
|
|
571
717
|
*/
|
|
572
718
|
interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
573
719
|
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
@@ -586,14 +732,19 @@ interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
|
586
732
|
* within the file tree of a certain repo, an absolute path of `/b.yaml` does
|
|
587
733
|
* not resolve to `https://hostname/b.yaml` but rather to
|
|
588
734
|
* `<repo root url>/b.yaml` inside the file tree of that same repo.
|
|
589
|
-
*
|
|
590
|
-
* @param options.url The (absolute or relative) URL or path to resolve
|
|
591
|
-
* @param options.base The base URL onto which this resolution happens
|
|
592
|
-
* @param options.lineNumber The line number in the target file to link to, starting with 1. Only applicable when linking to files.
|
|
593
735
|
*/
|
|
594
736
|
resolveUrl(options: {
|
|
737
|
+
/**
|
|
738
|
+
* The (absolute or relative) URL or path to resolve.
|
|
739
|
+
*/
|
|
595
740
|
url: string;
|
|
741
|
+
/**
|
|
742
|
+
* The base URL onto which this resolution happens
|
|
743
|
+
*/
|
|
596
744
|
base: string;
|
|
745
|
+
/**
|
|
746
|
+
* The line number in the target file to link to, starting with 1. Only applicable when linking to files.
|
|
747
|
+
*/
|
|
597
748
|
lineNumber?: number;
|
|
598
749
|
}): string;
|
|
599
750
|
/**
|
|
@@ -605,18 +756,28 @@ interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
|
605
756
|
* If this is not possible, the integration can fall back to a URL to view
|
|
606
757
|
* the file in the web interface.
|
|
607
758
|
*
|
|
608
|
-
* @param url The absolute URL to the file that should be edited.
|
|
759
|
+
* @param url - The absolute URL to the file that should be edited.
|
|
609
760
|
*/
|
|
610
761
|
resolveEditUrl(url: string): string;
|
|
611
762
|
}
|
|
612
763
|
|
|
613
|
-
|
|
764
|
+
/**
|
|
765
|
+
* The set of supported integrations.
|
|
766
|
+
*
|
|
767
|
+
* @public
|
|
768
|
+
*/
|
|
769
|
+
interface IntegrationsByType {
|
|
614
770
|
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
615
771
|
azure: ScmIntegrationsGroup<AzureIntegration>;
|
|
616
772
|
bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;
|
|
617
773
|
github: ScmIntegrationsGroup<GitHubIntegration>;
|
|
618
774
|
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
|
619
|
-
}
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Exposes the set of supported integrations.
|
|
778
|
+
*
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
620
781
|
declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
621
782
|
private readonly byType;
|
|
622
783
|
static fromConfig(config: Config): ScmIntegrations;
|
|
@@ -637,4 +798,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
637
798
|
resolveEditUrl(url: string): string;
|
|
638
799
|
}
|
|
639
800
|
|
|
640
|
-
export { AwsS3Integration, AwsS3IntegrationConfig, AzureIntegration, AzureIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentialsProvider, GoogleGcsIntegrationConfig, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsGroup, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGoogleGcsIntegrationConfig,
|
|
801
|
+
export { AwsS3Integration, AwsS3IntegrationConfig, AzureIntegration, AzureIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType };
|