From dbd7365130d78bbf0832fd92a246fe3d80bb3844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 19 Aug 2022 09:52:22 +0200 Subject: [PATCH] rollbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- plugins/rollbar/api-report.md | 191 +++++++++++++++--- plugins/rollbar/src/api/RollbarApi.ts | 2 + plugins/rollbar/src/api/RollbarClient.ts | 1 + plugins/rollbar/src/api/index.ts | 1 + plugins/rollbar/src/api/types.ts | 12 ++ .../EntityPageRollbar/EntityPageRollbar.tsx | 1 + plugins/rollbar/src/components/Router.tsx | 6 +- plugins/rollbar/src/constants.ts | 1 + plugins/rollbar/src/plugin.ts | 2 + scripts/api-extractor.ts | 1 - 10 files changed, 187 insertions(+), 31 deletions(-) diff --git a/plugins/rollbar/api-report.md b/plugins/rollbar/api-report.md index 27f0e4641b..5ee8a50ce3 100644 --- a/plugins/rollbar/api-report.md +++ b/plugins/rollbar/api-report.md @@ -12,44 +12,28 @@ import { Entity } from '@backstage/catalog-model'; import { IdentityApi } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; -// Warning: (ae-missing-release-tag) "EntityPageRollbar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const EntityPageRollbar: () => JSX.Element; -// Warning: (ae-missing-release-tag) "EntityRollbarContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const EntityRollbarContent: (_props: {}) => JSX.Element; +export const EntityRollbarContent: () => 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 }; export { isPluginApplicableToEntity as isRollbarAvailable }; -// Warning: (ae-missing-release-tag) "ROLLBAR_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const ROLLBAR_ANNOTATION = 'rollbar.com/project-slug'; -// Warning: (ae-missing-release-tag) "RollbarApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface RollbarApi { - // Warning: (ae-forgotten-export) The symbol "RollbarProject" needs to be exported by the entry point index.d.ts - // // (undocumented) getAllProjects(): Promise; // (undocumented) getProject(projectName: string): Promise; - // Warning: (ae-forgotten-export) The symbol "RollbarItemsResponse" needs to be exported by the entry point index.d.ts - // // (undocumented) getProjectItems(project: string): Promise; - // Warning: (ae-forgotten-export) The symbol "RollbarTopActiveItem" needs to be exported by the entry point index.d.ts - // // (undocumented) getTopActiveItems( project: string, @@ -57,13 +41,9 @@ export interface RollbarApi { ): Promise; } -// Warning: (ae-missing-release-tag) "rollbarApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const rollbarApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "RollbarClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class RollbarClient implements RollbarApi { constructor(options: { @@ -84,8 +64,131 @@ export class RollbarClient implements RollbarApi { ): Promise; } -// Warning: (ae-missing-release-tag) "rollbarPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type RollbarEnvironment = 'production' | string; + +// @public (undocumented) +export enum RollbarFrameworkId { + // (undocumented) + 'browser-js' = 7, + // (undocumented) + 'node-js' = 4, + // (undocumented) + 'rollbar-system' = 8, + // (undocumented) + 'android' = 9, + // (undocumented) + 'celery' = 17, + // (undocumented) + 'django' = 2, + // (undocumented) + 'flask' = 16, + // (undocumented) + 'ios' = 10, + // (undocumented) + 'logentries' = 12, + // (undocumented) + 'mailgun' = 11, + // (undocumented) + 'php' = 6, + // (undocumented) + 'pylons' = 5, + // (undocumented) + 'pyramid' = 3, + // (undocumented) + 'python' = 13, + // (undocumented) + 'rails' = 1, + // (undocumented) + 'rq' = 18, + // (undocumented) + 'ruby' = 14, + // (undocumented) + 'sidekiq' = 15, + // (undocumented) + 'unknown' = 0, +} + +// @public (undocumented) +export type RollbarItem = { + publicItemId: number; + integrationsData: null; + levelLock: number; + controllingId: number; + lastActivatedTimestamp: number; + assignedUserId: number; + groupStatus: number; + hash: string; + id: number; + environment: RollbarEnvironment; + titleLock: number; + title: string; + lastOccurrenceId: number; + lastOccurrenceTimestamp: number; + platform: RollbarPlatformId; + firstOccurrenceTimestamp: number; + project_id: number; + resolvedInVersion: string; + status: 'enabled' | string; + uniqueOccurrences: number; + groupItemId: number; + framework: RollbarFrameworkId; + totalOccurrences: number; + level: RollbarLevel; + counter: number; + lastModifiedBy: number; + firstOccurrenceId: number; + activatingOccurrenceId: number; + lastResolvedTimestamp: number; +}; + +// @public (undocumented) +export type RollbarItemCount = { + timestamp: number; + count: number; +}; + +// @public (undocumented) +export type RollbarItemsResponse = { + items: RollbarItem[]; + page: number; + totalCount: number; +}; + +// @public (undocumented) +export enum RollbarLevel { + // (undocumented) + critical = 50, + // (undocumented) + debug = 10, + // (undocumented) + error = 40, + // (undocumented) + info = 20, + // (undocumented) + warning = 30, +} + +// @public (undocumented) +export enum RollbarPlatformId { + // (undocumented) + 'google-app-engine' = 6, + // (undocumented) + 'android' = 3, + // (undocumented) + 'browser' = 1, + // (undocumented) + 'client' = 7, + // (undocumented) + 'flash' = 2, + // (undocumented) + 'heroku' = 5, + // (undocumented) + 'ios' = 4, + // (undocumented) + 'unknown' = 0, +} + // @public (undocumented) const rollbarPlugin: BackstagePlugin< { @@ -97,9 +200,43 @@ const rollbarPlugin: BackstagePlugin< export { rollbarPlugin as plugin }; export { rollbarPlugin }; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const Router: (_props: Props) => JSX.Element; +export type RollbarProject = { + id: number; + name: string; + accountId: number; + status: 'enabled' | string; +}; + +// @public (undocumented) +export type RollbarProjectAccessToken = { + projectId: number; + name: string; + scopes: RollbarProjectAccessTokenScope[]; + accessToken: string; + status: 'enabled' | string; +}; + +// @public (undocumented) +export type RollbarProjectAccessTokenScope = 'read' | 'write'; + +// @public (undocumented) +export type RollbarTopActiveItem = { + item: { + id: number; + counter: number; + environment: RollbarEnvironment; + framework: RollbarFrameworkId; + lastOccurrenceTimestamp: number; + level: number; + occurrences: number; + projectId: number; + title: string; + uniqueOccurrences: number; + }; + counts: number[]; +}; + +// @public (undocumented) +export const Router: () => JSX.Element; ``` diff --git a/plugins/rollbar/src/api/RollbarApi.ts b/plugins/rollbar/src/api/RollbarApi.ts index 3da52338ec..d5d6fe6aca 100644 --- a/plugins/rollbar/src/api/RollbarApi.ts +++ b/plugins/rollbar/src/api/RollbarApi.ts @@ -21,10 +21,12 @@ import { } from './types'; import { createApiRef } from '@backstage/core-plugin-api'; +/** @public */ export const rollbarApiRef = createApiRef({ id: 'plugin.rollbar.service', }); +/** @public */ export interface RollbarApi { getAllProjects(): Promise; getProject(projectName: string): Promise; diff --git a/plugins/rollbar/src/api/RollbarClient.ts b/plugins/rollbar/src/api/RollbarClient.ts index b87a6c8cc8..71c9f74ff0 100644 --- a/plugins/rollbar/src/api/RollbarClient.ts +++ b/plugins/rollbar/src/api/RollbarClient.ts @@ -22,6 +22,7 @@ import { } from './types'; import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; +/** @public */ export class RollbarClient implements RollbarApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi; diff --git a/plugins/rollbar/src/api/index.ts b/plugins/rollbar/src/api/index.ts index 56c23f07dd..882024f90f 100644 --- a/plugins/rollbar/src/api/index.ts +++ b/plugins/rollbar/src/api/index.ts @@ -16,3 +16,4 @@ export * from './RollbarApi'; export * from './RollbarClient'; +export * from './types'; diff --git a/plugins/rollbar/src/api/types.ts b/plugins/rollbar/src/api/types.ts index 549bdbbbb7..0a8f718a26 100644 --- a/plugins/rollbar/src/api/types.ts +++ b/plugins/rollbar/src/api/types.ts @@ -16,9 +16,13 @@ // TODO: Make this shared/dry with backend +/** @public */ export type RollbarProjectAccessTokenScope = 'read' | 'write'; + +/** @public */ export type RollbarEnvironment = 'production' | string; +/** @public */ export enum RollbarLevel { debug = 10, info = 20, @@ -27,6 +31,7 @@ export enum RollbarLevel { critical = 50, } +/** @public */ export enum RollbarFrameworkId { 'unknown' = 0, 'rails' = 1, @@ -49,6 +54,7 @@ export enum RollbarFrameworkId { 'rq' = 18, } +/** @public */ export enum RollbarPlatformId { 'unknown' = 0, 'browser' = 1, @@ -60,6 +66,7 @@ export enum RollbarPlatformId { 'client' = 7, } +/** @public */ export type RollbarProject = { id: number; name: string; @@ -67,6 +74,7 @@ export type RollbarProject = { status: 'enabled' | string; }; +/** @public */ export type RollbarProjectAccessToken = { projectId: number; name: string; @@ -75,6 +83,7 @@ export type RollbarProjectAccessToken = { status: 'enabled' | string; }; +/** @public */ export type RollbarItem = { publicItemId: number; integrationsData: null; @@ -107,17 +116,20 @@ export type RollbarItem = { lastResolvedTimestamp: number; }; +/** @public */ export type RollbarItemsResponse = { items: RollbarItem[]; page: number; totalCount: number; }; +/** @public */ export type RollbarItemCount = { timestamp: number; count: number; }; +/** @public */ export type RollbarTopActiveItem = { item: { id: number; diff --git a/plugins/rollbar/src/components/EntityPageRollbar/EntityPageRollbar.tsx b/plugins/rollbar/src/components/EntityPageRollbar/EntityPageRollbar.tsx index 626b3442e5..cde396674e 100644 --- a/plugins/rollbar/src/components/EntityPageRollbar/EntityPageRollbar.tsx +++ b/plugins/rollbar/src/components/EntityPageRollbar/EntityPageRollbar.tsx @@ -18,6 +18,7 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import React from 'react'; import { RollbarProject } from '../RollbarProject/RollbarProject'; +/** @public */ export const EntityPageRollbar = () => { const { entity } = useEntity(); diff --git a/plugins/rollbar/src/components/Router.tsx b/plugins/rollbar/src/components/Router.tsx index a11acb379c..9cd63e74aa 100644 --- a/plugins/rollbar/src/components/Router.tsx +++ b/plugins/rollbar/src/components/Router.tsx @@ -22,12 +22,12 @@ import { ROLLBAR_ANNOTATION } from '../constants'; import { EntityPageRollbar } from './EntityPageRollbar/EntityPageRollbar'; import { MissingAnnotationEmptyState } from '@backstage/core-components'; +/** @public */ export const isPluginApplicableToEntity = (entity: Entity) => Boolean(entity.metadata.annotations?.[ROLLBAR_ANNOTATION]); -type Props = {}; - -export const Router = (_props: Props) => { +/** @public */ +export const Router = () => { const { entity } = useEntity(); if (!isPluginApplicableToEntity(entity)) { diff --git a/plugins/rollbar/src/constants.ts b/plugins/rollbar/src/constants.ts index 8697c3239f..42031ddcef 100644 --- a/plugins/rollbar/src/constants.ts +++ b/plugins/rollbar/src/constants.ts @@ -14,4 +14,5 @@ * limitations under the License. */ +/** @public */ export const ROLLBAR_ANNOTATION = 'rollbar.com/project-slug'; diff --git a/plugins/rollbar/src/plugin.ts b/plugins/rollbar/src/plugin.ts index 3ca456058f..de3dd38b1a 100644 --- a/plugins/rollbar/src/plugin.ts +++ b/plugins/rollbar/src/plugin.ts @@ -29,6 +29,7 @@ export const rootRouteRef = createRouteRef({ id: 'rollbar', }); +/** @public */ export const rollbarPlugin = createPlugin({ id: 'rollbar', apis: [ @@ -44,6 +45,7 @@ export const rollbarPlugin = createPlugin({ }, }); +/** @public */ export const EntityRollbarContent = rollbarPlugin.provide( createRoutableExtension({ name: 'EntityRollbarContent', diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index ca710e1885..0683c1efbd 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -233,7 +233,6 @@ const ALLOW_WARNINGS = [ 'plugins/newrelic', 'plugins/newrelic-dashboard', 'plugins/pagerduty', - 'plugins/rollbar', 'plugins/rollbar-backend', 'plugins/search-backend-module-pg', 'plugins/sentry',