@backstage/integration 1.11.0-next.0 → 1.12.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/ScmIntegrations.esm.js +4 -10
  3. package/dist/ScmIntegrations.esm.js.map +1 -1
  4. package/dist/awsCodeCommit/AwsCodeCommitIntegration.esm.js +13 -21
  5. package/dist/awsCodeCommit/AwsCodeCommitIntegration.esm.js.map +1 -1
  6. package/dist/awsCodeCommit/config.esm.js +1 -2
  7. package/dist/awsCodeCommit/config.esm.js.map +1 -1
  8. package/dist/awsS3/AwsS3Integration.esm.js +11 -19
  9. package/dist/awsS3/AwsS3Integration.esm.js.map +1 -1
  10. package/dist/awsS3/config.esm.js +2 -3
  11. package/dist/awsS3/config.esm.js.map +1 -1
  12. package/dist/azure/AzureIntegration.esm.js +12 -21
  13. package/dist/azure/AzureIntegration.esm.js.map +1 -1
  14. package/dist/azure/AzureUrl.esm.js +72 -76
  15. package/dist/azure/AzureUrl.esm.js.map +1 -1
  16. package/dist/azure/CachedAzureDevOpsCredentialsProvider.esm.js +2 -8
  17. package/dist/azure/CachedAzureDevOpsCredentialsProvider.esm.js.map +1 -1
  18. package/dist/azure/DefaultAzureDevOpsCredentialsProvider.esm.js +3 -6
  19. package/dist/azure/DefaultAzureDevOpsCredentialsProvider.esm.js.map +1 -1
  20. package/dist/azure/config.esm.js +12 -15
  21. package/dist/azure/config.esm.js.map +1 -1
  22. package/dist/azure/deprecated.esm.js +2 -3
  23. package/dist/azure/deprecated.esm.js.map +1 -1
  24. package/dist/bitbucket/BitbucketIntegration.esm.js +19 -27
  25. package/dist/bitbucket/BitbucketIntegration.esm.js.map +1 -1
  26. package/dist/bitbucket/config.esm.js +3 -4
  27. package/dist/bitbucket/config.esm.js.map +1 -1
  28. package/dist/bitbucketCloud/BitbucketCloudIntegration.esm.js +13 -21
  29. package/dist/bitbucketCloud/BitbucketCloudIntegration.esm.js.map +1 -1
  30. package/dist/bitbucketCloud/config.esm.js +1 -2
  31. package/dist/bitbucketCloud/config.esm.js.map +1 -1
  32. package/dist/bitbucketServer/BitbucketServerIntegration.esm.js +13 -21
  33. package/dist/bitbucketServer/BitbucketServerIntegration.esm.js.map +1 -1
  34. package/dist/bitbucketServer/config.esm.js +1 -2
  35. package/dist/bitbucketServer/config.esm.js.map +1 -1
  36. package/dist/gerrit/GerritIntegration.esm.js +11 -19
  37. package/dist/gerrit/GerritIntegration.esm.js.map +1 -1
  38. package/dist/gerrit/config.esm.js +1 -2
  39. package/dist/gerrit/config.esm.js.map +1 -1
  40. package/dist/gitea/GiteaIntegration.esm.js +10 -18
  41. package/dist/gitea/GiteaIntegration.esm.js.map +1 -1
  42. package/dist/gitea/config.esm.js +1 -2
  43. package/dist/gitea/config.esm.js.map +1 -1
  44. package/dist/gitea/core.esm.js +1 -2
  45. package/dist/gitea/core.esm.js.map +1 -1
  46. package/dist/github/GithubIntegration.esm.js +11 -19
  47. package/dist/github/GithubIntegration.esm.js.map +1 -1
  48. package/dist/github/SingleInstanceGithubCredentialsProvider.esm.js +22 -40
  49. package/dist/github/SingleInstanceGithubCredentialsProvider.esm.js.map +1 -1
  50. package/dist/github/config.esm.js +3 -4
  51. package/dist/github/config.esm.js.map +1 -1
  52. package/dist/github/deprecated.esm.js +1 -7
  53. package/dist/github/deprecated.esm.js.map +1 -1
  54. package/dist/gitlab/GitLabIntegration.esm.js +11 -19
  55. package/dist/gitlab/GitLabIntegration.esm.js.map +1 -1
  56. package/dist/gitlab/SingleInstanceGitlabCredentialsProvider.esm.js +5 -12
  57. package/dist/gitlab/SingleInstanceGitlabCredentialsProvider.esm.js.map +1 -1
  58. package/dist/gitlab/config.esm.js +1 -2
  59. package/dist/gitlab/config.esm.js.map +1 -1
  60. package/dist/harness/HarnessIntegration.esm.js +10 -18
  61. package/dist/harness/HarnessIntegration.esm.js.map +1 -1
  62. package/dist/harness/core.esm.js +48 -46
  63. package/dist/harness/core.esm.js.map +1 -1
  64. package/dist/index.cjs.js +323 -471
  65. package/dist/index.cjs.js.map +1 -1
  66. package/dist/index.d.ts +50 -2
  67. package/dist/index.esm.js +1 -1
  68. package/package.json +2 -2
