Add isApiType function

Signed-off-by: Alex McKay <amckay@spotify.com>
This commit is contained in:
Alex McKay
2024-03-29 14:04:02 -04:00
parent 34217c5d37
commit 18c7f12f39
4 changed files with 19 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Add `isApiType()` to EntitySwitch routing functions.
+5
View File
@@ -559,6 +559,11 @@ export interface HasSystemsCardProps {
variant?: InfoCardVariants;
}
// @public
export function isApiType(
types: string | string[],
): (entity: Entity) => boolean;
// @public
export function isComponentType(
types: string | string[],
@@ -60,6 +60,14 @@ export function isResourceType(types: string | string[]) {
return isEntityWith({ kind: 'resource', type: types });
}
/**
* For use in EntitySwitch.Case. Matches if the entity is an API of a given spec.type.
* @public
*/
export function isApiType(types: string | string[]) {
return isEntityWith({ kind: 'api', type: types });
}
/**
* For use in EntitySwitch.Case. Matches if the entity is the specified kind and type (if present).
* @public
@@ -22,5 +22,6 @@ export {
isNamespace,
isComponentType,
isResourceType,
isApiType,
isEntityWith,
} from './conditions';