Skip to main content

ExtensionDefinition

Home > @backstage/frontend-plugin-api > ExtensionDefinition

Signature:

export type ExtensionDefinition<T extends ExtensionDefinitionParameters = ExtensionDefinitionParameters> = {
$$type: '@backstage/ExtensionDefinition';
readonly T: T;
override<TExtensionConfigSchema extends {
[key in string]: (zImpl: typeof z) => z.ZodType;
}, UFactoryOutput extends ExtensionDataValue<any, any>, UNewOutput extends AnyExtensionDataRef, TExtraInputs extends {
[inputName in string]: ExtensionInput<AnyExtensionDataRef, {
optional: boolean;
singleton: boolean;
}>;
}>(args: Expand<{
attachTo?: {
id: string;
input: string;
};
disabled?: boolean;
inputs?: TExtraInputs & {
[KName in keyof T['inputs']]?: `Error: Input '${KName & string}' is already defined in parent definition`;
};
output?: Array<UNewOutput>;
config?: {
schema: TExtensionConfigSchema & {
[KName in keyof T['config']]?: `Error: Config key '${KName & string}' is already defined in parent schema`;
};
};
factory?(originalFactory: (context?: Expand<{
config?: T['config'];
inputs?: ResolveInputValueOverrides<NonNullable<T['inputs']>>;
} & ([T['params']] extends [never] ? {} : {
params?: Partial<T['params']>;
})>) => ExtensionDataContainer<NonNullable<T['output']>>, context: {
node: AppNode;
apis: ApiHolder;
config: T['config'] & {
[key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
};
inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
}): Iterable<UFactoryOutput>;
} & ([T['params']] extends [never] ? {} : {
params?: Partial<T['params']>;
})> & VerifyExtensionFactoryOutput<AnyExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UFactoryOutput>): ExtensionDefinition<{
kind: T['kind'];
name: T['name'];
output: AnyExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
inputs: T['inputs'] & TExtraInputs;
config: T['config'] & {
[key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
};
configInput: T['configInput'] & z.input<z.ZodObject<{
[key in keyof TExtensionConfigSchema]: ReturnType<TExtensionConfigSchema[key]>;
}>>;
}>;
};

References: ExtensionDefinitionParameters, ExtensionDataValue, AnyExtensionDataRef, ExtensionInput, ResolveInputValueOverrides, ExtensionDataContainer, AppNode, ApiHolder, ResolvedExtensionInputs, ExtensionDefinition