@backstage/integration 1.6.0 → 1.7.0-next.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/CHANGELOG.md +31 -0
- package/config.d.ts +30 -0
- package/dist/index.cjs.js +306 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +525 -433
- package/dist/index.esm.js +307 -59
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -180,20 +180,51 @@ type AzureIntegrationConfig = {
|
|
|
180
180
|
* The authorization token to use for requests.
|
|
181
181
|
*
|
|
182
182
|
* If no token is specified, anonymous access is used.
|
|
183
|
+
*
|
|
184
|
+
* @deprecated Use `credentials` instead.
|
|
183
185
|
*/
|
|
184
186
|
token?: string;
|
|
185
187
|
/**
|
|
186
188
|
* The credential to use for requests.
|
|
187
189
|
*
|
|
188
190
|
* If no credential is specified anonymous access is used.
|
|
191
|
+
*
|
|
192
|
+
* @deprecated Use `credentials` instead.
|
|
193
|
+
*/
|
|
194
|
+
credential?: AzureDevOpsCredential;
|
|
195
|
+
/**
|
|
196
|
+
* The credentials to use for requests. If multiple credentials are specified the first one that matches the organization is used.
|
|
197
|
+
* If not organization matches the first credential without an organization is used.
|
|
198
|
+
*
|
|
199
|
+
* If no credentials are specified at all, either a default credential (for Azure DevOps) or anonymous access (for Azure DevOps Server) is used.
|
|
200
|
+
*/
|
|
201
|
+
credentials?: AzureDevOpsCredential[];
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* The kind of Azure DevOps credential.
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
type AzureDevOpsCredentialKind = 'PersonalAccessToken' | 'ClientSecret' | 'ManagedIdentity';
|
|
208
|
+
/**
|
|
209
|
+
* Common fields for the Azure DevOps credentials.
|
|
210
|
+
* @public
|
|
211
|
+
*/
|
|
212
|
+
type AzureCredentialBase = {
|
|
213
|
+
/**
|
|
214
|
+
* The kind of credential.
|
|
215
|
+
*/
|
|
216
|
+
kind: AzureDevOpsCredentialKind;
|
|
217
|
+
/**
|
|
218
|
+
* The Azure DevOps organizations for which to use this credential.
|
|
189
219
|
*/
|
|
190
|
-
|
|
220
|
+
organizations?: string[];
|
|
191
221
|
};
|
|
192
222
|
/**
|
|
193
|
-
*
|
|
223
|
+
* A client secret credential that was generated for an App Registration.
|
|
194
224
|
* @public
|
|
195
225
|
*/
|
|
196
|
-
type AzureClientSecretCredential = {
|
|
226
|
+
type AzureClientSecretCredential = AzureCredentialBase & {
|
|
227
|
+
kind: 'ClientSecret';
|
|
197
228
|
/**
|
|
198
229
|
* The Azure Active Directory tenant
|
|
199
230
|
*/
|
|
@@ -208,20 +239,34 @@ type AzureClientSecretCredential = {
|
|
|
208
239
|
clientSecret: string;
|
|
209
240
|
};
|
|
210
241
|
/**
|
|
211
|
-
*
|
|
242
|
+
* A managed identity credential.
|
|
212
243
|
* @public
|
|
213
244
|
*/
|
|
214
|
-
type AzureManagedIdentityCredential = {
|
|
245
|
+
type AzureManagedIdentityCredential = AzureCredentialBase & {
|
|
246
|
+
kind: 'ManagedIdentity';
|
|
215
247
|
/**
|
|
216
248
|
* The clientId
|
|
217
249
|
*/
|
|
218
250
|
clientId: string;
|
|
219
251
|
};
|
|
220
252
|
/**
|
|
221
|
-
*
|
|
253
|
+
* A personal access token credential.
|
|
222
254
|
* @public
|
|
223
255
|
*/
|
|
224
|
-
type
|
|
256
|
+
type PersonalAccessTokenCredential = AzureCredentialBase & {
|
|
257
|
+
kind: 'PersonalAccessToken';
|
|
258
|
+
personalAccessToken: string;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* The general shape of a credential that can be used to authenticate to Azure DevOps.
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
type AzureDevOpsCredentialLike = Omit<Partial<AzureClientSecretCredential> & Partial<AzureManagedIdentityCredential> & Partial<PersonalAccessTokenCredential>, 'kind'>;
|
|
265
|
+
/**
|
|
266
|
+
* Credential used to authenticate to Azure DevOps.
|
|
267
|
+
* @public
|
|
268
|
+
*/
|
|
269
|
+
type AzureDevOpsCredential = AzureClientSecretCredential | AzureManagedIdentityCredential | PersonalAccessTokenCredential;
|
|
225
270
|
/**
|
|
226
271
|
* Reads a single Azure integration config.
|
|
227
272
|
*
|
|
@@ -287,44 +332,50 @@ declare function getAzureDownloadUrl(url: string): string;
|
|
|
287
332
|
* @public
|
|
288
333
|
*/
|
|
289
334
|
declare function getAzureCommitsUrl(url: string): string;
|
|
335
|
+
|
|
290
336
|
/**
|
|
291
|
-
*
|
|
337
|
+
* The type of Azure DevOps credential, either bearer or pat.
|
|
338
|
+
* @public
|
|
339
|
+
*/
|
|
340
|
+
type AzureDevOpsCredentialType = 'bearer' | 'pat';
|
|
341
|
+
/**
|
|
342
|
+
* A set of credentials for Azure DevOps.
|
|
292
343
|
*
|
|
293
|
-
* @param config - The relevant provider config
|
|
294
|
-
* @param additionalHeaders - Additional headers for the request
|
|
295
344
|
* @public
|
|
296
345
|
*/
|
|
297
|
-
|
|
298
|
-
headers:
|
|
299
|
-
|
|
346
|
+
type AzureDevOpsCredentials = {
|
|
347
|
+
headers: {
|
|
348
|
+
[name: string]: string;
|
|
349
|
+
};
|
|
350
|
+
token: string;
|
|
351
|
+
type: AzureDevOpsCredentialType;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* This allows implementations to be provided to retrieve Azure DevOps credentials.
|
|
355
|
+
*
|
|
356
|
+
* @public
|
|
357
|
+
*
|
|
358
|
+
*/
|
|
359
|
+
interface AzureDevOpsCredentialsProvider {
|
|
360
|
+
getCredentials(opts: {
|
|
361
|
+
url: string;
|
|
362
|
+
}): Promise<AzureDevOpsCredentials | undefined>;
|
|
363
|
+
}
|
|
300
364
|
|
|
301
365
|
/**
|
|
302
|
-
* The configuration parameters for a single Bitbucket API provider.
|
|
366
|
+
* The configuration parameters for a single Bitbucket Cloud API provider.
|
|
303
367
|
*
|
|
304
368
|
* @public
|
|
305
|
-
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
306
369
|
*/
|
|
307
|
-
type
|
|
370
|
+
type BitbucketCloudIntegrationConfig = {
|
|
308
371
|
/**
|
|
309
|
-
*
|
|
372
|
+
* Constant. bitbucket.org
|
|
310
373
|
*/
|
|
311
374
|
host: string;
|
|
312
375
|
/**
|
|
313
|
-
*
|
|
314
|
-
* with no trailing slash.
|
|
315
|
-
*
|
|
316
|
-
* Values omitted at the optional property at the app-config will be deduced
|
|
317
|
-
* from the "host" value.
|
|
376
|
+
* Constant. https://api.bitbucket.org/2.0
|
|
318
377
|
*/
|
|
319
378
|
apiBaseUrl: string;
|
|
320
|
-
/**
|
|
321
|
-
* The authorization token to use for requests to a Bitbucket Server provider.
|
|
322
|
-
*
|
|
323
|
-
* See https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html
|
|
324
|
-
*
|
|
325
|
-
* If no token is specified, anonymous access is used.
|
|
326
|
-
*/
|
|
327
|
-
token?: string;
|
|
328
379
|
/**
|
|
329
380
|
* The username to use for requests to Bitbucket Cloud (bitbucket.org).
|
|
330
381
|
*/
|
|
@@ -337,36 +388,33 @@ type BitbucketIntegrationConfig = {
|
|
|
337
388
|
appPassword?: string;
|
|
338
389
|
};
|
|
339
390
|
/**
|
|
340
|
-
* Reads a single Bitbucket integration config.
|
|
391
|
+
* Reads a single Bitbucket Cloud integration config.
|
|
341
392
|
*
|
|
342
393
|
* @param config - The config object of a single integration
|
|
343
394
|
* @public
|
|
344
|
-
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
345
395
|
*/
|
|
346
|
-
declare function
|
|
396
|
+
declare function readBitbucketCloudIntegrationConfig(config: Config): BitbucketCloudIntegrationConfig;
|
|
347
397
|
/**
|
|
348
|
-
* Reads a set of Bitbucket integration configs,
|
|
349
|
-
* public Bitbucket if
|
|
398
|
+
* Reads a set of Bitbucket Cloud integration configs,
|
|
399
|
+
* and inserts one for public Bitbucket Cloud if none specified.
|
|
350
400
|
*
|
|
351
401
|
* @param configs - All of the integration config objects
|
|
352
402
|
* @public
|
|
353
|
-
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
354
403
|
*/
|
|
355
|
-
declare function
|
|
404
|
+
declare function readBitbucketCloudIntegrationConfigs(configs: Config[]): BitbucketCloudIntegrationConfig[];
|
|
356
405
|
|
|
357
406
|
/**
|
|
358
|
-
* A Bitbucket based integration.
|
|
407
|
+
* A Bitbucket Cloud based integration.
|
|
359
408
|
*
|
|
360
409
|
* @public
|
|
361
|
-
* @deprecated replaced by the integrations bitbucketCloud and bitbucketServer.
|
|
362
410
|
*/
|
|
363
|
-
declare class
|
|
411
|
+
declare class BitbucketCloudIntegration implements ScmIntegration {
|
|
364
412
|
private readonly integrationConfig;
|
|
365
|
-
static factory: ScmIntegrationsFactory<
|
|
366
|
-
constructor(integrationConfig:
|
|
413
|
+
static factory: ScmIntegrationsFactory<BitbucketCloudIntegration>;
|
|
414
|
+
constructor(integrationConfig: BitbucketCloudIntegrationConfig);
|
|
367
415
|
get type(): string;
|
|
368
416
|
get title(): string;
|
|
369
|
-
get config():
|
|
417
|
+
get config(): BitbucketCloudIntegrationConfig;
|
|
370
418
|
resolveUrl(options: {
|
|
371
419
|
url: string;
|
|
372
420
|
base: string;
|
|
@@ -376,65 +424,32 @@ declare class BitbucketIntegration implements ScmIntegration {
|
|
|
376
424
|
}
|
|
377
425
|
|
|
378
426
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* @param url - A URL pointing to a path
|
|
382
|
-
* @param config - The relevant provider config
|
|
383
|
-
* @public
|
|
384
|
-
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
385
|
-
*/
|
|
386
|
-
declare function getBitbucketDefaultBranch(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
387
|
-
/**
|
|
388
|
-
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
389
|
-
* for downloading the subtree.
|
|
390
|
-
*
|
|
391
|
-
* @param url - A URL pointing to a path
|
|
392
|
-
* @param config - The relevant provider config
|
|
393
|
-
* @public
|
|
394
|
-
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
395
|
-
*/
|
|
396
|
-
declare function getBitbucketDownloadUrl(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
397
|
-
/**
|
|
398
|
-
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
399
|
-
* for fetching the contents of the data.
|
|
400
|
-
*
|
|
401
|
-
* @remarks
|
|
402
|
-
*
|
|
403
|
-
* Converts
|
|
404
|
-
* from: https://bitbucket.org/orgname/reponame/src/master/file.yaml
|
|
405
|
-
* to: https://api.bitbucket.org/2.0/repositories/orgname/reponame/src/master/file.yaml
|
|
406
|
-
*
|
|
407
|
-
* @param url - A URL pointing to a file
|
|
408
|
-
* @param config - The relevant provider config
|
|
409
|
-
* @public
|
|
410
|
-
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
411
|
-
*/
|
|
412
|
-
declare function getBitbucketFileFetchUrl(url: string, config: BitbucketIntegrationConfig): string;
|
|
413
|
-
/**
|
|
414
|
-
* Gets the request options necessary to make requests to a given provider.
|
|
415
|
-
*
|
|
416
|
-
* @param config - The relevant provider config
|
|
417
|
-
* @public
|
|
418
|
-
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
419
|
-
*/
|
|
420
|
-
declare function getBitbucketRequestOptions(config: BitbucketIntegrationConfig): {
|
|
421
|
-
headers: Record<string, string>;
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* The configuration parameters for a single Bitbucket Cloud API provider.
|
|
427
|
+
* The configuration parameters for a single Bitbucket API provider.
|
|
426
428
|
*
|
|
427
429
|
* @public
|
|
430
|
+
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
428
431
|
*/
|
|
429
|
-
type
|
|
432
|
+
type BitbucketIntegrationConfig = {
|
|
430
433
|
/**
|
|
431
|
-
*
|
|
434
|
+
* The host of the target that this matches on, e.g. "bitbucket.org"
|
|
432
435
|
*/
|
|
433
436
|
host: string;
|
|
434
437
|
/**
|
|
435
|
-
*
|
|
438
|
+
* The base URL of the API of this provider, e.g. "https://api.bitbucket.org/2.0",
|
|
439
|
+
* with no trailing slash.
|
|
440
|
+
*
|
|
441
|
+
* Values omitted at the optional property at the app-config will be deduced
|
|
442
|
+
* from the "host" value.
|
|
436
443
|
*/
|
|
437
444
|
apiBaseUrl: string;
|
|
445
|
+
/**
|
|
446
|
+
* The authorization token to use for requests to a Bitbucket Server provider.
|
|
447
|
+
*
|
|
448
|
+
* See https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html
|
|
449
|
+
*
|
|
450
|
+
* If no token is specified, anonymous access is used.
|
|
451
|
+
*/
|
|
452
|
+
token?: string;
|
|
438
453
|
/**
|
|
439
454
|
* The username to use for requests to Bitbucket Cloud (bitbucket.org).
|
|
440
455
|
*/
|
|
@@ -447,33 +462,36 @@ type BitbucketCloudIntegrationConfig = {
|
|
|
447
462
|
appPassword?: string;
|
|
448
463
|
};
|
|
449
464
|
/**
|
|
450
|
-
* Reads a single Bitbucket
|
|
465
|
+
* Reads a single Bitbucket integration config.
|
|
451
466
|
*
|
|
452
467
|
* @param config - The config object of a single integration
|
|
453
468
|
* @public
|
|
469
|
+
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
454
470
|
*/
|
|
455
|
-
declare function
|
|
471
|
+
declare function readBitbucketIntegrationConfig(config: Config): BitbucketIntegrationConfig;
|
|
456
472
|
/**
|
|
457
|
-
* Reads a set of Bitbucket
|
|
458
|
-
*
|
|
473
|
+
* Reads a set of Bitbucket integration configs, and inserts some defaults for
|
|
474
|
+
* public Bitbucket if not specified.
|
|
459
475
|
*
|
|
460
476
|
* @param configs - All of the integration config objects
|
|
461
477
|
* @public
|
|
478
|
+
* @deprecated bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
462
479
|
*/
|
|
463
|
-
declare function
|
|
480
|
+
declare function readBitbucketIntegrationConfigs(configs: Config[]): BitbucketIntegrationConfig[];
|
|
464
481
|
|
|
465
482
|
/**
|
|
466
|
-
* A Bitbucket
|
|
483
|
+
* A Bitbucket based integration.
|
|
467
484
|
*
|
|
468
485
|
* @public
|
|
486
|
+
* @deprecated replaced by the integrations bitbucketCloud and bitbucketServer.
|
|
469
487
|
*/
|
|
470
|
-
declare class
|
|
488
|
+
declare class BitbucketIntegration implements ScmIntegration {
|
|
471
489
|
private readonly integrationConfig;
|
|
472
|
-
static factory: ScmIntegrationsFactory<
|
|
473
|
-
constructor(integrationConfig:
|
|
490
|
+
static factory: ScmIntegrationsFactory<BitbucketIntegration>;
|
|
491
|
+
constructor(integrationConfig: BitbucketIntegrationConfig);
|
|
474
492
|
get type(): string;
|
|
475
493
|
get title(): string;
|
|
476
|
-
get config():
|
|
494
|
+
get config(): BitbucketIntegrationConfig;
|
|
477
495
|
resolveUrl(options: {
|
|
478
496
|
url: string;
|
|
479
497
|
base: string;
|
|
@@ -482,48 +500,6 @@ declare class BitbucketCloudIntegration implements ScmIntegration {
|
|
|
482
500
|
resolveEditUrl(url: string): string;
|
|
483
501
|
}
|
|
484
502
|
|
|
485
|
-
/**
|
|
486
|
-
* Given a URL pointing to a path on a provider, returns the default branch.
|
|
487
|
-
*
|
|
488
|
-
* @param url - A URL pointing to a path
|
|
489
|
-
* @param config - The relevant provider config
|
|
490
|
-
* @public
|
|
491
|
-
*/
|
|
492
|
-
declare function getBitbucketCloudDefaultBranch(url: string, config: BitbucketCloudIntegrationConfig): Promise<string>;
|
|
493
|
-
/**
|
|
494
|
-
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
495
|
-
* for downloading the subtree.
|
|
496
|
-
*
|
|
497
|
-
* @param url - A URL pointing to a path
|
|
498
|
-
* @param config - The relevant provider config
|
|
499
|
-
* @public
|
|
500
|
-
*/
|
|
501
|
-
declare function getBitbucketCloudDownloadUrl(url: string, config: BitbucketCloudIntegrationConfig): Promise<string>;
|
|
502
|
-
/**
|
|
503
|
-
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
504
|
-
* for fetching the contents of the data.
|
|
505
|
-
*
|
|
506
|
-
* @remarks
|
|
507
|
-
*
|
|
508
|
-
* Converts
|
|
509
|
-
* from: https://bitbucket.org/orgname/reponame/src/master/file.yaml
|
|
510
|
-
* to: https://api.bitbucket.org/2.0/repositories/orgname/reponame/src/master/file.yaml
|
|
511
|
-
*
|
|
512
|
-
* @param url - A URL pointing to a file
|
|
513
|
-
* @param config - The relevant provider config
|
|
514
|
-
* @public
|
|
515
|
-
*/
|
|
516
|
-
declare function getBitbucketCloudFileFetchUrl(url: string, config: BitbucketCloudIntegrationConfig): string;
|
|
517
|
-
/**
|
|
518
|
-
* Gets the request options necessary to make requests to a given provider.
|
|
519
|
-
*
|
|
520
|
-
* @param config - The relevant provider config
|
|
521
|
-
* @public
|
|
522
|
-
*/
|
|
523
|
-
declare function getBitbucketCloudRequestOptions(config: BitbucketCloudIntegrationConfig): {
|
|
524
|
-
headers: Record<string, string>;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
503
|
/**
|
|
528
504
|
* The configuration parameters for a single Bitbucket Server API provider.
|
|
529
505
|
*
|
|
@@ -603,49 +579,7 @@ declare class BitbucketServerIntegration implements ScmIntegration {
|
|
|
603
579
|
}
|
|
604
580
|
|
|
605
581
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
* @param url - A URL pointing to a path
|
|
609
|
-
* @param config - The relevant provider config
|
|
610
|
-
* @public
|
|
611
|
-
*/
|
|
612
|
-
declare function getBitbucketServerDefaultBranch(url: string, config: BitbucketServerIntegrationConfig): Promise<string>;
|
|
613
|
-
/**
|
|
614
|
-
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
615
|
-
* for downloading the subtree.
|
|
616
|
-
*
|
|
617
|
-
* @param url - A URL pointing to a path
|
|
618
|
-
* @param config - The relevant provider config
|
|
619
|
-
* @public
|
|
620
|
-
*/
|
|
621
|
-
declare function getBitbucketServerDownloadUrl(url: string, config: BitbucketServerIntegrationConfig): Promise<string>;
|
|
622
|
-
/**
|
|
623
|
-
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
624
|
-
* for fetching the contents of the data.
|
|
625
|
-
*
|
|
626
|
-
* @remarks
|
|
627
|
-
*
|
|
628
|
-
* Converts
|
|
629
|
-
* from: https://bitbucket.company.com/projectname/reponame/src/main/file.yaml
|
|
630
|
-
* to: https://bitbucket.company.com/rest/api/1.0/project/projectname/reponame/raw/file.yaml?at=main
|
|
631
|
-
*
|
|
632
|
-
* @param url - A URL pointing to a file
|
|
633
|
-
* @param config - The relevant provider config
|
|
634
|
-
* @public
|
|
635
|
-
*/
|
|
636
|
-
declare function getBitbucketServerFileFetchUrl(url: string, config: BitbucketServerIntegrationConfig): string;
|
|
637
|
-
/**
|
|
638
|
-
* Gets the request options necessary to make requests to a given provider.
|
|
639
|
-
*
|
|
640
|
-
* @param config - The relevant provider config
|
|
641
|
-
* @public
|
|
642
|
-
*/
|
|
643
|
-
declare function getBitbucketServerRequestOptions(config: BitbucketServerIntegrationConfig): {
|
|
644
|
-
headers: Record<string, string>;
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* The configuration parameters for a single Gerrit API provider.
|
|
582
|
+
* The configuration parameters for a single Gerrit API provider.
|
|
649
583
|
*
|
|
650
584
|
* @public
|
|
651
585
|
*/
|
|
@@ -720,176 +654,6 @@ declare class GerritIntegration implements ScmIntegration {
|
|
|
720
654
|
resolveEditUrl(url: string): string;
|
|
721
655
|
}
|
|
722
656
|
|
|
723
|
-
/**
|
|
724
|
-
* Parse a Gitiles URL and return branch, file path and project.
|
|
725
|
-
*
|
|
726
|
-
* @remarks
|
|
727
|
-
*
|
|
728
|
-
* Gerrit only handles code reviews so it does not have a native way to browse
|
|
729
|
-
* or showing the content of gits. Image if Github only had the "pull requests"
|
|
730
|
-
* tab.
|
|
731
|
-
*
|
|
732
|
-
* Any source code browsing is instead handled by optional services outside
|
|
733
|
-
* Gerrit. The url format chosen for the Gerrit url reader is the one used by
|
|
734
|
-
* the Gitiles project. Gerrit will work perfectly with Backstage without
|
|
735
|
-
* having Gitiles installed but there are some places in the Backstage GUI
|
|
736
|
-
* with links to the url used by the url reader. These will not work unless
|
|
737
|
-
* the urls point to an actual Gitiles installation.
|
|
738
|
-
*
|
|
739
|
-
* Gitiles url:
|
|
740
|
-
* https://g.com/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
741
|
-
* https://g.com/a/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
* @param url - An URL pointing to a file stored in git.
|
|
745
|
-
* @public
|
|
746
|
-
*/
|
|
747
|
-
declare function parseGerritGitilesUrl(config: GerritIntegrationConfig, url: string): {
|
|
748
|
-
branch: string;
|
|
749
|
-
filePath: string;
|
|
750
|
-
project: string;
|
|
751
|
-
};
|
|
752
|
-
/**
|
|
753
|
-
* Build a Gerrit Gitiles archive url that targets a specific branch and path
|
|
754
|
-
*
|
|
755
|
-
* @param config - A Gerrit provider config.
|
|
756
|
-
* @param project - The name of the git project
|
|
757
|
-
* @param branch - The branch we will target.
|
|
758
|
-
* @param filePath - The absolute file path.
|
|
759
|
-
* @public
|
|
760
|
-
*/
|
|
761
|
-
declare function buildGerritGitilesArchiveUrl(config: GerritIntegrationConfig, project: string, branch: string, filePath: string): string;
|
|
762
|
-
/**
|
|
763
|
-
* Return the url to get branch info from the Gerrit API.
|
|
764
|
-
*
|
|
765
|
-
* @param config - A Gerrit provider config.
|
|
766
|
-
* @param url - An url pointing to a file in git.
|
|
767
|
-
* @public
|
|
768
|
-
*/
|
|
769
|
-
declare function getGerritBranchApiUrl(config: GerritIntegrationConfig, url: string): string;
|
|
770
|
-
/**
|
|
771
|
-
* Return the url to clone the repo that is referenced by the url.
|
|
772
|
-
*
|
|
773
|
-
* @param url - An url pointing to a file in git.
|
|
774
|
-
* @public
|
|
775
|
-
*/
|
|
776
|
-
declare function getGerritCloneRepoUrl(config: GerritIntegrationConfig, url: string): string;
|
|
777
|
-
/**
|
|
778
|
-
* Return the url to fetch the contents of a file using the Gerrit API.
|
|
779
|
-
*
|
|
780
|
-
* @param config - A Gerrit provider config.
|
|
781
|
-
* @param url - An url pointing to a file in git.
|
|
782
|
-
* @public
|
|
783
|
-
*/
|
|
784
|
-
declare function getGerritFileContentsApiUrl(config: GerritIntegrationConfig, url: string): string;
|
|
785
|
-
/**
|
|
786
|
-
* Return the url to query available projects using the Gerrit API.
|
|
787
|
-
*
|
|
788
|
-
* @param config - A Gerrit provider config.
|
|
789
|
-
* @public
|
|
790
|
-
*/
|
|
791
|
-
declare function getGerritProjectsApiUrl(config: GerritIntegrationConfig): string;
|
|
792
|
-
/**
|
|
793
|
-
* Return request headers for a Gerrit provider.
|
|
794
|
-
*
|
|
795
|
-
* @param config - A Gerrit provider config
|
|
796
|
-
* @public
|
|
797
|
-
*/
|
|
798
|
-
declare function getGerritRequestOptions(config: GerritIntegrationConfig): {
|
|
799
|
-
headers?: Record<string, string>;
|
|
800
|
-
};
|
|
801
|
-
/**
|
|
802
|
-
* Parse the json response from Gerrit and strip the magic prefix.
|
|
803
|
-
*
|
|
804
|
-
* @remarks
|
|
805
|
-
*
|
|
806
|
-
* To prevent against XSSI attacks the JSON response body from Gerrit starts
|
|
807
|
-
* with a magic prefix that must be stripped before it can be fed to a JSON
|
|
808
|
-
* parser.
|
|
809
|
-
*
|
|
810
|
-
* @param response - An API response.
|
|
811
|
-
* @public
|
|
812
|
-
*/
|
|
813
|
-
declare function parseGerritJsonResponse(response: Response): Promise<unknown>;
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* The configuration for a single Gitea integration.
|
|
817
|
-
*
|
|
818
|
-
* @public
|
|
819
|
-
*/
|
|
820
|
-
type GiteaIntegrationConfig = {
|
|
821
|
-
/**
|
|
822
|
-
* The host of the target that this matches on, e.g. "gitea.website.com"
|
|
823
|
-
*/
|
|
824
|
-
host: string;
|
|
825
|
-
/**
|
|
826
|
-
* The optional base URL of the Gitea instance. It is assumed that https
|
|
827
|
-
* is used and that the base path is "/" on the host. If that is not the
|
|
828
|
-
* case set the complete base url to the gitea instance, e.g.
|
|
829
|
-
* "https://gitea.website.com/". This is the url that you would open
|
|
830
|
-
* in a browser.
|
|
831
|
-
*/
|
|
832
|
-
baseUrl?: string;
|
|
833
|
-
/**
|
|
834
|
-
* The username to use for requests to gitea.
|
|
835
|
-
*/
|
|
836
|
-
username?: string;
|
|
837
|
-
/**
|
|
838
|
-
* The password or http token to use for authentication.
|
|
839
|
-
*/
|
|
840
|
-
password?: string;
|
|
841
|
-
};
|
|
842
|
-
/**
|
|
843
|
-
* Parses a location config block for use in GiteaIntegration
|
|
844
|
-
*
|
|
845
|
-
* @public
|
|
846
|
-
*/
|
|
847
|
-
declare function readGiteaConfig(config: Config): GiteaIntegrationConfig;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* A Gitea based integration.
|
|
851
|
-
*
|
|
852
|
-
* @public
|
|
853
|
-
*/
|
|
854
|
-
declare class GiteaIntegration implements ScmIntegration {
|
|
855
|
-
readonly config: GiteaIntegrationConfig;
|
|
856
|
-
static factory: ScmIntegrationsFactory<GiteaIntegration>;
|
|
857
|
-
constructor(config: GiteaIntegrationConfig);
|
|
858
|
-
get type(): string;
|
|
859
|
-
get title(): string;
|
|
860
|
-
resolveUrl(options: {
|
|
861
|
-
url: string;
|
|
862
|
-
base: string;
|
|
863
|
-
lineNumber?: number | undefined;
|
|
864
|
-
}): string;
|
|
865
|
-
resolveEditUrl(url: string): string;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
/**
|
|
869
|
-
* Given a URL pointing to a file, returns an api URL
|
|
870
|
-
* for fetching the contents of the data.
|
|
871
|
-
*
|
|
872
|
-
* @remarks
|
|
873
|
-
*
|
|
874
|
-
* Converts
|
|
875
|
-
* from: https://gitea.com/a/b/src/branch/branchname/path/to/c.yaml
|
|
876
|
-
* to: https://gitea.com/api/v1/repos/a/b/contents/path/to/c.yaml?ref=branchname
|
|
877
|
-
*
|
|
878
|
-
* @param url - A URL pointing to a file
|
|
879
|
-
* @param config - The relevant provider config
|
|
880
|
-
* @public
|
|
881
|
-
*/
|
|
882
|
-
declare function getGiteaFileContentsUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
883
|
-
/**
|
|
884
|
-
* Return request headers for a Gitea provider.
|
|
885
|
-
*
|
|
886
|
-
* @param config - A Gitea provider config
|
|
887
|
-
* @public
|
|
888
|
-
*/
|
|
889
|
-
declare function getGiteaRequestOptions(config: GiteaIntegrationConfig): {
|
|
890
|
-
headers?: Record<string, string>;
|
|
891
|
-
};
|
|
892
|
-
|
|
893
657
|
/**
|
|
894
658
|
* The configuration parameters for a single GitHub integration.
|
|
895
659
|
*
|
|
@@ -989,63 +753,6 @@ declare function readGithubIntegrationConfig(config: Config): GithubIntegrationC
|
|
|
989
753
|
*/
|
|
990
754
|
declare function readGithubIntegrationConfigs(configs: Config[]): GithubIntegrationConfig[];
|
|
991
755
|
|
|
992
|
-
/**
|
|
993
|
-
* The type of credentials produced by the credential provider.
|
|
994
|
-
*
|
|
995
|
-
* @public
|
|
996
|
-
*/
|
|
997
|
-
type GithubCredentialType = 'app' | 'token';
|
|
998
|
-
/**
|
|
999
|
-
* A set of credentials information for a GitHub integration.
|
|
1000
|
-
*
|
|
1001
|
-
* @public
|
|
1002
|
-
*/
|
|
1003
|
-
type GithubCredentials = {
|
|
1004
|
-
headers?: {
|
|
1005
|
-
[name: string]: string;
|
|
1006
|
-
};
|
|
1007
|
-
token?: string;
|
|
1008
|
-
type: GithubCredentialType;
|
|
1009
|
-
};
|
|
1010
|
-
/**
|
|
1011
|
-
* This allows implementations to be provided to retrieve GitHub credentials.
|
|
1012
|
-
*
|
|
1013
|
-
* @public
|
|
1014
|
-
*
|
|
1015
|
-
*/
|
|
1016
|
-
interface GithubCredentialsProvider {
|
|
1017
|
-
getCredentials(opts: {
|
|
1018
|
-
url: string;
|
|
1019
|
-
}): Promise<GithubCredentials>;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1024
|
-
* for fetching the contents of the data.
|
|
1025
|
-
*
|
|
1026
|
-
* @remarks
|
|
1027
|
-
*
|
|
1028
|
-
* Converts
|
|
1029
|
-
* from: https://github.com/a/b/blob/branchname/path/to/c.yaml
|
|
1030
|
-
* to: https://api.github.com/repos/a/b/contents/path/to/c.yaml?ref=branchname
|
|
1031
|
-
* or: https://raw.githubusercontent.com/a/b/branchname/c.yaml
|
|
1032
|
-
*
|
|
1033
|
-
* @param url - A URL pointing to a file
|
|
1034
|
-
* @param config - The relevant provider config
|
|
1035
|
-
* @public
|
|
1036
|
-
*/
|
|
1037
|
-
declare function getGithubFileFetchUrl(url: string, config: GithubIntegrationConfig, credentials: GithubCredentials): string;
|
|
1038
|
-
/**
|
|
1039
|
-
* Gets the request options necessary to make requests to a given provider.
|
|
1040
|
-
*
|
|
1041
|
-
* @deprecated This function is no longer used internally
|
|
1042
|
-
* @param config - The relevant provider config
|
|
1043
|
-
* @public
|
|
1044
|
-
*/
|
|
1045
|
-
declare function getGitHubRequestOptions(config: GithubIntegrationConfig, credentials: GithubCredentials): {
|
|
1046
|
-
headers: Record<string, string>;
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
756
|
/**
|
|
1050
757
|
* A GitHub based integration.
|
|
1051
758
|
*
|
|
@@ -1158,29 +865,82 @@ declare class GitLabIntegration implements ScmIntegration {
|
|
|
1158
865
|
declare function replaceGitLabUrlType(url: string, type: 'blob' | 'tree' | 'edit'): string;
|
|
1159
866
|
|
|
1160
867
|
/**
|
|
1161
|
-
*
|
|
868
|
+
* The configuration for a single Gitea integration.
|
|
1162
869
|
*
|
|
1163
870
|
* @public
|
|
1164
871
|
*/
|
|
1165
|
-
|
|
1166
|
-
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
1167
|
-
azure: ScmIntegrationsGroup<AzureIntegration>;
|
|
872
|
+
type GiteaIntegrationConfig = {
|
|
1168
873
|
/**
|
|
1169
|
-
*
|
|
874
|
+
* The host of the target that this matches on, e.g. "gitea.website.com"
|
|
1170
875
|
*/
|
|
1171
|
-
|
|
1172
|
-
bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;
|
|
1173
|
-
bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;
|
|
1174
|
-
gerrit: ScmIntegrationsGroup<GerritIntegration>;
|
|
1175
|
-
github: ScmIntegrationsGroup<GithubIntegration>;
|
|
1176
|
-
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
|
1177
|
-
gitea: ScmIntegrationsGroup<GiteaIntegration>;
|
|
876
|
+
host: string;
|
|
1178
877
|
/**
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
878
|
+
* The optional base URL of the Gitea instance. It is assumed that https
|
|
879
|
+
* is used and that the base path is "/" on the host. If that is not the
|
|
880
|
+
* case set the complete base url to the gitea instance, e.g.
|
|
881
|
+
* "https://gitea.website.com/". This is the url that you would open
|
|
882
|
+
* in a browser.
|
|
883
|
+
*/
|
|
884
|
+
baseUrl?: string;
|
|
885
|
+
/**
|
|
886
|
+
* The username to use for requests to gitea.
|
|
887
|
+
*/
|
|
888
|
+
username?: string;
|
|
889
|
+
/**
|
|
890
|
+
* The password or http token to use for authentication.
|
|
891
|
+
*/
|
|
892
|
+
password?: string;
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* Parses a location config block for use in GiteaIntegration
|
|
896
|
+
*
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
declare function readGiteaConfig(config: Config): GiteaIntegrationConfig;
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* A Gitea based integration.
|
|
903
|
+
*
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
declare class GiteaIntegration implements ScmIntegration {
|
|
907
|
+
readonly config: GiteaIntegrationConfig;
|
|
908
|
+
static factory: ScmIntegrationsFactory<GiteaIntegration>;
|
|
909
|
+
constructor(config: GiteaIntegrationConfig);
|
|
910
|
+
get type(): string;
|
|
911
|
+
get title(): string;
|
|
912
|
+
resolveUrl(options: {
|
|
913
|
+
url: string;
|
|
914
|
+
base: string;
|
|
915
|
+
lineNumber?: number | undefined;
|
|
916
|
+
}): string;
|
|
917
|
+
resolveEditUrl(url: string): string;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Holds all registered SCM integrations, of all types.
|
|
922
|
+
*
|
|
923
|
+
* @public
|
|
924
|
+
*/
|
|
925
|
+
interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
926
|
+
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
927
|
+
azure: ScmIntegrationsGroup<AzureIntegration>;
|
|
928
|
+
/**
|
|
929
|
+
* @deprecated in favor of `bitbucketCloud` and `bitbucketServer`
|
|
930
|
+
*/
|
|
931
|
+
bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;
|
|
932
|
+
bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;
|
|
933
|
+
bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;
|
|
934
|
+
gerrit: ScmIntegrationsGroup<GerritIntegration>;
|
|
935
|
+
github: ScmIntegrationsGroup<GithubIntegration>;
|
|
936
|
+
gitlab: ScmIntegrationsGroup<GitLabIntegration>;
|
|
937
|
+
gitea: ScmIntegrationsGroup<GiteaIntegration>;
|
|
938
|
+
/**
|
|
939
|
+
* Resolves an absolute or relative URL in relation to a base URL.
|
|
940
|
+
*
|
|
941
|
+
* This method is adapted for use within SCM systems, so relative URLs are
|
|
942
|
+
* within the context of the root of the hierarchy pointed to by the base
|
|
943
|
+
* URL.
|
|
1184
944
|
*
|
|
1185
945
|
* For example, if the base URL is `<repo root url>/folder/a.yaml`, i.e.
|
|
1186
946
|
* within the file tree of a certain repo, an absolute path of `/b.yaml` does
|
|
@@ -1215,6 +975,338 @@ interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
|
1215
975
|
resolveEditUrl(url: string): string;
|
|
1216
976
|
}
|
|
1217
977
|
|
|
978
|
+
/**
|
|
979
|
+
* Default implementation of AzureDevOpsCredentialsProvider.
|
|
980
|
+
* @public
|
|
981
|
+
*/
|
|
982
|
+
declare class DefaultAzureDevOpsCredentialsProvider implements AzureDevOpsCredentialsProvider {
|
|
983
|
+
private readonly providers;
|
|
984
|
+
static fromIntegrations(integrations: ScmIntegrationRegistry): DefaultAzureDevOpsCredentialsProvider;
|
|
985
|
+
private constructor();
|
|
986
|
+
private forAzureDevOpsServerOrganization;
|
|
987
|
+
private forAzureDevOpsOrganization;
|
|
988
|
+
private forHost;
|
|
989
|
+
getCredentials(opts: {
|
|
990
|
+
url: string;
|
|
991
|
+
}): Promise<AzureDevOpsCredentials | undefined>;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Gets the request options necessary to make requests to a given provider.
|
|
996
|
+
*
|
|
997
|
+
* @param config - The relevant provider config
|
|
998
|
+
* @param additionalHeaders - Additional headers for the request
|
|
999
|
+
* @public
|
|
1000
|
+
* @deprecated Use {@link AzureDevOpsCredentialsProvider} instead.
|
|
1001
|
+
*/
|
|
1002
|
+
declare function getAzureRequestOptions(config: AzureIntegrationConfig, additionalHeaders?: Record<string, string>): Promise<{
|
|
1003
|
+
headers: Record<string, string>;
|
|
1004
|
+
}>;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Given a URL pointing to a path on a provider, returns the default branch.
|
|
1008
|
+
*
|
|
1009
|
+
* @param url - A URL pointing to a path
|
|
1010
|
+
* @param config - The relevant provider config
|
|
1011
|
+
* @public
|
|
1012
|
+
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
1013
|
+
*/
|
|
1014
|
+
declare function getBitbucketDefaultBranch(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
1017
|
+
* for downloading the subtree.
|
|
1018
|
+
*
|
|
1019
|
+
* @param url - A URL pointing to a path
|
|
1020
|
+
* @param config - The relevant provider config
|
|
1021
|
+
* @public
|
|
1022
|
+
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
1023
|
+
*/
|
|
1024
|
+
declare function getBitbucketDownloadUrl(url: string, config: BitbucketIntegrationConfig): Promise<string>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1027
|
+
* for fetching the contents of the data.
|
|
1028
|
+
*
|
|
1029
|
+
* @remarks
|
|
1030
|
+
*
|
|
1031
|
+
* Converts
|
|
1032
|
+
* from: https://bitbucket.org/orgname/reponame/src/master/file.yaml
|
|
1033
|
+
* to: https://api.bitbucket.org/2.0/repositories/orgname/reponame/src/master/file.yaml
|
|
1034
|
+
*
|
|
1035
|
+
* @param url - A URL pointing to a file
|
|
1036
|
+
* @param config - The relevant provider config
|
|
1037
|
+
* @public
|
|
1038
|
+
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
1039
|
+
*/
|
|
1040
|
+
declare function getBitbucketFileFetchUrl(url: string, config: BitbucketIntegrationConfig): string;
|
|
1041
|
+
/**
|
|
1042
|
+
* Gets the request options necessary to make requests to a given provider.
|
|
1043
|
+
*
|
|
1044
|
+
* @param config - The relevant provider config
|
|
1045
|
+
* @public
|
|
1046
|
+
* @deprecated no longer in use, bitbucket integration replaced by integrations bitbucketCloud and bitbucketServer.
|
|
1047
|
+
*/
|
|
1048
|
+
declare function getBitbucketRequestOptions(config: BitbucketIntegrationConfig): {
|
|
1049
|
+
headers: Record<string, string>;
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Given a URL pointing to a path on a provider, returns the default branch.
|
|
1054
|
+
*
|
|
1055
|
+
* @param url - A URL pointing to a path
|
|
1056
|
+
* @param config - The relevant provider config
|
|
1057
|
+
* @public
|
|
1058
|
+
*/
|
|
1059
|
+
declare function getBitbucketCloudDefaultBranch(url: string, config: BitbucketCloudIntegrationConfig): Promise<string>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
1062
|
+
* for downloading the subtree.
|
|
1063
|
+
*
|
|
1064
|
+
* @param url - A URL pointing to a path
|
|
1065
|
+
* @param config - The relevant provider config
|
|
1066
|
+
* @public
|
|
1067
|
+
*/
|
|
1068
|
+
declare function getBitbucketCloudDownloadUrl(url: string, config: BitbucketCloudIntegrationConfig): Promise<string>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1071
|
+
* for fetching the contents of the data.
|
|
1072
|
+
*
|
|
1073
|
+
* @remarks
|
|
1074
|
+
*
|
|
1075
|
+
* Converts
|
|
1076
|
+
* from: https://bitbucket.org/orgname/reponame/src/master/file.yaml
|
|
1077
|
+
* to: https://api.bitbucket.org/2.0/repositories/orgname/reponame/src/master/file.yaml
|
|
1078
|
+
*
|
|
1079
|
+
* @param url - A URL pointing to a file
|
|
1080
|
+
* @param config - The relevant provider config
|
|
1081
|
+
* @public
|
|
1082
|
+
*/
|
|
1083
|
+
declare function getBitbucketCloudFileFetchUrl(url: string, config: BitbucketCloudIntegrationConfig): string;
|
|
1084
|
+
/**
|
|
1085
|
+
* Gets the request options necessary to make requests to a given provider.
|
|
1086
|
+
*
|
|
1087
|
+
* @param config - The relevant provider config
|
|
1088
|
+
* @public
|
|
1089
|
+
*/
|
|
1090
|
+
declare function getBitbucketCloudRequestOptions(config: BitbucketCloudIntegrationConfig): {
|
|
1091
|
+
headers: Record<string, string>;
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Given a URL pointing to a path on a provider, returns the default branch.
|
|
1096
|
+
*
|
|
1097
|
+
* @param url - A URL pointing to a path
|
|
1098
|
+
* @param config - The relevant provider config
|
|
1099
|
+
* @public
|
|
1100
|
+
*/
|
|
1101
|
+
declare function getBitbucketServerDefaultBranch(url: string, config: BitbucketServerIntegrationConfig): Promise<string>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
1104
|
+
* for downloading the subtree.
|
|
1105
|
+
*
|
|
1106
|
+
* @param url - A URL pointing to a path
|
|
1107
|
+
* @param config - The relevant provider config
|
|
1108
|
+
* @public
|
|
1109
|
+
*/
|
|
1110
|
+
declare function getBitbucketServerDownloadUrl(url: string, config: BitbucketServerIntegrationConfig): Promise<string>;
|
|
1111
|
+
/**
|
|
1112
|
+
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1113
|
+
* for fetching the contents of the data.
|
|
1114
|
+
*
|
|
1115
|
+
* @remarks
|
|
1116
|
+
*
|
|
1117
|
+
* Converts
|
|
1118
|
+
* from: https://bitbucket.company.com/projectname/reponame/src/main/file.yaml
|
|
1119
|
+
* to: https://bitbucket.company.com/rest/api/1.0/project/projectname/reponame/raw/file.yaml?at=main
|
|
1120
|
+
*
|
|
1121
|
+
* @param url - A URL pointing to a file
|
|
1122
|
+
* @param config - The relevant provider config
|
|
1123
|
+
* @public
|
|
1124
|
+
*/
|
|
1125
|
+
declare function getBitbucketServerFileFetchUrl(url: string, config: BitbucketServerIntegrationConfig): string;
|
|
1126
|
+
/**
|
|
1127
|
+
* Gets the request options necessary to make requests to a given provider.
|
|
1128
|
+
*
|
|
1129
|
+
* @param config - The relevant provider config
|
|
1130
|
+
* @public
|
|
1131
|
+
*/
|
|
1132
|
+
declare function getBitbucketServerRequestOptions(config: BitbucketServerIntegrationConfig): {
|
|
1133
|
+
headers: Record<string, string>;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Parse a Gitiles URL and return branch, file path and project.
|
|
1138
|
+
*
|
|
1139
|
+
* @remarks
|
|
1140
|
+
*
|
|
1141
|
+
* Gerrit only handles code reviews so it does not have a native way to browse
|
|
1142
|
+
* or showing the content of gits. Image if Github only had the "pull requests"
|
|
1143
|
+
* tab.
|
|
1144
|
+
*
|
|
1145
|
+
* Any source code browsing is instead handled by optional services outside
|
|
1146
|
+
* Gerrit. The url format chosen for the Gerrit url reader is the one used by
|
|
1147
|
+
* the Gitiles project. Gerrit will work perfectly with Backstage without
|
|
1148
|
+
* having Gitiles installed but there are some places in the Backstage GUI
|
|
1149
|
+
* with links to the url used by the url reader. These will not work unless
|
|
1150
|
+
* the urls point to an actual Gitiles installation.
|
|
1151
|
+
*
|
|
1152
|
+
* Gitiles url:
|
|
1153
|
+
* https://g.com/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
1154
|
+
* https://g.com/a/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
1155
|
+
*
|
|
1156
|
+
*
|
|
1157
|
+
* @param url - An URL pointing to a file stored in git.
|
|
1158
|
+
* @public
|
|
1159
|
+
*/
|
|
1160
|
+
declare function parseGerritGitilesUrl(config: GerritIntegrationConfig, url: string): {
|
|
1161
|
+
branch: string;
|
|
1162
|
+
filePath: string;
|
|
1163
|
+
project: string;
|
|
1164
|
+
};
|
|
1165
|
+
/**
|
|
1166
|
+
* Build a Gerrit Gitiles archive url that targets a specific branch and path
|
|
1167
|
+
*
|
|
1168
|
+
* @param config - A Gerrit provider config.
|
|
1169
|
+
* @param project - The name of the git project
|
|
1170
|
+
* @param branch - The branch we will target.
|
|
1171
|
+
* @param filePath - The absolute file path.
|
|
1172
|
+
* @public
|
|
1173
|
+
*/
|
|
1174
|
+
declare function buildGerritGitilesArchiveUrl(config: GerritIntegrationConfig, project: string, branch: string, filePath: string): string;
|
|
1175
|
+
/**
|
|
1176
|
+
* Return the url to get branch info from the Gerrit API.
|
|
1177
|
+
*
|
|
1178
|
+
* @param config - A Gerrit provider config.
|
|
1179
|
+
* @param url - An url pointing to a file in git.
|
|
1180
|
+
* @public
|
|
1181
|
+
*/
|
|
1182
|
+
declare function getGerritBranchApiUrl(config: GerritIntegrationConfig, url: string): string;
|
|
1183
|
+
/**
|
|
1184
|
+
* Return the url to clone the repo that is referenced by the url.
|
|
1185
|
+
*
|
|
1186
|
+
* @param url - An url pointing to a file in git.
|
|
1187
|
+
* @public
|
|
1188
|
+
*/
|
|
1189
|
+
declare function getGerritCloneRepoUrl(config: GerritIntegrationConfig, url: string): string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Return the url to fetch the contents of a file using the Gerrit API.
|
|
1192
|
+
*
|
|
1193
|
+
* @param config - A Gerrit provider config.
|
|
1194
|
+
* @param url - An url pointing to a file in git.
|
|
1195
|
+
* @public
|
|
1196
|
+
*/
|
|
1197
|
+
declare function getGerritFileContentsApiUrl(config: GerritIntegrationConfig, url: string): string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Return the url to query available projects using the Gerrit API.
|
|
1200
|
+
*
|
|
1201
|
+
* @param config - A Gerrit provider config.
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
declare function getGerritProjectsApiUrl(config: GerritIntegrationConfig): string;
|
|
1205
|
+
/**
|
|
1206
|
+
* Return request headers for a Gerrit provider.
|
|
1207
|
+
*
|
|
1208
|
+
* @param config - A Gerrit provider config
|
|
1209
|
+
* @public
|
|
1210
|
+
*/
|
|
1211
|
+
declare function getGerritRequestOptions(config: GerritIntegrationConfig): {
|
|
1212
|
+
headers?: Record<string, string>;
|
|
1213
|
+
};
|
|
1214
|
+
/**
|
|
1215
|
+
* Parse the json response from Gerrit and strip the magic prefix.
|
|
1216
|
+
*
|
|
1217
|
+
* @remarks
|
|
1218
|
+
*
|
|
1219
|
+
* To prevent against XSSI attacks the JSON response body from Gerrit starts
|
|
1220
|
+
* with a magic prefix that must be stripped before it can be fed to a JSON
|
|
1221
|
+
* parser.
|
|
1222
|
+
*
|
|
1223
|
+
* @param response - An API response.
|
|
1224
|
+
* @public
|
|
1225
|
+
*/
|
|
1226
|
+
declare function parseGerritJsonResponse(response: Response): Promise<unknown>;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Given a URL pointing to a file, returns an api URL
|
|
1230
|
+
* for fetching the contents of the data.
|
|
1231
|
+
*
|
|
1232
|
+
* @remarks
|
|
1233
|
+
*
|
|
1234
|
+
* Converts
|
|
1235
|
+
* from: https://gitea.com/a/b/src/branch/branchname/path/to/c.yaml
|
|
1236
|
+
* to: https://gitea.com/api/v1/repos/a/b/contents/path/to/c.yaml?ref=branchname
|
|
1237
|
+
*
|
|
1238
|
+
* @param url - A URL pointing to a file
|
|
1239
|
+
* @param config - The relevant provider config
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
declare function getGiteaFileContentsUrl(config: GiteaIntegrationConfig, url: string): string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Return request headers for a Gitea provider.
|
|
1245
|
+
*
|
|
1246
|
+
* @param config - A Gitea provider config
|
|
1247
|
+
* @public
|
|
1248
|
+
*/
|
|
1249
|
+
declare function getGiteaRequestOptions(config: GiteaIntegrationConfig): {
|
|
1250
|
+
headers?: Record<string, string>;
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* The type of credentials produced by the credential provider.
|
|
1255
|
+
*
|
|
1256
|
+
* @public
|
|
1257
|
+
*/
|
|
1258
|
+
type GithubCredentialType = 'app' | 'token';
|
|
1259
|
+
/**
|
|
1260
|
+
* A set of credentials information for a GitHub integration.
|
|
1261
|
+
*
|
|
1262
|
+
* @public
|
|
1263
|
+
*/
|
|
1264
|
+
type GithubCredentials = {
|
|
1265
|
+
headers?: {
|
|
1266
|
+
[name: string]: string;
|
|
1267
|
+
};
|
|
1268
|
+
token?: string;
|
|
1269
|
+
type: GithubCredentialType;
|
|
1270
|
+
};
|
|
1271
|
+
/**
|
|
1272
|
+
* This allows implementations to be provided to retrieve GitHub credentials.
|
|
1273
|
+
*
|
|
1274
|
+
* @public
|
|
1275
|
+
*
|
|
1276
|
+
*/
|
|
1277
|
+
interface GithubCredentialsProvider {
|
|
1278
|
+
getCredentials(opts: {
|
|
1279
|
+
url: string;
|
|
1280
|
+
}): Promise<GithubCredentials>;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1285
|
+
* for fetching the contents of the data.
|
|
1286
|
+
*
|
|
1287
|
+
* @remarks
|
|
1288
|
+
*
|
|
1289
|
+
* Converts
|
|
1290
|
+
* from: https://github.com/a/b/blob/branchname/path/to/c.yaml
|
|
1291
|
+
* to: https://api.github.com/repos/a/b/contents/path/to/c.yaml?ref=branchname
|
|
1292
|
+
* or: https://raw.githubusercontent.com/a/b/branchname/c.yaml
|
|
1293
|
+
*
|
|
1294
|
+
* @param url - A URL pointing to a file
|
|
1295
|
+
* @param config - The relevant provider config
|
|
1296
|
+
* @public
|
|
1297
|
+
*/
|
|
1298
|
+
declare function getGithubFileFetchUrl(url: string, config: GithubIntegrationConfig, credentials: GithubCredentials): string;
|
|
1299
|
+
/**
|
|
1300
|
+
* Gets the request options necessary to make requests to a given provider.
|
|
1301
|
+
*
|
|
1302
|
+
* @deprecated This function is no longer used internally
|
|
1303
|
+
* @param config - The relevant provider config
|
|
1304
|
+
* @public
|
|
1305
|
+
*/
|
|
1306
|
+
declare function getGitHubRequestOptions(config: GithubIntegrationConfig, credentials: GithubCredentials): {
|
|
1307
|
+
headers: Record<string, string>;
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1218
1310
|
/**
|
|
1219
1311
|
* Handles the creation and caching of credentials for GitHub integrations.
|
|
1220
1312
|
*
|
|
@@ -1486,4 +1578,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1486
1578
|
resolveEditUrl(url: string): string;
|
|
1487
1579
|
}
|
|
1488
1580
|
|
|
1489
|
-
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential,
|
|
1581
|
+
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredentialBase, AzureDevOpsCredential, AzureDevOpsCredentialKind, AzureDevOpsCredentialLike, AzureDevOpsCredentialType, AzureDevOpsCredentials, AzureDevOpsCredentialsProvider, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, PersonalAccessTokenCredential, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|