@backstage/integration 1.15.2 → 1.16.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/CHANGELOG.md +12 -0
- package/dist/ScmIntegrations.cjs.js +6 -0
- package/dist/ScmIntegrations.cjs.js.map +1 -1
- package/dist/ScmIntegrations.esm.js +6 -0
- package/dist/ScmIntegrations.esm.js.map +1 -1
- package/dist/azureBlobStorage/AzureBlobStorageIntegration.cjs.js +40 -0
- package/dist/azureBlobStorage/AzureBlobStorageIntegration.cjs.js.map +1 -0
- package/dist/azureBlobStorage/AzureBlobStorageIntegration.esm.js +38 -0
- package/dist/azureBlobStorage/AzureBlobStorageIntegration.esm.js.map +1 -0
- package/dist/azureBlobStorage/DefaultAzureCredentialsProvider.cjs.js +49 -0
- package/dist/azureBlobStorage/DefaultAzureCredentialsProvider.cjs.js.map +1 -0
- package/dist/azureBlobStorage/DefaultAzureCredentialsProvider.esm.js +47 -0
- package/dist/azureBlobStorage/DefaultAzureCredentialsProvider.esm.js.map +1 -0
- package/dist/azureBlobStorage/config.cjs.js +69 -0
- package/dist/azureBlobStorage/config.cjs.js.map +1 -0
- package/dist/azureBlobStorage/config.esm.js +66 -0
- package/dist/azureBlobStorage/config.esm.js.map +1 -0
- package/dist/index.cjs.js +35 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +178 -60
- package/dist/index.esm.js +3 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage/integration
|
|
2
2
|
|
|
3
|
+
## 1.16.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 277092a: Add the integration for Azure blob storage to read the credentials to access the storage account and provide the default credential provider.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/config@1.3.0
|
|
13
|
+
- @backstage/errors@1.2.5
|
|
14
|
+
|
|
3
15
|
## 1.15.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -13,6 +13,8 @@ var helpers = require('./helpers.cjs.js');
|
|
|
13
13
|
var GiteaIntegration = require('./gitea/GiteaIntegration.cjs.js');
|
|
14
14
|
require('lodash');
|
|
15
15
|
var HarnessIntegration = require('./harness/HarnessIntegration.cjs.js');
|
|
16
|
+
var AzureBlobStorageIntegration = require('./azureBlobStorage/AzureBlobStorageIntegration.cjs.js');
|
|
17
|
+
require('@azure/identity');
|
|
16
18
|
|
|
17
19
|
class ScmIntegrations {
|
|
18
20
|
byType;
|
|
@@ -20,6 +22,7 @@ class ScmIntegrations {
|
|
|
20
22
|
return new ScmIntegrations({
|
|
21
23
|
awsS3: AwsS3Integration.AwsS3Integration.factory({ config }),
|
|
22
24
|
awsCodeCommit: AwsCodeCommitIntegration.AwsCodeCommitIntegration.factory({ config }),
|
|
25
|
+
azureBlobStorage: AzureBlobStorageIntegration.AzureBlobStorageIntergation.factory({ config }),
|
|
23
26
|
azure: AzureIntegration.AzureIntegration.factory({ config }),
|
|
24
27
|
bitbucket: BitbucketIntegration.BitbucketIntegration.factory({ config }),
|
|
25
28
|
bitbucketCloud: BitbucketCloudIntegration.BitbucketCloudIntegration.factory({ config }),
|
|
@@ -40,6 +43,9 @@ class ScmIntegrations {
|
|
|
40
43
|
get awsCodeCommit() {
|
|
41
44
|
return this.byType.awsCodeCommit;
|
|
42
45
|
}
|
|
46
|
+
get azureBlobStorage() {
|
|
47
|
+
return this.byType.azureBlobStorage;
|
|
48
|
+
}
|
|
43
49
|
get azure() {
|
|
44
50
|
return this.byType.azure;
|
|
45
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScmIntegrations.cjs.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":["AwsS3Integration","AwsCodeCommitIntegration","AzureIntegration","BitbucketIntegration","BitbucketCloudIntegration","BitbucketServerIntegration","GerritIntegration","GithubIntegration","GitLabIntegration","GiteaIntegration","HarnessIntegration","defaultScmResolveUrl"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScmIntegrations.cjs.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';\nimport { AzureBlobStorageIntergation } from './azureBlobStorage';\n\n/**\n * The set of supported integrations.\n *\n * @public\n */\nexport interface IntegrationsByType {\n awsS3: ScmIntegrationsGroup<AwsS3Integration>;\n awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;\n azureBlobStorage: ScmIntegrationsGroup<AzureBlobStorageIntergation>;\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 azureBlobStorage: AzureBlobStorageIntergation.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 azureBlobStorage(): ScmIntegrationsGroup<AzureBlobStorageIntergation> {\n return this.byType.azureBlobStorage;\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":["AwsS3Integration","AwsCodeCommitIntegration","AzureBlobStorageIntergation","AzureIntegration","BitbucketIntegration","BitbucketCloudIntegration","BitbucketServerIntegration","GerritIntegration","GithubIntegration","GitLabIntegration","GiteaIntegration","HarnessIntegration","defaultScmResolveUrl"],"mappings":";;;;;;;;;;;;;;;;;;AA6DO,MAAM,eAAkD,CAAA;AAAA,EAC5C,MAAA;AAAA,EAEjB,OAAO,WAAW,MAAiC,EAAA;AACjD,IAAA,OAAO,IAAI,eAAgB,CAAA;AAAA,MACzB,KAAO,EAAAA,iCAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1C,aAAe,EAAAC,iDAAA,CAAyB,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAC1D,gBAAkB,EAAAC,uDAAA,CAA4B,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAAA,MAChE,KAAO,EAAAC,iCAAA,CAAiB,OAAQ,CAAA,EAAE,QAAQ,C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CAAA,KAAA,CAAA,CAAE,MAAO,CAAA,IAAI,CAAC,CAAA,CACvB,KAAK,OAAO,CAAA;AAAA;AACjB,EAEA,WAAW,OAIA,EAAA;AACT,IAAA,MAAM,WAAc,GAAA,IAAA,CAAK,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAC3C,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAA,OAAOQ,6BAAqB,OAAO,CAAA;AAAA;AAGrC,IAAO,OAAA,WAAA,CAAY,WAAW,OAAO,CAAA;AAAA;AACvC,EAEA,eAAe,GAAqB,EAAA;AAClC,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,KAAA,CAAM,GAAG,CAAA;AAClC,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,GAAA;AAAA;AAGT,IAAO,OAAA,WAAA,CAAY,eAAe,GAAG,CAAA;AAAA;AAEzC;;;;"}
|
|
@@ -11,6 +11,8 @@ import { defaultScmResolveUrl } from './helpers.esm.js';
|
|
|
11
11
|
import { GiteaIntegration } from './gitea/GiteaIntegration.esm.js';
|
|
12
12
|
import 'lodash';
|
|
13
13
|
import { HarnessIntegration } from './harness/HarnessIntegration.esm.js';
|
|
14
|
+
import { AzureBlobStorageIntergation } from './azureBlobStorage/AzureBlobStorageIntegration.esm.js';
|
|
15
|
+
import '@azure/identity';
|
|
14
16
|
|
|
15
17
|
class ScmIntegrations {
|
|
16
18
|
byType;
|
|
@@ -18,6 +20,7 @@ class ScmIntegrations {
|
|
|
18
20
|
return new ScmIntegrations({
|
|
19
21
|
awsS3: AwsS3Integration.factory({ config }),
|
|
20
22
|
awsCodeCommit: AwsCodeCommitIntegration.factory({ config }),
|
|
23
|
+
azureBlobStorage: AzureBlobStorageIntergation.factory({ config }),
|
|
21
24
|
azure: AzureIntegration.factory({ config }),
|
|
22
25
|
bitbucket: BitbucketIntegration.factory({ config }),
|
|
23
26
|
bitbucketCloud: BitbucketCloudIntegration.factory({ config }),
|
|
@@ -38,6 +41,9 @@ class ScmIntegrations {
|
|
|
38
41
|
get awsCodeCommit() {
|
|
39
42
|
return this.byType.awsCodeCommit;
|
|
40
43
|
}
|
|
44
|
+
get azureBlobStorage() {
|
|
45
|
+
return this.byType.azureBlobStorage;
|
|
46
|
+
}
|
|
41
47
|
get azure() {
|
|
42
48
|
return this.byType.azure;
|
|
43
49
|
}
|
|
@@ -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":"
|
|
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';\nimport { AzureBlobStorageIntergation } from './azureBlobStorage';\n\n/**\n * The set of supported integrations.\n *\n * @public\n */\nexport interface IntegrationsByType {\n awsS3: ScmIntegrationsGroup<AwsS3Integration>;\n awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;\n azureBlobStorage: ScmIntegrationsGroup<AzureBlobStorageIntergation>;\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 azureBlobStorage: AzureBlobStorageIntergation.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 azureBlobStorage(): ScmIntegrationsGroup<AzureBlobStorageIntergation> {\n return this.byType.azureBlobStorage;\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":";;;;;;;;;;;;;;;;AA6DO,MAAM,eAAkD,CAAA;AAAA,EAC5C,MAAA;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,gBAAkB,EAAA,2BAAA,CAA4B,OAAQ,CAAA,EAAE,QAAQ,CAAA;AAA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O,IAAK,CAAA,MAAM,CAC7B,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA,IAAI,CAAC,CAAA,CACvB,KAAK,OAAO,CAAA;AAAA;AACjB,EAEA,WAAW,OAIA,EAAA;AACT,IAAA,MAAM,WAAc,GAAA,IAAA,CAAK,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAC3C,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAA,OAAO,qBAAqB,OAAO,CAAA;AAAA;AAGrC,IAAO,OAAA,WAAA,CAAY,WAAW,OAAO,CAAA;AAAA;AACvC,EAEA,eAAe,GAAqB,EAAA;AAClC,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,KAAA,CAAM,GAAG,CAAA;AAClC,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,GAAA;AAAA;AAGT,IAAO,OAAA,WAAA,CAAY,eAAe,GAAG,CAAA;AAAA;AAEzC;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var helpers = require('../helpers.cjs.js');
|
|
4
|
+
var config = require('./config.cjs.js');
|
|
5
|
+
|
|
6
|
+
class AzureBlobStorageIntergation {
|
|
7
|
+
constructor(integrationConfig) {
|
|
8
|
+
this.integrationConfig = integrationConfig;
|
|
9
|
+
}
|
|
10
|
+
static factory = ({
|
|
11
|
+
config: config$1
|
|
12
|
+
}) => {
|
|
13
|
+
const configs = config.readAzureBlobStorageIntegrationConfigs(
|
|
14
|
+
config$1.getOptionalConfigArray("integrations.azureBlobStorage") ?? []
|
|
15
|
+
);
|
|
16
|
+
return helpers.basicIntegrations(
|
|
17
|
+
configs.map((c) => new AzureBlobStorageIntergation(c)),
|
|
18
|
+
(i) => i.config.host
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
get type() {
|
|
22
|
+
return "azureBlobStorage";
|
|
23
|
+
}
|
|
24
|
+
get title() {
|
|
25
|
+
return this.integrationConfig.host;
|
|
26
|
+
}
|
|
27
|
+
get config() {
|
|
28
|
+
return this.integrationConfig;
|
|
29
|
+
}
|
|
30
|
+
resolveUrl(options) {
|
|
31
|
+
const resolved = helpers.defaultScmResolveUrl(options);
|
|
32
|
+
return resolved;
|
|
33
|
+
}
|
|
34
|
+
resolveEditUrl(url) {
|
|
35
|
+
return url;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.AzureBlobStorageIntergation = AzureBlobStorageIntergation;
|
|
40
|
+
//# sourceMappingURL=AzureBlobStorageIntegration.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureBlobStorageIntegration.cjs.js","sources":["../../src/azureBlobStorage/AzureBlobStorageIntegration.ts"],"sourcesContent":["/*\n * Copyright 2024 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 AzureBlobStorageIntegrationConfig,\n readAzureBlobStorageIntegrationConfigs,\n} from './config';\n\n/**\n * Microsoft Azure Blob storage based integration.\n *\n * @public\n */\nexport class AzureBlobStorageIntergation implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AzureBlobStorageIntergation> = ({\n config,\n }) => {\n const configs = readAzureBlobStorageIntegrationConfigs(\n config.getOptionalConfigArray('integrations.azureBlobStorage') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AzureBlobStorageIntergation(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'azureBlobStorage';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AzureBlobStorageIntegrationConfig {\n return this.integrationConfig;\n }\n\n constructor(\n private readonly integrationConfig: AzureBlobStorageIntegrationConfig,\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\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for azureBlobStorage\n return url;\n }\n}\n"],"names":["config","readAzureBlobStorageIntegrationConfigs","basicIntegrations","defaultScmResolveUrl"],"mappings":";;;;;AA4BO,MAAM,2BAAsD,CAAA;AAAA,EAyBjE,YACmB,iBACjB,EAAA;AADiB,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA;AAAA;AAChB,EA1BH,OAAO,UAA+D,CAAC;AAAA,YACrEA;AAAA,GACI,KAAA;AACJ,IAAA,MAAM,OAAU,GAAAC,6CAAA;AAAA,MACdD,QAAO,CAAA,sBAAA,CAAuB,+BAA+B,CAAA,IAAK;AAAC,KACrE;AACA,IAAO,OAAAE,yBAAA;AAAA,MACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,2BAAA,CAA4B,CAAC,CAAC,CAAA;AAAA,MACnD,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA;AAAA,KAChB;AAAA,GACF;AAAA,EAEA,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,kBAAA;AAAA;AACT,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA;AAAA;AAChC,EAEA,IAAI,MAA4C,GAAA;AAC9C,IAAA,OAAO,IAAK,CAAA,iBAAA;AAAA;AACd,EAMA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAWC,6BAAqB,OAAO,CAAA;AAC7C,IAAO,OAAA,QAAA;AAAA;AACT,EAEA,eAAe,GAAqB,EAAA;AAElC,IAAO,OAAA,GAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { basicIntegrations, defaultScmResolveUrl } from '../helpers.esm.js';
|
|
2
|
+
import { readAzureBlobStorageIntegrationConfigs } from './config.esm.js';
|
|
3
|
+
|
|
4
|
+
class AzureBlobStorageIntergation {
|
|
5
|
+
constructor(integrationConfig) {
|
|
6
|
+
this.integrationConfig = integrationConfig;
|
|
7
|
+
}
|
|
8
|
+
static factory = ({
|
|
9
|
+
config
|
|
10
|
+
}) => {
|
|
11
|
+
const configs = readAzureBlobStorageIntegrationConfigs(
|
|
12
|
+
config.getOptionalConfigArray("integrations.azureBlobStorage") ?? []
|
|
13
|
+
);
|
|
14
|
+
return basicIntegrations(
|
|
15
|
+
configs.map((c) => new AzureBlobStorageIntergation(c)),
|
|
16
|
+
(i) => i.config.host
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
get type() {
|
|
20
|
+
return "azureBlobStorage";
|
|
21
|
+
}
|
|
22
|
+
get title() {
|
|
23
|
+
return this.integrationConfig.host;
|
|
24
|
+
}
|
|
25
|
+
get config() {
|
|
26
|
+
return this.integrationConfig;
|
|
27
|
+
}
|
|
28
|
+
resolveUrl(options) {
|
|
29
|
+
const resolved = defaultScmResolveUrl(options);
|
|
30
|
+
return resolved;
|
|
31
|
+
}
|
|
32
|
+
resolveEditUrl(url) {
|
|
33
|
+
return url;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { AzureBlobStorageIntergation };
|
|
38
|
+
//# sourceMappingURL=AzureBlobStorageIntegration.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureBlobStorageIntegration.esm.js","sources":["../../src/azureBlobStorage/AzureBlobStorageIntegration.ts"],"sourcesContent":["/*\n * Copyright 2024 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 AzureBlobStorageIntegrationConfig,\n readAzureBlobStorageIntegrationConfigs,\n} from './config';\n\n/**\n * Microsoft Azure Blob storage based integration.\n *\n * @public\n */\nexport class AzureBlobStorageIntergation implements ScmIntegration {\n static factory: ScmIntegrationsFactory<AzureBlobStorageIntergation> = ({\n config,\n }) => {\n const configs = readAzureBlobStorageIntegrationConfigs(\n config.getOptionalConfigArray('integrations.azureBlobStorage') ?? [],\n );\n return basicIntegrations(\n configs.map(c => new AzureBlobStorageIntergation(c)),\n i => i.config.host,\n );\n };\n\n get type(): string {\n return 'azureBlobStorage';\n }\n\n get title(): string {\n return this.integrationConfig.host;\n }\n\n get config(): AzureBlobStorageIntegrationConfig {\n return this.integrationConfig;\n }\n\n constructor(\n private readonly integrationConfig: AzureBlobStorageIntegrationConfig,\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\n resolveEditUrl(url: string): string {\n // TODO: Implement edit URL for azureBlobStorage\n return url;\n }\n}\n"],"names":[],"mappings":";;;AA4BO,MAAM,2BAAsD,CAAA;AAAA,EAyBjE,YACmB,iBACjB,EAAA;AADiB,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA;AAAA;AAChB,EA1BH,OAAO,UAA+D,CAAC;AAAA,IACrE;AAAA,GACI,KAAA;AACJ,IAAA,MAAM,OAAU,GAAA,sCAAA;AAAA,MACd,MAAO,CAAA,sBAAA,CAAuB,+BAA+B,CAAA,IAAK;AAAC,KACrE;AACA,IAAO,OAAA,iBAAA;AAAA,MACL,QAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,IAAI,2BAAA,CAA4B,CAAC,CAAC,CAAA;AAAA,MACnD,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA;AAAA,KAChB;AAAA,GACF;AAAA,EAEA,IAAI,IAAe,GAAA;AACjB,IAAO,OAAA,kBAAA;AAAA;AACT,EAEA,IAAI,KAAgB,GAAA;AAClB,IAAA,OAAO,KAAK,iBAAkB,CAAA,IAAA;AAAA;AAChC,EAEA,IAAI,MAA4C,GAAA;AAC9C,IAAA,OAAO,IAAK,CAAA,iBAAA;AAAA;AACd,EAMA,WAAW,OAIA,EAAA;AACT,IAAM,MAAA,QAAA,GAAW,qBAAqB,OAAO,CAAA;AAC7C,IAAO,OAAA,QAAA;AAAA;AACT,EAEA,eAAe,GAAqB,EAAA;AAElC,IAAO,OAAA,GAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var identity = require('@azure/identity');
|
|
4
|
+
|
|
5
|
+
class DefaultAzureCredentialsManager {
|
|
6
|
+
constructor(configProviders) {
|
|
7
|
+
this.configProviders = configProviders;
|
|
8
|
+
this.cachedCredentials = /* @__PURE__ */ new Map();
|
|
9
|
+
}
|
|
10
|
+
cachedCredentials;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of DefaultAzureCredentialsManager from a Backstage integration registry.
|
|
13
|
+
*/
|
|
14
|
+
static fromIntegrations(integrations) {
|
|
15
|
+
const configProviders = integrations.azureBlobStorage.list().reduce((acc, integration) => {
|
|
16
|
+
acc.set(
|
|
17
|
+
integration.config.accountName || "default",
|
|
18
|
+
integration.config
|
|
19
|
+
);
|
|
20
|
+
return acc;
|
|
21
|
+
}, /* @__PURE__ */ new Map());
|
|
22
|
+
return new DefaultAzureCredentialsManager(configProviders);
|
|
23
|
+
}
|
|
24
|
+
createCredential(config) {
|
|
25
|
+
if (config.aadCredential && config.aadCredential.clientId && config.aadCredential.clientSecret && config.aadCredential.tenantId) {
|
|
26
|
+
return new identity.ClientSecretCredential(
|
|
27
|
+
config.aadCredential.tenantId,
|
|
28
|
+
config.aadCredential.clientId,
|
|
29
|
+
config.aadCredential.clientSecret
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return new identity.DefaultAzureCredential();
|
|
33
|
+
}
|
|
34
|
+
async getCredentials(accountName) {
|
|
35
|
+
if (this.cachedCredentials.has(accountName)) {
|
|
36
|
+
return this.cachedCredentials.get(accountName);
|
|
37
|
+
}
|
|
38
|
+
const config = this.configProviders.get(accountName);
|
|
39
|
+
if (!config) {
|
|
40
|
+
throw new Error(`No configuration found for account: ${accountName}`);
|
|
41
|
+
}
|
|
42
|
+
const credential = this.createCredential(config);
|
|
43
|
+
this.cachedCredentials.set(accountName, credential);
|
|
44
|
+
return credential;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.DefaultAzureCredentialsManager = DefaultAzureCredentialsManager;
|
|
49
|
+
//# sourceMappingURL=DefaultAzureCredentialsProvider.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultAzureCredentialsProvider.cjs.js","sources":["../../src/azureBlobStorage/DefaultAzureCredentialsProvider.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n DefaultAzureCredential,\n ClientSecretCredential,\n TokenCredential,\n} from '@azure/identity';\nimport { AzureBlobStorageIntegrationConfig } from './config';\nimport { AzureCredentialsManager } from './types';\nimport { ScmIntegrationRegistry } from '../registry';\n\n/**\n * Default implementation of AzureCredentialsManager that supports multiple Azure Blob Storage integrations.\n * @public\n */\nexport class DefaultAzureCredentialsManager implements AzureCredentialsManager {\n private cachedCredentials: Map<string, TokenCredential>;\n\n private constructor(\n private readonly configProviders: Map<\n string,\n AzureBlobStorageIntegrationConfig\n >,\n ) {\n this.cachedCredentials = new Map<string, TokenCredential>();\n }\n\n /**\n * Creates an instance of DefaultAzureCredentialsManager from a Backstage integration registry.\n */\n static fromIntegrations(\n integrations: ScmIntegrationRegistry,\n ): DefaultAzureCredentialsManager {\n const configProviders = integrations.azureBlobStorage\n .list()\n .reduce((acc, integration) => {\n acc.set(\n integration.config.accountName || 'default',\n integration.config,\n );\n return acc;\n }, new Map<string, AzureBlobStorageIntegrationConfig>());\n\n return new DefaultAzureCredentialsManager(configProviders);\n }\n\n private createCredential(\n config: AzureBlobStorageIntegrationConfig,\n ): TokenCredential {\n if (\n config.aadCredential &&\n config.aadCredential.clientId &&\n config.aadCredential.clientSecret &&\n config.aadCredential.tenantId\n ) {\n return new ClientSecretCredential(\n config.aadCredential.tenantId,\n config.aadCredential.clientId,\n config.aadCredential.clientSecret,\n );\n }\n\n return new DefaultAzureCredential();\n }\n\n async getCredentials(accountName: string): Promise<TokenCredential> {\n if (this.cachedCredentials.has(accountName)) {\n return this.cachedCredentials.get(accountName)!;\n }\n\n const config = this.configProviders.get(accountName);\n if (!config) {\n throw new Error(`No configuration found for account: ${accountName}`);\n }\n\n const credential = this.createCredential(config);\n\n // Cache the credentials for future use\n this.cachedCredentials.set(accountName, credential);\n\n return credential;\n }\n}\n"],"names":["ClientSecretCredential","DefaultAzureCredential"],"mappings":";;;;AA6BO,MAAM,8BAAkE,CAAA;AAAA,EAGrE,YACW,eAIjB,EAAA;AAJiB,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AAKjB,IAAK,IAAA,CAAA,iBAAA,uBAAwB,GAA6B,EAAA;AAAA;AAC5D,EATQ,iBAAA;AAAA;AAAA;AAAA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AAkB,GAAI,CAAA,WAAA,EAAa,UAAU,CAAA;AAElD,IAAO,OAAA,UAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ClientSecretCredential, DefaultAzureCredential } from '@azure/identity';
|
|
2
|
+
|
|
3
|
+
class DefaultAzureCredentialsManager {
|
|
4
|
+
constructor(configProviders) {
|
|
5
|
+
this.configProviders = configProviders;
|
|
6
|
+
this.cachedCredentials = /* @__PURE__ */ new Map();
|
|
7
|
+
}
|
|
8
|
+
cachedCredentials;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of DefaultAzureCredentialsManager from a Backstage integration registry.
|
|
11
|
+
*/
|
|
12
|
+
static fromIntegrations(integrations) {
|
|
13
|
+
const configProviders = integrations.azureBlobStorage.list().reduce((acc, integration) => {
|
|
14
|
+
acc.set(
|
|
15
|
+
integration.config.accountName || "default",
|
|
16
|
+
integration.config
|
|
17
|
+
);
|
|
18
|
+
return acc;
|
|
19
|
+
}, /* @__PURE__ */ new Map());
|
|
20
|
+
return new DefaultAzureCredentialsManager(configProviders);
|
|
21
|
+
}
|
|
22
|
+
createCredential(config) {
|
|
23
|
+
if (config.aadCredential && config.aadCredential.clientId && config.aadCredential.clientSecret && config.aadCredential.tenantId) {
|
|
24
|
+
return new ClientSecretCredential(
|
|
25
|
+
config.aadCredential.tenantId,
|
|
26
|
+
config.aadCredential.clientId,
|
|
27
|
+
config.aadCredential.clientSecret
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return new DefaultAzureCredential();
|
|
31
|
+
}
|
|
32
|
+
async getCredentials(accountName) {
|
|
33
|
+
if (this.cachedCredentials.has(accountName)) {
|
|
34
|
+
return this.cachedCredentials.get(accountName);
|
|
35
|
+
}
|
|
36
|
+
const config = this.configProviders.get(accountName);
|
|
37
|
+
if (!config) {
|
|
38
|
+
throw new Error(`No configuration found for account: ${accountName}`);
|
|
39
|
+
}
|
|
40
|
+
const credential = this.createCredential(config);
|
|
41
|
+
this.cachedCredentials.set(accountName, credential);
|
|
42
|
+
return credential;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { DefaultAzureCredentialsManager };
|
|
47
|
+
//# sourceMappingURL=DefaultAzureCredentialsProvider.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultAzureCredentialsProvider.esm.js","sources":["../../src/azureBlobStorage/DefaultAzureCredentialsProvider.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n DefaultAzureCredential,\n ClientSecretCredential,\n TokenCredential,\n} from '@azure/identity';\nimport { AzureBlobStorageIntegrationConfig } from './config';\nimport { AzureCredentialsManager } from './types';\nimport { ScmIntegrationRegistry } from '../registry';\n\n/**\n * Default implementation of AzureCredentialsManager that supports multiple Azure Blob Storage integrations.\n * @public\n */\nexport class DefaultAzureCredentialsManager implements AzureCredentialsManager {\n private cachedCredentials: Map<string, TokenCredential>;\n\n private constructor(\n private readonly configProviders: Map<\n string,\n AzureBlobStorageIntegrationConfig\n >,\n ) {\n this.cachedCredentials = new Map<string, TokenCredential>();\n }\n\n /**\n * Creates an instance of DefaultAzureCredentialsManager from a Backstage integration registry.\n */\n static fromIntegrations(\n integrations: ScmIntegrationRegistry,\n ): DefaultAzureCredentialsManager {\n const configProviders = integrations.azureBlobStorage\n .list()\n .reduce((acc, integration) => {\n acc.set(\n integration.config.accountName || 'default',\n integration.config,\n );\n return acc;\n }, new Map<string, AzureBlobStorageIntegrationConfig>());\n\n return new DefaultAzureCredentialsManager(configProviders);\n }\n\n private createCredential(\n config: AzureBlobStorageIntegrationConfig,\n ): TokenCredential {\n if (\n config.aadCredential &&\n config.aadCredential.clientId &&\n config.aadCredential.clientSecret &&\n config.aadCredential.tenantId\n ) {\n return new ClientSecretCredential(\n config.aadCredential.tenantId,\n config.aadCredential.clientId,\n config.aadCredential.clientSecret,\n );\n }\n\n return new DefaultAzureCredential();\n }\n\n async getCredentials(accountName: string): Promise<TokenCredential> {\n if (this.cachedCredentials.has(accountName)) {\n return this.cachedCredentials.get(accountName)!;\n }\n\n const config = this.configProviders.get(accountName);\n if (!config) {\n throw new Error(`No configuration found for account: ${accountName}`);\n }\n\n const credential = this.createCredential(config);\n\n // Cache the credentials for future use\n this.cachedCredentials.set(accountName, credential);\n\n return credential;\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,8BAAkE,CAAA;AAAA,EAGrE,YACW,eAIjB,EAAA;AAJiB,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AAKjB,IAAK,IAAA,CAAA,iBAAA,uBAAwB,GAA6B,EAAA;AAAA;AAC5D,EATQ,iBAAA;AAAA;AAAA;AAAA;AAAA,EAcR,OAAO,iBACL,YACgC,EAAA;AAChC,IAAM,MAAA,eAAA,GAAkB,aAAa,gBAClC,CAAA,IAAA,GACA,MAAO,CAAA,CAAC,KAAK,WAAgB,KAAA;AAC5B,MAAI,GAAA,CAAA,GAAA;AAAA,QACF,WAAA,CAAY,OAAO,WAAe,IAAA,SAAA;AAAA,QAClC,WAAY,CAAA;AAAA,OACd;AACA,MAAO,OAAA,GAAA;AAAA,KACT,kBAAO,IAAA,GAAA,EAAgD,CAAA;AAEzD,IAAO,OAAA,IAAI,+BAA+B,eAAe,CAAA;AAAA;AAC3D,EAEQ,iBACN,MACiB,EAAA;AACjB,IACE,IAAA,MAAA,CAAO,aACP,IAAA,MAAA,CAAO,aAAc,CAAA,QAAA,IACrB,OAAO,aAAc,CAAA,YAAA,IACrB,MAAO,CAAA,aAAA,CAAc,QACrB,EAAA;AACA,MAAA,OAAO,IAAI,sBAAA;AAAA,QACT,OAAO,aAAc,CAAA,QAAA;AAAA,QACrB,OAAO,aAAc,CAAA,QAAA;AAAA,QACrB,OAAO,aAAc,CAAA;AAAA,OACvB;AAAA;AAGF,IAAA,OAAO,IAAI,sBAAuB,EAAA;AAAA;AACpC,EAEA,MAAM,eAAe,WAA+C,EAAA;AAClE,IAAA,IAAI,IAAK,CAAA,iBAAA,CAAkB,GAAI,CAAA,WAAW,CAAG,EAAA;AAC3C,MAAO,OAAA,IAAA,CAAK,iBAAkB,CAAA,GAAA,CAAI,WAAW,CAAA;AAAA;AAG/C,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,eAAgB,CAAA,GAAA,CAAI,WAAW,CAAA;AACnD,IAAA,IAAI,CAAC,MAAQ,EAAA;AACX,MAAA,MAAM,IAAI,KAAA,CAAM,CAAuC,oCAAA,EAAA,WAAW,CAAE,CAAA,CAAA;AAAA;AAGtE,IAAM,MAAA,UAAA,GAAa,IAAK,CAAA,gBAAA,CAAiB,MAAM,CAAA;AAG/C,IAAK,IAAA,CAAA,iBAAA,CAAkB,GAAI,CAAA,WAAA,EAAa,UAAU,CAAA;AAElD,IAAO,OAAA,UAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const AZURE_HOST = "blob.core.windows.net";
|
|
4
|
+
function readAzureBlobStorageIntegrationConfig(config) {
|
|
5
|
+
const endpoint = config.getOptionalString("endpoint");
|
|
6
|
+
const accountName = config.getString("accountName");
|
|
7
|
+
const accountKey = config.getOptionalString("accountKey")?.trim();
|
|
8
|
+
const sasToken = config.getOptionalString("sasToken")?.trim();
|
|
9
|
+
const connectionString = config.getOptionalString("connectionString")?.trim();
|
|
10
|
+
const endpointSuffix = config.getOptionalString("endpointSuffix")?.trim();
|
|
11
|
+
let host;
|
|
12
|
+
let pathname;
|
|
13
|
+
if (endpoint) {
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(endpoint);
|
|
16
|
+
host = url.host;
|
|
17
|
+
pathname = url.pathname;
|
|
18
|
+
} catch {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`invalid azureBlobStorage integration config, endpoint '${endpoint}' is not a valid URL`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
if (pathname !== "/") {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`invalid azureBlobStorage integration config, endpoints cannot contain path, got '${endpoint}'`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
host = AZURE_HOST;
|
|
30
|
+
}
|
|
31
|
+
const aadCredential = config.has("aadCredential") ? {
|
|
32
|
+
clientId: config.getString("aadCredential.clientId"),
|
|
33
|
+
tenantId: config.getString("aadCredential.tenantId"),
|
|
34
|
+
clientSecret: config.getString("aadCredential.clientSecret")?.trim()
|
|
35
|
+
} : void 0;
|
|
36
|
+
if (accountKey && sasToken) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Invalid Azure Blob Storage config for ${accountName}: Both account key and SAS token cannot be used simultaneously.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
if (aadCredential && (accountKey || sasToken)) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Invalid Azure Blob Storage config for ${accountName}: Cannot use both Azure AD credentials and account keys/SAS tokens for the same account.`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
host,
|
|
48
|
+
endpoint,
|
|
49
|
+
accountName,
|
|
50
|
+
accountKey,
|
|
51
|
+
sasToken,
|
|
52
|
+
connectionString,
|
|
53
|
+
endpointSuffix,
|
|
54
|
+
aadCredential
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function readAzureBlobStorageIntegrationConfigs(configs) {
|
|
58
|
+
const result = configs.map(readAzureBlobStorageIntegrationConfig);
|
|
59
|
+
if (!result.some((c) => c.host === AZURE_HOST)) {
|
|
60
|
+
result.push({
|
|
61
|
+
host: AZURE_HOST
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.readAzureBlobStorageIntegrationConfig = readAzureBlobStorageIntegrationConfig;
|
|
68
|
+
exports.readAzureBlobStorageIntegrationConfigs = readAzureBlobStorageIntegrationConfigs;
|
|
69
|
+
//# sourceMappingURL=config.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs.js","sources":["../../src/azureBlobStorage/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 AZURE_HOST = 'blob.core.windows.net';\n\n/**\n * The configuration parameters for a single Azure Blob Storage account.\n *\n * @public\n */\nexport type AzureBlobStorageIntegrationConfig = {\n /**\n * The name of the Azure Storage Account, e.g., \"mystorageaccount\".\n */\n accountName?: string;\n\n /**\n * The primary or secondary key for the Azure Storage Account.\n * Only required if connectionString or SAS token are not specified.\n */\n accountKey?: string;\n\n /**\n * A Shared Access Signature (SAS) token for limited access to resources.\n */\n sasToken?: string;\n\n /**\n * A full connection string for the Azure Storage Account.\n * This includes the account name, key, and endpoint details.\n */\n connectionString?: string;\n\n /**\n * Optional endpoint suffix for custom domains or sovereign clouds.\n * e.g., \"core.windows.net\" for public Azure or \"core.usgovcloudapi.net\" for US Government cloud.\n */\n endpointSuffix?: string;\n\n /**\n * The host of the target that this matches on, e.g., \"blob.core.windows.net\".\n */\n host: string;\n\n endpoint?: string;\n /**\n * Optional credential to use for Azure Active Directory authentication.\n */\n aadCredential?: {\n /**\n * The client ID of the Azure AD application.\n */\n clientId: string;\n\n /**\n * The tenant ID for Azure AD.\n */\n tenantId: string;\n\n /**\n * The client secret for the Azure AD application.\n */\n clientSecret: string;\n };\n};\n\n/**\n * Reads a single Azure Blob Storage integration config.\n *\n * @param config - The config object of a single integration.\n * @public\n */\nexport function readAzureBlobStorageIntegrationConfig(\n config: Config,\n): AzureBlobStorageIntegrationConfig {\n const endpoint = config.getOptionalString('endpoint');\n const accountName = config.getString('accountName');\n const accountKey = config.getOptionalString('accountKey')?.trim();\n const sasToken = config.getOptionalString('sasToken')?.trim();\n const connectionString = config.getOptionalString('connectionString')?.trim();\n const endpointSuffix = config.getOptionalString('endpointSuffix')?.trim();\n\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 azureBlobStorage integration config, endpoint '${endpoint}' is not a valid URL`,\n );\n }\n if (pathname !== '/') {\n throw new Error(\n `invalid azureBlobStorage integration config, endpoints cannot contain path, got '${endpoint}'`,\n );\n }\n } else {\n host = AZURE_HOST;\n }\n const aadCredential = config.has('aadCredential')\n ? {\n clientId: config.getString('aadCredential.clientId'),\n tenantId: config.getString('aadCredential.tenantId'),\n clientSecret: config.getString('aadCredential.clientSecret')?.trim(),\n }\n : undefined;\n\n if (accountKey && sasToken) {\n throw new Error(\n `Invalid Azure Blob Storage config for ${accountName}: Both account key and SAS token cannot be used simultaneously.`,\n );\n }\n\n if (aadCredential && (accountKey || sasToken)) {\n throw new Error(\n `Invalid Azure Blob Storage config for ${accountName}: Cannot use both Azure AD credentials and account keys/SAS tokens for the same account.`,\n );\n }\n\n return {\n host,\n endpoint,\n accountName,\n accountKey,\n sasToken,\n connectionString,\n endpointSuffix,\n aadCredential,\n };\n}\n\n/**\n * Reads a set of Azure Blob Storage integration configs.\n *\n * @param configs - All of the integration config objects.\n * @public\n */\nexport function readAzureBlobStorageIntegrationConfigs(\n configs: Config[],\n): AzureBlobStorageIntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAzureBlobStorageIntegrationConfig);\n\n // If no explicit blob.core.windows.net integration was added, put one in the list as\n // a convenience\n if (!result.some(c => c.host === AZURE_HOST)) {\n result.push({\n host: AZURE_HOST,\n });\n }\n return result;\n}\n"],"names":[],"mappings":";;AAkBA,MAAM,UAAa,GAAA,uBAAA;AAqEZ,SAAS,sCACd,MACmC,EAAA;AACnC,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA;AACpD,EAAM,MAAA,WAAA,GAAc,MAAO,CAAA,SAAA,CAAU,aAAa,CAAA;AAClD,EAAA,MAAM,UAAa,GAAA,MAAA,CAAO,iBAAkB,CAAA,YAAY,GAAG,IAAK,EAAA;AAChE,EAAA,MAAM,QAAW,GAAA,MAAA,CAAO,iBAAkB,CAAA,UAAU,GAAG,IAAK,EAAA;AAC5D,EAAA,MAAM,gBAAmB,GAAA,MAAA,CAAO,iBAAkB,CAAA,kBAAkB,GAAG,IAAK,EAAA;AAC5E,EAAA,MAAM,cAAiB,GAAA,MAAA,CAAO,iBAAkB,CAAA,gBAAgB,GAAG,IAAK,EAAA;AAExE,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,QAAU,EAAA;AACZ,IAAI,IAAA;AACF,MAAM,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,QAAQ,CAAA;AAC5B,MAAA,IAAA,GAAO,GAAI,CAAA,IAAA;AACX,MAAA,QAAA,GAAW,GAAI,CAAA,QAAA;AAAA,KACT,CAAA,MAAA;AACN,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,0DAA0D,QAAQ,CAAA,oBAAA;AAAA,OACpE;AAAA;AAEF,IAAA,IAAI,aAAa,GAAK,EAAA;AACpB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,oFAAoF,QAAQ,CAAA,CAAA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+
const endpoint = config.getOptionalString("endpoint");
|
|
4
|
+
const accountName = config.getString("accountName");
|
|
5
|
+
const accountKey = config.getOptionalString("accountKey")?.trim();
|
|
6
|
+
const sasToken = config.getOptionalString("sasToken")?.trim();
|
|
7
|
+
const connectionString = config.getOptionalString("connectionString")?.trim();
|
|
8
|
+
const endpointSuffix = config.getOptionalString("endpointSuffix")?.trim();
|
|
9
|
+
let host;
|
|
10
|
+
let pathname;
|
|
11
|
+
if (endpoint) {
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(endpoint);
|
|
14
|
+
host = url.host;
|
|
15
|
+
pathname = url.pathname;
|
|
16
|
+
} catch {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`invalid azureBlobStorage integration config, endpoint '${endpoint}' is not a valid URL`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
if (pathname !== "/") {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`invalid azureBlobStorage integration config, endpoints cannot contain path, got '${endpoint}'`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
host = AZURE_HOST;
|
|
28
|
+
}
|
|
29
|
+
const aadCredential = config.has("aadCredential") ? {
|
|
30
|
+
clientId: config.getString("aadCredential.clientId"),
|
|
31
|
+
tenantId: config.getString("aadCredential.tenantId"),
|
|
32
|
+
clientSecret: config.getString("aadCredential.clientSecret")?.trim()
|
|
33
|
+
} : void 0;
|
|
34
|
+
if (accountKey && sasToken) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Invalid Azure Blob Storage config for ${accountName}: Both account key and SAS token cannot be used simultaneously.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (aadCredential && (accountKey || sasToken)) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Invalid Azure Blob Storage config for ${accountName}: Cannot use both Azure AD credentials and account keys/SAS tokens for the same account.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
host,
|
|
46
|
+
endpoint,
|
|
47
|
+
accountName,
|
|
48
|
+
accountKey,
|
|
49
|
+
sasToken,
|
|
50
|
+
connectionString,
|
|
51
|
+
endpointSuffix,
|
|
52
|
+
aadCredential
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function readAzureBlobStorageIntegrationConfigs(configs) {
|
|
56
|
+
const result = configs.map(readAzureBlobStorageIntegrationConfig);
|
|
57
|
+
if (!result.some((c) => c.host === AZURE_HOST)) {
|
|
58
|
+
result.push({
|
|
59
|
+
host: AZURE_HOST
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { readAzureBlobStorageIntegrationConfig, readAzureBlobStorageIntegrationConfigs };
|
|
66
|
+
//# sourceMappingURL=config.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.esm.js","sources":["../../src/azureBlobStorage/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 AZURE_HOST = 'blob.core.windows.net';\n\n/**\n * The configuration parameters for a single Azure Blob Storage account.\n *\n * @public\n */\nexport type AzureBlobStorageIntegrationConfig = {\n /**\n * The name of the Azure Storage Account, e.g., \"mystorageaccount\".\n */\n accountName?: string;\n\n /**\n * The primary or secondary key for the Azure Storage Account.\n * Only required if connectionString or SAS token are not specified.\n */\n accountKey?: string;\n\n /**\n * A Shared Access Signature (SAS) token for limited access to resources.\n */\n sasToken?: string;\n\n /**\n * A full connection string for the Azure Storage Account.\n * This includes the account name, key, and endpoint details.\n */\n connectionString?: string;\n\n /**\n * Optional endpoint suffix for custom domains or sovereign clouds.\n * e.g., \"core.windows.net\" for public Azure or \"core.usgovcloudapi.net\" for US Government cloud.\n */\n endpointSuffix?: string;\n\n /**\n * The host of the target that this matches on, e.g., \"blob.core.windows.net\".\n */\n host: string;\n\n endpoint?: string;\n /**\n * Optional credential to use for Azure Active Directory authentication.\n */\n aadCredential?: {\n /**\n * The client ID of the Azure AD application.\n */\n clientId: string;\n\n /**\n * The tenant ID for Azure AD.\n */\n tenantId: string;\n\n /**\n * The client secret for the Azure AD application.\n */\n clientSecret: string;\n };\n};\n\n/**\n * Reads a single Azure Blob Storage integration config.\n *\n * @param config - The config object of a single integration.\n * @public\n */\nexport function readAzureBlobStorageIntegrationConfig(\n config: Config,\n): AzureBlobStorageIntegrationConfig {\n const endpoint = config.getOptionalString('endpoint');\n const accountName = config.getString('accountName');\n const accountKey = config.getOptionalString('accountKey')?.trim();\n const sasToken = config.getOptionalString('sasToken')?.trim();\n const connectionString = config.getOptionalString('connectionString')?.trim();\n const endpointSuffix = config.getOptionalString('endpointSuffix')?.trim();\n\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 azureBlobStorage integration config, endpoint '${endpoint}' is not a valid URL`,\n );\n }\n if (pathname !== '/') {\n throw new Error(\n `invalid azureBlobStorage integration config, endpoints cannot contain path, got '${endpoint}'`,\n );\n }\n } else {\n host = AZURE_HOST;\n }\n const aadCredential = config.has('aadCredential')\n ? {\n clientId: config.getString('aadCredential.clientId'),\n tenantId: config.getString('aadCredential.tenantId'),\n clientSecret: config.getString('aadCredential.clientSecret')?.trim(),\n }\n : undefined;\n\n if (accountKey && sasToken) {\n throw new Error(\n `Invalid Azure Blob Storage config for ${accountName}: Both account key and SAS token cannot be used simultaneously.`,\n );\n }\n\n if (aadCredential && (accountKey || sasToken)) {\n throw new Error(\n `Invalid Azure Blob Storage config for ${accountName}: Cannot use both Azure AD credentials and account keys/SAS tokens for the same account.`,\n );\n }\n\n return {\n host,\n endpoint,\n accountName,\n accountKey,\n sasToken,\n connectionString,\n endpointSuffix,\n aadCredential,\n };\n}\n\n/**\n * Reads a set of Azure Blob Storage integration configs.\n *\n * @param configs - All of the integration config objects.\n * @public\n */\nexport function readAzureBlobStorageIntegrationConfigs(\n configs: Config[],\n): AzureBlobStorageIntegrationConfig[] {\n // First read all the explicit integrations\n const result = configs.map(readAzureBlobStorageIntegrationConfig);\n\n // If no explicit blob.core.windows.net integration was added, put one in the list as\n // a convenience\n if (!result.some(c => c.host === AZURE_HOST)) {\n result.push({\n host: AZURE_HOST,\n });\n }\n return result;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,UAAa,GAAA,uBAAA;AAqEZ,SAAS,sCACd,MACmC,EAAA;AACnC,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA;AACpD,EAAM,MAAA,WAAA,GAAc,MAAO,CAAA,SAAA,CAAU,aAAa,CAAA;AAClD,EAAA,MAAM,UAAa,GAAA,MAAA,CAAO,iBAAkB,CAAA,YAAY,GAAG,IAAK,EAAA;AAChE,EAAA,MAAM,QAAW,GAAA,MAAA,CAAO,iBAAkB,CAAA,UAAU,GAAG,IAAK,EAAA;AAC5D,EAAA,MAAM,gBAAmB,GAAA,MAAA,CAAO,iBAAkB,CAAA,kBAAkB,GAAG,IAAK,EAAA;AAC5E,EAAA,MAAM,cAAiB,GAAA,MAAA,CAAO,iBAAkB,CAAA,gBAAgB,GAAG,IAAK,EAAA;AAExE,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,QAAU,EAAA;AACZ,IAAI,IAAA;AACF,MAAM,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,QAAQ,CAAA;AAC5B,MAAA,IAAA,GAAO,GAAI,CAAA,IAAA;AACX,MAAA,QAAA,GAAW,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C,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,IAAM,EAAA;AAAA,KACP,CAAA;AAAA;AAEH,EAAO,OAAA,MAAA;AACT;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -4,39 +4,42 @@ var AwsS3Integration = require('./awsS3/AwsS3Integration.cjs.js');
|
|
|
4
4
|
var config = require('./awsS3/config.cjs.js');
|
|
5
5
|
var AwsCodeCommitIntegration = require('./awsCodeCommit/AwsCodeCommitIntegration.cjs.js');
|
|
6
6
|
var config$1 = require('./awsCodeCommit/config.cjs.js');
|
|
7
|
+
var AzureBlobStorageIntegration = require('./azureBlobStorage/AzureBlobStorageIntegration.cjs.js');
|
|
8
|
+
var config$2 = require('./azureBlobStorage/config.cjs.js');
|
|
9
|
+
var DefaultAzureCredentialsProvider = require('./azureBlobStorage/DefaultAzureCredentialsProvider.cjs.js');
|
|
7
10
|
var AzureIntegration = require('./azure/AzureIntegration.cjs.js');
|
|
8
|
-
var config$
|
|
11
|
+
var config$3 = require('./azure/config.cjs.js');
|
|
9
12
|
var core = require('./azure/core.cjs.js');
|
|
10
13
|
var DefaultAzureDevOpsCredentialsProvider = require('./azure/DefaultAzureDevOpsCredentialsProvider.cjs.js');
|
|
11
14
|
var deprecated = require('./azure/deprecated.cjs.js');
|
|
12
15
|
var BitbucketIntegration = require('./bitbucket/BitbucketIntegration.cjs.js');
|
|
13
|
-
var config$
|
|
16
|
+
var config$4 = require('./bitbucket/config.cjs.js');
|
|
14
17
|
var core$1 = require('./bitbucket/core.cjs.js');
|
|
15
18
|
var BitbucketCloudIntegration = require('./bitbucketCloud/BitbucketCloudIntegration.cjs.js');
|
|
16
|
-
var config$
|
|
19
|
+
var config$5 = require('./bitbucketCloud/config.cjs.js');
|
|
17
20
|
var core$2 = require('./bitbucketCloud/core.cjs.js');
|
|
18
21
|
var BitbucketServerIntegration = require('./bitbucketServer/BitbucketServerIntegration.cjs.js');
|
|
19
|
-
var config$
|
|
22
|
+
var config$6 = require('./bitbucketServer/config.cjs.js');
|
|
20
23
|
var core$3 = require('./bitbucketServer/core.cjs.js');
|
|
21
24
|
var GerritIntegration = require('./gerrit/GerritIntegration.cjs.js');
|
|
22
|
-
var config$
|
|
25
|
+
var config$7 = require('./gerrit/config.cjs.js');
|
|
23
26
|
var core$4 = require('./gerrit/core.cjs.js');
|
|
24
27
|
var GiteaIntegration = require('./gitea/GiteaIntegration.cjs.js');
|
|
25
28
|
var core$5 = require('./gitea/core.cjs.js');
|
|
26
|
-
var config$
|
|
27
|
-
var config$
|
|
29
|
+
var config$8 = require('./gitea/config.cjs.js');
|
|
30
|
+
var config$9 = require('./github/config.cjs.js');
|
|
28
31
|
var core$6 = require('./github/core.cjs.js');
|
|
29
32
|
var DefaultGithubCredentialsProvider = require('./github/DefaultGithubCredentialsProvider.cjs.js');
|
|
30
33
|
var SingleInstanceGithubCredentialsProvider = require('./github/SingleInstanceGithubCredentialsProvider.cjs.js');
|
|
31
34
|
var GithubIntegration = require('./github/GithubIntegration.cjs.js');
|
|
32
|
-
var config$
|
|
35
|
+
var config$a = require('./gitlab/config.cjs.js');
|
|
33
36
|
var core$7 = require('./gitlab/core.cjs.js');
|
|
34
37
|
var GitLabIntegration = require('./gitlab/GitLabIntegration.cjs.js');
|
|
35
38
|
var DefaultGitlabCredentialsProvider = require('./gitlab/DefaultGitlabCredentialsProvider.cjs.js');
|
|
36
|
-
var config$
|
|
39
|
+
var config$b = require('./googleGcs/config.cjs.js');
|
|
37
40
|
var HarnessIntegration = require('./harness/HarnessIntegration.cjs.js');
|
|
38
41
|
var core$8 = require('./harness/core.cjs.js');
|
|
39
|
-
var config$
|
|
42
|
+
var config$c = require('./harness/config.cjs.js');
|
|
40
43
|
var helpers = require('./helpers.cjs.js');
|
|
41
44
|
var ScmIntegrations = require('./ScmIntegrations.cjs.js');
|
|
42
45
|
|
|
@@ -48,38 +51,42 @@ exports.readAwsS3IntegrationConfigs = config.readAwsS3IntegrationConfigs;
|
|
|
48
51
|
exports.AwsCodeCommitIntegration = AwsCodeCommitIntegration.AwsCodeCommitIntegration;
|
|
49
52
|
exports.readAwsCodeCommitIntegrationConfig = config$1.readAwsCodeCommitIntegrationConfig;
|
|
50
53
|
exports.readAwsCodeCommitIntegrationConfigs = config$1.readAwsCodeCommitIntegrationConfigs;
|
|
54
|
+
exports.AzureBlobStorageIntergation = AzureBlobStorageIntegration.AzureBlobStorageIntergation;
|
|
55
|
+
exports.readAzureBlobStorageIntegrationConfig = config$2.readAzureBlobStorageIntegrationConfig;
|
|
56
|
+
exports.readAzureBlobStorageIntegrationConfigs = config$2.readAzureBlobStorageIntegrationConfigs;
|
|
57
|
+
exports.DefaultAzureCredentialsManager = DefaultAzureCredentialsProvider.DefaultAzureCredentialsManager;
|
|
51
58
|
exports.AzureIntegration = AzureIntegration.AzureIntegration;
|
|
52
|
-
exports.readAzureIntegrationConfig = config$
|
|
53
|
-
exports.readAzureIntegrationConfigs = config$
|
|
59
|
+
exports.readAzureIntegrationConfig = config$3.readAzureIntegrationConfig;
|
|
60
|
+
exports.readAzureIntegrationConfigs = config$3.readAzureIntegrationConfigs;
|
|
54
61
|
exports.getAzureCommitsUrl = core.getAzureCommitsUrl;
|
|
55
62
|
exports.getAzureDownloadUrl = core.getAzureDownloadUrl;
|
|
56
63
|
exports.getAzureFileFetchUrl = core.getAzureFileFetchUrl;
|
|
57
64
|
exports.DefaultAzureDevOpsCredentialsProvider = DefaultAzureDevOpsCredentialsProvider.DefaultAzureDevOpsCredentialsProvider;
|
|
58
65
|
exports.getAzureRequestOptions = deprecated.getAzureRequestOptions;
|
|
59
66
|
exports.BitbucketIntegration = BitbucketIntegration.BitbucketIntegration;
|
|
60
|
-
exports.readBitbucketIntegrationConfig = config$
|
|
61
|
-
exports.readBitbucketIntegrationConfigs = config$
|
|
67
|
+
exports.readBitbucketIntegrationConfig = config$4.readBitbucketIntegrationConfig;
|
|
68
|
+
exports.readBitbucketIntegrationConfigs = config$4.readBitbucketIntegrationConfigs;
|
|
62
69
|
exports.getBitbucketDefaultBranch = core$1.getBitbucketDefaultBranch;
|
|
63
70
|
exports.getBitbucketDownloadUrl = core$1.getBitbucketDownloadUrl;
|
|
64
71
|
exports.getBitbucketFileFetchUrl = core$1.getBitbucketFileFetchUrl;
|
|
65
72
|
exports.getBitbucketRequestOptions = core$1.getBitbucketRequestOptions;
|
|
66
73
|
exports.BitbucketCloudIntegration = BitbucketCloudIntegration.BitbucketCloudIntegration;
|
|
67
|
-
exports.readBitbucketCloudIntegrationConfig = config$
|
|
68
|
-
exports.readBitbucketCloudIntegrationConfigs = config$
|
|
74
|
+
exports.readBitbucketCloudIntegrationConfig = config$5.readBitbucketCloudIntegrationConfig;
|
|
75
|
+
exports.readBitbucketCloudIntegrationConfigs = config$5.readBitbucketCloudIntegrationConfigs;
|
|
69
76
|
exports.getBitbucketCloudDefaultBranch = core$2.getBitbucketCloudDefaultBranch;
|
|
70
77
|
exports.getBitbucketCloudDownloadUrl = core$2.getBitbucketCloudDownloadUrl;
|
|
71
78
|
exports.getBitbucketCloudFileFetchUrl = core$2.getBitbucketCloudFileFetchUrl;
|
|
72
79
|
exports.getBitbucketCloudRequestOptions = core$2.getBitbucketCloudRequestOptions;
|
|
73
80
|
exports.BitbucketServerIntegration = BitbucketServerIntegration.BitbucketServerIntegration;
|
|
74
|
-
exports.readBitbucketServerIntegrationConfig = config$
|
|
75
|
-
exports.readBitbucketServerIntegrationConfigs = config$
|
|
81
|
+
exports.readBitbucketServerIntegrationConfig = config$6.readBitbucketServerIntegrationConfig;
|
|
82
|
+
exports.readBitbucketServerIntegrationConfigs = config$6.readBitbucketServerIntegrationConfigs;
|
|
76
83
|
exports.getBitbucketServerDefaultBranch = core$3.getBitbucketServerDefaultBranch;
|
|
77
84
|
exports.getBitbucketServerDownloadUrl = core$3.getBitbucketServerDownloadUrl;
|
|
78
85
|
exports.getBitbucketServerFileFetchUrl = core$3.getBitbucketServerFileFetchUrl;
|
|
79
86
|
exports.getBitbucketServerRequestOptions = core$3.getBitbucketServerRequestOptions;
|
|
80
87
|
exports.GerritIntegration = GerritIntegration.GerritIntegration;
|
|
81
|
-
exports.readGerritIntegrationConfig = config$
|
|
82
|
-
exports.readGerritIntegrationConfigs = config$
|
|
88
|
+
exports.readGerritIntegrationConfig = config$7.readGerritIntegrationConfig;
|
|
89
|
+
exports.readGerritIntegrationConfigs = config$7.readGerritIntegrationConfigs;
|
|
83
90
|
exports.buildGerritGitilesArchiveUrl = core$4.buildGerritGitilesArchiveUrl;
|
|
84
91
|
exports.getGerritBranchApiUrl = core$4.getGerritBranchApiUrl;
|
|
85
92
|
exports.getGerritCloneRepoUrl = core$4.getGerritCloneRepoUrl;
|
|
@@ -96,9 +103,9 @@ exports.getGiteaFileContentsUrl = core$5.getGiteaFileContentsUrl;
|
|
|
96
103
|
exports.getGiteaLatestCommitUrl = core$5.getGiteaLatestCommitUrl;
|
|
97
104
|
exports.getGiteaRequestOptions = core$5.getGiteaRequestOptions;
|
|
98
105
|
exports.parseGiteaUrl = core$5.parseGiteaUrl;
|
|
99
|
-
exports.readGiteaConfig = config$
|
|
100
|
-
exports.readGithubIntegrationConfig = config$
|
|
101
|
-
exports.readGithubIntegrationConfigs = config$
|
|
106
|
+
exports.readGiteaConfig = config$8.readGiteaConfig;
|
|
107
|
+
exports.readGithubIntegrationConfig = config$9.readGithubIntegrationConfig;
|
|
108
|
+
exports.readGithubIntegrationConfigs = config$9.readGithubIntegrationConfigs;
|
|
102
109
|
exports.getGitHubRequestOptions = core$6.getGitHubRequestOptions;
|
|
103
110
|
exports.getGithubFileFetchUrl = core$6.getGithubFileFetchUrl;
|
|
104
111
|
exports.DefaultGithubCredentialsProvider = DefaultGithubCredentialsProvider.DefaultGithubCredentialsProvider;
|
|
@@ -106,22 +113,22 @@ exports.GithubAppCredentialsMux = SingleInstanceGithubCredentialsProvider.Github
|
|
|
106
113
|
exports.SingleInstanceGithubCredentialsProvider = SingleInstanceGithubCredentialsProvider.SingleInstanceGithubCredentialsProvider;
|
|
107
114
|
exports.GithubIntegration = GithubIntegration.GithubIntegration;
|
|
108
115
|
exports.replaceGithubUrlType = GithubIntegration.replaceGithubUrlType;
|
|
109
|
-
exports.getGitLabIntegrationRelativePath = config$
|
|
110
|
-
exports.readGitLabIntegrationConfig = config$
|
|
111
|
-
exports.readGitLabIntegrationConfigs = config$
|
|
116
|
+
exports.getGitLabIntegrationRelativePath = config$a.getGitLabIntegrationRelativePath;
|
|
117
|
+
exports.readGitLabIntegrationConfig = config$a.readGitLabIntegrationConfig;
|
|
118
|
+
exports.readGitLabIntegrationConfigs = config$a.readGitLabIntegrationConfigs;
|
|
112
119
|
exports.getGitLabFileFetchUrl = core$7.getGitLabFileFetchUrl;
|
|
113
120
|
exports.getGitLabRequestOptions = core$7.getGitLabRequestOptions;
|
|
114
121
|
exports.GitLabIntegration = GitLabIntegration.GitLabIntegration;
|
|
115
122
|
exports.replaceGitLabUrlType = GitLabIntegration.replaceGitLabUrlType;
|
|
116
123
|
exports.DefaultGitlabCredentialsProvider = DefaultGitlabCredentialsProvider.DefaultGitlabCredentialsProvider;
|
|
117
|
-
exports.readGoogleGcsIntegrationConfig = config$
|
|
124
|
+
exports.readGoogleGcsIntegrationConfig = config$b.readGoogleGcsIntegrationConfig;
|
|
118
125
|
exports.HarnessIntegration = HarnessIntegration.HarnessIntegration;
|
|
119
126
|
exports.getHarnessArchiveUrl = core$8.getHarnessArchiveUrl;
|
|
120
127
|
exports.getHarnessFileContentsUrl = core$8.getHarnessFileContentsUrl;
|
|
121
128
|
exports.getHarnessLatestCommitUrl = core$8.getHarnessLatestCommitUrl;
|
|
122
129
|
exports.getHarnessRequestOptions = core$8.getHarnessRequestOptions;
|
|
123
130
|
exports.parseHarnessUrl = core$8.parseHarnessUrl;
|
|
124
|
-
exports.readHarnessConfig = config$
|
|
131
|
+
exports.readHarnessConfig = config$c.readHarnessConfig;
|
|
125
132
|
exports.defaultScmResolveUrl = helpers.defaultScmResolveUrl;
|
|
126
133
|
exports.ScmIntegrations = ScmIntegrations.ScmIntegrations;
|
|
127
134
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Config } from '@backstage/config';
|
|
2
|
+
import { TokenCredential } from '@azure/identity';
|
|
3
|
+
import { StorageSharedKeyCredential, AnonymousCredential } from '@azure/storage-blob';
|
|
2
4
|
import { ConsumedResponse } from '@backstage/errors';
|
|
3
5
|
import { RestEndpointMethodTypes } from '@octokit/rest';
|
|
4
6
|
|
|
@@ -240,6 +242,103 @@ declare class AwsCodeCommitIntegration implements ScmIntegration {
|
|
|
240
242
|
resolveEditUrl(url: string): string;
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
/**
|
|
246
|
+
* The configuration parameters for a single Azure Blob Storage account.
|
|
247
|
+
*
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
250
|
+
type AzureBlobStorageIntegrationConfig = {
|
|
251
|
+
/**
|
|
252
|
+
* The name of the Azure Storage Account, e.g., "mystorageaccount".
|
|
253
|
+
*/
|
|
254
|
+
accountName?: string;
|
|
255
|
+
/**
|
|
256
|
+
* The primary or secondary key for the Azure Storage Account.
|
|
257
|
+
* Only required if connectionString or SAS token are not specified.
|
|
258
|
+
*/
|
|
259
|
+
accountKey?: string;
|
|
260
|
+
/**
|
|
261
|
+
* A Shared Access Signature (SAS) token for limited access to resources.
|
|
262
|
+
*/
|
|
263
|
+
sasToken?: string;
|
|
264
|
+
/**
|
|
265
|
+
* A full connection string for the Azure Storage Account.
|
|
266
|
+
* This includes the account name, key, and endpoint details.
|
|
267
|
+
*/
|
|
268
|
+
connectionString?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Optional endpoint suffix for custom domains or sovereign clouds.
|
|
271
|
+
* e.g., "core.windows.net" for public Azure or "core.usgovcloudapi.net" for US Government cloud.
|
|
272
|
+
*/
|
|
273
|
+
endpointSuffix?: string;
|
|
274
|
+
/**
|
|
275
|
+
* The host of the target that this matches on, e.g., "blob.core.windows.net".
|
|
276
|
+
*/
|
|
277
|
+
host: string;
|
|
278
|
+
endpoint?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Optional credential to use for Azure Active Directory authentication.
|
|
281
|
+
*/
|
|
282
|
+
aadCredential?: {
|
|
283
|
+
/**
|
|
284
|
+
* The client ID of the Azure AD application.
|
|
285
|
+
*/
|
|
286
|
+
clientId: string;
|
|
287
|
+
/**
|
|
288
|
+
* The tenant ID for Azure AD.
|
|
289
|
+
*/
|
|
290
|
+
tenantId: string;
|
|
291
|
+
/**
|
|
292
|
+
* The client secret for the Azure AD application.
|
|
293
|
+
*/
|
|
294
|
+
clientSecret: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Reads a single Azure Blob Storage integration config.
|
|
299
|
+
*
|
|
300
|
+
* @param config - The config object of a single integration.
|
|
301
|
+
* @public
|
|
302
|
+
*/
|
|
303
|
+
declare function readAzureBlobStorageIntegrationConfig(config: Config): AzureBlobStorageIntegrationConfig;
|
|
304
|
+
/**
|
|
305
|
+
* Reads a set of Azure Blob Storage integration configs.
|
|
306
|
+
*
|
|
307
|
+
* @param configs - All of the integration config objects.
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
310
|
+
declare function readAzureBlobStorageIntegrationConfigs(configs: Config[]): AzureBlobStorageIntegrationConfig[];
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Microsoft Azure Blob storage based integration.
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
declare class AzureBlobStorageIntergation implements ScmIntegration {
|
|
318
|
+
private readonly integrationConfig;
|
|
319
|
+
static factory: ScmIntegrationsFactory<AzureBlobStorageIntergation>;
|
|
320
|
+
get type(): string;
|
|
321
|
+
get title(): string;
|
|
322
|
+
get config(): AzureBlobStorageIntegrationConfig;
|
|
323
|
+
constructor(integrationConfig: AzureBlobStorageIntegrationConfig);
|
|
324
|
+
resolveUrl(options: {
|
|
325
|
+
url: string;
|
|
326
|
+
base: string;
|
|
327
|
+
lineNumber?: number | undefined;
|
|
328
|
+
}): string;
|
|
329
|
+
resolveEditUrl(url: string): string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* This allows implementations to be provided to retrieve Azure Storage accounts credentials.
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
interface AzureCredentialsManager {
|
|
339
|
+
getCredentials(accountName: string): Promise<TokenCredential | StorageSharedKeyCredential | AnonymousCredential>;
|
|
340
|
+
}
|
|
341
|
+
|
|
243
342
|
/**
|
|
244
343
|
* The configuration parameters for a single Azure provider.
|
|
245
344
|
*
|
|
@@ -379,65 +478,6 @@ declare class AzureIntegration implements ScmIntegration {
|
|
|
379
478
|
resolveEditUrl(url: string): string;
|
|
380
479
|
}
|
|
381
480
|
|
|
382
|
-
/**
|
|
383
|
-
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
384
|
-
* for fetching the contents of the data.
|
|
385
|
-
*
|
|
386
|
-
* @remarks
|
|
387
|
-
*
|
|
388
|
-
* Converts
|
|
389
|
-
* - from: `https://dev.azure.com/{organization}/{project}/_git/reponame?path={path}&version=GB{commitOrBranch}&_a=contents`
|
|
390
|
-
* - to: `https://dev.azure.com/{organization}/{project}/_apis/git/repositories/reponame/items?path={path}&version={commitOrBranch}`
|
|
391
|
-
*
|
|
392
|
-
* @param url - A URL pointing to a file
|
|
393
|
-
* @public
|
|
394
|
-
*/
|
|
395
|
-
declare function getAzureFileFetchUrl(url: string): string;
|
|
396
|
-
/**
|
|
397
|
-
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
398
|
-
* for downloading the subtree.
|
|
399
|
-
*
|
|
400
|
-
* @param url - A URL pointing to a path
|
|
401
|
-
* @public
|
|
402
|
-
*/
|
|
403
|
-
declare function getAzureDownloadUrl(url: string): string;
|
|
404
|
-
/**
|
|
405
|
-
* Given a URL, return the API URL to fetch commits on the branch.
|
|
406
|
-
*
|
|
407
|
-
* @param url - A URL pointing to a repository or a sub-path
|
|
408
|
-
* @public
|
|
409
|
-
*/
|
|
410
|
-
declare function getAzureCommitsUrl(url: string): string;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* The type of Azure DevOps credential, either bearer or pat.
|
|
414
|
-
* @public
|
|
415
|
-
*/
|
|
416
|
-
type AzureDevOpsCredentialType = 'bearer' | 'pat';
|
|
417
|
-
/**
|
|
418
|
-
* A set of credentials for Azure DevOps.
|
|
419
|
-
*
|
|
420
|
-
* @public
|
|
421
|
-
*/
|
|
422
|
-
type AzureDevOpsCredentials = {
|
|
423
|
-
headers: {
|
|
424
|
-
[name: string]: string;
|
|
425
|
-
};
|
|
426
|
-
token: string;
|
|
427
|
-
type: AzureDevOpsCredentialType;
|
|
428
|
-
};
|
|
429
|
-
/**
|
|
430
|
-
* This allows implementations to be provided to retrieve Azure DevOps credentials.
|
|
431
|
-
*
|
|
432
|
-
* @public
|
|
433
|
-
*
|
|
434
|
-
*/
|
|
435
|
-
interface AzureDevOpsCredentialsProvider {
|
|
436
|
-
getCredentials(opts: {
|
|
437
|
-
url: string;
|
|
438
|
-
}): Promise<AzureDevOpsCredentials | undefined>;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
481
|
/**
|
|
442
482
|
* The configuration parameters for a single Bitbucket Cloud API provider.
|
|
443
483
|
*
|
|
@@ -1050,6 +1090,7 @@ declare class HarnessIntegration implements ScmIntegration {
|
|
|
1050
1090
|
interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
1051
1091
|
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
1052
1092
|
awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;
|
|
1093
|
+
azureBlobStorage: ScmIntegrationsGroup<AzureBlobStorageIntergation>;
|
|
1053
1094
|
azure: ScmIntegrationsGroup<AzureIntegration>;
|
|
1054
1095
|
/**
|
|
1055
1096
|
* @deprecated in favor of `bitbucketCloud` and `bitbucketServer`
|
|
@@ -1102,6 +1143,81 @@ interface ScmIntegrationRegistry extends ScmIntegrationsGroup<ScmIntegration> {
|
|
|
1102
1143
|
resolveEditUrl(url: string): string;
|
|
1103
1144
|
}
|
|
1104
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* Default implementation of AzureCredentialsManager that supports multiple Azure Blob Storage integrations.
|
|
1148
|
+
* @public
|
|
1149
|
+
*/
|
|
1150
|
+
declare class DefaultAzureCredentialsManager implements AzureCredentialsManager {
|
|
1151
|
+
private readonly configProviders;
|
|
1152
|
+
private cachedCredentials;
|
|
1153
|
+
private constructor();
|
|
1154
|
+
/**
|
|
1155
|
+
* Creates an instance of DefaultAzureCredentialsManager from a Backstage integration registry.
|
|
1156
|
+
*/
|
|
1157
|
+
static fromIntegrations(integrations: ScmIntegrationRegistry): DefaultAzureCredentialsManager;
|
|
1158
|
+
private createCredential;
|
|
1159
|
+
getCredentials(accountName: string): Promise<TokenCredential>;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Given a URL pointing to a file on a provider, returns a URL that is suitable
|
|
1164
|
+
* for fetching the contents of the data.
|
|
1165
|
+
*
|
|
1166
|
+
* @remarks
|
|
1167
|
+
*
|
|
1168
|
+
* Converts
|
|
1169
|
+
* - from: `https://dev.azure.com/{organization}/{project}/_git/reponame?path={path}&version=GB{commitOrBranch}&_a=contents`
|
|
1170
|
+
* - to: `https://dev.azure.com/{organization}/{project}/_apis/git/repositories/reponame/items?path={path}&version={commitOrBranch}`
|
|
1171
|
+
*
|
|
1172
|
+
* @param url - A URL pointing to a file
|
|
1173
|
+
* @public
|
|
1174
|
+
*/
|
|
1175
|
+
declare function getAzureFileFetchUrl(url: string): string;
|
|
1176
|
+
/**
|
|
1177
|
+
* Given a URL pointing to a path on a provider, returns a URL that is suitable
|
|
1178
|
+
* for downloading the subtree.
|
|
1179
|
+
*
|
|
1180
|
+
* @param url - A URL pointing to a path
|
|
1181
|
+
* @public
|
|
1182
|
+
*/
|
|
1183
|
+
declare function getAzureDownloadUrl(url: string): string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Given a URL, return the API URL to fetch commits on the branch.
|
|
1186
|
+
*
|
|
1187
|
+
* @param url - A URL pointing to a repository or a sub-path
|
|
1188
|
+
* @public
|
|
1189
|
+
*/
|
|
1190
|
+
declare function getAzureCommitsUrl(url: string): string;
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* The type of Azure DevOps credential, either bearer or pat.
|
|
1194
|
+
* @public
|
|
1195
|
+
*/
|
|
1196
|
+
type AzureDevOpsCredentialType = 'bearer' | 'pat';
|
|
1197
|
+
/**
|
|
1198
|
+
* A set of credentials for Azure DevOps.
|
|
1199
|
+
*
|
|
1200
|
+
* @public
|
|
1201
|
+
*/
|
|
1202
|
+
type AzureDevOpsCredentials = {
|
|
1203
|
+
headers: {
|
|
1204
|
+
[name: string]: string;
|
|
1205
|
+
};
|
|
1206
|
+
token: string;
|
|
1207
|
+
type: AzureDevOpsCredentialType;
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* This allows implementations to be provided to retrieve Azure DevOps credentials.
|
|
1211
|
+
*
|
|
1212
|
+
* @public
|
|
1213
|
+
*
|
|
1214
|
+
*/
|
|
1215
|
+
interface AzureDevOpsCredentialsProvider {
|
|
1216
|
+
getCredentials(opts: {
|
|
1217
|
+
url: string;
|
|
1218
|
+
}): Promise<AzureDevOpsCredentials | undefined>;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1105
1221
|
/**
|
|
1106
1222
|
* Default implementation of AzureDevOpsCredentialsProvider.
|
|
1107
1223
|
* @public
|
|
@@ -1785,6 +1901,7 @@ declare function defaultScmResolveUrl(options: {
|
|
|
1785
1901
|
interface IntegrationsByType {
|
|
1786
1902
|
awsS3: ScmIntegrationsGroup<AwsS3Integration>;
|
|
1787
1903
|
awsCodeCommit: ScmIntegrationsGroup<AwsCodeCommitIntegration>;
|
|
1904
|
+
azureBlobStorage: ScmIntegrationsGroup<AzureBlobStorageIntergation>;
|
|
1788
1905
|
azure: ScmIntegrationsGroup<AzureIntegration>;
|
|
1789
1906
|
/**
|
|
1790
1907
|
* @deprecated in favor of `bitbucketCloud` and `bitbucketServer`
|
|
@@ -1809,6 +1926,7 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1809
1926
|
constructor(integrationsByType: IntegrationsByType);
|
|
1810
1927
|
get awsS3(): ScmIntegrationsGroup<AwsS3Integration>;
|
|
1811
1928
|
get awsCodeCommit(): ScmIntegrationsGroup<AwsCodeCommitIntegration>;
|
|
1929
|
+
get azureBlobStorage(): ScmIntegrationsGroup<AzureBlobStorageIntergation>;
|
|
1812
1930
|
get azure(): ScmIntegrationsGroup<AzureIntegration>;
|
|
1813
1931
|
/**
|
|
1814
1932
|
* @deprecated in favor of `bitbucketCloud()` and `bitbucketServer()`
|
|
@@ -1832,4 +1950,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1832
1950
|
resolveEditUrl(url: string): string;
|
|
1833
1951
|
}
|
|
1834
1952
|
|
|
1835
|
-
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, GitLabIntegration, type GitLabIntegrationConfig, GiteaIntegration, type GiteaIntegrationConfig, type GithubAppConfig, GithubAppCredentialsMux, type GithubCredentialType, type GithubCredentials, type GithubCredentialsProvider, GithubIntegration, type GithubIntegrationConfig, type GitlabCredentials, type GitlabCredentialsProvider, type GoogleGcsIntegrationConfig, HarnessIntegration, type HarnessIntegrationConfig, 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, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, getHarnessArchiveUrl, getHarnessFileContentsUrl, getHarnessLatestCommitUrl, getHarnessRequestOptions, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, parseGitilesUrlRef, parseHarnessUrl, readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, readHarnessConfig, replaceGitLabUrlType, replaceGithubUrlType };
|
|
1953
|
+
export { AwsCodeCommitIntegration, type AwsCodeCommitIntegrationConfig, AwsS3Integration, type AwsS3IntegrationConfig, type AzureBlobStorageIntegrationConfig, AzureBlobStorageIntergation, type AzureClientSecretCredential, type AzureCredentialBase, type AzureCredentialsManager, 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, DefaultAzureCredentialsManager, DefaultAzureDevOpsCredentialsProvider, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, type GerritIntegrationConfig, GitLabIntegration, type GitLabIntegrationConfig, GiteaIntegration, type GiteaIntegrationConfig, type GithubAppConfig, GithubAppCredentialsMux, type GithubCredentialType, type GithubCredentials, type GithubCredentialsProvider, GithubIntegration, type GithubIntegrationConfig, type GitlabCredentials, type GitlabCredentialsProvider, type GoogleGcsIntegrationConfig, HarnessIntegration, type HarnessIntegrationConfig, 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, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaArchiveUrl, getGiteaEditContentsUrl, getGiteaFileContentsUrl, getGiteaLatestCommitUrl, getGiteaRequestOptions, getGithubFileFetchUrl, getHarnessArchiveUrl, getHarnessFileContentsUrl, getHarnessLatestCommitUrl, getHarnessRequestOptions, parseGerritGitilesUrl, parseGerritJsonResponse, parseGiteaUrl, parseGitilesUrlRef, parseHarnessUrl, readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureBlobStorageIntegrationConfig, readAzureBlobStorageIntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, readHarnessConfig, replaceGitLabUrlType, replaceGithubUrlType };
|
package/dist/index.esm.js
CHANGED
|
@@ -2,6 +2,9 @@ export { AwsS3Integration } from './awsS3/AwsS3Integration.esm.js';
|
|
|
2
2
|
export { readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs } from './awsS3/config.esm.js';
|
|
3
3
|
export { AwsCodeCommitIntegration } from './awsCodeCommit/AwsCodeCommitIntegration.esm.js';
|
|
4
4
|
export { readAwsCodeCommitIntegrationConfig, readAwsCodeCommitIntegrationConfigs } from './awsCodeCommit/config.esm.js';
|
|
5
|
+
export { AzureBlobStorageIntergation } from './azureBlobStorage/AzureBlobStorageIntegration.esm.js';
|
|
6
|
+
export { readAzureBlobStorageIntegrationConfig, readAzureBlobStorageIntegrationConfigs } from './azureBlobStorage/config.esm.js';
|
|
7
|
+
export { DefaultAzureCredentialsManager } from './azureBlobStorage/DefaultAzureCredentialsProvider.esm.js';
|
|
5
8
|
export { AzureIntegration } from './azure/AzureIntegration.esm.js';
|
|
6
9
|
export { readAzureIntegrationConfig, readAzureIntegrationConfigs } from './azure/config.esm.js';
|
|
7
10
|
export { getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl } from './azure/core.esm.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/integration",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0-next.0",
|
|
4
4
|
"description": "Helpers for managing integrations towards external systems",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "common-library"
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@azure/identity": "^4.0.0",
|
|
41
|
-
"@
|
|
42
|
-
"@backstage/
|
|
41
|
+
"@azure/storage-blob": "^12.5.0",
|
|
42
|
+
"@backstage/config": "1.3.0",
|
|
43
|
+
"@backstage/errors": "1.2.5",
|
|
43
44
|
"@octokit/auth-app": "^4.0.0",
|
|
44
45
|
"@octokit/rest": "^19.0.3",
|
|
45
46
|
"cross-fetch": "^4.0.0",
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
"luxon": "^3.0.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@backstage/cli": "
|
|
52
|
-
"@backstage/config-loader": "
|
|
52
|
+
"@backstage/cli": "0.29.3-next.0",
|
|
53
|
+
"@backstage/config-loader": "1.9.2",
|
|
53
54
|
"@types/luxon": "^3.0.0",
|
|
54
55
|
"msw": "^1.0.0"
|
|
55
56
|
},
|