@backstage/plugin-techdocs
Version:
The Backstage plugin that renders technical documentation for your components
28 lines (25 loc) • 965 B
JavaScript
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
import { getEntityRelations, humanizeEntityRef } from '@backstage/plugin-catalog-react';
import { toLowerMaybe } from '../../../helpers.esm.js';
function entitiesToDocsMapper(entities, getRouteToReaderPageFor, config) {
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) => humanizeEntityRef(r, { defaultKind: "group" })).join(", ")
}
};
});
}
export { entitiesToDocsMapper };
//# sourceMappingURL=helpers.esm.js.map