@backstage/integration 1.9.1-next.2 → 1.10.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -173,6 +173,69 @@ declare class AwsS3Integration implements ScmIntegration {
173
173
  resolveEditUrl(url: string): string;
174
174
  }
175
175
 
176
+ /**
177
+ * The configuration parameters for a single AWS CodeCommit provider.
178
+ *
179
+ * @public
180
+ */
181
+ type AwsCodeCommitIntegrationConfig = {
182
+ /**
183
+ * Host, git host derived from region
184
+ */
185
+ host: string;
186
+ /**
187
+ * (Optional) User access key id
188
+ */
189
+ accessKeyId?: string;
190
+ /**
191
+ * (Optional) User secret access key
192
+ */
193
+ secretAccessKey?: string;
194
+ /**
195
+ * (Optional) ARN of role to be assumed
196
+ */
197
+ roleArn?: string;
198
+ /**
199
+ * (Optional) External ID to use when assuming role
200
+ */
201
+ externalId?: string;
202
+ };
203
+ /**
204
+ * Reads a single Aws CodeCommit integration config.
205
+ *
206
+ * @param config - The config object of a single integration
207
+ * @public
208
+ */
209
+ declare function readAwsCodeCommitIntegrationConfig(config: Config): AwsCodeCommitIntegrationConfig;
210
+ /**
211
+ * Reads a set of AWS CodeCommit integration configs, and inserts some defaults for
212
+ * public Amazon AWS if not specified.
213
+ *
214
+ * @param configs - The config objects of the integrations
215
+ * @public
216
+ */
217
+ declare function readAwsCodeCommitIntegrationConfigs(configs: Config[]): AwsCodeCommitIntegrationConfig[];
218
+
219
+ /**
220
+ * Integrates with AWS CodeCommit.
221
+ *
222
+ * @public
223
+ */
224
+ declare class AwsCodeCommitIntegration implements ScmIntegration {
225
+ private readonly integrationConfig;
226
+ static factory: ScmIntegrationsFactory<AwsCodeCommitIntegration>;
227
+ get type(): string;
228
+ get config(): AwsCodeCommitIntegrationConfig;
229
+ get title(): string;
230
+ constructor(integrationConfig: AwsCodeCommitIntegrationConfig);
231
+ resolveUrl(options: {
232
+ url: string;
233
+ base: string;
234
+ lineNumber?: number | undefined;
235
+ }): string;
236
+ resolveEditUrl(url: string): string;
237
+ }
238
+
176
239
  /**
177
240
  * The configuration parameters for a single Azure provider.
178
241
  *
@@ -934,6 +997,7 @@ declare class GiteaIntegration implements ScmIntegration {
934
997
  */
935
998
  interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
936
999
  awsS3: ScmIntegrationsGroup<AwsS3Integration>;
1000
+ awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;
937
1001
  azure: ScmIntegrationsGroup<AzureIntegration>;
938
1002
  /**
939
1003
  * @deprecated in favor of `bitbucketCloud` and `bitbucketServer`
@@ -1603,6 +1667,7 @@ declare function defaultScmResolveUrl(options: {
1603
1667
  */
