frontend-app-api: Rename $$type to conform with backend types
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Co-authored-by: Philipp Hugenroth <philipph@spotify.com> Co-authored-by: Fredrik Adelöw <freben@gmail.com> Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -23,6 +23,8 @@ import mapValues from 'lodash/mapValues';
|
||||
|
||||
/** @internal */
|
||||
export interface ExtensionInstance {
|
||||
readonly $$type: '@backstage/ExtensionInstance';
|
||||
|
||||
readonly id: string;
|
||||
/**
|
||||
* Get concrete value for the given extension data reference. Returns undefined if no value is available.
|
||||
@@ -32,7 +34,6 @@ export interface ExtensionInstance {
|
||||
* Maps input names to the actual instances given to them.
|
||||
*/
|
||||
readonly attachments: Map<string, ExtensionInstance[]>;
|
||||
readonly $$type: 'extension-instance';
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@@ -86,12 +87,12 @@ export function createExtensionInstance(options: {
|
||||
}
|
||||
|
||||
return {
|
||||
$$type: '@backstage/ExtensionInstance',
|
||||
id: options.extension.id,
|
||||
getData<T>(ref: ExtensionDataRef<T>): T | undefined {
|
||||
return extensionData.get(ref.id) as T | undefined;
|
||||
},
|
||||
|
||||
attachments,
|
||||
$$type: 'extension-instance',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export type AnyExtensionDataMap = {
|
||||
// @public (undocumented)
|
||||
export interface BackstagePlugin {
|
||||
// (undocumented)
|
||||
$$type: 'backstage-plugin';
|
||||
$$type: '@backstage/BackstagePlugin';
|
||||
// (undocumented)
|
||||
extensions: Extension<unknown>[];
|
||||
// (undocumented)
|
||||
@@ -176,7 +176,7 @@ export function createSchemaFromZod<TOutput, TInput>(
|
||||
// @public (undocumented)
|
||||
export interface Extension<TConfig> {
|
||||
// (undocumented)
|
||||
$$type: 'extension';
|
||||
$$type: '@backstage/Extension';
|
||||
// (undocumented)
|
||||
at: string;
|
||||
// (undocumented)
|
||||
@@ -268,7 +268,7 @@ export type ExtensionDataRef<
|
||||
id: string;
|
||||
T: TData;
|
||||
config: TConfig;
|
||||
$$type: 'extension-data';
|
||||
$$type: '@backstage/ExtensionDataRef';
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -87,7 +87,7 @@ export function createExtension<
|
||||
return {
|
||||
...options,
|
||||
disabled: options.disabled ?? false,
|
||||
$$type: 'extension',
|
||||
$$type: '@backstage/Extension',
|
||||
inputs: options.inputs ?? {},
|
||||
factory({ bind, config, inputs }) {
|
||||
// TODO: Simplify this, but TS wouldn't infer the input type for some reason
|
||||
|
||||
@@ -22,7 +22,7 @@ export type ExtensionDataRef<
|
||||
id: string;
|
||||
T: TData;
|
||||
config: TConfig;
|
||||
$$type: 'extension-data';
|
||||
$$type: '@backstage/ExtensionDataRef';
|
||||
};
|
||||
|
||||
/** @public */
|
||||
@@ -40,7 +40,7 @@ export function createExtensionDataRef<TData>(
|
||||
): ConfigurableExtensionDataRef<TData> {
|
||||
return {
|
||||
id,
|
||||
$$type: 'extension-data',
|
||||
$$type: '@backstage/ExtensionDataRef',
|
||||
config: {},
|
||||
optional() {
|
||||
return { ...this, config: { ...this.config, optional: true } };
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface PluginOptions {
|
||||
|
||||
/** @public */
|
||||
export interface BackstagePlugin {
|
||||
$$type: 'backstage-plugin';
|
||||
$$type: '@backstage/BackstagePlugin';
|
||||
id: string;
|
||||
extensions: Extension<unknown>[];
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export interface BackstagePlugin {
|
||||
export function createPlugin(options: PluginOptions): BackstagePlugin {
|
||||
return {
|
||||
...options,
|
||||
$$type: 'backstage-plugin',
|
||||
$$type: '@backstage/BackstagePlugin',
|
||||
extensions: options.extensions ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export type AnyExtensionDataMap = {
|
||||
|
||||
/** @public */
|
||||
export interface Extension<TConfig> {
|
||||
$$type: 'extension';
|
||||
$$type: '@backstage/Extension';
|
||||
id: string;
|
||||
at: string;
|
||||
disabled: boolean;
|
||||
|
||||
Reference in New Issue
Block a user