UNPKG

@backstage/plugin-catalog-backend

Version:

The Backstage backend plugin that provides the Backstage catalog

116 lines (104 loc) 4.49 kB
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api'; import { LoggerService, UrlReaderService } from '@backstage/backend-plugin-api'; import { Entity, EntityPolicy } from '@backstage/catalog-model'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { LocationSpec } from '@backstage/plugin-catalog-common'; import { CatalogProcessor, CatalogProcessorEmit, CatalogProcessorParser, PlaceholderResolver, CatalogProcessorCache } from '@backstage/plugin-catalog-node'; import { Config } from '@backstage/config'; /** * Catalog plugin * @public */ declare const catalogPlugin: _backstage_backend_plugin_api.BackendFeature; /** @public */ declare class AnnotateLocationEntityProcessor implements CatalogProcessor { private readonly options; constructor(options: { integrations: ScmIntegrationRegistry; }); getProcessorName(): string; preProcessEntity(entity: Entity, location: LocationSpec, _: CatalogProcessorEmit, originLocation: LocationSpec): Promise<Entity>; } /** @public */ declare class AnnotateScmSlugEntityProcessor implements CatalogProcessor { private readonly opts; constructor(opts: { scmIntegrationRegistry: ScmIntegrationRegistry; kinds?: string[]; }); getProcessorName(): string; static fromConfig(config: Config, options?: { kinds?: string[]; }): AnnotateScmSlugEntityProcessor; preProcessEntity(entity: Entity, location: LocationSpec): Promise<Entity>; } /** @public */ declare class BuiltinKindsEntityProcessor implements CatalogProcessor { private readonly validators; getProcessorName(): string; validateEntityKind(entity: Entity): Promise<boolean>; postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>; } /** @public */ declare class CodeOwnersProcessor implements CatalogProcessor { private readonly integrations; private readonly logger; private readonly reader; static fromConfig(config: Config, options: { logger: LoggerService; reader: UrlReaderService; }): CodeOwnersProcessor; constructor(options: { integrations: ScmIntegrationRegistry; logger: LoggerService; reader: UrlReaderService; }); getProcessorName(): string; preProcessEntity(entity: Entity, location: LocationSpec): Promise<Entity>; } /** @public */ declare class FileReaderProcessor implements CatalogProcessor { getProcessorName(): string; readLocation(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser): Promise<boolean>; } /** @public */ type PlaceholderProcessorOptions = { resolvers: Record<string, PlaceholderResolver>; reader: UrlReaderService; integrations: ScmIntegrationRegistry; }; /** * Traverses raw entity JSON looking for occurrences of $-prefixed placeholders * that it then fills in with actual data. * @public */ declare class PlaceholderProcessor implements CatalogProcessor { private readonly options; constructor(options: PlaceholderProcessorOptions); getProcessorName(): string; preProcessEntity(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>; } /** @public */ declare class UrlReaderProcessor implements CatalogProcessor { #private; private readonly options; constructor(options: { reader: UrlReaderService; logger: LoggerService; }); getProcessorName(): string; readLocation(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>; private doRead; } /** * Transform a given entity policy to an entity processor. * @param policy - The policy to transform * @returns A new entity processor that uses the entity policy. * @public */ declare function transformLegacyPolicyToProcessor(policy: EntityPolicy): CatalogProcessor; /** @public */ declare const CATALOG_CONFLICTS_TOPIC = "experimental.catalog.conflict"; /** @public */ declare const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors"; export { AnnotateLocationEntityProcessor, AnnotateScmSlugEntityProcessor, BuiltinKindsEntityProcessor, CATALOG_CONFLICTS_TOPIC, CATALOG_ERRORS_TOPIC, CodeOwnersProcessor, FileReaderProcessor, PlaceholderProcessor, type PlaceholderProcessorOptions, UrlReaderProcessor, catalogPlugin as default, transformLegacyPolicyToProcessor };