@backstage/frontend-plugin-api 0.2.0-next.2 → 0.3.0-next.0
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.
- package/CHANGELOG.md +34 -0
- package/dist/index.d.ts +233 -16
- package/dist/index.esm.js +340 -12
- package/dist/index.esm.js.map +1 -1
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.3.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 68fc9dc60e: Added `RouteRef`, `SubRouteRef`, `ExternalRouteRef`, and related types. All exports from this package that previously relied on the types with the same name from `@backstage/core-plugin-api` now use the new types instead. To convert and existing legacy route ref to be compatible with the APIs from this package, use the `convertLegacyRouteRef` utility from `@backstage/core-plugin-api/alpha`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 6c2b872153: Add official support for React 18.
|
|
12
|
+
- 6af88a05ff: Improve the extension boundary component and create a default extension suspense component.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/core-components@0.13.7-next.0
|
|
15
|
+
- @backstage/core-plugin-api@1.8.0-next.0
|
|
16
|
+
- @backstage/version-bridge@1.0.7-next.0
|
|
17
|
+
- @backstage/types@1.1.1
|
|
18
|
+
|
|
19
|
+
## 0.2.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 06432f900c: Extension attachment point is now configured via `attachTo: { id, input }` instead of `at: 'id/input'`.
|
|
24
|
+
- 4461d87d5a: Removed support for the new `useRouteRef`.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- d3a37f55c0: Add support for `SidebarGroup` on the sidebar item extension.
|
|
29
|
+
- 2ecd33618a: Plugins can now be assigned `routes` and `externalRoutes` when created.
|
|
30
|
+
- 9a1fce352e: Updated dependency `@testing-library/jest-dom` to `^6.0.0`.
|
|
31
|
+
- c1e9ca6500: Added `createExtensionOverrides` which can be used to install a collection of extensions in an app that will replace any existing ones.
|
|
32
|
+
- 52366db5b3: Added `createThemeExtension` and `coreExtensionData.theme`.
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
- @backstage/core-plugin-api@1.7.0
|
|
35
|
+
- @backstage/types@1.1.1
|
|
36
|
+
|
|
3
37
|
## 0.2.0-next.2
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,200 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React, { JSX as JSX$1, ReactNode } from 'react';
|
|
3
3
|
import { JsonObject } from '@backstage/types';
|
|
4
|
-
import { IconComponent,
|
|
4
|
+
import { IconComponent, AnyApiFactory, AppTheme, AnyApiRef } from '@backstage/core-plugin-api';
|
|
5
5
|
import { z, ZodSchema, ZodTypeDef } from 'zod';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Catch-all type for route params.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
type AnyRouteRefParams = {
|
|
13
|
+
[param in string]: string;
|
|
14
|
+
} | undefined;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Absolute route reference.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*
|
|
21
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
interface RouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams> {
|
|
26
|
+
readonly $$type: '@backstage/RouteRef';
|
|
27
|
+
readonly T: TParams;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a {@link RouteRef} from a route descriptor.
|
|
31
|
+
*
|
|
32
|
+
* @param config - Description of the route reference to be created.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
declare function createRouteRef<TParams extends {
|
|
36
|
+
[param in TParamKeys]: string;
|
|
37
|
+
} | undefined = undefined, TParamKeys extends string = string>(config?: {
|
|
38
|
+
/** A list of parameter names that the path that this route ref is bound to must contain */
|
|
39
|
+
readonly params: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];
|
|
40
|
+
}): RouteRef<keyof TParams extends never ? undefined : string extends TParamKeys ? TParams : {
|
|
41
|
+
[param in TParamKeys]: string;
|
|
42
|
+
}>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Descriptor of a route relative to an absolute {@link RouteRef}.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
*
|
|
49
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
interface SubRouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams> {
|
|
54
|
+
readonly $$type: '@backstage/SubRouteRef';
|
|
55
|
+
readonly T: TParams;
|
|
56
|
+
readonly path: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Used in {@link PathParams} type declaration.
|
|
60
|
+
* @ignore
|
|
61
|
+
*/
|
|
62
|
+
type ParamPart<S extends string> = S extends `:${infer Param}` ? Param : never;
|
|
63
|
+
/**
|
|
64
|
+
* Used in {@link PathParams} type declaration.
|
|
65
|
+
* @ignore
|
|
66
|
+
*/
|
|
67
|
+
type ParamNames<S extends string> = S extends `${infer Part}/${infer Rest}` ? ParamPart<Part> | ParamNames<Rest> : ParamPart<S>;
|
|
68
|
+
/**
|
|
69
|
+
* This utility type helps us infer a Param object type from a string path
|
|
70
|
+
* For example, `/foo/:bar/:baz` inferred to `{ bar: string, baz: string }`
|
|
71
|
+
* @ignore
|
|
72
|
+
*/
|
|
73
|
+
type PathParams<S extends string> = {
|
|
74
|
+
[name in ParamNames<S>]: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Merges a param object type with an optional params type into a params object.
|
|
78
|
+
* @ignore
|
|
79
|
+
*/
|
|
80
|
+
type MergeParams<P1 extends {
|
|
81
|
+
[param in string]: string;
|
|
82
|
+
}, P2 extends AnyRouteRefParams> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);
|
|
83
|
+
/**
|
|
84
|
+
* Convert empty params to undefined.
|
|
85
|
+
* @ignore
|
|
86
|
+
*/
|
|
87
|
+
type TrimEmptyParams<Params extends {
|
|
88
|
+
[param in string]: string;
|
|
89
|
+
}> = keyof Params extends never ? undefined : Params;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a SubRouteRef type given the desired parameters and parent route parameters.
|
|
92
|
+
* The parameters types are merged together while ensuring that there is no overlap between the two.
|
|
93
|
+
*
|
|
94
|
+
* @ignore
|
|
95
|
+
*/
|
|
96
|
+
type MakeSubRouteRef<Params extends {
|
|
97
|
+
[param in string]: string;
|
|
98
|
+
}, ParentParams extends AnyRouteRefParams> = keyof Params & keyof ParentParams extends never ? SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>> : never;
|
|
99
|
+
/**
|
|
100
|
+
* Create a {@link SubRouteRef} from a route descriptor.
|
|
101
|
+
*
|
|
102
|
+
* @param config - Description of the route reference to be created.
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
declare function createSubRouteRef<Path extends string, ParentParams extends AnyRouteRefParams = never>(config: {
|
|
106
|
+
path: Path;
|
|
107
|
+
parent: RouteRef<ParentParams>;
|
|
108
|
+
}): MakeSubRouteRef<PathParams<Path>, ParentParams>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
*
|
|
115
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
interface ExternalRouteRef<TParams extends AnyRouteRefParams = AnyRouteRefParams, TOptional extends boolean = boolean> {
|
|
120
|
+
readonly $$type: '@backstage/ExternalRouteRef';
|
|
121
|
+
readonly T: TParams;
|
|
122
|
+
readonly optional: TOptional;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
*
|
|
129
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}.
|
|
130
|
+
*
|
|
131
|
+
* @param options - Description of the route reference to be created.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
declare function createExternalRouteRef<TParams extends {
|
|
135
|
+
[param in TParamKeys]: string;
|
|
136
|
+
} | undefined = undefined, TOptional extends boolean = false, TParamKeys extends string = string>(options?: {
|
|
137
|
+
/**
|
|
138
|
+
* The parameters that will be provided to the external route reference.
|
|
139
|
+
*/
|
|
140
|
+
readonly params?: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];
|
|
141
|
+
/**
|
|
142
|
+
* Whether or not this route is optional, defaults to false.
|
|
143
|
+
*
|
|
144
|
+
* Optional external routes are not required to be bound in the app, and
|
|
145
|
+
* if they aren't, `useExternalRouteRef` will return `undefined`.
|
|
146
|
+
*/
|
|
147
|
+
optional?: TOptional;
|
|
148
|
+
}): ExternalRouteRef<keyof TParams extends never ? undefined : string extends TParamKeys ? TParams : {
|
|
149
|
+
[param in TParamKeys]: string;
|
|
150
|
+
}, TOptional>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* TS magic for handling route parameters.
|
|
154
|
+
*
|
|
155
|
+
* @remarks
|
|
156
|
+
*
|
|
157
|
+
* The extra TS magic here is to require a single params argument if the RouteRef
|
|
158
|
+
* had at least one param defined, but require 0 arguments if there are no params defined.
|
|
159
|
+
* Without this we'd have to pass in empty object to all parameter-less RouteRefs
|
|
160
|
+
* just to make TypeScript happy, or we would have to make the argument optional in
|
|
161
|
+
* which case you might forget to pass it in when it is actually required.
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
type RouteFunc<TParams extends AnyRouteRefParams> = (...[params]: TParams extends undefined ? readonly [] : readonly [params: TParams]) => string;
|
|
166
|
+
/**
|
|
167
|
+
* React hook for constructing URLs to routes.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
*
|
|
171
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}
|
|
172
|
+
*
|
|
173
|
+
* @param routeRef - The ref to route that should be converted to URL.
|
|
174
|
+
* @returns A function that will in turn return the concrete URL of the `routeRef`.
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
declare function useRouteRef<TOptional extends boolean, TParams extends AnyRouteRefParams>(routeRef: ExternalRouteRef<TParams, TOptional>): TParams extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;
|
|
178
|
+
/**
|
|
179
|
+
* React hook for constructing URLs to routes.
|
|
180
|
+
*
|
|
181
|
+
* @remarks
|
|
182
|
+
*
|
|
183
|
+
* See {@link https://backstage.io/docs/plugins/composability#routing-system}
|
|
184
|
+
*
|
|
185
|
+
* @param routeRef - The ref to route that should be converted to URL.
|
|
186
|
+
* @returns A function that will in turn return the concrete URL of the `routeRef`.
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
declare function useRouteRef<TParams extends AnyRouteRefParams>(routeRef: RouteRef<TParams> | SubRouteRef<TParams>): RouteFunc<TParams>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* React hook for retrieving dynamic params from the current URL.
|
|
193
|
+
* @param _routeRef - Ref of the current route.
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
declare function useRouteRefParams<Params extends AnyRouteRefParams>(_routeRef: RouteRef<Params> | SubRouteRef<Params>): Params;
|
|
197
|
+
|
|
7
198
|
/** @public */
|
|
8
199
|
type ExtensionDataRef<TData, TConfig extends {
|
|
9
200
|
optional?: true;
|
|
@@ -28,14 +219,14 @@ declare function createExtensionDataRef<TData>(id: string): ConfigurableExtensio
|
|
|
28
219
|
type NavTarget = {
|
|
29
220
|
title: string;
|
|
30
221
|
icon: IconComponent;
|
|
31
|
-
routeRef: RouteRef<
|
|
222
|
+
routeRef: RouteRef<undefined>;
|
|
32
223
|
};
|
|
33
224
|
/** @public */
|
|
34
225
|
declare const coreExtensionData: {
|
|
35
226
|
reactElement: ConfigurableExtensionDataRef<JSX$1.Element, {}>;
|
|
36
227
|
routePath: ConfigurableExtensionDataRef<string, {}>;
|
|
37
228
|
apiFactory: ConfigurableExtensionDataRef<AnyApiFactory, {}>;
|
|
38
|
-
routeRef: ConfigurableExtensionDataRef<RouteRef
|
|
229
|
+
routeRef: ConfigurableExtensionDataRef<RouteRef<AnyRouteRefParams>, {}>;
|
|
39
230
|
navTarget: ConfigurableExtensionDataRef<NavTarget, {}>;
|
|
40
231
|
theme: ConfigurableExtensionDataRef<AppTheme, {}>;
|
|
41
232
|
};
|
|
@@ -49,6 +240,14 @@ type PortableSchema<TOutput> = {
|
|
|
49
240
|
/** @public */
|
|
50
241
|
declare function createSchemaFromZod<TOutput, TInput>(schemaCreator: (zImpl: typeof z) => ZodSchema<TOutput, ZodTypeDef, TInput>): PortableSchema<TOutput>;
|
|
51
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Utility type to expand type aliases into their equivalent type.
|
|
245
|
+
* @ignore
|
|
246
|
+
*/
|
|
247
|
+
type Expand<T> = T extends infer O ? {
|
|
248
|
+
[K in keyof O]: O[K];
|
|
249
|
+
} : never;
|
|
250
|
+
|
|
52
251
|
/** @public */
|
|
53
252
|
interface ExtensionInput<TExtensionData extends AnyExtensionDataMap, TConfig extends {
|
|
54
253
|
singleton: boolean;
|
|
@@ -68,18 +267,30 @@ declare function createExtensionInput<TExtensionData extends AnyExtensionDataMap
|
|
|
68
267
|
}>;
|
|
69
268
|
|
|
70
269
|
/** @public */
|
|
71
|
-
|
|
270
|
+
type AnyRoutes = {
|
|
271
|
+
[name in string]: RouteRef;
|
|
272
|
+
};
|
|
273
|
+
/** @public */
|
|
274
|
+
type AnyExternalRoutes = {
|
|
275
|
+
[name in string]: ExternalRouteRef;
|
|
276
|
+
};
|
|
277
|
+
/** @public */
|
|
278
|
+
interface PluginOptions<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> {
|
|
72
279
|
id: string;
|
|
280
|
+
routes?: Routes;
|
|
281
|
+
externalRoutes?: ExternalRoutes;
|
|
73
282
|
extensions?: Extension<unknown>[];
|
|
74
283
|
}
|
|
75
284
|
/** @public */
|
|
76
|
-
interface BackstagePlugin {
|
|
285
|
+
interface BackstagePlugin<Routes extends AnyRoutes = AnyRoutes, ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes> {
|
|
77
286
|
$$type: '@backstage/BackstagePlugin';
|
|
78
287
|
id: string;
|
|
79
288
|
extensions: Extension<unknown>[];
|
|
289
|
+
routes: Routes;
|
|
290
|
+
externalRoutes: ExternalRoutes;
|
|
80
291
|
}
|
|
81
292
|
/** @public */
|
|
82
|
-
declare function createPlugin(options: PluginOptions): BackstagePlugin
|
|
293
|
+
declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(options: PluginOptions<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
|
|
83
294
|
|
|
84
295
|
/** @public */
|
|
85
296
|
type AnyExtensionDataMap = {
|
|
@@ -94,13 +305,6 @@ type AnyExtensionInputMap = {
|
|
|
94
305
|
singleton: boolean;
|
|
95
306
|
}>;
|
|
96
307
|
};
|
|
97
|
-
/**
|
|
98
|
-
* Utility type to expand type aliases into their equivalent type.
|
|
99
|
-
* @ignore
|
|
100
|
-
*/
|
|
101
|
-
type Expand<T> = T extends infer O ? {
|
|
102
|
-
[K in keyof O]: O[K];
|
|
103
|
-
} : never;
|
|
104
308
|
/**
|
|
105
309
|
* Converts an extension data map into the matching concrete data values type.
|
|
106
310
|
* @public
|
|
@@ -163,10 +367,23 @@ interface Extension<TConfig> {
|
|
|
163
367
|
/** @public */
|
|
164
368
|
declare function createExtension<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig = never>(options: CreateExtensionOptions<TOutput, TInputs, TConfig>): Extension<TConfig>;
|
|
165
369
|
|
|
370
|
+
/** @public */
|
|
371
|
+
interface ExtensionOverridesOptions {
|
|
372
|
+
extensions: Extension<unknown>[];
|
|
373
|
+
}
|
|
374
|
+
/** @public */
|
|
375
|
+
interface ExtensionOverrides {
|
|
376
|
+
$$type: '@backstage/ExtensionOverrides';
|
|
377
|
+
}
|
|
378
|
+
/** @public */
|
|
379
|
+
declare function createExtensionOverrides(options: ExtensionOverridesOptions): ExtensionOverrides;
|
|
380
|
+
|
|
166
381
|
/** @public */
|
|
167
382
|
interface ExtensionBoundaryProps {
|
|
168
|
-
|
|
383
|
+
id: string;
|
|
169
384
|
source?: BackstagePlugin;
|
|
385
|
+
routable?: boolean;
|
|
386
|
+
children: ReactNode;
|
|
170
387
|
}
|
|
171
388
|
/** @public */
|
|
172
389
|
declare function ExtensionBoundary(props: ExtensionBoundaryProps): React.JSX.Element;
|
|
@@ -217,7 +434,7 @@ declare function createPageExtension<TConfig extends {
|
|
|
217
434
|
*/
|
|
218
435
|
declare function createNavItemExtension(options: {
|
|
219
436
|
id: string;
|
|
220
|
-
routeRef: RouteRef
|
|
437
|
+
routeRef: RouteRef<undefined>;
|
|
221
438
|
title: string;
|
|
222
439
|
icon: IconComponent;
|
|
223
440
|
}): Extension<{
|
|
@@ -227,4 +444,4 @@ declare function createNavItemExtension(options: {
|
|
|
227
444
|
/** @public */
|
|
228
445
|
declare function createThemeExtension(theme: AppTheme): Extension<never>;
|
|
229
446
|
|
|
230
|
-
export { AnyExtensionDataMap, AnyExtensionInputMap, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues, ExtensionInput, ExtensionInputValues, NavTarget, PluginOptions, PortableSchema, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, createThemeExtension };
|
|
447
|
+
export { AnyExtensionDataMap, AnyExtensionInputMap, AnyExternalRoutes, AnyRouteRefParams, AnyRoutes, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues, ExtensionInput, ExtensionInputValues, ExtensionOverrides, ExtensionOverridesOptions, ExternalRouteRef, NavTarget, PluginOptions, PortableSchema, RouteFunc, RouteRef, SubRouteRef, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createExtensionOverrides, createExternalRouteRef, createNavItemExtension, createPageExtension, createPlugin, createRouteRef, createSchemaFromZod, createSubRouteRef, createThemeExtension, useRouteRef, useRouteRefParams };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,88 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Component, Suspense, useEffect, lazy, useMemo } from 'react';
|
|
2
|
+
import { useApp, AnalyticsContext, useAnalytics } from '@backstage/core-plugin-api';
|
|
3
|
+
import { Button } from '@material-ui/core';
|
|
4
|
+
import { ErrorPanel } from '@backstage/core-components';
|
|
5
|
+
import { getOrCreateGlobalSingleton, useVersionedContext } from '@backstage/version-bridge';
|
|
2
6
|
import { z } from 'zod';
|
|
3
7
|
import zodToJsonSchema from 'zod-to-json-schema';
|
|
8
|
+
import { useLocation, useParams } from 'react-router-dom';
|
|
4
9
|
|
|
10
|
+
var __defProp$3 = Object.defineProperty;
|
|
11
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __publicField$3 = (obj, key, value) => {
|
|
13
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
const DefaultErrorBoundaryFallback = ({
|
|
17
|
+
plugin,
|
|
18
|
+
error,
|
|
19
|
+
resetError
|
|
20
|
+
}) => {
|
|
21
|
+
const title = `Error in ${plugin == null ? void 0 : plugin.id}`;
|
|
22
|
+
return /* @__PURE__ */ React.createElement(ErrorPanel, { title, error, defaultExpanded: true }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: resetError }, "Retry"));
|
|
23
|
+
};
|
|
24
|
+
class ErrorBoundary extends Component {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
__publicField$3(this, "state", { error: void 0 });
|
|
28
|
+
__publicField$3(this, "handleErrorReset", () => {
|
|
29
|
+
this.setState({ error: void 0 });
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static getDerivedStateFromError(error) {
|
|
33
|
+
return { error };
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
const { error } = this.state;
|
|
37
|
+
const { plugin, children } = this.props;
|
|
38
|
+
if (error) {
|
|
39
|
+
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
DefaultErrorBoundaryFallback,
|
|
41
|
+
{
|
|
42
|
+
plugin,
|
|
43
|
+
error,
|
|
44
|
+
resetError: this.handleErrorReset
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return children;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function ExtensionSuspense(props) {
|
|
53
|
+
const { children } = props;
|
|
54
|
+
const app = useApp();
|
|
55
|
+
const { Progress } = app.getComponents();
|
|
56
|
+
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, children);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getOrCreateGlobalSingleton(
|
|
60
|
+
"core-plugin-api:analytics-tracker-events",
|
|
61
|
+
() => ({
|
|
62
|
+
mostRecentGatheredNavigation: void 0,
|
|
63
|
+
mostRecentRoutableExtensionRender: void 0,
|
|
64
|
+
beforeUnloadRegistered: false
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
const routableExtensionRenderedEvent = "_ROUTABLE-EXTENSION-RENDERED";
|
|
68
|
+
|
|
69
|
+
const RouteTracker = (props) => {
|
|
70
|
+
const { disableTracking, children } = props;
|
|
71
|
+
const analytics = useAnalytics();
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (disableTracking)
|
|
74
|
+
return;
|
|
75
|
+
analytics.captureEvent(routableExtensionRenderedEvent, "");
|
|
76
|
+
}, [analytics, disableTracking]);
|
|
77
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
78
|
+
};
|
|
5
79
|
function ExtensionBoundary(props) {
|
|
6
|
-
|
|
80
|
+
const { id, source, routable, children } = props;
|
|
81
|
+
const attributes = {
|
|
82
|
+
extension: id,
|
|
83
|
+
pluginId: source == null ? void 0 : source.id
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ React.createElement(ExtensionSuspense, null, /* @__PURE__ */ React.createElement(ErrorBoundary, { plugin: source }, /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes }, /* @__PURE__ */ React.createElement(RouteTracker, { disableTracking: !routable }, children))));
|
|
7
86
|
}
|
|
8
87
|
|
|
9
88
|
function createExtensionDataRef(id) {
|
|
@@ -55,11 +134,21 @@ function createExtensionInput(extensionData, config) {
|
|
|
55
134
|
}
|
|
56
135
|
|
|
57
136
|
function createPlugin(options) {
|
|
58
|
-
var _a;
|
|
137
|
+
var _a, _b, _c;
|
|
59
138
|
return {
|
|
60
139
|
...options,
|
|
61
|
-
|
|
62
|
-
|
|
140
|
+
routes: (_a = options.routes) != null ? _a : {},
|
|
141
|
+
externalRoutes: (_b = options.externalRoutes) != null ? _b : {},
|
|
142
|
+
extensions: (_c = options.extensions) != null ? _c : [],
|
|
143
|
+
$$type: "@backstage/BackstagePlugin"
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function createExtensionOverrides(options) {
|
|
148
|
+
return {
|
|
149
|
+
$$type: "@backstage/ExtensionOverrides",
|
|
150
|
+
version: "v1",
|
|
151
|
+
extensions: options.extensions
|
|
63
152
|
};
|
|
64
153
|
}
|
|
65
154
|
|
|
@@ -115,28 +204,29 @@ function formatIssue(issue) {
|
|
|
115
204
|
|
|
116
205
|
function createPageExtension(options) {
|
|
117
206
|
var _a;
|
|
207
|
+
const { id } = options;
|
|
118
208
|
const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
|
|
119
209
|
(z) => z.object({ path: z.string().default(options.defaultPath) })
|
|
120
210
|
);
|
|
121
211
|
return createExtension({
|
|
122
|
-
id
|
|
212
|
+
id,
|
|
123
213
|
attachTo: (_a = options.attachTo) != null ? _a : { id: "core.routes", input: "routes" },
|
|
214
|
+
configSchema,
|
|
215
|
+
inputs: options.inputs,
|
|
124
216
|
disabled: options.disabled,
|
|
125
217
|
output: {
|
|
126
218
|
element: coreExtensionData.reactElement,
|
|
127
219
|
path: coreExtensionData.routePath,
|
|
128
220
|
routeRef: coreExtensionData.routeRef.optional()
|
|
129
221
|
},
|
|
130
|
-
inputs: options.inputs,
|
|
131
|
-
configSchema,
|
|
132
222
|
factory({ bind, config, inputs, source }) {
|
|
133
|
-
const
|
|
223
|
+
const ExtensionComponent = lazy(
|
|
134
224
|
() => options.loader({ config, inputs }).then((element) => ({ default: () => element }))
|
|
135
225
|
);
|
|
136
226
|
bind({
|
|
137
227
|
path: config.path,
|
|
138
|
-
|
|
139
|
-
|
|
228
|
+
routeRef: options.routeRef,
|
|
229
|
+
element: /* @__PURE__ */ React.createElement(ExtensionBoundary, { id, source, routable: true }, /* @__PURE__ */ React.createElement(ExtensionComponent, null))
|
|
140
230
|
});
|
|
141
231
|
}
|
|
142
232
|
});
|
|
@@ -180,5 +270,243 @@ function createThemeExtension(theme) {
|
|
|
180
270
|
});
|
|
181
271
|
}
|
|
182
272
|
|
|
183
|
-
|
|
273
|
+
const MESSAGE_MARKER = "eHgtF5hmbrXyiEvo";
|
|
274
|
+
function describeParentCallSite(ErrorConstructor = Error) {
|
|
275
|
+
const { stack } = new ErrorConstructor(MESSAGE_MARKER);
|
|
276
|
+
if (!stack) {
|
|
277
|
+
return "<unknown>";
|
|
278
|
+
}
|
|
279
|
+
const startIndex = stack.includes(MESSAGE_MARKER) ? stack.indexOf("\n") + 1 : 0;
|
|
280
|
+
const secondEntryStart = stack.indexOf("\n", stack.indexOf("\n", startIndex) + 1) + 1;
|
|
281
|
+
const secondEntryEnd = stack.indexOf("\n", secondEntryStart);
|
|
282
|
+
const line = stack.substring(secondEntryStart, secondEntryEnd).trim();
|
|
283
|
+
if (!line) {
|
|
284
|
+
return "unknown";
|
|
285
|
+
}
|
|
286
|
+
if (line.includes("(")) {
|
|
287
|
+
return line.substring(line.indexOf("(") + 1, line.indexOf(")"));
|
|
288
|
+
}
|
|
289
|
+
if (line.includes("@")) {
|
|
290
|
+
return line.substring(line.indexOf("@") + 1);
|
|
291
|
+
}
|
|
292
|
+
return line;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
var __defProp$2 = Object.defineProperty;
|
|
296
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
297
|
+
var __publicField$2 = (obj, key, value) => {
|
|
298
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
299
|
+
return value;
|
|
300
|
+
};
|
|
301
|
+
var __accessCheck$1 = (obj, member, msg) => {
|
|
302
|
+
if (!member.has(obj))
|
|
303
|
+
throw TypeError("Cannot " + msg);
|
|
304
|
+
};
|
|
305
|
+
var __privateGet$1 = (obj, member, getter) => {
|
|
306
|
+
__accessCheck$1(obj, member, "read from private field");
|
|
307
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
308
|
+
};
|
|
309
|
+
var __privateAdd$1 = (obj, member, value) => {
|
|
310
|
+
if (member.has(obj))
|
|
311
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
312
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
313
|
+
};
|
|
314
|
+
var __privateSet$1 = (obj, member, value, setter) => {
|
|
315
|
+
__accessCheck$1(obj, member, "write to private field");
|
|
316
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
317
|
+
return value;
|
|
318
|
+
};
|
|
319
|
+
var _id, _params$1, _creationSite, _name, name_get;
|
|
320
|
+
function toInternalRouteRef(resource) {
|
|
321
|
+
const r = resource;
|
|
322
|
+
if (r.$$type !== "@backstage/RouteRef") {
|
|
323
|
+
throw new Error(`Invalid RouteRef, bad type '${r.$$type}'`);
|
|
324
|
+
}
|
|
325
|
+
return r;
|
|
326
|
+
}
|
|
327
|
+
class RouteRefImpl {
|
|
328
|
+
constructor(params = [], creationSite) {
|
|
329
|
+
this.params = params;
|
|
330
|
+
__privateAdd$1(this, _name);
|
|
331
|
+
__publicField$2(this, "$$type", "@backstage/RouteRef");
|
|
332
|
+
__publicField$2(this, "version", "v1");
|
|
333
|
+
__privateAdd$1(this, _id, void 0);
|
|
334
|
+
__privateAdd$1(this, _params$1, void 0);
|
|
335
|
+
__privateAdd$1(this, _creationSite, void 0);
|
|
336
|
+
__privateSet$1(this, _params$1, params);
|
|
337
|
+
__privateSet$1(this, _creationSite, creationSite);
|
|
338
|
+
}
|
|
339
|
+
getParams() {
|
|
340
|
+
return __privateGet$1(this, _params$1);
|
|
341
|
+
}
|
|
342
|
+
getDescription() {
|
|
343
|
+
if (__privateGet$1(this, _id)) {
|
|
344
|
+
return __privateGet$1(this, _id);
|
|
345
|
+
}
|
|
346
|
+
return `created at '${__privateGet$1(this, _creationSite)}'`;
|
|
347
|
+
}
|
|
348
|
+
setId(id) {
|
|
349
|
+
if (!id) {
|
|
350
|
+
throw new Error(`${__privateGet$1(this, _name, name_get)} id must be a non-empty string`);
|
|
351
|
+
}
|
|
352
|
+
if (__privateGet$1(this, _id)) {
|
|
353
|
+
throw new Error(
|
|
354
|
+
`${__privateGet$1(this, _name, name_get)} was referenced twice as both '${__privateGet$1(this, _id)}' and '${id}'`
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
__privateSet$1(this, _id, id);
|
|
358
|
+
}
|
|
359
|
+
toString() {
|
|
360
|
+
return `${__privateGet$1(this, _name, name_get)}{${this.getDescription()}}`;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
_id = new WeakMap();
|
|
364
|
+
_params$1 = new WeakMap();
|
|
365
|
+
_creationSite = new WeakMap();
|
|
366
|
+
_name = new WeakSet();
|
|
367
|
+
name_get = function() {
|
|
368
|
+
return this.$$type.slice("@backstage/".length);
|
|
369
|
+
};
|
|
370
|
+
function createRouteRef(config) {
|
|
371
|
+
return new RouteRefImpl(
|
|
372
|
+
config == null ? void 0 : config.params,
|
|
373
|
+
describeParentCallSite()
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
var __defProp$1 = Object.defineProperty;
|
|
378
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
379
|
+
var __publicField$1 = (obj, key, value) => {
|
|
380
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
381
|
+
return value;
|
|
382
|
+
};
|
|
383
|
+
var __accessCheck = (obj, member, msg) => {
|
|
384
|
+
if (!member.has(obj))
|
|
385
|
+
throw TypeError("Cannot " + msg);
|
|
386
|
+
};
|
|
387
|
+
var __privateGet = (obj, member, getter) => {
|
|
388
|
+
__accessCheck(obj, member, "read from private field");
|
|
389
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
390
|
+
};
|
|
391
|
+
var __privateAdd = (obj, member, value) => {
|
|
392
|
+
if (member.has(obj))
|
|
393
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
394
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
395
|
+
};
|
|
396
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
397
|
+
__accessCheck(obj, member, "write to private field");
|
|
398
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
399
|
+
return value;
|
|
400
|
+
};
|
|
401
|
+
var _params, _parent;
|
|
402
|
+
const PARAM_PATTERN = /^\w+$/;
|
|
403
|
+
class SubRouteRefImpl {
|
|
404
|
+
constructor(path, params, parent) {
|
|
405
|
+
this.path = path;
|
|
406
|
+
__publicField$1(this, "$$type", "@backstage/SubRouteRef");
|
|
407
|
+
__publicField$1(this, "version", "v1");
|
|
408
|
+
__privateAdd(this, _params, void 0);
|
|
409
|
+
__privateAdd(this, _parent, void 0);
|
|
410
|
+
__privateSet(this, _params, params);
|
|
411
|
+
__privateSet(this, _parent, parent);
|
|
412
|
+
}
|
|
413
|
+
getParams() {
|
|
414
|
+
return __privateGet(this, _params);
|
|
415
|
+
}
|
|
416
|
+
getParent() {
|
|
417
|
+
return __privateGet(this, _parent);
|
|
418
|
+
}
|
|
419
|
+
getDescription() {
|
|
420
|
+
const parent = toInternalRouteRef(__privateGet(this, _parent));
|
|
421
|
+
return `at ${this.path} with parent ${parent.getDescription()}`;
|
|
422
|
+
}
|
|
423
|
+
toString() {
|
|
424
|
+
return `SubRouteRef{${this.getDescription()}}`;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
_params = new WeakMap();
|
|
428
|
+
_parent = new WeakMap();
|
|
429
|
+
function createSubRouteRef(config) {
|
|
430
|
+
const { path, parent } = config;
|
|
431
|
+
const internalParent = toInternalRouteRef(parent);
|
|
432
|
+
const parentParams = internalParent.getParams();
|
|
433
|
+
const pathParams = path.split("/").filter((p) => p.startsWith(":")).map((p) => p.substring(1));
|
|
434
|
+
const params = [...parentParams, ...pathParams];
|
|
435
|
+
if (parentParams.some((p) => pathParams.includes(p))) {
|
|
436
|
+
throw new Error(
|
|
437
|
+
"SubRouteRef may not have params that overlap with its parent"
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
if (!path.startsWith("/")) {
|
|
441
|
+
throw new Error(`SubRouteRef path must start with '/', got '${path}'`);
|
|
442
|
+
}
|
|
443
|
+
if (path.endsWith("/")) {
|
|
444
|
+
throw new Error(`SubRouteRef path must not end with '/', got '${path}'`);
|
|
445
|
+
}
|
|
446
|
+
for (const param of pathParams) {
|
|
447
|
+
if (!PARAM_PATTERN.test(param)) {
|
|
448
|
+
throw new Error(`SubRouteRef path has invalid param, got '${param}'`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const subRouteRef = new SubRouteRefImpl(
|
|
452
|
+
path,
|
|
453
|
+
params,
|
|
454
|
+
parent
|
|
455
|
+
);
|
|
456
|
+
return subRouteRef;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
var __defProp = Object.defineProperty;
|
|
460
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
461
|
+
var __publicField = (obj, key, value) => {
|
|
462
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
463
|
+
return value;
|
|
464
|
+
};
|
|
465
|
+
class ExternalRouteRefImpl extends RouteRefImpl {
|
|
466
|
+
constructor(optional, params = [], creationSite) {
|
|
467
|
+
super(params, creationSite);
|
|
468
|
+
this.optional = optional;
|
|
469
|
+
this.params = params;
|
|
470
|
+
__publicField(this, "$$type", "@backstage/ExternalRouteRef");
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function createExternalRouteRef(options) {
|
|
474
|
+
return new ExternalRouteRefImpl(
|
|
475
|
+
Boolean(options == null ? void 0 : options.optional),
|
|
476
|
+
options == null ? void 0 : options.params,
|
|
477
|
+
describeParentCallSite()
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function useRouteRef(routeRef) {
|
|
482
|
+
const { pathname } = useLocation();
|
|
483
|
+
const versionedContext = useVersionedContext(
|
|
484
|
+
"routing-context"
|
|
485
|
+
);
|
|
486
|
+
if (!versionedContext) {
|
|
487
|
+
throw new Error("Routing context is not available");
|
|
488
|
+
}
|
|
489
|
+
const resolver = versionedContext.atVersion(1);
|
|
490
|
+
const routeFunc = useMemo(
|
|
491
|
+
() => resolver && resolver.resolve(routeRef, { pathname }),
|
|
492
|
+
[resolver, routeRef, pathname]
|
|
493
|
+
);
|
|
494
|
+
if (!versionedContext) {
|
|
495
|
+
throw new Error("useRouteRef used outside of routing context");
|
|
496
|
+
}
|
|
497
|
+
if (!resolver) {
|
|
498
|
+
throw new Error("RoutingContext v1 not available");
|
|
499
|
+
}
|
|
500
|
+
const isOptional = "optional" in routeRef && routeRef.optional;
|
|
501
|
+
if (!routeFunc && !isOptional) {
|
|
502
|
+
throw new Error(`No path for ${routeRef}`);
|
|
503
|
+
}
|
|
504
|
+
return routeFunc;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function useRouteRefParams(_routeRef) {
|
|
508
|
+
return useParams();
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export { ExtensionBoundary, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createExtensionOverrides, createExternalRouteRef, createNavItemExtension, createPageExtension, createPlugin, createRouteRef, createSchemaFromZod, createSubRouteRef, createThemeExtension, useRouteRef, useRouteRefParams };
|
|
184
512
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/ExtensionBoundary.tsx","../src/wiring/createExtensionDataRef.ts","../src/wiring/coreExtensionData.ts","../src/wiring/createExtension.ts","../src/wiring/createExtensionInput.ts","../src/wiring/createPlugin.ts","../src/extensions/createApiExtension.ts","../src/schema/createSchemaFromZod.ts","../src/extensions/createPageExtension.tsx","../src/extensions/createNavItemExtension.tsx","../src/extensions/createThemeExtension.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { BackstagePlugin } from '../wiring';\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n children: ReactNode;\n source?: BackstagePlugin;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n return <>{props.children}</>;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport type ExtensionDataRef<\n TData,\n TConfig extends { optional?: true } = {},\n> = {\n id: string;\n T: TData;\n config: TConfig;\n $$type: '@backstage/ExtensionDataRef';\n};\n\n/** @public */\nexport interface ConfigurableExtensionDataRef<\n TData,\n TConfig extends { optional?: true } = {},\n> extends ExtensionDataRef<TData, TConfig> {\n optional(): ConfigurableExtensionDataRef<TData, TData & { optional: true }>;\n}\n\n// TODO: change to options object with ID.\n/** @public */\nexport function createExtensionDataRef<TData>(\n id: string,\n): ConfigurableExtensionDataRef<TData> {\n return {\n id,\n $$type: '@backstage/ExtensionDataRef',\n config: {},\n optional() {\n return { ...this, config: { ...this.config, optional: true } };\n },\n } as ConfigurableExtensionDataRef<TData>;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JSX } from 'react';\nimport {\n AnyApiFactory,\n AppTheme,\n IconComponent,\n RouteRef,\n} from '@backstage/core-plugin-api';\nimport { createExtensionDataRef } from './createExtensionDataRef';\n\n/** @public */\nexport type NavTarget = {\n title: string;\n icon: IconComponent;\n routeRef: RouteRef<{}>;\n};\n\n/** @public */\nexport const coreExtensionData = {\n reactElement: createExtensionDataRef<JSX.Element>('core.reactElement'),\n routePath: createExtensionDataRef<string>('core.routing.path'),\n apiFactory: createExtensionDataRef<AnyApiFactory>('core.api.factory'),\n routeRef: createExtensionDataRef<RouteRef>('core.routing.ref'),\n navTarget: createExtensionDataRef<NavTarget>('core.nav.target'),\n theme: createExtensionDataRef<AppTheme>('core.theme'),\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PortableSchema } from '../schema';\nimport { ExtensionDataRef } from './createExtensionDataRef';\nimport { ExtensionInput } from './createExtensionInput';\nimport { BackstagePlugin } from './createPlugin';\n\n/** @public */\nexport type AnyExtensionDataMap = {\n [name in string]: ExtensionDataRef<unknown, { optional?: true }>;\n};\n\n/** @public */\nexport type AnyExtensionInputMap = {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataMap,\n { optional: boolean; singleton: boolean }\n >;\n};\n\n// TODO(Rugvip): This might be a quite useful utility type, maybe add to @backstage/types?\n/**\n * Utility type to expand type aliases into their equivalent type.\n * @ignore\n */\nexport type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;\n\n/**\n * Converts an extension data map into the matching concrete data values type.\n * @public\n */\nexport type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TExtensionData[DataName]['T'];\n} & {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TExtensionData[DataName]['T'];\n};\n\n/**\n * Converts an extension input map into the matching concrete input values type.\n * @public\n */\nexport type ExtensionInputValues<\n TInputs extends { [name in string]: ExtensionInput<any, any> },\n> = {\n [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']\n ? Array<Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>>>\n : false extends TInputs[InputName]['config']['optional']\n ? Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>>\n : Expand<\n ExtensionDataValues<TInputs[InputName]['extensionData']> | undefined\n >;\n};\n\n/** @public */\nexport interface CreateExtensionOptions<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig,\n> {\n id: string;\n attachTo: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n output: TOutput;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n source?: BackstagePlugin;\n bind(values: Expand<ExtensionDataValues<TOutput>>): void;\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }): void;\n}\n\n/** @public */\nexport interface Extension<TConfig> {\n $$type: '@backstage/Extension';\n id: string;\n attachTo: { id: string; input: string };\n disabled: boolean;\n inputs: AnyExtensionInputMap;\n output: AnyExtensionDataMap;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n source?: BackstagePlugin;\n bind(values: ExtensionInputValues<any>): void;\n config: TConfig;\n inputs: Record<\n string,\n undefined | Record<string, unknown> | Array<Record<string, unknown>>\n >;\n }): void;\n}\n\n/** @public */\nexport function createExtension<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig = never,\n>(\n options: CreateExtensionOptions<TOutput, TInputs, TConfig>,\n): Extension<TConfig> {\n return {\n ...options,\n disabled: options.disabled ?? false,\n $$type: '@backstage/Extension',\n inputs: options.inputs ?? {},\n factory({ bind, config, inputs }) {\n // TODO: Simplify this, but TS wouldn't infer the input type for some reason\n return options.factory({\n bind,\n config,\n inputs: inputs as Expand<ExtensionInputValues<TInputs>>,\n });\n },\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnyExtensionDataMap } from './createExtension';\n\n/** @public */\nexport interface ExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton: boolean; optional: boolean },\n> {\n $$type: '@backstage/ExtensionInput';\n extensionData: TExtensionData;\n config: TConfig;\n}\n\n/** @public */\nexport function createExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton?: boolean; optional?: boolean },\n>(\n extensionData: TExtensionData,\n config?: TConfig,\n): ExtensionInput<\n TExtensionData,\n {\n singleton: TConfig['singleton'] extends true ? true : false;\n optional: TConfig['optional'] extends true ? true : false;\n }\n> {\n return {\n $$type: '@backstage/ExtensionInput',\n extensionData,\n config: {\n singleton: Boolean(config?.singleton) as TConfig['singleton'] extends true\n ? true\n : false,\n optional: Boolean(config?.optional) as TConfig['optional'] extends true\n ? true\n : false,\n },\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Extension } from './createExtension';\n\n/** @public */\nexport interface PluginOptions {\n id: string;\n extensions?: Extension<unknown>[];\n}\n\n/** @public */\nexport interface BackstagePlugin {\n $$type: '@backstage/BackstagePlugin';\n id: string;\n extensions: Extension<unknown>[];\n}\n\n/** @public */\nexport function createPlugin(options: PluginOptions): BackstagePlugin {\n return {\n ...options,\n $$type: '@backstage/BackstagePlugin',\n extensions: options.extensions ?? [],\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnyApiFactory, AnyApiRef } from '@backstage/core-plugin-api';\nimport { PortableSchema } from '../schema';\nimport {\n ExtensionInputValues,\n createExtension,\n coreExtensionData,\n} from '../wiring';\nimport { AnyExtensionInputMap, Expand } from '../wiring/createExtension';\n\n/** @public */\nexport function createApiExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n api: AnyApiRef;\n factory: (options: {\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }) => AnyApiFactory;\n }\n | {\n factory: AnyApiFactory;\n }\n ) & {\n configSchema?: PortableSchema<TConfig>;\n inputs?: TInputs;\n },\n) {\n const { factory, configSchema, inputs: extensionInputs } = options;\n\n const apiRef =\n 'api' in options ? options.api : (factory as { api: AnyApiRef }).api;\n\n return createExtension({\n id: `apis.${apiRef.id}`,\n attachTo: { id: 'core', input: 'apis' },\n inputs: extensionInputs,\n configSchema,\n output: {\n api: coreExtensionData.apiFactory,\n },\n factory({ bind, config, inputs }) {\n if (typeof factory === 'function') {\n bind({ api: factory({ config, inputs }) });\n } else {\n bind({ api: factory });\n }\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { z, ZodSchema, ZodTypeDef } from 'zod';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { PortableSchema } from './types';\n\n/** @public */\nexport function createSchemaFromZod<TOutput, TInput>(\n schemaCreator: (zImpl: typeof z) => ZodSchema<TOutput, ZodTypeDef, TInput>,\n): PortableSchema<TOutput> {\n const schema = schemaCreator(z);\n return {\n // TODO: Types allow z.array etc here but it will break stuff\n parse: input => {\n const result = schema.safeParse(input);\n if (result.success) {\n return result.data;\n }\n\n throw new Error(result.error.issues.map(formatIssue).join('; '));\n },\n // TODO: Verify why we are not compatible with the latest zodToJsonSchema.\n schema: zodToJsonSchema(schema) as JsonObject,\n };\n}\n\nfunction formatIssue(issue: z.ZodIssue): string {\n if (issue.code === 'invalid_union') {\n return formatIssue(issue.unionErrors[0].issues[0]);\n }\n let message = issue.message;\n if (message === 'Required') {\n message = `Missing required value`;\n }\n if (issue.path.length) {\n message += ` at '${issue.path.join('.')}'`;\n }\n return message;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RouteRef } from '@backstage/core-plugin-api';\nimport React from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { createSchemaFromZod, PortableSchema } from '../schema';\nimport {\n coreExtensionData,\n createExtension,\n Extension,\n ExtensionInputValues,\n} from '../wiring';\nimport { AnyExtensionInputMap, Expand } from '../wiring/createExtension';\n\n/**\n * Helper for creating extensions for a routable React page component.\n *\n * @public\n */\nexport function createPageExtension<\n TConfig extends { path: string },\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n id: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }) => Promise<JSX.Element>;\n },\n): Extension<TConfig> {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({ path: z.string().default(options.defaultPath) }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n id: options.id,\n attachTo: options.attachTo ?? { id: 'core.routes', input: 'routes' },\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n },\n inputs: options.inputs,\n configSchema,\n factory({ bind, config, inputs, source }) {\n const LazyComponent = React.lazy(() =>\n options\n .loader({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n bind({\n path: config.path,\n element: (\n <ExtensionBoundary source={source}>\n <React.Suspense fallback=\"...\">\n <LazyComponent />\n </React.Suspense>\n </ExtensionBoundary>\n ),\n routeRef: options.routeRef,\n });\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IconComponent, RouteRef } from '@backstage/core-plugin-api';\nimport { createSchemaFromZod } from '../schema/createSchemaFromZod';\nimport { coreExtensionData, createExtension } from '../wiring';\n\n/**\n * Helper for creating extensions for a nav item.\n * @public\n */\nexport function createNavItemExtension(options: {\n id: string;\n routeRef: RouteRef;\n title: string;\n icon: IconComponent;\n}) {\n const { id, routeRef, title, icon } = options;\n return createExtension({\n id,\n attachTo: { id: 'core.nav', input: 'items' },\n configSchema: createSchemaFromZod(z =>\n z.object({\n title: z.string().default(title),\n }),\n ),\n output: {\n navTarget: coreExtensionData.navTarget,\n },\n factory: ({ bind, config }) => {\n bind({\n navTarget: {\n title: config.title,\n icon,\n routeRef,\n },\n });\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtension, coreExtensionData } from '../wiring';\nimport { AppTheme } from '@backstage/core-plugin-api';\n\n/** @public */\nexport function createThemeExtension(theme: AppTheme) {\n return createExtension({\n id: `themes.${theme.id}`,\n attachTo: { id: 'core', input: 'themes' },\n output: {\n theme: coreExtensionData.theme,\n },\n factory({ bind }) {\n bind({ theme });\n },\n });\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,kBAAkB,KAA+B,EAAA;AAC/D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,MAAM,QAAS,CAAA,CAAA;AAC3B;;ACSO,SAAS,uBACd,EACqC,EAAA;AACrC,EAAO,OAAA;AAAA,IACL,EAAA;AAAA,IACA,MAAQ,EAAA,6BAAA;AAAA,IACR,QAAQ,EAAC;AAAA,IACT,QAAW,GAAA;AACT,MAAO,OAAA,EAAE,GAAG,IAAA,EAAM,MAAQ,EAAA,EAAE,GAAG,IAAK,CAAA,MAAA,EAAQ,QAAU,EAAA,IAAA,EAAO,EAAA,CAAA;AAAA,KAC/D;AAAA,GACF,CAAA;AACF;;ACfO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,YAAA,EAAc,uBAAoC,mBAAmB,CAAA;AAAA,EACrE,SAAA,EAAW,uBAA+B,mBAAmB,CAAA;AAAA,EAC7D,UAAA,EAAY,uBAAsC,kBAAkB,CAAA;AAAA,EACpE,QAAA,EAAU,uBAAiC,kBAAkB,CAAA;AAAA,EAC7D,SAAA,EAAW,uBAAkC,iBAAiB,CAAA;AAAA,EAC9D,KAAA,EAAO,uBAAiC,YAAY,CAAA;AACtD;;AC4EO,SAAS,gBAKd,OACoB,EAAA;AA1HtB,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA2HE,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,QAAA,EAAA,CAAU,EAAQ,GAAA,OAAA,C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AAA,KAC/B;AAAA,IACA,OAAS,EAAA,CAAC,EAAE,IAAA,EAAM,QAAa,KAAA;AAC7B,MAAK,IAAA,CAAA;AAAA,QACH,SAAW,EAAA;AAAA,UACT,OAAO,MAAO,CAAA,KAAA;AAAA,UACd,IAAA;AAAA,UACA,QAAA;AAAA,SACF;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;AChCO,SAAS,qBAAqB,KAAiB,EAAA;AACpD,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,EAAA,EAAI,CAAU,OAAA,EAAA,KAAA,CAAM,EAAE,CAAA,CAAA;AAAA,IACtB,QAAU,EAAA,EAAE,EAAI,EAAA,MAAA,EAAQ,OAAO,QAAS,EAAA;AAAA,IACxC,MAAQ,EAAA;AAAA,MACN,OAAO,iBAAkB,CAAA,KAAA;AAAA,KAC3B;AAAA,IACA,OAAA,CAAQ,EAAE,IAAA,EAAQ,EAAA;AAChB,MAAK,IAAA,CAAA,EAAE,OAAO,CAAA,CAAA;AAAA,KAChB;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/ErrorBoundary.tsx","../src/components/ExtensionSuspense.tsx","../../core-plugin-api/src/analytics/Tracker.ts","../src/components/ExtensionBoundary.tsx","../src/wiring/createExtensionDataRef.ts","../src/wiring/coreExtensionData.ts","../src/wiring/createExtension.ts","../src/wiring/createExtensionInput.ts","../src/wiring/createPlugin.ts","../src/wiring/createExtensionOverrides.ts","../src/extensions/createApiExtension.ts","../src/schema/createSchemaFromZod.ts","../src/extensions/createPageExtension.tsx","../src/extensions/createNavItemExtension.tsx","../src/extensions/createThemeExtension.ts","../src/routing/describeParentCallSite.ts","../src/routing/RouteRef.ts","../src/routing/SubRouteRef.ts","../src/routing/ExternalRouteRef.ts","../src/routing/useRouteRef.tsx","../src/routing/useRouteRefParams.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { Component, PropsWithChildren } from 'react';\n// TODO: Dependency on MUI should be removed from core packages\nimport { Button } from '@material-ui/core';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { BackstagePlugin } from '../wiring';\n\ntype DefaultErrorBoundaryFallbackProps = PropsWithChildren<{\n plugin?: BackstagePlugin;\n error: Error;\n resetError: () => void;\n}>;\n\nconst DefaultErrorBoundaryFallback = ({\n plugin,\n error,\n resetError,\n}: DefaultErrorBoundaryFallbackProps) => {\n const title = `Error in ${plugin?.id}`;\n\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n};\n\ntype ErrorBoundaryProps = PropsWithChildren<{ plugin?: BackstagePlugin }>;\ntype ErrorBoundaryState = { error?: Error };\n\n/** @internal */\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: ErrorBoundaryState = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children } = this.props;\n\n if (error) {\n // TODO: use a configurable error boundary fallback\n return (\n <DefaultErrorBoundaryFallback\n plugin={plugin}\n error={error}\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode, Suspense } from 'react';\nimport { useApp } from '@backstage/core-plugin-api';\n\n/** @public */\nexport interface ExtensionSuspenseProps {\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionSuspense(props: ExtensionSuspenseProps) {\n const { children } = props;\n\n const app = useApp();\n const { Progress } = app.getComponents();\n\n return <Suspense fallback={<Progress />}>{children}</Suspense>;\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\nimport {\n AnalyticsApi,\n AnalyticsEventAttributes,\n AnalyticsTracker,\n} from '../apis';\nimport { AnalyticsContextValue } from './';\n\ntype TempGlobalEvents = {\n /**\n * Stores the most recent \"gathered\" mountpoint navigation.\n */\n mostRecentGatheredNavigation?: {\n action: string;\n subject: string;\n value?: number;\n attributes?: AnalyticsEventAttributes;\n context: AnalyticsContextValue;\n };\n /**\n * Stores the most recent routable extension render.\n */\n mostRecentRoutableExtensionRender?: {\n context: AnalyticsContextValue;\n };\n /**\n * Tracks whether or not a beforeunload event listener has already been\n * registered.\n */\n beforeUnloadRegistered: boolean;\n};\n\n/**\n * Temporary global store for select event data. Used to make `navigate` events\n * more accurate when gathered mountpoints are used.\n */\nconst globalEvents = getOrCreateGlobalSingleton<TempGlobalEvents>(\n 'core-plugin-api:analytics-tracker-events',\n () => ({\n mostRecentGatheredNavigation: undefined,\n mostRecentRoutableExtensionRender: undefined,\n beforeUnloadRegistered: false,\n }),\n);\n\n/**\n * Internal-only event representing when a routable extension is rendered.\n */\nexport const routableExtensionRenderedEvent = '_ROUTABLE-EXTENSION-RENDERED';\n\nexport class Tracker implements AnalyticsTracker {\n constructor(\n private readonly analyticsApi: AnalyticsApi,\n private context: AnalyticsContextValue = {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n },\n ) {\n // Only register a single beforeunload event across all trackers.\n if (!globalEvents.beforeUnloadRegistered) {\n // Before the page unloads, attempt to capture any deferred navigation\n // events that haven't yet been captured.\n addEventListener(\n 'beforeunload',\n () => {\n if (globalEvents.mostRecentGatheredNavigation) {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n },\n { once: true, passive: true },\n );\n\n // Prevent duplicate handlers from being registered.\n globalEvents.beforeUnloadRegistered = true;\n }\n }\n\n setContext(context: AnalyticsContextValue) {\n this.context = context;\n }\n\n captureEvent(\n action: string,\n subject: string,\n {\n value,\n attributes,\n }: { value?: number; attributes?: AnalyticsEventAttributes } = {},\n ) {\n // Never pass internal \"_routeNodeType\" context value.\n const { _routeNodeType, ...context } = this.context;\n\n // Never fire the special \"_routable-extension-rendered\" internal event.\n if (action === routableExtensionRenderedEvent) {\n // But keep track of it if we're delaying a `navigate` event for a\n // a gathered route node type.\n if (globalEvents.mostRecentGatheredNavigation) {\n globalEvents.mostRecentRoutableExtensionRender = {\n context: {\n ...context,\n extension: 'App',\n },\n };\n }\n return;\n }\n\n // If we are about to fire a real event, and we have an un-fired gathered\n // mountpoint navigation on the global store, we need to fire the navigate\n // event first, so this real event happens accurately after the navigation.\n if (globalEvents.mostRecentGatheredNavigation) {\n try {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n\n // Clear the global stores.\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n\n // Never directly fire a navigation event on a gathered route with default\n // contextual details.\n if (\n action === 'navigate' &&\n _routeNodeType === 'gathered' &&\n context.pluginId === 'root'\n ) {\n // Instead, set it on the global store.\n globalEvents.mostRecentGatheredNavigation = {\n action,\n subject,\n value,\n attributes,\n context,\n };\n return;\n }\n\n try {\n this.analyticsApi.captureEvent({\n action,\n subject,\n value,\n attributes,\n context,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { PropsWithChildren, ReactNode, useEffect } from 'react';\nimport { AnalyticsContext, useAnalytics } from '@backstage/core-plugin-api';\nimport { BackstagePlugin } from '../wiring';\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { ExtensionSuspense } from './ExtensionSuspense';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\n\ntype RouteTrackerProps = PropsWithChildren<{\n disableTracking?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { disableTracking, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (disableTracking) return;\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }, [analytics, disableTracking]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n id: string;\n source?: BackstagePlugin;\n routable?: boolean;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { id, source, routable, children } = props;\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extension: id,\n pluginId: source?.id,\n };\n\n return (\n <ExtensionSuspense>\n <ErrorBoundary plugin={source}>\n <AnalyticsContext attributes={attributes}>\n <RouteTracker disableTracking={!routable}>{children}</RouteTracker>\n </AnalyticsContext>\n </ErrorBoundary>\n </ExtensionSuspense>\n );\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport type ExtensionDataRef<\n TData,\n TConfig extends { optional?: true } = {},\n> = {\n id: string;\n T: TData;\n config: TConfig;\n $$type: '@backstage/ExtensionDataRef';\n};\n\n/** @public */\nexport interface ConfigurableExtensionDataRef<\n TData,\n TConfig extends { optional?: true } = {},\n> extends ExtensionDataRef<TData, TConfig> {\n optional(): ConfigurableExtensionDataRef<TData, TData & { optional: true }>;\n}\n\n// TODO: change to options object with ID.\n/** @public */\nexport function createExtensionDataRef<TData>(\n id: string,\n): ConfigurableExtensionDataRef<TData> {\n return {\n id,\n $$type: '@backstage/ExtensionDataRef',\n config: {},\n optional() {\n return { ...this, config: { ...this.config, optional: true } };\n },\n } as ConfigurableExtensionDataRef<TData>;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JSX } from 'react';\nimport {\n AnyApiFactory,\n AppTheme,\n IconComponent,\n} from '@backstage/core-plugin-api';\nimport { createExtensionDataRef } from './createExtensionDataRef';\nimport { RouteRef } from '../routing';\n\n/** @public */\nexport type NavTarget = {\n title: string;\n icon: IconComponent;\n routeRef: RouteRef<undefined>;\n};\n\n/** @public */\nexport const coreExtensionData = {\n reactElement: createExtensionDataRef<JSX.Element>('core.reactElement'),\n routePath: createExtensionDataRef<string>('core.routing.path'),\n apiFactory: createExtensionDataRef<AnyApiFactory>('core.api.factory'),\n routeRef: createExtensionDataRef<RouteRef>('core.routing.ref'),\n navTarget: createExtensionDataRef<NavTarget>('core.nav.target'),\n theme: createExtensionDataRef<AppTheme>('core.theme'),\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PortableSchema } from '../schema';\nimport { Expand } from '../types';\nimport { ExtensionDataRef } from './createExtensionDataRef';\nimport { ExtensionInput } from './createExtensionInput';\nimport { BackstagePlugin } from './createPlugin';\n\n/** @public */\nexport type AnyExtensionDataMap = {\n [name in string]: ExtensionDataRef<unknown, { optional?: true }>;\n};\n\n/** @public */\nexport type AnyExtensionInputMap = {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataMap,\n { optional: boolean; singleton: boolean }\n >;\n};\n\n/**\n * Converts an extension data map into the matching concrete data values type.\n * @public\n */\nexport type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TExtensionData[DataName]['T'];\n} & {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TExtensionData[DataName]['T'];\n};\n\n/**\n * Converts an extension input map into the matching concrete input values type.\n * @public\n */\nexport type ExtensionInputValues<\n TInputs extends { [name in string]: ExtensionInput<any, any> },\n> = {\n [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']\n ? Array<Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>>>\n : false extends TInputs[InputName]['config']['optional']\n ? Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>>\n : Expand<\n ExtensionDataValues<TInputs[InputName]['extensionData']> | undefined\n >;\n};\n\n/** @public */\nexport interface CreateExtensionOptions<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig,\n> {\n id: string;\n attachTo: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n output: TOutput;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n source?: BackstagePlugin;\n bind(values: Expand<ExtensionDataValues<TOutput>>): void;\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }): void;\n}\n\n/** @public */\nexport interface Extension<TConfig> {\n $$type: '@backstage/Extension';\n id: string;\n attachTo: { id: string; input: string };\n disabled: boolean;\n inputs: AnyExtensionInputMap;\n output: AnyExtensionDataMap;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n source?: BackstagePlugin;\n bind(values: ExtensionInputValues<any>): void;\n config: TConfig;\n inputs: Record<\n string,\n undefined | Record<string, unknown> | Array<Record<string, unknown>>\n >;\n }): void;\n}\n\n/** @public */\nexport function createExtension<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig = never,\n>(\n options: CreateExtensionOptions<TOutput, TInputs, TConfig>,\n): Extension<TConfig> {\n return {\n ...options,\n disabled: options.disabled ?? false,\n $$type: '@backstage/Extension',\n inputs: options.inputs ?? {},\n factory({ bind, config, inputs }) {\n // TODO: Simplify this, but TS wouldn't infer the input type for some reason\n return options.factory({\n bind,\n config,\n inputs: inputs as Expand<ExtensionInputValues<TInputs>>,\n });\n },\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnyExtensionDataMap } from './createExtension';\n\n/** @public */\nexport interface ExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton: boolean; optional: boolean },\n> {\n $$type: '@backstage/ExtensionInput';\n extensionData: TExtensionData;\n config: TConfig;\n}\n\n/** @public */\nexport function createExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton?: boolean; optional?: boolean },\n>(\n extensionData: TExtensionData,\n config?: TConfig,\n): ExtensionInput<\n TExtensionData,\n {\n singleton: TConfig['singleton'] extends true ? true : false;\n optional: TConfig['optional'] extends true ? true : false;\n }\n> {\n return {\n $$type: '@backstage/ExtensionInput',\n extensionData,\n config: {\n singleton: Boolean(config?.singleton) as TConfig['singleton'] extends true\n ? true\n : false,\n optional: Boolean(config?.optional) as TConfig['optional'] extends true\n ? true\n : false,\n },\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Extension } from './createExtension';\nimport { ExternalRouteRef, RouteRef } from '../routing';\n\n/** @public */\nexport type AnyRoutes = { [name in string]: RouteRef };\n\n/** @public */\nexport type AnyExternalRoutes = { [name in string]: ExternalRouteRef };\n\n/** @public */\nexport interface PluginOptions<\n Routes extends AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes,\n> {\n id: string;\n routes?: Routes;\n externalRoutes?: ExternalRoutes;\n extensions?: Extension<unknown>[];\n}\n\n/** @public */\nexport interface BackstagePlugin<\n Routes extends AnyRoutes = AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes,\n> {\n $$type: '@backstage/BackstagePlugin';\n id: string;\n extensions: Extension<unknown>[];\n routes: Routes;\n externalRoutes: ExternalRoutes;\n}\n\n/** @public */\nexport function createPlugin<\n Routes extends AnyRoutes = {},\n ExternalRoutes extends AnyExternalRoutes = {},\n>(\n options: PluginOptions<Routes, ExternalRoutes>,\n): BackstagePlugin<Routes, ExternalRoutes> {\n return {\n ...options,\n routes: options.routes ?? ({} as Routes),\n externalRoutes: options.externalRoutes ?? ({} as ExternalRoutes),\n extensions: options.extensions ?? [],\n $$type: '@backstage/BackstagePlugin',\n };\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Extension } from './createExtension';\n\n/** @public */\nexport interface ExtensionOverridesOptions {\n extensions: Extension<unknown>[];\n}\n\n/** @public */\nexport interface ExtensionOverrides {\n $$type: '@backstage/ExtensionOverrides';\n}\n\n/** @internal */\nexport interface InternalExtensionOverrides extends ExtensionOverrides {\n version: string;\n extensions: Extension<unknown>[];\n}\n\n/** @public */\nexport function createExtensionOverrides(\n options: ExtensionOverridesOptions,\n): ExtensionOverrides {\n return {\n $$type: '@backstage/ExtensionOverrides',\n version: 'v1',\n extensions: options.extensions,\n } as InternalExtensionOverrides;\n}\n\n/** @internal */\nexport function toInternalExtensionOverrides(\n overrides: ExtensionOverrides,\n): InternalExtensionOverrides {\n const internal = overrides as InternalExtensionOverrides;\n if (internal.$$type !== '@backstage/ExtensionOverrides') {\n throw new Error(\n `Invalid translation resource, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid translation resource, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnyApiFactory, AnyApiRef } from '@backstage/core-plugin-api';\nimport { PortableSchema } from '../schema';\nimport {\n ExtensionInputValues,\n createExtension,\n coreExtensionData,\n} from '../wiring';\nimport { AnyExtensionInputMap } from '../wiring/createExtension';\nimport { Expand } from '../types';\n\n/** @public */\nexport function createApiExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n api: AnyApiRef;\n factory: (options: {\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }) => AnyApiFactory;\n }\n | {\n factory: AnyApiFactory;\n }\n ) & {\n configSchema?: PortableSchema<TConfig>;\n inputs?: TInputs;\n },\n) {\n const { factory, configSchema, inputs: extensionInputs } = options;\n\n const apiRef =\n 'api' in options ? options.api : (factory as { api: AnyApiRef }).api;\n\n return createExtension({\n id: `apis.${apiRef.id}`,\n attachTo: { id: 'core', input: 'apis' },\n inputs: extensionInputs,\n configSchema,\n output: {\n api: coreExtensionData.apiFactory,\n },\n factory({ bind, config, inputs }) {\n if (typeof factory === 'function') {\n bind({ api: factory({ config, inputs }) });\n } else {\n bind({ api: factory });\n }\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { z, ZodSchema, ZodTypeDef } from 'zod';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { PortableSchema } from './types';\n\n/** @public */\nexport function createSchemaFromZod<TOutput, TInput>(\n schemaCreator: (zImpl: typeof z) => ZodSchema<TOutput, ZodTypeDef, TInput>,\n): PortableSchema<TOutput> {\n const schema = schemaCreator(z);\n return {\n // TODO: Types allow z.array etc here but it will break stuff\n parse: input => {\n const result = schema.safeParse(input);\n if (result.success) {\n return result.data;\n }\n\n throw new Error(result.error.issues.map(formatIssue).join('; '));\n },\n // TODO: Verify why we are not compatible with the latest zodToJsonSchema.\n schema: zodToJsonSchema(schema) as JsonObject,\n };\n}\n\nfunction formatIssue(issue: z.ZodIssue): string {\n if (issue.code === 'invalid_union') {\n return formatIssue(issue.unionErrors[0].issues[0]);\n }\n let message = issue.message;\n if (message === 'Required') {\n message = `Missing required value`;\n }\n if (issue.path.length) {\n message += ` at '${issue.path.join('.')}'`;\n }\n return message;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { lazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { createSchemaFromZod, PortableSchema } from '../schema';\nimport {\n coreExtensionData,\n createExtension,\n Extension,\n ExtensionInputValues,\n AnyExtensionInputMap,\n} from '../wiring';\nimport { RouteRef } from '../routing';\nimport { Expand } from '../types';\n\n/**\n * Helper for creating extensions for a routable React page component.\n *\n * @public\n */\nexport function createPageExtension<\n TConfig extends { path: string },\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n id: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ExtensionInputValues<TInputs>>;\n }) => Promise<JSX.Element>;\n },\n): Extension<TConfig> {\n const { id } = options;\n\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({ path: z.string().default(options.defaultPath) }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n id,\n attachTo: options.attachTo ?? { id: 'core.routes', input: 'routes' },\n configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n },\n factory({ bind, config, inputs, source }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n bind({\n path: config.path,\n routeRef: options.routeRef,\n element: (\n <ExtensionBoundary id={id} source={source} routable>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n });\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IconComponent } from '@backstage/core-plugin-api';\nimport { createSchemaFromZod } from '../schema/createSchemaFromZod';\nimport { coreExtensionData, createExtension } from '../wiring';\nimport { RouteRef } from '../routing';\n\n/**\n * Helper for creating extensions for a nav item.\n * @public\n */\nexport function createNavItemExtension(options: {\n id: string;\n routeRef: RouteRef<undefined>;\n title: string;\n icon: IconComponent;\n}) {\n const { id, routeRef, title, icon } = options;\n return createExtension({\n id,\n attachTo: { id: 'core.nav', input: 'items' },\n configSchema: createSchemaFromZod(z =>\n z.object({\n title: z.string().default(title),\n }),\n ),\n output: {\n navTarget: coreExtensionData.navTarget,\n },\n factory: ({ bind, config }) => {\n bind({\n navTarget: {\n title: config.title,\n icon,\n routeRef,\n },\n });\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtension, coreExtensionData } from '../wiring';\nimport { AppTheme } from '@backstage/core-plugin-api';\n\n/** @public */\nexport function createThemeExtension(theme: AppTheme) {\n return createExtension({\n id: `themes.${theme.id}`,\n attachTo: { id: 'core', input: 'themes' },\n output: {\n theme: coreExtensionData.theme,\n },\n factory({ bind }) {\n bind({ theme });\n },\n });\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst MESSAGE_MARKER = 'eHgtF5hmbrXyiEvo';\n\n/**\n * Internal helper that describes the location of the parent caller.\n * @internal\n */\nexport function describeParentCallSite(\n ErrorConstructor: { new (message: string): Error } = Error,\n): string {\n const { stack } = new ErrorConstructor(MESSAGE_MARKER);\n if (!stack) {\n return '<unknown>';\n }\n\n // Safari and Firefox don't include the error itself in the stack\n const startIndex = stack.includes(MESSAGE_MARKER)\n ? stack.indexOf('\\n') + 1\n : 0;\n const secondEntryStart =\n stack.indexOf('\\n', stack.indexOf('\\n', startIndex) + 1) + 1;\n const secondEntryEnd = stack.indexOf('\\n', secondEntryStart);\n\n const line = stack.substring(secondEntryStart, secondEntryEnd).trim();\n if (!line) {\n return 'unknown';\n }\n\n // Below we try to extract the location for different browsers.\n // Since RouteRefs are declared at the top-level of modules the caller name isn't interesting.\n\n // Chrome\n if (line.includes('(')) {\n return line.substring(line.indexOf('(') + 1, line.indexOf(')'));\n }\n\n // Safari & Firefox\n if (line.includes('@')) {\n return line.substring(line.indexOf('@') + 1);\n }\n\n // Give up\n return line;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Absolute route reference.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface RouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/RouteRef';\n readonly T: TParams;\n}\n\n/** @internal */\nexport interface InternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends RouteRef<TParams> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: RouteRef<TParams>): InternalRouteRef<TParams> {\n const r = resource as InternalRouteRef<TParams>;\n if (r.$$type !== '@backstage/RouteRef') {\n throw new Error(`Invalid RouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isRouteRef(opaque: { $$type: string }): opaque is RouteRef {\n return opaque.$$type === '@backstage/RouteRef';\n}\n\n/** @internal */\nexport class RouteRefImpl implements InternalRouteRef {\n readonly $$type = '@backstage/RouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #id?: string;\n #params: string[];\n #creationSite: string;\n\n constructor(readonly params: string[] = [], creationSite: string) {\n this.#params = params;\n this.#creationSite = creationSite;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getDescription(): string {\n if (this.#id) {\n return this.#id;\n }\n return `created at '${this.#creationSite}'`;\n }\n\n get #name() {\n return this.$$type.slice('@backstage/'.length);\n }\n\n setId(id: string): void {\n if (!id) {\n throw new Error(`${this.#name} id must be a non-empty string`);\n }\n if (this.#id) {\n throw new Error(\n `${this.#name} was referenced twice as both '${this.#id}' and '${id}'`,\n );\n }\n this.#id = id;\n }\n\n toString(): string {\n return `${this.#name}{${this.getDescription()}}`;\n }\n}\n\n/**\n * Create a {@link RouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createRouteRef<\n // Params is the type that we care about and the one to be embedded in the route ref.\n // For example, given the params ['name', 'kind'], Params will be {name: string, kind: string}\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TParamKeys extends string = string,\n>(config?: {\n /** A list of parameter names that the path that this route ref is bound to must contain */\n readonly params: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];\n}): RouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string }\n> {\n return new RouteRefImpl(\n config?.params as string[] | undefined,\n describeParentCallSite(),\n ) as RouteRef<any>;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RouteRef, toInternalRouteRef } from './RouteRef';\nimport { AnyRouteRefParams } from './types';\n\n// Should match the pattern in react-router\nconst PARAM_PATTERN = /^\\w+$/;\n\n/**\n * Descriptor of a route relative to an absolute {@link RouteRef}.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface SubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/SubRouteRef';\n\n readonly T: TParams;\n\n readonly path: string;\n}\n\n/** @internal */\nexport interface InternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends SubRouteRef<TParams> {\n readonly version: 'v1';\n\n getParams(): string[];\n getParent(): RouteRef;\n getDescription(): string;\n}\n\n/** @internal */\nexport function toInternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: SubRouteRef<TParams>): InternalSubRouteRef<TParams> {\n const r = resource as InternalSubRouteRef<TParams>;\n if (r.$$type !== '@backstage/SubRouteRef') {\n throw new Error(`Invalid SubRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isSubRouteRef(opaque: {\n $$type: string;\n}): opaque is SubRouteRef {\n return opaque.$$type === '@backstage/SubRouteRef';\n}\n\n/** @internal */\nexport class SubRouteRefImpl<TParams extends AnyRouteRefParams>\n implements SubRouteRef<TParams>\n{\n readonly $$type = '@backstage/SubRouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #params: string[];\n #parent: RouteRef;\n\n constructor(readonly path: string, params: string[], parent: RouteRef) {\n this.#params = params;\n this.#parent = parent;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getParent(): RouteRef {\n return this.#parent;\n }\n\n getDescription(): string {\n const parent = toInternalRouteRef(this.#parent);\n return `at ${this.path} with parent ${parent.getDescription()}`;\n }\n\n toString(): string {\n return `SubRouteRef{${this.getDescription()}}`;\n }\n}\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamPart<S extends string> = S extends `:${infer Param}` ? Param : never;\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamNames<S extends string> = S extends `${infer Part}/${infer Rest}`\n ? ParamPart<Part> | ParamNames<Rest>\n : ParamPart<S>;\n/**\n * This utility type helps us infer a Param object type from a string path\n * For example, `/foo/:bar/:baz` inferred to `{ bar: string, baz: string }`\n * @ignore\n */\ntype PathParams<S extends string> = { [name in ParamNames<S>]: string };\n\n/**\n * Merges a param object type with an optional params type into a params object.\n * @ignore\n */\ntype MergeParams<\n P1 extends { [param in string]: string },\n P2 extends AnyRouteRefParams,\n> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);\n\n/**\n * Convert empty params to undefined.\n * @ignore\n */\ntype TrimEmptyParams<Params extends { [param in string]: string }> =\n keyof Params extends never ? undefined : Params;\n\n/**\n * Creates a SubRouteRef type given the desired parameters and parent route parameters.\n * The parameters types are merged together while ensuring that there is no overlap between the two.\n *\n * @ignore\n */\ntype MakeSubRouteRef<\n Params extends { [param in string]: string },\n ParentParams extends AnyRouteRefParams,\n> = keyof Params & keyof ParentParams extends never\n ? SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>\n : never;\n\n/**\n * Create a {@link SubRouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createSubRouteRef<\n Path extends string,\n ParentParams extends AnyRouteRefParams = never,\n>(config: {\n path: Path;\n parent: RouteRef<ParentParams>;\n}): MakeSubRouteRef<PathParams<Path>, ParentParams> {\n const { path, parent } = config;\n type Params = PathParams<Path>;\n\n const internalParent = toInternalRouteRef(parent);\n const parentParams = internalParent.getParams();\n\n // Collect runtime parameters from the path, e.g. ['bar', 'baz'] from '/foo/:bar/:baz'\n const pathParams = path\n .split('/')\n .filter(p => p.startsWith(':'))\n .map(p => p.substring(1));\n const params = [...parentParams, ...pathParams];\n\n if (parentParams.some(p => pathParams.includes(p as string))) {\n throw new Error(\n 'SubRouteRef may not have params that overlap with its parent',\n );\n }\n if (!path.startsWith('/')) {\n throw new Error(`SubRouteRef path must start with '/', got '${path}'`);\n }\n if (path.endsWith('/')) {\n throw new Error(`SubRouteRef path must not end with '/', got '${path}'`);\n }\n for (const param of pathParams) {\n if (!PARAM_PATTERN.test(param)) {\n throw new Error(`SubRouteRef path has invalid param, got '${param}'`);\n }\n }\n\n // We ensure that the type of the return type is sane here\n const subRouteRef = new SubRouteRefImpl(\n path,\n params as string[],\n parent,\n ) as SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>;\n\n // But skip type checking of the return value itself, because the conditional\n // type checking of the parent parameter overlap is tricky to express.\n return subRouteRef as any;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RouteRefImpl } from './RouteRef';\nimport { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface ExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> {\n readonly $$type: '@backstage/ExternalRouteRef';\n readonly T: TParams;\n readonly optional: TOptional;\n}\n\n/** @internal */\nexport interface InternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> extends ExternalRouteRef<TParams, TOptional> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n>(\n resource: ExternalRouteRef<TParams, TOptional>,\n): InternalExternalRouteRef<TParams, TOptional> {\n const r = resource as InternalExternalRouteRef<TParams, TOptional>;\n if (r.$$type !== '@backstage/ExternalRouteRef') {\n throw new Error(`Invalid ExternalRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isExternalRouteRef(opaque: {\n $$type: string;\n}): opaque is ExternalRouteRef {\n return opaque.$$type === '@backstage/ExternalRouteRef';\n}\n\n/** @internal */\nclass ExternalRouteRefImpl\n extends RouteRefImpl\n implements InternalExternalRouteRef\n{\n readonly $$type = '@backstage/ExternalRouteRef' as any;\n\n constructor(\n readonly optional: boolean,\n readonly params: string[] = [],\n creationSite: string,\n ) {\n super(params, creationSite);\n }\n}\n\n/**\n * Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @param options - Description of the route reference to be created.\n * @public\n */\nexport function createExternalRouteRef<\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TOptional extends boolean = false,\n TParamKeys extends string = string,\n>(options?: {\n /**\n * The parameters that will be provided to the external route reference.\n */\n readonly params?: string extends TParamKeys\n ? (keyof TParams)[]\n : TParamKeys[];\n\n /**\n * Whether or not this route is optional, defaults to false.\n *\n * Optional external routes are not required to be bound in the app, and\n * if they aren't, `useExternalRouteRef` will return `undefined`.\n */\n optional?: TOptional;\n}): ExternalRouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string },\n TOptional\n> {\n return new ExternalRouteRefImpl(\n Boolean(options?.optional),\n options?.params as string[] | undefined,\n describeParentCallSite(),\n ) as ExternalRouteRef<any, any>;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { matchRoutes, useLocation } from 'react-router-dom';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { AnyRouteRefParams } from './types';\nimport { RouteRef } from './RouteRef';\nimport { SubRouteRef } from './SubRouteRef';\nimport { ExternalRouteRef } from './ExternalRouteRef';\n\n/**\n * TS magic for handling route parameters.\n *\n * @remarks\n *\n * The extra TS magic here is to require a single params argument if the RouteRef\n * had at least one param defined, but require 0 arguments if there are no params defined.\n * Without this we'd have to pass in empty object to all parameter-less RouteRefs\n * just to make TypeScript happy, or we would have to make the argument optional in\n * which case you might forget to pass it in when it is actually required.\n *\n * @public\n */\nexport type RouteFunc<TParams extends AnyRouteRefParams> = (\n ...[params]: TParams extends undefined\n ? readonly []\n : readonly [params: TParams]\n) => string;\n\n/**\n * @internal\n */\nexport interface RouteResolver {\n resolve<TParams extends AnyRouteRefParams>(\n anyRouteRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams, any>,\n sourceLocation: Parameters<typeof matchRoutes>[1],\n ): RouteFunc<TParams> | undefined;\n}\n\n/**\n * React hook for constructing URLs to routes.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}\n *\n * @param routeRef - The ref to route that should be converted to URL.\n * @returns A function that will in turn return the concrete URL of the `routeRef`.\n * @public\n */\nexport function useRouteRef<\n TOptional extends boolean,\n TParams extends AnyRouteRefParams,\n>(\n routeRef: ExternalRouteRef<TParams, TOptional>,\n): TParams extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;\n\n/**\n * React hook for constructing URLs to routes.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}\n *\n * @param routeRef - The ref to route that should be converted to URL.\n * @returns A function that will in turn return the concrete URL of the `routeRef`.\n * @public\n */\nexport function useRouteRef<TParams extends AnyRouteRefParams>(\n routeRef: RouteRef<TParams> | SubRouteRef<TParams>,\n): RouteFunc<TParams>;\n\n/**\n * React hook for constructing URLs to routes.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}\n *\n * @param routeRef - The ref to route that should be converted to URL.\n * @returns A function that will in turn return the concrete URL of the `routeRef`.\n * @public\n */\nexport function useRouteRef<TParams extends AnyRouteRefParams>(\n routeRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams, any>,\n): RouteFunc<TParams> | undefined {\n const { pathname } = useLocation();\n const versionedContext = useVersionedContext<{ 1: RouteResolver }>(\n 'routing-context',\n );\n if (!versionedContext) {\n throw new Error('Routing context is not available');\n }\n\n const resolver = versionedContext.atVersion(1);\n const routeFunc = useMemo(\n () => resolver && resolver.resolve(routeRef, { pathname }),\n [resolver, routeRef, pathname],\n );\n\n if (!versionedContext) {\n throw new Error('useRouteRef used outside of routing context');\n }\n if (!resolver) {\n throw new Error('RoutingContext v1 not available');\n }\n\n const isOptional = 'optional' in routeRef && routeRef.optional;\n if (!routeFunc && !isOptional) {\n throw new Error(`No path for ${routeRef}`);\n }\n\n return routeFunc;\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { AnyRouteRefParams } from './types';\nimport { RouteRef } from './RouteRef';\nimport { SubRouteRef } from './SubRouteRef';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyRouteRefParams>(\n _routeRef: RouteRef<Params> | SubRou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QAAA,EAAU,QAAQ,CAAA;AAAA,GAC/B,CAAA;AAEA,EAAA,IAAI,CAAC,gBAAkB,EAAA;AACrB,IAAM,MAAA,IAAI,MAAM,6CAA6C,CAAA,CAAA;AAAA,GAC/D;AACA,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA,CAAA;AAAA,GACnD;AAEA,EAAM,MAAA,UAAA,GAAa,UAAc,IAAA,QAAA,IAAY,QAAS,CAAA,QAAA,CAAA;AACtD,EAAI,IAAA,CAAC,SAAa,IAAA,CAAC,UAAY,EAAA;AAC7B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAe,YAAA,EAAA,QAAQ,CAAE,CAAA,CAAA,CAAA;AAAA,GAC3C;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;AC3GO,SAAS,kBACd,SACQ,EAAA;AACR,EAAA,OAAO,SAAU,EAAA,CAAA;AACnB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-plugin-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,22 +23,26 @@
|
|
|
23
23
|
"postpack": "backstage-cli package postpack"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@backstage/cli": "^0.
|
|
27
|
-
"@backstage/frontend-app-api": "^0.
|
|
28
|
-
"@backstage/test-utils": "^1.4.
|
|
29
|
-
"@testing-library/jest-dom": "^
|
|
30
|
-
"@testing-library/react": "^
|
|
26
|
+
"@backstage/cli": "^0.24.0-next.0",
|
|
27
|
+
"@backstage/frontend-app-api": "^0.3.0-next.0",
|
|
28
|
+
"@backstage/test-utils": "^1.4.5-next.0",
|
|
29
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
30
|
+
"@testing-library/react": "^14.0.0",
|
|
31
|
+
"history": "^5.3.0"
|
|
31
32
|
},
|
|
32
33
|
"files": [
|
|
33
34
|
"dist"
|
|
34
35
|
],
|
|
35
36
|
"peerDependencies": {
|
|
36
|
-
"react": "^16.13.1 || ^17.0.0",
|
|
37
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
37
38
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@backstage/core-
|
|
41
|
+
"@backstage/core-components": "^0.13.7-next.0",
|
|
42
|
+
"@backstage/core-plugin-api": "^1.8.0-next.0",
|
|
41
43
|
"@backstage/types": "^1.1.1",
|
|
44
|
+
"@backstage/version-bridge": "^1.0.7-next.0",
|
|
45
|
+
"@material-ui/core": "^4.12.4",
|
|
42
46
|
"@types/react": "^16.13.1 || ^17.0.0",
|
|
43
47
|
"lodash": "^4.17.21",
|
|
44
48
|
"zod": "^3.21.4",
|