Merge pull request #7807 from andrewthauer/custom-location-analyzer

feat: allow custom location analyzer in next catalog builder
This commit is contained in:
Fredrik Adelöw
2021-10-28 13:19:22 +02:00
committed by GitHub
3 changed files with 17 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Allow custom LocationAnalyzer in NextCatalogBuilder
+1
View File
@@ -1295,6 +1295,7 @@ export class NextCatalogBuilder {
setEntityDataParser(parser: CatalogProcessorParser): NextCatalogBuilder;
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
setFieldFormatValidators(validators: Partial<Validators>): NextCatalogBuilder;
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): NextCatalogBuilder;
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
setPlaceholderResolver(
@@ -122,6 +122,7 @@ export class NextCatalogBuilder {
minSeconds: 100,
maxSeconds: 150,
});
private locationAnalyzer: LocationAnalyzer | undefined = undefined;
constructor(env: CatalogEnvironment) {
this.env = env;
@@ -176,6 +177,14 @@ export class NextCatalogBuilder {
return this;
}
/**
* Overwrites the default location analyzer.
*/
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): NextCatalogBuilder {
this.locationAnalyzer = locationAnalyzer;
return this;
}
/**
* Sets what policies to use for validation of entities between the pre-
* processing and post-processing stages. All such policies must pass for the
@@ -338,7 +347,8 @@ export class NextCatalogBuilder {
);
const locationsCatalog = new DatabaseLocationsCatalog(db);
const locationAnalyzer = new RepoLocationAnalyzer(logger, integrations);
const locationAnalyzer =
this.locationAnalyzer ?? new RepoLocationAnalyzer(logger, integrations);
const locationService = new DefaultLocationService(
locationStore,
orchestrator,