From bbbd0f0950d72597421528afd3420efee51ba306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 23 Feb 2022 11:43:03 +0100 Subject: [PATCH] deprecate parseEntityName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/service/CodeCoverageDatabase.ts | 4 ++-- .../scaffolder/src/components/TaskPage/TaskPageLinks.tsx | 4 ++-- .../src/service/persistence/TechInsightsDatabase.ts | 6 +++--- plugins/todo-backend/src/service/router.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/code-coverage-backend/src/service/CodeCoverageDatabase.ts b/plugins/code-coverage-backend/src/service/CodeCoverageDatabase.ts index 580d560bae..9235f3a8fd 100644 --- a/plugins/code-coverage-backend/src/service/CodeCoverageDatabase.ts +++ b/plugins/code-coverage-backend/src/service/CodeCoverageDatabase.ts @@ -15,7 +15,7 @@ */ import { resolvePackagePath } from '@backstage/backend-common'; import { NotFoundError } from '@backstage/errors'; -import { parseEntityName, stringifyEntityRef } from '@backstage/catalog-model'; +import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model'; import { Knex } from 'knex'; import { v4 as uuid } from 'uuid'; import { aggregateCoverage } from './CoverageUtils'; @@ -103,7 +103,7 @@ export class CodeCoverageDatabase implements CodeCoverageStore { .map(r => JSON.parse(r.coverage)) .map(c => aggregateCoverage(c)); - const entityName = parseEntityName(entity); + const entityName = parseEntityRef(entity); return { entity: { diff --git a/plugins/scaffolder/src/components/TaskPage/TaskPageLinks.tsx b/plugins/scaffolder/src/components/TaskPage/TaskPageLinks.tsx index 2adec564a1..d53b5d705c 100644 --- a/plugins/scaffolder/src/components/TaskPage/TaskPageLinks.tsx +++ b/plugins/scaffolder/src/components/TaskPage/TaskPageLinks.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { parseEntityName } from '@backstage/catalog-model'; +import { parseEntityRef } from '@backstage/catalog-model'; import { entityRouteRef } from '@backstage/plugin-catalog-react'; import { Box } from '@material-ui/core'; import LanguageIcon from '@material-ui/icons/Language'; @@ -57,7 +57,7 @@ export const TaskPageLinks = ({ output }: TaskPageLinksProps) => { .filter(({ url, entityRef }) => url || entityRef) .map(({ url, entityRef, title, icon }) => { if (entityRef) { - const entityName = parseEntityName(entityRef); + const entityName = parseEntityRef(entityRef); const target = entityRoute(entityName); return { title, icon, url: target }; } diff --git a/plugins/tech-insights-backend/src/service/persistence/TechInsightsDatabase.ts b/plugins/tech-insights-backend/src/service/persistence/TechInsightsDatabase.ts index 0b7013295f..ddb90b75cd 100644 --- a/plugins/tech-insights-backend/src/service/persistence/TechInsightsDatabase.ts +++ b/plugins/tech-insights-backend/src/service/persistence/TechInsightsDatabase.ts @@ -26,7 +26,7 @@ import { rsort } from 'semver'; import { groupBy, omit } from 'lodash'; import { DateTime } from 'luxon'; import { Logger } from 'winston'; -import { parseEntityName, stringifyEntityRef } from '@backstage/catalog-model'; +import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model'; import { isMaxItems, isTtl } from '../fact/factRetrievers/utils'; type Transaction = Knex.Transaction; @@ -161,7 +161,7 @@ export class TechInsightsDatabase implements TechInsightsStore { return groupBy( results.map(it => { - const { namespace, kind, name } = parseEntityName(it.entity); + const { namespace, kind, name } = parseEntityRef(it.entity); const timestamp = typeof it.timestamp === 'string' ? DateTime.fromISO(it.timestamp) @@ -253,7 +253,7 @@ export class TechInsightsDatabase implements TechInsightsStore { private dbFactRowsToTechInsightFacts(rows: RawDbFactRow[]) { return rows.reduce((acc, it) => { - const { namespace, kind, name } = parseEntityName(it.entity); + const { namespace, kind, name } = parseEntityRef(it.entity); const timestamp = typeof it.timestamp === 'string' ? DateTime.fromISO(it.timestamp) diff --git a/plugins/todo-backend/src/service/router.ts b/plugins/todo-backend/src/service/router.ts index 203e552161..a0e6a6ec94 100644 --- a/plugins/todo-backend/src/service/router.ts +++ b/plugins/todo-backend/src/service/router.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { EntityName, parseEntityName } from '@backstage/catalog-model'; +import { EntityName, parseEntityRef } from '@backstage/catalog-model'; import { InputError } from '@backstage/errors'; import express from 'express'; import Router from 'express-promise-router'; @@ -55,7 +55,7 @@ export async function createRouter( let entity: EntityName | undefined = undefined; if (entityRef) { try { - entity = parseEntityName(entityRef); + entity = parseEntityRef(entityRef); } catch (error) { throw new InputError(`Invalid entity ref, ${error}`); }