From b98f508543164d2e327f910011e2f57645ec4751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 9 Aug 2023 10:58:29 +0200 Subject: [PATCH] simplify the module argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../alpha-api-report.md | 9 ++++----- plugins/search-backend-module-catalog/src/alpha.ts | 14 ++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/search-backend-module-catalog/alpha-api-report.md b/plugins/search-backend-module-catalog/alpha-api-report.md index 1f4395e116..3db9fe97a6 100644 --- a/plugins/search-backend-module-catalog/alpha-api-report.md +++ b/plugins/search-backend-module-catalog/alpha-api-report.md @@ -4,7 +4,7 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -import { DefaultCatalogCollatorFactoryOptions } from '@backstage/plugin-search-backend-module-catalog'; +import { CatalogCollatorEntityTransformer } from '@backstage/plugin-search-backend-module-catalog'; // @alpha export const searchModuleCatalogCollator: ( @@ -12,10 +12,9 @@ export const searchModuleCatalogCollator: ( ) => BackendFeature; // @alpha -export type SearchModuleCatalogCollatorOptions = Pick< - DefaultCatalogCollatorFactoryOptions, - 'entityTransformer' ->; +export type SearchModuleCatalogCollatorOptions = { + entityTransformer?: CatalogCollatorEntityTransformer; +}; // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/search-backend-module-catalog/src/alpha.ts b/plugins/search-backend-module-catalog/src/alpha.ts index 330e11b42a..8d2a7f4ff1 100644 --- a/plugins/search-backend-module-catalog/src/alpha.ts +++ b/plugins/search-backend-module-catalog/src/alpha.ts @@ -25,8 +25,8 @@ import { } from '@backstage/backend-plugin-api'; import { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha'; import { + CatalogCollatorEntityTransformer, DefaultCatalogCollatorFactory, - DefaultCatalogCollatorFactoryOptions, } from '@backstage/plugin-search-backend-module-catalog'; import { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha'; import { readScheduleConfigOptions } from './collators/config'; @@ -36,10 +36,12 @@ import { readScheduleConfigOptions } from './collators/config'; * * @alpha */ -export type SearchModuleCatalogCollatorOptions = Pick< - DefaultCatalogCollatorFactoryOptions, - 'entityTransformer' ->; +export type SearchModuleCatalogCollatorOptions = { + /** + * Allows you to customize how entities are shaped into documents. + */ + entityTransformer?: CatalogCollatorEntityTransformer; +}; /** * Search backend module for the Catalog index. @@ -73,7 +75,7 @@ export const searchModuleCatalogCollator = createBackendModule( readScheduleConfigOptions(config), ), factory: DefaultCatalogCollatorFactory.fromConfig(config, { - ...options, + entityTransformer: options?.entityTransformer, discovery, tokenManager, catalogClient: catalog,