@backstage/plugin-catalog-backend 0.19.1 → 0.19.2

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 0.19.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3368f27aef: Fixed the handling of optional locations so that the catalog no longer logs `NotFoundError`s for missing optional locations.
8
+ - Updated dependencies
9
+ - @backstage/backend-common@0.9.14
10
+ - @backstage/catalog-model@0.9.8
11
+
3
12
  ## 0.19.1
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -472,7 +472,8 @@ async function* paginated20(request, options) {
472
472
  const defaultRepositoryParser = async function* defaultRepositoryParser2({ target }) {
473
473
  yield location({
474
474
  type: "url",
475
- target
475
+ target,
476
+ presence: "optional"
476
477
  }, true);
477
478
  };
478
479
 
@@ -1135,7 +1136,8 @@ class GithubDiscoveryProcessor {
1135
1136
  const path = `/blob/${branchName}${catalogPath}`;
1136
1137
  emit(location({
1137
1138
  type: "url",
1138
- target: `${repository.url}${path}`
1139
+ target: `${repository.url}${path}`,
1140
+ presence: "optional"
1139
1141
  }, true));
1140
1142
  }
1141
1143
  return true;
@@ -1224,7 +1226,8 @@ class AzureDevOpsDiscoveryProcessor {
1224
1226
  for (const file of files) {
1225
1227
  emit(location({
1226
1228
  type: "url",
1227
- target: `${baseUrl}/${org}/${project}/_git/${file.repository.name}?path=${file.path}`
1229
+ target: `${baseUrl}/${org}/${project}/_git/${file.repository.name}?path=${file.path}`,
1230
+ presence: "optional"
1228
1231
  }, true));
1229
1232
  }
1230
1233
  return true;
@@ -1521,7 +1524,8 @@ class GitLabDiscoveryProcessor {
1521
1524
  const project_branch = branch === "*" ? project.default_branch : branch;
1522
1525
  emit(location({
1523
1526
  type: "url",
1524
- target: `${project.web_url}/-/blob/${project_branch}/${catalogPath}`
1527
+ target: `${project.web_url}/-/blob/${project_branch}/${catalogPath}`,
1528
+ presence: "optional"
1525
1529
  }, true));
1526
1530
  }
1527
1531
  const duration = ((Date.now() - startTimestamp) / 1e3).toFixed(1);
@@ -3270,7 +3274,8 @@ function locationSpecToLocationEntity(location, parentEntity) {
3270
3274
  },
3271
3275
  spec: {
3272
3276
  type: location.type,
3273
- target: location.target
3277
+ target: location.target,
3278
+ presence: location.presence
3274
3279
  }
3275
3280
  };
3276
3281
  return result;
@@ -4366,7 +4371,8 @@ class ProcessorOutputCollector {
4366
4371
  }
4367
4372
  this.deferredEntities.push({ entity, locationKey: location });
4368
4373
  } else if (i.type === "location") {
4369
- const entity = locationSpecToLocationEntity(i.location, this.parentEntity);
4374
+ const presence = i.optional ? "optional" : "required";
4375
+ const entity = locationSpecToLocationEntity({ presence, ...i.location }, this.parentEntity);
4370
4376
  const locationKey = getEntityLocationRef(entity);
4371
4377
  this.deferredEntities.push({ entity, locationKey });
4372
4378
  } else if (i.type === "relation") {
@@ -4563,7 +4569,7 @@ class DefaultCatalogProcessingOrchestrator {
4563
4569
  }
4564
4570
  }
4565
4571
  async runSpecialLocationStep(entity, context) {
4566
- const { type = context.location.type } = entity.spec;
4572
+ const { type = context.location.type, presence = "required" } = entity.spec;
4567
4573
  const targets = new Array();
4568
4574
  if (entity.spec.target) {
4569
4575
  targets.push(entity.spec.target);
@@ -4584,8 +4590,8 @@ class DefaultCatalogProcessingOrchestrator {
4584
4590
  const read = await processor.readLocation({
4585
4591
  type,
4586
4592
  target,
4587
- presence: "required"
4588
- }, false, context.collector.onEmit, this.options.parser, context.cache.forProcessor(processor, target));
4593
+ presence
4594
+ }, presence === "optional", context.collector.onEmit, this.options.parser, context.cache.forProcessor(processor, target));
4589
4595
  if (read) {
4590
4596
  didRead = true;
4591
4597
  break;