Address PR review comments
- Make ExtensionPointFactoryMiddleware an opaque type via new @internal/backend package using OpaqueType from @internal/opaque - Use options object for createExtensionPointFactoryMiddleware - Make middleware function async (returns Promise<T>) - Remove extensionPointFactoryMiddleware from createBackend, keep only on createSpecializedBackend - Export defaultServiceFactories from @backstage/backend-defaults Signed-off-by: Jack Palmer <jackpalmer@spotify.com>
This commit is contained in:
@@ -5,18 +5,14 @@
|
||||
```ts
|
||||
import { Backend } from '@backstage/backend-app-api';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { createExtensionPointFactoryMiddleware } from '@backstage/backend-app-api';
|
||||
import { ExtensionPointFactoryMiddleware } from '@backstage/backend-app-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
export function createBackend(options?: {
|
||||
extensionPointFactoryMiddleware?: ExtensionPointFactoryMiddleware[];
|
||||
}): Backend;
|
||||
export function createBackend(): Backend;
|
||||
|
||||
export { createExtensionPointFactoryMiddleware };
|
||||
// @public (undocumented)
|
||||
export const defaultServiceFactories: ServiceFactory[];
|
||||
|
||||
// @public
|
||||
export const discoveryFeatureLoader: BackendFeature;
|
||||
|
||||
export { ExtensionPointFactoryMiddleware };
|
||||
```
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Backend,
|
||||
createSpecializedBackend,
|
||||
ExtensionPointFactoryMiddleware,
|
||||
} from '@backstage/backend-app-api';
|
||||
import { Backend, createSpecializedBackend } from '@backstage/backend-app-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { auditorServiceFactory } from '@backstage/backend-defaults/auditor';
|
||||
import { authServiceFactory } from '@backstage/backend-defaults/auth';
|
||||
import { cacheServiceFactory } from '@backstage/backend-defaults/cache';
|
||||
@@ -46,7 +43,8 @@ import {
|
||||
} from '@backstage/backend-defaults/alpha';
|
||||
import { instanceMetadataServiceFactory } from './alpha/entrypoints/instanceMetadata/instanceMetadataServiceFactory';
|
||||
|
||||
export const defaultServiceFactories = [
|
||||
/** @public */
|
||||
export const defaultServiceFactories: ServiceFactory[] = [
|
||||
auditorServiceFactory,
|
||||
authServiceFactory,
|
||||
cacheServiceFactory,
|
||||
@@ -80,11 +78,6 @@ export const defaultServiceFactories = [
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function createBackend(options?: {
|
||||
extensionPointFactoryMiddleware?: ExtensionPointFactoryMiddleware[];
|
||||
}): Backend {
|
||||
return createSpecializedBackend({
|
||||
defaultServiceFactories,
|
||||
extensionPointFactoryMiddleware: options?.extensionPointFactoryMiddleware,
|
||||
});
|
||||
export function createBackend(): Backend {
|
||||
return createSpecializedBackend({ defaultServiceFactories });
|
||||
}
|
||||
|
||||
@@ -20,7 +20,5 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export { createBackend } from './CreateBackend';
|
||||
export type { ExtensionPointFactoryMiddleware } from '@backstage/backend-app-api';
|
||||
export { createExtensionPointFactoryMiddleware } from '@backstage/backend-app-api';
|
||||
export { createBackend, defaultServiceFactories } from './CreateBackend';
|
||||
export { discoveryFeatureLoader } from './discoveryFeatureLoader';
|
||||
|
||||
Reference in New Issue
Block a user