From b83063afe030b45a8bf363162a8bf0ffd61acf10 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Mon, 14 Mar 2022 14:11:48 +0100 Subject: [PATCH] clean up deprecations of techdocs-backend plugin Signed-off-by: Emma Indal --- plugins/techdocs-backend/config.d.ts | 24 -------------- .../techdocs-backend/src/service/router.ts | 33 +------------------ 2 files changed, 1 insertion(+), 56 deletions(-) diff --git a/plugins/techdocs-backend/config.d.ts b/plugins/techdocs-backend/config.d.ts index 8d531e0536..d4782ff406 100644 --- a/plugins/techdocs-backend/config.d.ts +++ b/plugins/techdocs-backend/config.d.ts @@ -46,17 +46,6 @@ export interface Config { pullImage?: boolean; }; - /** - * Techdocs generator information - * @deprecated Replaced with techdocs.generator - */ - generators?: { - /** - * @deprecated Use techdocs.generator.runIn - */ - techdocs: 'local' | 'docker'; - }; - /** * Techdocs publisher information */ @@ -252,19 +241,6 @@ export interface Config { readTimeout?: number; }; - /** - * @example http://localhost:7007/api/techdocs - * @visibility frontend - * @deprecated - */ - requestUrl?: string; - - /** - * @example http://localhost:7007/api/techdocs/static/docs - * @deprecated - */ - storageUrl?: string; - /** * (Optional and not recommended) Prior to version [0.x.y] of TechDocs, docs * sites could only be accessed over paths with case-sensitive entity triplets diff --git a/plugins/techdocs-backend/src/service/router.ts b/plugins/techdocs-backend/src/service/router.ts index e404c1b6d2..a56657cb9b 100644 --- a/plugins/techdocs-backend/src/service/router.ts +++ b/plugins/techdocs-backend/src/service/router.ts @@ -208,15 +208,7 @@ export async function createRouter( throw new NotFoundError('Entity metadata UID missing'); } - let responseHandler: DocsSynchronizerSyncOpts; - if (req.header('accept') !== 'text/event-stream') { - console.warn( - "The call to /sync/:namespace/:kind/:name wasn't done by an EventSource. This behavior is deprecated and will be removed soon. Make sure to update the @backstage/plugin-techdocs package in the frontend to the latest version.", - ); - responseHandler = createHttpResponse(res); - } else { - responseHandler = createEventStream(res); - } + const responseHandler: DocsSynchronizerSyncOpts = createEventStream(res); // By default, techdocs-backend will only try to build documentation for an entity if techdocs.builder is set to // 'local'. If set to 'external', it will assume that an external process (e.g. CI/CD pipeline @@ -345,26 +337,3 @@ export function createEventStream( }, }; } - -/** - * @deprecated use event-stream implementation of the sync endpoint - */ -export function createHttpResponse( - res: Response, -): DocsSynchronizerSyncOpts { - return { - log: () => {}, - error: e => { - throw e; - }, - finish: ({ updated }) => { - if (!updated) { - throw new NotModifiedError(); - } - - res - .status(201) - .json({ message: 'Docs updated or did not need updating' }); - }, - }; -}