removed old backend system support, removed backend-common

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2025-04-25 20:32:18 +02:00
parent a459f17b2a
commit cb93cd9b8c
17 changed files with 22 additions and 212 deletions
+7 -1
View File
@@ -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`
-1
View File
@@ -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:^",
-109
View File
@@ -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<EntityPolicy | Array<EntityPolicy>>
): CatalogBuilder;
addEntityProvider(
...providers: Array<EntityProvider | Array<EntityProvider>>
): CatalogBuilder;
addLocationAnalyzers(
...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>
): CatalogBuilder;
addPermissionRules(
...permissionRules: Array<
CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>
>
): this;
addPermissions(...permissions: Array<Permission | Array<Permission>>): this;
addProcessor(
...processors: Array<CatalogProcessor | Array<CatalogProcessor>>
): 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<Validators>): 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;
}): 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<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
// @public
const catalogPlugin: BackendFeature;
export default catalogPlugin;
// @public
export interface CatalogProcessingEngine {
// (undocumented)
start(): Promise<void>;
// (undocumented)
stop(): Promise<void>;
}
// @public (undocumented)
export class CodeOwnersProcessor implements CatalogProcessor {
constructor(options: {
@@ -195,12 +95,6 @@ export class CodeOwnersProcessor implements CatalogProcessor {
preProcessEntity(entity: Entity, location: LocationSpec): Promise<Entity>;
}
// @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,
@@ -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';
@@ -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 {
-2
View File
@@ -22,6 +22,4 @@
export { catalogPlugin as default } from './service/CatalogPlugin';
export * from './processors';
export * from './processing';
export * from './service';
export * from './constants';
@@ -84,7 +84,6 @@ function addProcessorAttributes(
);
}
/** @public */
export class DefaultCatalogProcessingOrchestrator
implements CatalogProcessingOrchestrator
{
@@ -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';
@@ -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;
@@ -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<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
/**
* @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',
);
@@ -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,
@@ -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;
@@ -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';
@@ -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<Location>;
@@ -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';
@@ -32,7 +32,6 @@ export function locationSpecToMetadataName(location: LocationSpec) {
return `generated-${hash}`;
}
/** @public */
export function locationSpecToLocationEntity(opts: {
location: LocationSpec;
parentEntity?: Entity;
-1
View File
@@ -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:^"