@@ -211,7 +211,7 @@ describe('readAppExtensionParameters', () => {
|
||||
}),
|
||||
),
|
||||
).toThrow(
|
||||
"Invalid extension configuration at app.extensions[0], extension ID must only contain letters, numbers, dashes, and dots, got 'core.router/routes'",
|
||||
"Invalid extension configuration at app.extensions[0], extension ID must only contain letters, numbers, and dots; got 'core.router/routes'",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -260,10 +260,10 @@ describe('expandShorthandExtensionParameters', () => {
|
||||
disabled: false,
|
||||
});
|
||||
expect(() => run('')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid extension configuration at app.extensions[1], extension ID must only contain letters, numbers, dashes, and dots, got ''"`,
|
||||
`"Invalid extension configuration at app.extensions[1], extension ID must only contain letters, numbers, and dots; got ''"`,
|
||||
);
|
||||
expect(() => run('core.router/routes')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid extension configuration at app.extensions[1], extension ID must only contain letters, numbers, dashes, and dots, got 'core.router/routes'"`,
|
||||
`"Invalid extension configuration at app.extensions[1], extension ID must only contain letters, numbers, and dots; got 'core.router/routes'"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -61,10 +61,10 @@ export function expandShorthandExtensionParameters(
|
||||
}
|
||||
|
||||
function assertValidId(id: string) {
|
||||
if (!id.match(/^[\.a-zA-Z0-9-]+$/)) {
|
||||
if (!id.match(/^[\.a-zA-Z0-9]+$/)) {
|
||||
throw new Error(
|
||||
errorMsg(
|
||||
`extension ID must only contain letters, numbers, dashes, and dots, got '${id}'`,
|
||||
`extension ID must only contain letters, numbers, and dots; got '${id}'`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface BackstagePlugin {
|
||||
// (undocumented)
|
||||
$$type: 'backstage-plugin';
|
||||
// (undocumented)
|
||||
defaultExtensionInstances: ExtensionInstanceParameters[];
|
||||
defaultExtensions: Extension<unknown>[];
|
||||
// (undocumented)
|
||||
id: string;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export interface BackstagePlugin {
|
||||
// @public (undocumented)
|
||||
export interface BackstagePluginOptions {
|
||||
// (undocumented)
|
||||
defaultExtensionInstances?: ExtensionInstanceParameters[];
|
||||
defaultExtensions?: Extension<unknown>[];
|
||||
// (undocumented)
|
||||
id: string;
|
||||
}
|
||||
@@ -61,9 +61,13 @@ export interface CreateExtensionOptions<
|
||||
>,
|
||||
TConfig,
|
||||
> {
|
||||
// (undocumented)
|
||||
at: string;
|
||||
// (undocumented)
|
||||
configSchema?: PortableSchema<TConfig>;
|
||||
// (undocumented)
|
||||
disabled?: boolean;
|
||||
// (undocumented)
|
||||
factory(options: {
|
||||
bind: ExtensionDataBind<TData>;
|
||||
config: TConfig;
|
||||
@@ -74,6 +78,8 @@ export interface CreateExtensionOptions<
|
||||
};
|
||||
}): void;
|
||||
// (undocumented)
|
||||
id: string;
|
||||
// (undocumented)
|
||||
inputs?: TPoint;
|
||||
// (undocumented)
|
||||
output: TData;
|
||||
@@ -99,6 +105,9 @@ export function createPageExtension<
|
||||
configSchema: PortableSchema<TConfig>;
|
||||
}
|
||||
) & {
|
||||
id: string;
|
||||
at?: string;
|
||||
disabled?: boolean;
|
||||
inputs?: TInputs;
|
||||
component: (props: {
|
||||
config: TConfig;
|
||||
@@ -124,14 +133,20 @@ export interface Extension<TConfig> {
|
||||
// (undocumented)
|
||||
$$type: 'extension';
|
||||
// (undocumented)
|
||||
at: string;
|
||||
// (undocumented)
|
||||
configSchema?: PortableSchema<TConfig>;
|
||||
// (undocumented)
|
||||
disabled: boolean;
|
||||
// (undocumented)
|
||||
factory(options: {
|
||||
bind: ExtensionDataBind<AnyExtensionDataMap>;
|
||||
config: TConfig;
|
||||
inputs: Record<string, Array<Record<string, unknown>>>;
|
||||
}): void;
|
||||
// (undocumented)
|
||||
id: string;
|
||||
// (undocumented)
|
||||
inputs: Record<
|
||||
string,
|
||||
{
|
||||
@@ -159,20 +174,6 @@ export type ExtensionDataValue<TData extends AnyExtensionDataMap> = {
|
||||
[K in keyof TData]: TData[K]['T'];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ExtensionInstanceParameters {
|
||||
// (undocumented)
|
||||
at: string;
|
||||
// (undocumented)
|
||||
config?: unknown;
|
||||
// (undocumented)
|
||||
disabled?: boolean;
|
||||
// (undocumented)
|
||||
extension: Extension<unknown>;
|
||||
// (undocumented)
|
||||
id: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type PortableSchema<TOutput> = {
|
||||
parse: (input: unknown) => TOutput;
|
||||
|
||||
Reference in New Issue
Block a user