@c-rex/services 0.3.0-build.33 → 0.3.0-build.34

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/dist/index.js CHANGED
@@ -2412,13 +2412,35 @@ var addTaxonomyNodeOverride = (node, map, sectionLabel) => {
2412
2412
  sectionLabel
2413
2413
  };
2414
2414
  };
2415
- var createClassSectionOverrides = (nodes) => {
2415
+ var createClassSectionOverrides = (nodes, options) => {
2416
2416
  const overrides = {};
2417
2417
  Object.values(nodes).forEach((node) => {
2418
- addTaxonomyNodeOverride(node, overrides, node.classRef?.label);
2418
+ const classId = node.classRef?.id?.trim();
2419
+ const sectionLabel = node.classRef?.label || (classId ? options?.classLabelsById?.[classId] : void 0);
2420
+ addTaxonomyNodeOverride(node, overrides, sectionLabel);
2419
2421
  });
2420
2422
  return overrides;
2421
2423
  };
2424
+ var resolveMissingClassLabels = async (nodes, uiLanguage) => {
2425
+ const classIds = Array.from(
2426
+ new Set(
2427
+ Object.values(nodes).map((node) => node.classRef?.id?.trim()).filter((value) => Boolean(value))
2428
+ )
2429
+ );
2430
+ const result = {};
2431
+ await Promise.all(
2432
+ classIds.map(async (classId) => {
2433
+ const hasLocalizedLabelInNode = Object.values(nodes).some(
2434
+ (node) => node.classRef?.id?.trim() === classId && Boolean(node.classRef?.label)
2435
+ );
2436
+ if (hasLocalizedLabelInNode) {
2437
+ return;
2438
+ }
2439
+ result[classId] = await getDomainEntitySectionLabel(classId, uiLanguage);
2440
+ })
2441
+ );
2442
+ return result;
2443
+ };
2422
2444
  var TOPIC_TYPE_DOMAIN_ENTITY_ID = "http://iirds.tekom.de/iirds#TopicType";
2423
2445
  var CONTENT_LIFECYCLE_STATUS_DOMAIN_ENTITY_ID = "http://iirds.tekom.de/iirds#ContentLifeCycleStatus";
2424
2446
  var resolveLocalizedLabel2 = (labels, uiLanguage) => {
@@ -2540,7 +2562,8 @@ var getMetadataFacetLabelOverrides = async (properties, uiLanguage = "en-US", op
2540
2562
  result[property] = overrides;
2541
2563
  return;
2542
2564
  }
2543
- result[property] = createClassSectionOverrides(taxonomy.nodesById);
2565
+ const classLabelsById = await resolveMissingClassLabels(taxonomy.nodesById, uiLanguage);
2566
+ result[property] = createClassSectionOverrides(taxonomy.nodesById, { classLabelsById });
2544
2567
  })()
2545
2568
  );
2546
2569
  }