@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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @backstage/integration
2
2
 
3
+ ## 1.12.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 395b973: Implemented `readTree` for Harness provider to support TechDocs functionality
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/config@1.2.0
13
+ - @backstage/errors@1.2.4
14
+
15
+ ## 1.11.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 2cc750d: Added `HarnessIntegration` via the `ScmIntegrations` interface.
20
+
3
21
  ## 1.11.0-next.0
4
22
 
5
23
  ### Minor Changes
@@ -12,17 +12,8 @@ import { GiteaIntegration } from './gitea/GiteaIntegration.esm.js';
12
12
  import 'lodash';
13
13
  import { HarnessIntegration } from './harness/HarnessIntegration.esm.js';
14
14
 
15
- var __defProp = Object.defineProperty;
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __publicField = (obj, key, value) => {
18
- __defNormalProp(obj, key + "" , value);
19
- return value;
20
- };
21
15
  class ScmIntegrations {
22
- constructor(integrationsByType) {
23
- __publicField(this, "byType");
24
- this.byType = integrationsByType;
25
- }
16
+ byType;
26
17
  static fromConfig(config) {
27
18
  return new ScmIntegrations({
28
19
  awsS3: AwsS3Integration.factory({ config }),
@@ -38,6 +29,9 @@ class ScmIntegrations {
38
29
  harness: HarnessIntegration.factory({ config })
39
30
  });
40
31
  }
32
+ constructor(integrationsByType) {
33
+ this.byType = integrationsByType;
34
+ }
41
35
  get awsS3() {
42
36
  return this.byType.awsS3;
43
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScmIntegrations.esm.js","sources":["../src/ScmIntegrations.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { AwsS3Integration } from './awsS3/AwsS3Integration';\nimport { AwsCodeCommitIntegration } from './awsCodeCommit/AwsCodeCommitIntegration';\nimport { AzureIntegration } from './azure/AzureIntegration';\nimport { BitbucketCloudIntegration } from './bitbucketCloud/BitbucketCloudIntegration';\nimport { BitbucketIntegration } from './bitbucket/BitbucketIntegration';\nimport { BitbucketServerIntegration } from './bitbucketServer/BitbucketServerIntegration';\nimport { GerritIntegration } from './gerrit/GerritIntegration';\nimport { GithubIntegration } from './github/GithubIntegration';\nimport { GitLabIntegration } from './gitlab/GitLabIntegration';\nimport { defaultScmResolveUrl } from './helpers';\nimport { ScmIntegration, ScmIntegrationsGroup } from './types';\nimport { ScmIntegrationRegistry } from './registry';\nimport { GiteaIntegration } from './gitea';\nimport { HarnessIntegration } from './harness/HarnessIntegration';\n\n/**\n * The set of supported integrations.\n *\n * @public\n */\nexport interface IntegrationsByType {\n awsS3: ScmIntegrationsGroup<AwsS3Integration>;\n awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;\n azure: ScmIntegrationsGroup<AzureIntegration>;\n /**\n * @deprecated in favor of `bitbucketCloud` and `bitbucketServer`\n */\n bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;\n bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;\n bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;\n gerrit: ScmIntegrationsGroup<GerritIntegration>;\n github: ScmIntegrationsGroup<GithubIntegration>;\n gitlab: ScmIntegrationsGroup<GitLabIntegration>;\n gitea: ScmIntegrationsGroup<GiteaIntegration>;\n harness: ScmIntegrationsGroup<HarnessIntegration>;\n}\n\n/**\n * Exposes the set of supported integrations.\n *\n * @public\n */\nexport class ScmIntegrations implements ScmIntegrationRegistry {\n private readonly byType: IntegrationsByType;\n\n static fromConfig(config: Config): ScmIntegrations {\n return new ScmIntegrations({\n awsS3: AwsS3Integration.factory({ config }),\n awsCodeCommit: AwsCodeCommitIntegration.factory({ config }),\n azure: AzureIntegration.factory({ config }),\n bitbucket: BitbucketIntegration.factory({ config }),\n bitbucketCloud: BitbucketCloudIntegration.factory({ config }),\n bitbucketServer: BitbucketServerIntegration.factory({ config }),\n gerrit: GerritIntegration.factory({ config }),\n github: GithubIntegration.factory({ config }),\n gitlab: GitLabIntegration.factory({ config }),\n gitea: GiteaIntegration.factory({ config }),\n harness: HarnessIntegration.factory({ config }),\n });\n }\n\n constructor(integrationsByType: IntegrationsByType) {\n this.byType = integrationsByType;\n }\n\n get awsS3(): ScmIntegrationsGroup<AwsS3Integration> {\n return this.byType.awsS3;\n }\n\n get awsCodeCommit(): ScmIntegrationsGroup<AwsCodeCommitIntegration> {\n return this.byType.awsCodeCommit;\n }\n\n get azure(): ScmIntegrationsGroup<AzureIntegration> {\n return this.byType.azure;\n }\n\n /**\n * @deprecated in favor of `bitbucketCloud()` and `bitbucketServer()`\n */\n get bitbucket(): ScmIntegrationsGroup<BitbucketIntegration> {\n return this.byType.bitbucket;\n }\n\n get bitbucketCloud(): ScmIntegrationsGroup<BitbucketCloudIntegration> {\n return this.byType.bitbucketCloud;\n }\n\n get bitbucketServer(): ScmIntegrationsGroup<BitbucketServerIntegration> {\n return this.byType.bitbucketServer;\n }\n\n get gerrit(): ScmIntegrationsGroup<GerritIntegration> {\n return this.byType.gerrit;\n }\n\n get github(): ScmIntegrationsGroup<GithubIntegration> {\n return this.byType.github;\n }\n\n get gitlab(): ScmIntegrationsGroup<GitLabIntegration> {\n return this.byType.gitlab;\n }\n\n get gitea(): ScmIntegrationsGroup<GiteaIntegration> {\n return this.byType.gitea;\n }\n\n get harness(): ScmIntegrationsGroup<HarnessIntegration> {\n return this.byType.harness;\n }\n\n list(): ScmIntegration[] {\n return Object.values(this.byType).flatMap(\n i => i.list() as ScmIntegration[],\n );\n }\n\n byUrl(url: string | URL): ScmIntegration | undefined {\n let candidates = Object.values(this.byType)\n .map(i => i.byUrl(url))\n .filter(Boolean);\n\n // Do not return deprecated integrations if there are other options\n if (candidates.length > 1) {\n const filteredCandidates = candidates.filter(\n x => !(x instanceof BitbucketIntegration),\n );\n if (filteredCandidates.length !== 0) {\n candidates = filteredCandidates;\n }\n }\n\n return candidates[0];\n }\n\n byHost(host: string): ScmIntegration | undefined {\n return Object.values(this.byType)\n .map(i => i.byHost(host))\n .find(Boolean);\n }\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number;\n }): string {\n const integration = this.byUrl(options.base);\n if (!integration) {\n return defaultScmResolveUrl(options);\n }\n\n return integration.resolveUrl(options);\n }\n\n resolveEditUrl(url: string): string {\n const integration = this.byUrl(url);\n if (!integration) {\n return url;\n }\n\n return integration.resolveEditUrl(url);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA2DO,MAAM,eAAkD,CAAA;AAAA,EAmB7D,YAAY,kBAAwC,EAAA;AAlBpD,IAAiB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAmBf,IAAA,IAAA,CAAK,MAAS,GAAA,kBAAA,CAAA;AAAA,GAChB;AAAA,EAlBA,OAAO,WAAW,MAAiC,EAAA;AACjD,IAAA,OAAO,IAAI,eAAgB,CAAA;AAAA,MACzB,KAAO,EAAA,gBAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1C,aAAe,EAAA,wBAAA,CAAyB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1D,KAAO,EAAA,gBAAA,CAAiB,OAAQ,C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AAA,CAAO,IAAK,CAAA,MAAM,CAC7B,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA,IAAI,CAAC,CAAA,CACvB,KAAK,OAAO,CAAA,CAAA;AAAA,GACjB;AAAA,EAEA,WAAW,OAIA,EAAA;AACT,IAAA,MAAM,WAAc,GAAA,IAAA,CAAK,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA,CAAA;AAC3C,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAA,OAAO,qBAAqB,OAAO,CAAA,CAAA;AAAA,KACrC;AAEA,IAAO,OAAA,WAAA,CAAY,WAAW,OAAO,CAAA,CAAA;AAAA,GACvC;AAAA,EAEA,eAAe,GAAqB,EAAA;AAClC,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAClC,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,GAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,WAAA,CAAY,eAAe,GAAG,CAAA,CAAA;AAAA,GACvC;AACF;;;;"}
1
+ {"version":3,"file":"ScmIntegrations.esm.js","sources":["../src/ScmIntegrations.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { AwsS3Integration } from './awsS3/AwsS3Integration';\nimport { AwsCodeCommitIntegration } from './awsCodeCommit/AwsCodeCommitIntegration';\nimport { AzureIntegration } from './azure/AzureIntegration';\nimport { BitbucketCloudIntegration } from './bitbucketCloud/BitbucketCloudIntegration';\nimport { BitbucketIntegration } from './bitbucket/BitbucketIntegration';\nimport { BitbucketServerIntegration } from './bitbucketServer/BitbucketServerIntegration';\nimport { GerritIntegration } from './gerrit/GerritIntegration';\nimport { GithubIntegration } from './github/GithubIntegration';\nimport { GitLabIntegration } from './gitlab/GitLabIntegration';\nimport { defaultScmResolveUrl } from './helpers';\nimport { ScmIntegration, ScmIntegrationsGroup } from './types';\nimport { ScmIntegrationRegistry } from './registry';\nimport { GiteaIntegration } from './gitea';\nimport { HarnessIntegration } from './harness/HarnessIntegration';\n\n/**\n * The set of supported integrations.\n *\n * @public\n */\nexport interface IntegrationsByType {\n awsS3: ScmIntegrationsGroup<AwsS3Integration>;\n awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;\n azure: ScmIntegrationsGroup<AzureIntegration>;\n /**\n * @deprecated in favor of `bitbucketCloud` and `bitbucketServer`\n */\n bitbucket: ScmIntegrationsGroup<BitbucketIntegration>;\n bitbucketCloud: ScmIntegrationsGroup<BitbucketCloudIntegration>;\n bitbucketServer: ScmIntegrationsGroup<BitbucketServerIntegration>;\n gerrit: ScmIntegrationsGroup<GerritIntegration>;\n github: ScmIntegrationsGroup<GithubIntegration>;\n gitlab: ScmIntegrationsGroup<GitLabIntegration>;\n gitea: ScmIntegrationsGroup<GiteaIntegration>;\n harness: ScmIntegrationsGroup<HarnessIntegration>;\n}\n\n/**\n * Exposes the set of supported integrations.\n *\n * @public\n */\nexport class ScmIntegrations implements ScmIntegrationRegistry {\n private readonly byType: IntegrationsByType;\n\n static fromConfig(config: Config): ScmIntegrations {\n return new ScmIntegrations({\n awsS3: AwsS3Integration.factory({ config }),\n awsCodeCommit: AwsCodeCommitIntegration.factory({ config }),\n azure: AzureIntegration.factory({ config }),\n bitbucket: BitbucketIntegration.factory({ config }),\n bitbucketCloud: BitbucketCloudIntegration.factory({ config }),\n bitbucketServer: BitbucketServerIntegration.factory({ config }),\n gerrit: GerritIntegration.factory({ config }),\n github: GithubIntegration.factory({ config }),\n gitlab: GitLabIntegration.factory({ config }),\n gitea: GiteaIntegration.factory({ config }),\n harness: HarnessIntegration.factory({ config }),\n });\n }\n\n constructor(integrationsByType: IntegrationsByType) {\n this.byType = integrationsByType;\n }\n\n get awsS3(): ScmIntegrationsGroup<AwsS3Integration> {\n return this.byType.awsS3;\n }\n\n get awsCodeCommit(): ScmIntegrationsGroup<AwsCodeCommitIntegration> {\n return this.byType.awsCodeCommit;\n }\n\n get azure(): ScmIntegrationsGroup<AzureIntegration> {\n return this.byType.azure;\n }\n\n /**\n * @deprecated in favor of `bitbucketCloud()` and `bitbucketServer()`\n */\n get bitbucket(): ScmIntegrationsGroup<BitbucketIntegration> {\n return this.byType.bitbucket;\n }\n\n get bitbucketCloud(): ScmIntegrationsGroup<BitbucketCloudIntegration> {\n return this.byType.bitbucketCloud;\n }\n\n get bitbucketServer(): ScmIntegrationsGroup<BitbucketServerIntegration> {\n return this.byType.bitbucketServer;\n }\n\n get gerrit(): ScmIntegrationsGroup<GerritIntegration> {\n return this.byType.gerrit;\n }\n\n get github(): ScmIntegrationsGroup<GithubIntegration> {\n return this.byType.github;\n }\n\n get gitlab(): ScmIntegrationsGroup<GitLabIntegration> {\n return this.byType.gitlab;\n }\n\n get gitea(): ScmIntegrationsGroup<GiteaIntegration> {\n return this.byType.gitea;\n }\n\n get harness(): ScmIntegrationsGroup<HarnessIntegration> {\n return this.byType.harness;\n }\n\n list(): ScmIntegration[] {\n return Object.values(this.byType).flatMap(\n i => i.list() as ScmIntegration[],\n );\n }\n\n byUrl(url: string | URL): ScmIntegration | undefined {\n let candidates = Object.values(this.byType)\n .map(i => i.byUrl(url))\n .filter(Boolean);\n\n // Do not return deprecated integrations if there are other options\n if (candidates.length > 1) {\n const filteredCandidates = candidates.filter(\n x => !(x instanceof BitbucketIntegration),\n );\n if (filteredCandidates.length !== 0) {\n candidates = filteredCandidates;\n }\n }\n\n return candidates[0];\n }\n\n byHost(host: string): ScmIntegration | undefined {\n return Object.values(this.byType)\n .map(i => i.byHost(host))\n .find(Boolean);\n }\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number;\n }): string {\n const integration = this.byUrl(options.base);\n if (!integration) {\n return defaultScmResolveUrl(options);\n }\n\n return integration.resolveUrl(options);\n }\n\n resolveEditUrl(url: string): string {\n const integration = this.byUrl(url);\n if (!integration) {\n return url;\n }\n\n return integration.resolveEditUrl(url);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA2DO,MAAM,eAAkD,CAAA;AAAA,EAC5C,MAAA,CAAA;AAAA,EAEjB,OAAO,WAAW,MAAiC,EAAA;AACjD,IAAA,OAAO,IAAI,eAAgB,CAAA;AAAA,MACzB,KAAO,EAAA,gBAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1C,aAAe,EAAA,wBAAA,CAAyB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1D,KAAO,EAAA,gBAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1C,SAAW,EAAA,oBAAA,CAAqB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAClD,cAAgB,EAAA,yBAAA,CAA0B,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC5D,eAAiB,EAAA,0BAAA,CAA2B,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC9D,MAAQ,EAAA,iBAAA,CAAkB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC5C,MAAQ,EAAA,iBAAA,CAAkB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC5C,MAAQ,EAAA,iBAAA,CAAkB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC5C,KAAO,EAAA,gBAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1C,OAAS,EAAA,kBAAA,CAAmB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,KAC/C,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A,CAAA;AAClC,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,GAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,WAAA,CAAY,eAAe,GAAG,CAAA,CAAA;AAAA,GACvC;AACF;;;;"}
@@ -1,16 +1,21 @@
1
1
  import { basicIntegrations, defaultScmResolveUrl } from '../helpers.esm.js';
2
2
  import { readAwsCodeCommitIntegrationConfigs } from './config.esm.js';
3
3
 
4
- var __defProp = Object.defineProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => {
7
- __defNormalProp(obj, key + "" , value);
8
- return value;
9
- };
10
- const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
4
+ class AwsCodeCommitIntegration {
11
5
  constructor(integrationConfig) {
12
6
  this.integrationConfig = integrationConfig;
13
7
  }
8
+ static factory = ({
9
+ config
10
+ }) => {
11
+ const configs = readAwsCodeCommitIntegrationConfigs(
12
+ config.getOptionalConfigArray("integrations.awsCodeCommit") ?? []
13
+ );
14
+ return basicIntegrations(
15
+ configs.map((c) => new AwsCodeCommitIntegration(c)),
16
+ (i) => i.config.host
17
+ );
18
+ };
14
19
  get type() {
15
20
  return "awsCodeCommit";
16
21
  }
@@ -35,20 +40,7 @@ const _AwsCodeCommitIntegration = class _AwsCodeCommitIntegration {
35
40
  const [, repositoryName] = pathMatch;
36
41
  return replaceCodeCommitUrlType(url, repositoryName);
37
42
  }
38
- };
39
- __publicField(_AwsCodeCommitIntegration, "factory", ({
40
- config
41
- }) => {
42
- var _a;
43
- const configs = readAwsCodeCommitIntegrationConfigs(
44
- (_a = config.getOptionalConfigArray("integrations.awsCodeCommit")) != null ? _a : []
45
- );
46
- return basicIntegrations(
47
- configs.map((c) => new _AwsCodeCommitIntegration(c)),
48
- (i) => i.config.host
49
- );
50
- });
51
- let AwsCodeCommitIntegration = _AwsCodeCommitIntegration;
43
+ }
52
44
  function replaceCodeCommitUrlType(url, repositoryName, type) {
53
45
  const newString = `files/edit` ;
54
46
  return url.replace(
@@ -1 +1 @@
1
- {"version":3,"file":"AwsCodeCommitIntegration.esm.js","sources":["../../src/awsCodeCommit/AwsCodeCommitIntegration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, defaultScmResolveUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport {\n AwsCodeCommitIntegrationConfig,\n readAwsCodeCommitIntegrationConfigs,\n} from './config';\n\n/**\n * Integrates with AWS CodeCommit.\n *\n * @public\n */\nexport class AwsCodeCommitIntegration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AwsCodeCommitIntegration> = ({\n config,\n }) => {\n const configs = readAwsCodeCommitIntegrationConfigs(\n config.getOptionalConfigArray('integrations.awsCodeCommit') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AwsCodeCommitIntegration(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'awsCodeCommit';\n }\n\n get config(): AwsCodeCommitIntegrationConfig {\n return this.integrationConfig;\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n constructor(\n private readonly integrationConfig: AwsCodeCommitIntegrationConfig,\n ) {}\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number | undefined;\n }): string {\n const resolved = defaultScmResolveUrl(options);\n return resolved;\n }\n resolveEditUrl(url: string): string {\n const parsedUrl = new URL(url);\n const pathMatch = parsedUrl.pathname.match(\n /^\\/codesuite\\/codecommit\\/repositories\\/([^\\/]+)\\//,\n );\n if (!pathMatch) {\n throw new Error(``);\n }\n const [, repositoryName] = pathMatch;\n return replaceCodeCommitUrlType(url, repositoryName, 'edit');\n }\n}\n\n/**\n * Takes a CodeCommit URL and replaces the type part (blob, tree etc).\n *\n * @param url - The original URL\n * @param type - The desired type, e.g. 'blob', 'edit'\n * @public\n */\nexport function replaceCodeCommitUrlType(\n url: string,\n repositoryName: string,\n type: 'browse' | 'edit',\n): string {\n const newString = type === 'edit' ? `files/edit` : type;\n return url.replace(\n new RegExp(\n `\\/codesuite\\/codecommit\\/repositories\\/${repositoryName}\\/(browse|files\\/edit)\\/`,\n ),\n `/codesuite/codecommit/repositories/${repositoryName}/${newString}/`,\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA4BO,MAAM,yBAAA,GAAN,MAAM,yBAAmD,CAAA;AAAA,EAyB9D,YACmB,iBACjB,EAAA;AADiB,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA,CAAA;AAAA,GAChB;AAAA,EAdH,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,eAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,MAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,iBAAA,CAAA;AAAA,GACd;AAAA,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA,CAAA;AAAA,GAChC;AAAA,EAMA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAW,qBAAqB,OAAO,CAAA,CAAA;AAC7C,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AAAA,EACA,eAAe,GAAqB,EAAA;AAClC,IAAM,MAAA,SAAA,GAAY,IAAI,GAAA,CAAI,GAAG,CAAA,CAAA;AAC7B,IAAM,MAAA,SAAA,GAAY,UAAU,QAAS,CAAA,KAAA;AAAA,MACnC,oDAAA;AAAA,KACF,CAAA;AACA,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAM,MAAA,IAAI,MAAM,CAAE,CAAA,CAAA,CAAA;AAAA,KACpB;AACA,IAAM,MAAA,GAAG,cAAc,CAAI,GAAA,SAAA,CAAA;AAC3B,IAAO,OAAA,wBAAA,CAAyB,GAAK,EAAA,cAAsB,CAAA,CAAA;AAAA,GAC7D;AACF,CAAA,CAAA;AA/CE,aADW,CAAA,yBAAA,EACJ,WAA4D,CAAC;AAAA,EAClE,MAAA;AACF,CAAM,KAAA;AA/BR,EAAA,IAAA,EAAA,CAAA;AAgCI,EAAA,MAAM,OAAU,GAAA,mCAAA;AAAA,IAAA,CACd,EAAO,GAAA,MAAA,CAAA,sBAAA,CAAuB,4BAA4B,CAAA,KAA1D,YAA+D,EAAC;AAAA,GAClE,CAAA;AACA,EAAO,OAAA,iBAAA;AAAA,IACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,yBAAA,CAAyB,CAAC,CAAC,CAAA;AAAA,IAChD,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,GAChB,CAAA;AACF,CAAA,CAAA,CAAA;AAXK,IAAM,wBAAN,GAAA,0BAAA;AAyDS,SAAA,wBAAA,CACd,GACA,EAAA,cAAA,EACA,IACQ,EAAA;AACR,EAAM,MAAA,SAAA,GAA8B,CAAe,UAAA,CAAA,CAAA,CAAA;AACnD,EAAA,OAAO,GAAI,CAAA,OAAA;AAAA,IACT,IAAI,MAAA;AAAA,MACF,sCAA0C,cAAc,CAAA,qBAAA,CAAA;AAAA,KAC1D;AAAA,IACA,CAAA,mCAAA,EAAsC,cAAc,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,CAAA;AAAA,GACnE,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"AwsCodeCommitIntegration.esm.js","sources":["../../src/awsCodeCommit/AwsCodeCommitIntegration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, defaultScmResolveUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport {\n AwsCodeCommitIntegrationConfig,\n readAwsCodeCommitIntegrationConfigs,\n} from './config';\n\n/**\n * Integrates with AWS CodeCommit.\n *\n * @public\n */\nexport class AwsCodeCommitIntegration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AwsCodeCommitIntegration> = ({\n config,\n }) => {\n const configs = readAwsCodeCommitIntegrationConfigs(\n config.getOptionalConfigArray('integrations.awsCodeCommit') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AwsCodeCommitIntegration(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'awsCodeCommit';\n }\n\n get config(): AwsCodeCommitIntegrationConfig {\n return this.integrationConfig;\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n constructor(\n private readonly integrationConfig: AwsCodeCommitIntegrationConfig,\n ) {}\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number | undefined;\n }): string {\n const resolved = defaultScmResolveUrl(options);\n return resolved;\n }\n resolveEditUrl(url: string): string {\n const parsedUrl = new URL(url);\n const pathMatch = parsedUrl.pathname.match(\n /^\\/codesuite\\/codecommit\\/repositories\\/([^\\/]+)\\//,\n );\n if (!pathMatch) {\n throw new Error(``);\n }\n const [, repositoryName] = pathMatch;\n return replaceCodeCommitUrlType(url, repositoryName, 'edit');\n }\n}\n\n/**\n * Takes a CodeCommit URL and replaces the type part (blob, tree etc).\n *\n * @param url - The original URL\n * @param type - The desired type, e.g. 'blob', 'edit'\n * @public\n */\nexport function replaceCodeCommitUrlType(\n url: string,\n repositoryName: string,\n type: 'browse' | 'edit',\n): string {\n const newString = type === 'edit' ? `files/edit` : type;\n return url.replace(\n new RegExp(\n `\\/codesuite\\/codecommit\\/repositories\\/${repositoryName}\\/(browse|files\\/edit)\\/`,\n ),\n `/codesuite/codecommit/repositories/${repositoryName}/${newString}/`,\n );\n}\n"],"names":[],"mappings":";;;AA4BO,MAAM,wBAAmD,CAAA;AAAA,EAyB9D,YACmB,iBACjB,EAAA;AADiB,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA,CAAA;AAAA,GAChB;AAAA,EA1BH,OAAO,UAA4D,CAAC;AAAA,IAClE,MAAA;AAAA,GACI,KAAA;AACJ,IAAA,MAAM,OAAU,GAAA,mCAAA;AAAA,MACd,MAAO,CAAA,sBAAA,CAAuB,4BAA4B,CAAA,IAAK,EAAC;AAAA,KAClE,CAAA;AACA,IAAO,OAAA,iBAAA;AAAA,MACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,wBAAA,CAAyB,CAAC,CAAC,CAAA;AAAA,MAChD,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,KAChB,CAAA;AAAA,GACF,CAAA;AAAA,EAEA,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,eAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,MAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,iBAAA,CAAA;AAAA,GACd;AAAA,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA,CAAA;AAAA,GAChC;AAAA,EAMA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAW,qBAAqB,OAAO,CAAA,CAAA;AAC7C,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AAAA,EACA,eAAe,GAAqB,EAAA;AAClC,IAAM,MAAA,SAAA,GAAY,IAAI,GAAA,CAAI,GAAG,CAAA,CAAA;AAC7B,IAAM,MAAA,SAAA,GAAY,UAAU,QAAS,CAAA,KAAA;AAAA,MACnC,oDAAA;AAAA,KACF,CAAA;AACA,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAM,MAAA,IAAI,MAAM,CAAE,CAAA,CAAA,CAAA;AAAA,KACpB;AACA,IAAM,MAAA,GAAG,cAAc,CAAI,GAAA,SAAA,CAAA;AAC3B,IAAO,OAAA,wBAAA,CAAyB,GAAK,EAAA,cAAsB,CAAA,CAAA;AAAA,GAC7D;AACF,CAAA;AASgB,SAAA,wBAAA,CACd,GACA,EAAA,cAAA,EACA,IACQ,EAAA;AACR,EAAM,MAAA,SAAA,GAA8B,CAAe,UAAA,CAAA,CAAA,CAAA;AACnD,EAAA,OAAO,GAAI,CAAA,OAAA;AAAA,IACT,IAAI,MAAA;AAAA,MACF,sCAA0C,cAAc,CAAA,qBAAA,CAAA;AAAA,KAC1D;AAAA,IACA,CAAA,mCAAA,EAAsC,cAAc,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,CAAA;AAAA,GACnE,CAAA;AACF;;;;"}
@@ -1,8 +1,7 @@
1
1
  const AMAZON_AWS_CODECOMMIT_HOST = "console.aws.amazon.com";
2
2
  function readAwsCodeCommitIntegrationConfig(config) {
3
- var _a;
4
3
  const accessKeyId = config.getOptionalString("accessKeyId");
5
- const secretAccessKey = (_a = config.getOptionalString("secretAccessKey")) == null ? void 0 : _a.trim();
4
+ const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
6
5
  const roleArn = config.getOptionalString("roleArn");
7
6
  const externalId = config.getOptionalString("externalId");
8
7
  const host = AMAZON_AWS_CODECOMMIT_HOST;
@@ -1 +1 @@
1
- {"version":3,"file":"config.esm.js","sources":["../../src/awsCodeCommit/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_CODECOMMIT_HOST = 'console.aws.amazon.com';\n\n/**\n * The configuration parameters for a single AWS CodeCommit provider.\n *\n * @public\n */\nexport type AwsCodeCommitIntegrationConfig = {\n /**\n * Host, git host derived from region\n */\n host: string;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n};\n\n/**\n * Reads a single Aws CodeCommit integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsCodeCommitIntegrationConfig(\n config: Config,\n): AwsCodeCommitIntegrationConfig {\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n const host = AMAZON_AWS_CODECOMMIT_HOST;\n\n return {\n host,\n accessKeyId,\n secretAccessKey,\n roleArn,\n externalId,\n };\n}\n\n/**\n * Reads a set of AWS CodeCommit integration configs, and inserts some defaults for\n * public Amazon AWS if not specified.\n *\n * @param configs - The config objects of the integrations\n * @public\n */\nexport function readAwsCodeCommitIntegrationConfigs(\n configs: Config[],\n): AwsCodeCommitIntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAwsCodeCommitIntegrationConfig);\n\n // If no explicit console.aws.amazon.com integration was added, put one in the list as\n // a convenience\n if (!result.some(c => c.host === AMAZON_AWS_CODECOMMIT_HOST)) {\n result.push({\n host: AMAZON_AWS_CODECOMMIT_HOST,\n });\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,0BAA6B,GAAA,wBAAA,CAAA;AAyC5B,SAAS,mCACd,MACgC,EAAA;AA7DlC,EAAA,IAAA,EAAA,CAAA;AA8DE,EAAM,MAAA,WAAA,GAAc,MAAO,CAAA,iBAAA,CAAkB,aAAa,CAAA,CAAA;AAC1D,EAAA,MAAM,eAAkB,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,iBAAkB,CAAA,iBAAiB,MAA1C,IAA6C,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,EAAA,CAAA;AACrE,EAAM,MAAA,OAAA,GAAU,MAAO,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AAClD,EAAM,MAAA,UAAA,GAAa,MAAO,CAAA,iBAAA,CAAkB,YAAY,CAAA,CAAA;AACxD,EAAA,MAAM,IAAO,GAAA,0BAAA,CAAA;AAEb,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,oCACd,OACkC,EAAA;AAElC,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,GAAA,CAAI,kCAAkC,CAAA,CAAA;AAI7D,EAAA,IAAI,CAAC,MAAO,CAAA,IAAA,CAAK,OAAK,CAAE,CAAA,IAAA,KAAS,0BAA0B,CAAG,EAAA;AAC5D,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,IAAM,EAAA,0BAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"config.esm.js","sources":["../../src/awsCodeCommit/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_CODECOMMIT_HOST = 'console.aws.amazon.com';\n\n/**\n * The configuration parameters for a single AWS CodeCommit provider.\n *\n * @public\n */\nexport type AwsCodeCommitIntegrationConfig = {\n /**\n * Host, git host derived from region\n */\n host: string;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n};\n\n/**\n * Reads a single Aws CodeCommit integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsCodeCommitIntegrationConfig(\n config: Config,\n): AwsCodeCommitIntegrationConfig {\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n const host = AMAZON_AWS_CODECOMMIT_HOST;\n\n return {\n host,\n accessKeyId,\n secretAccessKey,\n roleArn,\n externalId,\n };\n}\n\n/**\n * Reads a set of AWS CodeCommit integration configs, and inserts some defaults for\n * public Amazon AWS if not specified.\n *\n * @param configs - The config objects of the integrations\n * @public\n */\nexport function readAwsCodeCommitIntegrationConfigs(\n configs: Config[],\n): AwsCodeCommitIntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAwsCodeCommitIntegrationConfig);\n\n // If no explicit console.aws.amazon.com integration was added, put one in the list as\n // a convenience\n if (!result.some(c => c.host === AMAZON_AWS_CODECOMMIT_HOST)) {\n result.push({\n host: AMAZON_AWS_CODECOMMIT_HOST,\n });\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,0BAA6B,GAAA,wBAAA,CAAA;AAyC5B,SAAS,mCACd,MACgC,EAAA;AAChC,EAAM,MAAA,WAAA,GAAc,MAAO,CAAA,iBAAA,CAAkB,aAAa,CAAA,CAAA;AAC1D,EAAA,MAAM,eAAkB,GAAA,MAAA,CAAO,iBAAkB,CAAA,iBAAiB,GAAG,IAAK,EAAA,CAAA;AAC1E,EAAM,MAAA,OAAA,GAAU,MAAO,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AAClD,EAAM,MAAA,UAAA,GAAa,MAAO,CAAA,iBAAA,CAAkB,YAAY,CAAA,CAAA;AACxD,EAAA,MAAM,IAAO,GAAA,0BAAA,CAAA;AAEb,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,oCACd,OACkC,EAAA;AAElC,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,GAAA,CAAI,kCAAkC,CAAA,CAAA;AAI7D,EAAA,IAAI,CAAC,MAAO,CAAA,IAAA,CAAK,OAAK,CAAE,CAAA,IAAA,KAAS,0BAA0B,CAAG,EAAA;AAC5D,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,IAAM,EAAA,0BAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -1,16 +1,19 @@
1
1
  import { basicIntegrations, defaultScmResolveUrl } from '../helpers.esm.js';
2
2
  import { readAwsS3IntegrationConfigs } from './config.esm.js';
3
3
 
4
- var __defProp = Object.defineProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => {
7
- __defNormalProp(obj, key + "" , value);
8
- return value;
9
- };
10
- const _AwsS3Integration = class _AwsS3Integration {
4
+ class AwsS3Integration {
11
5
  constructor(integrationConfig) {
12
6
  this.integrationConfig = integrationConfig;
13
7
  }
8
+ static factory = ({ config }) => {
9
+ const configs = readAwsS3IntegrationConfigs(
10
+ config.getOptionalConfigArray("integrations.awsS3") ?? []
11
+ );
12
+ return basicIntegrations(
13
+ configs.map((c) => new AwsS3Integration(c)),
14
+ (i) => i.config.host
15
+ );
16
+ };
14
17
  get type() {
15
18
  return "awsS3";
16
19
  }
@@ -27,18 +30,7 @@ const _AwsS3Integration = class _AwsS3Integration {
27
30
  resolveEditUrl(url) {
28
31
  return url;
29
32
  }
30
- };
31
- __publicField(_AwsS3Integration, "factory", ({ config }) => {
32
- var _a;
33
- const configs = readAwsS3IntegrationConfigs(
34
- (_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []
35
- );
36
- return basicIntegrations(
37
- configs.map((c) => new _AwsS3Integration(c)),
38
- (i) => i.config.host
39
- );
40
- });
41
- let AwsS3Integration = _AwsS3Integration;
33
+ }
42
34
 
43
35
  export { AwsS3Integration };
44
36
  //# sourceMappingURL=AwsS3Integration.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AwsS3Integration.esm.js","sources":["../../src/awsS3/AwsS3Integration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, defaultScmResolveUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport { AwsS3IntegrationConfig, readAwsS3IntegrationConfigs } from './config';\n\n/**\n * Integrates with AWS S3 or compatible solutions.\n *\n * @public\n */\nexport class AwsS3Integration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AwsS3Integration> = ({ config }) => {\n const configs = readAwsS3IntegrationConfigs(\n config.getOptionalConfigArray('integrations.awsS3') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AwsS3Integration(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'awsS3';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AwsS3IntegrationConfig {\n return this.integrationConfig;\n }\n\n constructor(private readonly integrationConfig: AwsS3IntegrationConfig) {}\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number | undefined;\n }): string {\n const resolved = defaultScmResolveUrl(options);\n return resolved;\n }\n\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for awsS3\n return url;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAyBO,MAAM,iBAAA,GAAN,MAAM,iBAA2C,CAAA;AAAA,EAuBtD,YAA6B,iBAA2C,EAAA;AAA3C,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA,CAAA;AAAA,GAA4C;AAAA,EAZzE,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA,CAAA;AAAA,GAChC;AAAA,EAEA,IAAI,MAAiC,GAAA;AACnC,IAAA,OAAO,IAAK,CAAA,iBAAA,CAAA;AAAA,GACd;AAAA,EAIA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAW,qBAAqB,OAAO,CAAA,CAAA;AAC7C,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AAAA,EAEA,eAAe,GAAqB,EAAA;AAElC,IAAO,OAAA,GAAA,CAAA;AAAA,GACT;AACF,CAAA,CAAA;AArCE,aAAA,CADW,iBACJ,EAAA,SAAA,EAAoD,CAAC,EAAE,QAAa,KAAA;AA1B7E,EAAA,IAAA,EAAA,CAAA;AA2BI,EAAA,MAAM,OAAU,GAAA,2BAAA;AAAA,IAAA,CACd,EAAO,GAAA,MAAA,CAAA,sBAAA,CAAuB,oBAAoB,CAAA,KAAlD,YAAuD,EAAC;AAAA,GAC1D,CAAA;AACA,EAAO,OAAA,iBAAA;AAAA,IACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,iBAAA,CAAiB,CAAC,CAAC,CAAA;AAAA,IACxC,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,GAChB,CAAA;AACF,CAAA,CAAA,CAAA;AATK,IAAM,gBAAN,GAAA;;;;"}
1
+ {"version":3,"file":"AwsS3Integration.esm.js","sources":["../../src/awsS3/AwsS3Integration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, defaultScmResolveUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport { AwsS3IntegrationConfig, readAwsS3IntegrationConfigs } from './config';\n\n/**\n * Integrates with AWS S3 or compatible solutions.\n *\n * @public\n */\nexport class AwsS3Integration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AwsS3Integration> = ({ config }) => {\n const configs = readAwsS3IntegrationConfigs(\n config.getOptionalConfigArray('integrations.awsS3') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AwsS3Integration(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'awsS3';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AwsS3IntegrationConfig {\n return this.integrationConfig;\n }\n\n constructor(private readonly integrationConfig: AwsS3IntegrationConfig) {}\n\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number | undefined;\n }): string {\n const resolved = defaultScmResolveUrl(options);\n return resolved;\n }\n\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for awsS3\n return url;\n }\n}\n"],"names":[],"mappings":";;;AAyBO,MAAM,gBAA2C,CAAA;AAAA,EAuBtD,YAA6B,iBAA2C,EAAA;AAA3C,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA,CAAA;AAAA,GAA4C;AAAA,EAtBzE,OAAO,OAAA,GAAoD,CAAC,EAAE,QAAa,KAAA;AACzE,IAAA,MAAM,OAAU,GAAA,2BAAA;AAAA,MACd,MAAO,CAAA,sBAAA,CAAuB,oBAAoB,CAAA,IAAK,EAAC;AAAA,KAC1D,CAAA;AACA,IAAO,OAAA,iBAAA;AAAA,MACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,gBAAA,CAAiB,CAAC,CAAC,CAAA;AAAA,MACxC,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,KAChB,CAAA;AAAA,GACF,CAAA;AAAA,EAEA,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA,CAAA;AAAA,GAChC;AAAA,EAEA,IAAI,MAAiC,GAAA;AACnC,IAAA,OAAO,IAAK,CAAA,iBAAA,CAAA;AAAA,GACd;AAAA,EAIA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAW,qBAAqB,OAAO,CAAA,CAAA;AAC7C,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AAAA,EAEA,eAAe,GAAqB,EAAA;AAElC,IAAO,OAAA,GAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -1,8 +1,7 @@
1
1
  const AMAZON_AWS_HOST = "amazonaws.com";
2
2
  function readAwsS3IntegrationConfig(config) {
3
- var _a, _b;
4
3
  const endpoint = config.getOptionalString("endpoint");
5
- const s3ForcePathStyle = (_a = config.getOptionalBoolean("s3ForcePathStyle")) != null ? _a : false;
4
+ const s3ForcePathStyle = config.getOptionalBoolean("s3ForcePathStyle") ?? false;
6
5
  let host;
7
6
  let pathname;
8
7
  if (endpoint) {
@@ -24,7 +23,7 @@ function readAwsS3IntegrationConfig(config) {
24
23
  host = AMAZON_AWS_HOST;
25
24
  }
26
25
  const accessKeyId = config.getOptionalString("accessKeyId");
27
- const secretAccessKey = (_b = config.getOptionalString("secretAccessKey")) == null ? void 0 : _b.trim();
26
+ const secretAccessKey = config.getOptionalString("secretAccessKey")?.trim();
28
27
  const roleArn = config.getOptionalString("roleArn");
29
28
  const externalId = config.getOptionalString("externalId");
30
29
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"config.esm.js","sources":["../../src/awsS3/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_HOST = 'amazonaws.com';\n\n/**\n * The configuration parameters for a single AWS S3 provider.\n *\n * @public\n */\nexport type AwsS3IntegrationConfig = {\n /**\n * Host, derived from endpoint, and defaults to amazonaws.com\n */\n host: string;\n\n /**\n * (Optional) AWS Endpoint.\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property\n *\n * Supports non-AWS providers, e.g. for LocalStack, endpoint may look like http://localhost:4566\n */\n endpoint?: string;\n\n /**\n * (Optional) Whether to use path style URLs when communicating with S3.\n * Defaults to false.\n * This allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used.\n */\n s3ForcePathStyle?: boolean;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n};\n\n/**\n * Reads a single Aws S3 integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsS3IntegrationConfig(\n config: Config,\n): AwsS3IntegrationConfig {\n const endpoint = config.getOptionalString('endpoint');\n const s3ForcePathStyle =\n config.getOptionalBoolean('s3ForcePathStyle') ?? false;\n let host;\n let pathname;\n if (endpoint) {\n try {\n const url = new URL(endpoint);\n host = url.host;\n pathname = url.pathname;\n } catch {\n throw new Error(\n `invalid awsS3 integration config, endpoint '${endpoint}' is not a valid URL`,\n );\n }\n if (pathname !== '/') {\n throw new Error(\n `invalid awsS3 integration config, endpoints cannot contain path, got '${endpoint}'`,\n );\n }\n } else {\n host = AMAZON_AWS_HOST;\n }\n\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n\n return {\n host,\n endpoint,\n s3ForcePathStyle,\n accessKeyId,\n secretAccessKey,\n roleArn,\n externalId,\n };\n}\n\n/**\n * Reads a set of AWS S3 integration configs, and inserts some defaults for\n * public Amazon AWS if not specified.\n *\n * @param configs - The config objects of the integrations\n * @public\n */\nexport function readAwsS3IntegrationConfigs(\n configs: Config[],\n): AwsS3IntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAwsS3IntegrationConfig);\n\n // If no explicit amazonaws.com integration was added, put one in the list as\n // a convenience\n if (!result.some(c => c.host === AMAZON_AWS_HOST)) {\n result.push({\n host: AMAZON_AWS_HOST,\n });\n }\n return result;\n}\n"],"names":[],"mappings":"A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MAAA,UAAA,GAAa,MAAO,CAAA,iBAAA,CAAkB,YAAY,CAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,QAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,4BACd,OAC0B,EAAA;AAE1B,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,GAAA,CAAI,0BAA0B,CAAA,CAAA;AAIrD,EAAA,IAAI,CAAC,MAAO,CAAA,IAAA,CAAK,OAAK,CAAE,CAAA,IAAA,KAAS,eAAe,CAAG,EAAA;AACjD,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,IAAM,EAAA,eAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"config.esm.js","sources":["../../src/awsS3/config.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\nconst AMAZON_AWS_HOST = 'amazonaws.com';\n\n/**\n * The configuration parameters for a single AWS S3 provider.\n *\n * @public\n */\nexport type AwsS3IntegrationConfig = {\n /**\n * Host, derived from endpoint, and defaults to amazonaws.com\n */\n host: string;\n\n /**\n * (Optional) AWS Endpoint.\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property\n *\n * Supports non-AWS providers, e.g. for LocalStack, endpoint may look like http://localhost:4566\n */\n endpoint?: string;\n\n /**\n * (Optional) Whether to use path style URLs when communicating with S3.\n * Defaults to false.\n * This allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used.\n */\n s3ForcePathStyle?: boolean;\n\n /**\n * (Optional) User access key id\n */\n accessKeyId?: string;\n\n /**\n * (Optional) User secret access key\n */\n secretAccessKey?: string;\n\n /**\n * (Optional) ARN of role to be assumed\n */\n roleArn?: string;\n\n /**\n * (Optional) External ID to use when assuming role\n */\n externalId?: string;\n};\n\n/**\n * Reads a single Aws S3 integration config.\n *\n * @param config - The config object of a single integration\n * @public\n */\n\nexport function readAwsS3IntegrationConfig(\n config: Config,\n): AwsS3IntegrationConfig {\n const endpoint = config.getOptionalString('endpoint');\n const s3ForcePathStyle =\n config.getOptionalBoolean('s3ForcePathStyle') ?? false;\n let host;\n let pathname;\n if (endpoint) {\n try {\n const url = new URL(endpoint);\n host = url.host;\n pathname = url.pathname;\n } catch {\n throw new Error(\n `invalid awsS3 integration config, endpoint '${endpoint}' is not a valid URL`,\n );\n }\n if (pathname !== '/') {\n throw new Error(\n `invalid awsS3 integration config, endpoints cannot contain path, got '${endpoint}'`,\n );\n }\n } else {\n host = AMAZON_AWS_HOST;\n }\n\n const accessKeyId = config.getOptionalString('accessKeyId');\n const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();\n const roleArn = config.getOptionalString('roleArn');\n const externalId = config.getOptionalString('externalId');\n\n return {\n host,\n endpoint,\n s3ForcePathStyle,\n accessKeyId,\n secretAccessKey,\n roleArn,\n externalId,\n };\n}\n\n/**\n * Reads a set of AWS S3 integration configs, and inserts some defaults for\n * public Amazon AWS if not specified.\n *\n * @param configs - The config objects of the integrations\n * @public\n */\nexport function readAwsS3IntegrationConfigs(\n configs: Config[],\n): AwsS3IntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAwsS3IntegrationConfig);\n\n // If no explicit amazonaws.com integration was added, put one in the list as\n // a convenience\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YAAY,CAAA,CAAA;AAExD,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,QAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF,CAAA;AASO,SAAS,4BACd,OAC0B,EAAA;AAE1B,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,GAAA,CAAI,0BAA0B,CAAA,CAAA;AAIrD,EAAA,IAAI,CAAC,MAAO,CAAA,IAAA,CAAK,OAAK,CAAE,CAAA,IAAA,KAAS,eAAe,CAAG,EAAA;AACjD,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,IAAM,EAAA,eAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -2,16 +2,19 @@ import { basicIntegrations, isValidUrl } from '../helpers.esm.js';
2
2
  import { AzureUrl } from './AzureUrl.esm.js';
3
3
  import { readAzureIntegrationConfigs } from './config.esm.js';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => {
8
- __defNormalProp(obj, key + "" , value);
9
- return value;
10
- };
11
- const _AzureIntegration = class _AzureIntegration {
5
+ class AzureIntegration {
12
6
  constructor(integrationConfig) {
13
7
  this.integrationConfig = integrationConfig;
14
8
  }
9
+ static factory = ({ config }) => {
10
+ const configs = readAzureIntegrationConfigs(
11
+ config.getOptionalConfigArray("integrations.azure") ?? []
12
+ );
13
+ return basicIntegrations(
14
+ configs.map((c) => new AzureIntegration(c)),
15
+ (i) => i.config.host
16
+ );
17
+ };
15
18
  get type() {
16
19
  return "azure";
17
20
  }
@@ -27,7 +30,6 @@ const _AzureIntegration = class _AzureIntegration {
27
30
  * Example base URL: https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml
28
31
  */
29
32
  resolveUrl(options) {
30
- var _a;
31
33
  const { url, base } = options;
32
34
  if (isValidUrl(url)) {
33
35
  return url;
@@ -35,7 +37,7 @@ const _AzureIntegration = class _AzureIntegration {
35
37
  try {
36
38
  const azureUrl = AzureUrl.fromRepoUrl(base);
37
39
  const newUrl = new URL(base);
38
- const mockBaseUrl = new URL(`https://a.com${(_a = azureUrl.getPath()) != null ? _a : ""}`);
40
+ const mockBaseUrl = new URL(`https://a.com${azureUrl.getPath() ?? ""}`);
39
41
  const updatedPath = new URL(url, mockBaseUrl).pathname;
40
42
  newUrl.searchParams.set("path", updatedPath);
41
43
  if (options.lineNumber) {
@@ -52,18 +54,7 @@ const _AzureIntegration = class _AzureIntegration {
52
54
  resolveEditUrl(url) {
53
55
  return url;
54
56
  }
55
- };
56
- __publicField(_AzureIntegration, "factory", ({ config }) => {
57
- var _a;
58
- const configs = readAzureIntegrationConfigs(
59
- (_a = config.getOptionalConfigArray("integrations.azure")) != null ? _a : []
60
- );
61
- return basicIntegrations(
62
- configs.map((c) => new _AzureIntegration(c)),
63
- (i) => i.config.host
64
- );
65
- });
66
- let AzureIntegration = _AzureIntegration;
57
+ }
67
58
 
68
59
  export { AzureIntegration };
69
60
  //# sourceMappingURL=AzureIntegration.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AzureIntegration.esm.js","sources":["../../src/azure/AzureIntegration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, isValidUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport { AzureUrl } from './AzureUrl';\nimport { AzureIntegrationConfig, readAzureIntegrationConfigs } from './config';\n\n/**\n * Microsoft Azure based integration.\n *\n * @public\n */\nexport class AzureIntegration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AzureIntegration> = ({ config }) => {\n const configs = readAzureIntegrationConfigs(\n config.getOptionalConfigArray('integrations.azure') ?? [],\n );\n\n return basicIntegrations(\n configs.map(c => new AzureIntegration(c)),\n i => i.config.host,\n );\n };\n\n constructor(private readonly integrationConfig: AzureIntegrationConfig) {}\n\n get type(): string {\n return 'azure';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AzureIntegrationConfig {\n return this.integrationConfig;\n }\n\n /*\n * Azure repo URLs on the form with a `path` query param are treated specially.\n *\n * Example base URL: https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml\n */\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number;\n }): string {\n const { url, base } = options;\n\n // If we can parse the url, it is absolute - then return it verbatim\n if (isValidUrl(url)) {\n return url;\n }\n\n try {\n const azureUrl = AzureUrl.fromRepoUrl(base);\n const newUrl = new URL(base);\n\n // We lean on the URL path resolution logic to resolve the path param\n const mockBaseUrl = new URL(`https://a.com${azureUrl.getPath() ?? ''}`);\n const updatedPath = new URL(url, mockBaseUrl).pathname;\n newUrl.searchParams.set('path', updatedPath);\n\n if (options.lineNumber) {\n newUrl.searchParams.set('line', String(options.lineNumber));\n newUrl.searchParams.set('lineEnd', String(options.lineNumber + 1));\n newUrl.searchParams.set('lineStartColumn', '1');\n newUrl.searchParams.set('lineEndColumn', '1');\n }\n\n return newUrl.toString();\n } catch {\n // If not an actual file path within a repo, treat the URL as raw\n return new URL(url, base).toString();\n }\n }\n\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for Azure, fallback to view url as I don't know\n // how azure works.\n return url;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AA0BO,MAAM,iBAAA,GAAN,M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C,CAAA,CAAA;AAC1D,QAAA,MAAA,CAAO,aAAa,GAAI,CAAA,SAAA,EAAW,OAAO,OAAQ,CAAA,UAAA,GAAa,CAAC,CAAC,CAAA,CAAA;AACjE,QAAO,MAAA,CAAA,YAAA,CAAa,GAAI,CAAA,iBAAA,EAAmB,GAAG,CAAA,CAAA;AAC9C,QAAO,MAAA,CAAA,YAAA,CAAa,GAAI,CAAA,eAAA,EAAiB,GAAG,CAAA,CAAA;AAAA,OAC9C;AAEA,MAAA,OAAO,OAAO,QAAS,EAAA,CAAA;AAAA,KACjB,CAAA,MAAA;AAEN,MAAA,OAAO,IAAI,GAAA,CAAI,GAAK,EAAA,IAAI,EAAE,QAAS,EAAA,CAAA;AAAA,KACrC;AAAA,GACF;AAAA,EAEA,eAAe,GAAqB,EAAA;AAGlC,IAAO,OAAA,GAAA,CAAA;AAAA,GACT;AACF,CAAA,CAAA;AAtEE,aAAA,CADW,iBACJ,EAAA,SAAA,EAAoD,CAAC,EAAE,QAAa,KAAA;AA3B7E,EAAA,IAAA,EAAA,CAAA;AA4BI,EAAA,MAAM,OAAU,GAAA,2BAAA;AAAA,IAAA,CACd,EAAO,GAAA,MAAA,CAAA,sBAAA,CAAuB,oBAAoB,CAAA,KAAlD,YAAuD,EAAC;AAAA,GAC1D,CAAA;AAEA,EAAO,OAAA,iBAAA;AAAA,IACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,iBAAA,CAAiB,CAAC,CAAC,CAAA;AAAA,IACxC,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,GAChB,CAAA;AACF,CAAA,CAAA,CAAA;AAVK,IAAM,gBAAN,GAAA;;;;"}
1
+ {"version":3,"file":"AzureIntegration.esm.js","sources":["../../src/azure/AzureIntegration.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { basicIntegrations, isValidUrl } from '../helpers';\nimport { ScmIntegration, ScmIntegrationsFactory } from '../types';\nimport { AzureUrl } from './AzureUrl';\nimport { AzureIntegrationConfig, readAzureIntegrationConfigs } from './config';\n\n/**\n * Microsoft Azure based integration.\n *\n * @public\n */\nexport class AzureIntegration implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AzureIntegration> = ({ config }) => {\n const configs = readAzureIntegrationConfigs(\n config.getOptionalConfigArray('integrations.azure') ?? [],\n );\n\n return basicIntegrations(\n configs.map(c => new AzureIntegration(c)),\n i => i.config.host,\n );\n };\n\n constructor(private readonly integrationConfig: AzureIntegrationConfig) {}\n\n get type(): string {\n return 'azure';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AzureIntegrationConfig {\n return this.integrationConfig;\n }\n\n /*\n * Azure repo URLs on the form with a `path` query param are treated specially.\n *\n * Example base URL: https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml\n */\n resolveUrl(options: {\n url: string;\n base: string;\n lineNumber?: number;\n }): string {\n const { url, base } = options;\n\n // If we can parse the url, it is absolute - then return it verbatim\n if (isValidUrl(url)) {\n return url;\n }\n\n try {\n const azureUrl = AzureUrl.fromRepoUrl(base);\n const newUrl = new URL(base);\n\n // We lean on the URL path resolution logic to resolve the path param\n const mockBaseUrl = new URL(`https://a.com${azureUrl.getPath() ?? ''}`);\n const updatedPath = new URL(url, mockBaseUrl).pathname;\n newUrl.searchParams.set('path', updatedPath);\n\n if (options.lineNumber) {\n newUrl.searchParams.set('line', String(options.lineNumber));\n newUrl.searchParams.set('lineEnd', String(options.lineNumber + 1));\n newUrl.searchParams.set('lineStartColumn', '1');\n newUrl.searchParams.set('lineEndColumn', '1');\n }\n\n return newUrl.toString();\n } catch {\n // If not an actual file path within a repo, treat the URL as raw\n return new URL(url, base).toString();\n }\n }\n\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for Azure, fallback to view url as I don't know\n // how azure works.\n return url;\n }\n}\n"],"names":[],"mappings":";;;;AA0BO,MAAM,gBAA2C,CAAA;AAAA,EAYtD,YAA6B,iBAA2C,EAAA;AAA3C,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA,CAAA;AAAA,GAA4C;AAAA,EAXzE,OAAO,OAAA,GAAoD,CAAC,EAAE,QAAa,KAAA;AACzE,IAAA,MAAM,OAAU,GAAA,2BAAA;AAAA,MACd,MAAO,CAAA,sBAAA,CAAuB,oBAAoB,CAAA,IAAK,EAAC;AAAA,KAC1D,CAAA;AAEA,IAAO,OAAA,iBAAA;AAAA,MACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,gBAAA,CAAiB,CAAC,CAAC,CAAA;AAAA,MACxC,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,IAAA;AAAA,KAChB,CAAA;AAAA,GACF,CAAA;AAAA,EAIA,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,OAAA,CAAA;AAAA,GACT;AAAA,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA,CAAA;AAAA,GAChC;AAAA,EAEA,IAAI,MAAiC,GAAA;AACnC,IAAA,OAAO,IAAK,CAAA,iBAAA,CAAA;AAAA,GACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,EAAE,GAAK,EAAA,IAAA,EAAS,GAAA,OAAA,CAAA;AAGtB,IAAI,IAAA,UAAA,CAAW,GAAG,CAAG,EAAA;AACnB,MAAO,OAAA,GAAA,CAAA;AAAA,KACT;AAEA,IAAI,IAAA;AACF,MAAM,MAAA,QAAA,GAAW,QAAS,CAAA,WAAA,C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