Merge pull request #19810 from backstage/mob/factory-factory-factory

backend-plugin-api: properly mark service factory functions as such
This commit is contained in:
Patrik Oldsberg
2023-09-06 14:07:05 +02:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-plugin-api': patch
---
Service factory functions are now marked as feature factories that can be installed in the backend.
@@ -241,7 +241,7 @@ export function createServiceFactory<
| (() => PluginServiceFactoryConfig<TService, TContext, TImpl, TDeps>),
): (options: TOpts) => ServiceFactory {
const configCallback = typeof config === 'function' ? config : () => config;
return (
const factory = (
options: TOpts,
): InternalServiceFactory<TService, 'plugin' | 'root'> => {
const anyConf = configCallback(options);
@@ -275,4 +275,8 @@ export function createServiceFactory<
factory: async (deps: TDeps, ctx: TContext) => c.factory(deps, ctx),
};
};
factory.$$type = '@backstage/BackendFeatureFactory';
return factory;
}