backend-plugin-api: properly mark service factory functions as such

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Philipp Hugenroth <philipph@spotify.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-06 13:33:26 +02:00
parent 19c2e46fc5
commit 474b792d6a
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;
}