diff --git a/.changeset/sad-showers-begin.md b/.changeset/sad-showers-begin.md index 6054072620..3f78400a13 100644 --- a/.changeset/sad-showers-begin.md +++ b/.changeset/sad-showers-begin.md @@ -2,7 +2,7 @@ '@backstage/plugin-catalog-backend': major --- -**BREAKING**: Removed all deprecated exports. +**BREAKING**: Removed all deprecated exports, and removed support for the old backend system. The following removed exports are available from `@backstage/plugin-catalog-node`: @@ -56,3 +56,9 @@ The following exports are removed without a direct replacement: - `DefaultCatalogCollatorFactoryOptions` - `LocationEntityProcessor` - `LocationEntityProcessorOptions` +- `CatalogBuilder` +- `CatalogEnvironment` +- `CatalogPermissionRuleInput` +- `CatalogProcessingEngine` +- `createRandomProcessingInterval` +- `ProcessingIntervalFunction` diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index fb6032342b..58df69f6a3 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -61,7 +61,6 @@ "test": "backstage-cli package test" }, "dependencies": { - "@backstage/backend-common": "^0.25.0", "@backstage/backend-openapi-utils": "workspace:^", "@backstage/backend-plugin-api": "workspace:^", "@backstage/catalog-client": "workspace:^", diff --git a/plugins/catalog-backend/report.api.md b/plugins/catalog-backend/report.api.md index cdabce4732..9bb94b2dd5 100644 --- a/plugins/catalog-backend/report.api.md +++ b/plugins/catalog-backend/report.api.md @@ -3,40 +3,19 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { AuditorService } from '@backstage/backend-plugin-api'; -import { AuthService } from '@backstage/backend-plugin-api'; import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogProcessor } from '@backstage/plugin-catalog-node'; import { CatalogProcessorCache } from '@backstage/plugin-catalog-node'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-node'; import { CatalogProcessorParser } from '@backstage/plugin-catalog-node'; import { Config } from '@backstage/config'; -import { DatabaseService } from '@backstage/backend-plugin-api'; -import { DiscoveryService } from '@backstage/backend-plugin-api'; -import { EntitiesSearchFilter } from '@backstage/plugin-catalog-node'; import { Entity } from '@backstage/catalog-model'; import { EntityPolicy } from '@backstage/catalog-model'; -import { EntityProvider } from '@backstage/plugin-catalog-node'; -import { EventBroker } from '@backstage/plugin-events-node'; -import { EventsService } from '@backstage/plugin-events-node'; -import { HttpAuthService } from '@backstage/backend-plugin-api'; -import { LocationAnalyzer } from '@backstage/plugin-catalog-node'; import { LocationSpec } from '@backstage/plugin-catalog-common'; import { LoggerService } from '@backstage/backend-plugin-api'; -import { Permission } from '@backstage/plugin-permission-common'; -import { PermissionAuthorizer } from '@backstage/plugin-permission-common'; -import { PermissionRule } from '@backstage/plugin-permission-node'; -import { PermissionRuleParams } from '@backstage/plugin-permission-common'; -import { PermissionsRegistryService } from '@backstage/backend-plugin-api'; -import { PermissionsService } from '@backstage/backend-plugin-api'; import { PlaceholderResolver } from '@backstage/plugin-catalog-node'; -import { RootConfigService } from '@backstage/backend-plugin-api'; -import { Router } from 'express'; -import { SchedulerService } from '@backstage/backend-plugin-api'; import { ScmIntegrationRegistry } from '@backstage/integration'; -import { ScmLocationAnalyzer } from '@backstage/plugin-catalog-node'; import { UrlReaderService } from '@backstage/backend-plugin-api'; -import { Validators } from '@backstage/catalog-model'; // @public (undocumented) export class AnnotateLocationEntityProcessor implements CatalogProcessor { @@ -91,89 +70,10 @@ export const CATALOG_CONFLICTS_TOPIC = 'experimental.catalog.conflict'; // @public (undocumented) export const CATALOG_ERRORS_TOPIC = 'experimental.catalog.errors'; -// @public @deprecated -export class CatalogBuilder { - addEntityPolicy( - ...policies: Array> - ): CatalogBuilder; - addEntityProvider( - ...providers: Array> - ): CatalogBuilder; - addLocationAnalyzers( - ...analyzers: Array> - ): CatalogBuilder; - addPermissionRules( - ...permissionRules: Array< - CatalogPermissionRuleInput | Array - > - ): this; - addPermissions(...permissions: Array>): this; - addProcessor( - ...processors: Array> - ): CatalogBuilder; - build(): Promise<{ - processingEngine: CatalogProcessingEngine; - router: Router; - }>; - static create(env: CatalogEnvironment): CatalogBuilder; - getDefaultProcessors(): CatalogProcessor[]; - replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder; - replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder; - setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder; - setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder; - setEventBroker(broker: EventBroker | EventsService): CatalogBuilder; - setFieldFormatValidators(validators: Partial): CatalogBuilder; - setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder; - setPlaceholderResolver( - key: string, - resolver: PlaceholderResolver, - ): CatalogBuilder; - setProcessingInterval( - processingInterval: ProcessingIntervalFunction, - ): CatalogBuilder; - setProcessingIntervalSeconds(seconds: number): CatalogBuilder; - // (undocumented) - subscribe(options: { - onProcessingError: (event: { - unprocessedEntity: Entity; - errors: Error[]; - }) => Promise | void; - }): void; - useLegacySingleProcessorValidation(): this; -} - -// @public @deprecated (undocumented) -export type CatalogEnvironment = { - logger: LoggerService; - database: DatabaseService; - config: RootConfigService; - reader: UrlReaderService; - permissions: PermissionsService | PermissionAuthorizer; - permissionsRegistry?: PermissionsRegistryService; - scheduler?: SchedulerService; - discovery?: DiscoveryService; - auth?: AuthService; - httpAuth?: HttpAuthService; - auditor?: AuditorService; -}; - -// @public -export type CatalogPermissionRuleInput< - TParams extends PermissionRuleParams = PermissionRuleParams, -> = PermissionRule; - // @public const catalogPlugin: BackendFeature; export default catalogPlugin; -// @public -export interface CatalogProcessingEngine { - // (undocumented) - start(): Promise; - // (undocumented) - stop(): Promise; -} - // @public (undocumented) export class CodeOwnersProcessor implements CatalogProcessor { constructor(options: { @@ -195,12 +95,6 @@ export class CodeOwnersProcessor implements CatalogProcessor { preProcessEntity(entity: Entity, location: LocationSpec): Promise; } -// @public -export function createRandomProcessingInterval(options: { - minSeconds: number; - maxSeconds: number; -}): ProcessingIntervalFunction; - // @public (undocumented) export class FileReaderProcessor implements CatalogProcessor { // (undocumented) @@ -234,9 +128,6 @@ export type PlaceholderProcessorOptions = { integrations: ScmIntegrationRegistry; }; -// @public -export type ProcessingIntervalFunction = () => number; - // @public export function transformLegacyPolicyToProcessor( policy: EntityPolicy, diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts index 750eebbadb..a09e938575 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts @@ -32,7 +32,7 @@ import { DbRefreshStateRow, DbRelationsRow, } from './tables'; -import { createRandomProcessingInterval } from '../processing'; +import { createRandomProcessingInterval } from '../processing/refresh'; import { timestampToDateTime } from './conversion'; import { generateStableHash } from './util'; import { LoggerService } from '@backstage/backend-plugin-api'; diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts index 0aa31dd36d..81c26c66ab 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts @@ -19,7 +19,7 @@ import { ConflictError } from '@backstage/errors'; import { DeferredEntity } from '@backstage/plugin-catalog-node'; import { Knex } from 'knex'; import lodash from 'lodash'; -import { ProcessingIntervalFunction } from '../processing'; +import { ProcessingIntervalFunction } from '../processing/refresh'; import { rethrowError, timestampToDateTime } from './conversion'; import { initDatabaseMetrics } from './metrics'; import { diff --git a/plugins/catalog-backend/src/index.ts b/plugins/catalog-backend/src/index.ts index ea658a9a13..72bfde4cdf 100644 --- a/plugins/catalog-backend/src/index.ts +++ b/plugins/catalog-backend/src/index.ts @@ -22,6 +22,4 @@ export { catalogPlugin as default } from './service/CatalogPlugin'; export * from './processors'; -export * from './processing'; -export * from './service'; export * from './constants'; diff --git a/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts b/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts index 5456371e15..b1fcba5d40 100644 --- a/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts +++ b/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts @@ -84,7 +84,6 @@ function addProcessorAttributes( ); } -/** @public */ export class DefaultCatalogProcessingOrchestrator implements CatalogProcessingOrchestrator { diff --git a/plugins/catalog-backend/src/processing/index.ts b/plugins/catalog-backend/src/processing/index.ts deleted file mode 100644 index 6e5893c976..0000000000 --- a/plugins/catalog-backend/src/processing/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export type { CatalogProcessingEngine } from './types'; -export { createRandomProcessingInterval } from './refresh'; -export type { ProcessingIntervalFunction } from './refresh'; diff --git a/plugins/catalog-backend/src/processing/refresh.ts b/plugins/catalog-backend/src/processing/refresh.ts index f9f596cdb9..9efc1dfcdc 100644 --- a/plugins/catalog-backend/src/processing/refresh.ts +++ b/plugins/catalog-backend/src/processing/refresh.ts @@ -16,14 +16,12 @@ /** * Function that returns the catalog processing interval in seconds. - * @public */ export type ProcessingIntervalFunction = () => number; /** * Creates a function that returns a random processing interval between minSeconds and maxSeconds. * @returns A {@link ProcessingIntervalFunction} that provides the next processing interval - * @public */ export function createRandomProcessingInterval(options: { minSeconds: number; diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 99752ca5cf..899563c74d 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -14,10 +14,6 @@ * limitations under the License. */ -import { - createLegacyAuthAdapters, - HostDiscovery, -} from '@backstage/backend-common'; import { DefaultNamespaceEntityPolicy, Entity, @@ -38,7 +34,6 @@ import { AuditorService, AuthService, DatabaseService, - DiscoveryService, HttpAuthService, LoggerService, PermissionsRegistryService, @@ -55,7 +50,6 @@ import { import { CatalogProcessor, CatalogProcessorParser, - EntitiesSearchFilter, EntityProvider, LocationAnalyzer, PlaceholderResolver, @@ -65,13 +59,11 @@ import { EventBroker, EventsService } from '@backstage/plugin-events-node'; import { Permission, PermissionAuthorizer, - PermissionRuleParams, toPermissionEvaluator, } from '@backstage/plugin-permission-common'; import { createConditionTransformer, createPermissionIntegrationRouter, - PermissionRule, } from '@backstage/plugin-permission-node'; import { durationToMilliseconds } from '@backstage/types'; import { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase'; @@ -81,11 +73,11 @@ import { applyDatabaseMigrations } from '../database/migrations'; import { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules'; import { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer'; import { permissionRules as catalogPermissionRules } from '../permissions/rules'; +import { CatalogProcessingEngine } from '../processing/types'; import { - CatalogProcessingEngine, createRandomProcessingInterval, ProcessingIntervalFunction, -} from '../processing'; +} from '../processing/refresh'; import { connectEntityProviders } from '../processing/connectEntityProviders'; import { evictEntitiesFromOrphanedProviders } from '../processing/evictEntitiesFromOrphanedProviders'; import { DefaultCatalogProcessingEngine } from '../processing/DefaultCatalogProcessingEngine'; @@ -116,21 +108,11 @@ import { DefaultEntitiesCatalog } from './DefaultEntitiesCatalog'; import { DefaultLocationService } from './DefaultLocationService'; import { DefaultRefreshService } from './DefaultRefreshService'; import { entitiesResponseToObjects } from './response'; -import { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha'; +import { + catalogEntityPermissionResourceRef, + CatalogPermissionRuleInput, +} from '@backstage/plugin-catalog-node/alpha'; -/** - * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API. - * - * @public - */ -export type CatalogPermissionRuleInput< - TParams extends PermissionRuleParams = PermissionRuleParams, -> = PermissionRule; - -/** - * @deprecated Please migrate to the new backend system as this will be removed in the future. - * @public - */ export type CatalogEnvironment = { logger: LoggerService; database: DatabaseService; @@ -139,9 +121,8 @@ export type CatalogEnvironment = { permissions: PermissionsService | PermissionAuthorizer; permissionsRegistry?: PermissionsRegistryService; scheduler?: SchedulerService; - discovery?: DiscoveryService; - auth?: AuthService; - httpAuth?: HttpAuthService; + auth: AuthService; + httpAuth: HttpAuthService; auditor?: AuditorService; }; @@ -167,9 +148,6 @@ export type CatalogEnvironment = { * - Processors can be added or replaced. These implement the functionality of * reading, parsing, validating, and processing the entity data before it is * 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; @@ -482,15 +460,11 @@ export class CatalogBuilder { permissions, scheduler, permissionsRegistry, - discovery = HostDiscovery.fromConfig(config), auditor, + auth, + httpAuth, } = this.env; - const { auth, httpAuth } = createLegacyAuthAdapters({ - ...this.env, - discovery, - }); - const disableRelationsCompatibility = config.getOptionalBoolean( 'catalog.disableRelationsCompatibility', ); diff --git a/plugins/catalog-backend/src/service/CatalogPlugin.ts b/plugins/catalog-backend/src/service/CatalogPlugin.ts index 13be6eea31..9925f11c7b 100644 --- a/plugins/catalog-backend/src/service/CatalogPlugin.ts +++ b/plugins/catalog-backend/src/service/CatalogPlugin.ts @@ -35,13 +35,14 @@ import { catalogModelExtensionPoint, CatalogPermissionExtensionPoint, catalogPermissionExtensionPoint, + CatalogPermissionRuleInput, CatalogProcessingExtensionPoint, catalogProcessingExtensionPoint, } from '@backstage/plugin-catalog-node/alpha'; import { eventsServiceRef } from '@backstage/plugin-events-node'; import { Permission } from '@backstage/plugin-permission-common'; import { merge } from 'lodash'; -import { CatalogBuilder, CatalogPermissionRuleInput } from './CatalogBuilder'; +import { CatalogBuilder } from './CatalogBuilder'; class CatalogLocationsExtensionPointImpl implements CatalogLocationsExtensionPoint @@ -232,7 +233,6 @@ export const catalogPlugin = createBackendPlugin({ httpRouter: coreServices.httpRouter, lifecycle: coreServices.rootLifecycle, scheduler: coreServices.scheduler, - discovery: coreServices.discovery, auth: coreServices.auth, httpAuth: coreServices.httpAuth, auditor: coreServices.auditor, @@ -248,7 +248,6 @@ export const catalogPlugin = createBackendPlugin({ httpRouter, lifecycle, scheduler, - discovery, auth, httpAuth, auditor, @@ -262,7 +261,6 @@ export const catalogPlugin = createBackendPlugin({ database, scheduler, logger, - discovery, auth, httpAuth, auditor, diff --git a/plugins/catalog-backend/src/service/createRouter.ts b/plugins/catalog-backend/src/service/createRouter.ts index 08e98d0548..f4ce26b66b 100644 --- a/plugins/catalog-backend/src/service/createRouter.ts +++ b/plugins/catalog-backend/src/service/createRouter.ts @@ -65,9 +65,6 @@ import { /** * 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; diff --git a/plugins/catalog-backend/src/service/index.ts b/plugins/catalog-backend/src/service/index.ts deleted file mode 100644 index 44645d39fe..0000000000 --- a/plugins/catalog-backend/src/service/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export type { - CatalogEnvironment, - CatalogPermissionRuleInput, -} from './CatalogBuilder'; -export { CatalogBuilder } from './CatalogBuilder'; diff --git a/plugins/catalog-backend/src/service/types.ts b/plugins/catalog-backend/src/service/types.ts index 30470e5af0..f9ec39c7d3 100644 --- a/plugins/catalog-backend/src/service/types.ts +++ b/plugins/catalog-backend/src/service/types.ts @@ -20,8 +20,6 @@ import { BackstageCredentials } from '@backstage/backend-plugin-api'; /** * Holds the information required to create a new location in the catalog location store. - * - * @public */ export interface LocationInput { type: string; @@ -30,7 +28,6 @@ export interface LocationInput { /** * The location service manages entity locations. - * @public */ export interface LocationService { createLocation( @@ -59,8 +56,6 @@ export interface LocationService { /** * Options for requesting a refresh of entities in the catalog. - * - * @public */ export type RefreshOptions = { /** The reference to a single entity that should be refreshed */ @@ -70,8 +65,6 @@ export type RefreshOptions = { /** * A service that manages refreshes of entities in the catalog. - * - * @public */ export interface RefreshService { /** @@ -82,7 +75,6 @@ export interface RefreshService { /** * Interacts with the database to manage locations. - * @public */ export interface LocationStore { createLocation(location: LocationInput): Promise; diff --git a/plugins/catalog-backend/src/tests/integration.test.ts b/plugins/catalog-backend/src/tests/integration.test.ts index 76d6af1f0d..400bbc7538 100644 --- a/plugins/catalog-backend/src/tests/integration.test.ts +++ b/plugins/catalog-backend/src/tests/integration.test.ts @@ -47,7 +47,7 @@ import { } from '../processing/DefaultCatalogProcessingEngine'; import { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator'; import { connectEntityProviders } from '../processing/connectEntityProviders'; -import { CatalogProcessingEngine } from '../processing'; +import { CatalogProcessingEngine } from '../processing/types'; import { DefaultEntitiesCatalog } from '../service/DefaultEntitiesCatalog'; import { DefaultRefreshService } from '../service/DefaultRefreshService'; import { RefreshOptions, RefreshService } from '../service/types'; diff --git a/plugins/catalog-backend/src/util/conversion.ts b/plugins/catalog-backend/src/util/conversion.ts index 0b92b88d90..7d542e0ce1 100644 --- a/plugins/catalog-backend/src/util/conversion.ts +++ b/plugins/catalog-backend/src/util/conversion.ts @@ -32,7 +32,6 @@ export function locationSpecToMetadataName(location: LocationSpec) { return `generated-${hash}`; } -/** @public */ export function locationSpecToLocationEntity(opts: { location: LocationSpec; parentEntity?: Entity; diff --git a/yarn.lock b/yarn.lock index c7f79ae2f0..7a3aeefd84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6016,7 +6016,6 @@ __metadata: version: 0.0.0-use.local resolution: "@backstage/plugin-catalog-backend@workspace:plugins/catalog-backend" dependencies: - "@backstage/backend-common": "npm:^0.25.0" "@backstage/backend-defaults": "workspace:^" "@backstage/backend-openapi-utils": "workspace:^" "@backstage/backend-plugin-api": "workspace:^"