diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index 130ad6d1f1..26c8179771 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -4,8 +4,9 @@ ```ts import { AnyServiceFactory } from '@backstage/backend-plugin-api'; -import { BackendRegistrable } from '@backstage/backend-plugin-api'; +import { BackendFeature } from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; +import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { HttpRouterService } from '@backstage/backend-plugin-api'; import { Logger } from '@backstage/backend-plugin-api'; import { PermissionAuthorizer } from '@backstage/plugin-permission-common'; @@ -15,13 +16,14 @@ import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; import { ServiceFactory } from '@backstage/backend-plugin-api'; +import { ServiceRef } from '@backstage/backend-plugin-api'; import { TokenManager } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; // @public (undocumented) export interface Backend { // (undocumented) - add(extension: BackendRegistrable): void; + add(feature: BackendFeature): void; // (undocumented) start(): Promise; } @@ -85,6 +87,11 @@ export const schedulerFactory: ServiceFactory< {} >; +// @public (undocumented) +export type ServiceOrExtensionPoint = + | ExtensionPoint + | ServiceRef; + // @public (undocumented) export const tokenManagerFactory: ServiceFactory< TokenManager, diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index 44791f5744..fa5097be64 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -26,23 +26,11 @@ export type AnyServiceFactory = ServiceFactory< >; // @public (undocumented) -export interface BackendInitRegistry { +export interface BackendFeature { // (undocumented) - registerExtensionPoint( - ref: ServiceRef, - impl: TExtensionPoint, - ): void; + id: string; // (undocumented) - registerInit< - Deps extends { - [name in string]: unknown; - }, - >(options: { - deps: { - [name in keyof Deps]: ServiceRef; - }; - init: (deps: Deps) => Promise; - }): void; + register(reg: BackendRegistrationPoints): void; } // @public (undocumented) @@ -53,7 +41,7 @@ export interface BackendModuleConfig { pluginId: string; // (undocumented) register( - reg: Omit, + reg: Omit, options: TOptions, ): void; } @@ -63,15 +51,27 @@ export interface BackendPluginConfig { // (undocumented) id: string; // (undocumented) - register(reg: BackendInitRegistry, options: TOptions): void; + register(reg: BackendRegistrationPoints, options: TOptions): void; } // @public (undocumented) -export interface BackendRegistrable { +export interface BackendRegistrationPoints { // (undocumented) - id: string; + registerExtensionPoint( + ref: ExtensionPoint, + impl: TExtensionPoint, + ): void; // (undocumented) - register(reg: BackendInitRegistry): void; + registerInit< + Deps extends { + [name in string]: unknown; + }, + >(options: { + deps: { + [name in keyof Deps]: ServiceRef | ExtensionPoint; + }; + init(deps: Deps): Promise; + }): void; } // @public (undocumented) @@ -84,15 +84,15 @@ export const configServiceRef: ServiceRef; export function createBackendModule( config: BackendModuleConfig, ): undefined extends TOptions - ? (options?: TOptions) => BackendRegistrable - : (options: TOptions) => BackendRegistrable; + ? (options?: TOptions) => BackendFeature + : (options: TOptions) => BackendFeature; // @public (undocumented) export function createBackendPlugin( config: BackendPluginConfig, ): undefined extends TOptions - ? (options?: TOptions) => BackendRegistrable - : (options: TOptions) => BackendRegistrable; + ? (options?: TOptions) => BackendFeature + : (options: TOptions) => BackendFeature; // @public (undocumented) export function createExtensionPoint(options: { diff --git a/packages/backend-test-utils/api-report.md b/packages/backend-test-utils/api-report.md index 9c75402b43..b8881e659d 100644 --- a/packages/backend-test-utils/api-report.md +++ b/packages/backend-test-utils/api-report.md @@ -4,16 +4,11 @@ ```ts import { AnyServiceFactory } from '@backstage/backend-plugin-api'; -import { Backend } from '@backstage/backend-app-api'; -import { BackendRegistrable } from '@backstage/backend-plugin-api'; +import { BackendFeature } from '@backstage/backend-plugin-api'; +import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { Knex } from 'knex'; import { ServiceRef } from '@backstage/backend-plugin-api'; -// @alpha (undocumented) -export function createTestBackend( - options: TestBackendOptions, -): Backend; - // @public (undocumented) export function isDockerDisabledForTests(): boolean; @@ -25,16 +20,29 @@ export function setupRequestMockHandlers(worker: { }): void; // @alpha (undocumented) -export function startTestBackend( - options: TestBackendOptions & { - registrables?: BackendRegistrable[]; - }, -): Promise; +export function startTestBackend< + TServices extends any[], + TExtensionPoints extends any[], +>(options: TestBackendOptions): Promise; // @alpha (undocumented) -export interface TestBackendOptions { +export interface TestBackendOptions< + TServices extends any[], + TExtensionPoints extends any[], +> { // (undocumented) - services: readonly [ + extensionPoints?: readonly [ + ...{ + [index in keyof TExtensionPoints]: [ + ExtensionPoint, + Partial, + ]; + }, + ]; + // (undocumented) + features?: BackendFeature[]; + // (undocumented) + services?: readonly [ ...{ [index in keyof TServices]: | AnyServiceFactory diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index fa6806933d..55f2d114db 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -5,7 +5,7 @@ ```ts /// -import { BackendRegistrable } from '@backstage/backend-plugin-api'; +import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; import { CatalogEntityDocument } from '@backstage/plugin-catalog-common'; import { CatalogProcessor } from '@backstage/plugin-catalog-node'; @@ -224,7 +224,7 @@ export type CatalogPermissionRule = PermissionRule; // @alpha -export const catalogPlugin: (options?: unknown) => BackendRegistrable; +export const catalogPlugin: (options?: unknown) => BackendFeature; // @public (undocumented) export interface CatalogProcessingEngine { diff --git a/plugins/catalog-node/api-report.md b/plugins/catalog-node/api-report.md index 47a9bdf45c..46e3efef99 100644 --- a/plugins/catalog-node/api-report.md +++ b/plugins/catalog-node/api-report.md @@ -7,8 +7,8 @@ import { CompoundEntityRef } from '@backstage/catalog-model'; import { Entity } from '@backstage/catalog-model'; +import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { JsonValue } from '@backstage/types'; -import { ServiceRef } from '@backstage/backend-plugin-api'; // @alpha (undocumented) export interface CatalogProcessingExtensionPoint { @@ -19,7 +19,7 @@ export interface CatalogProcessingExtensionPoint { } // @alpha (undocumented) -export const catalogProcessingExtensionPoint: ServiceRef; +export const catalogProcessingExtensionPoint: ExtensionPoint; // @public (undocumented) export type CatalogProcessor = { diff --git a/plugins/scaffolder-backend/api-report.md b/plugins/scaffolder-backend/api-report.md index 6e7220964d..96a4d7b400 100644 --- a/plugins/scaffolder-backend/api-report.md +++ b/plugins/scaffolder-backend/api-report.md @@ -5,7 +5,7 @@ ```ts /// -import { BackendRegistrable } from '@backstage/backend-plugin-api'; +import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; import { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; @@ -566,7 +566,7 @@ export type RunCommandOptions = { }; // @alpha -export const scaffolderCatalogModule: (options?: unknown) => BackendRegistrable; +export const scaffolderCatalogModule: (options?: unknown) => BackendFeature; // @public (undocumented) export class ScaffolderEntitiesProcessor implements CatalogProcessor {