From fb8c2971ae83e3b5e391520858bc98f3be1e222f Mon Sep 17 00:00:00 2001 From: sblausten Date: Thu, 30 Mar 2023 15:35:53 +0200 Subject: [PATCH] Change constant export Signed-off-by: sblausten --- plugins/catalog-backend/api-report.md | 6 +++--- plugins/catalog-backend/src/constants.ts | 18 ++++++++++++++++++ .../src/database/DefaultProcessingDatabase.ts | 4 ++-- plugins/catalog-backend/src/index.ts | 1 + .../src/service/CatalogBuilder.ts | 3 --- plugins/catalog-backend/src/service/index.ts | 2 +- 6 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 plugins/catalog-backend/src/constants.ts diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 1317481046..59d198a18a 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -113,6 +113,9 @@ export class BuiltinKindsEntityProcessor implements CatalogProcessor_2 { validateEntityKind(entity: Entity): Promise; } +// @public (undocumented) +export const CATALOG_CONFLICTS_TOPIC = 'catalog.conflict'; + // @public export class CatalogBuilder { addEntityPolicy( @@ -167,9 +170,6 @@ export class CatalogBuilder { export type CatalogCollatorEntityTransformer = CatalogCollatorEntityTransformer_2; -// @public (undocumented) -export const catalogConflictsTopic = 'catalog.conflict'; - // @public (undocumented) export type CatalogEnvironment = { logger: Logger; diff --git a/plugins/catalog-backend/src/constants.ts b/plugins/catalog-backend/src/constants.ts new file mode 100644 index 0000000000..2ba21da629 --- /dev/null +++ b/plugins/catalog-backend/src/constants.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +/** @public */ +export const CATALOG_CONFLICTS_TOPIC = 'catalog.conflict'; diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts index 4b701758ec..e634d18c4a 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts @@ -46,7 +46,7 @@ import { updateUnprocessedEntity } from './operations/refreshState/updateUnproce import { generateStableHash } from './util'; import { EventBroker } from '@backstage/plugin-events-node'; import { DateTime } from 'luxon'; -import { catalogConflictsTopic } from '../service'; +import { CATALOG_CONFLICTS_TOPIC } from '../constants'; // The number of items that are sent per batch to the database layer, when // doing .batchInsert calls to knex. This needs to be low enough to not cause @@ -362,7 +362,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); if (this.options.eventBroker) { await this.options.eventBroker?.publish({ - topic: catalogConflictsTopic, + topic: CATALOG_CONFLICTS_TOPIC, eventPayload: { entity, entityRef, diff --git a/plugins/catalog-backend/src/index.ts b/plugins/catalog-backend/src/index.ts index eca155ce46..345102adcd 100644 --- a/plugins/catalog-backend/src/index.ts +++ b/plugins/catalog-backend/src/index.ts @@ -27,6 +27,7 @@ export * from './processing'; export * from './search'; export * from './service'; export * from './deprecated'; +export * from './constants'; import { DefaultCatalogCollatorFactory as _DefaultCatalogCollatorFactory, diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 39a40c95de..c0d5c7acc7 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -118,9 +118,6 @@ export type CatalogEnvironment = { permissions: PermissionEvaluator | PermissionAuthorizer; }; -/** @public */ -export const catalogConflictsTopic = 'catalog.conflict'; - /** * A builder that helps wire up all of the component parts of the catalog. * diff --git a/plugins/catalog-backend/src/service/index.ts b/plugins/catalog-backend/src/service/index.ts index 70c65cf08f..44645d39fe 100644 --- a/plugins/catalog-backend/src/service/index.ts +++ b/plugins/catalog-backend/src/service/index.ts @@ -18,4 +18,4 @@ export type { CatalogEnvironment, CatalogPermissionRuleInput, } from './CatalogBuilder'; -export { CatalogBuilder, catalogConflictsTopic } from './CatalogBuilder'; +export { CatalogBuilder } from './CatalogBuilder';