@backstage/frontend-plugin-api 0.15.0-next.1 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/dist/alpha.d.ts +6 -71
  3. package/dist/alpha.esm.js +4 -0
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/analytics/useAnalytics.esm.js +2 -0
  6. package/dist/analytics/useAnalytics.esm.js.map +1 -1
  7. package/dist/apis/definitions/AlertApi.esm.js +3 -2
  8. package/dist/apis/definitions/AlertApi.esm.js.map +1 -1
  9. package/dist/apis/definitions/AnalyticsApi.esm.js +3 -2
  10. package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
  11. package/dist/apis/definitions/AppLanguageApi.esm.js +3 -2
  12. package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -1
  13. package/dist/apis/definitions/AppThemeApi.esm.js +3 -2
  14. package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -1
  15. package/dist/apis/definitions/AppTreeApi.esm.js +4 -1
  16. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
  17. package/dist/apis/definitions/ConfigApi.esm.js +3 -2
  18. package/dist/apis/definitions/ConfigApi.esm.js.map +1 -1
  19. package/dist/apis/definitions/DialogApi.esm.js +3 -2
  20. package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
  21. package/dist/apis/definitions/DiscoveryApi.esm.js +3 -2
  22. package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -1
  23. package/dist/apis/definitions/ErrorApi.esm.js +3 -2
  24. package/dist/apis/definitions/ErrorApi.esm.js.map +1 -1
  25. package/dist/apis/definitions/FeatureFlagsApi.esm.js +3 -2
  26. package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -1
  27. package/dist/apis/definitions/FetchApi.esm.js +3 -2
  28. package/dist/apis/definitions/FetchApi.esm.js.map +1 -1
  29. package/dist/apis/definitions/IconsApi.esm.js +3 -2
  30. package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
  31. package/dist/apis/definitions/IdentityApi.esm.js +3 -2
  32. package/dist/apis/definitions/IdentityApi.esm.js.map +1 -1
  33. package/dist/apis/definitions/OAuthRequestApi.esm.js +3 -2
  34. package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -1
  35. package/dist/apis/definitions/PluginHeaderActionsApi.esm.js +3 -2
  36. package/dist/apis/definitions/PluginHeaderActionsApi.esm.js.map +1 -1
  37. package/dist/apis/definitions/PluginWrapperApi.esm.js +7 -3
  38. package/dist/apis/definitions/PluginWrapperApi.esm.js.map +1 -1
  39. package/dist/apis/definitions/RouteResolutionApi.esm.js +3 -2
  40. package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
  41. package/dist/apis/definitions/StorageApi.esm.js +3 -2
  42. package/dist/apis/definitions/StorageApi.esm.js.map +1 -1
  43. package/dist/apis/definitions/SwappableComponentsApi.esm.js +3 -2
  44. package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
  45. package/dist/apis/definitions/ToastApi.esm.js +11 -0
  46. package/dist/apis/definitions/ToastApi.esm.js.map +1 -0
  47. package/dist/apis/definitions/TranslationApi.esm.js +3 -2
  48. package/dist/apis/definitions/TranslationApi.esm.js.map +1 -1
  49. package/dist/apis/definitions/auth.esm.js +33 -22
  50. package/dist/apis/definitions/auth.esm.js.map +1 -1
  51. package/dist/apis/system/ApiRef.esm.js +28 -20
  52. package/dist/apis/system/ApiRef.esm.js.map +1 -1
  53. package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js +1 -1
  54. package/dist/blueprints/ApiBlueprint.esm.js +1 -1
  55. package/dist/blueprints/AppRootElementBlueprint.esm.js +1 -1
  56. package/dist/blueprints/NavItemBlueprint.esm.js +1 -1
  57. package/dist/blueprints/PageBlueprint.esm.js +38 -7
  58. package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
  59. package/dist/blueprints/PluginHeaderActionBlueprint.esm.js +3 -1
  60. package/dist/blueprints/PluginHeaderActionBlueprint.esm.js.map +1 -1
  61. package/dist/blueprints/PluginWrapperBlueprint.esm.js +4 -2
  62. package/dist/blueprints/PluginWrapperBlueprint.esm.js.map +1 -1
  63. package/dist/blueprints/SubPageBlueprint.esm.js +3 -1
  64. package/dist/blueprints/SubPageBlueprint.esm.js.map +1 -1
  65. package/dist/components/ExtensionBoundary.esm.js +3 -2
  66. package/dist/components/ExtensionBoundary.esm.js.map +1 -1
  67. package/dist/components/PageLayout.esm.js.map +1 -1
  68. package/dist/components/createSwappableComponent.esm.js +2 -0
  69. package/dist/components/createSwappableComponent.esm.js.map +1 -1
  70. package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js +9 -0
  71. package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js.map +1 -0
  72. package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
  73. package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
  74. package/dist/index.d.ts +364 -1442
  75. package/dist/index.esm.js +3 -0
  76. package/dist/index.esm.js.map +1 -1
  77. package/dist/routing/useRouteRef.esm.js +2 -0
  78. package/dist/routing/useRouteRef.esm.js.map +1 -1
  79. package/dist/schema/createSchemaFromZod.esm.js +1 -1
  80. package/dist/schema/createSchemaFromZod.esm.js.map +1 -1
  81. package/dist/translation/useTranslationRef.esm.js +2 -0
  82. package/dist/translation/useTranslationRef.esm.js.map +1 -1
  83. package/dist/types/alpha.d-DzeiOzxk.d.ts +1425 -0
  84. package/dist/wiring/createExtension.esm.js +6 -0
  85. package/dist/wiring/createExtension.esm.js.map +1 -1
  86. package/dist/wiring/createExtensionBlueprint.esm.js +2 -0
  87. package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
  88. package/dist/wiring/createExtensionDataRef.esm.js.map +1 -1
  89. package/dist/wiring/createFrontendModule.esm.js +1 -0
  90. package/dist/wiring/createFrontendModule.esm.js.map +1 -1
  91. package/dist/wiring/createFrontendPlugin.esm.js +6 -0
  92. package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
  93. package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
  94. package/dist/wiring/resolveInputOverrides.esm.js.map +1 -1
  95. package/package.json +11 -10
