diff --git a/.changeset/odd-spoons-design.md b/.changeset/odd-spoons-design.md new file mode 100644 index 0000000000..1d0ca96015 --- /dev/null +++ b/.changeset/odd-spoons-design.md @@ -0,0 +1,10 @@ +--- +'@backstage/plugin-catalog-backend': minor +--- + +**BREAKING**: Removed the following deprecated symbols: + +- `catalogBuilder.setRefreshInterval`, use `catalogBuilder.setProcessingInterval` instead. +- `catalogBuilder.setRefreshIntervalSeconds`, use `catalogBuilder.setProcessingIntervalSeconds` instead. +- `createRandomRefreshInterval`, use `createRandomProcessingInterval` instead. +- `RefreshIntervalFunction`, use `ProcessingIntervalFunction` instead. diff --git a/.changeset/shaggy-beers-unite.md b/.changeset/shaggy-beers-unite.md new file mode 100644 index 0000000000..7649203f52 --- /dev/null +++ b/.changeset/shaggy-beers-unite.md @@ -0,0 +1,8 @@ +--- +'@backstage/plugin-catalog-react': minor +--- + +**BREAKING**: The following deprecated annotation reading helper functions were removed: + +- `getEntityMetadataViewUrl`, use `entity.metadata.annotations?.[ANNOTATION_VIEW_URL]` instead. +- `getEntityMetadataEditUrl`, use `entity.metadata.annotations?.[ANNOTATION_EDIT_URL]` instead. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 31ee5af1f2..d648e16173 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -142,10 +142,6 @@ export class CatalogBuilder { processingInterval: ProcessingIntervalFunction, ): CatalogBuilder; setProcessingIntervalSeconds(seconds: number): CatalogBuilder; - // @deprecated - setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder; - // @deprecated - setRefreshIntervalSeconds(seconds: number): CatalogBuilder; } // @alpha @@ -324,12 +320,6 @@ export function createRandomProcessingInterval(options: { maxSeconds: number; }): ProcessingIntervalFunction; -// @public @deprecated -export function createRandomRefreshInterval(options: { - minSeconds: number; - maxSeconds: number; -}): RefreshIntervalFunction; - // @public export function createRouter(options: RouterOptions): Promise; @@ -811,9 +801,6 @@ export type RecursivePartial = { : T[P]; }; -// @public @deprecated -export type RefreshIntervalFunction = () => number; - // @public export type RefreshOptions = { entityRef: string; diff --git a/plugins/catalog-backend/src/processing/index.ts b/plugins/catalog-backend/src/processing/index.ts index aec6a5d71c..315cea37d7 100644 --- a/plugins/catalog-backend/src/processing/index.ts +++ b/plugins/catalog-backend/src/processing/index.ts @@ -23,11 +23,5 @@ export type { } from './types'; export { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator'; -export { - createRandomRefreshInterval, - createRandomProcessingInterval, -} from './refresh'; -export type { - RefreshIntervalFunction, - ProcessingIntervalFunction, -} from './refresh'; +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 941c338912..f9f596cdb9 100644 --- a/plugins/catalog-backend/src/processing/refresh.ts +++ b/plugins/catalog-backend/src/processing/refresh.ts @@ -14,35 +14,12 @@ * limitations under the License. */ -/** - * Function that returns the catalog refresh interval in seconds. - * @deprecated use {@link ProcessingIntervalFunction} instead - * @public - */ -export type RefreshIntervalFunction = () => number; - /** * Function that returns the catalog processing interval in seconds. * @public */ export type ProcessingIntervalFunction = () => number; -/** - * Creates a function that returns a random refresh interval between minSeconds and maxSeconds. - * @returns A {@link RefreshIntervalFunction} that provides the next refresh interval - * @deprecated use {@link createRandomProcessingInterval} instead - * @public - */ -export function createRandomRefreshInterval(options: { - minSeconds: number; - maxSeconds: number; -}): RefreshIntervalFunction { - const { minSeconds, maxSeconds } = options; - return () => { - return Math.random() * (maxSeconds - minSeconds) + minSeconds; - }; -} - /** * Creates a function that returns a random processing interval between minSeconds and maxSeconds. * @returns A {@link ProcessingIntervalFunction} that provides the next processing interval diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 79edf3b221..8dd507c74e 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -68,7 +68,6 @@ import { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatal import { Stitcher } from '../stitching/Stitcher'; import { createRandomProcessingInterval, - RefreshIntervalFunction, ProcessingIntervalFunction, } from '../processing/refresh'; import { createRouter } from './createRouter'; @@ -179,25 +178,6 @@ export class CatalogBuilder { return this; } - /** - * Refresh interval determines how often entities should be refreshed. - * Seconds provided will be multiplied by 1.5 - * The default refresh duration is 100-150 seconds. - * setting this too low will potentially deplete request quotas to upstream services. - * - * @deprecated use {@link CatalogBuilder#setProcessingIntervalSeconds} instead - */ - setRefreshIntervalSeconds(seconds: number): CatalogBuilder { - this.env.logger.warn( - '[DEPRECATION] - CatalogBuilder.setRefreshIntervalSeconds is deprecated. Use CatalogBuilder.setProcessingIntervalSeconds instead.', - ); - this.processingInterval = createRandomProcessingInterval({ - minSeconds: seconds, - maxSeconds: seconds * 1.5, - }); - return this; - } - /** * Processing interval determines how often entities should be processed. * Seconds provided will be multiplied by 1.5 @@ -212,20 +192,6 @@ export class CatalogBuilder { return this; } - /** - * Overwrites the default refresh interval function used to spread - * entity updates in the catalog. - * - * @deprecated use {@link CatalogBuilder#setProcessingInterval} instead - */ - setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder { - this.env.logger.warn( - '[DEPRECATION] - CatalogBuilder.setRefreshInterval is deprecated. Use CatalogBuilder.setProcessingInterval instead.', - ); - this.processingInterval = refreshInterval; - return this; - } - /** * Overwrites the default processing interval function used to spread * entity updates in the catalog. diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 502dcf208e..7859e1d2d8 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -393,12 +393,6 @@ export type FavoriteEntityProps = ComponentProps & { entity: Entity; }; -// @public @deprecated (undocumented) -export function getEntityMetadataEditUrl(entity: Entity): string | undefined; - -// @public @deprecated (undocumented) -export function getEntityMetadataViewUrl(entity: Entity): string | undefined; - // @public export function getEntityRelations( entity: Entity | undefined, diff --git a/plugins/catalog-react/src/index.ts b/plugins/catalog-react/src/index.ts index 6d5a5ad204..2ca7d67d59 100644 --- a/plugins/catalog-react/src/index.ts +++ b/plugins/catalog-react/src/index.ts @@ -32,8 +32,6 @@ export * from './testUtils'; export * from './types'; export * from './overridableComponents'; export { - getEntityMetadataEditUrl, - getEntityMetadataViewUrl, getEntityRelations, getEntitySourceLocation, isOwnerOf, diff --git a/plugins/catalog-react/src/utils/getEntityMetadataUrl.ts b/plugins/catalog-react/src/utils/getEntityMetadataUrl.ts deleted file mode 100644 index 6037fc3c4d..0000000000 --- a/plugins/catalog-react/src/utils/getEntityMetadataUrl.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2020 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. - */ - -import { - ANNOTATION_EDIT_URL, - ANNOTATION_VIEW_URL, - Entity, -} from '@backstage/catalog-model'; - -/** - * @public - * @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */ -export function getEntityMetadataViewUrl(entity: Entity): string | undefined { - return entity.metadata.annotations?.[ANNOTATION_VIEW_URL]; -} - -/** - * @public - * @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead. - */ -export function getEntityMetadataEditUrl(entity: Entity): string | undefined { - return entity.metadata.annotations?.[ANNOTATION_EDIT_URL]; -} diff --git a/plugins/catalog-react/src/utils/index.ts b/plugins/catalog-react/src/utils/index.ts index 2672664ef8..5afc32af63 100644 --- a/plugins/catalog-react/src/utils/index.ts +++ b/plugins/catalog-react/src/utils/index.ts @@ -14,10 +14,6 @@ * limitations under the License. */ export * from './filters'; -export { - getEntityMetadataEditUrl, - getEntityMetadataViewUrl, -} from './getEntityMetadataUrl'; export { getEntityRelations } from './getEntityRelations'; export { getEntitySourceLocation } from './getEntitySourceLocation'; export type { EntitySourceLocation } from './getEntitySourceLocation';