diff --git a/plugins/pagerduty/api-report.md b/plugins/pagerduty/api-report.md index 8bd8df6f7c..5bfe84e63f 100644 --- a/plugins/pagerduty/api-report.md +++ b/plugins/pagerduty/api-report.md @@ -13,26 +13,30 @@ import { Entity } from '@backstage/catalog-model'; import { FetchApi } from '@backstage/core-plugin-api'; import { ReactNode } from 'react'; -// Warning: (ae-missing-release-tag) "EntityPagerDutyCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const EntityPagerDutyCard: () => JSX.Element; -// Warning: (ae-missing-release-tag) "isPluginApplicableToEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) const isPluginApplicableToEntity: (entity: Entity) => boolean; export { isPluginApplicableToEntity as isPagerDutyAvailable }; export { isPluginApplicableToEntity }; -// Warning: (ae-forgotten-export) The symbol "PagerDutyApi" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "pagerDutyApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export interface PagerDutyApi { + getChangeEventsByServiceId( + serviceId: string, + ): Promise; + getIncidentsByServiceId( + serviceId: string, + ): Promise; + getOnCallByPolicyId(policyId: string): Promise; + getServiceByEntity(entity: Entity): Promise; + triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise; +} + // @public (undocumented) export const pagerDutyApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "PagerDutyAssignee" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyAssignee = { id: string; @@ -40,13 +44,9 @@ export type PagerDutyAssignee = { html_url: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const PagerDutyCard: () => JSX.Element; -// Warning: (ae-missing-release-tag) "PagerDutyChangeEvent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyChangeEvent = { id: string; @@ -67,15 +67,11 @@ export type PagerDutyChangeEvent = { timestamp: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyChangeEventsResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyChangeEventsResponse = { change_events: PagerDutyChangeEvent[]; }; -// Warning: (ae-missing-release-tag) "PagerDutyClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class PagerDutyClient implements PagerDutyApi { constructor(config: PagerDutyClientApiConfig); @@ -100,23 +96,17 @@ export class PagerDutyClient implements PagerDutyApi { triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise; } -// Warning: (ae-missing-release-tag) "PagerDutyClientApiConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyClientApiConfig = PagerDutyClientApiDependencies & { eventsBaseUrl?: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyClientApiDependencies" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyClientApiDependencies = { discoveryApi: DiscoveryApi; fetchApi: FetchApi; }; -// Warning: (ae-missing-release-tag) "PagerDutyEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyEntity = { integrationKey?: string; @@ -124,8 +114,6 @@ export type PagerDutyEntity = { name: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyIncident" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyIncident = { id: string; @@ -141,37 +129,27 @@ export type PagerDutyIncident = { created_at: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyIncidentsResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyIncidentsResponse = { incidents: PagerDutyIncident[]; }; -// Warning: (ae-missing-release-tag) "PagerDutyOnCall" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyOnCall = { user: PagerDutyUser; escalation_level: number; }; -// Warning: (ae-missing-release-tag) "PagerDutyOnCallsResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyOnCallsResponse = { oncalls: PagerDutyOnCall[]; }; -// Warning: (ae-missing-release-tag) "pagerDutyPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) const pagerDutyPlugin: BackstagePlugin<{}, {}, {}>; export { pagerDutyPlugin }; export { pagerDutyPlugin as plugin }; -// Warning: (ae-missing-release-tag) "PagerDutyService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyService = { id: string; @@ -185,15 +163,11 @@ export type PagerDutyService = { }; }; -// Warning: (ae-missing-release-tag) "PagerDutyServiceResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyServiceResponse = { service: PagerDutyService; }; -// Warning: (ae-missing-release-tag) "PagerDutyTriggerAlarmRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyTriggerAlarmRequest = { integrationKey: string; @@ -202,8 +176,6 @@ export type PagerDutyTriggerAlarmRequest = { userName: string; }; -// Warning: (ae-missing-release-tag) "PagerDutyUser" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PagerDutyUser = { id: string; @@ -213,14 +185,9 @@ export type PagerDutyUser = { name: string; }; -// Warning: (ae-forgotten-export) The symbol "TriggerButtonProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "TriggerButton" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export function TriggerButton(props: TriggerButtonProps): JSX.Element; +export function TriggerButton(props: { children?: ReactNode }): JSX.Element; -// Warning: (ae-missing-release-tag) "UnauthorizedError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class UnauthorizedError extends Error {} ``` diff --git a/plugins/pagerduty/src/api/client.ts b/plugins/pagerduty/src/api/client.ts index edc87d4b4a..7266d5e9eb 100644 --- a/plugins/pagerduty/src/api/client.ts +++ b/plugins/pagerduty/src/api/client.ts @@ -31,8 +31,10 @@ import { NotFoundError } from '@backstage/errors'; import { Entity } from '@backstage/catalog-model'; import { getPagerDutyEntity } from '../components/pagerDutyEntity'; +/** @public */ export class UnauthorizedError extends Error {} +/** @public */ export const pagerDutyApiRef = createApiRef({ id: 'plugin.pagerduty.api', }); @@ -40,6 +42,7 @@ export const pagerDutyApiRef = createApiRef({ const commonGetServiceParams = 'time_zone=UTC&include[]=integrations&include[]=escalation_policies'; +/** @public */ export class PagerDutyClient implements PagerDutyApi { static fromConfig( configApi: ConfigApi, diff --git a/plugins/pagerduty/src/api/index.ts b/plugins/pagerduty/src/api/index.ts index 9a0c08973d..031920fa62 100644 --- a/plugins/pagerduty/src/api/index.ts +++ b/plugins/pagerduty/src/api/index.ts @@ -16,6 +16,7 @@ export { PagerDutyClient, pagerDutyApiRef, UnauthorizedError } from './client'; export type { + PagerDutyApi, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, diff --git a/plugins/pagerduty/src/api/types.ts b/plugins/pagerduty/src/api/types.ts index 786b0bdffd..f1971d53d5 100644 --- a/plugins/pagerduty/src/api/types.ts +++ b/plugins/pagerduty/src/api/types.ts @@ -27,22 +27,27 @@ export type PagerDutyServicesResponse = { services: PagerDutyService[]; }; +/** @public */ export type PagerDutyServiceResponse = { service: PagerDutyService; }; +/** @public */ export type PagerDutyIncidentsResponse = { incidents: PagerDutyIncident[]; }; +/** @public */ export type PagerDutyChangeEventsResponse = { change_events: PagerDutyChangeEvent[]; }; +/** @public */ export type PagerDutyOnCallsResponse = { oncalls: PagerDutyOnCall[]; }; +/** @public */ export type PagerDutyTriggerAlarmRequest = { integrationKey: string; source: string; @@ -50,6 +55,7 @@ export type PagerDutyTriggerAlarmRequest = { userName: string; }; +/** @public */ export interface PagerDutyApi { /** * Fetches the service for the provided Entity. @@ -85,11 +91,13 @@ export interface PagerDutyApi { triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise; } +/** @public */ export type PagerDutyClientApiDependencies = { discoveryApi: DiscoveryApi; fetchApi: FetchApi; }; +/** @public */ export type PagerDutyClientApiConfig = PagerDutyClientApiDependencies & { eventsBaseUrl?: string; }; diff --git a/plugins/pagerduty/src/components/PagerDutyCard/index.tsx b/plugins/pagerduty/src/components/PagerDutyCard/index.tsx index e8ba2c522c..15967fae01 100644 --- a/plugins/pagerduty/src/components/PagerDutyCard/index.tsx +++ b/plugins/pagerduty/src/components/PagerDutyCard/index.tsx @@ -46,12 +46,14 @@ const BasicCard = ({ children }: { children: ReactNode }) => ( {children} ); +/** @public */ export const isPluginApplicableToEntity = (entity: Entity) => Boolean( entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] || entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID], ); +/** @public */ export const PagerDutyCard = () => { const { entity } = useEntity(); const pagerDutyEntity = getPagerDutyEntity(entity); diff --git a/plugins/pagerduty/src/components/TriggerButton/index.tsx b/plugins/pagerduty/src/components/TriggerButton/index.tsx index 6f83effcf4..732298c6d8 100644 --- a/plugins/pagerduty/src/components/TriggerButton/index.tsx +++ b/plugins/pagerduty/src/components/TriggerButton/index.tsx @@ -20,10 +20,6 @@ import { BackstageTheme } from '@backstage/theme'; import { usePagerdutyEntity } from '../../hooks'; import { TriggerDialog } from '../TriggerDialog'; -export type TriggerButtonProps = { - children?: ReactNode; -}; - const useStyles = makeStyles(theme => ({ buttonStyle: { backgroundColor: theme.palette.error.main, @@ -34,7 +30,8 @@ const useStyles = makeStyles(theme => ({ }, })); -export function TriggerButton(props: TriggerButtonProps) { +/** @public */ +export function TriggerButton(props: { children?: ReactNode }) { const { buttonStyle } = useStyles(); const { integrationKey } = usePagerdutyEntity(); const [dialogShown, setDialogShown] = useState(false); diff --git a/plugins/pagerduty/src/components/types.ts b/plugins/pagerduty/src/components/types.ts index 89cdffea16..156b5c9b9d 100644 --- a/plugins/pagerduty/src/components/types.ts +++ b/plugins/pagerduty/src/components/types.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +/** @public */ export type PagerDutyChangeEvent = { id: string; integration: [ @@ -33,6 +34,7 @@ export type PagerDutyChangeEvent = { timestamp: string; }; +/** @public */ export type PagerDutyIncident = { id: string; title: string; @@ -47,6 +49,7 @@ export type PagerDutyIncident = { created_at: string; }; +/** @public */ export type PagerDutyService = { id: string; name: string; @@ -59,17 +62,20 @@ export type PagerDutyService = { }; }; +/** @public */ export type PagerDutyOnCall = { user: PagerDutyUser; escalation_level: number; }; +/** @public */ export type PagerDutyAssignee = { id: string; summary: string; html_url: string; }; +/** @public */ export type PagerDutyUser = { id: string; summary: string; @@ -78,6 +84,7 @@ export type PagerDutyUser = { name: string; }; +/** @public */ export type SubHeaderLink = { title: string; href?: string; diff --git a/plugins/pagerduty/src/plugin.ts b/plugins/pagerduty/src/plugin.ts index d49de29416..73e7e0b397 100644 --- a/plugins/pagerduty/src/plugin.ts +++ b/plugins/pagerduty/src/plugin.ts @@ -28,6 +28,7 @@ export const rootRouteRef = createRouteRef({ id: 'pagerduty', }); +/** @public */ export const pagerDutyPlugin = createPlugin({ id: 'pagerduty', apis: [ @@ -44,6 +45,7 @@ export const pagerDutyPlugin = createPlugin({ ], }); +/** @public */ export const EntityPagerDutyCard = pagerDutyPlugin.provide( createComponentExtension({ name: 'EntityPagerDutyCard', diff --git a/plugins/pagerduty/src/types.ts b/plugins/pagerduty/src/types.ts index 07f7f2bbe3..9f38b429ef 100644 --- a/plugins/pagerduty/src/types.ts +++ b/plugins/pagerduty/src/types.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +/** @public */ export type PagerDutyEntity = { integrationKey?: string; serviceId?: string; diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index fd1254b07d..fbd5b71196 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -229,7 +229,6 @@ const ALLOW_WARNINGS = [ 'plugins/kubernetes-common', 'plugins/newrelic', 'plugins/newrelic-dashboard', - 'plugins/pagerduty', ]; async function resolvePackagePath(