Rename serviceFactories to services, fix docs

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-08-10 15:35:18 +02:00
parent 5595a608d4
commit e419f6dcca
6 changed files with 21 additions and 36 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ export function createSpecializedBackend(
// @public (undocumented)
export interface CreateSpecializedBackendOptions {
// (undocumented)
serviceFactories: AnyServiceFactory[];
services: AnyServiceFactory[];
}
// @public (undocumented)
+2 -2
View File
@@ -42,7 +42,7 @@ export interface BackendRegisterInit {
* @public
*/
export interface CreateSpecializedBackendOptions {
serviceFactories: AnyServiceFactory[];
services: AnyServiceFactory[];
}
export type ServiceHolder = {
@@ -55,5 +55,5 @@ export type ServiceHolder = {
export function createSpecializedBackend(
options: CreateSpecializedBackendOptions,
): Backend {
return new BackstageBackend(options.serviceFactories);
return new BackstageBackend(options.services);
}
+1 -3
View File
@@ -12,8 +12,6 @@ export function createBackend(options?: CreateBackendOptions): Backend;
// @public (undocumented)
export interface CreateBackendOptions {
// (undocumented)
serviceFactories?: AnyServiceFactory[];
services?: AnyServiceFactory[];
}
// (No @packageDocumentation comment for this package)
```
+10 -5
View File
@@ -28,7 +28,6 @@ import {
tokenManagerFactory,
urlReaderFactory,
} from '@backstage/backend-app-api';
import { CreateBackendOptions } from './types';
export const defaultServiceFactories = [
cacheFactory,
@@ -43,15 +42,21 @@ export const defaultServiceFactories = [
httpRouterFactory,
];
import { AnyServiceFactory } from '@backstage/backend-plugin-api';
/**
* @public
*/
export interface CreateBackendOptions {
services?: AnyServiceFactory[];
}
/**
* @public
*/
export function createBackend(options?: CreateBackendOptions): Backend {
// TODO: merge with provided APIs
return createSpecializedBackend({
serviceFactories: [
...defaultServiceFactories,
...(options?.serviceFactories || []),
],
services: [...defaultServiceFactories, ...(options?.services || [])],
});
}
+7 -1
View File
@@ -14,5 +14,11 @@
* limitations under the License.
*/
export type { CreateBackendOptions } from './types';
/**
* Backend defaults used by Backstage backend apps
*
* @packageDocumentation
*/
export type { CreateBackendOptions } from './CreateBackend';
export { createBackend } from './CreateBackend';
-24
View File
@@ -1,24 +0,0 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AnyServiceFactory } from '@backstage/backend-plugin-api';
/**
* @public
*/
export interface CreateBackendOptions {
serviceFactories?: AnyServiceFactory[];
}