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:
Johan Haals
2023-09-11 16:48:01 +02:00
parent 34ffe5654c
commit 1cfe070efd
6 changed files with 12 additions and 11 deletions
@@ -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',
};
}
+3 -3
View File
@@ -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;