Merge pull request #13252 from backstage/freben/api-well-ok-then

When the 🧹 s go marching in
This commit is contained in:
Fredrik Adelöw
2022-08-23 13:55:58 +02:00
committed by GitHub
273 changed files with 2469 additions and 1529 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': minor
---
Removed the previously deprecated class `AtlassianAuthProvider`. Please use `providers.atlassian.create(...)` instead.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': minor
---
Renamed the `RedirectInfo` type to `OAuthStartResponse`
+44
View File
@@ -0,0 +1,44 @@
---
'@backstage/plugin-allure': patch
'@backstage/plugin-apache-airflow': patch
'@backstage/plugin-app-backend': patch
'@backstage/plugin-auth-backend': patch
'@backstage/plugin-bitrise': patch
'@backstage/plugin-catalog': patch
'@backstage/plugin-catalog-graphql': patch
'@backstage/plugin-cicd-statistics': patch
'@backstage/plugin-circleci': patch
'@backstage/plugin-cloudbuild': patch
'@backstage/plugin-code-climate': patch
'@backstage/plugin-config-schema': patch
'@backstage/plugin-cost-insights': patch
'@backstage/plugin-dynatrace': patch
'@backstage/plugin-explore': patch
'@backstage/plugin-explore-react': patch
'@backstage/plugin-firehydrant': patch
'@backstage/plugin-gcalendar': patch
'@backstage/plugin-gcp-projects': patch
'@backstage/plugin-github-actions': patch
'@backstage/plugin-github-deployments': patch
'@backstage/plugin-github-pull-requests-board': patch
'@backstage/plugin-gitops-profiles': patch
'@backstage/plugin-graphql-backend': patch
'@backstage/plugin-home': patch
'@backstage/plugin-ilert': patch
'@backstage/plugin-jenkins-backend': patch
'@backstage/plugin-kubernetes-common': patch
'@backstage/plugin-newrelic': patch
'@backstage/plugin-newrelic-dashboard': patch
'@backstage/plugin-pagerduty': patch
'@backstage/plugin-rollbar': patch
'@backstage/plugin-rollbar-backend': patch
'@backstage/plugin-search-backend-module-pg': patch
'@backstage/plugin-sentry': patch
'@backstage/plugin-shortcuts': patch
'@backstage/plugin-splunk-on-call': patch
'@backstage/plugin-tech-radar': patch
'@backstage/plugin-user-settings': patch
'@backstage/plugin-xcmetrics': patch
---
Minor API signatures cleanup
-8
View File
@@ -9,13 +9,9 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "ALLURE_PROJECT_ID_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ALLURE_PROJECT_ID_ANNOTATION = 'qameta.io/allure-project';
// Warning: (ae-missing-release-tag) "allurePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const allurePlugin: BackstagePlugin<
{
@@ -25,13 +21,9 @@ export const allurePlugin: BackstagePlugin<
{}
>;
// Warning: (ae-missing-release-tag) "EntityAllureReportContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityAllureReportContent: () => JSX.Element;
// Warning: (ae-missing-release-tag) "isAllureReportAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const isAllureReportAvailable: (entity: Entity) => boolean;
```
@@ -15,8 +15,10 @@
*/
import { Entity } from '@backstage/catalog-model';
/** @public */
export const ALLURE_PROJECT_ID_ANNOTATION = 'qameta.io/allure-project';
/** @public */
export const isAllureReportAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[ALLURE_PROJECT_ID_ANNOTATION]);
+2
View File
@@ -26,6 +26,7 @@ export const allureRouteRef = createRouteRef({
id: 'allure',
});
/** @public */
export const allurePlugin = createPlugin({
id: 'allure',
apis: [
@@ -42,6 +43,7 @@ export const allurePlugin = createPlugin({
},
});
/** @public */
export const EntityAllureReportContent = allurePlugin.provide(
createRoutableExtension({
name: 'EntityAllureReportContent',
-4
View File
@@ -13,13 +13,9 @@ export const ApacheAirflowDagTable: (props: {
dagIds?: string[] | undefined;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "ApacheAirflowPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ApacheAirflowPage: () => JSX.Element;
// Warning: (ae-missing-release-tag) "apacheAirflowPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const apacheAirflowPlugin: BackstagePlugin<
{
+2
View File
@@ -25,6 +25,7 @@ import {
discoveryApiRef,
} from '@backstage/core-plugin-api';
/** @public */
export const apacheAirflowPlugin = createPlugin({
id: 'apache-airflow',
routes: {
@@ -43,6 +44,7 @@ export const apacheAirflowPlugin = createPlugin({
],
});
/** @public */
export const ApacheAirflowPage = apacheAirflowPlugin.provide(
createRoutableExtension({
name: 'ApacheAirflowPage',
-4
View File
@@ -8,13 +8,9 @@ import express from 'express';
import { Logger } from 'winston';
import { PluginDatabaseManager } from '@backstage/backend-common';
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface RouterOptions {
appPackageName: string;
@@ -40,6 +40,7 @@ import {
// express uses mime v1 while we only have types for mime v2
type Mime = { lookup(arg0: string): string };
/** @public */
export interface RouterOptions {
config: Config;
logger: Logger;
@@ -85,6 +86,7 @@ export interface RouterOptions {
disableConfigInjection?: boolean;
}
/** @public */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
+34 -79
View File
@@ -24,26 +24,6 @@ import { TokenSet } from 'openid-client';
import { UserEntity } from '@backstage/catalog-model';
import { UserinfoResponse } from 'openid-client';
// @public @deprecated (undocumented)
export class AtlassianAuthProvider implements OAuthHandlers {
// Warning: (ae-forgotten-export) The symbol "AtlassianAuthProviderOptions" needs to be exported by the entry point index.d.ts
constructor(options: AtlassianAuthProviderOptions);
// (undocumented)
handler(req: express.Request): Promise<{
response: OAuthResponse;
refreshToken: string | undefined;
}>;
// (undocumented)
refresh(req: OAuthRefreshRequest): Promise<{
response: OAuthResponse;
refreshToken: string | undefined;
}>;
// Warning: (ae-forgotten-export) The symbol "RedirectInfo" needs to be exported by the entry point index.d.ts
//
// (undocumented)
start(req: OAuthStartRequest): Promise<RedirectInfo>;
}
// @public
export type AuthHandler<TAuthResult> = (
input: TAuthResult,
@@ -63,8 +43,6 @@ export type AuthProviderConfig = {
cookieConfigurer?: CookieConfigurer;
};
// Warning: (ae-missing-release-tag) "AuthProviderFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AuthProviderFactory = (options: {
providerId: string;
@@ -74,8 +52,6 @@ export type AuthProviderFactory = (options: {
resolverContext: AuthResolverContext;
}) => AuthProviderRouteHandlers;
// Warning: (ae-missing-release-tag) "AuthProviderRouteHandlers" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface AuthProviderRouteHandlers {
frameHandler(req: express.Request, res: express.Response): Promise<void>;
@@ -129,8 +105,6 @@ export type AwsAlbResult = {
accessToken: string;
};
// Warning: (ae-missing-release-tag) "BitbucketOAuthResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BitbucketOAuthResult = {
fullProfile: BitbucketPassportProfile;
@@ -143,8 +117,6 @@ export type BitbucketOAuthResult = {
refreshToken?: string;
};
// Warning: (ae-missing-release-tag) "BitbucketPassportProfile" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BitbucketPassportProfile = Profile & {
id?: string;
@@ -160,15 +132,14 @@ export type BitbucketPassportProfile = Profile & {
};
};
// Warning: (ae-missing-release-tag) "CatalogIdentityClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class CatalogIdentityClient {
constructor(options: { catalogApi: CatalogApi; tokenManager: TokenManager });
// Warning: (ae-forgotten-export) The symbol "UserQuery" needs to be exported by the entry point index.d.ts
findUser(query: UserQuery): Promise<UserEntity>;
// Warning: (ae-forgotten-export) The symbol "MemberClaimQuery" needs to be exported by the entry point index.d.ts
resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]>;
findUser(query: { annotations: Record<string, string> }): Promise<UserEntity>;
resolveCatalogMembership(query: {
entityRefs: string[];
logger?: Logger;
}): Promise<string[]>;
}
// @public
@@ -218,8 +189,6 @@ export type CookieConfigurer = (ctx: {
secure: boolean;
};
// Warning: (ae-missing-release-tag) "createAuthProviderIntegration" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export function createAuthProviderIntegration<
TCreateOptions extends unknown[],
@@ -234,13 +203,9 @@ export function createAuthProviderIntegration<
resolvers: Readonly<string extends keyof TResolvers ? never : TResolvers>;
}>;
// Warning: (ae-missing-release-tag) "createOriginFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function createOriginFilter(config: Config): (origin: string) => boolean;
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
@@ -249,13 +214,9 @@ export const defaultAuthProviderFactories: {
[providerId: string]: AuthProviderFactory;
};
// Warning: (ae-missing-release-tag) "encodeState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const encodeState: (state: OAuthState) => string;
// Warning: (ae-missing-release-tag) "ensuresXRequestedWith" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ensuresXRequestedWith: (req: express.Request) => boolean;
@@ -274,8 +235,6 @@ export type GcpIapTokenInfo = {
// @public
export function getDefaultOwnershipEntityRefs(entity: Entity): string[];
// Warning: (ae-missing-release-tag) "GithubOAuthResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type GithubOAuthResult = {
fullProfile: Profile;
@@ -296,20 +255,19 @@ export type OAuth2ProxyResult<JWTPayload = {}> = {
getHeader(name: string): string | undefined;
};
// Warning: (ae-missing-release-tag) "OAuthAdapter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class OAuthAdapter implements AuthProviderRouteHandlers {
constructor(handlers: OAuthHandlers, options: Options);
constructor(handlers: OAuthHandlers, options: OAuthAdapterOptions);
// (undocumented)
frameHandler(req: express.Request, res: express.Response): Promise<void>;
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
//
// (undocumented)
static fromConfig(
config: AuthProviderConfig,
handlers: OAuthHandlers,
options: Pick<Options, 'providerId' | 'persistScopes' | 'callbackUrl'>,
options: Pick<
OAuthAdapterOptions,
'providerId' | 'persistScopes' | 'callbackUrl'
>,
): OAuthAdapter;
// (undocumented)
logout(req: express.Request, res: express.Response): Promise<void>;
@@ -319,8 +277,18 @@ export class OAuthAdapter implements AuthProviderRouteHandlers {
start(req: express.Request, res: express.Response): Promise<void>;
}
// Warning: (ae-missing-release-tag) "OAuthEnvironmentHandler" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthAdapterOptions = {
providerId: string;
secure: boolean;
persistScopes?: boolean;
cookieDomain: string;
cookiePath: string;
appOrigin: string;
isOriginAllowed: (origin: string) => boolean;
callbackUrl: string;
};
// @public (undocumented)
export class OAuthEnvironmentHandler implements AuthProviderRouteHandlers {
constructor(handlers: Map<string, AuthProviderRouteHandlers>);
@@ -350,11 +318,9 @@ export interface OAuthHandlers {
response: OAuthResponse;
refreshToken?: string;
}>;
start(req: OAuthStartRequest): Promise<RedirectInfo>;
start(req: OAuthStartRequest): Promise<OAuthStartResponse>;
}
// Warning: (ae-missing-release-tag) "OAuthProviderInfo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthProviderInfo = {
accessToken: string;
@@ -363,8 +329,6 @@ export type OAuthProviderInfo = {
scope: string;
};
// Warning: (ae-missing-release-tag) "OAuthProviderOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type OAuthProviderOptions = {
clientId: string;
@@ -372,8 +336,6 @@ export type OAuthProviderOptions = {
callbackUrl: string;
};
// Warning: (ae-missing-release-tag) "OAuthRefreshRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthRefreshRequest = express.Request<{}> & {
scope: string;
@@ -387,8 +349,6 @@ export type OAuthResponse = {
backstageIdentity?: BackstageSignInResult;
};
// Warning: (ae-missing-release-tag) "OAuthResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthResult = {
fullProfile: Profile;
@@ -401,16 +361,18 @@ export type OAuthResult = {
refreshToken?: string;
};
// Warning: (ae-missing-release-tag) "OAuthStartRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthStartRequest = express.Request<{}> & {
scope: string;
state: OAuthState;
};
// Warning: (ae-missing-release-tag) "OAuthState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type OAuthStartResponse = {
url: string;
status?: number;
};
// @public (undocumented)
export type OAuthState = {
nonce: string;
@@ -425,8 +387,6 @@ export type OidcAuthResult = {
userinfo: UserinfoResponse;
};
// Warning: (ae-missing-release-tag) "postMessageResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const postMessageResponse: (
res: express.Response,
@@ -446,6 +406,11 @@ export type ProfileInfo = {
picture?: string;
};
// @public (undocumented)
export type ProviderFactories = {
[s: string]: AuthProviderFactory;
};
// @public
export const providers: Readonly<{
atlassian: Readonly<{
@@ -693,13 +658,9 @@ export const providers: Readonly<{
}>;
}>;
// Warning: (ae-missing-release-tag) "readState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const readState: (stateString: string) => OAuthState;
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface RouterOptions {
// (undocumented)
@@ -710,8 +671,6 @@ export interface RouterOptions {
discovery: PluginEndpointDiscovery;
// (undocumented)
logger: Logger;
// Warning: (ae-forgotten-export) The symbol "ProviderFactories" needs to be exported by the entry point index.d.ts
//
// (undocumented)
providerFactories?: ProviderFactories;
// (undocumented)
@@ -750,13 +709,9 @@ export type TokenParams = {
};
};
// Warning: (ae-missing-release-tag) "verifyNonce" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const verifyNonce: (req: express.Request, providerId: string) => void;
// Warning: (ae-missing-release-tag) "WebMessageResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type WebMessageResponse =
| {
@@ -26,17 +26,10 @@ import {
} from '@backstage/catalog-model';
import { TokenManager } from '@backstage/backend-common';
type UserQuery = {
annotations: Record<string, string>;
};
type MemberClaimQuery = {
entityRefs: string[];
logger?: Logger;
};
/**
* A catalog client tailored for reading out identity data from the catalog.
*
* @public
*/
export class CatalogIdentityClient {
private readonly catalogApi: CatalogApi;
@@ -52,7 +45,9 @@ export class CatalogIdentityClient {
*
* Throws a NotFoundError or ConflictError if 0 or multiple users are found.
*/
async findUser(query: UserQuery): Promise<UserEntity> {
async findUser(query: {
annotations: Record<string, string>;
}): Promise<UserEntity> {
const filter: Record<string, string> = {
kind: 'user',
};
@@ -81,7 +76,10 @@ export class CatalogIdentityClient {
*
* Returns a superset of the entity names that can be passed directly to `issueToken` as `ent`.
*/
async resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]> {
async resolveCatalogMembership(query: {
entityRefs: string[];
logger?: Logger;
}): Promise<string[]> {
const { entityRefs, logger } = query;
const resolvedEntityRefs = entityRefs
.map((ref: string) => {
@@ -24,6 +24,7 @@ export const safelyEncodeURIComponent = (value: string) => {
return encodeURIComponent(value).replace(/'/g, '%27');
};
/** @public */
export const postMessageResponse = (
res: express.Response,
appOrigin: string,
@@ -68,6 +69,7 @@ export const postMessageResponse = (
res.end(`<html><body><script>${script}</script></body></html>`);
};
/** @public */
export const ensuresXRequestedWith = (req: express.Request) => {
const requiredHeader = req.header('X-Requested-With');
if (!requiredHeader || requiredHeader !== 'XMLHttpRequest') {
@@ -19,6 +19,8 @@ import { AuthResponse } from '../../providers/types';
/**
* Payload sent as a post message after the auth request is complete.
* If successful then has a valid payload with Auth information else contains an error.
*
* @public
*/
export type WebMessageResponse =
| {
@@ -44,7 +44,8 @@ import { prepareBackstageIdentityResponse } from '../../providers/prepareBacksta
export const THOUSAND_DAYS_MS = 1000 * 24 * 60 * 60 * 1000;
export const TEN_MINUTES_MS = 600 * 1000;
export type Options = {
/** @public */
export type OAuthAdapterOptions = {
providerId: string;
secure: boolean;
persistScopes?: boolean;
@@ -54,11 +55,16 @@ export type Options = {
isOriginAllowed: (origin: string) => boolean;
callbackUrl: string;
};
/** @public */
export class OAuthAdapter implements AuthProviderRouteHandlers {
static fromConfig(
config: AuthProviderConfig,
handlers: OAuthHandlers,
options: Pick<Options, 'providerId' | 'persistScopes' | 'callbackUrl'>,
options: Pick<
OAuthAdapterOptions,
'providerId' | 'persistScopes' | 'callbackUrl'
>,
): OAuthAdapter {
const { origin: appOrigin } = new URL(config.appUrl);
@@ -83,7 +89,7 @@ export class OAuthAdapter implements AuthProviderRouteHandlers {
constructor(
private readonly handlers: OAuthHandlers,
private readonly options: Options,
private readonly options: OAuthAdapterOptions,
) {
this.baseCookieOptions = {
httpOnly: true,
@@ -20,6 +20,7 @@ import { InputError, NotFoundError } from '@backstage/errors';
import { readState } from './helpers';
import { AuthProviderRouteHandlers } from '../../providers/types';
/** @public */
export class OAuthEnvironmentHandler implements AuthProviderRouteHandlers {
static mapConfig(
config: Config,
@@ -19,6 +19,7 @@ import { OAuthState } from './types';
import pickBy from 'lodash/pickBy';
import { CookieConfigurer } from '../../providers/types';
/** @public */
export const readState = (stateString: string): OAuthState => {
const state = Object.fromEntries(
new URLSearchParams(Buffer.from(stateString, 'hex').toString('utf-8')),
@@ -35,6 +36,7 @@ export const readState = (stateString: string): OAuthState => {
return state as OAuthState;
};
/** @public */
export const encodeState = (state: OAuthState): string => {
const stateString = new URLSearchParams(
pickBy<string>(state, value => value !== undefined),
@@ -43,6 +45,7 @@ export const encodeState = (state: OAuthState): string => {
return Buffer.from(stateString, 'utf-8').toString('hex');
};
/** @public */
export const verifyNonce = (req: express.Request, providerId: string) => {
const cookieNonce = req.cookies[`${providerId}-nonce`];
const state: OAuthState = readState(req.query.state?.toString() ?? '');
@@ -15,6 +15,7 @@
*/
export { OAuthEnvironmentHandler } from './OAuthEnvironmentHandler';
export type { OAuthAdapterOptions } from './OAuthAdapter';
export { OAuthAdapter } from './OAuthAdapter';
export { encodeState, verifyNonce, readState } from './helpers';
export type {
+9 -2
View File
@@ -17,10 +17,12 @@
import express from 'express';
import { Profile as PassportProfile } from 'passport';
import { BackstageSignInResult } from '@backstage/plugin-auth-node';
import { RedirectInfo, ProfileInfo } from '../../providers/types';
import { OAuthStartResponse, ProfileInfo } from '../../providers/types';
/**
* Common options for passport.js-based OAuth providers
*
* @public
*/
export type OAuthProviderOptions = {
/**
@@ -37,6 +39,7 @@ export type OAuthProviderOptions = {
callbackUrl: string;
};
/** @public */
export type OAuthResult = {
fullProfile: PassportProfile;
params: {
@@ -59,6 +62,7 @@ export type OAuthResponse = {
backstageIdentity?: BackstageSignInResult;
};
/** @public */
export type OAuthProviderInfo = {
/**
* An access token issued for the signed in user.
@@ -78,6 +82,7 @@ export type OAuthProviderInfo = {
scope: string;
};
/** @public */
export type OAuthState = {
/* A type for the serialized value in the `state` parameter of the OAuth authorization flow
*/
@@ -87,11 +92,13 @@ export type OAuthState = {
scope?: string;
};
/** @public */
export type OAuthStartRequest = express.Request<{}> & {
scope: string;
state: OAuthState;
};
/** @public */
export type OAuthRefreshRequest = express.Request<{}> & {
scope: string;
refreshToken: string;
@@ -108,7 +115,7 @@ export interface OAuthHandlers {
/**
* Initiate a sign in request with an auth provider.
*/
start(req: OAuthStartRequest): Promise<RedirectInfo>;
start(req: OAuthStartRequest): Promise<OAuthStartResponse>;
/**
* Handle the redirect from the auth provider when the user has signed in.
@@ -33,7 +33,7 @@ describe('PassportStrategyHelper', () => {
}
describe('executeRedirectStrategy', () => {
it('should call authenticate and resolve with RedirectInfo', async () => {
it('should call authenticate and resolve with OAuthStartResponse', async () => {
const mockStrategy = new MyCustomRedirectStrategy();
const spyAuthenticate = jest.spyOn(mockStrategy, 'authenticate');
const redirectStrategyPromise = executeRedirectStrategy(
@@ -20,7 +20,7 @@ import jwtDecoder from 'jwt-decode';
import { InternalOAuthError } from 'passport-oauth2';
import { PassportProfile } from './types';
import { ProfileInfo, RedirectInfo } from '../../providers/types';
import { ProfileInfo, OAuthStartResponse } from '../../providers/types';
export type PassportDoneCallback<Res, Private = never> = (
err?: Error,
@@ -77,7 +77,7 @@ export const executeRedirectStrategy = async (
req: express.Request,
providerStrategy: passport.Strategy,
options: Record<string, string>,
): Promise<RedirectInfo> => {
): Promise<OAuthStartResponse> => {
return new Promise(resolve => {
const strategy = Object.create(providerStrategy);
strategy.redirect = (url: string, status?: number) => {
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { atlassian, AtlassianAuthProvider } from './provider';
export { atlassian } from './provider';
@@ -38,12 +38,13 @@ import {
import {
AuthHandler,
AuthResolverContext,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
} from '../types';
import express from 'express';
import { createAuthProviderIntegration } from '../createAuthProviderIntegration';
/** @public */
export type AtlassianAuthProviderOptions = OAuthProviderOptions & {
scopes: string;
signInResolver?: SignInResolver<OAuthResult>;
@@ -58,10 +59,6 @@ export const atlassianDefaultAuthHandler: AuthHandler<OAuthResult> = async ({
profile: makeProfileInfo(fullProfile, params.id_token),
});
/**
* @public
* @deprecated This export is deprecated and will be removed in the future.
*/
export class AtlassianAuthProvider implements OAuthHandlers {
private readonly _strategy: AtlassianStrategy;
private readonly signInResolver?: SignInResolver<OAuthResult>;
@@ -97,7 +94,7 @@ export class AtlassianAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
state: encodeState(req.state),
});
@@ -37,7 +37,7 @@ import {
PassportDoneCallback,
} from '../../lib/passport';
import {
RedirectInfo,
OAuthStartResponse,
AuthHandler,
SignInResolver,
AuthResolverContext,
@@ -98,7 +98,7 @@ export class Auth0AuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
accessType: 'offline',
prompt: 'consent',
@@ -39,7 +39,7 @@ import {
import { createAuthProviderIntegration } from '../createAuthProviderIntegration';
import {
AuthHandler,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
AuthResolverContext,
} from '../types';
@@ -54,6 +54,7 @@ type Options = OAuthProviderOptions & {
resolverContext: AuthResolverContext;
};
/** @public */
export type BitbucketOAuthResult = {
fullProfile: BitbucketPassportProfile;
params: {
@@ -65,6 +66,7 @@ export type BitbucketOAuthResult = {
refreshToken?: string;
};
/** @public */
export type BitbucketPassportProfile = PassportProfile & {
id?: string;
displayName?: string;
@@ -119,7 +121,7 @@ export class BitbucketAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
accessType: 'offline',
prompt: 'consent',
@@ -146,7 +146,6 @@ export type CloudflareAccessIdentityProfile = {
};
/**
*
* @public
*/
export type CloudflareAccessResult = {
@@ -22,6 +22,8 @@ import { AuthProviderFactory, SignInResolver } from './types';
*
* The returned object facilitates the creation of provider instances, and
* supplies built-in sign-in resolvers for the specific provider.
*
* @public
*/
export function createAuthProviderIntegration<
TCreateOptions extends unknown[],
@@ -26,7 +26,7 @@ import {
PassportDoneCallback,
} from '../../lib/passport';
import {
RedirectInfo,
OAuthStartResponse,
AuthHandler,
SignInResolver,
StateEncoder,
@@ -52,6 +52,7 @@ type PrivateInfo = {
refreshToken?: string;
};
/** @public */
export type GithubOAuthResult = {
fullProfile: PassportProfile;
params: {
@@ -106,7 +107,7 @@ export class GithubAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
scope: req.scope,
state: (await this.stateEncoder(req)).encodedState,
@@ -25,7 +25,7 @@ import {
PassportDoneCallback,
} from '../../lib/passport';
import {
RedirectInfo,
OAuthStartResponse,
SignInResolver,
AuthHandler,
AuthResolverContext,
@@ -110,7 +110,7 @@ export class GitlabAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
scope: req.scope,
state: encodeState(req.state),
@@ -39,7 +39,7 @@ import {
import {
AuthHandler,
AuthResolverContext,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
} from '../types';
import { createAuthProviderIntegration } from '../createAuthProviderIntegration';
@@ -98,7 +98,7 @@ export class GoogleAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this.strategy, {
accessType: 'offline',
prompt: 'consent',
+1 -1
View File
@@ -14,7 +14,6 @@
* limitations under the License.
*/
export { AtlassianAuthProvider } from './atlassian';
export type { AwsAlbResult } from './aws-alb';
export type {
BitbucketOAuthResult,
@@ -50,6 +49,7 @@ export type {
StateEncoder,
AuthResponse,
ProfileInfo,
OAuthStartResponse,
} from './types';
export { prepareBackstageIdentityResponse } from './prepareBackstageIdentityResponse';
@@ -38,7 +38,7 @@ import {
} from '../../lib/passport';
import {
AuthHandler,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
AuthResolverContext,
} from '../types';
@@ -97,7 +97,7 @@ export class MicrosoftAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
scope: req.scope,
state: encodeState(req.state),
@@ -39,7 +39,7 @@ import {
import {
AuthHandler,
AuthResolverContext,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
} from '../types';
import { createAuthProviderIntegration } from '../createAuthProviderIntegration';
@@ -114,7 +114,7 @@ export class OAuth2AuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
accessType: 'offline',
prompt: 'consent',
@@ -40,7 +40,7 @@ import {
import {
AuthHandler,
AuthResolverContext,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
} from '../types';
import { createAuthProviderIntegration } from '../createAuthProviderIntegration';
@@ -91,7 +91,7 @@ export class OidcAuthProvider implements OAuthHandlers {
this.resolverContext = options.resolverContext;
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
const { strategy } = await this.implementation;
const options: Record<string, string> = {
scope: req.scope || this.scope || 'openid profile email',
@@ -38,7 +38,7 @@ import {
} from '../../lib/passport';
import {
AuthHandler,
RedirectInfo,
OAuthStartResponse,
SignInResolver,
AuthResolverContext,
} from '../types';
@@ -125,7 +125,7 @@ export class OktaAuthProvider implements OAuthHandlers {
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this.strategy, {
accessType: 'offline',
prompt: 'consent',
@@ -37,7 +37,7 @@ import {
PassportDoneCallback,
} from '../../lib/passport';
import {
RedirectInfo,
OAuthStartResponse,
AuthHandler,
SignInResolver,
AuthResolverContext,
@@ -95,7 +95,7 @@ export class OneLoginProvider implements OAuthHandlers {
},
);
}
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
async start(req: OAuthStartRequest): Promise<OAuthStartResponse> {
return await executeRedirectStrategy(req, this._strategy, {
accessType: 'offline',
prompt: 'consent',
+5 -1
View File
@@ -126,7 +126,8 @@ export type AuthProviderConfig = {
cookieConfigurer?: CookieConfigurer;
};
export type RedirectInfo = {
/** @public */
export type OAuthStartResponse = {
/**
* URL to redirect to
*/
@@ -147,6 +148,8 @@ export type RedirectInfo = {
* `/auth/[provider]/handler/frame -> frameHandler`
* `/auth/[provider]/refresh -> refresh`
* `/auth/[provider]/logout -> logout`
*
* @public
*/
export interface AuthProviderRouteHandlers {
/**
@@ -192,6 +195,7 @@ export interface AuthProviderRouteHandlers {
logout?(req: express.Request, res: express.Response): Promise<void>;
}
/** @public */
export type AuthProviderFactory = (options: {
providerId: string;
globalConfig: AuthProviderConfig;
+5 -1
View File
@@ -36,8 +36,10 @@ import passport from 'passport';
import { Minimatch } from 'minimatch';
import { CatalogAuthResolverContext } from '../lib/resolvers';
type ProviderFactories = { [s: string]: AuthProviderFactory };
/** @public */
export type ProviderFactories = { [s: string]: AuthProviderFactory };
/** @public */
export interface RouterOptions {
logger: Logger;
database: PluginDatabaseManager;
@@ -48,6 +50,7 @@ export interface RouterOptions {
providerFactories?: ProviderFactories;
}
/** @public */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
@@ -187,6 +190,7 @@ export async function createRouter(
return router;
}
/** @public */
export function createOriginFilter(
config: Config,
): (origin: string) => boolean {
+3 -6
View File
@@ -8,18 +8,15 @@
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
// Warning: (ae-missing-release-tag) "bitrisePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const BITRISE_APP_ANNOTATION = 'bitrise.io/app';
// @public (undocumented)
export const bitrisePlugin: BackstagePlugin<{}, {}, {}>;
// Warning: (ae-missing-release-tag) "EntityBitriseContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityBitriseContent: () => JSX.Element;
// Warning: (ae-missing-release-tag) "isBitriseAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const isBitriseAvailable: (entity: Entity) => boolean;
```
@@ -32,8 +32,10 @@ export type Props = {
entity: Entity;
};
/** @public */
export const BITRISE_APP_ANNOTATION = 'bitrise.io/app';
/** @public */
export const isBitriseAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[BITRISE_APP_ANNOTATION]);
+1
View File
@@ -17,6 +17,7 @@
import { bitrisePlugin } from './plugin';
import { createComponentExtension } from '@backstage/core-plugin-api';
/** @public */
export const EntityBitriseContent = bitrisePlugin.provide(
createComponentExtension({
name: 'EntityBitriseContent',
+4 -1
View File
@@ -22,4 +22,7 @@
export { bitrisePlugin } from './plugin';
export { EntityBitriseContent } from './extensions';
export { isBitriseAvailable } from './components/BitriseBuildsComponent';
export {
isBitriseAvailable,
BITRISE_APP_ANNOTATION,
} from './components/BitriseBuildsComponent';
+1
View File
@@ -28,6 +28,7 @@ export const bitriseApiRef = createApiRef<BitriseApi>({
id: 'plugin.bitrise.service',
});
/** @public */
export const bitrisePlugin = createPlugin({
id: 'bitrise',
apis: [
-4
View File
@@ -7,13 +7,9 @@ import { Config } from '@backstage/config';
import { Logger } from 'winston';
import { Module } from 'graphql-modules';
// Warning: (ae-missing-release-tag) "createModule" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function createModule(options: ModuleOptions): Promise<Module>;
// Warning: (ae-missing-release-tag) "ModuleOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ModuleOptions {
// (undocumented)
@@ -27,11 +27,13 @@ import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
import { Entity } from '@backstage/catalog-model';
import typeDefs from '../schema';
/** @public */
export interface ModuleOptions {
logger: Logger;
config: Config;
}
/** @public */
export async function createModule(options: ModuleOptions): Promise<Module> {
const catalogClient = new CatalogClient(
options.config.getString('backend.baseUrl'),
+7 -7
View File
@@ -64,6 +64,9 @@ export type BackstageOverrides = Overrides & {
>;
};
// @public (undocumented)
export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
// @public (undocumented)
export const CatalogEntityPage: () => JSX.Element;
@@ -79,8 +82,6 @@ export interface CatalogKindHeaderProps {
initialFilter?: string;
}
// Warning: (ae-forgotten-export) The symbol "CatalogInputPluginOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const catalogPlugin: BackstagePlugin<
{
@@ -176,6 +177,9 @@ export interface CatalogTableRow {
};
}
// @public (undocumented)
export type ColumnBreakpoints = Record<Breakpoint, number>;
// @public
export interface DefaultCatalogPageProps {
// (undocumented)
@@ -296,15 +300,11 @@ export type EntityLayoutRouteProps = {
>;
};
// Warning: (ae-forgotten-export) The symbol "EntityLinksCard" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const EntityLinksCard: EntityLinksCard_2;
export const EntityLinksCard: (props: EntityLinksCardProps) => JSX.Element;
// @public (undocumented)
export interface EntityLinksCardProps {
// Warning: (ae-forgotten-export) The symbol "ColumnBreakpoints" needs to be exported by the entry point index.d.ts
//
// (undocumented)
cols?: ColumnBreakpoints | number;
// (undocumented)
@@ -29,7 +29,7 @@ export interface EntityLinksCardProps {
variant?: InfoCardVariants;
}
export function EntityLinksCard(props: EntityLinksCardProps) {
export const EntityLinksCard = (props: EntityLinksCardProps) => {
const { cols = undefined, variant } = props;
const { entity } = useEntity();
const app = useApp();
@@ -55,4 +55,4 @@ export function EntityLinksCard(props: EntityLinksCardProps) {
)}
</InfoCard>
);
}
};
@@ -17,3 +17,4 @@
export { EntityLinksCard } from './EntityLinksCard';
export type { EntityLinksCardProps } from './EntityLinksCard';
export type { EntityLinksEmptyStateClassKey } from './EntityLinksEmptyState';
export type { Breakpoint, ColumnBreakpoints } from './types';
@@ -14,6 +14,8 @@
* limitations under the License.
*/
/** @public */
export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
/** @public */
export type ColumnBreakpoints = Record<Breakpoint, number>;
+2
View File
@@ -59,6 +59,8 @@ export type { DependsOnResourcesCardProps } from './components/DependsOnResource
export type {
EntityLinksEmptyStateClassKey,
EntityLinksCardProps,
Breakpoint,
ColumnBreakpoints,
} from './components/EntityLinksCard';
export type { SystemDiagramCardClassKey } from './components/SystemDiagramCard';
export type { DefaultCatalogPageProps } from './components/CatalogPage';
+1
View File
@@ -20,6 +20,7 @@ export type CatalogPluginOptions = {
createButtonTitle: string;
};
/** @ignore */
export type CatalogInputPluginOptions = {
createButtonTitle: string;
};
+1 -45
View File
@@ -10,13 +10,9 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "AbortError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class AbortError extends Error {}
// Warning: (ae-missing-release-tag) "Build" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface Build {
branchType: FilterBranchType;
@@ -30,25 +26,17 @@ export interface Build {
triggeredBy?: TriggerReason;
}
// Warning: (ae-missing-release-tag) "BuildWithRaw" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type BuildWithRaw<T = any> = Build & {
raw: T;
};
// Warning: (ae-missing-release-tag) "ChartType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type ChartType = 'duration' | 'count';
// Warning: (ae-missing-release-tag) "ChartTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type ChartTypes = Array<ChartType>;
// Warning: (ae-missing-release-tag) "CicdConfiguration" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface CicdConfiguration {
availableStatuses: ReadonlyArray<FilterStatusType>;
@@ -56,8 +44,6 @@ export interface CicdConfiguration {
formatStageName: (parentNames: Array<string>, stageName: string) => string;
}
// Warning: (ae-missing-release-tag) "CicdDefaults" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface CicdDefaults {
chartTypes: Record<FilterStatusType, ChartTypes>;
@@ -75,16 +61,12 @@ export interface CicdDefaults {
timeTo: Date;
}
// Warning: (ae-missing-release-tag) "CicdState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface CicdState {
// (undocumented)
builds: Array<Build>;
}
// Warning: (ae-missing-release-tag) "CicdStatisticsApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface CicdStatisticsApi {
// (undocumented)
@@ -95,13 +77,9 @@ export interface CicdStatisticsApi {
): Promise<Partial<CicdConfiguration>>;
}
// Warning: (ae-missing-release-tag) "cicdStatisticsApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const cicdStatisticsApiRef: ApiRef<CicdStatisticsApi>;
// Warning: (ae-missing-release-tag) "cicdStatisticsPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const cicdStatisticsPlugin: BackstagePlugin<
{
@@ -111,18 +89,12 @@ export const cicdStatisticsPlugin: BackstagePlugin<
{}
>;
// Warning: (ae-missing-release-tag) "EntityCicdStatisticsContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityCicdStatisticsContent: EntityPageCicdCharts;
// Warning: (ae-missing-release-tag) "EntityPageCicdCharts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function EntityPageCicdCharts(): JSX.Element;
// Warning: (ae-missing-release-tag) "FetchBuildsOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface FetchBuildsOptions {
// (undocumented)
@@ -141,13 +113,9 @@ export interface FetchBuildsOptions {
updateProgress: UpdateProgress;
}
// Warning: (ae-missing-release-tag) "FilterBranchType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type FilterBranchType = 'master' | 'branch';
// Warning: (ae-missing-release-tag) "FilterStatusType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type FilterStatusType =
| 'unknown'
@@ -160,16 +128,12 @@ export type FilterStatusType =
| 'stalled'
| 'expired';
// Warning: (ae-missing-release-tag) "GetConfigurationOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface GetConfigurationOptions {
// (undocumented)
entity: Entity;
}
// Warning: (ae-missing-release-tag) "Stage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface Stage {
duration: number;
@@ -179,13 +143,9 @@ export interface Stage {
status: FilterStatusType;
}
// Warning: (ae-missing-release-tag) "statusTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const statusTypes: Array<FilterStatusType>;
// Warning: (ae-missing-release-tag) "TriggerReason" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type TriggerReason =
/** Triggered by source code management, e.g. a Github hook */
@@ -197,13 +157,9 @@ export type TriggerReason =
/** Triggered for some other reason */
| 'other';
// Warning: (ae-missing-release-tag) "triggerReasons" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const triggerReasons: Array<TriggerReason>;
// Warning: (ae-missing-release-tag) "UpdateProgress" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface UpdateProgress {
// (undocumented)
@@ -15,9 +15,9 @@
*/
import { createApiRef } from '@backstage/core-plugin-api';
import { CicdStatisticsApi } from './types';
/** @public */
export const cicdStatisticsApiRef = createApiRef<CicdStatisticsApi>({
id: 'cicd-statistics-api',
});
+44
View File
@@ -21,6 +21,8 @@ import { Entity } from '@backstage/catalog-model';
*
* If all of these aren't applicable to the underlying CI/CD, these can be
* configured to be hidden, using the `availableStatuses` in `CicdConfiguration`.
*
* @public
*/
export type FilterStatusType =
| 'unknown'
@@ -32,6 +34,10 @@ export type FilterStatusType =
| 'failed'
| 'stalled'
| 'expired';
/**
* @public
*/
export const statusTypes: Array<FilterStatusType> = [
'succeeded',
'failed',
@@ -50,9 +56,14 @@ export const statusTypes: Array<FilterStatusType> = [
* The concept of what constitutes a master branch is generic. It might be called
* something like 'release' or 'main' or 'trunk' in the underlying CI/CD system,
* which is then up to the Api to map accordingly.
*
* @public
*/
export type FilterBranchType = 'master' | 'branch';
/**
* @public
*/
export type TriggerReason =
/** Triggered by source code management, e.g. a Github hook */
| 'scm'
@@ -63,6 +74,9 @@ export type TriggerReason =
/** Triggered for some other reason */
| 'other';
/**
* @public
*/
export const triggerReasons: Array<TriggerReason> = [
'scm',
'manual',
@@ -76,6 +90,8 @@ export const triggerReasons: Array<TriggerReason> = [
* This may be called things like Stage or Step or Task in CI/CD systems, but is
* generic here. There's also no concept of parallelism which might exist within
* some stages.
*
* @public
*/
export interface Stage {
name: string;
@@ -94,6 +110,8 @@ export interface Stage {
* Generic Build type.
*
* A build has e.g. a build type (master/branch), a status and (possibly) sub stages.
*
* @public
*/
export interface Build {
raw?: unknown;
@@ -125,6 +143,8 @@ export interface Build {
*
* This can be useful in an Api to use while mapping internal data structures
* (raw) into generic builds.
*
* @public
*/
export type BuildWithRaw<T = any> = Build & {
raw: T;
@@ -136,8 +156,16 @@ export type BuildWithRaw<T = any> = Build & {
* Values are:
* * `duration`: shows an area chart of the duration over time
* * `count`: shows a bar chart of the number of build per day
*
* @public
*/
export type ChartType = 'duration' | 'count';
/**
* Chart types.
*
* @public
*/
export type ChartTypes = Array<ChartType>;
/**
@@ -145,6 +173,8 @@ export type ChartTypes = Array<ChartType>;
*
* These are all optional, but can be overridden from the Api to whatever makes
* most sense for that implementation.
*
* @public
*/
export interface CicdDefaults {
timeFrom: Date;
@@ -171,6 +201,8 @@ export interface CicdDefaults {
* configuration before anything else.
*
* All of these fields are optional though, and will fallback to hard-coded defaults.
*
* @public
*/
export interface CicdConfiguration {
/**
@@ -200,11 +232,15 @@ export interface CicdConfiguration {
/**
* If the Api implements support for aborting the fetching of builds, throw an
* AbortError of this type (or any other error with name === 'AbortError').
*
* @public
*/
export class AbortError extends Error {}
/**
* The result type for `fetchBuilds`.
*
* @public
*/
export interface CicdState {
builds: Array<Build>;
@@ -222,6 +258,8 @@ export interface CicdState {
* the UI.
*
* Optionally this can signal multiple progresses in several steps
*
* @public
*/
export interface UpdateProgress {
(completed: number, total: number, started?: number): void;
@@ -238,6 +276,8 @@ export interface UpdateProgress {
/**
* When reading configuration, the Api can return a custom settings depending on
* the entity being viewed.
*
* @public
*/
export interface GetConfigurationOptions {
entity: Entity;
@@ -252,6 +292,8 @@ export interface GetConfigurationOptions {
*
* When the UI re-fetches, it will abort any previous fetching, so polling
* `abortSignal.aborted`, and possibly throwing an `AbortError`, can be useful.
*
* @public
*/
export interface FetchBuildsOptions {
entity: Entity;
@@ -266,6 +308,8 @@ export interface FetchBuildsOptions {
/**
* The interface which is mapped to the `cicdStatisticsApiRef` which is used by
* the UI.
*
* @public
*/
export interface CicdStatisticsApi {
getConfiguration(
@@ -46,6 +46,7 @@ import { cleanupBuildTree } from './utils/stage-names';
import { renderFallbacks, useAsyncChain } from './components/progress';
import { sortFilterStatusType } from './utils/api';
/** @public */
export function EntityPageCicdCharts() {
const state = useCicdConfiguration();
+2
View File
@@ -26,6 +26,7 @@ const rootCatalogCicdStatsRouteRef = createRouteRef({
id: 'cicd-statistics',
});
/** @public */
export const cicdStatisticsPlugin = createPlugin({
id: 'cicd-statistics',
routes: {
@@ -33,6 +34,7 @@ export const cicdStatisticsPlugin = createPlugin({
},
});
/** @public */
export const EntityCicdStatisticsContent = cicdStatisticsPlugin.provide(
createRoutableExtension({
component: () => import('./entity-page').then(m => m.EntityPageCicdCharts),
+1 -20
View File
@@ -26,17 +26,12 @@ export { BuildSummary };
export { BuildWithSteps };
// Warning: (ae-missing-release-tag) "CIRCLECI_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CIRCLECI_ANNOTATION = 'circleci.com/project-slug';
// Warning: (ae-missing-release-tag) "CircleCIApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class CircleCIApi {
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
constructor(options: Options);
constructor(options: { discoveryApi: DiscoveryApi; proxyPath?: string });
// (undocumented)
getBuild(
buildNumber: number,
@@ -59,44 +54,30 @@ export class CircleCIApi {
): Promise<BuildSummary>;
}
// Warning: (ae-missing-release-tag) "circleCIApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const circleCIApiRef: ApiRef<CircleCIApi>;
// Warning: (ae-missing-release-tag) "circleCIBuildRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const circleCIBuildRouteRef: SubRouteRef<PathParams<'/:buildId'>>;
// Warning: (ae-missing-release-tag) "circleCIPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const circleCIPlugin: BackstagePlugin<{}, {}, {}>;
export { circleCIPlugin };
export { circleCIPlugin as plugin };
// Warning: (ae-missing-release-tag) "circleCIRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const circleCIRouteRef: RouteRef<undefined>;
// Warning: (ae-missing-release-tag) "EntityCircleCIContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityCircleCIContent: () => JSX.Element;
export { GitType };
// Warning: (ae-missing-release-tag) "isCircleCIAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const isCircleCIAvailable: (entity: Entity) => boolean;
export { isCircleCIAvailable };
export { isCircleCIAvailable as isPluginApplicableToEntity };
// 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: () => JSX.Element;
```
+12 -9
View File
@@ -28,28 +28,31 @@ import {
} from 'circleci-api';
import { createApiRef, DiscoveryApi } from '@backstage/core-plugin-api';
/** @public */
export { GitType };
/** @public */
export type { BuildWithSteps, BuildStepAction, BuildSummary };
/** @public */
export const circleCIApiRef = createApiRef<CircleCIApi>({
id: 'plugin.circleci.service',
});
const DEFAULT_PROXY_PATH = '/circleci/api';
type Options = {
discoveryApi: DiscoveryApi;
/**
* Path to use for requests via the proxy, defaults to /circleci/api
*/
proxyPath?: string;
};
/** @public */
export class CircleCIApi {
private readonly discoveryApi: DiscoveryApi;
private readonly proxyPath: string;
constructor(options: Options) {
constructor(options: {
discoveryApi: DiscoveryApi;
/**
* Path to use for requests via the proxy, defaults to /circleci/api
*/
proxyPath?: string;
}) {
this.discoveryApi = options.discoveryApi;
this.proxyPath = options.proxyPath ?? DEFAULT_PROXY_PATH;
}
+2 -1
View File
@@ -14,7 +14,8 @@
* limitations under the License.
*/
export { CircleCIApi, circleCIApiRef, GitType } from './CircleCIApi';
export type { GitType } from './CircleCIApi';
export { CircleCIApi, circleCIApiRef } from './CircleCIApi';
export type {
BuildWithSteps,
BuildStepAction,
@@ -24,9 +24,11 @@ import { Entity } from '@backstage/catalog-model';
import { useEntity } from '@backstage/plugin-catalog-react';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
/** @public */
export const isCircleCIAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]);
/** @public */
export const Router = () => {
const { entity } = useEntity();
+1
View File
@@ -14,4 +14,5 @@
* limitations under the License.
*/
/** @public */
export const CIRCLECI_ANNOTATION = 'circleci.com/project-slug';
+2
View File
@@ -23,6 +23,7 @@ import {
createRoutableExtension,
} from '@backstage/core-plugin-api';
/** @public */
export const circleCIPlugin = createPlugin({
id: 'circleci',
apis: [
@@ -34,6 +35,7 @@ export const circleCIPlugin = createPlugin({
],
});
/** @public */
export const EntityCircleCIContent = circleCIPlugin.provide(
createRoutableExtension({
name: 'EntityCircleCIContent',
+2
View File
@@ -16,10 +16,12 @@
import { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';
/** @public */
export const circleCIRouteRef = createRouteRef({
id: 'circle-ci',
});
/** @public */
export const circleCIBuildRouteRef = createSubRouteRef({
id: 'circle-ci/build',
parent: circleCIRouteRef,
-52
View File
@@ -11,8 +11,6 @@ import { Entity } from '@backstage/catalog-model';
import { OAuthApi } from '@backstage/core-plugin-api';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "ActionsGetWorkflowResponseData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ActionsGetWorkflowResponseData = {
id: string;
@@ -37,16 +35,12 @@ export type ActionsGetWorkflowResponseData = {
timing: Timing2;
};
// Warning: (ae-missing-release-tag) "ActionsListWorkflowRunsForRepoResponseData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ActionsListWorkflowRunsForRepoResponseData {
// (undocumented)
builds: ActionsGetWorkflowResponseData[];
}
// Warning: (ae-missing-release-tag) "BUILD" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface BUILD {
// (undocumented)
@@ -55,8 +49,6 @@ export interface BUILD {
startTime: string;
}
// Warning: (ae-missing-release-tag) "CLOUDBUILD_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CLOUDBUILD_ANNOTATION = 'google.com/cloudbuild-project-slug';
@@ -79,8 +71,6 @@ export type CloudbuildApi = {
}) => Promise<any>;
};
// Warning: (ae-missing-release-tag) "cloudbuildApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const cloudbuildApiRef: ApiRef<CloudbuildApi>;
@@ -107,8 +97,6 @@ export class CloudbuildClient implements CloudbuildApi {
reRunWorkflow(options: { projectId: string; runId: string }): Promise<void>;
}
// Warning: (ae-missing-release-tag) "cloudbuildPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const cloudbuildPlugin: BackstagePlugin<
{
@@ -120,27 +108,19 @@ const cloudbuildPlugin: BackstagePlugin<
export { cloudbuildPlugin };
export { cloudbuildPlugin as plugin };
// Warning: (ae-missing-release-tag) "EntityCloudbuildContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityCloudbuildContent: () => JSX.Element;
// Warning: (ae-missing-release-tag) "EntityLatestCloudbuildRunCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityLatestCloudbuildRunCard: (props: {
branch: string;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "EntityLatestCloudbuildsForBranchCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityLatestCloudbuildsForBranchCard: (props: {
branch: string;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "FETCHSOURCE" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface FETCHSOURCE {
// (undocumented)
@@ -149,27 +129,19 @@ export interface FETCHSOURCE {
startTime: string;
}
// Warning: (ae-missing-release-tag) "isCloudbuildAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const isCloudbuildAvailable: (entity: Entity) => boolean;
export { isCloudbuildAvailable };
export { isCloudbuildAvailable as isPluginApplicableToEntity };
// Warning: (ae-missing-release-tag) "LatestWorkflowRunCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LatestWorkflowRunCard: (props: { branch: string }) => JSX.Element;
// Warning: (ae-missing-release-tag) "LatestWorkflowsForBranchCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LatestWorkflowsForBranchCard: (props: {
branch: string;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "Options" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Options {
// (undocumented)
@@ -182,8 +154,6 @@ export interface Options {
substitutionOption: string;
}
// Warning: (ae-missing-release-tag) "PullTiming" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface PullTiming {
// (undocumented)
@@ -192,8 +162,6 @@ export interface PullTiming {
startTime: string;
}
// Warning: (ae-missing-release-tag) "ResolvedStorageSource" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ResolvedStorageSource {
// (undocumented)
@@ -204,8 +172,6 @@ export interface ResolvedStorageSource {
object: string;
}
// Warning: (ae-missing-release-tag) "Results" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Results {
// (undocumented)
@@ -214,21 +180,15 @@ export interface Results {
buildStepOutputs: string[];
}
// 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: () => JSX.Element;
// Warning: (ae-missing-release-tag) "Source" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Source {
// (undocumented)
storageSource: StorageSource;
}
// Warning: (ae-missing-release-tag) "SourceProvenance" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface SourceProvenance {
// (undocumented)
@@ -237,8 +197,6 @@ export interface SourceProvenance {
resolvedStorageSource: {};
}
// Warning: (ae-missing-release-tag) "Step" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Step {
// (undocumented)
@@ -263,8 +221,6 @@ export interface Step {
waitFor: string[];
}
// Warning: (ae-missing-release-tag) "StorageSource" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface StorageSource {
// (undocumented)
@@ -273,8 +229,6 @@ export interface StorageSource {
object: string;
}
// Warning: (ae-missing-release-tag) "Substitutions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Substitutions {
// (undocumented)
@@ -289,8 +243,6 @@ export interface Substitutions {
SHORT_SHA: string;
}
// Warning: (ae-missing-release-tag) "Timing" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Timing {
// (undocumented)
@@ -299,8 +251,6 @@ export interface Timing {
startTime: string;
}
// Warning: (ae-missing-release-tag) "Timing2" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Timing2 {
// (undocumented)
@@ -309,8 +259,6 @@ export interface Timing2 {
FETCHSOURCE: FETCHSOURCE;
}
// Warning: (ae-missing-release-tag) "Volume" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface Volume {
// (undocumented)
@@ -20,6 +20,7 @@ import {
} from '../api/types';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export const cloudbuildApiRef = createApiRef<CloudbuildApi>({
id: 'plugin.cloudbuild.service',
});
+16
View File
@@ -14,10 +14,12 @@
* limitations under the License.
*/
/** @public */
export interface ActionsListWorkflowRunsForRepoResponseData {
builds: ActionsGetWorkflowResponseData[];
}
/** @public */
export type ActionsGetWorkflowResponseData = {
id: string;
status: string;
@@ -41,6 +43,7 @@ export type ActionsGetWorkflowResponseData = {
timing: Timing2;
};
/** @public */
export interface Step {
name: string;
args: string[];
@@ -54,16 +57,19 @@ export interface Step {
pullTiming: PullTiming;
}
/** @public */
export interface Timing2 {
BUILD: BUILD;
FETCHSOURCE: FETCHSOURCE;
}
/** @public */
export interface SourceProvenance {
resolvedStorageSource: {};
fileHashes: {};
}
/** @public */
export interface Options {
machineType: string;
substitutionOption: string;
@@ -71,6 +77,7 @@ export interface Options {
dynamicSubstitutions: boolean;
}
/** @public */
export interface Substitutions {
COMMIT_SHA: string;
SHORT_SHA: string;
@@ -79,45 +86,54 @@ export interface Substitutions {
REVISION_ID: string;
}
/** @public */
export interface Results {
buildStepImages: string[];
buildStepOutputs: string[];
}
/** @public */
export interface BUILD {
startTime: string;
endTime: string;
}
/** @public */
export interface FETCHSOURCE {
startTime: string;
endTime: string;
}
/** @public */
export interface StorageSource {
bucket: string;
object: string;
}
/** @public */
export interface Source {
storageSource: StorageSource;
}
/** @public */
export interface Volume {
name: string;
path: string;
}
/** @public */
export interface Timing {
startTime: string;
endTime: string;
}
/** @public */
export interface PullTiming {
startTime: string;
endTime: string;
}
/** @public */
export interface ResolvedStorageSource {
bucket: string;
object: string;
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useEffect } from 'react';
import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';
import { WorkflowRunsTable } from '../WorkflowRunsTable';
@@ -72,6 +73,7 @@ const WidgetContent = ({
);
};
/** @public */
export const LatestWorkflowRunCard = (props: { branch: string }) => {
const { branch = 'master' } = props;
const { entity } = useEntity();
@@ -100,6 +102,7 @@ export const LatestWorkflowRunCard = (props: { branch: string }) => {
);
};
/** @public */
export const LatestWorkflowsForBranchCard = (props: { branch: string }) => {
const { branch = 'master' } = props;
const { entity } = useEntity();
@@ -13,4 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { LatestWorkflowRunCard, LatestWorkflowsForBranchCard } from './Cards';
@@ -23,9 +23,11 @@ import { WorkflowRunsTable } from './WorkflowRunsTable';
import { CLOUDBUILD_ANNOTATION } from './useProjectName';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
/** @public */
export const isCloudbuildAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[CLOUDBUILD_ANNOTATION]);
/** @public */
export const Router = () => {
const { entity } = useEntity();
@@ -17,6 +17,7 @@
import useAsync from 'react-use/lib/useAsync';
import { Entity } from '@backstage/catalog-model';
/** @public */
export const CLOUDBUILD_ANNOTATION = 'google.com/cloudbuild-project-slug';
export const useProjectName = (entity: Entity) => {
+4
View File
@@ -23,6 +23,7 @@ import {
createComponentExtension,
} from '@backstage/core-plugin-api';
/** @public */
export const cloudbuildPlugin = createPlugin({
id: 'cloudbuild',
apis: [
@@ -39,6 +40,7 @@ export const cloudbuildPlugin = createPlugin({
},
});
/** @public */
export const EntityCloudbuildContent = cloudbuildPlugin.provide(
createRoutableExtension({
name: 'EntityCloudbuildContent',
@@ -47,6 +49,7 @@ export const EntityCloudbuildContent = cloudbuildPlugin.provide(
}),
);
/** @public */
export const EntityLatestCloudbuildRunCard = cloudbuildPlugin.provide(
createComponentExtension({
name: 'EntityLatestCloudbuildRunCard',
@@ -57,6 +60,7 @@ export const EntityLatestCloudbuildRunCard = cloudbuildPlugin.provide(
}),
);
/** @public */
export const EntityLatestCloudbuildsForBranchCard = cloudbuildPlugin.provide(
createComponentExtension({
name: 'EntityLatestCloudbuildsForBranchCard',
+1 -21
View File
@@ -11,21 +11,15 @@ import { DiscoveryApi } from '@backstage/core-plugin-api';
import { FetchApi } from '@backstage/core-plugin-api';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-missing-release-tag) "CodeClimateApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface CodeClimateApi {
// (undocumented)
fetchData(repoID: string): Promise<CodeClimateData>;
}
// Warning: (ae-missing-release-tag) "codeClimateApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const codeClimateApiRef: ApiRef<CodeClimateApi>;
// Warning: (ae-missing-release-tag) "CodeClimateData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CodeClimateData = {
repoID: string;
@@ -42,8 +36,6 @@ export type CodeClimateData = {
numberOfOtherIssues: number;
};
// Warning: (ae-missing-release-tag) "codeClimatePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const codeClimatePlugin: BackstagePlugin<
{
@@ -53,30 +45,18 @@ export const codeClimatePlugin: BackstagePlugin<
{}
>;
// Warning: (ae-missing-release-tag) "EntityCodeClimateCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityCodeClimateCard: () => JSX.Element;
// Warning: (ae-missing-release-tag) "MockCodeClimateApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class MockCodeClimateApi implements CodeClimateApi {
// (undocumented)
fetchData(): Promise<CodeClimateData>;
}
// Warning: (ae-missing-release-tag) "mockData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const mockData: CodeClimateData;
// Warning: (ae-missing-release-tag) "ProductionCodeClimateApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class ProductionCodeClimateApi implements CodeClimateApi {
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
constructor(options: Options);
constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi });
// (undocumented)
fetchAllData(options: {
apiUrl: string;
@@ -17,10 +17,12 @@
import { CodeClimateData } from './code-climate-data';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export const codeClimateApiRef = createApiRef<CodeClimateApi>({
id: 'plugin.code-climate.service',
});
/** @public */
export interface CodeClimateApi {
fetchData(repoID: string): Promise<CodeClimateData>;
}
@@ -164,6 +164,7 @@ export type CodeClimateIssuesData = {
meta: { current_page: number; total_pages: number; total_count: number };
};
/** @public */
export type CodeClimateData = {
repoID: string;
maintainability: {
@@ -14,5 +14,4 @@
* limitations under the License.
*/
export { mockData } from './mock-api';
export { MockCodeClimateApi } from './mock-api';
@@ -47,6 +47,7 @@ export const mockData: CodeClimateData = {
numberOfOtherIssues: 26,
};
/** @public */
export class MockCodeClimateApi implements CodeClimateApi {
fetchData(): Promise<CodeClimateData> {
return new Promise(resolve => {
@@ -34,16 +34,12 @@ const codeSmellsQuery = `${basicIssuesOptions}&${categoriesFilter}=Complexity`;
const duplicationQuery = `${basicIssuesOptions}&${categoriesFilter}=Duplication`;
const otherIssuesQuery = `${basicIssuesOptions}&${categoriesFilter}=Bug%20Risk`;
type Options = {
discoveryApi: DiscoveryApi;
fetchApi: FetchApi;
};
/** @public */
export class ProductionCodeClimateApi implements CodeClimateApi {
private readonly discoveryApi: DiscoveryApi;
private readonly fetchApi: FetchApi;
constructor(options: Options) {
constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }) {
this.discoveryApi = options.discoveryApi;
this.fetchApi = options.fetchApi;
}
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { CodeClimateTable } from './CodeClimateTable';
import { mockData } from '../../api/mock';
import { mockData } from '../../api/mock/mock-api';
import { ThemeProvider } from '@material-ui/core';
import { lightTheme } from '@backstage/theme';
+2
View File
@@ -30,6 +30,7 @@ export const rootRouteRef = createRouteRef({
id: 'code-climate',
});
/** @public */
export const codeClimatePlugin = createPlugin({
id: 'code-climate',
apis: [
@@ -48,6 +49,7 @@ export const codeClimatePlugin = createPlugin({
},
});
/** @public */
export const EntityCodeClimateCard = codeClimatePlugin.provide(
createComponentExtension({
name: 'EntityCodeClimateCard',
+6 -10
View File
@@ -11,28 +11,18 @@ import { Observable } from '@backstage/types';
import { RouteRef } from '@backstage/core-plugin-api';
import { Schema } from 'jsonschema';
// Warning: (ae-missing-release-tag) "ConfigSchemaApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ConfigSchemaApi {
// Warning: (ae-forgotten-export) The symbol "ConfigSchemaResult" needs to be exported by the entry point index.d.ts
//
// (undocumented)
schema$(): Observable<ConfigSchemaResult>;
}
// Warning: (ae-missing-release-tag) "configSchemaApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const configSchemaApiRef: ApiRef<ConfigSchemaApi>;
// Warning: (ae-missing-release-tag) "ConfigSchemaPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ConfigSchemaPage: () => JSX.Element;
// Warning: (ae-missing-release-tag) "configSchemaPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const configSchemaPlugin: BackstagePlugin<
{
@@ -42,6 +32,12 @@ export const configSchemaPlugin: BackstagePlugin<
{}
>;
// @public (undocumented)
export interface ConfigSchemaResult {
// (undocumented)
schema?: Schema;
}
// @public
export class StaticSchemaLoader implements ConfigSchemaApi {
constructor(options?: { url?: string });
+1 -1
View File
@@ -15,5 +15,5 @@
*/
export { configSchemaApiRef } from './types';
export type { ConfigSchemaApi } from './types';
export type { ConfigSchemaApi, ConfigSchemaResult } from './types';
export { StaticSchemaLoader } from './StaticSchemaLoader';
+3
View File
@@ -18,14 +18,17 @@ import { Schema } from 'jsonschema';
import { createApiRef } from '@backstage/core-plugin-api';
import { Observable } from '@backstage/types';
/** @public */
export interface ConfigSchemaResult {
schema?: Schema;
}
/** @public */
export interface ConfigSchemaApi {
schema$(): Observable<ConfigSchemaResult>;
}
/** @public */
export const configSchemaApiRef = createApiRef<ConfigSchemaApi>({
id: 'plugin.config-schema',
});
+2
View File
@@ -20,6 +20,7 @@ import {
createRoutableExtension,
} from '@backstage/core-plugin-api';
/** @public */
export const configSchemaPlugin = createPlugin({
id: 'config-schema',
routes: {
@@ -27,6 +28,7 @@ export const configSchemaPlugin = createPlugin({
},
});
/** @public */
export const ConfigSchemaPage = configSchemaPlugin.provide(
createRoutableExtension({
name: 'ConfigSchemaPage',
+68 -193
View File
@@ -25,8 +25,6 @@ import { SetStateAction } from 'react';
import { TooltipProps } from 'recharts';
import { TypographyProps } from '@material-ui/core';
// Warning: (ae-missing-release-tag) "Alert" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type Alert = {
title: string | JSX.Element;
@@ -43,8 +41,6 @@ export type Alert = {
onDismissed?(options: AlertOptions): Promise<Alert[]>;
};
// Warning: (ae-missing-release-tag) "AlertCost" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface AlertCost {
// (undocumented)
@@ -53,8 +49,6 @@ export interface AlertCost {
id: string;
}
// Warning: (ae-missing-release-tag) "AlertDismissFormData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface AlertDismissFormData {
// (undocumented)
@@ -65,8 +59,6 @@ export interface AlertDismissFormData {
reason: AlertDismissReason;
}
// Warning: (ae-missing-release-tag) "AlertDismissOption" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface AlertDismissOption {
// (undocumented)
@@ -75,13 +67,9 @@ export interface AlertDismissOption {
reason: string;
}
// Warning: (ae-missing-release-tag) "AlertDismissOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const AlertDismissOptions: AlertDismissOption[];
// Warning: (ae-missing-release-tag) "AlertDismissReason" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum AlertDismissReason {
// (undocumented)
@@ -98,8 +86,6 @@ export enum AlertDismissReason {
Seasonal = 'seasonal',
}
// Warning: (ae-missing-release-tag) "AlertForm" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AlertForm<
A extends Alert = any,
@@ -108,8 +94,6 @@ export type AlertForm<
AlertFormProps<A, Data> & RefAttributes<HTMLFormElement>
>;
// Warning: (ae-missing-release-tag) "AlertFormProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AlertFormProps<A extends Alert, FormData = {}> = {
alert: A;
@@ -117,8 +101,6 @@ export type AlertFormProps<A extends Alert, FormData = {}> = {
disableSubmit: (isDisabled: boolean) => void;
};
// Warning: (ae-missing-release-tag) "AlertOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface AlertOptions<T = any> {
// (undocumented)
@@ -127,29 +109,21 @@ export interface AlertOptions<T = any> {
group: string;
}
// Warning: (ae-missing-release-tag) "AlertSnoozeFormData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export interface AlertSnoozeFormData {
// (undocumented)
intervals: string;
}
// Warning: (ae-missing-release-tag) "AlertSnoozeOption" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AlertSnoozeOption = {
label: string;
duration: Duration;
};
// Warning: (ae-missing-release-tag) "AlertSnoozeOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const AlertSnoozeOptions: AlertSnoozeOption[];
// Warning: (ae-missing-release-tag) "AlertStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum AlertStatus {
// (undocumented)
@@ -160,36 +134,17 @@ export enum AlertStatus {
Snoozed = 'snoozed',
}
// Warning: (ae-missing-release-tag) "BarChart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const BarChart: ({
resources,
responsive,
displayAmount,
options,
tooltip,
onClick,
onMouseMove,
}: BarChartProps) => JSX.Element;
export const BarChart: (props: BarChartProps) => JSX.Element;
// Warning: (ae-missing-release-tag) "BarChartData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @public @deprecated (undocumented)
export interface BarChartData extends BarChartOptions {}
// Warning: (ae-missing-release-tag) "BarChartLegend" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const BarChartLegend: ({
costStart,
costEnd,
options,
children,
}: PropsWithChildren<BarChartLegendProps>) => JSX.Element;
export const BarChartLegend: (
props: PropsWithChildren<BarChartLegendProps>,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "BarChartLegendOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BarChartLegendOptions = {
previousName: string;
@@ -199,8 +154,6 @@ export type BarChartLegendOptions = {
hideMarker?: boolean;
};
// Warning: (ae-missing-release-tag) "BarChartLegendProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BarChartLegendProps = {
costStart: number;
@@ -208,8 +161,6 @@ export type BarChartLegendProps = {
options?: Partial<BarChartLegendOptions>;
};
// Warning: (ae-missing-release-tag) "BarChartOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface BarChartOptions {
// (undocumented)
@@ -222,8 +173,6 @@ export interface BarChartOptions {
previousName: string;
}
// Warning: (ae-missing-release-tag) "BarChartProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BarChartProps = {
resources: ResourceData[];
@@ -235,34 +184,21 @@ export type BarChartProps = {
onMouseMove?: RechartsFunction;
};
// Warning: (ae-missing-release-tag) "BarChartTooltip" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const BarChartTooltip: ({
title,
content,
subtitle,
topRight,
actions,
children,
}: PropsWithChildren<BarChartTooltipProps>) => JSX.Element;
export const BarChartTooltip: (
props: PropsWithChildren<BarChartTooltipProps>,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "BarChartTooltipItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const BarChartTooltipItem: ({
item,
}: BarChartTooltipItemProps) => JSX.Element;
export const BarChartTooltipItem: (
props: BarChartTooltipItemProps,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "BarChartTooltipItemProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BarChartTooltipItemProps = {
item: TooltipItem;
};
// Warning: (ae-missing-release-tag) "BarChartTooltipProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type BarChartTooltipProps = {
title: string;
@@ -272,13 +208,9 @@ export type BarChartTooltipProps = {
actions?: ReactNode;
};
// Warning: (ae-missing-release-tag) "ChangeStatistic" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type ChangeStatistic = common.ChangeStatistic;
// Warning: (ae-missing-release-tag) "ChangeThreshold" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum ChangeThreshold {
// (undocumented)
@@ -295,28 +227,26 @@ export type ChartData = {
[key: string]: number;
};
// Warning: (ae-missing-release-tag) "Cost" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ConfigContextProps = {
metrics: Metric[];
products: Product[];
icons: Icon[];
engineerCost: number;
currencies: Currency[];
};
// @public @deprecated (undocumented)
export type Cost = common.Cost;
// Warning: (ae-missing-release-tag) "CostGrowth" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CostGrowth: ({ change, duration }: CostGrowthProps) => JSX.Element;
export const CostGrowth: (props: CostGrowthProps) => JSX.Element;
// Warning: (ae-missing-release-tag) "CostGrowthIndicator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CostGrowthIndicator: ({
change,
formatter,
className,
...props
}: CostGrowthIndicatorProps) => JSX.Element;
export const CostGrowthIndicator: (
props: CostGrowthIndicatorProps,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "CostGrowthIndicatorProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CostGrowthIndicatorProps = TypographyProps & {
change: ChangeStatistic;
@@ -328,16 +258,12 @@ export type CostGrowthIndicatorProps = TypographyProps & {
) => Maybe<string>;
};
// Warning: (ae-missing-release-tag) "CostGrowthProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CostGrowthProps = {
change: ChangeStatistic;
duration: Duration;
};
// Warning: (ae-missing-release-tag) "CostInsightsApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CostInsightsApi = {
getLastCompleteBillingDate(): Promise<string>;
@@ -350,36 +276,36 @@ export type CostInsightsApi = {
getAlerts(group: string): Promise<Alert[]>;
};
// Warning: (ae-missing-release-tag) "costInsightsApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const costInsightsApiRef: ApiRef<CostInsightsApi>;
// Warning: (ae-missing-release-tag) "CostInsightsLabelDataflowInstructionsPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CostInsightsLabelDataflowInstructionsPage: () => JSX.Element;
// Warning: (ae-missing-release-tag) "CostInsightsPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CostInsightsPage: () => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "CostInsightsPaletteAdditions" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "CostInsightsPalette" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CostInsightsPalette = BackstagePalette &
CostInsightsPaletteAdditions;
// Warning: (ae-missing-release-tag) "CostInsightsPaletteOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CostInsightsPaletteAdditions = {
blue: string;
lightBlue: string;
darkBlue: string;
magenta: string;
yellow: string;
tooltip: CostInsightsTooltipOptions;
navigationText: string;
alertBackground: string;
dataViz: string[];
};
// @public (undocumented)
export type CostInsightsPaletteOptions = PaletteOptions &
CostInsightsPaletteAdditions;
// Warning: (ae-missing-release-tag) "costInsightsPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
const costInsightsPlugin: BackstagePlugin<
{
@@ -393,27 +319,27 @@ const costInsightsPlugin: BackstagePlugin<
export { costInsightsPlugin };
export { costInsightsPlugin as plugin };
// Warning: (ae-missing-release-tag) "CostInsightsProjectGrowthInstructionsPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const CostInsightsProjectGrowthInstructionsPage: () => JSX.Element;
// Warning: (ae-missing-release-tag) "CostInsightsTheme" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface CostInsightsTheme extends BackstageTheme {
// (undocumented)
palette: CostInsightsPalette;
}
// Warning: (ae-missing-release-tag) "CostInsightsThemeOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface CostInsightsThemeOptions extends PaletteOptions {
// (undocumented)
palette: CostInsightsPaletteOptions;
}
// @public (undocumented)
export type CostInsightsTooltipOptions = {
background: string;
color: string;
};
// @public (undocumented)
export interface Currency {
// (undocumented)
@@ -428,8 +354,12 @@ export interface Currency {
unit: string;
}
// Warning: (ae-missing-release-tag) "CurrencyType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CurrencyContextProps = {
currency: Currency;
setCurrency: Dispatch<SetStateAction<Currency>>;
};
// @public (undocumented)
export enum CurrencyType {
// (undocumented)
@@ -442,8 +372,6 @@ export enum CurrencyType {
USD = 'USD',
}
// Warning: (ae-missing-release-tag) "DataKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum DataKey {
// (undocumented)
@@ -454,13 +382,9 @@ export enum DataKey {
Previous = 'previous',
}
// Warning: (ae-missing-release-tag) "DateAggregation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type DateAggregation = common.DateAggregation;
// Warning: (ae-missing-release-tag) "DEFAULT_DATE_FORMAT" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const DEFAULT_DATE_FORMAT = 'yyyy-LL-dd';
@@ -476,18 +400,12 @@ export enum Duration {
P90D = 'P90D',
}
// Warning: (ae-missing-release-tag) "EngineerThreshold" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EngineerThreshold = 0.5;
// Warning: (ae-missing-release-tag) "Entity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Entity = common.Entity;
// Warning: (ae-missing-release-tag) "ExampleCostInsightsClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class ExampleCostInsightsClient implements CostInsightsApi {
// (undocumented)
@@ -508,13 +426,9 @@ export class ExampleCostInsightsClient implements CostInsightsApi {
getUserGroups(userId: string): Promise<Group[]>;
}
// Warning: (ae-missing-release-tag) "Group" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Group = common.Group;
// Warning: (ae-missing-release-tag) "GrowthType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum GrowthType {
// (undocumented)
@@ -525,16 +439,12 @@ export enum GrowthType {
Savings = 1,
}
// Warning: (ae-missing-release-tag) "Icon" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Icon = {
kind: string;
component: JSX.Element;
};
// Warning: (ae-missing-release-tag) "IconType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum IconType {
// (undocumented)
@@ -551,18 +461,11 @@ export enum IconType {
Storage = 'storage',
}
// Warning: (ae-missing-release-tag) "LegendItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LegendItem: ({
title,
tooltipText,
markerColor,
children,
}: PropsWithChildren<LegendItemProps>) => JSX.Element;
export const LegendItem: (
props: PropsWithChildren<LegendItemProps>,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "LegendItemProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type LegendItemProps = {
title: string;
@@ -570,43 +473,37 @@ export type LegendItemProps = {
markerColor?: string;
};
// Warning: (ae-missing-release-tag) "Loading" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Loading = Record<string, boolean>;
// Warning: (ae-missing-release-tag) "Maybe" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Maybe<T> = common.Maybe<T>;
// Warning: (ae-missing-release-tag) "Metric" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Metric = common.Metric;
// Warning: (ae-missing-release-tag) "MetricData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type MetricData = common.MetricData;
// Warning: (ae-forgotten-export) The symbol "MockConfigProviderProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "MockConfigProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const MockConfigProvider: ({
children,
...context
}: MockConfigProviderProps) => JSX.Element;
export const MockConfigProvider: (
props: MockConfigProviderProps,
) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "MockCurrencyProviderProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "MockCurrencyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const MockCurrencyProvider: ({
children,
...context
}: MockCurrencyProviderProps) => JSX.Element;
export type MockConfigProviderProps = PropsWithChildren<
Partial<ConfigContextProps>
>;
// @public (undocumented)
export const MockCurrencyProvider: (
props: MockCurrencyProviderProps,
) => JSX.Element;
// @public (undocumented)
export type MockCurrencyProviderProps = PropsWithChildren<
Partial<CurrencyContextProps>
>;
// @public (undocumented)
export interface PageFilters {
@@ -620,16 +517,12 @@ export interface PageFilters {
project: Maybe_2<string>;
}
// Warning: (ae-missing-release-tag) "Product" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Product = common.Product;
// @public (undocumented)
export type ProductFilters = Array<ProductPeriod>;
// Warning: (ae-missing-release-tag) "ProductInsightsOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ProductInsightsOptions = {
product: string;
@@ -646,13 +539,9 @@ export interface ProductPeriod {
productType: string;
}
// Warning: (ae-missing-release-tag) "Project" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Project = common.Project;
// Warning: (ae-missing-release-tag) "ProjectGrowthAlert" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class ProjectGrowthAlert implements Alert {
constructor(data: ProjectGrowthData);
@@ -668,8 +557,6 @@ export class ProjectGrowthAlert implements Alert {
get url(): string;
}
// Warning: (ae-missing-release-tag) "ProjectGrowthData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ProjectGrowthData {
// (undocumented)
@@ -686,8 +573,6 @@ export interface ProjectGrowthData {
project: string;
}
// Warning: (ae-missing-release-tag) "ResourceData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ResourceData {
// (undocumented)
@@ -698,8 +583,6 @@ export interface ResourceData {
previous: number;
}
// Warning: (ae-missing-release-tag) "TooltipItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type TooltipItem = {
fill: string;
@@ -707,13 +590,9 @@ export type TooltipItem = {
value: string;
};
// Warning: (ae-missing-release-tag) "Trendline" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type Trendline = common.Trendline;
// Warning: (ae-missing-release-tag) "UnlabeledDataflowAlert" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class UnlabeledDataflowAlert implements Alert {
constructor(data: UnlabeledDataflowData);
@@ -731,8 +610,6 @@ export class UnlabeledDataflowAlert implements Alert {
get url(): string;
}
// Warning: (ae-missing-release-tag) "UnlabeledDataflowAlertProject" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface UnlabeledDataflowAlertProject {
// (undocumented)
@@ -743,8 +620,6 @@ export interface UnlabeledDataflowAlertProject {
unlabeledCost: number;
}
// Warning: (ae-missing-release-tag) "UnlabeledDataflowData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface UnlabeledDataflowData {
// (undocumented)
@@ -22,8 +22,9 @@ import { Alert, ProjectGrowthData } from '../types';
* The alert below is an example of an Alert implementation; the CostInsightsApi permits returning
* any implementation of the Alert type, so adopters can create their own. The CostInsightsApi
* fetches alert data from the backend, then creates Alert classes with the data.
*
* @public
*/
export class ProjectGrowthAlert implements Alert {
data: ProjectGrowthData;
@@ -22,8 +22,9 @@ import { Alert, AlertStatus, UnlabeledDataflowData } from '../types';
* The alert below is an example of an Alert implementation; the CostInsightsApi permits returning
* any implementation of the Alert type, so adopters can create their own. The CostInsightsApi
* fetches alert data from the backend, then creates Alert classes with the data.
*
* @public
*/
export class UnlabeledDataflowAlert implements Alert {
data: UnlabeledDataflowData;
status?: AlertStatus;
@@ -25,6 +25,7 @@ import {
} from '../types';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export type ProductInsightsOptions = {
/**
* The product from the cost-insights configuration in app-config.yaml
@@ -47,6 +48,7 @@ export type ProductInsightsOptions = {
project: Maybe<string>;
};
/** @public */
export type CostInsightsApi = {
/**
* Get the most current date for which billing data is complete, in YYYY-MM-DD format. This helps
@@ -146,6 +148,7 @@ export type CostInsightsApi = {
getAlerts(group: string): Promise<Alert[]>;
};
/** @public */
export const costInsightsApiRef = createApiRef<CostInsightsApi>({
id: 'plugin.costinsights.service',
});
@@ -61,6 +61,7 @@ export const defaultTooltip: ContentRenderer<RechartsTooltipProps> = ({
);
};
/** @public */
export type BarChartProps = {
resources: ResourceData[];
responsive?: boolean;
@@ -71,15 +72,18 @@ export type BarChartProps = {
onMouseMove?: RechartsFunction;
};
export const BarChart = ({
resources,
responsive = true,
displayAmount = 6,
options = {},
tooltip = defaultTooltip,
onClick,
onMouseMove,
}: BarChartProps) => {
/** @public */
export const BarChart = (props: BarChartProps) => {
const {
resources,
responsive = true,
displayAmount = 6,
options = {},
tooltip = defaultTooltip,
onClick,
onMouseMove,
} = props;
const theme = useTheme<CostInsightsTheme>();
const styles = useBarChartStyles(theme);
const [activeChart, setActiveChart] = useState(false);
@@ -21,6 +21,7 @@ import { currencyFormatter } from '../../utils/formatters';
import { CostInsightsTheme } from '../../types';
import { useBarChartLayoutStyles as useStyles } from '../../utils/styles';
/** @public */
export type BarChartLegendOptions = {
previousName: string;
previousFill: string;
@@ -29,18 +30,19 @@ export type BarChartLegendOptions = {
hideMarker?: boolean;
};
/** @public */
export type BarChartLegendProps = {
costStart: number;
costEnd: number;
options?: Partial<BarChartLegendOptions>;
};
export const BarChartLegend = ({
costStart,
costEnd,
options = {},
children,
}: PropsWithChildren<BarChartLegendProps>) => {
/** @public */
export const BarChartLegend = (
props: PropsWithChildren<BarChartLegendProps>,
) => {
const { costStart, costEnd, options = {}, children } = props;
const theme = useTheme<CostInsightsTheme>();
const classes = useStyles();
@@ -19,6 +19,7 @@ import classnames from 'classnames';
import { Box, Divider, Typography } from '@material-ui/core';
import { useTooltipStyles as useStyles } from '../../utils/styles';
/** @public */
export type BarChartTooltipProps = {
title: string;
content?: ReactNode | string;
@@ -27,14 +28,12 @@ export type BarChartTooltipProps = {
actions?: ReactNode;
};
export const BarChartTooltip = ({
title,
content,
subtitle,
topRight,
actions,
children,
}: PropsWithChildren<BarChartTooltipProps>) => {
/** @public */
export const BarChartTooltip = (
props: PropsWithChildren<BarChartTooltipProps>,
) => {
const { title, content, subtitle, topRight, actions, children } = props;
const classes = useStyles();
const titleClassName = classnames(classes.truncate, {
[classes.maxWidth]: topRight === undefined,
@@ -19,18 +19,24 @@ import { Box, Typography } from '@material-ui/core';
import LensIcon from '@material-ui/icons/Lens';
import { useTooltipStyles as useStyles } from '../../utils/styles';
/** @public */
export type TooltipItem = {
fill: string;
label: string;
value: string;
};
/** @public */
export type BarChartTooltipItemProps = {
item: TooltipItem;
};
export const BarChartTooltipItem = ({ item }: BarChartTooltipItemProps) => {
/** @public */
export const BarChartTooltipItem = (props: BarChartTooltipItemProps) => {
const { item } = props;
const classes = useStyles();
return (
<Box
display="flex"
@@ -31,12 +31,16 @@ import { indefiniteArticleOf } from '../../utils/grammar';
import { useConfig, useCurrency } from '../../hooks';
import { notEmpty } from '../../utils/assert';
/** @public */
export type CostGrowthProps = {
change: ChangeStatistic;
duration: Duration;
};
export const CostGrowth = ({ change, duration }: CostGrowthProps) => {
/** @public */
export const CostGrowth = (props: CostGrowthProps) => {
const { change, duration } = props;
const styles = useStyles();
const { engineerCost } = useConfig();
const [currency] = useCurrency();
@@ -23,6 +23,7 @@ import { growthOf } from '../../utils/change';
import { ChangeStatistic, GrowthType, Maybe } from '../../types';
import { useCostGrowthStyles as useStyles } from '../../utils/styles';
/** @public */
export type CostGrowthIndicatorProps = TypographyProps & {
change: ChangeStatistic;
formatter?: (
@@ -31,12 +32,10 @@ export type CostGrowthIndicatorProps = TypographyProps & {
) => Maybe<string>;
};
export const CostGrowthIndicator = ({
change,
formatter,
className,
...props
}: CostGrowthIndicatorProps) => {
/** @public */
export const CostGrowthIndicator = (props: CostGrowthIndicatorProps) => {
const { change, formatter, className, ...extraProps } = props;
const classes = useStyles();
const growth = growthOf(change);
@@ -46,7 +45,7 @@ export const CostGrowthIndicator = ({
});
return (
<Typography className={classNames} component="span" {...props}>
<Typography className={classNames} component="span" {...extraProps}>
{formatter ? formatter(change, { absolute: true }) : change.ratio}
{growth === GrowthType.Excess && <ArrowDropUp aria-label="excess" />}
{growth === GrowthType.Savings && <ArrowDropDown aria-label="savings" />}
@@ -20,19 +20,19 @@ import LensIcon from '@material-ui/icons/Lens';
import HelpOutlineOutlinedIcon from '@material-ui/icons/HelpOutlineOutlined';
import { useCostGrowthLegendStyles } from '../../utils/styles';
/** @public */
export type LegendItemProps = {
title: string;
tooltipText?: string;
markerColor?: string;
};
export const LegendItem = ({
title,
tooltipText,
markerColor,
children,
}: PropsWithChildren<LegendItemProps>) => {
/** @public */
export const LegendItem = (props: PropsWithChildren<LegendItemProps>) => {
const { title, tooltipText, markerColor, children } = props;
const classes = useCostGrowthLegendStyles();
return (
<Box display="flex" flexDirection="column">
<Box
@@ -39,6 +39,7 @@ import {
trendlineOf,
} from '../testUtils';
/** @public */
export class ExampleCostInsightsClient implements CostInsightsApi {
private request(_: any, res: any): Promise<any> {
return new Promise(resolve => setTimeout(resolve, 0, res));
@@ -58,6 +58,7 @@ import { configApiRef, useApi } from '@backstage/core-plugin-api';
* rate: 3.5
*/
/** @public */
export type ConfigContextProps = {
metrics: Metric[];
products: Product[];
@@ -23,6 +23,7 @@ import React, {
import { Currency } from '../types';
import { useConfig } from './useConfig';
/** @public */
export type CurrencyContextProps = {
currency: Currency;
setCurrency: Dispatch<SetStateAction<Currency>>;
+5
View File
@@ -38,8 +38,13 @@ export {
LegendItem,
} from './components';
export { MockConfigProvider, MockCurrencyProvider } from './testUtils';
export type {
MockConfigProviderProps,
MockCurrencyProviderProps,
} from './testUtils';
export * from './api';
export * from './alerts';
export type { ConfigContextProps, CurrencyContextProps } from './hooks';
export * from './types';
export type {
+4
View File
@@ -32,6 +32,7 @@ export const unlabeledDataflowAlertRef = createRouteRef({
id: 'cost-insights:labeling-jobs',
});
/** @public */
export const costInsightsPlugin = createPlugin({
id: 'cost-insights',
featureFlags: [{ name: 'cost-insights-currencies' }],
@@ -42,6 +43,7 @@ export const costInsightsPlugin = createPlugin({
},
});
/** @public */
export const CostInsightsPage = costInsightsPlugin.provide(
createRoutableExtension({
name: 'CostInsightsPage',
@@ -51,6 +53,7 @@ export const CostInsightsPage = costInsightsPlugin.provide(
}),
);
/** @public */
export const CostInsightsProjectGrowthInstructionsPage =
costInsightsPlugin.provide(
createRoutableExtension({
@@ -63,6 +66,7 @@ export const CostInsightsProjectGrowthInstructionsPage =
}),
);
/** @public */
export const CostInsightsLabelDataflowInstructionsPage =
costInsightsPlugin.provide(
createRoutableExtension({
@@ -27,12 +27,11 @@ import {
import { ScrollContext, ScrollContextProps } from '../hooks/useScroll';
import { Group, Duration } from '../types';
type PartialPropsWithChildren<T> = PropsWithChildren<Partial<T>>;
export const MockGroups: Group[] = [{ id: 'tech' }, { id: 'mock-group' }];
export type MockFilterProviderProps =
PartialPropsWithChildren<FilterContextProps>;
export type MockFilterProviderProps = PropsWithChildren<
Partial<FilterContextProps>
>;
export const MockFilterProvider = ({
children,
@@ -56,8 +55,9 @@ export const MockFilterProvider = ({
);
};
export type MockLoadingProviderProps =
PartialPropsWithChildren<LoadingContextProps>;
export type MockLoadingProviderProps = PropsWithChildren<
Partial<LoadingContextProps>
>;
export const MockLoadingProvider = ({
children,
@@ -75,13 +75,15 @@ export const MockLoadingProvider = ({
);
};
export type MockConfigProviderProps =
PartialPropsWithChildren<ConfigContextProps>;
/** @public */
export type MockConfigProviderProps = PropsWithChildren<
Partial<ConfigContextProps>
>;
/** @public */
export const MockConfigProvider = (props: MockConfigProviderProps) => {
const { children, ...context } = props;
export const MockConfigProvider = ({
children,
...context
}: MockConfigProviderProps) => {
const defaultContext: ConfigContextProps = {
metrics: [],
products: [],
@@ -89,6 +91,7 @@ export const MockConfigProvider = ({
engineerCost: 0,
currencies: [],
};
return (
<ConfigContext.Provider value={{ ...defaultContext, ...context }}>
{children}
@@ -96,13 +99,15 @@ export const MockConfigProvider = ({
);
};
export type MockCurrencyProviderProps =
PartialPropsWithChildren<CurrencyContextProps>;
/** @public */
export type MockCurrencyProviderProps = PropsWithChildren<
Partial<CurrencyContextProps>
>;
/** @public */
export const MockCurrencyProvider = (props: MockCurrencyProviderProps) => {
const { children, ...context } = props;
export const MockCurrencyProvider = ({
children,
...context
}: MockCurrencyProviderProps) => {
const defaultContext: CurrencyContextProps = {
currency: {
kind: null,
@@ -111,6 +116,7 @@ export const MockCurrencyProvider = ({
},
setCurrency: jest.fn(),
};
return (
<CurrencyContext.Provider value={{ ...defaultContext, ...context }}>
{children}
@@ -118,8 +124,9 @@ export const MockCurrencyProvider = ({
);
};
export type MockBillingDateProviderProps =
PartialPropsWithChildren<BillingDateContextProps>;
export type MockBillingDateProviderProps = PropsWithChildren<
Partial<BillingDateContextProps>
>;
export const MockBillingDateProvider = ({
children,
@@ -149,8 +156,9 @@ export const MockScrollProvider = ({ children }: MockScrollProviderProps) => {
);
};
export type MockGroupsProviderProps =
PartialPropsWithChildren<GroupsContextProps>;
export type MockGroupsProviderProps = PropsWithChildren<
Partial<GroupsContextProps>
>;
export const MockGroupsProvider = ({
children,

Some files were not shown because too many files have changed in this diff Show More