diff --git a/.changeset/hungry-apples-sparkle.md b/.changeset/hungry-apples-sparkle.md new file mode 100644 index 0000000000..6cfad2d2da --- /dev/null +++ b/.changeset/hungry-apples-sparkle.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Deprecated the `EntityRefContext` type which had limited use. diff --git a/packages/catalog-model/api-report.md b/packages/catalog-model/api-report.md index 4b19c799d8..87de76b640 100644 --- a/packages/catalog-model/api-report.md +++ b/packages/catalog-model/api-report.md @@ -70,7 +70,10 @@ export class CommonValidatorFunctions { export function compareEntityToRef( entity: Entity, ref: EntityRef | EntityName, - context?: EntityRefContext, + context?: { + defaultKind?: string; + defaultNamespace?: string; + }, ): boolean; // @public @@ -218,7 +221,7 @@ export type EntityRef = name: string; }; -// @public +// @public @deprecated export type EntityRefContext = { defaultKind?: string; defaultNamespace?: string; @@ -391,7 +394,10 @@ export const ORIGIN_LOCATION_ANNOTATION = // @public export function parseEntityName( ref: EntityRef, - context?: EntityRefContext, + context?: { + defaultKind?: string; + defaultNamespace?: string; + }, ): EntityName; // @public diff --git a/packages/catalog-model/src/entity/ref.ts b/packages/catalog-model/src/entity/ref.ts index 1996616077..0cc1c21f90 100644 --- a/packages/catalog-model/src/entity/ref.ts +++ b/packages/catalog-model/src/entity/ref.ts @@ -57,6 +57,7 @@ export function getEntityName(entity: Entity): EntityName { * The context of defaults that entity reference parsing happens within. * * @public + * @deprecated type inlined, will be removed in a future release. */ export type EntityRefContext = { /** The default kind, if none is given in the reference */ @@ -82,7 +83,12 @@ export type EntityRefContext = { */ export function parseEntityName( ref: EntityRef, - context: EntityRefContext = {}, + context: { + /** The default kind, if none is given in the reference */ + defaultKind?: string; + /** The default namespace, if none is given in the reference */ + defaultNamespace?: string; + } = {}, ): EntityName { const { kind, namespace, name } = parseEntityRef(ref, { defaultNamespace: ENTITY_DEFAULT_NAMESPACE, @@ -149,7 +155,12 @@ export function parseEntityRef( */ export function parseEntityRef( ref: EntityRef, - context: EntityRefContext = {}, + context: { + /** The default kind, if none is given in the reference */ + defaultKind?: string; + /** The default namespace, if none is given in the reference */ + defaultNamespace?: string; + } = {}, ): { kind?: string; namespace?: string; @@ -238,7 +249,12 @@ export function stringifyEntityRef( export function compareEntityToRef( entity: Entity, ref: EntityRef | EntityName, - context?: EntityRefContext, + context?: { + /** The default kind, if none is given in the reference */ + defaultKind?: string; + /** The default namespace, if none is given in the reference */ + defaultNamespace?: string; + }, ): boolean { const entityKind = entity.kind; const entityNamespace = entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE;