From 474b792d6a43cd8c049ea0799e4607f74ec33354 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 6 Sep 2023 13:33:26 +0200 Subject: [PATCH] backend-plugin-api: properly mark service factory functions as such MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Co-authored-by: Camila Belo Co-authored-by: Philipp Hugenroth Signed-off-by: Patrik Oldsberg --- .changeset/wise-tables-add.md | 5 +++++ packages/backend-plugin-api/src/services/system/types.ts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/wise-tables-add.md diff --git a/.changeset/wise-tables-add.md b/.changeset/wise-tables-add.md new file mode 100644 index 0000000000..987c74cf53 --- /dev/null +++ b/.changeset/wise-tables-add.md @@ -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. diff --git a/packages/backend-plugin-api/src/services/system/types.ts b/packages/backend-plugin-api/src/services/system/types.ts index bea53dc1ed..b8fb12fe44 100644 --- a/packages/backend-plugin-api/src/services/system/types.ts +++ b/packages/backend-plugin-api/src/services/system/types.ts @@ -241,7 +241,7 @@ export function createServiceFactory< | (() => PluginServiceFactoryConfig), ): (options: TOpts) => ServiceFactory { const configCallback = typeof config === 'function' ? config : () => config; - return ( + const factory = ( options: TOpts, ): InternalServiceFactory => { 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; }