catalog-model: Deprecate EntityRefContext

and instead inline type where needed as the type isn't used much.

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-02-15 10:42:22 +01:00
parent 1c9891e3fb
commit e8c6f9d282
3 changed files with 33 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/catalog-model': patch
---
Deprecates the `EntityRefContext` type which had limited use.
+9 -3
View File
@@ -70,7 +70,10 @@ export class CommonValidatorFunctions {
export function compareEntityToRef(
entity: Entity,
ref: EntityRef | EntityName,
context?: EntityRefContext,
context?: {
defaultKind?: string;
defaultNamespace?: string;
},
): boolean;
// @public
@@ -215,7 +218,7 @@ export type EntityRef =
name: string;
};
// @public
// @public @deprecated
export type EntityRefContext = {
defaultKind?: string;
defaultNamespace?: string;
@@ -388,7 +391,10 @@ export const ORIGIN_LOCATION_ANNOTATION =
// @public
export function parseEntityName(
ref: EntityRef,
context?: EntityRefContext,
context?: {
defaultKind?: string;
defaultNamespace?: string;
},
): EntityName;
// @public
+19 -3
View File
@@ -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;