clean up deprecations of techdocs-backend plugin

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-03-14 14:11:48 +01:00
parent cb4f0e4f07
commit b83063afe0
2 changed files with 1 additions and 56 deletions
+1 -32
View File
@@ -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<any, any>,
): 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' });
},
};
}