From faa728689776013a152ad2d2b240664132c6b2d4 Mon Sep 17 00:00:00 2001 From: Hasan Oezdemir <21654050+nodify-at@users.noreply.github.com> Date: Wed, 6 Jul 2022 17:27:04 +0200 Subject: [PATCH] feature: remove public annotation from EntityProcessingResult to mark it as an internal type and improve the change set to describe the subscription method Signed-off-by: Hasan Oezdemir <21654050+nodify-at@users.noreply.github.com> --- .changeset/shaggy-spiders-notice.md | 12 ++++++++++-- plugins/catalog-backend/api-report.md | 16 ---------------- plugins/catalog-backend/src/processing/index.ts | 6 +----- plugins/catalog-backend/src/processing/types.ts | 2 +- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/.changeset/shaggy-spiders-notice.md b/.changeset/shaggy-spiders-notice.md index 6b50c964e3..513f6cd521 100644 --- a/.changeset/shaggy-spiders-notice.md +++ b/.changeset/shaggy-spiders-notice.md @@ -2,5 +2,13 @@ '@backstage/plugin-catalog-backend': patch --- -Provide a new listener `CatalogProcessingErrorListener` for the processing engines to notify the caller if an entity can not be processed. Processing engine -will collect the errors and passes the entity and the results to the given listeners. +CatalogBuilder supports now subscription to processing engine errors. + +```ts +subscribe(options: { + onProcessingError: (event: { unprocessedEntity: Entity, error: Error }) => Promise | void; +}); +``` + +If you want to get notified on errors while processing the entities, you call CatalogBuilder.subscribe +to get notifications with the parameters defined as above. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index 8af2643dc0..5a2020f3e0 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -15,7 +15,6 @@ import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; import { Entity } from '@backstage/catalog-model'; import { EntityPolicy } from '@backstage/catalog-model'; import { GetEntitiesRequest } from '@backstage/catalog-client'; -import { JsonObject } from '@backstage/types'; import { JsonValue } from '@backstage/types'; import { LocationEntityV1alpha1 } from '@backstage/catalog-model'; import { Logger } from 'winston'; @@ -420,21 +419,6 @@ export type EntityFilter = } | EntitiesSearchFilter; -// @public -export type EntityProcessingResult = - | { - ok: true; - state: JsonObject; - completedEntity: Entity; - deferredEntities: DeferredEntity[]; - relations: EntityRelationSpec[]; - errors: Error[]; - } - | { - ok: false; - errors: Error[]; - }; - // @public export interface EntityProvider { connect(connection: EntityProviderConnection): Promise; diff --git a/plugins/catalog-backend/src/processing/index.ts b/plugins/catalog-backend/src/processing/index.ts index d96e7b5b9b..b392c3aa76 100644 --- a/plugins/catalog-backend/src/processing/index.ts +++ b/plugins/catalog-backend/src/processing/index.ts @@ -14,11 +14,7 @@ * limitations under the License. */ -export type { - CatalogProcessingEngine, - EntityProcessingResult, - DeferredEntity, -} from './types'; +export type { CatalogProcessingEngine, DeferredEntity } from './types'; export { createRandomProcessingInterval } from './refresh'; export type { ProcessingIntervalFunction } from './refresh'; diff --git a/plugins/catalog-backend/src/processing/types.ts b/plugins/catalog-backend/src/processing/types.ts index b178522c14..a314c52c6c 100644 --- a/plugins/catalog-backend/src/processing/types.ts +++ b/plugins/catalog-backend/src/processing/types.ts @@ -29,7 +29,7 @@ export type EntityProcessingRequest = { /** * The result of processing an entity. - * @public + * @internal */ export type EntityProcessingResult = | {