From 163ba0826f896940802177939255cd2db4029f65 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 19 Aug 2024 10:17:39 +0200 Subject: [PATCH 1/4] catalog-backend: Deprecate createRouter and CatalogBuilder Signed-off-by: Johan Haals --- .changeset/flat-bugs-drive.md | 5 +++++ plugins/catalog-backend/api-report.md | 11 ++++++----- .../catalog-backend/src/service/CatalogBuilder.ts | 12 ++++++++---- plugins/catalog-backend/src/service/createRouter.ts | 2 ++ 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 .changeset/flat-bugs-drive.md diff --git a/.changeset/flat-bugs-drive.md b/.changeset/flat-bugs-drive.md new file mode 100644 index 0000000000..4bf460c148 --- /dev/null +++ b/.changeset/flat-bugs-drive.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': minor +--- + +Deprecated `createRouter`, `RouterOptions`, `CatalogBuilder` and `CatalogEnvironment`. Please make sure to upgrade to the new backend system. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 7efa8669e6..1433cd51ca 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -26,6 +26,7 @@ import { CatalogProcessorRefreshKeysResult as CatalogProcessorRefreshKeysResult_ import { CatalogProcessorRelationResult as CatalogProcessorRelationResult_2 } from '@backstage/plugin-catalog-node'; import { CatalogProcessorResult as CatalogProcessorResult_2 } from '@backstage/plugin-catalog-node'; import { Config } from '@backstage/config'; +import { DatabaseService } from '@backstage/backend-plugin-api'; import { DefaultCatalogCollatorFactory as DefaultCatalogCollatorFactory_2 } from '@backstage/plugin-search-backend-module-catalog'; import { DefaultCatalogCollatorFactoryOptions as DefaultCatalogCollatorFactoryOptions_2 } from '@backstage/plugin-search-backend-module-catalog'; import { DeferredEntity as DeferredEntity_2 } from '@backstage/plugin-catalog-node'; @@ -56,9 +57,9 @@ import { PlaceholderResolver as PlaceholderResolver_2 } from '@backstage/plugin- import { PlaceholderResolverParams as PlaceholderResolverParams_2 } from '@backstage/plugin-catalog-node'; import { PlaceholderResolverRead as PlaceholderResolverRead_2 } from '@backstage/plugin-catalog-node'; import { PlaceholderResolverResolveUrl as PlaceholderResolverResolveUrl_2 } from '@backstage/plugin-catalog-node'; -import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; +import { RootConfigService } from '@backstage/backend-plugin-api'; import { Router } from 'express'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { ScmLocationAnalyzer as ScmLocationAnalyzer_2 } from '@backstage/plugin-catalog-node'; @@ -137,7 +138,7 @@ export const CATALOG_CONFLICTS_TOPIC = 'experimental.catalog.conflict'; // @public (undocumented) export const CATALOG_ERRORS_TOPIC = 'experimental.catalog.errors'; -// @public +// @public @deprecated export class CatalogBuilder { addEntityPolicy( ...policies: Array> @@ -192,11 +193,11 @@ export class CatalogBuilder { export type CatalogCollatorEntityTransformer = CatalogCollatorEntityTransformer_2; -// @public (undocumented) +// @public @deprecated (undocumented) export type CatalogEnvironment = { logger: LoggerService; - database: PluginDatabaseManager; - config: Config; + database: DatabaseService; + config: RootConfigService; reader: UrlReaderService; permissions: PermissionsService | PermissionAuthorizer; scheduler?: PluginTaskScheduler; diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 344c231f7c..368f8ae731 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -17,7 +17,6 @@ import { createLegacyAuthAdapters, HostDiscovery, - PluginDatabaseManager, } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; import { @@ -107,10 +106,12 @@ import { EventBroker, EventsService } from '@backstage/plugin-events-node'; import { durationToMilliseconds } from '@backstage/types'; import { AuthService, + DatabaseService, DiscoveryService, HttpAuthService, LoggerService, PermissionsService, + RootConfigService, UrlReaderService, } from '@backstage/backend-plugin-api'; @@ -123,11 +124,13 @@ export type CatalogPermissionRuleInput< TParams extends PermissionRuleParams = PermissionRuleParams, > = PermissionRule; -/** @public */ +/** + * @deprecated Please migrate to the new backend system as this will be removed in the future. + * @public */ export type CatalogEnvironment = { logger: LoggerService; - database: PluginDatabaseManager; - config: Config; + database: DatabaseService; + config: RootConfigService; reader: UrlReaderService; permissions: PermissionsService | PermissionAuthorizer; scheduler?: PluginTaskScheduler; @@ -160,6 +163,7 @@ export type CatalogEnvironment = { * persisted in the catalog. * * @public + * @deprecated Please migrate to the new backend system as this will be removed in the future. */ export class CatalogBuilder { private readonly env: CatalogEnvironment; diff --git a/plugins/catalog-backend/src/service/createRouter.ts b/plugins/catalog-backend/src/service/createRouter.ts index 774ee61a6d..7c42814686 100644 --- a/plugins/catalog-backend/src/service/createRouter.ts +++ b/plugins/catalog-backend/src/service/createRouter.ts @@ -60,6 +60,7 @@ import { LocationAnalyzer } from '@backstage/plugin-catalog-node'; * Options used by {@link createRouter}. * * @public + * @deprecated Please migrate to the new backend system as this will be removed in the future. */ export interface RouterOptions { entitiesCatalog?: EntitiesCatalog; @@ -79,6 +80,7 @@ export interface RouterOptions { * Creates a catalog router. * * @public + * @deprecated Please migrate to the new backend system as this will be removed in the future. */ export async function createRouter( options: RouterOptions, From ae3c730296ea83d8ff8ac678a5667b5ef4972804 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 19 Aug 2024 13:04:29 +0200 Subject: [PATCH 2/4] Update plugins/catalog-backend/src/service/createRouter.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Johan Haals Signed-off-by: Johan Haals --- plugins/catalog-backend/src/service/createRouter.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/catalog-backend/src/service/createRouter.ts b/plugins/catalog-backend/src/service/createRouter.ts index 7c42814686..776cabce17 100644 --- a/plugins/catalog-backend/src/service/createRouter.ts +++ b/plugins/catalog-backend/src/service/createRouter.ts @@ -78,9 +78,6 @@ export interface RouterOptions { /** * Creates a catalog router. - * - * @public - * @deprecated Please migrate to the new backend system as this will be removed in the future. */ export async function createRouter( options: RouterOptions, From 18c281a859da0b7feec6578122db87dfcf652af9 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 19 Aug 2024 13:04:45 +0200 Subject: [PATCH 3/4] Update plugins/catalog-backend/src/service/CatalogBuilder.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Johan Haals Signed-off-by: Johan Haals --- plugins/catalog-backend/src/service/CatalogBuilder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 368f8ae731..585ed272e7 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -126,7 +126,8 @@ export type CatalogPermissionRuleInput< /** * @deprecated Please migrate to the new backend system as this will be removed in the future. - * @public */ + * @public + */ export type CatalogEnvironment = { logger: LoggerService; database: DatabaseService; From 350e44e483880c7dc8e637b9d353391c50c0d776 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 19 Aug 2024 13:05:03 +0200 Subject: [PATCH 4/4] Update .changeset/flat-bugs-drive.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Johan Haals Signed-off-by: Johan Haals --- .changeset/flat-bugs-drive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/flat-bugs-drive.md b/.changeset/flat-bugs-drive.md index 4bf460c148..dcdc65496f 100644 --- a/.changeset/flat-bugs-drive.md +++ b/.changeset/flat-bugs-drive.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog-backend': minor --- -Deprecated `createRouter`, `RouterOptions`, `CatalogBuilder` and `CatalogEnvironment`. Please make sure to upgrade to the new backend system. +Deprecated `RouterOptions`, `CatalogBuilder`, and `CatalogEnvironment`. Please make sure to upgrade to the new backend system.