@backstage/integration 1.10.0-next.0 → 1.11.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 (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/config.d.ts +18 -0
  3. package/dist/ScmIntegrations.esm.js +114 -0
  4. package/dist/ScmIntegrations.esm.js.map +1 -0
  5. package/dist/awsCodeCommit/AwsCodeCommitIntegration.esm.js +63 -0
  6. package/dist/awsCodeCommit/AwsCodeCommitIntegration.esm.js.map +1 -0
  7. package/dist/awsCodeCommit/config.esm.js +28 -0
  8. package/dist/awsCodeCommit/config.esm.js.map +1 -0
  9. package/dist/awsS3/AwsS3Integration.esm.js +44 -0
  10. package/dist/awsS3/AwsS3Integration.esm.js.map +1 -0
  11. package/dist/awsS3/config.esm.js +51 -0
  12. package/dist/awsS3/config.esm.js.map +1 -0
  13. package/dist/azure/AzureIntegration.esm.js +69 -0
  14. package/dist/azure/AzureIntegration.esm.js.map +1 -0
  15. package/dist/azure/AzureUrl.esm.js +191 -0
  16. package/dist/azure/AzureUrl.esm.js.map +1 -0
  17. package/dist/azure/CachedAzureDevOpsCredentialsProvider.esm.js +80 -0
  18. package/dist/azure/CachedAzureDevOpsCredentialsProvider.esm.js.map +1 -0
  19. package/dist/azure/DefaultAzureDevOpsCredentialsProvider.esm.js +76 -0
  20. package/dist/azure/DefaultAzureDevOpsCredentialsProvider.esm.js.map +1 -0
  21. package/dist/azure/config.esm.js +153 -0
  22. package/dist/azure/config.esm.js.map +1 -0
  23. package/dist/azure/core.esm.js +14 -0
  24. package/dist/azure/core.esm.js.map +1 -0
  25. package/dist/azure/deprecated.esm.js +25 -0
  26. package/dist/azure/deprecated.esm.js.map +1 -0
  27. package/dist/bitbucket/BitbucketIntegration.esm.js +67 -0
  28. package/dist/bitbucket/BitbucketIntegration.esm.js.map +1 -0
  29. package/dist/bitbucket/config.esm.js +45 -0
  30. package/dist/bitbucket/config.esm.js.map +1 -0
  31. package/dist/bitbucket/core.esm.js +85 -0
  32. package/dist/bitbucket/core.esm.js.map +1 -0
  33. package/dist/bitbucketCloud/BitbucketCloudIntegration.esm.js +56 -0
  34. package/dist/bitbucketCloud/BitbucketCloudIntegration.esm.js.map +1 -0
  35. package/dist/bitbucketCloud/config.esm.js +28 -0
  36. package/dist/bitbucketCloud/config.esm.js.map +1 -0
  37. package/dist/bitbucketCloud/core.esm.js +68 -0
  38. package/dist/bitbucketCloud/core.esm.js.map +1 -0
  39. package/dist/bitbucketServer/BitbucketServerIntegration.esm.js +54 -0
  40. package/dist/bitbucketServer/BitbucketServerIntegration.esm.js.map +1 -0
  41. package/dist/bitbucketServer/config.esm.js +34 -0
  42. package/dist/bitbucketServer/config.esm.js.map +1 -0
  43. package/dist/bitbucketServer/core.esm.js +63 -0
  44. package/dist/bitbucketServer/core.esm.js.map +1 -0
  45. package/dist/gerrit/GerritIntegration.esm.js +58 -0
  46. package/dist/gerrit/GerritIntegration.esm.js.map +1 -0
  47. package/dist/gerrit/config.esm.js +58 -0
  48. package/dist/gerrit/config.esm.js.map +1 -0
  49. package/dist/gerrit/core.esm.js +106 -0
  50. package/dist/gerrit/core.esm.js.map +1 -0
  51. package/dist/gitea/GiteaIntegration.esm.js +40 -0
  52. package/dist/gitea/GiteaIntegration.esm.js.map +1 -0
  53. package/dist/gitea/config.esm.js +33 -0
  54. package/dist/gitea/config.esm.js.map +1 -0
  55. package/dist/gitea/core.esm.js +53 -0
  56. package/dist/gitea/core.esm.js.map +1 -0
  57. package/dist/github/DefaultGithubCredentialsProvider.esm.js +52 -0
  58. package/dist/github/DefaultGithubCredentialsProvider.esm.js.map +1 -0
  59. package/dist/github/GithubIntegration.esm.js +56 -0
  60. package/dist/github/GithubIntegration.esm.js.map +1 -0
  61. package/dist/github/SingleInstanceGithubCredentialsProvider.esm.js +222 -0
  62. package/dist/github/SingleInstanceGithubCredentialsProvider.esm.js.map +1 -0
  63. package/dist/github/config.esm.js +53 -0
  64. package/dist/github/config.esm.js.map +1 -0
  65. package/dist/github/core.esm.js +38 -0
  66. package/dist/github/core.esm.js.map +1 -0
  67. package/dist/github/deprecated.esm.js +26 -0
  68. package/dist/github/deprecated.esm.js.map +1 -0
  69. package/dist/gitlab/DefaultGitlabCredentialsProvider.esm.js +28 -0
  70. package/dist/gitlab/DefaultGitlabCredentialsProvider.esm.js.map +1 -0
  71. package/dist/gitlab/GitLabIntegration.esm.js +46 -0
  72. package/dist/gitlab/GitLabIntegration.esm.js.map +1 -0
  73. package/dist/gitlab/SingleInstanceGitlabCredentialsProvider.esm.js +29 -0
  74. package/dist/gitlab/SingleInstanceGitlabCredentialsProvider.esm.js.map +1 -0
  75. package/dist/gitlab/config.esm.js +57 -0
  76. package/dist/gitlab/config.esm.js.map +1 -0
  77. package/dist/gitlab/core.esm.js +69 -0
  78. package/dist/gitlab/core.esm.js.map +1 -0
  79. package/dist/googleGcs/config.esm.js +14 -0
  80. package/dist/googleGcs/config.esm.js.map +1 -0
  81. package/dist/harness/HarnessIntegration.esm.js +40 -0
  82. package/dist/harness/HarnessIntegration.esm.js.map +1 -0
  83. package/dist/harness/config.esm.js +20 -0
  84. package/dist/harness/config.esm.js.map +1 -0
  85. package/dist/harness/core.esm.js +73 -0
  86. package/dist/harness/core.esm.js.map +1 -0
  87. package/dist/helpers.esm.js +62 -0
  88. package/dist/helpers.esm.js.map +1 -0
  89. package/dist/index.cjs.js +214 -85
  90. package/dist/index.cjs.js.map +1 -1
  91. package/dist/index.d.ts +73 -1
  92. package/dist/index.esm.js +40 -2323
  93. package/dist/index.esm.js.map +1 -1
  94. package/package.json +3 -3
package/dist/index.cjs.js CHANGED
@@ -119,10 +119,10 @@ function readAwsS3IntegrationConfigs(configs) {
119
119
  return result;
120
120
  }
121
121
 
122
- var __defProp$e = Object.defineProperty;
123
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
124
- var __publicField$e = (obj, key, value) => {
125
- __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
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
126
  return value;
127
127
  };
128
128
  const _AwsS3Integration = class _AwsS3Integration {
@@ -146,7 +146,7 @@ const _AwsS3Integration = class _AwsS3Integration {
146
146
  return url;
147
147
  }
148
148
  };
149
- __publicField$e(_AwsS3Integration, "factory", ({ config }) => {
149
+ __publicField$f(_AwsS3Integration, "factory", ({ config }) => {
150
150
  var _a;
151
151
  const configs = readAwsS3IntegrationConfigs(
152
152
  (_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []
@@ -184,10 +184,10 @@ function readAwsCodeCommitIntegrationConfigs(configs) {
184
184
  return result;
185
185
  }
186
186
 
187
- var __defProp$d = Object.defineProperty;
188
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
189
- var __publicField$d = (obj, key, value) => {
190
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
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
191
  return value;
192
192
  };
193
193
  const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
@@ -216,10 +216,10 @@ const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
216
216
  throw new Error(``);
217
217
  }
218
218
  const [, repositoryName] = pathMatch;
219
- return replaceCodeCommitUrlType(url, repositoryName, "edit");
219
+ return replaceCodeCommitUrlType(url, repositoryName);
220
220
  }
221
221
  };
222
- __publicField$d(_AwsCodeCommitIntegration, "factory", ({
222
+ __publicField$e(_AwsCodeCommitIntegration, "factory", ({
223
223
  config
224
224
  }) => {
225
225
  var _a;
@@ -233,7 +233,7 @@ __publicField$d(_AwsCodeCommitIntegration, "factory", ({
233
233
  });
234
234
  let AwsCodeCommitIntegration = _AwsCodeCommitIntegration;
235
235
  function replaceCodeCommitUrlType(url, repositoryName, type) {
236
- const newString = type === "edit" ? `files/edit` : type;
236
+ const newString = `files/edit` ;
237
237
  return url.replace(
238
238
  new RegExp(
239
239
  `/codesuite/codecommit/repositories/${repositoryName}/(browse|files/edit)/`
@@ -248,7 +248,7 @@ var __accessCheck = (obj, member, msg) => {
248
248
  };
249
249
  var __privateGet = (obj, member, getter) => {
250
250
  __accessCheck(obj, member, "read from private field");
251
- return getter ? getter.call(obj) : member.get(obj);
251
+ return member.get(obj);
252
252
  };
253
253
  var __privateAdd = (obj, member, value) => {
254
254
  if (member.has(obj))
@@ -257,7 +257,7 @@ var __privateAdd = (obj, member, value) => {
257
257
  };
258
258
  var __privateSet = (obj, member, value, setter) => {
259
259
  __accessCheck(obj, member, "write to private field");
260
- setter ? setter.call(obj, value) : member.set(obj, value);
260
+ member.set(obj, value);
261
261
  return value;
262
262
  };
263
263
  var _origin, _owner, _project, _repo, _path, _ref, _baseUrl;
@@ -580,10 +580,10 @@ function readAzureIntegrationConfigs(configs) {
580
580
  return result;
581
581
  }
582
582
 
583
- var __defProp$c = Object.defineProperty;
584
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
585
- var __publicField$c = (obj, key, value) => {
586
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
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
587
  return value;
588
588
  };
589
589
  const _AzureIntegration = class _AzureIntegration {
@@ -631,7 +631,7 @@ const _AzureIntegration = class _AzureIntegration {
631
631
  return url;
632
632
  }
633
633
  };
634
- __publicField$c(_AzureIntegration, "factory", ({ config }) => {
634
+ __publicField$d(_AzureIntegration, "factory", ({ config }) => {
635
635
  var _a;
636
636
  const configs = readAzureIntegrationConfigs(
637
637
  (_a = config.getOptionalConfigArray("integrations.azure")) != null ? _a : []
@@ -653,18 +653,18 @@ function getAzureCommitsUrl(url) {
653
653
  return AzureUrl.fromRepoUrl(url).toCommitsUrl();
654
654
  }
655
655
 
656
- var __defProp$b = Object.defineProperty;
657
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
658
- var __publicField$b = (obj, key, value) => {
659
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
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
660
  return value;
661
661
  };
662
662
  const tenMinutes = 1e3 * 60 * 10;
663
663
  class CachedAzureDevOpsCredentialsProvider {
664
664
  constructor(credential) {
665
665
  this.credential = credential;
666
- __publicField$b(this, "azureDevOpsScope", "499b84ac-1321-427f-aa17-267ca6975798/.default");
667
- __publicField$b(this, "cached");
666
+ __publicField$c(this, "azureDevOpsScope", "499b84ac-1321-427f-aa17-267ca6975798/.default");
667
+ __publicField$c(this, "cached");
668
668
  }
669
669
  static fromAzureDevOpsCredential(credential) {
670
670
  switch (credential.kind) {
@@ -861,10 +861,10 @@ function readBitbucketIntegrationConfigs(configs) {
861
861
  return result;
862
862
  }
863
863
 
864
- var __defProp$a = Object.defineProperty;
865
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
866
- var __publicField$a = (obj, key, value) => {
867
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
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
868
  return value;
869
869
  };
870
870
  const _BitbucketIntegration = class _BitbucketIntegration {
@@ -902,7 +902,7 @@ const _BitbucketIntegration = class _BitbucketIntegration {
902
902
  return editUrl.toString();
903
903
  }
904
904
  };
905
- __publicField$a(_BitbucketIntegration, "factory", ({
905
+ __publicField$b(_BitbucketIntegration, "factory", ({
906
906
  config
907
907
  }) => {
908
908
  var _a, _b, _c;
@@ -1028,10 +1028,10 @@ function readBitbucketCloudIntegrationConfigs(configs) {
1028
1028
  return result;
1029
1029
  }
1030
1030
 
1031
- var __defProp$9 = Object.defineProperty;
1032
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1033
- var __publicField$9 = (obj, key, value) => {
1034
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1035
  return value;
1036
1036
  };
1037
1037
  const _BitbucketCloudIntegration = class _BitbucketCloudIntegration {
@@ -1064,7 +1064,7 @@ const _BitbucketCloudIntegration = class _BitbucketCloudIntegration {
1064
1064
  return editUrl.toString();
1065
1065
  }
1066
1066
  };
1067
- __publicField$9(_BitbucketCloudIntegration, "factory", ({
1067
+ __publicField$a(_BitbucketCloudIntegration, "factory", ({
1068
1068
  config
1069
1069
  }) => {
1070
1070
  var _a;
@@ -1170,10 +1170,10 @@ function readBitbucketServerIntegrationConfigs(configs) {
1170
1170
  return configs.map(readBitbucketServerIntegrationConfig);
1171
1171
  }
1172
1172
 
1173
- var __defProp$8 = Object.defineProperty;
1174
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1175
- var __publicField$8 = (obj, key, value) => {
1176
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1177
  return value;
1178
1178
  };
1179
1179
  const _BitbucketServerIntegration = class _BitbucketServerIntegration {
@@ -1205,7 +1205,7 @@ const _BitbucketServerIntegration = class _BitbucketServerIntegration {
1205
1205
  return url;
1206
1206
  }
1207
1207
  };
1208
- __publicField$8(_BitbucketServerIntegration, "factory", ({
1208
+ __publicField$9(_BitbucketServerIntegration, "factory", ({
1209
1209
  config
1210
1210
  }) => {
1211
1211
  var _a;
@@ -1432,10 +1432,10 @@ async function parseGerritJsonResponse(response) {
1432
1432
  );
1433
1433
  }
1434
1434
 
1435
- var __defProp$7 = Object.defineProperty;
1436
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1437
- var __publicField$7 = (obj, key, value) => {
1438
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1439
  return value;
1440
1440
  };
1441
1441
  const _GerritIntegration = class _GerritIntegration {
@@ -1472,7 +1472,7 @@ const _GerritIntegration = class _GerritIntegration {
1472
1472
  return url;
1473
1473
  }
1474
1474
  };
1475
- __publicField$7(_GerritIntegration, "factory", ({ config }) => {
1475
+ __publicField$8(_GerritIntegration, "factory", ({ config }) => {
1476
1476
  var _a;
1477
1477
  const configs = readGerritIntegrationConfigs(
1478
1478
  (_a = config.getOptionalConfigArray("integrations.gerrit")) != null ? _a : []
@@ -1563,10 +1563,10 @@ function parseGiteaUrl(config, url) {
1563
1563
  }
1564
1564
  }
1565
1565
 
1566
- var __defProp$6 = Object.defineProperty;
1567
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1568
- var __publicField$6 = (obj, key, value) => {
1569
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1570
  return value;
1571
1571
  };
1572
1572
  const _GiteaIntegration = class _GiteaIntegration {
@@ -1586,7 +1586,7 @@ const _GiteaIntegration = class _GiteaIntegration {
1586
1586
  return getGiteaEditContentsUrl(this.config, url);
1587
1587
  }
1588
1588
  };
1589
- __publicField$6(_GiteaIntegration, "factory", ({ config }) => {
1589
+ __publicField$7(_GiteaIntegration, "factory", ({ config }) => {
1590
1590
  var _a;
1591
1591
  const configs = (_a = config.getOptionalConfigArray("integrations.gitea")) != null ? _a : [];
1592
1592
  const giteaConfigs = configs.map((c) => readGiteaConfig(c));
@@ -1679,16 +1679,16 @@ function chooseEndpoint(config, credentials) {
1679
1679
  return "raw";
1680
1680
  }
1681
1681
 
1682
- var __defProp$5 = Object.defineProperty;
1683
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1684
- var __publicField$5 = (obj, key, value) => {
1685
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1686
  return value;
1687
1687
  };
1688
1688
  class Cache {
1689
1689
  constructor() {
1690
- __publicField$5(this, "tokenCache", /* @__PURE__ */ new Map());
1691
- __publicField$5(this, "isExpired", (date) => luxon.DateTime.local() > date);
1690
+ __publicField$6(this, "tokenCache", /* @__PURE__ */ new Map());
1691
+ __publicField$6(this, "isExpired", (date) => luxon.DateTime.local() > date);
1692
1692
  }
1693
1693
  async getOrCreateToken(owner, repo, supplier) {
1694
1694
  let existingInstallationData = this.tokenCache.get(owner);
@@ -1720,11 +1720,11 @@ const HEADERS = {
1720
1720
  class GithubAppManager {
1721
1721
  // undefined allows all installations
1722
1722
  constructor(config, baseUrl) {
1723
- __publicField$5(this, "appClient");
1724
- __publicField$5(this, "baseUrl");
1725
- __publicField$5(this, "baseAuthConfig");
1726
- __publicField$5(this, "cache", new Cache());
1727
- __publicField$5(this, "allowedInstallationOwners");
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
1728
  this.allowedInstallationOwners = config.allowedInstallationOwners;
1729
1729
  this.baseUrl = baseUrl;
1730
1730
  this.baseAuthConfig = {
@@ -1802,7 +1802,7 @@ class GithubAppManager {
1802
1802
  }
1803
1803
  class GithubAppCredentialsMux {
1804
1804
  constructor(config) {
1805
- __publicField$5(this, "apps");
1805
+ __publicField$6(this, "apps");
1806
1806
  var _a, _b;
1807
1807
  this.apps = (_b = (_a = config.apps) == null ? void 0 : _a.map((ac) => new GithubAppManager(ac, config.apiBaseUrl))) != null ? _b : [];
1808
1808
  }
@@ -1886,7 +1886,7 @@ const _SingleInstanceGithubCredentialsProvider = class _SingleInstanceGithubCred
1886
1886
  };
1887
1887
  }
1888
1888
  };
1889
- __publicField$5(_SingleInstanceGithubCredentialsProvider, "create", (config) => {
1889
+ __publicField$6(_SingleInstanceGithubCredentialsProvider, "create", (config) => {
1890
1890
  return new _SingleInstanceGithubCredentialsProvider(
1891
1891
  new GithubAppCredentialsMux(config),
1892
1892
  config.token
@@ -1942,10 +1942,10 @@ class DefaultGithubCredentialsProvider {
1942
1942
  }
1943
1943
  }
1944
1944
 
1945
- var __defProp$4 = Object.defineProperty;
1946
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1947
- var __publicField$4 = (obj, key, value) => {
1948
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
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
1949
  return value;
1950
1950
  };
1951
1951
  const _GithubIntegration = class _GithubIntegration {
@@ -1973,7 +1973,7 @@ const _GithubIntegration = class _GithubIntegration {
1973
1973
  };
1974
1974
  }
1975
1975
  };
1976
- __publicField$4(_GithubIntegration, "factory", ({ config }) => {
1976
+ __publicField$5(_GithubIntegration, "factory", ({ config }) => {
1977
1977
  var _a;
1978
1978
  const configs = readGithubIntegrationConfigs(
1979
1979
  (_a = config.getOptionalConfigArray("integrations.github")) != null ? _a : []
@@ -1993,10 +1993,10 @@ function replaceGithubUrlType(url, type) {
1993
1993
  );
1994
1994
  }
1995
1995
 
1996
- var __defProp$3 = Object.defineProperty;
1997
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1998
- var __publicField$3 = (obj, key, value) => {
1999
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
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
2000
  return value;
2001
2001
  };
2002
2002
  const getGitHubFileFetchUrl = getGithubFileFetchUrl;
@@ -2008,7 +2008,7 @@ class GitHubIntegration extends GithubIntegration {
2008
2008
  return super.config;
2009
2009
  }
2010
2010
  }
2011
- __publicField$3(GitHubIntegration, "factory", GithubIntegration.factory);
2011
+ __publicField$4(GitHubIntegration, "factory", GithubIntegration.factory);
2012
2012
  const readGitHubIntegrationConfig = readGithubIntegrationConfig;
2013
2013
  const readGitHubIntegrationConfigs = readGithubIntegrationConfigs;
2014
2014
  const replaceGitHubUrlType = replaceGithubUrlType;
@@ -2129,10 +2129,10 @@ async function getProjectId(target, config) {
2129
2129
  }
2130
2130
  }
2131
2131
 
2132
- var __defProp$2 = Object.defineProperty;
2133
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2134
- var __publicField$2 = (obj, key, value) => {
2135
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
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
2136
  return value;
2137
2137
  };
2138
2138
  const _GitLabIntegration = class _GitLabIntegration {
@@ -2155,7 +2155,7 @@ const _GitLabIntegration = class _GitLabIntegration {
2155
2155
  return replaceGitLabUrlType(url, "edit");
2156
2156
  }
2157
2157
  };
2158
- __publicField$2(_GitLabIntegration, "factory", ({ config }) => {
2158
+ __publicField$3(_GitLabIntegration, "factory", ({ config }) => {
2159
2159
  var _a;
2160
2160
  const configs = readGitLabIntegrationConfigs(
2161
2161
  (_a = config.getOptionalConfigArray("integrations.gitlab")) != null ? _a : []
@@ -2170,10 +2170,10 @@ function replaceGitLabUrlType(url, type) {
2170
2170
  return url.replace(/\/\-\/(blob|tree|edit)\//, `/-/${type}/`);
2171
2171
  }
2172
2172
 
2173
- var __defProp$1 = Object.defineProperty;
2174
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2175
- var __publicField$1 = (obj, key, value) => {
2176
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
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
2177
  return value;
2178
2178
  };
2179
2179
  const _SingleInstanceGitlabCredentialsProvider = class _SingleInstanceGitlabCredentialsProvider {
@@ -2192,7 +2192,7 @@ const _SingleInstanceGitlabCredentialsProvider = class _SingleInstanceGitlabCred
2192
2192
  };
2193
2193
  }
2194
2194
  };
2195
- __publicField$1(_SingleInstanceGitlabCredentialsProvider, "create", (config) => {
2195
+ __publicField$2(_SingleInstanceGitlabCredentialsProvider, "create", (config) => {
2196
2196
  return new _SingleInstanceGitlabCredentialsProvider(config.token);
2197
2197
  });
2198
2198
  let SingleInstanceGitlabCredentialsProvider = _SingleInstanceGitlabCredentialsProvider;
@@ -2233,10 +2233,131 @@ function readGoogleGcsIntegrationConfig(config) {
2233
2233
  return { clientEmail, privateKey };
2234
2234
  }
2235
2235
 
2236
+ function readHarnessConfig(config) {
2237
+ const host = config.getString("host");
2238
+ const token = config.getOptionalString("token");
2239
+ const apiKey = config.getOptionalString("apiKey");
2240
+ if (!isValidHost(host)) {
2241
+ throw new Error(
2242
+ `Invalid Harness Code integration config, '${host}' is not a valid host`
2243
+ );
2244
+ }
2245
+ return {
2246
+ host,
2247
+ apiKey,
2248
+ token
2249
+ };
2250
+ }
2251
+
2252
+ function getHarnessEditContentsUrl(config, url) {
2253
+ try {
2254
+ const baseUrl = `https://${config.host}`;
2255
+ const [
2256
+ _blank,
2257
+ _ng,
2258
+ _account,
2259
+ accountId,
2260
+ _module,
2261
+ _moduleName,
2262
+ _org,
2263
+ orgName,
2264
+ _projects,
2265
+ projectName,
2266
+ _repos,
2267
+ repoName,
2268
+ _files,
2269
+ _ref,
2270
+ _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,
2286
+ accountId,
2287
+ _module,
2288
+ _moduleName,
2289
+ _org,
2290
+ orgName,
2291
+ _projects,
2292
+ projectName,
2293
+ _repos,
2294
+ 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}`;
2306
+ } catch (e) {
2307
+ throw new Error(`Incorrect URL: ${url}, ${e}`);
2308
+ }
2309
+ }
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
+
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 {
2330
+ constructor(config) {
2331
+ this.config = config;
2332
+ }
2333
+ get type() {
2334
+ return "harness";
2335
+ }
2336
+ get title() {
2337
+ return this.config.host;
2338
+ }
2339
+ resolveUrl(options) {
2340
+ return defaultScmResolveUrl(options);
2341
+ }
2342
+ resolveEditUrl(url) {
2343
+ return getHarnessEditContentsUrl(this.config, url);
2344
+ }
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;
2356
+
2236
2357
  var __defProp = Object.defineProperty;
2237
2358
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2238
2359
  var __publicField = (obj, key, value) => {
2239
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2360
+ __defNormalProp(obj, key + "" , value);
2240
2361
  return value;
2241
2362
  };
2242
2363
  class ScmIntegrations {
@@ -2255,7 +2376,8 @@ class ScmIntegrations {
2255
2376
  gerrit: GerritIntegration.factory({ config }),
2256
2377
  github: GithubIntegration.factory({ config }),
2257
2378
  gitlab: GitLabIntegration.factory({ config }),
2258
- gitea: GiteaIntegration.factory({ config })
2379
+ gitea: GiteaIntegration.factory({ config }),
2380
+ harness: HarnessIntegration.factory({ config })
2259
2381
  });
2260
2382
  }
2261
2383
  get awsS3() {
@@ -2291,6 +2413,9 @@ class ScmIntegrations {
2291
2413
  get gitea() {
2292
2414
  return this.byType.gitea;
2293
2415
  }
2416
+ get harness() {
2417
+ return this.byType.harness;
2418
+ }
2294
2419
  list() {
2295
2420
  return Object.values(this.byType).flatMap(
2296
2421
  (i) => i.list()
@@ -2342,6 +2467,7 @@ exports.GitLabIntegration = GitLabIntegration;
2342
2467
  exports.GiteaIntegration = GiteaIntegration;
2343
2468
  exports.GithubAppCredentialsMux = GithubAppCredentialsMux;
2344
2469
  exports.GithubIntegration = GithubIntegration;
2470
+ exports.HarnessIntegration = HarnessIntegration;
2345
2471
  exports.ScmIntegrations = ScmIntegrations;
2346
2472
  exports.SingleInstanceGithubCredentialsProvider = SingleInstanceGithubCredentialsProvider;
2347
2473
  exports.buildGerritGitilesArchiveUrl = buildGerritGitilesArchiveUrl;
@@ -2378,6 +2504,8 @@ exports.getGiteaFileContentsUrl = getGiteaFileContentsUrl;
2378
2504
  exports.getGiteaLatestCommitUrl = getGiteaLatestCommitUrl;
2379
2505
  exports.getGiteaRequestOptions = getGiteaRequestOptions;
2380
2506
  exports.getGithubFileFetchUrl = getGithubFileFetchUrl;
2507
+ exports.getHarnessFileContentsUrl = getHarnessFileContentsUrl;
2508
+ exports.getHarnessRequestOptions = getHarnessRequestOptions;
2381
2509
  exports.parseGerritGitilesUrl = parseGerritGitilesUrl;
2382
2510
  exports.parseGerritJsonResponse = parseGerritJsonResponse;
2383
2511
  exports.parseGiteaUrl = parseGiteaUrl;
@@ -2403,6 +2531,7 @@ exports.readGiteaConfig = readGiteaConfig;
2403
2531
  exports.readGithubIntegrationConfig = readGithubIntegrationConfig;
2404
2532
  exports.readGithubIntegrationConfigs = readGithubIntegrationConfigs;
2405
2533
  exports.readGoogleGcsIntegrationConfig = readGoogleGcsIntegrationConfig;
2534
+ exports.readHarnessConfig = readHarnessConfig;
2406
2535
  exports.replaceGitHubUrlType = replaceGitHubUrlType;
2407
2536
  exports.replaceGitLabUrlType = replaceGitLabUrlType;
2408
2537
  exports.replaceGithubUrlType = replaceGithubUrlType;