backend-plugin-api: simplified ServiceFactory type

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-17 18:11:41 +02:00
parent 70343d6813
commit eef91a2558
12 changed files with 70 additions and 108 deletions
@@ -28,7 +28,7 @@ import {
tokenManagerFactory,
urlReaderFactory,
} from '@backstage/backend-app-api';
import { AnyServiceFactory } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
export const defaultServiceFactories = [
cacheFactory,
@@ -47,15 +47,15 @@ export const defaultServiceFactories = [
* @public
*/
export interface CreateBackendOptions {
services?: AnyServiceFactory[];
services?: ServiceFactory[];
}
/**
* @public
*/
export function createBackend(options?: CreateBackendOptions): Backend {
const services = new Map<string, AnyServiceFactory>(
defaultServiceFactories.map(sf => [sf.service.id, sf]),
const services = new Map<string, ServiceFactory>(
defaultServiceFactories.map(sf => [sf.service.id, sf as ServiceFactory]),
);
if (options?.services) {