package/dist/index.cjs.js CHANGED
@@ -72,9 +72,8 @@ function defaultScmResolveUrl(options) {
72
72
 
73
73
  const AMAZON_AWS_HOST = "amazonaws.com";
74
74
  function readAwsS3IntegrationConfig(config) {
75
- var _a, _b;
76
75
  const endpoint = config.getOptionalString("endpoint");
77
- const s3ForcePathStyle = (_a = config.getOptionalBoolean("s3ForcePathStyle")) != null ? _a : false;
76
+ const s3ForcePathStyle = config.getOptionalBoolean("s3ForcePathStyle") ?? false;
78
77
  let host;
79
78
  let pathname;
80
79
  if (endpoint) {
@@ -96,7 +95,7 @@ function readAwsS3IntegrationConfig(config) {
96
95
  host = AMAZON_AWS_HOST;
97
96
  }
98
97
  const accessKeyId = config.getOptionalString("accessKeyId");
99
- const secretAccessKey = (_b = config.getOptionalString("secretAccessKey")) == null ? void 0 : _b.trim();
98
+ const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
100
99
  const roleArn = config.getOptionalString("roleArn");
101
100
  const externalId = config.getOptionalString("externalId");
102
101
  return {
@@ -119,16 +118,19 @@ function readAwsS3IntegrationConfigs(configs) {
119
118
  return result;
120
119
  }
121
120
 
122
- var __defProp$f = Object.defineProperty;
123
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
124
- var __publicField$f = (obj, key, value) => {
125
- __defNormalProp$f(obj, key + "" , value);
126
- return value;
127
- };
128
- const _AwsS3Integration = class _AwsS3Integration {
121
+ class AwsS3Integration {
129
122
  constructor(integrationConfig) {
130
123
  this.integrationConfig = integrationConfig;
131
124
  }
125
+ static factory = ({ config }) => {
126
+ const configs = readAwsS3IntegrationConfigs(
127
+ config.getOptionalConfigArray("integrations.awsS3") ?? []
128
+ );
129
+ return basicIntegrations(
130
+ configs.map((c) => new AwsS3Integration(c)),
131
+ (i) => i.config.host
132
+ );
133
+ };
132
134
  get type() {
133
135
  return "awsS3";
134
136
  }
@@ -145,24 +147,12 @@ const _AwsS3Integration = class _AwsS3Integration {
145
147
  resolveEditUrl(url) {
146
148
  return url;
147
149
  }
148
- };
149
- __publicField$f(_AwsS3Integration, "factory", ({ config }) => {
150
- var _a;
151
- const configs = readAwsS3IntegrationConfigs(
152
- (_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []
153
- );
154
- return basicIntegrations(
155
- configs.map((c) => new _AwsS3Integration(c)),
156
- (i) => i.config.host
157
- );
158
- });
159
- let AwsS3Integration = _AwsS3Integration;
150
+ }
160
151
 
161
152
  const AMAZON_AWS_CODECOMMIT_HOST = "console.aws.amazon.com";
162
153
  function readAwsCodeCommitIntegrationConfig(config) {
163
- var _a;
164
154
  const accessKeyId = config.getOptionalString("accessKeyId");
165
- const secretAccessKey = (_a = config.getOptionalString("secretAccessKey")) == null ? void 0 : _a.trim();
155
+ const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
166
156
  const roleArn = config.getOptionalString("roleArn");
167
157
  const externalId = config.getOptionalString("externalId");
168
158
  const host = AMAZON_AWS_CODECOMMIT_HOST;
@@ -184,16 +174,21 @@ function readAwsCodeCommitIntegrationConfigs(configs) {
184
174
  return result;
185
175
  }
186
176
 
187
- var __defProp$e = Object.defineProperty;
188
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
189
- var __publicField$e = (obj, key, value) => {
190
- __defNormalProp$e(obj, key + "" , value);
191
- return value;
192
- };
193
- const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
177
+ class AwsCodeCommitIntegration {
194
178
  constructor(integrationConfig) {
195
179
  this.integrationConfig = integrationConfig;
196
180
  }
181
+ static factory = ({
182
+ config
183
+ }) => {
184
+ const configs = readAwsCodeCommitIntegrationConfigs(
185
+ config.getOptionalConfigArray("integrations.awsCodeCommit") ?? []
186
+ );
187
+ return basicIntegrations(
188
+ configs.map((c) => new AwsCodeCommitIntegration(c)),
189
+ (i) => i.config.host
190
+ );
191
+ };
197
192
  get type() {
198
193
  return "awsCodeCommit";
199
194
  }
@@ -218,20 +213,7 @@ const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
218
213
  const [, repositoryName] = pathMatch;
219
214
  return replaceCodeCommitUrlType(url, repositoryName);
220
215
  }
221
- };
222
- __publicField$e(_AwsCodeCommitIntegration, "factory", ({
223
- config
224
- }) => {
225
- var _a;
226
- const configs = readAwsCodeCommitIntegrationConfigs(
227
- (_a = config.getOptionalConfigArray("integrations.awsCodeCommit")) != null ? _a : []
228
- );
229
- return basicIntegrations(
230
- configs.map((c) => new _AwsCodeCommitIntegration(c)),
231
- (i) => i.config.host
232
- );
233
- });
234
- let AwsCodeCommitIntegration = _AwsCodeCommitIntegration;
216
+ }
235
217
  function replaceCodeCommitUrlType(url, repositoryName, type) {
236
218
  const newString = `files/edit` ;
237
219
  return url.replace(
@@ -242,53 +224,14 @@ function replaceCodeCommitUrlType(url, repositoryName, type) {
242
224
  );
243
225
  }
244
226
 
245
- var __accessCheck = (obj, member, msg) => {
246
- if (!member.has(obj))
247
- throw TypeError("Cannot " + msg);
248
- };
249
- var __privateGet = (obj, member, getter) => {
250
- __accessCheck(obj, member, "read from private field");
251
- return member.get(obj);
252
- };
253
- var __privateAdd = (obj, member, value) => {
254
- if (member.has(obj))
255
- throw TypeError("Cannot add the same private member more than once");
256
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
257
- };
258
- var __privateSet = (obj, member, value, setter) => {
259
- __accessCheck(obj, member, "write to private field");
260
- member.set(obj, value);
261
- return value;
262
- };
263
- var _origin, _owner, _project, _repo, _path, _ref, _baseUrl;
264
227
  const VERSION_PREFIX_GIT_BRANCH = "GB";
265
- const _AzureUrl = class _AzureUrl {
266
- constructor(origin, owner, project, repo, path, ref) {
267
- __privateAdd(this, _origin, void 0);
268
- __privateAdd(this, _owner, void 0);
269
- __privateAdd(this, _project, void 0);
270
- __privateAdd(this, _repo, void 0);
271
- __privateAdd(this, _path, void 0);
272
- __privateAdd(this, _ref, void 0);
273
- __privateAdd(this, _baseUrl, (...parts) => {
274
- const url = new URL(__privateGet(this, _origin));
275
- url.pathname = parts.map((part) => encodeURIComponent(part)).join("/");
276
- return url;
277
- });
278
- __privateSet(this, _origin, origin);
279
- __privateSet(this, _owner, owner);
280
- __privateSet(this, _project, project);
281
- __privateSet(this, _repo, repo);
282
- __privateSet(this, _path, path);
283
- __privateSet(this, _ref, ref);
284
- }
228
+ class AzureUrl {
285
229
  /**
286
230
  * Parses an azure URL as copied from the browser address bar.
287
231
  *
288
232
  * Throws an error if the URL is not a valid azure repo URL.
289
233
  */
290
234
  static fromRepoUrl(repoUrl) {
291
- var _a;
292
235
  const url = new URL(repoUrl);
293
236
  let owner;
294
237
  let project;
@@ -309,7 +252,7 @@ const _AzureUrl = class _AzureUrl {
309
252
  if (!owner || !project || !repo) {
310
253
  throw new Error("Azure URL must point to a git repository");
311
254
  }
312
- const path = (_a = url.searchParams.get("path")) != null ? _a : void 0;
255
+ const path = url.searchParams.get("path") ?? void 0;
313
256
  let ref;
314
257
  const version = url.searchParams.get("version");
315
258
  if (version) {
@@ -319,8 +262,27 @@ const _AzureUrl = class _AzureUrl {
319
262
  }
320
263
  ref = version.slice(2);
321
264
  }
322
- return new _AzureUrl(url.origin, owner, project, repo, path, ref);
323
- }
265
+ return new AzureUrl(url.origin, owner, project, repo, path, ref);
266
+ }
267
+ #origin;
268
+ #owner;
269
+ #project;
270
+ #repo;
271
+ #path;
272
+ #ref;
273
+ constructor(origin, owner, project, repo, path, ref) {
274
+ this.#origin = origin;
275
+ this.#owner = owner;
276
+ this.#project = project;
277
+ this.#repo = repo;
278
+ this.#path = path;
279
+ this.#ref = ref;
280
+ }
281
+ #baseUrl = (...parts) => {
282
+ const url = new URL(this.#origin);
283
+ url.pathname = parts.map((part) => encodeURIComponent(part)).join("/");
284
+ return url;
285
+ };
324
286
  /**
325
287
  * Returns a repo URL that can be used to navigate to the resource in azure.
326
288
  *
@@ -328,16 +290,16 @@ const _AzureUrl = class _AzureUrl {
328
290
  */
329
291
  toRepoUrl() {
330
292
  let url;
331
- if (__privateGet(this, _project) === __privateGet(this, _repo)) {
332
- url = __privateGet(this, _baseUrl).call(this, __privateGet(this, _owner), "_git", __privateGet(this, _repo));
293
+ if (this.#project === this.#repo) {
294
+ url = this.#baseUrl(this.#owner, "_git", this.#repo);
333
295
  } else {
334
- url = __privateGet(this, _baseUrl).call(this, __privateGet(this, _owner), __privateGet(this, _project), "_git", __privateGet(this, _repo));
296
+ url = this.#baseUrl(this.#owner, this.#project, "_git", this.#repo);
335
297
  }
336
- if (__privateGet(this, _path)) {
337
- url.searchParams.set("path", __privateGet(this, _path));
298
+ if (this.#path) {
299
+ url.searchParams.set("path", this.#path);
338
300
  }
339
- if (__privateGet(this, _ref)) {
340
- url.searchParams.set("version", VERSION_PREFIX_GIT_BRANCH + __privateGet(this, _ref));
301
+ if (this.#ref) {
302
+ url.searchParams.set("version", VERSION_PREFIX_GIT_BRANCH + this.#ref);
341
303
  }
342
304
  return url.toString();
343
305
  }
@@ -347,16 +309,24 @@ const _AzureUrl = class _AzureUrl {
347
309
  * Throws an error if the URL does not point to a file.
348
310
  */
349
311
  toFileUrl() {
350
- if (!__privateGet(this, _path)) {
312
+ if (!this.#path) {
351
313
  throw new Error(
352
314
  "Azure URL must point to a specific path to be able to download a file"
353
315
  );
354
316
  }
355
- const url = __privateGet(this, _baseUrl).call(this, __privateGet(this, _owner), __privateGet(this, _project), "_apis", "git", "repositories", __privateGet(this, _repo), "items");
317
+ const url = this.#baseUrl(
318
+ this.#owner,
319
+ this.#project,
320
+ "_apis",
321
+ "git",
322
+ "repositories",
323
+ this.#repo,
324
+ "items"
325
+ );
356
326
  url.searchParams.set("api-version", "6.0");
357
- url.searchParams.set("path", __privateGet(this, _path));
358
- if (__privateGet(this, _ref)) {
359
- url.searchParams.set("version", __privateGet(this, _ref));
327
+ url.searchParams.set("path", this.#path);
328
+ if (this.#ref) {
329
+ url.searchParams.set("version", this.#ref);
360
330
  }
361
331
  return url.toString();
362
332
  }
@@ -366,15 +336,23 @@ const _AzureUrl = class _AzureUrl {
366
336
  * Throws an error if the URL does not point to a repo.
367
337
  */
368
338
  toArchiveUrl() {
369
- const url = __privateGet(this, _baseUrl).call(this, __privateGet(this, _owner), __privateGet(this, _project), "_apis", "git", "repositories", __privateGet(this, _repo), "items");
339
+ const url = this.#baseUrl(
340
+ this.#owner,
341
+ this.#project,
342
+ "_apis",
343
+ "git",
344
+ "repositories",
345
+ this.#repo,
346
+ "items"
347
+ );
370
348
  url.searchParams.set("recursionLevel", "full");
371
349
  url.searchParams.set("download", "true");
372
350
  url.searchParams.set("api-version", "6.0");
373
- if (__privateGet(this, _path)) {
374
- url.searchParams.set("scopePath", __privateGet(this, _path));
351
+ if (this.#path) {
352
+ url.searchParams.set("scopePath", this.#path);
375
353
  }
376
- if (__privateGet(this, _ref)) {
377
- url.searchParams.set("version", __privateGet(this, _ref));
354
+ if (this.#ref) {
355
+ url.searchParams.set("version", this.#ref);
378
356
  }
379
357
  return url.toString();
380
358
  }
@@ -384,10 +362,18 @@ const _AzureUrl = class _AzureUrl {
384
362
  * Throws an error if the URL does not point to a commit.
385
363
  */
386
364
  toCommitsUrl() {
387
- const url = __privateGet(this, _baseUrl).call(this, __privateGet(this, _owner), __privateGet(this, _project), "_apis", "git", "repositories", __privateGet(this, _repo), "commits");
365
+ const url = this.#baseUrl(
366
+ this.#owner,
367
+ this.#project,
368
+ "_apis",
369
+ "git",
370
+ "repositories",
371
+ this.#repo,
372
+ "commits"
373
+ );
388
374
  url.searchParams.set("api-version", "6.0");
389
- if (__privateGet(this, _ref)) {
390
- url.searchParams.set("searchCriteria.itemVersion.version", __privateGet(this, _ref));
375
+ if (this.#ref) {
376
+ url.searchParams.set("searchCriteria.itemVersion.version", this.#ref);
391
377
  }
392
378
  return url.toString();
393
379
  }
@@ -395,41 +381,33 @@ const _AzureUrl = class _AzureUrl {
395
381
  * Returns the name of the owner, a user or an organization.
396
382
  */
397
383
  getOwner() {
398
- return __privateGet(this, _owner);
384
+ return this.#owner;
399
385
  }
400
386
  /**
401
387
  * Returns the name of the project.
402
388
  */
403
389
  getProject() {
404
- return __privateGet(this, _project);
390
+ return this.#project;
405
391
  }
406
392
  /**
407
393
  * Returns the name of the repo.
408
394
  */
409
395
  getRepo() {
410
- return __privateGet(this, _repo);
396
+ return this.#repo;
411
397
  }
412
398
  /**
413
399
  * Returns the file path within the repo if the URL contains one.
414
400
  */
415
401
  getPath() {
416
- return __privateGet(this, _path);
402
+ return this.#path;
417
403
  }
418
404
  /**
419
405
  * Returns the git ref in the repo if the URL contains one.
420
406
  */
421
407
  getRef() {
422
- return __privateGet(this, _ref);
408
+ return this.#ref;
423
409
  }
424
- };
425
- _origin = new WeakMap();
426
- _owner = new WeakMap();
427
- _project = new WeakMap();
428
- _repo = new WeakMap();
429
- _path = new WeakMap();
430
- _ref = new WeakMap();
431
- _baseUrl = new WeakMap();
432
- let AzureUrl = _AzureUrl;
410
+ }
433
411
 
434
412
  const AZURE_HOST = "dev.azure.com";
435
413
  const AzureDevOpsCredentialFields = [
@@ -463,20 +441,18 @@ function asAzureDevOpsCredential(credential) {
463
441
  throw new Error("is not a valid credential");
464
442
  }
465
443
  function readAzureIntegrationConfig(config) {
466
- var _a, _b, _c, _d, _e, _f, _g;
467
- const host = (_a = config.getOptionalString("host")) != null ? _a : AZURE_HOST;
468
- let credentialConfigs = (_b = config.getOptionalConfigArray("credentials")) == null ? void 0 : _b.map((credential) => {
469
- var _a2, _b2;
444
+ const host = config.getOptionalString("host") ?? AZURE_HOST;
445
+ let credentialConfigs = config.getOptionalConfigArray("credentials")?.map((credential) => {
470
446
  const result = {
471
447
  organizations: credential.getOptionalStringArray("organizations"),
472
- personalAccessToken: (_a2 = credential.getOptionalString("personalAccessToken")) == null ? void 0 : _a2.trim(),
448
+ personalAccessToken: credential.getOptionalString("personalAccessToken")?.trim(),
473
449
  tenantId: credential.getOptionalString("tenantId"),
474
450
  clientId: credential.getOptionalString("clientId"),
475
- clientSecret: (_b2 = credential.getOptionalString("clientSecret")) == null ? void 0 : _b2.trim()
451
+ clientSecret: credential.getOptionalString("clientSecret")?.trim()
476
452
  };
477
453
  return result;
478
454
  });
479
- const token = (_c = config.getOptionalString("token")) == null ? void 0 : _c.trim();
455
+ const token = config.getOptionalString("token")?.trim();
480
456
  if (config.getOptional("credential") !== void 0 && config.getOptional("credentials") !== void 0) {
481
457
  throw new Error(
482
458
  `Invalid Azure integration config, 'credential' and 'credentials' cannot be used together. Use 'credentials' instead.`
@@ -489,7 +465,7 @@ function readAzureIntegrationConfig(config) {
489
465
  }
490
466
  if (token !== void 0) {
491
467
  const mapped = [{ personalAccessToken: token }];
492
- credentialConfigs = (_d = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _d : mapped;
468
+ credentialConfigs = credentialConfigs?.concat(mapped) ?? mapped;
493
469
  }
494
470
  if (config.getOptional("credential") !== void 0) {
495
471
  const mapped = [
@@ -497,13 +473,13 @@ function readAzureIntegrationConfig(config) {
497
473
  organizations: config.getOptionalStringArray(
498
474
  "credential.organizations"
499
475
  ),
500
- token: (_e = config.getOptionalString("credential.token")) == null ? void 0 : _e.trim(),
476
+ token: config.getOptionalString("credential.token")?.trim(),
501
477
  tenantId: config.getOptionalString("credential.tenantId"),
502
478
  clientId: config.getOptionalString("credential.clientId"),
503
- clientSecret: (_f = config.getOptionalString("credential.clientSecret")) == null ? void 0 : _f.trim()
479
+ clientSecret: config.getOptionalString("credential.clientSecret")?.trim()
504
480
  }
505
481
  ];
506
- credentialConfigs = (_g = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _g : mapped;
482
+ credentialConfigs = credentialConfigs?.concat(mapped) ?? mapped;
507
483
  }
508
484
  if (!isValidHost(host)) {
509
485
  throw new Error(
@@ -512,7 +488,7 @@ function readAzureIntegrationConfig(config) {
512
488
  }
513
489
  let credentials = void 0;
514
490
  if (credentialConfigs !== void 0) {
515
- const errors = credentialConfigs == null ? void 0 : credentialConfigs.reduce((acc, credentialConfig, index) => {
491
+ const errors = credentialConfigs?.reduce((acc, credentialConfig, index) => {
516
492
  let error = void 0;
517
493
  try {
518
494
  asAzureDevOpsCredential(credentialConfig);
@@ -528,8 +504,7 @@ function readAzureIntegrationConfig(config) {
528
504
  credentialConfigs.filter(
529
505
  (credential) => credential.organizations !== void 0 && credential.organizations.length > 0
530
506
  ).reduce((acc, credential, index) => {
531
- var _a2;
532
- (_a2 = credential.organizations) == null ? void 0 : _a2.forEach((organization) => {
507
+ credential.organizations?.forEach((organization) => {
533
508
  if (!acc[organization]) {
534
509
  acc[organization] = [];
535
510
  }
@@ -544,7 +519,7 @@ function readAzureIntegrationConfig(config) {
544
519
  return acc;
545
520
  }, Array.of())
546
521
  );
547
- if ((errors == null ? void 0 : errors.length) > 0) {
522
+ if (errors?.length > 0) {
548
523
  throw new Error(
549
524
  `Invalid Azure integration config for ${host}: ${errors.join("; ")}`
550
525
  );
@@ -580,16 +555,19 @@ function readAzureIntegrationConfigs(configs) {
580
555
  return result;
581
556
  }
582
557
 
583
- var __defProp$d = Object.defineProperty;
584
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
585
- var __publicField$d = (obj, key, value) => {
586
- __defNormalProp$d(obj, key + "" , value);
587
- return value;
588
- };
589
- const _AzureIntegration = class _AzureIntegration {
558
+ class AzureIntegration {
590
559
  constructor(integrationConfig) {
591
560
  this.integrationConfig = integrationConfig;
592
561
  }
562
+ static factory = ({ config }) => {
563
+ const configs = readAzureIntegrationConfigs(
564
+ config.getOptionalConfigArray("integrations.azure") ?? []
565
+ );
566
+ return basicIntegrations(
567
+ configs.map((c) => new AzureIntegration(c)),
568
+ (i) => i.config.host
569
+ );
570
+ };
593
571
  get type() {
594
572
  return "azure";
595
573
  }
@@ -605,7 +583,6 @@ const _AzureIntegration = class _AzureIntegration {
605
583
  * Example base URL: https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml
606
584
  */
607
585
  resolveUrl(options) {
608
- var _a;
609
586
  const { url, base } = options;
610
587
  if (isValidUrl(url)) {
611
588
  return url;
@@ -613,7 +590,7 @@ const _AzureIntegration = class _AzureIntegration {
613
590
  try {
614
591
  const azureUrl = AzureUrl.fromRepoUrl(base);
615
592
  const newUrl = new URL(base);
616
- const mockBaseUrl = new URL(`https://a.com${(_a = azureUrl.getPath()) != null ? _a : ""}`);
593
+ const mockBaseUrl = new URL(`https://a.com${azureUrl.getPath() ?? ""}`);
617
594
  const updatedPath = new URL(url, mockBaseUrl).pathname;
618
595
  newUrl.searchParams.set("path", updatedPath);
619
596
  if (options.lineNumber) {
@@ -630,18 +607,7 @@ const _AzureIntegration = class _AzureIntegration {
630
607
  resolveEditUrl(url) {
631
608
  return url;
632
609
  }
633
- };
634
- __publicField$d(_AzureIntegration, "factory", ({ config }) => {
635
- var _a;
636
- const configs = readAzureIntegrationConfigs(
637
- (_a = config.getOptionalConfigArray("integrations.azure")) != null ? _a : []
638
- );
639
- return basicIntegrations(
640
- configs.map((c) => new _AzureIntegration(c)),
641
- (i) => i.config.host
642
- );
643
- });
644
- let AzureIntegration = _AzureIntegration;
610
+ }
645
611
 
646
612
  function getAzureFileFetchUrl(url) {
647
613
  return AzureUrl.fromRepoUrl(url).toFileUrl();
@@ -653,19 +619,13 @@ function getAzureCommitsUrl(url) {
653
619
  return AzureUrl.fromRepoUrl(url).toCommitsUrl();
654
620
  }
655
621
 
656
- var __defProp$c = Object.defineProperty;
657
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
658
- var __publicField$c = (obj, key, value) => {
659
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
660
- return value;
661
- };
662
622
  const tenMinutes = 1e3 * 60 * 10;
663
623
  class CachedAzureDevOpsCredentialsProvider {
664
624
  constructor(credential) {
665
625
  this.credential = credential;
666
- __publicField$c(this, "azureDevOpsScope", "499b84ac-1321-427f-aa17-267ca6975798/.default");
667
- __publicField$c(this, "cached");
668
626
  }
627
+ azureDevOpsScope = "499b84ac-1321-427f-aa17-267ca6975798/.default";
628
+ cached;
669
629
  static fromAzureDevOpsCredential(credential) {
670
630
  switch (credential.kind) {
671
631
  case "PersonalAccessToken":
@@ -735,9 +695,7 @@ class DefaultAzureDevOpsCredentialsProvider {
735
695
  }
736
696
  static fromIntegrations(integrations) {
737
697
  const providers = integrations.azure.list().reduce((acc, integration) => {
738
- var _a;
739
- (_a = integration.config.credentials) == null ? void 0 : _a.forEach((credential) => {
740
- var _a2;
698
+ integration.config.credentials?.forEach((credential) => {
741
699
  if (credential.organizations === void 0 || credential.organizations.length === 0) {
742
700
  if (acc.get(integration.config.host) === void 0) {
743
701
  acc.set(
@@ -751,7 +709,7 @@ class DefaultAzureDevOpsCredentialsProvider {
751
709
  const provider = CachedAzureDevOpsCredentialsProvider.fromAzureDevOpsCredential(
752
710
  credential
753
711
  );
754
- (_a2 = credential.organizations) == null ? void 0 : _a2.forEach((organization) => {
712
+ credential.organizations?.forEach((organization) => {
755
713
  acc.set(`${integration.config.host}/${organization}`, provider);
756
714
  });
757
715
  }
@@ -790,9 +748,8 @@ class DefaultAzureDevOpsCredentialsProvider {
790
748
  return this.providers.get(url.host);
791
749
  }
792
750
  async getCredentials(opts) {
793
- var _a, _b;
794
751
  const url = new URL(opts.url);
795
- const provider = (_b = (_a = this.forAzureDevOpsOrganization(url)) != null ? _a : this.forAzureDevOpsServerOrganization(url)) != null ? _b : this.forHost(url);
752
+ const provider = this.forAzureDevOpsOrganization(url) ?? this.forAzureDevOpsServerOrganization(url) ?? this.forHost(url);
796
753
  if (provider === void 0) {
797
754
  return void 0;
798
755
  }
@@ -801,9 +758,8 @@ class DefaultAzureDevOpsCredentialsProvider {
801
758
  }
802
759
 
803
760
  async function getAzureRequestOptions(config, additionalHeaders) {
804
- var _a;
805
761
  const headers = additionalHeaders ? { ...additionalHeaders } : {};
806
- const credentialConfig = (_a = config.credentials) == null ? void 0 : _a.filter(
762
+ const credentialConfig = config.credentials?.filter(
807
763
  (credential) => credential.organizations === void 0 || credential.organizations.length === 0
808
764
  )[0];
809
765
  if (credentialConfig) {
@@ -813,7 +769,7 @@ async function getAzureRequestOptions(config, additionalHeaders) {
813
769
  const credentials = await credentialsProvider.getCredentials();
814
770
  return {
815
771
  headers: {
816
- ...credentials == null ? void 0 : credentials.headers,
772
+ ...credentials?.headers,
817
773
  ...headers
818
774
  }
819
775
  };
@@ -824,12 +780,11 @@ async function getAzureRequestOptions(config, additionalHeaders) {
824
780
  const BITBUCKET_HOST = "bitbucket.org";
825
781
  const BITBUCKET_API_BASE_URL = "https://api.bitbucket.org/2.0";
826
782
  function readBitbucketIntegrationConfig(config) {
827
- var _a, _b, _c;
828
- const host = (_a = config.getOptionalString("host")) != null ? _a : BITBUCKET_HOST;
783
+ const host = config.getOptionalString("host") ?? BITBUCKET_HOST;
829
784
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
830
- const token = (_b = config.getOptionalString("token")) == null ? void 0 : _b.trim();
785
+ const token = config.getOptionalString("token")?.trim();
831
786
  const username = config.getOptionalString("username");
832
- const appPassword = (_c = config.getOptionalString("appPassword")) == null ? void 0 : _c.trim();
787
+ const appPassword = config.getOptionalString("appPassword")?.trim();
833
788
  if (!isValidHost(host)) {
834
789
  throw new Error(
835
790
  `Invalid Bitbucket integration config, '${host}' is not a valid host`
@@ -861,16 +816,27 @@ function readBitbucketIntegrationConfigs(configs) {
861
816
  return result;
862
817
  }
863
818
 
864
- var __defProp$b = Object.defineProperty;
865
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
866
- var __publicField$b = (obj, key, value) => {
867
- __defNormalProp$b(obj, key + "" , value);
868
- return value;
869
- };
870
- const _BitbucketIntegration = class _BitbucketIntegration {
819
+ class BitbucketIntegration {
871
820
  constructor(integrationConfig) {
872
821
  this.integrationConfig = integrationConfig;
873
822
  }
823
+ static factory = ({
824
+ config
825
+ }) => {
826
+ const configs = readBitbucketIntegrationConfigs(
827
+ config.getOptionalConfigArray("integrations.bitbucket") ?? [
828
+ // if integrations.bitbucket was not used assume the use was migrated to the new configs
829
+ // and backport for the deprecated integration to be usable for other parts of the system
830
+ // until these got migrated
831
+ ...config.getOptionalConfigArray("integrations.bitbucketCloud") ?? [],
832
+ ...config.getOptionalConfigArray("integrations.bitbucketServer") ?? []
833
+ ]
834
+ );
835
+ return basicIntegrations(
836
+ configs.map((c) => new BitbucketIntegration(c)),
837
+ (i) => i.config.host
838
+ );
839
+ };
874
840
  get type() {
875
841
  return "bitbucket";
876
842
  }
@@ -901,26 +867,7 @@ const _BitbucketIntegration = class _BitbucketIntegration {
901
867
  editUrl.searchParams.set("at", urlData.ref);
902
868
  return editUrl.toString();
903
869
  }
904
- };
905
- __publicField$b(_BitbucketIntegration, "factory", ({
906
- config
907
- }) => {
908
- var _a, _b, _c;
909
- const configs = readBitbucketIntegrationConfigs(
910
- (_c = config.getOptionalConfigArray("integrations.bitbucket")) != null ? _c : [
911
- // if integrations.bitbucket was not used assume the use was migrated to the new configs
912
- // and backport for the deprecated integration to be usable for other parts of the system
913
- // until these got migrated
914
- ...(_a = config.getOptionalConfigArray("integrations.bitbucketCloud")) != null ? _a : [],
915
- ...(_b = config.getOptionalConfigArray("integrations.bitbucketServer")) != null ? _b : []
916
- ]
917
- );
918
- return basicIntegrations(
919
- configs.map((c) => new _BitbucketIntegration(c)),
920
- (i) => i.config.host
921
- );
922
- });
923
- let BitbucketIntegration = _BitbucketIntegration;
870
+ }
924
871
 
925
872
  async function getBitbucketDefaultBranch(url, config) {
926
873
  const { name: repoName, owner: project, resource } = parseGitUrl__default.default(url);
@@ -1005,11 +952,10 @@ function getBitbucketRequestOptions(config) {
1005
952
  const BITBUCKET_CLOUD_HOST = "bitbucket.org";
1006
953
  const BITBUCKET_CLOUD_API_BASE_URL = "https://api.bitbucket.org/2.0";
1007
954
  function readBitbucketCloudIntegrationConfig(config) {
1008
- var _a;
1009
955
  const host = BITBUCKET_CLOUD_HOST;
1010
956
  const apiBaseUrl = BITBUCKET_CLOUD_API_BASE_URL;
1011
957
  const username = config.getString("username");
1012
- const appPassword = (_a = config.getString("appPassword")) == null ? void 0 : _a.trim();
958
+ const appPassword = config.getString("appPassword")?.trim();
1013
959
  return {
1014
960
  host,
1015
961
  apiBaseUrl,
@@ -1028,16 +974,21 @@ function readBitbucketCloudIntegrationConfigs(configs) {
1028
974
  return result;
1029
975
  }
1030
976
 
1031
- var __defProp$a = Object.defineProperty;
1032
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1033
- var __publicField$a = (obj, key, value) => {
1034
- __defNormalProp$a(obj, key + "" , value);
1035
- return value;
1036
- };
1037
- const _BitbucketCloudIntegration = class _BitbucketCloudIntegration {
977
+ class BitbucketCloudIntegration {
1038
978
  constructor(integrationConfig) {
1039
979
  this.integrationConfig = integrationConfig;
1040
980
  }
981
+ static factory = ({
982
+ config
983
+ }) => {
984
+ const configs = readBitbucketCloudIntegrationConfigs(
985
+ config.getOptionalConfigArray("integrations.bitbucketCloud") ?? []
986
+ );
987
+ return basicIntegrations(
988
+ configs.map((c) => new BitbucketCloudIntegration(c)),
989
+ (i) => i.config.host
990
+ );
991
+ };
1041
992
  get type() {
1042
993
  return "bitbucketCloud";
1043
994
  }
@@ -1063,20 +1014,7 @@ const _BitbucketCloudIntegration = class _BitbucketCloudIntegration {
1063
1014
  editUrl.searchParams.set("at", urlData.ref);
1064
1015
  return editUrl.toString();
1065
1016
  }
1066
- };
1067
- __publicField$a(_BitbucketCloudIntegration, "factory", ({
1068
- config
1069
- }) => {
1070
- var _a;
1071
- const configs = readBitbucketCloudIntegrationConfigs(
1072
- (_a = config.getOptionalConfigArray("integrations.bitbucketCloud")) != null ? _a : []
1073
- );
1074
- return basicIntegrations(
1075
- configs.map((c) => new _BitbucketCloudIntegration(c)),
1076
- (i) => i.config.host
1077
- );
1078
- });
1079
- let BitbucketCloudIntegration = _BitbucketCloudIntegration;
1017
+ }
1080
1018
 
1081
1019
  async function getBitbucketCloudDefaultBranch(url, config) {
1082
1020
  const { name: repoName, owner: project } = parseGitUrl__default.default(url);
@@ -1142,10 +1080,9 @@ function getBitbucketCloudRequestOptions(config) {
1142
1080
  }
1143
1081
 
1144
1082
  function readBitbucketServerIntegrationConfig(config) {
1145
- var _a;
1146
1083
  const host = config.getString("host");
1147
1084
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
1148
- const token = (_a = config.getOptionalString("token")) == null ? void 0 : _a.trim();
1085
+ const token = config.getOptionalString("token")?.trim();
1149
1086
  const username = config.getOptionalString("username");
1150
1087
  const password = config.getOptionalString("password");
1151
1088
  if (!isValidHost(host)) {
@@ -1170,16 +1107,21 @@ function readBitbucketServerIntegrationConfigs(configs) {
1170
1107
  return configs.map(readBitbucketServerIntegrationConfig);
1171
1108
  }
1172
1109
 
1173
- var __defProp$9 = Object.defineProperty;
1174
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1175
- var __publicField$9 = (obj, key, value) => {
1176
- __defNormalProp$9(obj, key + "" , value);
1177
- return value;
1178
- };
1179
- const _BitbucketServerIntegration = class _BitbucketServerIntegration {
1110
+ class BitbucketServerIntegration {
1180
1111
  constructor(integrationConfig) {
1181
1112
  this.integrationConfig = integrationConfig;
1182
1113
  }
1114
+ static factory = ({
1115
+ config
1116
+ }) => {
1117
+ const configs = readBitbucketServerIntegrationConfigs(
1118
+ config.getOptionalConfigArray("integrations.bitbucketServer") ?? []
1119
+ );
1120
+ return basicIntegrations(
1121
+ configs.map((c) => new BitbucketServerIntegration(c)),
1122
+ (i) => i.config.host
1123
+ );
1124
+ };
1183
1125
  get type() {
1184
1126
  return "bitbucketServer";
1185
1127
  }
@@ -1204,20 +1146,7 @@ const _BitbucketServerIntegration = class _BitbucketServerIntegration {
1204
1146
  }
1205
1147
  return url;
1206
1148
  }
1207
- };
1208
- __publicField$9(_BitbucketServerIntegration, "factory", ({
1209
- config
1210
- }) => {
1211
- var _a;
1212
- const configs = readBitbucketServerIntegrationConfigs(
1213
- (_a = config.getOptionalConfigArray("integrations.bitbucketServer")) != null ? _a : []
1214
- );
1215
- return basicIntegrations(
1216
- configs.map((c) => new _BitbucketServerIntegration(c)),
1217
- (i) => i.config.host
1218
- );
1219
- });
1220
- let BitbucketServerIntegration = _BitbucketServerIntegration;
1149
+ }
1221
1150
 
1222
1151
  async function getBitbucketServerDefaultBranch(url, config) {
1223
1152
  const { name: repoName, owner: project } = parseGitUrl__default.default(url);
@@ -1278,13 +1207,12 @@ function getBitbucketServerRequestOptions(config) {
1278
1207
  }
1279
1208
 
1280
1209
  function readGerritIntegrationConfig(config) {
1281
- var _a;
1282
1210
  const host = config.getString("host");
1283
1211
  let baseUrl = config.getOptionalString("baseUrl");
1284
1212
  let cloneUrl = config.getOptionalString("cloneUrl");
1285
1213
  let gitilesBaseUrl = config.getOptionalString("gitilesBaseUrl");
1286
1214
  const username = config.getOptionalString("username");
1287
- const password = (_a = config.getOptionalString("password")) == null ? void 0 : _a.trim();
1215
+ const password = config.getOptionalString("password")?.trim();
1288
1216
  if (!isValidHost(host)) {
1289
1217
  throw new Error(
1290
1218
  `Invalid Gerrit integration config, '${host}' is not a valid host`
@@ -1432,16 +1360,19 @@ async function parseGerritJsonResponse(response) {
1432
1360
  );
1433
1361
  }
1434
1362
 
1435
- var __defProp$8 = Object.defineProperty;
1436
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1437
- var __publicField$8 = (obj, key, value) => {
1438
- __defNormalProp$8(obj, key + "" , value);
1439
- return value;
1440
- };
1441
- const _GerritIntegration = class _GerritIntegration {
1363
+ class GerritIntegration {
1442
1364
  constructor(integrationConfig) {
1443
1365
  this.integrationConfig = integrationConfig;
1444
1366
  }
1367
+ static factory = ({ config }) => {
1368
+ const configs = readGerritIntegrationConfigs(
1369
+ config.getOptionalConfigArray("integrations.gerrit") ?? []
1370
+ );
1371
+ return basicIntegrations(
1372
+ configs.map((c) => new GerritIntegration(c)),
1373
+ (i) => i.config.host
1374
+ );
1375
+ };
1445
1376
  get type() {
1446
1377
  return "gerrit";
1447
1378
  }
@@ -1471,25 +1402,13 @@ const _GerritIntegration = class _GerritIntegration {
1471
1402
  resolveEditUrl(url) {
1472
1403
  return url;
1473
1404
  }
1474
- };
1475
- __publicField$8(_GerritIntegration, "factory", ({ config }) => {
1476
- var _a;
1477
- const configs = readGerritIntegrationConfigs(
1478
- (_a = config.getOptionalConfigArray("integrations.gerrit")) != null ? _a : []
1479
- );
1480
- return basicIntegrations(
1481
- configs.map((c) => new _GerritIntegration(c)),
1482
- (i) => i.config.host
1483
- );
1484
- });
1485
- let GerritIntegration = _GerritIntegration;
1405
+ }
1486
1406
 
1487
1407
  function readGiteaConfig(config) {
1488
- var _a;
1489
1408
  const host = config.getString("host");
1490
1409
  let baseUrl = config.getOptionalString("baseUrl");
1491
1410
  const username = config.getOptionalString("username");
1492
- const password = (_a = config.getOptionalString("password")) == null ? void 0 : _a.trim();
1411
+ const password = config.getOptionalString("password")?.trim();
1493
1412
  if (!isValidHost(host)) {
1494
1413
  throw new Error(
1495
1414
  `Invalid Gitea integration config, '${host}' is not a valid host`
@@ -1546,8 +1465,7 @@ function getGiteaRequestOptions(config) {
1546
1465
  };
1547
1466
  }
1548
1467
  function parseGiteaUrl(config, url) {
1549
- var _a;
1550
- const baseUrl = (_a = config.baseUrl) != null ? _a : `https://${config.host}`;
1468
+ const baseUrl = config.baseUrl ?? `https://${config.host}`;
1551
1469
  try {
1552
1470
  const [_blank, owner, name, _src, _branch, ref, ...path] = url.replace(baseUrl, "").split("/");
1553
1471
  const pathWithoutSlash = path.join("/").replace(/^\//, "");
@@ -1563,16 +1481,18 @@ function parseGiteaUrl(config, url) {
1563
1481
  }
1564
1482
  }
1565
1483
 
1566
- var __defProp$7 = Object.defineProperty;
1567
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1568
- var __publicField$7 = (obj, key, value) => {
1569
- __defNormalProp$7(obj, key + "" , value);
1570
- return value;
1571
- };
1572
- const _GiteaIntegration = class _GiteaIntegration {
1484
+ class GiteaIntegration {
1573
1485
  constructor(config) {
1574
1486
  this.config = config;
1575
1487
  }
1488
+ static factory = ({ config }) => {
1489
+ const configs = config.getOptionalConfigArray("integrations.gitea") ?? [];
1490
+ const giteaConfigs = configs.map((c) => readGiteaConfig(c));
1491
+ return basicIntegrations(
1492
+ giteaConfigs.map((c) => new GiteaIntegration(c)),
1493
+ (gitea) => gitea.config.host
1494
+ );
1495
+ };
1576
1496
  get type() {
1577
1497
  return "gitea";
1578
1498
  }
@@ -1585,28 +1505,17 @@ const _GiteaIntegration = class _GiteaIntegration {
1585
1505
  resolveEditUrl(url) {
1586
1506
  return getGiteaEditContentsUrl(this.config, url);
1587
1507
  }
1588
- };
1589
- __publicField$7(_GiteaIntegration, "factory", ({ config }) => {
1590
- var _a;
1591
- const configs = (_a = config.getOptionalConfigArray("integrations.gitea")) != null ? _a : [];
1592
- const giteaConfigs = configs.map((c) => readGiteaConfig(c));
1593
- return basicIntegrations(
1594
- giteaConfigs.map((c) => new _GiteaIntegration(c)),
1595
- (gitea) => gitea.config.host
1596
- );
1597
- });
1598
- let GiteaIntegration = _GiteaIntegration;
1508
+ }
1599
1509
 
1600
1510
  const GITHUB_HOST = "github.com";
1601
1511
  const GITHUB_API_BASE_URL = "https://api.github.com";
1602
1512
  const GITHUB_RAW_BASE_URL = "https://raw.githubusercontent.com";
1603
1513
  function readGithubIntegrationConfig(config) {
1604
- var _a, _b, _c;
1605
- const host = (_a = config.getOptionalString("host")) != null ? _a : GITHUB_HOST;
1514
+ const host = config.getOptionalString("host") ?? GITHUB_HOST;
1606
1515
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
1607
1516
  let rawBaseUrl = config.getOptionalString("rawBaseUrl");
1608
- const token = (_b = config.getOptionalString("token")) == null ? void 0 : _b.trim();
1609
- const apps = (_c = config.getOptionalConfigArray("apps")) == null ? void 0 : _c.map((c) => ({
1517
+ const token = config.getOptionalString("token")?.trim();
1518
+ const apps = config.getOptionalConfigArray("apps")?.map((c) => ({
1610
1519
  appId: c.getNumber("appId"),
1611
1520
  clientId: c.getString("clientId"),
1612
1521
  clientSecret: c.getString("clientSecret"),
@@ -1679,17 +1588,8 @@ function chooseEndpoint(config, credentials) {
1679
1588
  return "raw";
1680
1589
  }
1681
1590
 
1682
- var __defProp$6 = Object.defineProperty;
1683
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1684
- var __publicField$6 = (obj, key, value) => {
1685
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
1686
- return value;
1687
- };
1688
1591
  class Cache {
1689
- constructor() {
1690
- __publicField$6(this, "tokenCache", /* @__PURE__ */ new Map());
1691
- __publicField$6(this, "isExpired", (date) => luxon.DateTime.local() > date);
1692
- }
1592
+ tokenCache = /* @__PURE__ */ new Map();
1693
1593
  async getOrCreateToken(owner, repo, supplier) {
1694
1594
  let existingInstallationData = this.tokenCache.get(owner);
1695
1595
  if (!existingInstallationData || this.isExpired(existingInstallationData.expiresAt)) {
@@ -1704,6 +1604,7 @@ class Cache {
1704
1604
  }
1705
1605
  return { accessToken: existingInstallationData.token };
1706
1606
  }
1607
+ isExpired = (date) => luxon.DateTime.local() > date;
1707
1608
  appliesToRepo(tokenData, repo) {
1708
1609
  if (repo === void 0) {
1709
1610
  return true;
@@ -1718,13 +1619,13 @@ const HEADERS = {
1718
1619
  Accept: "application/vnd.github.machine-man-preview+json"
1719
1620
  };
1720
1621
  class GithubAppManager {
1622
+ appClient;
1623
+ baseUrl;
1624
+ baseAuthConfig;
1625
+ cache = new Cache();
1626
+ allowedInstallationOwners;
1721
1627
  // undefined allows all installations
1722
1628
  constructor(config, baseUrl) {
1723
- __publicField$6(this, "appClient");
1724
- __publicField$6(this, "baseUrl");
1725
- __publicField$6(this, "baseAuthConfig");
1726
- __publicField$6(this, "cache", new Cache());
1727
- __publicField$6(this, "allowedInstallationOwners");
1728
1629
  this.allowedInstallationOwners = config.allowedInstallationOwners;
1729
1630
  this.baseUrl = baseUrl;
1730
1631
  this.baseAuthConfig = {
@@ -1739,14 +1640,12 @@ class GithubAppManager {
1739
1640
  });
1740
1641
  }
1741
1642
  async getInstallationCredentials(owner, repo) {
1742
- var _a;
1743
1643
  if (this.allowedInstallationOwners) {
1744
- if (!((_a = this.allowedInstallationOwners) == null ? void 0 : _a.includes(owner))) {
1644
+ if (!this.allowedInstallationOwners?.includes(owner)) {
1745
1645
  return { accessToken: void 0 };
1746
1646
  }
1747
1647
  }
1748
1648
  return this.cache.getOrCreateToken(owner, repo, async () => {
1749
- var _a2;
1750
1649
  const { installationId, suspended } = await this.getInstallationData(
1751
1650
  owner
1752
1651
  );
@@ -1766,7 +1665,7 @@ class GithubAppManager {
1766
1665
  const repos = await installationClient.paginate(
1767
1666
  installationClient.apps.listReposAccessibleToInstallation
1768
1667
  );
1769
- const repositories = (_a2 = repos.repositories) != null ? _a2 : repos;
1668
+ const repositories = repos.repositories ?? repos;
1770
1669
  repositoryNames = repositories.map((repository) => repository.name);
1771
1670
  }
1772
1671
  return {
@@ -1782,10 +1681,7 @@ class GithubAppManager {
1782
1681
  async getInstallationData(owner) {
1783
1682
  const allInstallations = await this.getInstallations();
1784
1683
  const installation = allInstallations.find(
1785
- (inst) => {
1786
- var _a;
1787
- return inst.account && "login" in inst.account && ((_a = inst.account.login) == null ? void 0 : _a.toLocaleLowerCase("en-US")) === owner.toLocaleLowerCase("en-US");
1788
- }
1684
+ (inst) => inst.account && "login" in inst.account && inst.account.login?.toLocaleLowerCase("en-US") === owner.toLocaleLowerCase("en-US")
1789
1685
  );
1790
1686
  if (installation) {
1791
1687
  return {
@@ -1801,10 +1697,9 @@ class GithubAppManager {
1801
1697
  }
1802
1698
  }
1803
1699
  class GithubAppCredentialsMux {
1700
+ apps;
1804
1701
  constructor(config) {
1805
- __publicField$6(this, "apps");
1806
- var _a, _b;
1807
- this.apps = (_b = (_a = config.apps) == null ? void 0 : _a.map((ac) => new GithubAppManager(ac, config.apiBaseUrl))) != null ? _b : [];
1702
+ this.apps = config.apps?.map((ac) => new GithubAppManager(ac, config.apiBaseUrl)) ?? [];
1808
1703
  }
1809
1704
  async getAllInstallations() {
1810
1705
  if (!this.apps.length) {
@@ -1828,27 +1723,30 @@ class GithubAppCredentialsMux {
1828
1723
  )
1829
1724
  );
1830
1725
  const result = results.find(
1831
- (resultItem) => {
1832
- var _a;
1833
- return (_a = resultItem.credentials) == null ? void 0 : _a.accessToken;
1834
- }
1726
+ (resultItem) => resultItem.credentials?.accessToken
1835
1727
  );
1836
1728
  if (result) {
1837
1729
  return result.credentials.accessToken;
1838
1730
  }
1839
1731
  const errors = results.map((r) => r.error);
1840
- const notNotFoundError = errors.find((err) => (err == null ? void 0 : err.name) !== "NotFoundError");
1732
+ const notNotFoundError = errors.find((err) => err?.name !== "NotFoundError");
1841
1733
  if (notNotFoundError) {
1842
1734
  throw notNotFoundError;
1843
1735
  }
1844
1736
  return void 0;
1845
1737
  }
1846
1738
  }
1847
- const _SingleInstanceGithubCredentialsProvider = class _SingleInstanceGithubCredentialsProvider {
1739
+ class SingleInstanceGithubCredentialsProvider {
1848
1740
  constructor(githubAppCredentialsMux, token) {
1849
1741
  this.githubAppCredentialsMux = githubAppCredentialsMux;
1850
1742
  this.token = token;
1851
1743
  }
1744
+ static create = (config) => {
1745
+ return new SingleInstanceGithubCredentialsProvider(
1746
+ new GithubAppCredentialsMux(config),
1747
+ config.token
1748
+ );
1749
+ };
1852
1750
  /**
1853
1751
  * Returns {@link GithubCredentials} for a given URL.
1854
1752
  *
@@ -1885,14 +1783,7 @@ const _SingleInstanceGithubCredentialsProvider = class _SingleInstanceGithubCred
1885
1783
  type
1886
1784
  };
1887
1785
  }
1888
- };
1889
- __publicField$6(_SingleInstanceGithubCredentialsProvider, "create", (config) => {
1890
- return new _SingleInstanceGithubCredentialsProvider(
1891
- new GithubAppCredentialsMux(config),
1892
- config.token
1893
- );
1894
- });
1895
- let SingleInstanceGithubCredentialsProvider = _SingleInstanceGithubCredentialsProvider;
1786
+ }
1896
1787
 
1897
1788
  class DefaultGithubCredentialsProvider {
1898
1789
  constructor(providers) {
@@ -1942,16 +1833,19 @@ class DefaultGithubCredentialsProvider {
1942
1833
  }
1943
1834
  }
1944
1835
 
1945
- var __defProp$5 = Object.defineProperty;
1946
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1947
- var __publicField$5 = (obj, key, value) => {
1948
- __defNormalProp$5(obj, key + "" , value);
1949
- return value;
1950
- };
1951
- const _GithubIntegration = class _GithubIntegration {
1836
+ class GithubIntegration {
1952
1837
  constructor(integrationConfig) {
1953
1838
  this.integrationConfig = integrationConfig;
1954
1839
  }
1840
+ static factory = ({ config }) => {
1841
+ const configs = readGithubIntegrationConfigs(
1842
+ config.getOptionalConfigArray("integrations.github") ?? []
1843
+ );
1844
+ return basicIntegrations(
1845
+ configs.map((c) => new GithubIntegration(c)),
1846
+ (i) => i.config.host
1847
+ );
1848
+ };
1955
1849
  get type() {
1956
1850
  return "github";
1957
1851
  }
@@ -1972,18 +1866,7 @@ const _GithubIntegration = class _GithubIntegration {
1972
1866
  isRateLimited: response.status === 429 || response.status === 403 && response.headers.get("x-ratelimit-remaining") === "0"
1973
1867
  };
1974
1868
  }
1975
- };
1976
- __publicField$5(_GithubIntegration, "factory", ({ config }) => {
1977
- var _a;
1978
- const configs = readGithubIntegrationConfigs(
1979
- (_a = config.getOptionalConfigArray("integrations.github")) != null ? _a : []
1980
- );
1981
- return basicIntegrations(
1982
- configs.map((c) => new _GithubIntegration(c)),
1983
- (i) => i.config.host
1984
- );
1985
- });
1986
- let GithubIntegration = _GithubIntegration;
1869
+ }
1987
1870
  function replaceGithubUrlType(url, type) {
1988
1871
  return url.replace(
1989
1872
  /\/\/([^/]+)\/([^/]+)\/([^/]+)\/(blob|tree|edit)\//,
@@ -1993,14 +1876,9 @@ function replaceGithubUrlType(url, type) {
1993
1876
  );
1994
1877
  }
1995
1878
 
1996
- var __defProp$4 = Object.defineProperty;
1997
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1998
- var __publicField$4 = (obj, key, value) => {
1999
- __defNormalProp$4(obj, key + "" , value);
2000
- return value;
2001
- };
2002
1879
  const getGitHubFileFetchUrl = getGithubFileFetchUrl;
2003
1880
  class GitHubIntegration extends GithubIntegration {
1881
+ static factory = GithubIntegration.factory;
2004
1882
  constructor(integrationConfig) {
2005
1883
  super(integrationConfig);
2006
1884
  }
@@ -2008,7 +1886,6 @@ class GitHubIntegration extends GithubIntegration {
2008
1886
  return super.config;
2009
1887
  }
2010
1888
  }
2011
- __publicField$4(GitHubIntegration, "factory", GithubIntegration.factory);
2012
1889
  const readGitHubIntegrationConfig = readGithubIntegrationConfig;
2013
1890
  const readGitHubIntegrationConfigs = readGithubIntegrationConfigs;
2014
1891
  const replaceGitHubUrlType = replaceGithubUrlType;
@@ -2016,10 +1893,9 @@ const replaceGitHubUrlType = replaceGithubUrlType;
2016
1893
  const GITLAB_HOST = "gitlab.com";
2017
1894
  const GITLAB_API_BASE_URL = "https://gitlab.com/api/v4";
2018
1895
  function readGitLabIntegrationConfig(config) {
2019
- var _a;
2020
1896
  const host = config.getString("host");
2021
1897
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
2022
- const token = (_a = config.getOptionalString("token")) == null ? void 0 : _a.trim();
1898
+ const token = config.getOptionalString("token")?.trim();
2023
1899
  let baseUrl = config.getOptionalString("baseUrl");
2024
1900
  if (apiBaseUrl) {
2025
1901
  apiBaseUrl = lodash.trimEnd(apiBaseUrl, "/");
@@ -2129,16 +2005,19 @@ async function getProjectId(target, config) {
2129
2005
  }
2130
2006
  }
2131
2007
 
2132
- var __defProp$3 = Object.defineProperty;
2133
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2134
- var __publicField$3 = (obj, key, value) => {
2135
- __defNormalProp$3(obj, key + "" , value);
2136
- return value;
2137
- };
2138
- const _GitLabIntegration = class _GitLabIntegration {
2008
+ class GitLabIntegration {
2139
2009
  constructor(integrationConfig) {
2140
2010
  this.integrationConfig = integrationConfig;
2141
2011
  }
2012
+ static factory = ({ config }) => {
2013
+ const configs = readGitLabIntegrationConfigs(
2014
+ config.getOptionalConfigArray("integrations.gitlab") ?? []
2015
+ );
2016
+ return basicIntegrations(
2017
+ configs.map((c) => new GitLabIntegration(c)),
2018
+ (i) => i.config.host
2019
+ );
2020
+ };
2142
2021
  get type() {
2143
2022
  return "gitlab";
2144
2023
  }
@@ -2154,32 +2033,18 @@ const _GitLabIntegration = class _GitLabIntegration {
2154
2033
  resolveEditUrl(url) {
2155
2034
  return replaceGitLabUrlType(url, "edit");
2156
2035
  }
2157
- };
2158
- __publicField$3(_GitLabIntegration, "factory", ({ config }) => {
2159
- var _a;
2160
- const configs = readGitLabIntegrationConfigs(
2161
- (_a = config.getOptionalConfigArray("integrations.gitlab")) != null ? _a : []
2162
- );
2163
- return basicIntegrations(
2164
- configs.map((c) => new _GitLabIntegration(c)),
2165
- (i) => i.config.host
2166
- );
2167
- });
2168
- let GitLabIntegration = _GitLabIntegration;
2036
+ }
2169
2037
  function replaceGitLabUrlType(url, type) {
2170
2038
  return url.replace(/\/\-\/(blob|tree|edit)\//, `/-/${type}/`);
2171
2039
  }
2172
2040
 
2173
- var __defProp$2 = Object.defineProperty;
2174
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2175
- var __publicField$2 = (obj, key, value) => {
2176
- __defNormalProp$2(obj, key + "" , value);
2177
- return value;
2178
- };
2179
- const _SingleInstanceGitlabCredentialsProvider = class _SingleInstanceGitlabCredentialsProvider {
2041
+ class SingleInstanceGitlabCredentialsProvider {
2180
2042
  constructor(token) {
2181
2043
  this.token = token;
2182
2044
  }
2045
+ static create = (config) => {
2046
+ return new SingleInstanceGitlabCredentialsProvider(config.token);
2047
+ };
2183
2048
  async getCredentials(_opts) {
2184
2049
  if (!this.token) {
2185
2050
  return {};
@@ -2191,11 +2056,7 @@ const _SingleInstanceGitlabCredentialsProvider = class _SingleInstanceGitlabCred
2191
2056
  token: this.token
2192
2057
  };
2193
2058
  }
2194
- };
2195
- __publicField$2(_SingleInstanceGitlabCredentialsProvider, "create", (config) => {
2196
- return new _SingleInstanceGitlabCredentialsProvider(config.token);
2197
- });
2198
- let SingleInstanceGitlabCredentialsProvider = _SingleInstanceGitlabCredentialsProvider;
2059
+ }
2199
2060
 
2200
2061
  class DefaultGitlabCredentialsProvider {
2201
2062
  constructor(providers) {
@@ -2250,10 +2111,40 @@ function readHarnessConfig(config) {
2250
2111
  }
2251
2112
 
2252
2113
  function getHarnessEditContentsUrl(config, url) {
2114
+ const parsedUrl = parseHarnessUrl(config, url);
2115
+ return `${parsedUrl.baseUrl}/ng/account/${parsedUrl.accountId}/module/code/orgs/${parsedUrl.orgName}/projects/${parsedUrl.projectName}/${parsedUrl.repoName}/files/${parsedUrl.branch}/~/${parsedUrl.path}`;
2116
+ }
2117
+ function getHarnessFileContentsUrl(config, url) {
2118
+ const parsedUrl = parseHarnessUrl(config, url);
2119
+ return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/raw/${parsedUrl.path}?routingId=${parsedUrl.accountId}&git_ref=refs/heads/${parsedUrl.refString}`;
2120
+ }
2121
+ function getHarnessArchiveUrl(config, url) {
2122
+ const parsedUrl = parseHarnessUrl(config, url);
2123
+ return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/archive/${parsedUrl.branch}.zip?routingId=${parsedUrl.accountId}`;
2124
+ }
2125
+ function getHarnessLatestCommitUrl(config, url) {
2126
+ const parsedUrl = parseHarnessUrl(config, url);
2127
+ return `${parsedUrl.baseUrl}/gateway/code/api/v1/repos/${parsedUrl.accountId}/${parsedUrl.orgName}/${parsedUrl.projectName}/${parsedUrl.repoName}/+/content?routingId=${parsedUrl.accountId}&include_commit=true&git_ref=refs/heads/${parsedUrl.branch}`;
2128
+ }
2129
+ function getHarnessRequestOptions(config) {
2130
+ const headers = {};
2131
+ const { token, apiKey } = config;
2132
+ if (apiKey) {
2133
+ headers["x-api-key"] = apiKey;
2134
+ } else if (token) {
2135
+ headers.Authorization = `Bearer ${token}`;
2136
+ }
2137
+ return {
2138
+ headers
2139
+ };
2140
+ }
2141
+ function parseHarnessUrl(config, url) {
2142
+ const baseUrl = `https://${config.host}`;
2253
2143
  try {
2254
- const baseUrl = `https://${config.host}`;
2144
+ const pathUrl = new URL(url);
2145
+ const pathSegments = pathUrl.pathname.split("/").filter((segment) => segment !== "");
2146
+ const urlParts = pathUrl.pathname.split("/");
2255
2147
  const [
2256
- _blank,
2257
2148
  _ng,
2258
2149
  _account,
2259
2150
  accountId,
@@ -2268,68 +2159,42 @@ function getHarnessEditContentsUrl(config, url) {
2268
2159
  _files,
2269
2160
  _ref,
2270
2161
  _branch,
2271
- ...path
2272
- ] = url.replace(baseUrl, "").split("/");
2273
- const pathWithoutSlash = path.join("/").replace(/^\//, "");
2274
- return `${baseUrl}/gateway/code/api/v1/repos/${accountId}/${orgName}/${projectName}/${repoName}/+/edit/${pathWithoutSlash}`;
2275
- } catch (e) {
2276
- throw new Error(`Incorrect URL: ${url}, ${e}`);
2277
- }
2278
- }
2279
- function getHarnessFileContentsUrl(config, url) {
2280
- try {
2281
- const baseUrl = `https://${config.host}`;
2282
- const [
2283
- _blank,
2284
- _ng,
2285
- _account,
2162
+ ..._path
2163
+ ] = pathSegments;
2164
+ const refAndPath = urlParts.slice(
2165
+ urlParts.findIndex((i) => i === "files" || i === "edit") + 1
2166
+ );
2167
+ const refIndex = refAndPath.findIndex((item) => item === "~");
2168
+ const refString = refAndPath.slice(0, refIndex).join("/");
2169
+ const pathWithoutSlash = refIndex !== -1 ? refAndPath.slice(refIndex + 1).join("/").replace(/^\//, "") : "";
2170
+ return {
2171
+ baseUrl,
2286
2172
  accountId,
2287
- _module,
2288
- _moduleName,
2289
- _org,
2290
2173
  orgName,
2291
- _projects,
2292
2174
  projectName,
2293
- _repos,
2175
+ refString,
2176
+ path: pathWithoutSlash,
2294
2177
  repoName,
2295
- _files,
2296
- _ref,
2297
- _branch,
2298
- ...path
2299
- ] = url.replace(baseUrl, "").split("/");
2300
- const urlParts = url.replace(baseUrl, "").split("/");
2301
- const refAndPath = urlParts.slice(13);
2302
- const refIndex = refAndPath.findIndex((item) => item === "~");
2303
- const refString = refAndPath.slice(0, refIndex);
2304
- const pathWithoutSlash = path.join("/").replace(/^\//, "");
2305
- return `${baseUrl}/gateway/code/api/v1/repos/${accountId}/${orgName}/${projectName}/${repoName}/+/raw/${pathWithoutSlash}?routingId=${accountId}&git_ref=${refString}`;
2178
+ refDashStr: refAndPath.slice(0, refIndex).join("-"),
2179
+ branch: refIndex !== -1 ? refAndPath.slice(0, refIndex).join("/") : refAndPath.join("/")
2180
+ };
2306
2181
  } catch (e) {
2307
2182
  throw new Error(`Incorrect URL: ${url}, ${e}`);
2308
2183
  }
2309
2184
  }
2310
- function getHarnessRequestOptions(config) {
2311
- const headers = {};
2312
- const { token, apiKey } = config;
2313
- if (apiKey) {
2314
- headers["x-api-key"] = apiKey;
2315
- } else if (token) {
2316
- headers.Authorization = `Bearer ${token}`;
2317
- }
2318
- return {
2319
- headers
2320
- };
2321
- }
2322
2185
 
2323
- var __defProp$1 = Object.defineProperty;
2324
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2325
- var __publicField$1 = (obj, key, value) => {
2326
- __defNormalProp$1(obj, key + "" , value);
2327
- return value;
2328
- };
2329
- const _HarnessIntegration = class _HarnessIntegration {
2186
+ class HarnessIntegration {
2330
2187
  constructor(config) {
2331
2188
  this.config = config;
2332
2189
  }
2190
+ static factory = ({ config }) => {
2191
+ const configs = config.getOptionalConfigArray("integrations.harness") ?? [];
2192
+ const harnessConfigs = configs.map((c) => readHarnessConfig(c));
2193
+ return basicIntegrations(
2194
+ harnessConfigs.map((c) => new HarnessIntegration(c)),
2195
+ (harness) => harness.config.host
2196
+ );
2197
+ };
2333
2198
  get type() {
2334
2199
  return "harness";
2335
2200
  }
@@ -2342,29 +2207,10 @@ const _HarnessIntegration = class _HarnessIntegration {
2342
2207
  resolveEditUrl(url) {
2343
2208
  return getHarnessEditContentsUrl(this.config, url);
2344
2209
  }
2345
- };
2346
- __publicField$1(_HarnessIntegration, "factory", ({ config }) => {
2347
- var _a;
2348
- const configs = (_a = config.getOptionalConfigArray("integrations.harness")) != null ? _a : [];
2349
- const harnessConfigs = configs.map((c) => readHarnessConfig(c));
2350
- return basicIntegrations(
2351
- harnessConfigs.map((c) => new _HarnessIntegration(c)),
2352
- (harness) => harness.config.host
2353
- );
2354
- });
2355
- let HarnessIntegration = _HarnessIntegration;
2210
+ }
2356
2211
 
2357
- var __defProp = Object.defineProperty;
2358
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2359
- var __publicField = (obj, key, value) => {
2360
- __defNormalProp(obj, key + "" , value);
2361
- return value;
2362
- };
2363
2212
  class ScmIntegrations {
2364
- constructor(integrationsByType) {
2365
- __publicField(this, "byType");
2366
- this.byType = integrationsByType;
2367
- }
2213
+ byType;
2368
2214
  static fromConfig(config) {
2369
2215
  return new ScmIntegrations({
2370
2216
  awsS3: AwsS3Integration.factory({ config }),
@@ -2380,6 +2226,9 @@ class ScmIntegrations {
2380
2226
  harness: HarnessIntegration.factory({ config })
2381
2227
  });
2382
2228
  }
2229
+ constructor(integrationsByType) {
2230
+ this.byType = integrationsByType;
2231
+ }
2383
2232
  get awsS3() {
2384
2233
  return this.byType.awsS3;
2385
2234
  }
@@ -2504,11 +2353,14 @@ exports.getGiteaFileContentsUrl = getGiteaFileContentsUrl;
2504
2353
  exports.getGiteaLatestCommitUrl = getGiteaLatestCommitUrl;
2505
2354
  exports.getGiteaRequestOptions = getGiteaRequestOptions;
2506
2355
  exports.getGithubFileFetchUrl = getGithubFileFetchUrl;
2356
+ exports.getHarnessArchiveUrl = getHarnessArchiveUrl;
2507
2357
  exports.getHarnessFileContentsUrl = getHarnessFileContentsUrl;
2358
+ exports.getHarnessLatestCommitUrl = getHarnessLatestCommitUrl;
2508
2359
  exports.getHarnessRequestOptions = getHarnessRequestOptions;
2509
2360
  exports.parseGerritGitilesUrl = parseGerritGitilesUrl;
2510
2361
  exports.parseGerritJsonResponse = parseGerritJsonResponse;
2511
2362
  exports.parseGiteaUrl = parseGiteaUrl;
2363
+ exports.parseHarnessUrl = parseHarnessUrl;
2512
2364
  exports.readAwsCodeCommitIntegrationConfig = readAwsCodeCommitIntegrationConfig;
2513
2365
  exports.readAwsCodeCommitIntegrationConfigs = readAwsCodeCommitIntegrationConfigs;
2514
2366
  exports.readAwsS3IntegrationConfig = readAwsS3IntegrationConfig;