Merge pull request #33367 from backstage/rugvip/reduce-frontend-plugin-api-surface
frontend-plugin-api: reduce top-level API surface clutter
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/frontend-plugin-api': minor
|
||||
---
|
||||
|
||||
Removed the `ResolvedExtensionInput` and `ExtensionDataRefToValue` helper types from the public API surface to reduce top-level API clutter. These types were internal plumbing that are not needed by plugin authors. If you were relying on `ResolvedExtensionInput`, use the `ResolvedExtensionInputs` type instead, which maps a full set of inputs. If you were using `ExtensionDataRefToValue`, replace it with `ExtensionDataValue` combined with inferred types from your `ExtensionDataRef`.
|
||||
@@ -17,11 +17,10 @@
|
||||
import {
|
||||
AppNode,
|
||||
Extension,
|
||||
ExtensionDataContainer,
|
||||
ExtensionDataRef,
|
||||
ExtensionDefinition,
|
||||
ExtensionInput,
|
||||
PortableSchema,
|
||||
ResolvedExtensionInput,
|
||||
createExtension,
|
||||
createExtensionBlueprint,
|
||||
createExtensionDataRef,
|
||||
@@ -146,8 +145,8 @@ function mirrorInputs(ctx: {
|
||||
inputs: {
|
||||
[name in string]:
|
||||
| undefined
|
||||
| ResolvedExtensionInput<ExtensionInput>
|
||||
| Array<ResolvedExtensionInput<ExtensionInput>>;
|
||||
| ({ node: AppNode } & ExtensionDataContainer<ExtensionDataRef>)
|
||||
| Array<{ node: AppNode } & ExtensionDataContainer<ExtensionDataRef>>;
|
||||
};
|
||||
}) {
|
||||
return [
|
||||
|
||||
@@ -1156,12 +1156,6 @@ export type ExtensionDataRef<
|
||||
readonly config: TConfig;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type ExtensionDataRefToValue<TDataRef extends ExtensionDataRef> =
|
||||
TDataRef extends ExtensionDataRef<infer IData, infer IId, any>
|
||||
? ExtensionDataValue<IData, IId>
|
||||
: never;
|
||||
|
||||
// @public (undocumented)
|
||||
export type ExtensionDataValue<TData, TId extends string> = {
|
||||
readonly $$type: '@backstage/ExtensionDataValue';
|
||||
@@ -1956,14 +1950,6 @@ export const Progress: {
|
||||
// @public (undocumented)
|
||||
export type ProgressProps = {};
|
||||
|
||||
// @public
|
||||
export type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> =
|
||||
TExtensionInput['extensionData'] extends Array<ExtensionDataRef>
|
||||
? {
|
||||
node: AppNode;
|
||||
} & ExtensionDataContainer<TExtensionInput['extensionData'][number]>
|
||||
: never;
|
||||
|
||||
// @public
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
|
||||
@@ -43,11 +43,8 @@ import { FrontendModule } from './createFrontendModule';
|
||||
*/
|
||||
export const ctxParamsSymbol = Symbol('params');
|
||||
|
||||
/**
|
||||
* Convert a single extension input into a matching resolved input.
|
||||
* @public
|
||||
*/
|
||||
export type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> =
|
||||
/** @ignore */
|
||||
type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> =
|
||||
TExtensionInput['extensionData'] extends Array<ExtensionDataRef>
|
||||
? {
|
||||
node: AppNode;
|
||||
|
||||
@@ -33,7 +33,7 @@ export type ExtensionDataRef<
|
||||
readonly config: TConfig;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
/** @ignore */
|
||||
export type ExtensionDataRefToValue<TDataRef extends ExtensionDataRef> =
|
||||
TDataRef extends ExtensionDataRef<infer IData, infer IId, any>
|
||||
? ExtensionDataValue<IData, IId>
|
||||
|
||||
@@ -22,7 +22,6 @@ export {
|
||||
type ExtensionDefinitionParameters,
|
||||
type CreateExtensionOptions,
|
||||
type OverridableExtensionDefinition,
|
||||
type ResolvedExtensionInput,
|
||||
type ResolvedExtensionInputs,
|
||||
} from './createExtension';
|
||||
export {
|
||||
@@ -32,7 +31,6 @@ export {
|
||||
export {
|
||||
createExtensionDataRef,
|
||||
type ExtensionDataRef,
|
||||
type ExtensionDataRefToValue,
|
||||
type ExtensionDataValue,
|
||||
type ConfigurableExtensionDataRef,
|
||||
} from './createExtensionDataRef';
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { AppNode } from '../apis';
|
||||
import { Expand } from '@backstage/types';
|
||||
import { ResolvedExtensionInput } from './createExtension';
|
||||
import { createExtensionDataContainer } from '@internal/frontend';
|
||||
import {
|
||||
ExtensionDataRefToValue,
|
||||
@@ -124,7 +123,7 @@ export function resolveInputOverrides(
|
||||
);
|
||||
}
|
||||
newInputs[name] = Object.assign(providedContainer, {
|
||||
node: (originalInput as ResolvedExtensionInput<any>).node,
|
||||
node: (originalInput as { node: AppNode }).node,
|
||||
}) as any;
|
||||
}
|
||||
} else {
|
||||
@@ -158,7 +157,7 @@ export function resolveInputOverrides(
|
||||
declaredInput.extensionData,
|
||||
);
|
||||
return Object.assign(providedContainer, {
|
||||
node: (originalInput[i] as ResolvedExtensionInput<any>).node,
|
||||
node: (originalInput[i] as { node: AppNode }).node,
|
||||
}) as any;
|
||||
});
|
||||
} else if (withNodesCount === providedData.length) {
|
||||
|
||||
Reference in New Issue
Block a user