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/api-report.md b/plugins/tech-insights/api-report.md index 3e099493b6..54884f12ea 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,33 @@ export interface TechInsightsApi { // @public export const techInsightsApiRef: ApiRef; +// @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< { diff --git a/plugins/tech-insights/src/api/TechInsightsClient.ts b/plugins/tech-insights/src/api/TechInsightsClient.ts index 04de46dba9..aabb5a6297 100644 --- a/plugins/tech-insights/src/api/TechInsightsClient.ts +++ b/plugins/tech-insights/src/api/TechInsightsClient.ts @@ -29,16 +29,15 @@ import { defaultCheckResultRenderers, } from '../components/CheckResultRenderer'; -export type Options = { - discoveryApi: DiscoveryApi; - identityApi: IdentityApi; -}; - +/** @public */ 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; } 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';