From ff3c04041f4e2322a0995cbc0be396b18c044d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 23 Feb 2022 11:50:45 +0100 Subject: [PATCH] remove all usage of EntityRef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- packages/catalog-model/src/entity/ref.ts | 18 +++++++++++------- packages/catalog-model/src/types.ts | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/catalog-model/src/entity/ref.ts b/packages/catalog-model/src/entity/ref.ts index 769273dc45..850b11686f 100644 --- a/packages/catalog-model/src/entity/ref.ts +++ b/packages/catalog-model/src/entity/ref.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { EntityName, EntityRef } from '../types'; import { DEFAULT_NAMESPACE } from './constants'; +import { EntityName } from '../types'; import { Entity } from './Entity'; function parseRefString(ref: string): { @@ -76,13 +76,14 @@ export type EntityRefContext = { * otherwise specified as part of the options, and will throw an error if no * kind was specified in the input reference and no default kind was given. * + * @deprecated Please use parseEntityRef instead * @public * @param ref - The reference to parse * @param context - The context of defaults that the parsing happens within * @returns A complete entity name */ export function parseEntityName( - ref: EntityRef, + ref: string | { kind?: string; namespace?: string; name: string }, context: { /** The default kind, if none is given in the reference */ defaultKind?: string; @@ -119,7 +120,7 @@ export function parseEntityName( * @returns The compound form of the reference */ export function parseEntityRef( - ref: EntityRef, + ref: string | { kind?: string; namespace?: string; name: string }, context?: { defaultKind: string; defaultNamespace: string }, ): EntityName; /** @@ -128,7 +129,7 @@ export function parseEntityRef( * @public */ export function parseEntityRef( - ref: EntityRef, + ref: string | { kind?: string; namespace?: string; name: string }, context?: { defaultKind: string }, ): { kind: string; @@ -141,7 +142,7 @@ export function parseEntityRef( * @public */ export function parseEntityRef( - ref: EntityRef, + ref: string | { kind?: string; namespace?: string; name: string }, context?: { defaultNamespace: string }, ): { kind?: string; @@ -154,7 +155,7 @@ export function parseEntityRef( * @public */ export function parseEntityRef( - ref: EntityRef, + ref: string | { kind?: string; namespace?: string; name: string }, context: { /** The default kind, if none is given in the reference */ defaultKind?: string; @@ -249,7 +250,10 @@ export function stringifyEntityRef( */ export function compareEntityToRef( entity: Entity, - ref: EntityRef | EntityName, + ref: + | string + | { kind?: string; namespace?: string; name: string } + | EntityName, context?: { /** The default kind, if none is given in the reference */ defaultKind?: string; diff --git a/packages/catalog-model/src/types.ts b/packages/catalog-model/src/types.ts index 0526f8807e..13550968be 100644 --- a/packages/catalog-model/src/types.ts +++ b/packages/catalog-model/src/types.ts @@ -40,6 +40,7 @@ export type EntityName = { * A reference by name to an entity, either as a compact string representation, * or as a compound reference structure. * + * @deprecated Please use string directly, or EntityName (depending on what you actually need) * @remarks * * The string representation is on the form `[:][/]`.