From 09d2f4d1794738c663fda9bca9daf017ab317bb9 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 24 May 2022 14:43:07 +0200 Subject: [PATCH 1/4] export TechInsightsClient Signed-off-by: Leon --- .changeset/heavy-carrots-cheer.md | 5 +++++ plugins/tech-insights/src/api/index.ts | 1 + plugins/tech-insights/src/index.ts | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/heavy-carrots-cheer.md diff --git a/.changeset/heavy-carrots-cheer.md b/.changeset/heavy-carrots-cheer.md new file mode 100644 index 0000000000..484e04d8bd --- /dev/null +++ b/.changeset/heavy-carrots-cheer.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-insights': patch +--- + +Export TechInsightsClient so it may be extended by custom implementations diff --git a/plugins/tech-insights/src/api/index.ts b/plugins/tech-insights/src/api/index.ts index bcd2575a52..9f5545e671 100644 --- a/plugins/tech-insights/src/api/index.ts +++ b/plugins/tech-insights/src/api/index.ts @@ -15,3 +15,4 @@ */ export * from './TechInsightsApi'; export * from './TechInsightsClient'; +export * from './types'; diff --git a/plugins/tech-insights/src/index.ts b/plugins/tech-insights/src/index.ts index bc7c2ce26c..97bdc95631 100644 --- a/plugins/tech-insights/src/index.ts +++ b/plugins/tech-insights/src/index.ts @@ -19,7 +19,6 @@ export { EntityTechInsightsScorecardCard, } from './plugin'; -export { techInsightsApiRef } from './api/TechInsightsApi'; -export type { TechInsightsApi } from './api/TechInsightsApi'; -export type { Check } from './api/types'; +export { techInsightsApiRef, TechInsightsClient } from './api'; +export type { TechInsightsApi, Check } from './api'; export type { CheckResultRenderer } from './components/CheckResultRenderer'; From 65e760664e78ee448f168da214d58af7efabc917 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 24 May 2022 14:49:59 +0200 Subject: [PATCH 2/4] removed explicit type because it became a warning in api-report.md Signed-off-by: Leon --- plugins/tech-insights/src/api/TechInsightsClient.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/tech-insights/src/api/TechInsightsClient.ts b/plugins/tech-insights/src/api/TechInsightsClient.ts index 04de46dba9..899e000695 100644 --- a/plugins/tech-insights/src/api/TechInsightsClient.ts +++ b/plugins/tech-insights/src/api/TechInsightsClient.ts @@ -29,16 +29,14 @@ import { defaultCheckResultRenderers, } from '../components/CheckResultRenderer'; -export type Options = { - discoveryApi: DiscoveryApi; - identityApi: IdentityApi; -}; - export class TechInsightsClient implements TechInsightsApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi; - constructor(options: Options) { + constructor(options: { + discoveryApi: DiscoveryApi; + identityApi: IdentityApi; + }) { this.discoveryApi = options.discoveryApi; this.identityApi = options.identityApi; } From 23bf9593d75c4fefe3df07c8be848ea015f9062c Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 24 May 2022 14:50:15 +0200 Subject: [PATCH 3/4] generate api-report Signed-off-by: Leon --- plugins/tech-insights/api-report.md | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/plugins/tech-insights/api-report.md b/plugins/tech-insights/api-report.md index 3e099493b6..41e37ca4ff 100644 --- a/plugins/tech-insights/api-report.md +++ b/plugins/tech-insights/api-report.md @@ -10,6 +10,8 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { BulkCheckResponse } from '@backstage/plugin-tech-insights-common'; import { CheckResult } from '@backstage/plugin-tech-insights-common'; import { CompoundEntityRef } from '@backstage/catalog-model'; +import { DiscoveryApi } from '@backstage/core-plugin-api'; +import { IdentityApi } from '@backstage/core-plugin-api'; import { default as React_2 } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; @@ -78,6 +80,35 @@ export interface TechInsightsApi { // @public export const techInsightsApiRef: ApiRef; +// Warning: (ae-missing-release-tag) "TechInsightsClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class TechInsightsClient implements TechInsightsApi { + constructor(options: { + discoveryApi: DiscoveryApi; + identityApi: IdentityApi; + }); + // (undocumented) + getAllChecks(): Promise; + // (undocumented) + getScorecardsDefinition( + type: string, + value: CheckResult[], + title?: string, + description?: string, + ): CheckResultRenderer | undefined; + // (undocumented) + runBulkChecks( + entities: CompoundEntityRef[], + checks?: Check[], + ): Promise; + // (undocumented) + runChecks( + entityParams: CompoundEntityRef, + checks?: string[], + ): Promise; +} + // @public (undocumented) export const techInsightsPlugin: BackstagePlugin< { From fd16617e28d9d090b96d5e0fcf0b015935a6aa3c Mon Sep 17 00:00:00 2001 From: Leon Date: Mon, 30 May 2022 19:58:40 +0200 Subject: [PATCH 4/4] fix api-report warning --- plugins/tech-insights/api-report.md | 2 -- plugins/tech-insights/src/api/TechInsightsClient.ts | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/tech-insights/api-report.md b/plugins/tech-insights/api-report.md index 41e37ca4ff..54884f12ea 100644 --- a/plugins/tech-insights/api-report.md +++ b/plugins/tech-insights/api-report.md @@ -80,8 +80,6 @@ export interface TechInsightsApi { // @public export const techInsightsApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "TechInsightsClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class TechInsightsClient implements TechInsightsApi { constructor(options: { diff --git a/plugins/tech-insights/src/api/TechInsightsClient.ts b/plugins/tech-insights/src/api/TechInsightsClient.ts index 899e000695..aabb5a6297 100644 --- a/plugins/tech-insights/src/api/TechInsightsClient.ts +++ b/plugins/tech-insights/src/api/TechInsightsClient.ts @@ -29,6 +29,7 @@ import { defaultCheckResultRenderers, } from '../components/CheckResultRenderer'; +/** @public */ export class TechInsightsClient implements TechInsightsApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi;