diff --git a/.changeset/clever-garlics-rescue.md b/.changeset/clever-garlics-rescue.md index b8ce8f74e8..feaf1c2ef4 100644 --- a/.changeset/clever-garlics-rescue.md +++ b/.changeset/clever-garlics-rescue.md @@ -34,4 +34,4 @@ **BREAKING**: Removed `AzureDevOpsDiscoveryProcessor`, which now instead should be imported from `@backstage/plugin-catalog-backend-module-azure`. This processor was not part of the set of default processors. If you were using it, you should already have a reference to it in your backend code and only need to update the import. -**BREAKING**: Removed the formerly deprecated type `BitbucketRepositoryParser`, which is no longer necessary since its only use was in `BitbucketDiscoveryProcessor` but is now instead inlined there. +**BREAKING**: Removed the formerly deprecated type `BitbucketRepositoryParser`, which is instead reintroduced in `@backstage/plugin-catalog-backend-module-bitbucket`. diff --git a/plugins/catalog-backend-module-bitbucket/api-report.md b/plugins/catalog-backend-module-bitbucket/api-report.md index e8d7791a74..34acd6e76d 100644 --- a/plugins/catalog-backend-module-bitbucket/api-report.md +++ b/plugins/catalog-backend-module-bitbucket/api-report.md @@ -16,24 +16,14 @@ import { ScmIntegrationRegistry } from '@backstage/integration'; export class BitbucketDiscoveryProcessor implements CatalogProcessor { constructor(options: { integrations: ScmIntegrationRegistry; - parser?: (options: { - integration: BitbucketIntegration; - target: string; - presence?: 'optional' | 'required'; - logger: Logger; - }) => AsyncIterable; + parser?: BitbucketRepositoryParser; logger: Logger; }); // (undocumented) static fromConfig( config: Config, options: { - parser?: (options: { - integration: BitbucketIntegration; - target: string; - presence?: 'optional' | 'required'; - logger: Logger; - }) => AsyncIterable; + parser?: BitbucketRepositoryParser; logger: Logger; }, ): BitbucketDiscoveryProcessor; @@ -46,4 +36,12 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { emit: CatalogProcessorEmit, ): Promise; } + +// @public +export type BitbucketRepositoryParser = (options: { + integration: BitbucketIntegration; + target: string; + presence?: 'optional' | 'required'; + logger: Logger; +}) => AsyncIterable; ``` diff --git a/plugins/catalog-backend-module-bitbucket/package.json b/plugins/catalog-backend-module-bitbucket/package.json index 8a016196af..56a7cd2894 100644 --- a/plugins/catalog-backend-module-bitbucket/package.json +++ b/plugins/catalog-backend-module-bitbucket/package.json @@ -33,12 +33,12 @@ "start": "backstage-cli package start" }, "dependencies": { - "@backstage/backend-common": "^0.12.0", - "@backstage/catalog-model": "^0.12.0", + "@backstage/backend-common": "^0.13.0-next.0", + "@backstage/catalog-model": "^0.13.0-next.0", "@backstage/config": "^0.1.15", "@backstage/errors": "^0.2.2", "@backstage/integration": "^0.8.0", - "@backstage/plugin-catalog-backend": "^0.23.0", + "@backstage/plugin-catalog-backend": "^0.24.0-next.0", "@backstage/types": "^0.1.3", "lodash": "^4.17.21", "msw": "^0.35.0", @@ -46,8 +46,8 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/backend-test-utils": "^0.1.20", - "@backstage/cli": "^0.15.0", + "@backstage/backend-test-utils": "^0.1.21-next.0", + "@backstage/cli": "^0.15.2-next.0", "@types/lodash": "^4.14.151" }, "files": [ diff --git a/plugins/catalog-backend-module-bitbucket/src/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend-module-bitbucket/src/BitbucketDiscoveryProcessor.ts index 7c347073ca..5553de7f02 100644 --- a/plugins/catalog-backend-module-bitbucket/src/BitbucketDiscoveryProcessor.ts +++ b/plugins/catalog-backend-module-bitbucket/src/BitbucketDiscoveryProcessor.ts @@ -23,7 +23,6 @@ import { import { CatalogProcessor, CatalogProcessorEmit, - CatalogProcessorResult, LocationSpec, } from '@backstage/plugin-catalog-backend'; import { Logger } from 'winston'; @@ -31,6 +30,7 @@ import { BitbucketClient, BitbucketRepository, BitbucketRepository20, + BitbucketRepositoryParser, defaultRepositoryParser, paginated, paginated20, @@ -42,23 +42,13 @@ const DEFAULT_CATALOG_LOCATION = '/catalog-info.yaml'; /** @public */ export class BitbucketDiscoveryProcessor implements CatalogProcessor { private readonly integrations: ScmIntegrationRegistry; - private readonly parser: (options: { - integration: BitbucketIntegration; - target: string; - presence?: 'optional' | 'required'; - logger: Logger; - }) => AsyncIterable; + private readonly parser: BitbucketRepositoryParser; private readonly logger: Logger; static fromConfig( config: Config, options: { - parser?: (options: { - integration: BitbucketIntegration; - target: string; - presence?: 'optional' | 'required'; - logger: Logger; - }) => AsyncIterable; + parser?: BitbucketRepositoryParser; logger: Logger; }, ) { @@ -72,12 +62,7 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { constructor(options: { integrations: ScmIntegrationRegistry; - parser?: (options: { - integration: BitbucketIntegration; - target: string; - presence?: 'optional' | 'required'; - logger: Logger; - }) => AsyncIterable; + parser?: BitbucketRepositoryParser; logger: Logger; }) { this.integrations = options.integrations; @@ -122,7 +107,7 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { const { scanned, matches } = isBitbucketCloud ? await this.processCloudRepositories(processOptions) - : await this.processOrganisationRepositories(processOptions); + : await this.processOrganizationRepositories(processOptions); const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1); this.logger.debug( @@ -159,7 +144,7 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { }; } - private async processOrganisationRepositories( + private async processOrganizationRepositories( options: ProcessOptions, ): Promise { const { client, location, integration, emit } = options; diff --git a/plugins/catalog-backend-module-bitbucket/src/index.ts b/plugins/catalog-backend-module-bitbucket/src/index.ts index 3375fc5a9a..5bbda25dea 100644 --- a/plugins/catalog-backend-module-bitbucket/src/index.ts +++ b/plugins/catalog-backend-module-bitbucket/src/index.ts @@ -15,9 +15,10 @@ */ /** - * A Backstage catalog backend module that helps integrate towards GitLab + * A Backstage catalog backend module that helps integrate towards Bitbucket * * @packageDocumentation */ export { BitbucketDiscoveryProcessor } from './BitbucketDiscoveryProcessor'; +export type { BitbucketRepositoryParser } from './lib/BitbucketRepositoryParser'; diff --git a/plugins/catalog-backend-module-bitbucket/src/lib/BitbucketRepositoryParser.ts b/plugins/catalog-backend-module-bitbucket/src/lib/BitbucketRepositoryParser.ts index 974f2498df..57a162e1e4 100644 --- a/plugins/catalog-backend-module-bitbucket/src/lib/BitbucketRepositoryParser.ts +++ b/plugins/catalog-backend-module-bitbucket/src/lib/BitbucketRepositoryParser.ts @@ -21,6 +21,12 @@ import { } from '@backstage/plugin-catalog-backend'; import { Logger } from 'winston'; +/** + * A custom callback that reacts to finding a repository by yielding processing + * results. + * + * @public + */ export type BitbucketRepositoryParser = (options: { integration: BitbucketIntegration; target: string;