DevTools - Removed Deprecated Code

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
Andre Wanlin
2024-10-31 19:33:33 -05:00
parent 1a03dc6f69
commit c781a9aefe
10 changed files with 15 additions and 75 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
"test": "backstage-cli package test"
},
"dependencies": {
"@backstage/backend-common": "^0.25.0",
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/cli-common": "workspace:^",
"@backstage/config": "workspace:^",
-24
View File
@@ -7,16 +7,8 @@ import { BackendFeature } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import { ConfigInfo } from '@backstage/plugin-devtools-common';
import { DevToolsInfo } from '@backstage/plugin-devtools-common';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import express from 'express';
import { ExternalDependency } from '@backstage/plugin-devtools-common';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PermissionsService } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public (undocumented)
export class DevToolsBackendApi {
@@ -32,20 +24,4 @@ export class DevToolsBackendApi {
// @public
const devtoolsPlugin: BackendFeature;
export default devtoolsPlugin;
// @public @deprecated (undocumented)
export interface RouterOptions {
// (undocumented)
config: RootConfigService;
// (undocumented)
devToolsBackendApi?: DevToolsBackendApi;
// (undocumented)
discovery: DiscoveryService;
// (undocumented)
httpAuth?: HttpAuthService;
// (undocumented)
logger: LoggerService;
// (undocumented)
permissions: PermissionsService;
}
```
-1
View File
@@ -21,5 +21,4 @@
*/
export { DevToolsBackendApi } from './api';
export * from './service/router';
export { devtoolsPlugin as default } from './plugin';
@@ -51,6 +51,7 @@ describe('createRouter', () => {
}),
discovery: mockServices.discovery(),
permissions: permissionEvaluator,
httpAuth: mockServices.httpAuth(),
});
app = express().use(router);
});
+8 -13
View File
@@ -24,10 +24,6 @@ import {
import { DevToolsBackendApi } from '../api';
import { NotAllowedError } from '@backstage/errors';
import Router from 'express-promise-router';
import {
createLegacyAuthAdapters,
errorHandler,
} from '@backstage/backend-common';
import express from 'express';
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
import {
@@ -37,10 +33,10 @@ import {
PermissionsService,
RootConfigService,
} from '@backstage/backend-plugin-api';
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
* @internal
*/
export interface RouterOptions {
devToolsBackendApi?: DevToolsBackendApi;
@@ -48,19 +44,16 @@ export interface RouterOptions {
config: RootConfigService;
permissions: PermissionsService;
discovery: DiscoveryService;
httpAuth?: HttpAuthService;
httpAuth: HttpAuthService;
}
/**
* @deprecated Please migrate to the new backend system as this will be removed in the future.
* @public
* @internal
* */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
const { logger, config, permissions } = options;
const { httpAuth } = createLegacyAuthAdapters(options);
const { logger, config, permissions, httpAuth } = options;
const devToolsBackendApi =
options.devToolsBackendApi || new DevToolsBackendApi(logger, config);
@@ -128,6 +121,8 @@ export async function createRouter(
response.status(200).json(health);
});
router.use(errorHandler());
const middleware = MiddlewareFactory.create({ logger, config });
router.use(middleware.error());
return router;
}