@backstage/integration 1.9.0-next.0 → 1.9.0-next.1

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.esm.js CHANGED
@@ -65,7 +65,7 @@ function defaultScmResolveUrl(options) {
65
65
 
66
66
  const AMAZON_AWS_HOST = "amazonaws.com";
67
67
  function readAwsS3IntegrationConfig(config) {
68
- var _a;
68
+ var _a, _b;
69
69
  const endpoint = config.getOptionalString("endpoint");
70
70
  const s3ForcePathStyle = (_a = config.getOptionalBoolean("s3ForcePathStyle")) != null ? _a : false;
71
71
  let host;
@@ -89,7 +89,7 @@ function readAwsS3IntegrationConfig(config) {
89
89
  host = AMAZON_AWS_HOST;
90
90
  }
91
91
  const accessKeyId = config.getOptionalString("accessKeyId");
92
- const secretAccessKey = config.getOptionalString("secretAccessKey");
92
+ const secretAccessKey = (_b = config.getOptionalString("secretAccessKey")) == null ? void 0 : _b.trim();
93
93
  const roleArn = config.getOptionalString("roleArn");
94
94
  const externalId = config.getOptionalString("externalId");
95
95
  return {
@@ -372,21 +372,20 @@ function asAzureDevOpsCredential(credential) {
372
372
  throw new Error("is not a valid credential");
373
373
  }
374
374
  function readAzureIntegrationConfig(config) {
375
- var _a, _b, _c, _d;
375
+ var _a, _b, _c, _d, _e, _f, _g;
376
376
  const host = (_a = config.getOptionalString("host")) != null ? _a : AZURE_HOST;
377
377
  let credentialConfigs = (_b = config.getOptionalConfigArray("credentials")) == null ? void 0 : _b.map((credential) => {
378
+ var _a2, _b2;
378
379
  const result = {
379
380
  organizations: credential.getOptionalStringArray("organizations"),
380
- personalAccessToken: credential.getOptionalString(
381
- "personalAccessToken"
382
- ),
381
+ personalAccessToken: (_a2 = credential.getOptionalString("personalAccessToken")) == null ? void 0 : _a2.trim(),
383
382
  tenantId: credential.getOptionalString("tenantId"),
384
383
  clientId: credential.getOptionalString("clientId"),
385
- clientSecret: credential.getOptionalString("clientSecret")
384
+ clientSecret: (_b2 = credential.getOptionalString("clientSecret")) == null ? void 0 : _b2.trim()
386
385
  };
387
386
  return result;
388
387
  });
389
- const token = config.getOptionalString("token");
388
+ const token = (_c = config.getOptionalString("token")) == null ? void 0 : _c.trim();
390
389
  if (config.getOptional("credential") !== void 0 && config.getOptional("credentials") !== void 0) {
391
390
  throw new Error(
392
391
  `Invalid Azure integration config, 'credential' and 'credentials' cannot be used together. Use 'credentials' instead.`
@@ -399,7 +398,7 @@ function readAzureIntegrationConfig(config) {
399
398
  }
400
399
  if (token !== void 0) {
401
400
  const mapped = [{ personalAccessToken: token }];
402
- credentialConfigs = (_c = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _c : mapped;
401
+ credentialConfigs = (_d = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _d : mapped;
403
402
  }
404
403
  if (config.getOptional("credential") !== void 0) {
405
404
  const mapped = [
@@ -407,13 +406,13 @@ function readAzureIntegrationConfig(config) {
407
406
  organizations: config.getOptionalStringArray(
408
407
  "credential.organizations"
409
408
  ),
410
- token: config.getOptionalString("credential.token"),
409
+ token: (_e = config.getOptionalString("credential.token")) == null ? void 0 : _e.trim(),
411
410
  tenantId: config.getOptionalString("credential.tenantId"),
412
411
  clientId: config.getOptionalString("credential.clientId"),
413
- clientSecret: config.getOptionalString("credential.clientSecret")
412
+ clientSecret: (_f = config.getOptionalString("credential.clientSecret")) == null ? void 0 : _f.trim()
414
413
  }
415
414
  ];
416
- credentialConfigs = (_d = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _d : mapped;
415
+ credentialConfigs = (_g = credentialConfigs == null ? void 0 : credentialConfigs.concat(mapped)) != null ? _g : mapped;
417
416
  }
418
417
  if (!isValidHost(host)) {
419
418
  throw new Error(
@@ -734,12 +733,12 @@ async function getAzureRequestOptions(config, additionalHeaders) {
734
733
  const BITBUCKET_HOST = "bitbucket.org";
735
734
  const BITBUCKET_API_BASE_URL = "https://api.bitbucket.org/2.0";
736
735
  function readBitbucketIntegrationConfig(config) {
737
- var _a;
736
+ var _a, _b, _c;
738
737
  const host = (_a = config.getOptionalString("host")) != null ? _a : BITBUCKET_HOST;
739
738
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
740
- const token = config.getOptionalString("token");
739
+ const token = (_b = config.getOptionalString("token")) == null ? void 0 : _b.trim();
741
740
  const username = config.getOptionalString("username");
742
- const appPassword = config.getOptionalString("appPassword");
741
+ const appPassword = (_c = config.getOptionalString("appPassword")) == null ? void 0 : _c.trim();
743
742
  if (!isValidHost(host)) {
744
743
  throw new Error(
745
744
  `Invalid Bitbucket integration config, '${host}' is not a valid host`
@@ -915,10 +914,11 @@ function getBitbucketRequestOptions(config) {
915
914
  const BITBUCKET_CLOUD_HOST = "bitbucket.org";
916
915
  const BITBUCKET_CLOUD_API_BASE_URL = "https://api.bitbucket.org/2.0";
917
916
  function readBitbucketCloudIntegrationConfig(config) {
917
+ var _a;
918
918
  const host = BITBUCKET_CLOUD_HOST;
919
919
  const apiBaseUrl = BITBUCKET_CLOUD_API_BASE_URL;
920
920
  const username = config.getString("username");
921
- const appPassword = config.getString("appPassword");
921
+ const appPassword = (_a = config.getString("appPassword")) == null ? void 0 : _a.trim();
922
922
  return {
923
923
  host,
924
924
  apiBaseUrl,
@@ -1051,9 +1051,10 @@ function getBitbucketCloudRequestOptions(config) {
1051
1051
  }
1052
1052
 
1053
1053
  function readBitbucketServerIntegrationConfig(config) {
1054
+ var _a;
1054
1055
  const host = config.getString("host");
1055
1056
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
1056
- const token = config.getOptionalString("token");
1057
+ const token = (_a = config.getOptionalString("token")) == null ? void 0 : _a.trim();
1057
1058
  const username = config.getOptionalString("username");
1058
1059
  const password = config.getOptionalString("password");
1059
1060
  if (!isValidHost(host)) {
@@ -1186,12 +1187,13 @@ function getBitbucketServerRequestOptions(config) {
1186
1187
  }
1187
1188
 
1188
1189
  function readGerritIntegrationConfig(config) {
1190
+ var _a;
1189
1191
  const host = config.getString("host");
1190
1192
  let baseUrl = config.getOptionalString("baseUrl");
1191
1193
  let cloneUrl = config.getOptionalString("cloneUrl");
1192
1194
  let gitilesBaseUrl = config.getOptionalString("gitilesBaseUrl");
1193
1195
  const username = config.getOptionalString("username");
1194
- const password = config.getOptionalString("password");
1196
+ const password = (_a = config.getOptionalString("password")) == null ? void 0 : _a.trim();
1195
1197
  if (!isValidHost(host)) {
1196
1198
  throw new Error(
1197
1199
  `Invalid Gerrit integration config, '${host}' is not a valid host`
@@ -1392,10 +1394,11 @@ __publicField$7(_GerritIntegration, "factory", ({ config }) => {
1392
1394
  let GerritIntegration = _GerritIntegration;
1393
1395
 
1394
1396
  function readGiteaConfig(config) {
1397
+ var _a;
1395
1398
  const host = config.getString("host");
1396
1399
  let baseUrl = config.getOptionalString("baseUrl");
1397
1400
  const username = config.getOptionalString("username");
1398
- const password = config.getOptionalString("password");
1401
+ const password = (_a = config.getOptionalString("password")) == null ? void 0 : _a.trim();
1399
1402
  if (!isValidHost(host)) {
1400
1403
  throw new Error(
1401
1404
  `Invalid Gitea integration config, '${host}' is not a valid host`
@@ -1503,12 +1506,12 @@ const GITHUB_HOST = "github.com";
1503
1506
  const GITHUB_API_BASE_URL = "https://api.github.com";
1504
1507
  const GITHUB_RAW_BASE_URL = "https://raw.githubusercontent.com";
1505
1508
  function readGithubIntegrationConfig(config) {
1506
- var _a, _b;
1509
+ var _a, _b, _c;
1507
1510
  const host = (_a = config.getOptionalString("host")) != null ? _a : GITHUB_HOST;
1508
1511
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
1509
1512
  let rawBaseUrl = config.getOptionalString("rawBaseUrl");
1510
- const token = config.getOptionalString("token");
1511
- const apps = (_b = config.getOptionalConfigArray("apps")) == null ? void 0 : _b.map((c) => ({
1513
+ const token = (_b = config.getOptionalString("token")) == null ? void 0 : _b.trim();
1514
+ const apps = (_c = config.getOptionalConfigArray("apps")) == null ? void 0 : _c.map((c) => ({
1512
1515
  appId: c.getNumber("appId"),
1513
1516
  clientId: c.getString("clientId"),
1514
1517
  clientSecret: c.getString("clientSecret"),
@@ -1918,9 +1921,10 @@ const replaceGitHubUrlType = replaceGithubUrlType;
1918
1921
  const GITLAB_HOST = "gitlab.com";
1919
1922
  const GITLAB_API_BASE_URL = "https://gitlab.com/api/v4";
1920
1923
  function readGitLabIntegrationConfig(config) {
1924
+ var _a;
1921
1925
  const host = config.getString("host");
1922
1926
  let apiBaseUrl = config.getOptionalString("apiBaseUrl");
1923
- const token = config.getOptionalString("token");
1927
+ const token = (_a = config.getOptionalString("token")) == null ? void 0 : _a.trim();
1924
1928
  let baseUrl = config.getOptionalString("baseUrl");
1925
1929
  if (apiBaseUrl) {
1926
1930
  apiBaseUrl = trimEnd(apiBaseUrl, "/");