Merge pull request #9537 from backstage/jhaals/entityRefContext
catalog-model: Deprecate EntityRefContext
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/catalog-model': patch
|
||||
---
|
||||
|
||||
Deprecated the `EntityRefContext` type which had limited use.
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user