diff --git a/.changeset/afraid-planets-crash.md b/.changeset/afraid-planets-crash.md new file mode 100644 index 0000000000..b31a492f3d --- /dev/null +++ b/.changeset/afraid-planets-crash.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-app-api': minor +--- + +**BREAKING**: Renamed `RootHttpRouterConfigureOptions` to `RootHttpRouterConfigureContext`, and removed the unused type `ServiceOrExtensionPoint`. diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index 02b5685ead..e4c3e34751 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -11,7 +11,6 @@ import { ConfigService } from '@backstage/backend-plugin-api'; import { CorsOptions } from 'cors'; import { ErrorRequestHandler } from 'express'; import { Express as Express_2 } from 'express'; -import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { Format } from 'logform'; import { Handler } from 'express'; import { HelmetOptions } from 'helmet'; @@ -34,7 +33,6 @@ import { RootLoggerService } from '@backstage/backend-plugin-api'; import { SchedulerService } from '@backstage/backend-plugin-api'; import { ServiceFactory } from '@backstage/backend-plugin-api'; import { ServiceFactoryOrFunction } from '@backstage/backend-plugin-api'; -import { ServiceRef } from '@backstage/backend-plugin-api'; import { TokenManagerService } from '@backstage/backend-plugin-api'; import { transport } from 'winston'; import { UrlReader } from '@backstage/backend-common'; @@ -216,7 +214,7 @@ export function readHelmetOptions(config?: Config): HelmetOptions; export function readHttpServerOptions(config?: Config): HttpServerOptions; // @public (undocumented) -export interface RootHttpRouterConfigureOptions { +export interface RootHttpRouterConfigureContext { // (undocumented) app: Express_2; // (undocumented) @@ -234,7 +232,7 @@ export interface RootHttpRouterConfigureOptions { // @public (undocumented) export type RootHttpRouterFactoryOptions = { indexPath?: string | false; - configure?(options: RootHttpRouterConfigureOptions): void; + configure?(context: RootHttpRouterConfigureContext): void; }; // @public (undocumented) @@ -251,11 +249,6 @@ export const rootLoggerServiceFactory: () => ServiceFactory; // @public (undocumented) export const schedulerServiceFactory: () => ServiceFactory; -// @public (undocumented) -export type ServiceOrExtensionPoint = - | ExtensionPoint - | ServiceRef; - // @public (undocumented) export const tokenManagerServiceFactory: () => ServiceFactory; diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouter/index.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouter/index.ts index 93b997239d..8437399fec 100644 --- a/packages/backend-app-api/src/services/implementations/rootHttpRouter/index.ts +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouter/index.ts @@ -17,7 +17,7 @@ export { rootHttpRouterServiceFactory, type RootHttpRouterFactoryOptions, - type RootHttpRouterConfigureOptions, + type RootHttpRouterConfigureContext, } from './rootHttpRouterServiceFactory'; export { DefaultRootHttpRouter, diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouter/rootHttpRouterServiceFactory.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouter/rootHttpRouterServiceFactory.ts index a14beb428d..5eaf8aa152 100644 --- a/packages/backend-app-api/src/services/implementations/rootHttpRouter/rootHttpRouterServiceFactory.ts +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouter/rootHttpRouterServiceFactory.ts @@ -32,7 +32,7 @@ import { DefaultRootHttpRouter } from './DefaultRootHttpRouter'; /** * @public */ -export interface RootHttpRouterConfigureOptions { +export interface RootHttpRouterConfigureContext { app: Express; middleware: MiddlewareFactory; routes: RequestHandler; @@ -51,14 +51,11 @@ export type RootHttpRouterFactoryOptions = { */ indexPath?: string | false; - configure?(options: RootHttpRouterConfigureOptions): void; + configure?(context: RootHttpRouterConfigureContext): void; }; -function defaultConfigure({ - app, - routes, - middleware, -}: RootHttpRouterConfigureOptions) { +function defaultConfigure(context: RootHttpRouterConfigureContext) { + const { app, routes, middleware } = context; app.use(middleware.helmet()); app.use(middleware.cors()); app.use(middleware.compression()); diff --git a/packages/backend-app-api/src/wiring/index.ts b/packages/backend-app-api/src/wiring/index.ts index 6e0fb272ae..00e4a9d4b4 100644 --- a/packages/backend-app-api/src/wiring/index.ts +++ b/packages/backend-app-api/src/wiring/index.ts @@ -14,9 +14,5 @@ * limitations under the License. */ -export type { - Backend, - CreateSpecializedBackendOptions, - ServiceOrExtensionPoint, -} from './types'; +export type { Backend, CreateSpecializedBackendOptions } from './types'; export { createSpecializedBackend } from './createSpecializedBackend';