UNPKG

@backstage/plugin-techdocs

Version:

The Backstage plugin that renders technical documentation for your components

34 lines (31 loc) 1.11 kB
import { RELATION_OWNED_BY } from '@backstage/catalog-model'; import { getEntityRelations, entityPresentationSnapshot } from '@backstage/plugin-catalog-react'; import { toLowerMaybe } from '../../../helpers.esm.js'; function entitiesToDocsMapper(entities, getRouteToReaderPageFor, config, entityPresentationApi) { return entities.map((entity) => { const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY); return { entity, resolved: { docsUrl: getRouteToReaderPageFor({ namespace: toLowerMaybe( entity.metadata.namespace ?? "default", config ), kind: toLowerMaybe(entity.kind, config), name: toLowerMaybe(entity.metadata.name, config) }), ownedByRelations, ownedByRelationsTitle: ownedByRelations.map( (r) => entityPresentationSnapshot( r, { defaultKind: "group" }, entityPresentationApi ).primaryTitle ).join(", ") } }; }); } export { entitiesToDocsMapper }; //# sourceMappingURL=helpers.esm.js.map