@backstage/plugin-catalog-backend 0.0.0-nightly-202201122931 → 0.0.0-nightly-202201323044
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 +13 -12
- package/dist/index.cjs.js +29 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-202201323044
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -11,20 +11,21 @@
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
13
|
- 0ae759dad4: Add catalog permission rules.
|
|
14
|
+
- 3b4d8caff6: Allow a custom GithubCredentialsProvider to be passed to the GitHub processors.
|
|
14
15
|
- 5333451def: Cleaned up API exports
|
|
15
16
|
- 730d01ab1a: Add apply-conditions endpoint for evaluating conditional permissions in catalog backend.
|
|
16
17
|
- Updated dependencies
|
|
17
|
-
- @backstage/config@0.0.0-nightly-
|
|
18
|
-
- @backstage/
|
|
19
|
-
- @backstage/backend-common@0.0.0-nightly-
|
|
20
|
-
- @backstage/
|
|
21
|
-
- @backstage/errors@0.0.0-nightly-
|
|
22
|
-
- @backstage/catalog-client@0.0.0-nightly-
|
|
23
|
-
- @backstage/catalog-model@0.0.0-nightly-
|
|
24
|
-
- @backstage/search-common@0.0.0-nightly-
|
|
25
|
-
- @backstage/types@0.0.0-nightly-
|
|
26
|
-
- @backstage/plugin-catalog-common@0.0.0-nightly-
|
|
27
|
-
- @backstage/plugin-permission-common@0.0.0-nightly-
|
|
18
|
+
- @backstage/config@0.0.0-nightly-202201323044
|
|
19
|
+
- @backstage/integration@0.0.0-nightly-202201323044
|
|
20
|
+
- @backstage/backend-common@0.0.0-nightly-202201323044
|
|
21
|
+
- @backstage/plugin-permission-node@0.0.0-nightly-202201323044
|
|
22
|
+
- @backstage/errors@0.0.0-nightly-202201323044
|
|
23
|
+
- @backstage/catalog-client@0.0.0-nightly-202201323044
|
|
24
|
+
- @backstage/catalog-model@0.0.0-nightly-202201323044
|
|
25
|
+
- @backstage/search-common@0.0.0-nightly-202201323044
|
|
26
|
+
- @backstage/types@0.0.0-nightly-202201323044
|
|
27
|
+
- @backstage/plugin-catalog-common@0.0.0-nightly-202201323044
|
|
28
|
+
- @backstage/plugin-permission-common@0.0.0-nightly-202201323044
|
|
28
29
|
|
|
29
30
|
## 0.19.4
|
|
30
31
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1107,6 +1107,7 @@ class GithubDiscoveryProcessor {
|
|
|
1107
1107
|
constructor(options) {
|
|
1108
1108
|
this.integrations = options.integrations;
|
|
1109
1109
|
this.logger = options.logger;
|
|
1110
|
+
this.githubCredentialsProvider = options.githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);
|
|
1110
1111
|
}
|
|
1111
1112
|
async readLocation(location$1, _optional, emit) {
|
|
1112
1113
|
var _a, _b;
|
|
@@ -1119,7 +1120,9 @@ class GithubDiscoveryProcessor {
|
|
|
1119
1120
|
}
|
|
1120
1121
|
const { org, repoSearchPath, catalogPath, branch, host } = parseUrl$2(location$1.target);
|
|
1121
1122
|
const orgUrl = `https://${host}/${org}`;
|
|
1122
|
-
const { headers } = await
|
|
1123
|
+
const { headers } = await this.githubCredentialsProvider.getCredentials({
|
|
1124
|
+
url: orgUrl
|
|
1125
|
+
});
|
|
1123
1126
|
const client = graphql.graphql.defaults({
|
|
1124
1127
|
baseUrl: gitHubConfig.apiBaseUrl,
|
|
1125
1128
|
headers
|
|
@@ -1304,6 +1307,7 @@ class GithubOrgReaderProcessor {
|
|
|
1304
1307
|
}
|
|
1305
1308
|
constructor(options) {
|
|
1306
1309
|
this.integrations = options.integrations;
|
|
1310
|
+
this.githubCredentialsProvider = options.githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);
|
|
1307
1311
|
this.logger = options.logger;
|
|
1308
1312
|
}
|
|
1309
1313
|
async readLocation(location, _optional, emit) {
|
|
@@ -1334,8 +1338,7 @@ class GithubOrgReaderProcessor {
|
|
|
1334
1338
|
if (!gitHubConfig) {
|
|
1335
1339
|
throw new Error(`There is no GitHub Org provider that matches ${orgUrl}. Please add a configuration for an integration.`);
|
|
1336
1340
|
}
|
|
1337
|
-
const
|
|
1338
|
-
const { headers, type: tokenType } = await credentialsProvider.getCredentials({
|
|
1341
|
+
const { headers, type: tokenType } = await this.githubCredentialsProvider.getCredentials({
|
|
1339
1342
|
url: orgUrl
|
|
1340
1343
|
});
|
|
1341
1344
|
const client = graphql.graphql.defaults({
|
|
@@ -1360,6 +1363,7 @@ class GithubMultiOrgReaderProcessor {
|
|
|
1360
1363
|
this.integrations = options.integrations;
|
|
1361
1364
|
this.logger = options.logger;
|
|
1362
1365
|
this.orgs = options.orgs;
|
|
1366
|
+
this.githubCredentialsProvider = options.githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);
|
|
1363
1367
|
}
|
|
1364
1368
|
async readLocation(location, _optional, emit) {
|
|
1365
1369
|
var _a, _b;
|
|
@@ -1372,11 +1376,10 @@ class GithubMultiOrgReaderProcessor {
|
|
|
1372
1376
|
}
|
|
1373
1377
|
const allUsersMap = /* @__PURE__ */ new Map();
|
|
1374
1378
|
const baseUrl = new URL(location.target).origin;
|
|
1375
|
-
const credentialsProvider = integration.SingleInstanceGithubCredentialsProvider.create(gitHubConfig);
|
|
1376
1379
|
const orgsToProcess = this.orgs.length ? this.orgs : await this.getAllOrgs(gitHubConfig);
|
|
1377
1380
|
for (const orgConfig of orgsToProcess) {
|
|
1378
1381
|
try {
|
|
1379
|
-
const { headers, type: tokenType } = await
|
|
1382
|
+
const { headers, type: tokenType } = await this.githubCredentialsProvider.getCredentials({
|
|
1380
1383
|
url: `${baseUrl}/${orgConfig.name}`
|
|
1381
1384
|
});
|
|
1382
1385
|
const client = graphql.graphql.defaults({
|
|
@@ -1842,7 +1845,7 @@ const defaultEntityDataParser = async function* defaultEntityDataParser2({ data,
|
|
|
1842
1845
|
class GitHubOrgEntityProvider {
|
|
1843
1846
|
constructor(options) {
|
|
1844
1847
|
this.options = options;
|
|
1845
|
-
this.
|
|
1848
|
+
this.githubCredentialsProvider = options.githubCredentialsProvider || integration.SingleInstanceGithubCredentialsProvider.create(options.gitHubConfig);
|
|
1846
1849
|
}
|
|
1847
1850
|
static fromConfig(config, options) {
|
|
1848
1851
|
var _a;
|
|
@@ -1858,7 +1861,8 @@ class GitHubOrgEntityProvider {
|
|
|
1858
1861
|
id: options.id,
|
|
1859
1862
|
orgUrl: options.orgUrl,
|
|
1860
1863
|
logger,
|
|
1861
|
-
gitHubConfig
|
|
1864
|
+
gitHubConfig,
|
|
1865
|
+
githubCredentialsProvider: options.githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(integrations)
|
|
1862
1866
|
});
|
|
1863
1867
|
}
|
|
1864
1868
|
getProviderName() {
|
|
@@ -1872,7 +1876,7 @@ class GitHubOrgEntityProvider {
|
|
|
1872
1876
|
throw new Error("Not initialized");
|
|
1873
1877
|
}
|
|
1874
1878
|
const { markReadComplete } = trackProgress(this.options.logger);
|
|
1875
|
-
const { headers, type: tokenType } = await this.
|
|
1879
|
+
const { headers, type: tokenType } = await this.githubCredentialsProvider.getCredentials({
|
|
1876
1880
|
url: this.options.orgUrl
|
|
1877
1881
|
});
|
|
1878
1882
|
const client = graphql.graphql.defaults({
|
|
@@ -5104,12 +5108,19 @@ class NextCatalogBuilder {
|
|
|
5104
5108
|
getDefaultProcessors() {
|
|
5105
5109
|
const { config, logger, reader } = this.env;
|
|
5106
5110
|
const integrations = integration.ScmIntegrations.fromConfig(config);
|
|
5111
|
+
const githubCredentialsProvider = integration.DefaultGithubCredentialsProvider.fromIntegrations(integrations);
|
|
5107
5112
|
return [
|
|
5108
5113
|
new FileReaderProcessor(),
|
|
5109
5114
|
BitbucketDiscoveryProcessor.fromConfig(config, { logger }),
|
|
5110
5115
|
AzureDevOpsDiscoveryProcessor.fromConfig(config, { logger }),
|
|
5111
|
-
GithubDiscoveryProcessor.fromConfig(config, {
|
|
5112
|
-
|
|
5116
|
+
GithubDiscoveryProcessor.fromConfig(config, {
|
|
5117
|
+
logger,
|
|
5118
|
+
githubCredentialsProvider
|
|
5119
|
+
}),
|
|
5120
|
+
GithubOrgReaderProcessor.fromConfig(config, {
|
|
5121
|
+
logger,
|
|
5122
|
+
githubCredentialsProvider
|
|
5123
|
+
}),
|
|
5113
5124
|
GitLabDiscoveryProcessor.fromConfig(config, { logger }),
|
|
5114
5125
|
new UrlReaderProcessor({ reader, logger }),
|
|
5115
5126
|
CodeOwnersProcessor.fromConfig(config, { logger, reader }),
|
|
@@ -5314,6 +5325,7 @@ class CatalogBuilder {
|
|
|
5314
5325
|
buildProcessors() {
|
|
5315
5326
|
const { config, logger, reader } = this.env;
|
|
5316
5327
|
const integrations = integration.ScmIntegrations.fromConfig(config);
|
|
5328
|
+
const githubCredentialsProvider = integration.DefaultGithubCredentialsProvider.fromIntegrations(integrations);
|
|
5317
5329
|
this.checkDeprecatedReaderProcessors();
|
|
5318
5330
|
const placeholderResolvers = {
|
|
5319
5331
|
json: jsonPlaceholderResolver,
|
|
@@ -5331,7 +5343,13 @@ class CatalogBuilder {
|
|
|
5331
5343
|
new BuiltinKindsEntityProcessor()
|
|
5332
5344
|
];
|
|
5333
5345
|
if (!this.processorsReplace) {
|
|
5334
|
-
processors.push(new FileReaderProcessor(), BitbucketDiscoveryProcessor.fromConfig(config, { logger }), GithubDiscoveryProcessor.fromConfig(config, {
|
|
5346
|
+
processors.push(new FileReaderProcessor(), BitbucketDiscoveryProcessor.fromConfig(config, { logger }), GithubDiscoveryProcessor.fromConfig(config, {
|
|
5347
|
+
logger,
|
|
5348
|
+
githubCredentialsProvider
|
|
5349
|
+
}), AzureDevOpsDiscoveryProcessor.fromConfig(config, { logger }), GithubOrgReaderProcessor.fromConfig(config, {
|
|
5350
|
+
logger,
|
|
5351
|
+
githubCredentialsProvider
|
|
5352
|
+
}), GitLabDiscoveryProcessor.fromConfig(config, { logger }), new UrlReaderProcessor({ reader, logger }), CodeOwnersProcessor.fromConfig(config, { logger, reader }), new LocationEntityProcessor({ integrations }), new AnnotateLocationEntityProcessor({ integrations }));
|
|
5335
5353
|
}
|
|
5336
5354
|
processors.push(...this.processors);
|
|
5337
5355
|
return processors;
|