@@ -9,8 +9,6 @@ import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Badge" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface Badge {
|
||||
color?: string;
|
||||
@@ -23,8 +21,6 @@ export interface Badge {
|
||||
style?: BadgeStyle;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BADGE_STYLES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const BADGE_STYLES: readonly [
|
||||
'plastic',
|
||||
@@ -34,8 +30,6 @@ export const BADGE_STYLES: readonly [
|
||||
'social',
|
||||
];
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeBuilder" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type BadgeBuilder = {
|
||||
getBadges(): Promise<BadgeInfo[]>;
|
||||
@@ -43,8 +37,6 @@ export type BadgeBuilder = {
|
||||
createBadgeSvg(options: BadgeOptions): Promise<string>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface BadgeContext {
|
||||
// (undocumented)
|
||||
@@ -55,39 +47,29 @@ export interface BadgeContext {
|
||||
entity?: Entity;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeFactories" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface BadgeFactories {
|
||||
// (undocumented)
|
||||
[id: string]: BadgeFactory;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface BadgeFactory {
|
||||
// (undocumented)
|
||||
createBadge(context: BadgeContext): Badge;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeInfo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type BadgeInfo = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type BadgeOptions = {
|
||||
badgeInfo: BadgeInfo;
|
||||
context: BadgeContext;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeSpec" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type BadgeSpec = {
|
||||
id: string;
|
||||
@@ -96,23 +78,15 @@ export type BadgeSpec = {
|
||||
markdown: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "BadgeStyle" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type BadgeStyle = typeof BADGE_STYLES[number];
|
||||
|
||||
// Warning: (ae-missing-release-tag) "createDefaultBadgeFactories" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const createDefaultBadgeFactories: () => BadgeFactories;
|
||||
|
||||
// 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) "DefaultBadgeBuilder" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class DefaultBadgeBuilder implements BadgeBuilder {
|
||||
constructor(factories: BadgeFactories);
|
||||
@@ -126,8 +100,6 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
|
||||
protected getMarkdownCode(params: Badge, badgeUrl: string): string;
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -31,6 +31,7 @@ function entityUrl(context: BadgeContext): string {
|
||||
return `${catalogUrl}/${entityUri}`.toLowerCase();
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export const createDefaultBadgeFactories = (): BadgeFactories => ({
|
||||
pingback: {
|
||||
createBadge: (context: BadgeContext): Badge => {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { makeBadge, Format } from 'badge-maker';
|
||||
import { BadgeBuilder, BadgeInfo, BadgeOptions, BadgeSpec } from './types';
|
||||
import { Badge, BadgeFactories } from '../../types';
|
||||
|
||||
/** @public */
|
||||
export class DefaultBadgeBuilder implements BadgeBuilder {
|
||||
constructor(private readonly factories: BadgeFactories) {}
|
||||
|
||||
|
||||
@@ -16,15 +16,18 @@
|
||||
|
||||
import { Badge, BadgeContext } from '../../types';
|
||||
|
||||
/** @public */
|
||||
export type BadgeInfo = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type BadgeOptions = {
|
||||
badgeInfo: BadgeInfo;
|
||||
context: BadgeContext;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type BadgeSpec = {
|
||||
/** Badge id */
|
||||
id: string;
|
||||
@@ -39,6 +42,7 @@ export type BadgeSpec = {
|
||||
markdown: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type BadgeBuilder = {
|
||||
getBadges(): Promise<BadgeInfo[]>;
|
||||
createBadgeJson(options: BadgeOptions): Promise<BadgeSpec>;
|
||||
|
||||
@@ -26,6 +26,7 @@ import { NotFoundError } from '@backstage/errors';
|
||||
import { BadgeBuilder, DefaultBadgeBuilder } from '../lib/BadgeBuilder';
|
||||
import { BadgeContext, BadgeFactories } from '../types';
|
||||
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
badgeBuilder?: BadgeBuilder;
|
||||
badgeFactories?: BadgeFactories;
|
||||
@@ -34,6 +35,7 @@ export interface RouterOptions {
|
||||
discovery: PluginEndpointDiscovery;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export async function createRouter(
|
||||
options: RouterOptions,
|
||||
): Promise<express.Router> {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { Config } from '@backstage/config';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
/** @public */
|
||||
export const BADGE_STYLES = [
|
||||
'plastic',
|
||||
'flat',
|
||||
@@ -24,8 +25,11 @@ export const BADGE_STYLES = [
|
||||
'for-the-badge',
|
||||
'social',
|
||||
] as const;
|
||||
|
||||
/** @public */
|
||||
export type BadgeStyle = typeof BADGE_STYLES[number];
|
||||
|
||||
/** @public */
|
||||
export interface Badge {
|
||||
/** Badge message background color. */
|
||||
color?: string;
|
||||
@@ -48,16 +52,19 @@ export interface Badge {
|
||||
style?: BadgeStyle;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BadgeContext {
|
||||
badgeUrl: string;
|
||||
config: Config;
|
||||
entity?: Entity; // for entity badges
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BadgeFactory {
|
||||
createBadge(context: BadgeContext): Badge;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BadgeFactories {
|
||||
[id: string]: BadgeFactory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user