Merge pull request #33392 from backstage/rugvip/fix-api-review-items-1-3-5
frontend-plugin-api, frontend-app-api: API review cleanup
This commit is contained in:
@@ -765,13 +765,45 @@ export function createFrontendPlugin<
|
||||
[name in string]: ExternalRouteRef;
|
||||
} = {},
|
||||
>(
|
||||
options: PluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>,
|
||||
options: CreateFrontendPluginOptions<
|
||||
TId,
|
||||
TRoutes,
|
||||
TExternalRoutes,
|
||||
TExtensions
|
||||
>,
|
||||
): OverridableFrontendPlugin<
|
||||
TRoutes,
|
||||
TExternalRoutes,
|
||||
MakeSortedExtensionsMap<TExtensions[number], TId>
|
||||
>;
|
||||
|
||||
// @public
|
||||
export interface CreateFrontendPluginOptions<
|
||||
TId extends string,
|
||||
TRoutes extends {
|
||||
[name in string]: RouteRef | SubRouteRef;
|
||||
},
|
||||
TExternalRoutes extends {
|
||||
[name in string]: ExternalRouteRef;
|
||||
},
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> {
|
||||
// (undocumented)
|
||||
extensions?: TExtensions;
|
||||
// (undocumented)
|
||||
externalRoutes?: TExternalRoutes;
|
||||
// (undocumented)
|
||||
featureFlags?: FeatureFlagConfig[];
|
||||
icon?: IconElement;
|
||||
// (undocumented)
|
||||
info?: FrontendPluginInfoOptions;
|
||||
// (undocumented)
|
||||
pluginId: TId;
|
||||
// (undocumented)
|
||||
routes?: TRoutes;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function createRouteRef<
|
||||
TParams extends
|
||||
@@ -1931,8 +1963,8 @@ export const pluginHeaderActionsApiRef: ApiRef_2<
|
||||
readonly $$type: '@backstage/ApiRef';
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface PluginOptions<
|
||||
// @public @deprecated (undocumented)
|
||||
export type PluginOptions<
|
||||
TId extends string,
|
||||
TRoutes extends {
|
||||
[name in string]: RouteRef | SubRouteRef;
|
||||
@@ -1941,22 +1973,7 @@ export interface PluginOptions<
|
||||
[name in string]: ExternalRouteRef;
|
||||
},
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> {
|
||||
// (undocumented)
|
||||
extensions?: TExtensions;
|
||||
// (undocumented)
|
||||
externalRoutes?: TExternalRoutes;
|
||||
// (undocumented)
|
||||
featureFlags?: FeatureFlagConfig[];
|
||||
icon?: IconElement;
|
||||
// (undocumented)
|
||||
info?: FrontendPluginInfoOptions;
|
||||
// (undocumented)
|
||||
pluginId: TId;
|
||||
// (undocumented)
|
||||
routes?: TRoutes;
|
||||
title?: string;
|
||||
}
|
||||
> = CreateFrontendPluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>;
|
||||
|
||||
// @public
|
||||
export type PluginWrapperApi = {
|
||||
@@ -2039,19 +2056,6 @@ export const Progress: {
|
||||
// @public (undocumented)
|
||||
export type ProgressProps = {};
|
||||
|
||||
// @public
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
[name in string]: ExtensionInput;
|
||||
},
|
||||
> = {
|
||||
[InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']
|
||||
? Array<Expand<ResolvedExtensionInput<TInputs[InputName]>>>
|
||||
: false extends TInputs[InputName]['config']['optional']
|
||||
? Expand<ResolvedExtensionInput<TInputs[InputName]>>
|
||||
: Expand<ResolvedExtensionInput<TInputs[InputName]> | undefined>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type RouteFunc<TParams extends AnyRouteRefParams> = (
|
||||
...input: TParams extends undefined ? readonly [] : readonly [params: TParams]
|
||||
|
||||
@@ -53,7 +53,8 @@ type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> =
|
||||
|
||||
/**
|
||||
* Converts an extension input map into a matching collection of resolved inputs.
|
||||
* @public
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
|
||||
@@ -170,8 +170,12 @@ export interface FrontendPlugin<
|
||||
info(): Promise<FrontendPluginInfo>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface PluginOptions<
|
||||
/**
|
||||
* Options for {@link createFrontendPlugin}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CreateFrontendPluginOptions<
|
||||
TId extends string,
|
||||
TRoutes extends { [name in string]: RouteRef | SubRouteRef },
|
||||
TExternalRoutes extends { [name in string]: ExternalRouteRef },
|
||||
@@ -194,6 +198,17 @@ export interface PluginOptions<
|
||||
info?: FrontendPluginInfoOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link CreateFrontendPluginOptions} instead.
|
||||
* @public
|
||||
*/
|
||||
export type PluginOptions<
|
||||
TId extends string,
|
||||
TRoutes extends { [name in string]: RouteRef | SubRouteRef },
|
||||
TExternalRoutes extends { [name in string]: ExternalRouteRef },
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
> = CreateFrontendPluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>;
|
||||
|
||||
/**
|
||||
* Creates a new plugin that can be installed in a Backstage app.
|
||||
*
|
||||
@@ -230,7 +245,12 @@ export function createFrontendPlugin<
|
||||
TRoutes extends { [name in string]: RouteRef | SubRouteRef } = {},
|
||||
TExternalRoutes extends { [name in string]: ExternalRouteRef } = {},
|
||||
>(
|
||||
options: PluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>,
|
||||
options: CreateFrontendPluginOptions<
|
||||
TId,
|
||||
TRoutes,
|
||||
TExternalRoutes,
|
||||
TExtensions
|
||||
>,
|
||||
): OverridableFrontendPlugin<
|
||||
TRoutes,
|
||||
TExternalRoutes,
|
||||
|
||||
@@ -22,7 +22,6 @@ export {
|
||||
type ExtensionDefinitionParameters,
|
||||
type CreateExtensionOptions,
|
||||
type OverridableExtensionDefinition,
|
||||
type ResolvedExtensionInputs,
|
||||
} from './createExtension';
|
||||
export {
|
||||
createExtensionInput,
|
||||
@@ -36,6 +35,7 @@ export {
|
||||
} from './createExtensionDataRef';
|
||||
export {
|
||||
createFrontendPlugin,
|
||||
type CreateFrontendPluginOptions,
|
||||
type FrontendPlugin,
|
||||
type OverridableFrontendPlugin,
|
||||
type PluginOptions,
|
||||
|
||||
Reference in New Issue
Block a user