diff --git a/.changeset/odd-beds-confess.md b/.changeset/odd-beds-confess.md new file mode 100644 index 0000000000..5a766beb9d --- /dev/null +++ b/.changeset/odd-beds-confess.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Replace uses of deprecated types with replacements internally. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 8b7565bd1f..a38a964d48 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -12,7 +12,7 @@ import { AnalyzeLocationRequest as AnalyzeLocationRequest_2 } from '@backstage/p import { AnalyzeLocationResponse as AnalyzeLocationResponse_2 } from '@backstage/plugin-catalog-common'; import { AnalyzeOptions as AnalyzeOptions_2 } from '@backstage/plugin-catalog-node'; import { CatalogApi } from '@backstage/catalog-client'; -import type { CatalogCollatorEntityTransformer as CatalogCollatorEntityTransformer_2 } from '@backstage/plugin-search-backend-module-catalog'; +import { CatalogCollatorEntityTransformer as CatalogCollatorEntityTransformer_2 } from '@backstage/plugin-search-backend-module-catalog'; import { CatalogEntityDocument } from '@backstage/plugin-catalog-common'; import { CatalogProcessor as CatalogProcessor_2 } from '@backstage/plugin-catalog-node'; import { CatalogProcessorCache as CatalogProcessorCache_2 } from '@backstage/plugin-catalog-node'; @@ -26,7 +26,7 @@ import { CatalogProcessorRelationResult as CatalogProcessorRelationResult_2 } fr import { CatalogProcessorResult as CatalogProcessorResult_2 } from '@backstage/plugin-catalog-node'; import { Config } from '@backstage/config'; import { DefaultCatalogCollatorFactory as DefaultCatalogCollatorFactory_2 } from '@backstage/plugin-search-backend-module-catalog'; -import type { DefaultCatalogCollatorFactoryOptions as DefaultCatalogCollatorFactoryOptions_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'; import { EntitiesSearchFilter as EntitiesSearchFilter_2 } from '@backstage/plugin-catalog-node'; import { Entity } from '@backstage/catalog-model'; @@ -38,7 +38,6 @@ import { EntityProviderMutation as EntityProviderMutation_2 } from '@backstage/p import { EntityRelationSpec as EntityRelationSpec_2 } from '@backstage/plugin-catalog-node'; import { EventBroker } from '@backstage/plugin-events-node'; import { GetEntitiesRequest } from '@backstage/catalog-client'; -import { JsonValue } from '@backstage/types'; import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common'; import { locationSpecToLocationEntity as locationSpecToLocationEntity_2 } from '@backstage/plugin-catalog-node'; import { locationSpecToMetadataName as locationSpecToMetadataName_2 } from '@backstage/plugin-catalog-node'; @@ -48,6 +47,10 @@ import { PermissionAuthorizer } from '@backstage/plugin-permission-common'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; import { PermissionRule } from '@backstage/plugin-permission-node'; import { PermissionRuleParams } from '@backstage/plugin-permission-common'; +import { PlaceholderResolver as PlaceholderResolver_2 } from '@backstage/plugin-catalog-node'; +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'; @@ -160,7 +163,7 @@ export class CatalogBuilder { setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder; setPlaceholderResolver( key: string, - resolver: PlaceholderResolver, + resolver: PlaceholderResolver_2, ): CatalogBuilder; setProcessingInterval( processingInterval: ProcessingIntervalFunction, @@ -349,8 +352,8 @@ export class FileReaderProcessor implements CatalogProcessor_2 { // @public (undocumented) export type LocationAnalyzer = { analyzeLocation( - location: AnalyzeLocationRequest, - ): Promise; + location: AnalyzeLocationRequest_2, + ): Promise; }; // @public @deprecated @@ -401,34 +404,22 @@ export class PlaceholderProcessor implements CatalogProcessor_2 { // @public (undocumented) export type PlaceholderProcessorOptions = { - resolvers: Record; + resolvers: Record; reader: UrlReader; integrations: ScmIntegrationRegistry; }; // @public @deprecated (undocumented) -export type PlaceholderResolver = ( - params: PlaceholderResolverParams, -) => Promise; +export type PlaceholderResolver = PlaceholderResolver_2; // @public @deprecated (undocumented) -export type PlaceholderResolverParams = { - key: string; - value: JsonValue; - baseUrl: string; - read: PlaceholderResolverRead; - resolveUrl: PlaceholderResolverResolveUrl; - emit: CatalogProcessorEmit_2; -}; +export type PlaceholderResolverParams = PlaceholderResolverParams_2; // @public @deprecated (undocumented) -export type PlaceholderResolverRead = (url: string) => Promise; +export type PlaceholderResolverRead = PlaceholderResolverRead_2; // @public @deprecated (undocumented) -export type PlaceholderResolverResolveUrl = ( - url: string, - base: string, -) => string; +export type PlaceholderResolverResolveUrl = PlaceholderResolverResolveUrl_2; // @public export type ProcessingIntervalFunction = () => number; diff --git a/plugins/catalog-backend/src/deprecated.ts b/plugins/catalog-backend/src/deprecated.ts index 2201bbbab4..d935150d7e 100644 --- a/plugins/catalog-backend/src/deprecated.ts +++ b/plugins/catalog-backend/src/deprecated.ts @@ -14,6 +14,11 @@ * limitations under the License. */ +import { + type AnalyzeLocationRequest as _AnalyzeLocationRequest, + type AnalyzeLocationResponse as _AnalyzeLocationResponse, + type LocationSpec as _LocationSpec, +} from '@backstage/plugin-catalog-common'; import { locationSpecToMetadataName as _locationSpecToMetadataName, locationSpecToLocationEntity as _locationSpecToLocationEntity, @@ -36,9 +41,12 @@ import { type EntityProviderConnection as _EntityProviderConnection, type EntityProviderMutation as _EntityProviderMutation, type AnalyzeOptions as _AnalyzeOptions, + type PlaceholderResolver as _PlaceholderResolver, + type PlaceholderResolverParams as _PlaceholderResolverParams, + type PlaceholderResolverRead as _PlaceholderResolverRead, + type PlaceholderResolverResolveUrl as _PlaceholderResolverResolveUrl, type ScmLocationAnalyzer as _ScmLocationAnalyzer, } from '@backstage/plugin-catalog-node'; -import { type LocationSpec as _LocationSpec } from '@backstage/plugin-catalog-common'; /** * @public @@ -165,3 +173,38 @@ export type AnalyzeOptions = _AnalyzeOptions; * @deprecated import from `@backstage/plugin-catalog-node` instead */ export type ScmLocationAnalyzer = _ScmLocationAnalyzer; + +/** + * @public + * @deprecated import from `@backstage/plugin-catalog-node` instead + */ +export type PlaceholderResolver = _PlaceholderResolver; + +/** + * @public + * @deprecated import from `@backstage/plugin-catalog-node` instead + */ +export type PlaceholderResolverParams = _PlaceholderResolverParams; + +/** + * @public + * @deprecated import from `@backstage/plugin-catalog-node` instead + */ +export type PlaceholderResolverRead = _PlaceholderResolverRead; + +/** + * @public + * @deprecated import from `@backstage/plugin-catalog-node` instead + */ +export type PlaceholderResolverResolveUrl = _PlaceholderResolverResolveUrl; + +/** + * @public + * @deprecated use the same type from `@backstage/plugin-catalog-common` instead + */ +export type AnalyzeLocationRequest = _AnalyzeLocationRequest; +/** + * @public + * @deprecated use the same type from `@backstage/plugin-catalog-common` instead + */ +export type AnalyzeLocationResponse = _AnalyzeLocationResponse; diff --git a/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts b/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts index 592b1dda21..19c231884c 100644 --- a/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts +++ b/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts @@ -17,7 +17,7 @@ import { Entity } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; import { DefaultCatalogRulesEnforcer } from './CatalogRules'; -import { LocationSpec } from '@backstage/plugin-catalog-node'; +import { LocationSpec } from '@backstage/plugin-catalog-common'; const entity = { user: { diff --git a/plugins/catalog-backend/src/ingestion/index.ts b/plugins/catalog-backend/src/ingestion/index.ts index c97d029b5c..8e61b316cc 100644 --- a/plugins/catalog-backend/src/ingestion/index.ts +++ b/plugins/catalog-backend/src/ingestion/index.ts @@ -18,7 +18,5 @@ export type { AnalyzeLocationEntityField, AnalyzeLocationExistingEntity, AnalyzeLocationGenerateEntity, - AnalyzeLocationRequest, - AnalyzeLocationResponse, LocationAnalyzer, } from './types'; diff --git a/plugins/catalog-backend/src/ingestion/types.ts b/plugins/catalog-backend/src/ingestion/types.ts index 3875d3af03..6f6bdd84ad 100644 --- a/plugins/catalog-backend/src/ingestion/types.ts +++ b/plugins/catalog-backend/src/ingestion/types.ts @@ -15,24 +15,13 @@ */ import { - AnalyzeLocationRequest as NonDeprecatedAnalyzeLocationRequest, - AnalyzeLocationResponse as NonDeprecatedAnalyzeLocationResponse, + AnalyzeLocationRequest, + AnalyzeLocationResponse, AnalyzeLocationExistingEntity as NonDeprecatedAnalyzeLocationExistingEntity, AnalyzeLocationGenerateEntity as NonDeprecatedAnalyzeLocationGenerateEntity, AnalyzeLocationEntityField as NonDeprecatedAnalyzeLocationEntityField, } from '@backstage/plugin-catalog-common'; -/** - * @public - * @deprecated use the same type from `@backstage/plugin-catalog-common` instead - */ -export type AnalyzeLocationRequest = NonDeprecatedAnalyzeLocationRequest; -/** - * @public - * @deprecated use the same type from `@backstage/plugin-catalog-common` instead - */ -export type AnalyzeLocationResponse = NonDeprecatedAnalyzeLocationResponse; - /** * If the folder pointed to already contained catalog info yaml files, they are * read and emitted like this so that the frontend can inform the user that it diff --git a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.test.ts b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.test.ts index 2ce7975e41..094f8f1df8 100644 --- a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.test.ts +++ b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.test.ts @@ -17,13 +17,15 @@ import { UrlReader } from '@backstage/backend-common'; import { Entity } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; import { ScmIntegrations } from '@backstage/integration'; -import { CatalogProcessorResult } from '@backstage/plugin-catalog-node'; import { - jsonPlaceholderResolver, - PlaceholderProcessor, + CatalogProcessorResult, PlaceholderResolver, PlaceholderResolverParams, PlaceholderResolverRead, +} from '@backstage/plugin-catalog-node'; +import { + jsonPlaceholderResolver, + PlaceholderProcessor, textPlaceholderResolver, yamlPlaceholderResolver, } from './PlaceholderProcessor'; diff --git a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts index ee61e931e3..f6431cc9f5 100644 --- a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts +++ b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts @@ -23,45 +23,11 @@ import { LocationSpec } from '@backstage/plugin-catalog-common'; import { CatalogProcessor, CatalogProcessorEmit, + PlaceholderResolver, + PlaceholderResolverParams, processingResult, } from '@backstage/plugin-catalog-node'; -/** - * @public - * @deprecated Use the exported value from `@backstage/plugin-catalog-node` instead. - */ -export type PlaceholderResolverRead = (url: string) => Promise; - -/** - * @public - * @deprecated Use the exported value from `@backstage/plugin-catalog-node` instead. - */ -export type PlaceholderResolverResolveUrl = ( - url: string, - base: string, -) => string; - -/** - * @public - * @deprecated Use the exported value from `@backstage/plugin-catalog-node` instead. - */ -export type PlaceholderResolverParams = { - key: string; - value: JsonValue; - baseUrl: string; - read: PlaceholderResolverRead; - resolveUrl: PlaceholderResolverResolveUrl; - emit: CatalogProcessorEmit; -}; - -/** - * @public - * @deprecated Use the exported value from `@backstage/plugin-catalog-node` instead. - */ -export type PlaceholderResolver = ( - params: PlaceholderResolverParams, -) => Promise; - /** @public */ export type PlaceholderProcessorOptions = { resolvers: Record; diff --git a/plugins/catalog-backend/src/modules/core/index.ts b/plugins/catalog-backend/src/modules/core/index.ts index 364cede069..365def0bfe 100644 --- a/plugins/catalog-backend/src/modules/core/index.ts +++ b/plugins/catalog-backend/src/modules/core/index.ts @@ -21,12 +21,6 @@ export { FileReaderProcessor } from './FileReaderProcessor'; export { LocationEntityProcessor } from './LocationEntityProcessor'; export type { LocationEntityProcessorOptions } from './LocationEntityProcessor'; export { PlaceholderProcessor } from './PlaceholderProcessor'; -export type { - PlaceholderProcessorOptions, - PlaceholderResolver, - PlaceholderResolverParams, - PlaceholderResolverRead, - PlaceholderResolverResolveUrl, -} from './PlaceholderProcessor'; +export type { PlaceholderProcessorOptions } from './PlaceholderProcessor'; export { UrlReaderProcessor } from './UrlReaderProcessor'; export { parseEntityYaml } from '../util/parse'; diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index f8ed166118..f07b1ba061 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -39,6 +39,7 @@ import { CatalogProcessorParser, EntitiesSearchFilter, EntityProvider, + PlaceholderResolver, ScmLocationAnalyzer, } from '@backstage/plugin-catalog-node'; import { @@ -47,7 +48,6 @@ import { CodeOwnersProcessor, FileReaderProcessor, PlaceholderProcessor, - PlaceholderResolver, UrlReaderProcessor, } from '../modules'; import { ConfigLocationEntityProvider } from '../modules/core/ConfigLocationEntityProvider'; diff --git a/plugins/catalog-backend/src/service/CatalogPlugin.ts b/plugins/catalog-backend/src/service/CatalogPlugin.ts index 0800d41340..810243269e 100644 --- a/plugins/catalog-backend/src/service/CatalogPlugin.ts +++ b/plugins/catalog-backend/src/service/CatalogPlugin.ts @@ -29,10 +29,10 @@ import { import { CatalogProcessor, EntityProvider, + PlaceholderResolver, ScmLocationAnalyzer, } from '@backstage/plugin-catalog-node'; import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { PlaceholderResolver } from '../modules'; class CatalogProcessingExtensionPointImpl implements CatalogProcessingExtensionPoint