@@ -0,0 +1,1425 @@
1
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
+ import { JSX, ComponentType, ReactNode } from 'react';
3
+ import { Expand, JsonObject } from '@backstage/types';
4
+ import { FilterPredicate } from '@backstage/filter-predicates';
5
+ import { z } from 'zod/v3';
6
+
7
+ /**
8
+ * IconComponent is the common icon type used throughout Backstage when
9
+ * working with and rendering generic icons, including the app system icons.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The type is based on SvgIcon from Material UI, but we do not want the plugin-api
14
+ * package to have a dependency on Material UI, nor do we want the props to be as broad
15
+ * as the SvgIconProps interface.
16
+ *
17
+ * If you have the need to forward additional props from SvgIconProps, you can
18
+ * open an issue or submit a PR to the main Backstage repo. When doing so please
19
+ * also describe your use-case and reasoning of the addition.
20
+ *
21
+ * @public
22
+ * @deprecated Use {@link IconElement} instead, passing `<MyIcon />` rather than `MyIcon`.
23
+ */
24
+ type IconComponent = ComponentType<{
25
+ fontSize?: 'medium' | 'large' | 'small' | 'inherit';
26
+ }>;
27
+ /**
28
+ * The type used for icon elements throughout Backstage.
29
+ *
30
+ * @remarks
31
+ *
32
+ * Icon elements should behave like rendering a plain icon directly, for example
33
+ * from `@remixicon/react`, and are expected to be sized by the surrounding UI.
34
+ * Icons should be exactly 24x24 pixels in size by default.
35
+ *
36
+ * Using icons from `@remixicon/react` is preferred. Using icons from
37
+ * `@material-ui/icons` or `AppIcon` and its variants from
38
+ * `@backstage/core-components` is supported while migrating, but deprecated.
39
+ * When using those icons, you must set `fontSize="inherit"` on the element.
40
+ *
41
+ * @public
42
+ */
43
+ type IconElement = JSX.Element | null;
44
+
45
+ /**
46
+ * Catch-all type for route params.
47
+ *
48
+ * @public
49
+ */
50
+ type AnyRouteRefParams = {
51
+ [param in string]: string;
52
+ } | undefined;
53
+
54
+ /**
55
+ * Absolute route reference.
56
+ *
57
+ * @remarks
58
+ *
59
+ * See {@link https://backstage.io/docs/plugins/composability#routing-system}.
60
+ *
61
+ * @public
62
+ */
63
+ interface RouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams> {
64
+ readonly $$type: '@backstage/RouteRef';
65
+ readonly T: TParams;
66
+ }
67
+ /**
68
+ * Create a {@link RouteRef} from a route descriptor.
69
+ *
70
+ * @param config - Description of the route reference to be created.
71
+ * @public
72
+ */
73
+ declare function createRouteRef<TParams extends {
74
+ [param in TParamKeys]: string;
75
+ } | undefined = undefined, TParamKeys extends string = string>(config?: {
76
+ /** A list of parameter names that the path that this route ref is bound to must contain */
77
+ readonly params?: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];
78
+ aliasFor?: string;
79
+ }): RouteRef<keyof TParams extends never ? undefined : string extends TParamKeys ? TParams : {
80
+ [param in TParamKeys]: string;
81
+ }>;
82
+
83
+ /** @public */
84
+ type ExtensionDataValue<TData, TId extends string> = {
85
+ readonly $$type: '@backstage/ExtensionDataValue';
86
+ readonly id: TId;
87
+ readonly value: TData;
88
+ };
89
+ /** @public */
90
+ type ExtensionDataRef<TData = unknown, TId extends string = string, TConfig extends {
91
+ optional?: true;
92
+ } = {
93
+ optional?: true;
94
+ }> = {
95
+ readonly $$type: '@backstage/ExtensionDataRef';
96
+ readonly id: TId;
97
+ readonly T: TData;
98
+ readonly config: TConfig;
99
+ };
100
+ /** @ignore */
101
+ type ExtensionDataRefToValue<TDataRef extends ExtensionDataRef> = TDataRef extends ExtensionDataRef<infer IData, infer IId, any> ? ExtensionDataValue<IData, IId> : never;
102
+ /** @public */
103
+ interface ConfigurableExtensionDataRef<TData, TId extends string, TConfig extends {
104
+ optional?: true;
105
+ } = {}> extends ExtensionDataRef<TData, TId, TConfig> {
106
+ optional(): ConfigurableExtensionDataRef<TData, TId, TConfig & {
107
+ optional: true;
108
+ }>;
109
+ (t: TData): ExtensionDataValue<TData, TId>;
110
+ }
111
+ /** @public */
112
+ declare function createExtensionDataRef<TData>(): {
113
+ with<TId extends string>(options: {
114
+ id: TId;
115
+ }): ConfigurableExtensionDataRef<TData, TId>;
116
+ };
117
+
118
+ /** @public */
119
+ interface ExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
120
+ optional?: true;
121
+ }> = ExtensionDataRef, TConfig extends {
122
+ singleton: boolean;
123
+ optional: boolean;
124
+ internal?: boolean;
125
+ } = {
126
+ singleton: boolean;
127
+ optional: boolean;
128
+ internal?: boolean;
129
+ }> {
130
+ readonly $$type: '@backstage/ExtensionInput';
131
+ readonly extensionData: Array<UExtensionData>;
132
+ readonly config: TConfig;
133
+ readonly replaces?: Array<{
134
+ id: string;
135
+ input: string;
136
+ }>;
137
+ }
138
+ /**
139
+ * Creates a new extension input to be passed to the input map of an extension.
140
+ *
141
+ * @remarks
142
+ *
143
+ * Extension inputs created with this function can be passed to any `inputs` map
144
+ * as part of creating or overriding an extension.
145
+ *
146
+ * The array of extension data references defines the data this input expects.
147
+ * If the required data is not provided by the attached extension, the
148
+ * attachment will fail.
149
+ *
150
+ * The `config` object can be used to restrict the behavior and shape of the
151
+ * input. By default an input will accept zero or more extensions from any
152
+ * plugin. The following options are available:
153
+ *
154
+ * - `singleton`: If set to `true`, only one extension can be attached to the
155
+ * input at a time. Additional extensions will trigger an app error and be
156
+ * ignored.
157
+ * - `optional`: If set to `true`, the input is optional and can be omitted,
158
+ * this only has an effect if the `singleton` is set to `true`.
159
+ * - `internal`: If set to `true`, only extensions from the same plugin will be
160
+ * allowed to attach to this input. Other extensions will trigger an app error
161
+ * and be ignored.
162
+ *
163
+ * @param extensionData - The array of extension data references that this input
164
+ * expects.
165
+ * @param config - The configuration object for the input.
166
+ * @returns An extension input declaration.
167
+ * @example
168
+ * ```ts
169
+ * const extension = createExtension({
170
+ * attachTo: { id: 'example-parent', input: 'example-input' },
171
+ * inputs: {
172
+ * content: createExtensionInput([coreExtensionData.reactElement], {
173
+ * singleton: true,
174
+ * }),
175
+ * },
176
+ * output: [coreExtensionData.reactElement],
177
+ * *factory({ inputs }) {
178
+ * const content = inputs.content?.get(coreExtensionData.reactElement);
179
+ * yield coreExtensionData.reactElement(<ContentWrapper>{content}</ContentWrapper>);
180
+ * },
181
+ * });
182
+ * ```
183
+ * @public
184
+ */
185
+ declare function createExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
186
+ optional?: true;
187
+ }>, TConfig extends {
188
+ singleton?: boolean;
189
+ optional?: boolean;
190
+ internal?: boolean;
191
+ }>(extensionData: Array<UExtensionData>, config?: TConfig & {
192
+ replaces?: Array<{
193
+ id: string;
194
+ input: string;
195
+ }>;
196
+ }): ExtensionInput<UExtensionData, {
197
+ singleton: TConfig['singleton'] extends true ? true : false;
198
+ optional: TConfig['optional'] extends true ? true : false;
199
+ internal: TConfig['internal'] extends true ? true : false;
200
+ }>;
201
+
202
+ /** @ignore */
203
+ type ResolvedInputValueOverrides<TInputs extends {
204
+ [inputName in string]: ExtensionInput;
205
+ } = {
206
+ [inputName in string]: ExtensionInput;
207
+ }> = Expand<{
208
+ [KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
209
+ optional: infer IOptional extends boolean;
210
+ singleton: boolean;
211
+ internal?: boolean;
212
+ }> ? IOptional extends true ? never : KName : never]: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
213
+ optional: boolean;
214
+ singleton: infer ISingleton extends boolean;
215
+ internal?: boolean;
216
+ }> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
217
+ } & {
218
+ [KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
219
+ optional: infer IOptional extends boolean;
220
+ singleton: boolean;
221
+ internal?: boolean;
222
+ }> ? IOptional extends true ? KName : never : never]?: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
223
+ optional: boolean;
224
+ singleton: infer ISingleton extends boolean;
225
+ internal?: boolean;
226
+ }> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
227
+ }>;
228
+
229
+ /** @public */
230
+ interface CreateFrontendModuleOptions<TPluginId extends string, TExtensions extends readonly ExtensionDefinition[]> {
231
+ pluginId: TPluginId;
232
+ extensions?: TExtensions;
233
+ featureFlags?: FeatureFlagConfig[];
234
+ if?: FilterPredicate;
235
+ }
236
+ /** @public */
237
+ interface FrontendModule {
238
+ readonly $$type: '@backstage/FrontendModule';
239
+ readonly pluginId: string;
240
+ }
241
+ /**
242
+ * Creates a new module that can be installed in a Backstage app.
243
+ *
244
+ * @remarks
245
+ *
246
+ * Modules are used to add or override extensions for an existing plugin. If a
247
+ * module provides an extension with the same ID as one provided by the plugin,
248
+ * the extension provided by the module will always take precedence.
249
+ *
250
+ * Every module is created for a specific plugin by providing the
251
+ * unique ID of the plugin that the module should be installed for. If that
252
+ * plugin is not present in the app, the module will be ignored and have no
253
+ * effect.
254
+ *
255
+ * For more information on how modules work, see the
256
+ * {@link https://backstage.io/docs/frontend-system/architecture/extension-overrides#creating-a-frontend-module | documentation for modules}
257
+ * in the frontend system documentation.
258
+ *
259
+ * It is recommended to name the module variable of the form `<pluginId>Module<ModuleName>`.
260
+ *
261
+ * @example
262
+ *
263
+ * ```tsx
264
+ * import { createFrontendModule } from '@backstage/frontend-plugin-api';
265
+ *
266
+ * export const exampleModuleCustomPage = createFrontendModule({
267
+ * pluginId: 'example',
268
+ * extensions: [
269
+ * // Overrides the default page for the 'example' plugin
270
+ * PageBlueprint.make({
271
+ * path: '/example',
272
+ * loader: () => import('./CustomPage').then(m => <m.CustomPage />),
273
+ * }),
274
+ * ],
275
+ * });
276
+ * ```
277
+ *
278
+ * @public
279
+ */
280
+ declare function createFrontendModule<TId extends string, TExtensions extends readonly ExtensionDefinition[]>(options: CreateFrontendModuleOptions<TId, TExtensions>): FrontendModule;
281
+
282
+ /** @public */
283
+ type PortableSchema<TOutput, TInput = TOutput> = {
284
+ parse: (input: TInput) => TOutput;
285
+ schema: JsonObject;
286
+ };
287
+
288
+ /** @public */
289
+ type ExtensionAttachTo = {
290
+ id: string;
291
+ input: string;
292
+ };
293
+ /** @public */
294
+ interface Extension<TConfig, TConfigInput = TConfig> {
295
+ $$type: '@backstage/Extension';
296
+ readonly id: string;
297
+ readonly attachTo: ExtensionAttachTo;
298
+ readonly disabled: boolean;
299
+ readonly configSchema?: PortableSchema<TConfig, TConfigInput>;
300
+ }
301
+ /** @ignore */
302
+ type ResolveExtensionId<TExtension extends ExtensionDefinition, TNamespace extends string> = TExtension extends ExtensionDefinition<{
303
+ kind: infer IKind extends string | undefined;
304
+ name: infer IName extends string | undefined;
305
+ params: any;
306
+ }> ? [string] extends [IKind | IName] ? never : (undefined extends IName ? TNamespace : `${TNamespace}/${IName}`) extends infer INamePart extends string ? IKind extends string ? `${IKind}:${INamePart}` : INamePart : never : never;
307
+
308
+ type CompareChars<A extends string, B extends string> = [A, B] extends [
309
+ `${infer IAHead}${infer IARest}`,
310
+ `${infer IBHead}${infer IBRest}`
311
+ ] ? IAHead extends IBHead ? IBRest extends '' ? IARest extends '' ? 'eq' : 'gt' : IARest extends '' ? 'lt' : CompareChars<IARest, IBRest> : `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz` extends `${string}${IAHead}${string}${IBHead}${string}` ? 'lt' : 'gt' : 'eq';
312
+ type CompareStrings<A extends string | undefined, B extends string | undefined> = A extends B ? 'eq' : A extends undefined ? 'lt' : B extends undefined ? 'gt' : CompareChars<A & string, B & string>;
313
+ type CompareExtensions<A extends ExtensionDefinition, B extends ExtensionDefinition> = CompareStrings<A['T']['kind'], B['T']['kind']> extends 'eq' ? CompareStrings<A['T']['name'], B['T']['name']> : CompareStrings<A['T']['kind'], B['T']['kind']>;
314
+ type SortExtensionsInner<TPivot extends ExtensionDefinition, TRest extends readonly ExtensionDefinition[], TLow extends readonly ExtensionDefinition[], THigh extends readonly ExtensionDefinition[]> = TRest extends [
315
+ infer IHead extends ExtensionDefinition,
316
+ ...infer IRest extends readonly ExtensionDefinition[]
317
+ ] ? CompareExtensions<IHead, TPivot> extends 'lt' ? SortExtensionsInner<TPivot, IRest, [...TLow, IHead], THigh> : SortExtensionsInner<TPivot, IRest, TLow, [...THigh, IHead]> : [low: TLow, high: THigh];
318
+ type SortExtensions<T extends readonly ExtensionDefinition[]> = T extends [
319
+ infer IPivot extends ExtensionDefinition,
320
+ ...infer IRest extends readonly ExtensionDefinition[]
321
+ ] ? SortExtensionsInner<IPivot, IRest, [], []> extends [
322
+ low: infer ILow extends readonly ExtensionDefinition[],
323
+ high: infer IHigh extends readonly ExtensionDefinition[]
324
+ ] ? [...SortExtensions<ILow>, IPivot, ...SortExtensions<IHigh>] : 'invalid SortExtensionsInner' : [];
325
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
326
+ type PopUnion$1<U> = UnionToIntersection<U extends any ? () => U : never> extends () => infer R ? [next: R, rest: Exclude<U, R>] : undefined;
327
+ type UnionToArray<U, T = U, TResult extends T[] = []> = PopUnion$1<U> extends [
328
+ next: infer INext extends T,
329
+ rest: infer IRest extends T
330
+ ] ? UnionToArray<IRest, T, [INext, ...TResult]> : TResult;
331
+ type ExtensionArrayToMap<T extends ExtensionDefinition[], TId extends string, TOut extends {
332
+ [KId in string]: ExtensionDefinition;
333
+ } = {}> = T extends [
334
+ infer IHead extends ExtensionDefinition,
335
+ ...infer IRest extends ExtensionDefinition[]
336
+ ] ? ExtensionArrayToMap<IRest, TId, TOut & {
337
+ [K in ResolveExtensionId<IHead, TId>]: IHead;
338
+ }> : TOut extends infer O ? {
339
+ [K in keyof O]: O[K];
340
+ } : never;
341
+ /** @ignore */
342
+ type MakeSortedExtensionsMap<UExtensions extends ExtensionDefinition, TId extends string> = ExtensionArrayToMap<SortExtensions<UnionToArray<UExtensions>>, TId>;
343
+
344
+ /**
345
+ * Descriptor of a route relative to an absolute {@link RouteRef}.
346
+ *
347
+ * @remarks
348
+ *
349
+ * See {@link https://backstage.io/docs/plugins/composability#routing-system}.
350
+ *
351
+ * @public
352
+ */
353
+ interface SubRouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams> {
354
+ readonly $$type: '@backstage/SubRouteRef';
355
+ readonly T: TParams;
356
+ readonly path: string;
357
+ }
358
+ /**
359
+ * Used in {@link PathParams} type declaration.
360
+ * @ignore
361
+ */
362
+ type ParamPart<S extends string> = S extends `:${infer Param}` ? Param : never;
363
+ /**
364
+ * Used in {@link PathParams} type declaration.
365
+ * @ignore
366
+ */
367
+ type ParamNames<S extends string> = S extends `${infer Part}/${infer Rest}` ? ParamPart<Part> | ParamNames<Rest> : ParamPart<S>;
368
+ /**
369
+ * This utility type helps us infer a Param object type from a string path
370
+ * For example, `/foo/:bar/:baz` inferred to `{ bar: string, baz: string }`
371
+ * @ignore
372
+ */
373
+ type PathParams<S extends string> = {
374
+ [name in ParamNames<S>]: string;
375
+ };
376
+ /**
377
+ * Merges a param object type with an optional params type into a params object.
378
+ * @ignore
379
+ */
380
+ type MergeParams<P1 extends {
381
+ [param in string]: string;
382
+ }, P2 extends AnyRouteRefParams> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);
383
+ /**
384
+ * Convert empty params to undefined.
385
+ * @ignore
386
+ */
387
+ type TrimEmptyParams<Params extends {
388
+ [param in string]: string;
389
+ }> = keyof Params extends never ? undefined : Params;
390
+ /**
391
+ * Creates a SubRouteRef type given the desired parameters and parent route parameters.
392
+ * The parameters types are merged together while ensuring that there is no overlap between the two.
393
+ *
394
+ * @ignore
395
+ */
396
+ type MakeSubRouteRef<Params extends {
397
+ [param in string]: string;
398
+ }, ParentParams extends AnyRouteRefParams> = keyof Params & keyof ParentParams extends never ? SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>> : never;
399
+ /**
400
+ * Create a {@link SubRouteRef} from a route descriptor.
401
+ *
402
+ * @param config - Description of the route reference to be created.
403
+ * @public
404
+ */
405
+ declare function createSubRouteRef<Path extends string, ParentParams extends AnyRouteRefParams = never>(config: {
406
+ path: Path;
407
+ parent: RouteRef<ParentParams>;
408
+ }): MakeSubRouteRef<PathParams<Path>, ParentParams>;
409
+
410
+ /**
411
+ * Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.
412
+ *
413
+ * @remarks
414
+ *
415
+ * See {@link https://backstage.io/docs/plugins/composability#routing-system}.
416
+ *
417
+ * @public
418
+ */
419
+ interface ExternalRouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams> {
420
+ readonly $$type: '@backstage/ExternalRouteRef';
421
+ readonly T: TParams;
422
+ }
423
+ /**
424
+ * Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.
425
+ *
426
+ * @remarks
427
+ *
428
+ * See {@link https://backstage.io/docs/plugins/composability#routing-system}.
429
+ *
430
+ * @param options - Description of the route reference to be created.
431
+ * @public
432
+ */
433
+ declare function createExternalRouteRef<TParams extends {
434
+ [param in TParamKeys]: string;
435
+ } | undefined = undefined, TParamKeys extends string = string>(config?: {
436
+ /**
437
+ * The parameters that will be provided to the external route reference.
438
+ */
439
+ readonly params?: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];
440
+ /**
441
+ * The route (typically in another plugin) that this should map to by default.
442
+ *
443
+ * The string is expected to be on the standard `<plugin id>.<route id>` form,
444
+ * for example `techdocs.docRoot`.
445
+ */
446
+ defaultTarget?: string;
447
+ }): ExternalRouteRef<keyof TParams extends never ? undefined : string extends TParamKeys ? TParams : {
448
+ [param in TParamKeys]: string;
449
+ }>;
450
+
451
+ /**
452
+ * Information about the plugin.
453
+ *
454
+ * @public
455
+ * @remarks
456
+ *
457
+ * This interface is intended to be extended via [module
458
+ * augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
459
+ * in order to add fields that are specific to each project.
460
+ *
461
+ * For example, one might add a `slackChannel` field that is read from the
462
+ * opaque manifest file.
463
+ *
464
+ * See the options for `createApp` for more information about how to
465
+ * customize the parsing of manifest files.
466
+ */
467
+ interface FrontendPluginInfo {
468
+ /**
469
+ * The name of the package that implements the plugin.
470
+ */
471
+ packageName?: string;
472
+ /**
473
+ * The version of the plugin, typically the version of the package.json file.
474
+ */
475
+ version?: string;
476
+ /**
477
+ * As short description of the plugin, typically the description field in
478
+ * package.json.
479
+ */
480
+ description?: string;
481
+ /**
482
+ * The owner entity references of the plugin.
483
+ */
484
+ ownerEntityRefs?: string[];
485
+ /**
486
+ * Links related to the plugin.
487
+ */
488
+ links?: Array<{
489
+ title: string;
490
+ url: string;
491
+ }>;
492
+ }
493
+ /**
494
+ * Options for providing information for a plugin.
495
+ *
496
+ * @public
497
+ */
498
+ type FrontendPluginInfoOptions = {
499
+ /**
500
+ * A loader function for the package.json file for the plugin.
501
+ */
502
+ packageJson?: () => Promise<{
503
+ name: string;
504
+ } & JsonObject>;
505
+ /**
506
+ * A loader function for an opaque manifest file for the plugin.
507
+ */
508
+ manifest?: () => Promise<JsonObject>;
509
+ };
510
+ /**
511
+ * A variant of the {@link FrontendPlugin} interface that can also be used to install overrides for the plugin.
512
+ *
513
+ * @public
514
+ */
515
+ interface OverridableFrontendPlugin<TRoutes extends {
516
+ [name in string]: RouteRef | SubRouteRef;
517
+ } = {
518
+ [name in string]: RouteRef | SubRouteRef;
519
+ }, TExternalRoutes extends {
520
+ [name in string]: ExternalRouteRef;
521
+ } = {
522
+ [name in string]: ExternalRouteRef;
523
+ }, TExtensionMap extends {
524
+ [id in string]: ExtensionDefinition;
525
+ } = {
526
+ [id in string]: ExtensionDefinition;
527
+ }> extends FrontendPlugin<TRoutes, TExternalRoutes> {
528
+ getExtension<TId extends keyof TExtensionMap>(id: TId): OverridableExtensionDefinition<TExtensionMap[TId]['T']>;
529
+ withOverrides(options: {
530
+ extensions?: Array<ExtensionDefinition>;
531
+ /**
532
+ * Overrides the shared condition that applies to all extensions in the plugin.
533
+ */
534
+ if?: FilterPredicate;
535
+ /**
536
+ * Overrides the display title of the plugin.
537
+ */
538
+ title?: string;
539
+ /**
540
+ * Overrides the display icon of the plugin.
541
+ */
542
+ icon?: IconElement;
543
+ /**
544
+ * Overrides the original info loaders of the plugin one by one.
545
+ */
546
+ info?: FrontendPluginInfoOptions;
547
+ }): OverridableFrontendPlugin<TRoutes, TExternalRoutes, TExtensionMap>;
548
+ }
549
+ /** @public */
550
+ interface FrontendPlugin<TRoutes extends {
551
+ [name in string]: RouteRef | SubRouteRef;
552
+ } = {
553
+ [name in string]: RouteRef | SubRouteRef;
554
+ }, TExternalRoutes extends {
555
+ [name in string]: ExternalRouteRef;
556
+ } = {
557
+ [name in string]: ExternalRouteRef;
558
+ }> {
559
+ readonly $$type: '@backstage/FrontendPlugin';
560
+ /**
561
+ * The plugin ID.
562
+ */
563
+ readonly pluginId: string;
564
+ /**
565
+ * Deprecated alias for `pluginId`.
566
+ *
567
+ * @deprecated Use `pluginId` instead.
568
+ */
569
+ readonly id: string;
570
+ /**
571
+ * The display title of the plugin, used in page headers and navigation.
572
+ * Falls back to the plugin ID if not provided.
573
+ */
574
+ readonly title?: string;
575
+ /**
576
+ * The display icon of the plugin, used in page headers and navigation.
577
+ */
578
+ readonly icon?: IconElement;
579
+ readonly routes: TRoutes;
580
+ readonly externalRoutes: TExternalRoutes;
581
+ /**
582
+ * Loads the plugin info.
583
+ */
584
+ info(): Promise<FrontendPluginInfo>;
585
+ }
586
+ /**
587
+ * Options for {@link createFrontendPlugin}.
588
+ *
589
+ * @public
590
+ */
591
+ interface CreateFrontendPluginOptions<TId extends string, TRoutes extends {
592
+ [name in string]: RouteRef | SubRouteRef;
593
+ }, TExternalRoutes extends {
594
+ [name in string]: ExternalRouteRef;
595
+ }, TExtensions extends readonly ExtensionDefinition[]> {
596
+ pluginId: TId;
597
+ /**
598
+ * The display title of the plugin, used in page headers and navigation.
599
+ * Falls back to the plugin ID if not provided.
600
+ */
601
+ title?: string;
602
+ /**
603
+ * The display icon of the plugin, used in page headers and navigation.
604
+ */
605
+ icon?: IconElement;
606
+ routes?: TRoutes;
607
+ externalRoutes?: TExternalRoutes;
608
+ extensions?: TExtensions;
609
+ featureFlags?: FeatureFlagConfig[];
610
+ if?: FilterPredicate;
611
+ info?: FrontendPluginInfoOptions;
612
+ }
613
+ /**
614
+ * @deprecated Use {@link CreateFrontendPluginOptions} instead.
615
+ * @public
616
+ */
617
+ type PluginOptions<TId extends string, TRoutes extends {
618
+ [name in string]: RouteRef | SubRouteRef;
619
+ }, TExternalRoutes extends {
620
+ [name in string]: ExternalRouteRef;
621
+ }, TExtensions extends readonly ExtensionDefinition[]> = CreateFrontendPluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>;
622
+ /**
623
+ * Creates a new plugin that can be installed in a Backstage app.
624
+ *
625
+ * @remarks
626
+ *
627
+ * Every plugin is created with a unique ID and a set of extensions
628
+ * that are installed as part of the plugin.
629
+ *
630
+ * For more information on how plugins work, see the
631
+ * {@link https://backstage.io/docs/frontend-system/building-plugins/index | documentation for plugins}
632
+ * in the frontend system documentation.
633
+ *
634
+ * @example
635
+ *
636
+ * ```tsx
637
+ * import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
638
+ *
639
+ * export const examplePlugin = createFrontendPlugin({
640
+ * pluginId: 'example',
641
+ * extensions: [
642
+ * PageBlueprint.make({
643
+ * path: '/example',
644
+ * loader: () => import('./ExamplePage').then(m => <m.ExamplePage />),
645
+ * }),
646
+ * ],
647
+ * });
648
+ * ```
649
+ *
650
+ * @public
651
+ */
652
+ declare function createFrontendPlugin<TId extends string, TExtensions extends readonly ExtensionDefinition[], TRoutes extends {
653
+ [name in string]: RouteRef | SubRouteRef;
654
+ } = {}, TExternalRoutes extends {
655
+ [name in string]: ExternalRouteRef;
656
+ } = {}>(options: CreateFrontendPluginOptions<TId, TRoutes, TExternalRoutes, TExtensions>): OverridableFrontendPlugin<TRoutes, TExternalRoutes, MakeSortedExtensionsMap<TExtensions[number], TId>>;
657
+
658
+ /**
659
+ * Feature flag configuration.
660
+ *
661
+ * @public
662
+ */
663
+ type FeatureFlagConfig = {
664
+ /** Feature flag name */
665
+ name: string;
666
+ /** Feature flag description */
667
+ description?: string;
668
+ };
669
+ /** @public */
670
+ type ExtensionDataContainer<UExtensionData extends ExtensionDataRef> = Iterable<UExtensionData extends ExtensionDataRef<infer IData, infer IId, infer IConfig> ? IConfig['optional'] extends true ? never : ExtensionDataValue<IData, IId> : never> & {
671
+ get<TId extends UExtensionData['id']>(ref: ExtensionDataRef<any, TId, any>): UExtensionData extends ExtensionDataRef<infer IData, TId, infer IConfig> ? IConfig['optional'] extends true ? IData | undefined : IData : never;
672
+ };
673
+ /**
674
+ * @public
675
+ * @deprecated Moved to {@link @backstage/frontend-app-api#ExtensionFactoryMiddleware}
676
+ */
677
+ type ExtensionFactoryMiddleware = (originalFactory: (contextOverrides?: {
678
+ config?: JsonObject;
679
+ }) => ExtensionDataContainer<ExtensionDataRef>, context: {
680
+ node: AppNode;
681
+ apis: ApiHolder;
682
+ config?: JsonObject;
683
+ }) => Iterable<ExtensionDataValue<any, any>>;
684
+ /** @public */
685
+ type FrontendFeature = (Omit<FrontendPlugin, 'pluginId'> & {
686
+ pluginId?: string;
687
+ }) | FrontendModule;
688
+
689
+ /**
690
+ * A function used to define a parameter mapping function in order to facilitate
691
+ * advanced parameter typing for extension blueprints.
692
+ *
693
+ * @remarks
694
+ *
695
+ * This function is primarily intended to enable the use of inferred type
696
+ * parameters for blueprint params, but it can also be used to transoform the
697
+ * params before they are handed ot the blueprint.
698
+ *
699
+ * The function must return an object created with
700
+ * {@link createExtensionBlueprintParams}.
701
+ *
702
+ * @public
703
+ */
704
+ type ExtensionBlueprintDefineParams<TParams extends object = object, TInput = any> = (params: TInput) => ExtensionBlueprintParams<TParams>;
705
+ /**
706
+ * An opaque type that represents a set of parameters to be passed to a blueprint.
707
+ *
708
+ * @remarks
709
+ *
710
+ * Created with {@link createExtensionBlueprintParams}.
711
+ *
712
+ * @public
713
+ */
714
+ type ExtensionBlueprintParams<T extends object = object> = {
715
+ $$type: '@backstage/BlueprintParams';
716
+ T: T;
717
+ };
718
+ /**
719
+ * Wraps a plain blueprint parameter object in an opaque {@link ExtensionBlueprintParams} object.
720
+ *
721
+ * This is used in the definition of the `defineParams` option of {@link ExtensionBlueprint}.
722
+ *
723
+ * @public
724
+ * @param params - The plain blueprint parameter object to wrap.
725
+ * @returns The wrapped blueprint parameter object.
726
+ */
727
+ declare function createExtensionBlueprintParams<T extends object = object>(params: T): ExtensionBlueprintParams<T>;
728
+ /**
729
+ * @public
730
+ */
731
+ type CreateExtensionBlueprintOptions<TKind extends string, TParams extends object | ExtensionBlueprintDefineParams, UOutput extends ExtensionDataRef, TInputs extends {
732
+ [inputName in string]: ExtensionInput;
733
+ }, TConfigSchema extends {
734
+ [key in string]: (zImpl: typeof z) => z.ZodType;
735
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, TDataRefs extends {
736
+ [name in string]: ExtensionDataRef;
737
+ }, UParentInputs extends ExtensionDataRef> = {
738
+ kind: TKind;
739
+ attachTo: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<UOutput, UParentInputs>;
740
+ disabled?: boolean;
741
+ if?: FilterPredicate;
742
+ inputs?: TInputs;
743
+ output: Array<UOutput>;
744
+ config?: {
745
+ schema: TConfigSchema;
746
+ };
747
+ /**
748
+ * This option is used to further refine the blueprint params. When this
749
+ * option is used, the blueprint will require params to be passed in callback
750
+ * form. This function can both transform the params before they are handed to
751
+ * the blueprint factory, but importantly it also allows you to define
752
+ * inferred type parameters for your blueprint params.
753
+ *
754
+ * @example
755
+ * Blueprint definition with inferred type parameters:
756
+ * ```ts
757
+ * const ExampleBlueprint = createExtensionBlueprint({
758
+ * kind: 'example',
759
+ * attachTo: { id: 'example', input: 'example' },
760
+ * output: [exampleComponentDataRef, exampleFetcherDataRef],
761
+ * defineParams<T>(params: {
762
+ * component(props: ExampleProps<T>): JSX.Element | null
763
+ * fetcher(options: FetchOptions): Promise<FetchResult<T>>
764
+ * }) {
765
+ * return createExtensionBlueprintParams(params);
766
+ * },
767
+ * *factory(params) {
768
+ * yield exampleComponentDataRef(params.component)
769
+ * yield exampleFetcherDataRef(params.fetcher)
770
+ * },
771
+ * });
772
+ * ```
773
+ *
774
+ * @example
775
+ * Usage of the above example blueprint:
776
+ * ```ts
777
+ * const example = ExampleBlueprint.make({
778
+ * params: defineParams => defineParams({
779
+ * component: ...,
780
+ * fetcher: ...,
781
+ * }),
782
+ * });
783
+ * ```
784
+ */
785
+ defineParams?: TParams extends ExtensionBlueprintDefineParams ? TParams : 'The defineParams option must be a function if provided, see the docs for details';
786
+ factory(params: TParams extends ExtensionBlueprintDefineParams ? ReturnType<TParams>['T'] : TParams, context: {
787
+ node: AppNode;
788
+ apis: ApiHolder;
789
+ config: {
790
+ [key in keyof TConfigSchema]: z.infer<ReturnType<TConfigSchema[key]>>;
791
+ };
792
+ inputs: Expand<ResolvedExtensionInputs<TInputs>>;
793
+ }): Iterable<UFactoryOutput>;
794
+ dataRefs?: TDataRefs;
795
+ } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>;
796
+ /** @public */
797
+ type ExtensionBlueprintParameters = {
798
+ kind: string;
799
+ params?: object | ExtensionBlueprintDefineParams;
800
+ configInput?: {
801
+ [K in string]: any;
802
+ };
803
+ config?: {
804
+ [K in string]: any;
805
+ };
806
+ output?: ExtensionDataRef;
807
+ inputs?: {
808
+ [KName in string]: ExtensionInput;
809
+ };
810
+ dataRefs?: {
811
+ [name in string]: ExtensionDataRef;
812
+ };
813
+ };
814
+ /** @ignore */
815
+ type ParamsFactory<TDefiner extends ExtensionBlueprintDefineParams> = (defineParams: TDefiner) => ReturnType<TDefiner>;
816
+ /**
817
+ * Represents any form of params input that can be passed to a blueprint.
818
+ * This also includes the invalid form of passing a plain params object to a blueprint that uses a definition callback.
819
+ *
820
+ * @ignore
821
+ */
822
+ type AnyParamsInput$1<TParams extends object | ExtensionBlueprintDefineParams> = TParams extends ExtensionBlueprintDefineParams<infer IParams> ? IParams | ParamsFactory<TParams> : TParams | ParamsFactory<ExtensionBlueprintDefineParams<TParams, TParams>>;
823
+ /**
824
+ * @public
825
+ */
826
+ interface ExtensionBlueprint<T extends ExtensionBlueprintParameters = ExtensionBlueprintParameters> {
827
+ dataRefs: T['dataRefs'];
828
+ make<TName extends string | undefined, TParamsInput extends AnyParamsInput$1<NonNullable<T['params']>>, UParentInputs extends ExtensionDataRef>(args: {
829
+ name?: TName;
830
+ attachTo?: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<NonNullable<T['output']>, UParentInputs>;
831
+ disabled?: boolean;
832
+ if?: FilterPredicate;
833
+ params: TParamsInput extends ExtensionBlueprintDefineParams ? TParamsInput : T['params'] extends ExtensionBlueprintDefineParams ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `<blueprint>.make({ params: defineParams => defineParams(<params>) })`' : T['params'];
834
+ }): OverridableExtensionDefinition<{
835
+ kind: T['kind'];
836
+ name: string | undefined extends TName ? undefined : TName;
837
+ config: T['config'];
838
+ configInput: T['configInput'];
839
+ output: T['output'];
840
+ inputs: T['inputs'];
841
+ params: T['params'];
842
+ }>;
843
+ /**
844
+ * Creates a new extension from the blueprint.
845
+ *
846
+ * You must either pass `params` directly, or define a `factory` that can
847
+ * optionally call the original factory with the same params.
848
+ */
849
+ makeWithOverrides<TName extends string | undefined, TExtensionConfigSchema extends {
850
+ [key in string]: (zImpl: typeof z) => z.ZodType;
851
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, UNewOutput extends ExtensionDataRef, UParentInputs extends ExtensionDataRef, TExtraInputs extends {
852
+ [inputName in string]: ExtensionInput;
853
+ } = {}>(args: {
854
+ name?: TName;
855
+ attachTo?: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UParentInputs>;
856
+ disabled?: boolean;
857
+ if?: FilterPredicate;
858
+ inputs?: TExtraInputs & {
859
+ [KName in keyof T['inputs']]?: `Error: Input '${KName & string}' is already defined in parent definition`;
860
+ };
861
+ output?: Array<UNewOutput>;
862
+ config?: {
863
+ schema: TExtensionConfigSchema & {
864
+ [KName in keyof T['config']]?: `Error: Config key '${KName & string}' is already defined in parent schema`;
865
+ };
866
+ };
867
+ factory(originalFactory: <TParamsInput extends AnyParamsInput$1<NonNullable<T['params']>>>(params: TParamsInput extends ExtensionBlueprintDefineParams ? TParamsInput : T['params'] extends ExtensionBlueprintDefineParams ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`' : T['params'], context?: {
868
+ config?: T['config'];
869
+ inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;
870
+ }) => ExtensionDataContainer<NonNullable<T['output']>>, context: {
871
+ node: AppNode;
872
+ apis: ApiHolder;
873
+ config: T['config'] & {
874
+ [key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
875
+ };
876
+ inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
877
+ }): Iterable<UFactoryOutput> & VerifyExtensionFactoryOutput<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UFactoryOutput>;
878
+ }): OverridableExtensionDefinition<{
879
+ config: Expand<(string extends keyof TExtensionConfigSchema ? {} : {
880
+ [key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
881
+ }) & T['config']>;
882
+ configInput: Expand<(string extends keyof TExtensionConfigSchema ? {} : z.input<z.ZodObject<{
883
+ [key in keyof TExtensionConfigSchema]: ReturnType<TExtensionConfigSchema[key]>;
884
+ }>>) & T['configInput']>;
885
+ output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
886
+ inputs: Expand<T['inputs'] & TExtraInputs>;
887
+ kind: T['kind'];
888
+ name: string | undefined extends TName ? undefined : TName;
889
+ params: T['params'];
890
+ }>;
891
+ }
892
+ /**
893
+ * Creates a new extension blueprint that encapsulates the creation of
894
+ * extensions of particular kinds.
895
+ *
896
+ * @remarks
897
+ *
898
+ * For details on how blueprints work, see the
899
+ * {@link https://backstage.io/docs/frontend-system/architecture/extension-blueprints | documentation for extension blueprints}
900
+ * in the frontend system documentation.
901
+ *
902
+ * Extension blueprints make it much easier for users to create new extensions
903
+ * for your plugin. Rather than letting them use {@link createExtension}
904
+ * directly, you can define a set of parameters and default factory for your
905
+ * blueprint, removing a lot of the boilerplate and complexity that is otherwise
906
+ * needed to create an extension.
907
+ *
908
+ * Each blueprint has its own `kind` that helps identify and group the
909
+ * extensions that have been created with it. For example the
910
+ * {@link PageBlueprint} has the kind `'page'`, and extensions created with it
911
+ * will be given the ID `'page:<plugin-id>[/<name>]'`. Blueprints should always
912
+ * be exported as `<PascalCaseKind>Blueprint`.
913
+ *
914
+ * When creating a blueprint the type of the parameters are inferred from the
915
+ * `factory` function that you provide. The exception to that is when you need
916
+ * your blueprint to include inferred type parameters, in which case you need to
917
+ * use the `defineParams` option. See the documentation for the `defineParams`
918
+ * option for more details on how that works.
919
+ *
920
+ * @example
921
+ * ```tsx
922
+ * // In your plugin library
923
+ * export const GreetingBlueprint = createExtensionBlueprint({
924
+ * kind: 'greeting',
925
+ * attachTo: { id: 'example', input: 'greetings' },
926
+ * output: [coreExtensionData.reactElement],
927
+ * factory(params: { greeting: string }) {
928
+ * return [coreExtensionData.reactElement(<h1>{params.greeting}</h1>)];
929
+ * },
930
+ * });
931
+ *
932
+ * // Someone using your blueprint in their plugin
933
+ * const exampleGreeting = GreetingBlueprint.make({
934
+ * params: {
935
+ * greeting: 'Hello, world!',
936
+ * },
937
+ * });
938
+ * ```
939
+ * @public
940
+ */
941
+ declare function createExtensionBlueprint<TParams extends object | ExtensionBlueprintDefineParams, UOutput extends ExtensionDataRef, TInputs extends {
942
+ [inputName in string]: ExtensionInput;
943
+ }, TConfigSchema extends {
944
+ [key in string]: (zImpl: typeof z) => z.ZodType;
945
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, TKind extends string, UParentInputs extends ExtensionDataRef, TDataRefs extends {
946
+ [name in string]: ExtensionDataRef;
947
+ } = never>(options: CreateExtensionBlueprintOptions<TKind, TParams, UOutput, TInputs, TConfigSchema, UFactoryOutput, TDataRefs, UParentInputs>): ExtensionBlueprint<{
948
+ kind: TKind;
949
+ params: TParams;
950
+ output: UOutput extends ExtensionDataRef<infer IData, infer IId, infer IConfig> ? ExtensionDataRef<IData, IId, IConfig> : never;
951
+ inputs: string extends keyof TInputs ? {} : TInputs;
952
+ config: string extends keyof TConfigSchema ? {} : {
953
+ [key in keyof TConfigSchema]: z.infer<ReturnType<TConfigSchema[key]>>;
954
+ };
955
+ configInput: string extends keyof TConfigSchema ? {} : z.input<z.ZodObject<{
956
+ [key in keyof TConfigSchema]: ReturnType<TConfigSchema[key]>;
957
+ }>>;
958
+ dataRefs: TDataRefs;
959
+ }>;
960
+
961
+ /** @ignore */
962
+ type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> = TExtensionInput['extensionData'] extends Array<ExtensionDataRef> ? {
963
+ node: AppNode;
964
+ } & ExtensionDataContainer<TExtensionInput['extensionData'][number]> : never;
965
+ /**
966
+ * Converts an extension input map into a matching collection of resolved inputs.
967
+ *
968
+ * @ignore
969
+ */
970
+ type ResolvedExtensionInputs<TInputs extends {
971
+ [name in string]: ExtensionInput;
972
+ }> = {
973
+ [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton'] ? Array<Expand<ResolvedExtensionInput<TInputs[InputName]>>> : false extends TInputs[InputName]['config']['optional'] ? Expand<ResolvedExtensionInput<TInputs[InputName]>> : Expand<ResolvedExtensionInput<TInputs[InputName]> | undefined>;
974
+ };
975
+ type ToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
976
+ type PopUnion<U> = ToIntersection<U extends any ? () => U : never> extends () => infer R ? [rest: Exclude<U, R>, next: R] : undefined;
977
+ /** @ignore */
978
+ type JoinStringUnion<U, TDiv extends string = ', ', TResult extends string = ''> = PopUnion<U> extends [infer IRest extends string, infer INext extends string] ? TResult extends '' ? JoinStringUnion<IRest, TDiv, INext> : JoinStringUnion<IRest, TDiv, `${TResult}${TDiv}${INext}`> : TResult;
979
+ /** @ignore */
980
+ type RequiredExtensionIds<UExtensionData extends ExtensionDataRef> = UExtensionData extends any ? UExtensionData['config']['optional'] extends true ? never : UExtensionData['id'] : never;
981
+ /** @ignore */
982
+ type VerifyExtensionFactoryOutput<UDeclaredOutput extends ExtensionDataRef, UFactoryOutput extends ExtensionDataValue<any, any>> = [RequiredExtensionIds<UDeclaredOutput>] extends [UFactoryOutput['id']] ? [UFactoryOutput['id']] extends [UDeclaredOutput['id']] ? {} : `Error: The extension factory has undeclared output(s): ${JoinStringUnion<Exclude<UFactoryOutput['id'], UDeclaredOutput['id']>>}` : `Error: The extension factory is missing the following output(s): ${JoinStringUnion<Exclude<RequiredExtensionIds<UDeclaredOutput>, UFactoryOutput['id']>>}`;
983
+ /** @ignore */
984
+ type VerifyExtensionAttachTo<UOutput extends ExtensionDataRef, UParentInput extends ExtensionDataRef> = ExtensionDataRef extends UParentInput ? {} : [RequiredExtensionIds<UParentInput>] extends [RequiredExtensionIds<UOutput>] ? {} : `Error: This parent extension input requires the following extension data, but it is not declared as guaranteed output of this extension: ${JoinStringUnion<Exclude<RequiredExtensionIds<UParentInput>, RequiredExtensionIds<UOutput>>>}`;
985
+ /**
986
+ * Specifies where an extension should attach in the extension tree.
987
+ *
988
+ * @remarks
989
+ *
990
+ * A standard attachment point declaration will specify the ID of the parent extension, as well as the name of the input to attach to.
991
+ *
992
+ * There are two more advanced forms that are available for more complex use-cases:
993
+ *
994
+ * 1. Relative attachment points: using the `relative` property instead of `id`, the attachment point is resolved relative to the current plugin.
995
+ * 2. Extension input references: using a reference in code to another extension's input in the same plugin. These references are always relative.
996
+ *
997
+ * @example
998
+ * ```ts
999
+ * // Attach to a specific extension by full ID
1000
+ * { id: 'app/routes', input: 'routes' }
1001
+ *
1002
+ * // Attach to an extension in the same plugin by kind
1003
+ * { relative: { kind: 'page' }, input: 'actions' }
1004
+ *
1005
+ * // Attach to a specific input of another extension
1006
+ * const page = ParentBlueprint.make({ ... });
1007
+ * const child = ChildBlueprint.make({ attachTo: page.inputs.children });
1008
+ * ```
1009
+ *
1010
+ * @public
1011
+ */
1012
+ type ExtensionDefinitionAttachTo<UParentInputs extends ExtensionDataRef = ExtensionDataRef> = {
1013
+ id: string;
1014
+ input: string;
1015
+ relative?: never;
1016
+ } | {
1017
+ relative: {
1018
+ kind?: string;
1019
+ name?: string;
1020
+ };
1021
+ input: string;
1022
+ id?: never;
1023
+ } | ExtensionInput<UParentInputs>;
1024
+ /** @public */
1025
+ type CreateExtensionOptions<TKind extends string | undefined, TName extends string | undefined, UOutput extends ExtensionDataRef, TInputs extends {
1026
+ [inputName in string]: ExtensionInput;
1027
+ }, TConfigSchema extends {
1028
+ [key: string]: (zImpl: typeof z) => z.ZodType;
1029
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, UParentInputs extends ExtensionDataRef> = {
1030
+ kind?: TKind;
1031
+ name?: TName;
1032
+ attachTo: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<UOutput, UParentInputs>;
1033
+ disabled?: boolean;
1034
+ if?: FilterPredicate;
1035
+ inputs?: TInputs;
1036
+ output: Array<UOutput>;
1037
+ config?: {
1038
+ schema: TConfigSchema;
1039
+ };
1040
+ factory(context: {
1041
+ node: AppNode;
1042
+ apis: ApiHolder;
1043
+ config: {
1044
+ [key in keyof TConfigSchema]: z.infer<ReturnType<TConfigSchema[key]>>;
1045
+ };
1046
+ inputs: Expand<ResolvedExtensionInputs<TInputs>>;
1047
+ }): Iterable<UFactoryOutput>;
1048
+ } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>;
1049
+ /** @public */
1050
+ type ExtensionDefinitionParameters = {
1051
+ kind?: string;
1052
+ name?: string;
1053
+ configInput?: {
1054
+ [K in string]: any;
1055
+ };
1056
+ config?: {
1057
+ [K in string]: any;
1058
+ };
1059
+ output?: ExtensionDataRef;
1060
+ inputs?: {
1061
+ [KName in string]: ExtensionInput;
1062
+ };
1063
+ params?: object | ExtensionBlueprintDefineParams;
1064
+ };
1065
+ /**
1066
+ * Same as the one in `createExtensionBlueprint`, but with `ParamsFactory` inlined.
1067
+ * It can't be exported because it breaks API reports.
1068
+ * @ignore
1069
+ */
1070
+ type AnyParamsInput<TParams extends object | ExtensionBlueprintDefineParams> = TParams extends ExtensionBlueprintDefineParams<infer IParams> ? IParams | ((define: TParams) => ReturnType<TParams>) : TParams | ((define: ExtensionBlueprintDefineParams<TParams, TParams>) => ReturnType<ExtensionBlueprintDefineParams<TParams, TParams>>);
1071
+ /** @public */
1072
+ interface ExtensionDefinition<TParams extends ExtensionDefinitionParameters = ExtensionDefinitionParameters> {
1073
+ $$type: '@backstage/ExtensionDefinition';
1074
+ readonly T: TParams;
1075
+ }
1076
+ /** @public */
1077
+ interface OverridableExtensionDefinition<T extends ExtensionDefinitionParameters = ExtensionDefinitionParameters> extends ExtensionDefinition<T> {
1078
+ /**
1079
+ * References to the inputs of this extension, which can be used to attach child extensions.
1080
+ */
1081
+ readonly inputs: {
1082
+ [K in keyof T['inputs']]: ExtensionInput<T['inputs'][K] extends ExtensionInput<infer IData> ? IData : never>;
1083
+ };
1084
+ override<TExtensionConfigSchema extends {
1085
+ [key in string]: (zImpl: typeof z) => z.ZodType;
1086
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, UNewOutput extends ExtensionDataRef, TExtraInputs extends {
1087
+ [inputName in string]: ExtensionInput;
1088
+ }, TParamsInput extends AnyParamsInput<NonNullable<T['params']>>, UParentInputs extends ExtensionDataRef>(args: Expand<{
1089
+ attachTo?: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UParentInputs>;
1090
+ disabled?: boolean;
1091
+ if?: FilterPredicate;
1092
+ inputs?: TExtraInputs & {
1093
+ [KName in keyof T['inputs']]?: `Error: Input '${KName & string}' is already defined in parent definition`;
1094
+ };
1095
+ output?: Array<UNewOutput>;
1096
+ config?: {
1097
+ schema: TExtensionConfigSchema & {
1098
+ [KName in keyof T['config']]?: `Error: Config key '${KName & string}' is already defined in parent schema`;
1099
+ };
1100
+ };
1101
+ factory?(originalFactory: <TFactoryParamsReturn extends AnyParamsInput<NonNullable<T['params']>>>(context?: Expand<{
1102
+ config?: T['config'];
1103
+ inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;
1104
+ } & ([T['params']] extends [never] ? {} : {
1105
+ params?: TFactoryParamsReturn extends ExtensionBlueprintDefineParams ? TFactoryParamsReturn : T['params'] extends ExtensionBlueprintDefineParams ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`' : Partial<T['params']>;
1106
+ })>) => ExtensionDataContainer<NonNullable<T['output']>>, context: {
1107
+ node: AppNode;
1108
+ apis: ApiHolder;
1109
+ config: T['config'] & {
1110
+ [key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
1111
+ };
1112
+ inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
1113
+ }): Iterable<UFactoryOutput>;
1114
+ } & ([T['params']] extends [never] ? {} : {
1115
+ params?: TParamsInput extends ExtensionBlueprintDefineParams ? TParamsInput : T['params'] extends ExtensionBlueprintDefineParams ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`' : Partial<T['params']>;
1116
+ })> & VerifyExtensionFactoryOutput<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UFactoryOutput>): OverridableExtensionDefinition<{
1117
+ kind: T['kind'];
1118
+ name: T['name'];
1119
+ output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
1120
+ inputs: T['inputs'] & TExtraInputs;
1121
+ config: T['config'] & {
1122
+ [key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
1123
+ };
1124
+ configInput: T['configInput'] & z.input<z.ZodObject<{
1125
+ [key in keyof TExtensionConfigSchema]: ReturnType<TExtensionConfigSchema[key]>;
1126
+ }>>;
1127
+ }>;
1128
+ }
1129
+ /**
1130
+ * Creates a new extension definition for installation in a Backstage app.
1131
+ *
1132
+ * @remarks
1133
+ *
1134
+ * This is a low-level function for creation of extensions with arbitrary inputs
1135
+ * and outputs and is typically only intended to be used for advanced overrides
1136
+ * or framework-level extensions. For most extension creation needs, it is
1137
+ * recommended to use existing {@link ExtensionBlueprint}s instead. You can find
1138
+ * blueprints both in the `@backstage/frontend-plugin-api` package as well as
1139
+ * other plugin libraries. There is also a list of
1140
+ * {@link https://backstage.io/docs/frontend-system/building-plugins/common-extension-blueprints | commonly used blueprints}
1141
+ * in the frontend system documentation.
1142
+ *
1143
+ * Extension definitions that are created with this function can be installed in
1144
+ * a Backstage app via a {@link FrontendPlugin} or {@link FrontendModule}.
1145
+ *
1146
+ * For more details on how extensions work, see the
1147
+ * {@link https://backstage.io/docs/frontend-system/architecture/extensions | documentation for extensions}.
1148
+ *
1149
+ * @example
1150
+ *
1151
+ * ```ts
1152
+ * const myExtension = createExtension({
1153
+ * name: 'example',
1154
+ * attachTo: { id: 'app', input: 'root' },
1155
+ * output: [coreExtensionData.reactElement],
1156
+ * factory() {
1157
+ * return [coreExtensionData.reactElement(<h1>Hello, world!</h1>)];
1158
+ * },
1159
+ * });
1160
+ * ```
1161
+ *
1162
+ * @public
1163
+ */
1164
+ declare function createExtension<UOutput extends ExtensionDataRef, TInputs extends {
1165
+ [inputName in string]: ExtensionInput;
1166
+ }, TConfigSchema extends {
1167
+ [key: string]: (zImpl: typeof z) => z.ZodType;
1168
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, const TKind extends string | undefined = undefined, const TName extends string | undefined = undefined, UParentInputs extends ExtensionDataRef = ExtensionDataRef>(options: CreateExtensionOptions<TKind, TName, UOutput, TInputs, TConfigSchema, UFactoryOutput, UParentInputs>): OverridableExtensionDefinition<{
1169
+ config: string extends keyof TConfigSchema ? {} : {
1170
+ [key in keyof TConfigSchema]: z.infer<ReturnType<TConfigSchema[key]>>;
1171
+ };
1172
+ configInput: string extends keyof TConfigSchema ? {} : z.input<z.ZodObject<{
1173
+ [key in keyof TConfigSchema]: ReturnType<TConfigSchema[key]>;
1174
+ }>>;
1175
+ output: UOutput extends ExtensionDataRef<infer IData, infer IId, infer IConfig> ? ExtensionDataRef<IData, IId, IConfig> : never;
1176
+ inputs: TInputs;
1177
+ params: never;
1178
+ kind: string | undefined extends TKind ? undefined : TKind;
1179
+ name: string | undefined extends TName ? undefined : TName;
1180
+ }>;
1181
+
1182
+ /**
1183
+ * The specification for this {@link AppNode} in the {@link AppTree}.
1184
+ *
1185
+ * @public
1186
+ * @remarks
1187
+ *
1188
+ * The specifications for a collection of app nodes is all the information needed
1189
+ * to build the tree and instantiate the nodes.
1190
+ */
1191
+ interface AppNodeSpec {
1192
+ readonly id: string;
1193
+ readonly attachTo: ExtensionAttachTo;
1194
+ readonly extension: Extension<unknown, unknown>;
1195
+ readonly disabled: boolean;
1196
+ readonly if?: FilterPredicate;
1197
+ readonly config?: unknown;
1198
+ readonly plugin: FrontendPlugin;
1199
+ }
1200
+ /**
1201
+ * The connections from this {@link AppNode} to other nodes.
1202
+ *
1203
+ * @public
1204
+ * @remarks
1205
+ *
1206
+ * The app node edges are resolved based on the app node specs, regardless of whether
1207
+ * adjacent nodes are disabled or not. If no parent attachment is present or
1208
+ */
1209
+ interface AppNodeEdges {
1210
+ readonly attachedTo?: {
1211
+ node: AppNode;
1212
+ input: string;
1213
+ };
1214
+ readonly attachments: ReadonlyMap<string, AppNode[]>;
1215
+ }
1216
+ /**
1217
+ * The instance of this {@link AppNode} in the {@link AppTree}.
1218
+ *
1219
+ * @public
1220
+ * @remarks
1221
+ *
1222
+ * The app node instance is created when the `factory` function of an extension is called.
1223
+ * Instances will only be present for nodes in the app that are connected to the root
1224
+ * node and not disabled
1225
+ */
1226
+ interface AppNodeInstance {
1227
+ /** Returns a sequence of all extension data refs that were output by this instance */
1228
+ getDataRefs(): Iterable<ExtensionDataRef<unknown>>;
1229
+ /** Get the output data for a single extension data ref */
1230
+ getData<T>(ref: ExtensionDataRef<T>): T | undefined;
1231
+ }
1232
+ /**
1233
+ * A node in the {@link AppTree}.
1234
+ *
1235
+ * @public
1236
+ */
1237
+ interface AppNode {
1238
+ /** The specification for how this node should be instantiated */
1239
+ readonly spec: AppNodeSpec;
1240
+ /** The edges from this node to other nodes in the app tree */
1241
+ readonly edges: AppNodeEdges;
1242
+ /** The instance of this node, if it was instantiated */
1243
+ readonly instance?: AppNodeInstance;
1244
+ }
1245
+ /**
1246
+ * The app tree containing all {@link AppNode}s of the app.
1247
+ *
1248
+ * @public
1249
+ */
1250
+ interface AppTree {
1251
+ /** The root node of the app */
1252
+ readonly root: AppNode;
1253
+ /** A map of all nodes in the app by ID, including orphaned or disabled nodes */
1254
+ readonly nodes: ReadonlyMap<string, AppNode>;
1255
+ /** A sequence of all nodes with a parent that is not reachable from the app root node */
1256
+ readonly orphans: Iterable<AppNode>;
1257
+ }
1258
+ /**
1259
+ * The API for interacting with the {@link AppTree}.
1260
+ *
1261
+ * @public
1262
+ */
1263
+ interface AppTreeApi {
1264
+ /**
1265
+ * Get the {@link AppTree} for the app.
1266
+ */
1267
+ getTree(): {
1268
+ tree: AppTree;
1269
+ };
1270
+ /**
1271
+ * Get all nodes in the app that are mounted at a given route path.
1272
+ */
1273
+ getNodesByRoutePath(routePath: string): {
1274
+ nodes: AppNode[];
1275
+ };
1276
+ }
1277
+ /**
1278
+ * The `ApiRef` of {@link AppTreeApi}.
1279
+ *
1280
+ * @public
1281
+ */
1282
+ declare const appTreeApiRef: _backstage_frontend_plugin_api.ApiRef<AppTreeApi, "core.app-tree"> & {
1283
+ readonly $$type: "@backstage/ApiRef";
1284
+ };
1285
+
1286
+ /**
1287
+ * API reference.
1288
+ *
1289
+ * @public
1290
+ */
1291
+ type ApiRef<T, TId extends string = string> = {
1292
+ readonly $$type?: '@backstage/ApiRef';
1293
+ readonly id: TId;
1294
+ readonly T: T;
1295
+ };
1296
+ /**
1297
+ * Catch-all {@link ApiRef} type.
1298
+ *
1299
+ * @public
1300
+ */
1301
+ type AnyApiRef = ApiRef<unknown>;
1302
+ /**
1303
+ * Wraps a type with API properties into a type holding their respective {@link ApiRef}s.
1304
+ *
1305
+ * @public
1306
+ */
1307
+ type TypesToApiRefs<T> = {
1308
+ [key in keyof T]: ApiRef<T[key]>;
1309
+ };
1310
+ /**
1311
+ * Provides lookup of APIs through their {@link ApiRef}s.
1312
+ *
1313
+ * @public
1314
+ */
1315
+ type ApiHolder = {
1316
+ get<T>(api: ApiRef<T>): T | undefined;
1317
+ };
1318
+ /**
1319
+ * Describes type returning API implementations.
1320
+ *
1321
+ * @public
1322
+ */
1323
+ type ApiFactory<Api, Impl extends Api, Deps extends {
1324
+ [name in string]: unknown;
1325
+ }> = {
1326
+ api: ApiRef<Api>;
1327
+ deps: TypesToApiRefs<Deps>;
1328
+ factory(deps: Deps): Impl;
1329
+ };
1330
+ /**
1331
+ * Catch-all {@link ApiFactory} type.
1332
+ *
1333
+ * @public
1334
+ */
1335
+ type AnyApiFactory = ApiFactory<unknown, unknown, {
1336
+ [key in string]: unknown;
1337
+ }>;
1338
+
1339
+ /**
1340
+ * The Plugin Wrapper API allows plugins to wrap their extensions with
1341
+ * providers. This API is only intended for internal use by the Backstage
1342
+ * frontend system. To provide contexts to plugin components, use
1343
+ * `ExtensionBoundary` instead.
1344
+ *
1345
+ * @public
1346
+ */
1347
+ type PluginWrapperApi = {
1348
+ /**
1349
+ * Returns the root wrapper that manages the global plugin state across
1350
+ * plugin wrapper instances.
1351
+ */
1352
+ getRootWrapper(): ComponentType<{
1353
+ children: ReactNode;
1354
+ }>;
1355
+ /**
1356
+ * Returns a wrapper component for a specific plugin, or undefined if no
1357
+ * wrappers exist. Do not use this API directly, instead use
1358
+ * `ExtensionBoundary` to wrap your plugin components if needed.
1359
+ */
1360
+ getPluginWrapper(pluginId: string): ComponentType<{
1361
+ children: ReactNode;
1362
+ }> | undefined;
1363
+ };
1364
+ /**
1365
+ * The API reference of {@link PluginWrapperApi}.
1366
+ *
1367
+ * @public
1368
+ */
1369
+ declare const pluginWrapperApiRef: _backstage_frontend_plugin_api.ApiRef<PluginWrapperApi, "core.plugin-wrapper"> & {
1370
+ readonly $$type: "@backstage/ApiRef";
1371
+ };
1372
+
1373
+ /**
1374
+ * Defines the structure of a plugin wrapper, optionally including a shared
1375
+ * hook value.
1376
+ *
1377
+ * @remarks
1378
+ *
1379
+ * When `useWrapperValue` is provided, the hook is called in a single location
1380
+ * in the app and the resulting value is forwarded as the `value` prop to the
1381
+ * component. The hook obeys the rules of React hooks and is not called until a
1382
+ * component from the plugin is rendered.
1383
+ *
1384
+ * @public
1385
+ */
1386
+ type PluginWrapperDefinition<TValue = unknown | never> = {
1387
+ /**
1388
+ * Creates a shared value that is forwarded as the `value` prop to the
1389
+ * component.
1390
+ *
1391
+ * @remarks
1392
+ *
1393
+ * This function obeys the rules of React hooks and is only invoked in a
1394
+ * single location in the app. Note that the hook will not be called until a
1395
+ * component from the plugin is rendered.
1396
+ */
1397
+ useWrapperValue?: () => TValue;
1398
+ component: ComponentType<{
1399
+ children: ReactNode;
1400
+ value: TValue;
1401
+ }>;
1402
+ };
1403
+ /**
1404
+ * Creates extensions that wrap plugin extensions with providers.
1405
+ *
1406
+ * @public
1407
+ */
1408
+ declare const PluginWrapperBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1409
+ kind: "plugin-wrapper";
1410
+ params: <TValue = never>(params: {
1411
+ loader: () => Promise<PluginWrapperDefinition<TValue>>;
1412
+ }) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<{
1413
+ loader: () => Promise<PluginWrapperDefinition>;
1414
+ }>;
1415
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<() => Promise<PluginWrapperDefinition>, "core.plugin-wrapper.loader", {}>;
1416
+ inputs: {};
1417
+ config: {};
1418
+ configInput: {};
1419
+ dataRefs: {
1420
+ wrapper: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<PluginWrapperDefinition>, "core.plugin-wrapper.loader", {}>;
1421
+ };
1422
+ }>;
1423
+
1424
+ export { createExtensionDataRef as D, createFrontendPlugin as K, createFrontendModule as V, createExtensionBlueprint as a6, createExtensionBlueprintParams as a7, appTreeApiRef as h, PluginWrapperBlueprint as o, pluginWrapperApiRef as p, createRouteRef as r, createSubRouteRef as s, createExternalRouteRef as t, createExtension as v, createExtensionInput as z };
1425
+ export type { FeatureFlagConfig as $, AnyRouteRefParams as A, ExtensionInput as B, CreateExtensionOptions as C, ExternalRouteRef as E, FrontendFeature as F, ExtensionDataRef as G, ExtensionDataValue as H, IconElement as I, ConfigurableExtensionDataRef as J, CreateFrontendPluginOptions as L, OverridableFrontendPlugin as M, PluginOptions as N, OverridableExtensionDefinition as O, PluginWrapperApi as P, FrontendPluginInfo as Q, RouteRef as R, SubRouteRef as S, TypesToApiRefs as T, FrontendPluginInfoOptions as U, FrontendModule as W, CreateFrontendModuleOptions as X, Extension as Y, ExtensionAttachTo as Z, ExtensionDataContainer as _, IconComponent as a, ExtensionFactoryMiddleware as a0, CreateExtensionBlueprintOptions as a1, ExtensionBlueprint as a2, ExtensionBlueprintParameters as a3, ExtensionBlueprintParams as a4, ExtensionBlueprintDefineParams as a5, AppNode as b, FrontendPlugin as c, ApiRef as d, ApiHolder as e, ApiFactory as f, AnyApiFactory as g, AppNodeEdges as i, AppNodeInstance as j, AppNodeSpec as k, AppTree as l, AppTreeApi as m, AnyApiRef as n, PluginWrapperDefinition as q, PortableSchema as u, ExtensionDefinition as w, ExtensionDefinitionAttachTo as x, ExtensionDefinitionParameters as y };