1604
1668
  interface IntegrationsByType {
1605
1669
  awsS3: ScmIntegrationsGroup<AwsS3Integration>;
1670
+ awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;
1606
1671
  azure: ScmIntegrationsGroup<AzureIntegration>;
1607
1672
  /**
1608
1673
  * @deprecated in favor of `bitbucketCloud` and `bitbucketServer`
@@ -1625,6 +1690,7 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
1625
1690
  static fromConfig(config: Config): ScmIntegrations;
1626
1691
  constructor(integrationsByType: IntegrationsByType);
1627
1692
  get awsS3(): ScmIntegrationsGroup<AwsS3Integration>;
1693
+ get awsCodeCommit(): ScmIntegrationsGroup<AwsCodeCommitIntegration>;
1628
1694
  get azure(): ScmIntegrationsGroup<AzureIntegration>;
1629
1695
  /**
1630
1696
  * @deprecated in favor of `bitbucketCloud()` and `bitbucketServer()`
@@ -1647,4 +1713,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
1647
1713
  resolveEditUrl(url: string): string;
1648
1714
  }
1649
1715
 
1650
- export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredentialBase, AzureDevOpsCredential, AzureDevOpsCredentialKind, AzureDevOpsCredentialLike, AzureDevOpsCredentialType, AzureDevOpsCredentials, AzureDevOpsCredentialsProvider, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, PersonalAccessTokenCredential, RateLimitInfo, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
1716
+ export { AwsCodeCommitIntegration, type AwsCodeCommitIntegrationConfig, AwsS3Integration, type AwsS3IntegrationConfig, type AzureClientSecretCredential, type AzureCredentialBase, type AzureDevOpsCredential, type AzureDevOpsCredentialKind, type AzureDevOpsCredentialLike, type AzureDevOpsCredentialType, type AzureDevOpsCredentials, type AzureDevOpsCredentialsProvider, AzureIntegration, type AzureIntegrationConfig, type AzureManagedIdentityCredential, BitbucketCloudIntegration, type BitbucketCloudIntegrationConfig, BitbucketIntegration, type BitbucketIntegrationConfig, BitbucketServerIntegration, type BitbucketServerIntegrationConfig, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, type GerritIntegrationConfig, GitHubIntegration, type GitHubIntegrationConfig, GitLabIntegration, type GitLabIntegrationConfig, GiteaIntegration, type GiteaIntegrationConfig, type GithubAppConfig, GithubAppCredentialsMux, type GithubCredentialType, type GithubCredentials, type GithubCredentialsProvider, GithubIntegration, type GithubIntegrationConfig, type GitlabCredentials, type GitlabCredentialsProvider, type GoogleGcsIntegrationConfig, type IntegrationsByType, type PersonalAccessTokenCredential, type RateLimitInfo, type ScmIntegration, type ScmIntegrationRegistry, ScmIntegrations, type ScmIntegrationsFactory, type ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
package/dist/index.esm.js CHANGED
@@ -112,10 +112,10 @@ function readAwsS3IntegrationConfigs(configs) {
112
112
  return result;
113
113
  }
114
114
 
115
- var __defProp$d = Object.defineProperty;
116
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
117
- var __publicField$d = (obj, key, value) => {
118
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
115
+ var __defProp$e = Object.defineProperty;
116
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
117
+ var __publicField$e = (obj, key, value) => {
118
+ __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
119
119
  return value;
120
120
  };
121
121
  const _AwsS3Integration = class _AwsS3Integration {
@@ -139,7 +139,7 @@ const _AwsS3Integration = class _AwsS3Integration {
139
139
  return url;
140
140
  }
141
141
  };
142
- __publicField$d(_AwsS3Integration, "factory", ({ config }) => {
142
+ __publicField$e(_AwsS3Integration, "factory", ({ config }) => {
143
143
  var _a;
144
144
  const configs = readAwsS3IntegrationConfigs(
145
145
  (_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []
@@ -151,6 +151,90 @@ __publicField$d(_AwsS3Integration, "factory", ({ config }) => {
151
151
  });
152
152
  let AwsS3Integration = _AwsS3Integration;
153
153
 
154
+ const AMAZON_AWS_CODECOMMIT_HOST = "console.aws.amazon.com";
155
+ function readAwsCodeCommitIntegrationConfig(config) {
156
+ var _a;
157
+ const accessKeyId = config.getOptionalString("accessKeyId");
158
+ const secretAccessKey = (_a = config.getOptionalString("secretAccessKey")) == null ? void 0 : _a.trim();
159
+ const roleArn = config.getOptionalString("roleArn");
160
+ const externalId = config.getOptionalString("externalId");
161
+ const host = AMAZON_AWS_CODECOMMIT_HOST;
162
+ return {
163
+ host,
164
+ accessKeyId,
165
+ secretAccessKey,
166
+ roleArn,
167
+ externalId
168
+ };
169
+ }
170
+ function readAwsCodeCommitIntegrationConfigs(configs) {
171
+ const result = configs.map(readAwsCodeCommitIntegrationConfig);
172
+ if (!result.some((c) => c.host === AMAZON_AWS_CODECOMMIT_HOST)) {
173
+ result.push({
174
+ host: AMAZON_AWS_CODECOMMIT_HOST
175
+ });
176
+ }
177
+ return result;
178
+ }
179
+
180
+ var __defProp$d = Object.defineProperty;
181
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
182
+ var __publicField$d = (obj, key, value) => {
183
+ __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
184
+ return value;
185
+ };
186
+ const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
187
+ constructor(integrationConfig) {
188
+ this.integrationConfig = integrationConfig;
189
+ }
190
+ get type() {
191
+ return "awsCodeCommit";
192
+ }
193
+ get config() {
194
+ return this.integrationConfig;
195
+ }
196
+ get title() {
197
+ return this.integrationConfig.host;
198
+ }
199
+ resolveUrl(options) {
200
+ const resolved = defaultScmResolveUrl(options);
201
+ return resolved;
202
+ }
203
+ resolveEditUrl(url) {
204
+ const parsedUrl = new URL(url);
205
+ const pathMatch = parsedUrl.pathname.match(
206
+ /^\/codesuite\/codecommit\/repositories\/([^\/]+)\//
207
+ );
208
+ if (!pathMatch) {
209
+ throw new Error(``);
210
+ }
211
+ const [, repositoryName] = pathMatch;
212
+ return replaceCodeCommitUrlType(url, repositoryName, "edit");
213
+ }
214
+ };
215
+ __publicField$d(_AwsCodeCommitIntegration, "factory", ({
216
+ config
217
+ }) => {
218
+ var _a;
219
+ const configs = readAwsCodeCommitIntegrationConfigs(
220
+ (_a = config.getOptionalConfigArray("integrations.awsCodeCommit")) != null ? _a : []
221
+ );
222
+ return basicIntegrations(
223
+ configs.map((c) => new _AwsCodeCommitIntegration(c)),
224
+ (i) => i.config.host
225
+ );
226
+ });
227
+ let AwsCodeCommitIntegration = _AwsCodeCommitIntegration;
228
+ function replaceCodeCommitUrlType(url, repositoryName, type) {
229
+ const newString = type === "edit" ? `files/edit` : type;
230
+ return url.replace(
231
+ new RegExp(
232
+ `/codesuite/codecommit/repositories/${repositoryName}/(browse|files/edit)/`
233
+ ),
234
+ `/codesuite/codecommit/repositories/${repositoryName}/${newString}/`
235
+ );
236
+ }
237
+
154
238
  var __accessCheck = (obj, member, msg) => {
155
239
  if (!member.has(obj))
156
240
  throw TypeError("Cannot " + msg);
@@ -2156,6 +2240,7 @@ class ScmIntegrations {
2156
2240
  static fromConfig(config) {
2157
2241
  return new ScmIntegrations({
2158
2242
  awsS3: AwsS3Integration.factory({ config }),
2243
+ awsCodeCommit: AwsCodeCommitIntegration.factory({ config }),
2159
2244
  azure: AzureIntegration.factory({ config }),
2160
2245
  bitbucket: BitbucketIntegration.factory({ config }),
2161
2246
  bitbucketCloud: BitbucketCloudIntegration.factory({ config }),
@@ -2169,6 +2254,9 @@ class ScmIntegrations {
2169
2254
  get awsS3() {
2170
2255
  return this.byType.awsS3;
2171
2256
  }
2257
+ get awsCodeCommit() {
2258
+ return this.byType.awsCodeCommit;
2259
+ }
2172
2260
  get azure() {
2173
2261
  return this.byType.azure;
2174
2262
  }
@@ -2232,5 +2320,5 @@ class ScmIntegrations {
2232
2320
  }
2233
2321
  }
2234
2322
 
2235
- export { AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
2323
+ export { AwsCodeCommitIntegration, AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
2236
2324
  //# sourceMappingURL=index.esm.js.map