@backstage/frontend-plugin-api 0.10.3-next.1 → 0.10.3
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
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0169b23: Internal tweak to avoid circular dependencies
|
|
8
|
+
- 9e3868f: Added a new optional `info` option to `createFrontendPlugin` that lets you provide a loaders for different sources of metadata information about the plugin.
|
|
9
|
+
|
|
10
|
+
There are two available loaders. The first one is `info.packageJson`, which can be used to point to a `package.json` file for the plugin. This is recommended for any plugin that is defined within its own package, especially all plugins that are published to a package registry. Typical usage looks like this:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
export default createFrontendPlugin({
|
|
14
|
+
pluginId: '...',
|
|
15
|
+
info: {
|
|
16
|
+
packageJson: () => import('../package.json'),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The second loader is `info.manifest`, which can be used to point to an opaque plugin manifest. This **MUST ONLY** be used by plugins that are intended for use within a single organization. Plugins that are published to an open package registry should **NOT** use this loader. The loader is useful for adding additional internal metadata associated with the plugin, and it is up to the Backstage app to decide how these manifests are parsed and used. The default manifest parser in an app created with `createApp` from `@backstage/frontend-defaults` is able to parse the default `catalog-info.yaml` format and built-in fields such as `spec.owner`.
|
|
22
|
+
|
|
23
|
+
Typical usage looks like this:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
export default createFrontendPlugin({
|
|
27
|
+
pluginId: '...',
|
|
28
|
+
info: {
|
|
29
|
+
manifest: () => import('../catalog-info.yaml'),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- 6f48f71: Added a new `useAppNode` hook, which can be used to get a reference to the `AppNode` from by the closest `ExtensionBoundary`.
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @backstage/core-components@0.17.3
|
|
37
|
+
- @backstage/core-plugin-api@1.10.8
|
|
38
|
+
- @backstage/types@1.2.1
|
|
39
|
+
- @backstage/version-bridge@1.0.11
|
|
40
|
+
|
|
3
41
|
## 0.10.3-next.1
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tracker.esm.js","sources":["../../../../../core-plugin-api/src/analytics/Tracker.ts"],"sourcesContent":["/*\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"],"names":[],"mappings":";;AAoDqB,0BAAA;AAAA,EACnB,0CAAA;AAAA,EACA,OAAO;AAAA,IACL,4BAA8B,EAAA,KAAA,CAAA;AAAA,IAC9B,iCAAmC,EAAA,KAAA,CAAA;AAAA,IACnC,sBAAwB,EAAA;AAAA,GAC1B;AACF;AAKO,MAAM,8BAAiC,GAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Tracker.esm.js","sources":["../../../../../core-plugin-api/src/analytics/Tracker.ts"],"sourcesContent":["/*\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 './types';\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"],"names":[],"mappings":";;AAoDqB,0BAAA;AAAA,EACnB,0CAAA;AAAA,EACA,OAAO;AAAA,IACL,4BAA8B,EAAA,KAAA,CAAA;AAAA,IAC9B,iCAAmC,EAAA,KAAA,CAAA;AAAA,IACnC,sBAAwB,EAAA;AAAA,GAC1B;AACF;AAKO,MAAM,8BAAiC,GAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Expand, JsonObject } from '@backstage/types';
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { TranslationResource, TranslationMessages } from '@backstage/core-plugin-api/alpha';
|
|
10
10
|
export { TranslationMessages, TranslationMessagesOptions, TranslationRef, TranslationRefOptions, TranslationResource, TranslationResourceOptions, createTranslationMessages, createTranslationRef, createTranslationResource, useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
11
|
+
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Common analytics context attributes.
|
|
@@ -49,6 +50,43 @@ declare const AnalyticsContext: (options: {
|
|
|
49
50
|
children: ReactNode;
|
|
50
51
|
}) => react_jsx_runtime.JSX.Element;
|
|
51
52
|
|
|
53
|
+
/** @public */
|
|
54
|
+
type ExtensionDataValue<TData, TId extends string> = {
|
|
55
|
+
readonly $$type: '@backstage/ExtensionDataValue';
|
|
56
|
+
readonly id: TId;
|
|
57
|
+
readonly value: TData;
|
|
58
|
+
};
|
|
59
|
+
/** @public */
|
|
60
|
+
type ExtensionDataRef<TData, TId extends string = string, TConfig extends {
|
|
61
|
+
optional?: true;
|
|
62
|
+
} = {}> = {
|
|
63
|
+
readonly $$type: '@backstage/ExtensionDataRef';
|
|
64
|
+
readonly id: TId;
|
|
65
|
+
readonly T: TData;
|
|
66
|
+
readonly config: TConfig;
|
|
67
|
+
};
|
|
68
|
+
/** @public */
|
|
69
|
+
type ExtensionDataRefToValue<TDataRef extends AnyExtensionDataRef> = TDataRef extends ExtensionDataRef<infer IData, infer IId, any> ? ExtensionDataValue<IData, IId> : never;
|
|
70
|
+
/** @public */
|
|
71
|
+
type AnyExtensionDataRef = ExtensionDataRef<unknown, string, {
|
|
72
|
+
optional?: true;
|
|
73
|
+
}>;
|
|
74
|
+
/** @public */
|
|
75
|
+
interface ConfigurableExtensionDataRef<TData, TId extends string, TConfig extends {
|
|
76
|
+
optional?: true;
|
|
77
|
+
} = {}> extends ExtensionDataRef<TData, TId, TConfig> {
|
|
78
|
+
optional(): ConfigurableExtensionDataRef<TData, TId, TConfig & {
|
|
79
|
+
optional: true;
|
|
80
|
+
}>;
|
|
81
|
+
(t: TData): ExtensionDataValue<TData, TId>;
|
|
82
|
+
}
|
|
83
|
+
/** @public */
|
|
84
|
+
declare function createExtensionDataRef<TData>(): {
|
|
85
|
+
with<TId extends string>(options: {
|
|
86
|
+
id: TId;
|
|
87
|
+
}): ConfigurableExtensionDataRef<TData, TId>;
|
|
88
|
+
};
|
|
89
|
+
|
|
52
90
|
/**
|
|
53
91
|
* Catch-all type for route params.
|
|
54
92
|
*
|
|
@@ -86,6 +124,73 @@ declare function createRouteRef<TParams extends {
|
|
|
86
124
|
[param in TParamKeys]: string;
|
|
87
125
|
}>;
|
|
88
126
|
|
|
127
|
+
/** @public */
|
|
128
|
+
declare const coreExtensionData: {
|
|
129
|
+
reactElement: ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}>;
|
|
130
|
+
routePath: ConfigurableExtensionDataRef<string, "core.routing.path", {}>;
|
|
131
|
+
routeRef: ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {}>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** @public */
|
|
135
|
+
interface ExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
|
|
136
|
+
optional?: true;
|
|
137
|
+
}>, TConfig extends {
|
|
138
|
+
singleton: boolean;
|
|
139
|
+
optional: boolean;
|
|
140
|
+
}> {
|
|
141
|
+
$$type: '@backstage/ExtensionInput';
|
|
142
|
+
extensionData: Array<UExtensionData>;
|
|
143
|
+
config: TConfig;
|
|
144
|
+
replaces?: Array<{
|
|
145
|
+
id: string;
|
|
146
|
+
input: string;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
/** @public */
|
|
150
|
+
declare function createExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
|
|
151
|
+
optional?: true;
|
|
152
|
+
}>, TConfig extends {
|
|
153
|
+
singleton?: boolean;
|
|
154
|
+
optional?: boolean;
|
|
155
|
+
}>(extensionData: Array<UExtensionData>, config?: TConfig & {
|
|
156
|
+
replaces?: Array<{
|
|
157
|
+
id: string;
|
|
158
|
+
input: string;
|
|
159
|
+
}>;
|
|
160
|
+
}): ExtensionInput<UExtensionData, {
|
|
161
|
+
singleton: TConfig['singleton'] extends true ? true : false;
|
|
162
|
+
optional: TConfig['optional'] extends true ? true : false;
|
|
163
|
+
}>;
|
|
164
|
+
|
|
165
|
+
/** @public */
|
|
166
|
+
type ResolveInputValueOverrides<TInputs extends {
|
|
167
|
+
[inputName in string]: ExtensionInput<AnyExtensionDataRef, {
|
|
168
|
+
optional: boolean;
|
|
169
|
+
singleton: boolean;
|
|
170
|
+
}>;
|
|
171
|
+
} = {
|
|
172
|
+
[inputName in string]: ExtensionInput<AnyExtensionDataRef, {
|
|
173
|
+
optional: boolean;
|
|
174
|
+
singleton: boolean;
|
|
175
|
+
}>;
|
|
176
|
+
}> = Expand<{
|
|
177
|
+
[KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
|
|
178
|
+
optional: infer IOptional extends boolean;
|
|
179
|
+
singleton: boolean;
|
|
180
|
+
}> ? IOptional extends true ? never : KName : never]: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
|
|
181
|
+
optional: boolean;
|
|
182
|
+
singleton: infer ISingleton extends boolean;
|
|
183
|
+
}> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
|
|
184
|
+
} & {
|
|
185
|
+
[KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
|
|
186
|
+
optional: infer IOptional extends boolean;
|
|
187
|
+
singleton: boolean;
|
|
188
|
+
}> ? IOptional extends true ? KName : never : never]?: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
|
|
189
|
+
optional: boolean;
|
|
190
|
+
singleton: infer ISingleton extends boolean;
|
|
191
|
+
}> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
|
|
192
|
+
}>;
|
|
193
|
+
|
|
89
194
|
/**
|
|
90
195
|
* Descriptor of a route relative to an absolute {@link RouteRef}.
|
|
91
196
|
*
|
|
@@ -213,110 +318,6 @@ declare function useRouteRef<TParams extends AnyRouteRefParams>(routeRef: RouteR
|
|
|
213
318
|
*/
|
|
214
319
|
declare function useRouteRefParams<Params extends AnyRouteRefParams>(_routeRef: RouteRef<Params> | SubRouteRef<Params>): Params;
|
|
215
320
|
|
|
216
|
-
/** @public */
|
|
217
|
-
type ExtensionDataValue<TData, TId extends string> = {
|
|
218
|
-
readonly $$type: '@backstage/ExtensionDataValue';
|
|
219
|
-
readonly id: TId;
|
|
220
|
-
readonly value: TData;
|
|
221
|
-
};
|
|
222
|
-
/** @public */
|
|
223
|
-
type ExtensionDataRef<TData, TId extends string = string, TConfig extends {
|
|
224
|
-
optional?: true;
|
|
225
|
-
} = {}> = {
|
|
226
|
-
readonly $$type: '@backstage/ExtensionDataRef';
|
|
227
|
-
readonly id: TId;
|
|
228
|
-
readonly T: TData;
|
|
229
|
-
readonly config: TConfig;
|
|
230
|
-
};
|
|
231
|
-
/** @public */
|
|
232
|
-
type ExtensionDataRefToValue<TDataRef extends AnyExtensionDataRef> = TDataRef extends ExtensionDataRef<infer IData, infer IId, any> ? ExtensionDataValue<IData, IId> : never;
|
|
233
|
-
/** @public */
|
|
234
|
-
type AnyExtensionDataRef = ExtensionDataRef<unknown, string, {
|
|
235
|
-
optional?: true;
|
|
236
|
-
}>;
|
|
237
|
-
/** @public */
|
|
238
|
-
interface ConfigurableExtensionDataRef<TData, TId extends string, TConfig extends {
|
|
239
|
-
optional?: true;
|
|
240
|
-
} = {}> extends ExtensionDataRef<TData, TId, TConfig> {
|
|
241
|
-
optional(): ConfigurableExtensionDataRef<TData, TId, TConfig & {
|
|
242
|
-
optional: true;
|
|
243
|
-
}>;
|
|
244
|
-
(t: TData): ExtensionDataValue<TData, TId>;
|
|
245
|
-
}
|
|
246
|
-
/** @public */
|
|
247
|
-
declare function createExtensionDataRef<TData>(): {
|
|
248
|
-
with<TId extends string>(options: {
|
|
249
|
-
id: TId;
|
|
250
|
-
}): ConfigurableExtensionDataRef<TData, TId>;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/** @public */
|
|
254
|
-
declare const coreExtensionData: {
|
|
255
|
-
reactElement: ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}>;
|
|
256
|
-
routePath: ConfigurableExtensionDataRef<string, "core.routing.path", {}>;
|
|
257
|
-
routeRef: ConfigurableExtensionDataRef<RouteRef<AnyRouteRefParams>, "core.routing.ref", {}>;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/** @public */
|
|
261
|
-
interface ExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
|
|
262
|
-
optional?: true;
|
|
263
|
-
}>, TConfig extends {
|
|
264
|
-
singleton: boolean;
|
|
265
|
-
optional: boolean;
|
|
266
|
-
}> {
|
|
267
|
-
$$type: '@backstage/ExtensionInput';
|
|
268
|
-
extensionData: Array<UExtensionData>;
|
|
269
|
-
config: TConfig;
|
|
270
|
-
replaces?: Array<{
|
|
271
|
-
id: string;
|
|
272
|
-
input: string;
|
|
273
|
-
}>;
|
|
274
|
-
}
|
|
275
|
-
/** @public */
|
|
276
|
-
declare function createExtensionInput<UExtensionData extends ExtensionDataRef<unknown, string, {
|
|
277
|
-
optional?: true;
|
|
278
|
-
}>, TConfig extends {
|
|
279
|
-
singleton?: boolean;
|
|
280
|
-
optional?: boolean;
|
|
281
|
-
}>(extensionData: Array<UExtensionData>, config?: TConfig & {
|
|
282
|
-
replaces?: Array<{
|
|
283
|
-
id: string;
|
|
284
|
-
input: string;
|
|
285
|
-
}>;
|
|
286
|
-
}): ExtensionInput<UExtensionData, {
|
|
287
|
-
singleton: TConfig['singleton'] extends true ? true : false;
|
|
288
|
-
optional: TConfig['optional'] extends true ? true : false;
|
|
289
|
-
}>;
|
|
290
|
-
|
|
291
|
-
/** @public */
|
|
292
|
-
type ResolveInputValueOverrides<TInputs extends {
|
|
293
|
-
[inputName in string]: ExtensionInput<AnyExtensionDataRef, {
|
|
294
|
-
optional: boolean;
|
|
295
|
-
singleton: boolean;
|
|
296
|
-
}>;
|
|
297
|
-
} = {
|
|
298
|
-
[inputName in string]: ExtensionInput<AnyExtensionDataRef, {
|
|
299
|
-
optional: boolean;
|
|
300
|
-
singleton: boolean;
|
|
301
|
-
}>;
|
|
302
|
-
}> = Expand<{
|
|
303
|
-
[KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
|
|
304
|
-
optional: infer IOptional extends boolean;
|
|
305
|
-
singleton: boolean;
|
|
306
|
-
}> ? IOptional extends true ? never : KName : never]: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
|
|
307
|
-
optional: boolean;
|
|
308
|
-
singleton: infer ISingleton extends boolean;
|
|
309
|
-
}> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
|
|
310
|
-
} & {
|
|
311
|
-
[KName in keyof TInputs as TInputs[KName] extends ExtensionInput<any, {
|
|
312
|
-
optional: infer IOptional extends boolean;
|
|
313
|
-
singleton: boolean;
|
|
314
|
-
}> ? IOptional extends true ? KName : never : never]?: TInputs[KName] extends ExtensionInput<infer IDataRefs, {
|
|
315
|
-
optional: boolean;
|
|
316
|
-
singleton: infer ISingleton extends boolean;
|
|
317
|
-
}> ? ISingleton extends true ? Iterable<ExtensionDataRefToValue<IDataRefs>> : Array<Iterable<ExtensionDataRefToValue<IDataRefs>>> : never;
|
|
318
|
-
}>;
|
|
319
|
-
|
|
320
321
|
/** @public */
|
|
321
322
|
interface CreateFrontendModuleOptions<TPluginId extends string, TExtensions extends readonly ExtensionDefinition[]> {
|
|
322
323
|
pluginId: TPluginId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreExtensionData.esm.js","sources":["../../src/wiring/coreExtensionData.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 { JSX } from 'react';\nimport { RouteRef } from '../routing';\nimport { createExtensionDataRef } from './createExtensionDataRef';\n\n/** @public */\nexport const coreExtensionData = {\n reactElement: createExtensionDataRef<JSX.Element>().with({\n id: 'core.reactElement',\n }),\n routePath: createExtensionDataRef<string>().with({ id: 'core.routing.path' }),\n routeRef: createExtensionDataRef<RouteRef>().with({ id: 'core.routing.ref' }),\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,YAAA,EAAc,sBAAoC,EAAA,CAAE,IAAK,CAAA;AAAA,IACvD,EAAI,EAAA;AAAA,GACL,CAAA;AAAA,EACD,WAAW,sBAA+B,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,qBAAqB,CAAA;AAAA,EAC5E,UAAU,sBAAiC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,oBAAoB;AAC9E;;;;"}
|
|
1
|
+
{"version":3,"file":"coreExtensionData.esm.js","sources":["../../src/wiring/coreExtensionData.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 { JSX } from 'react';\nimport { RouteRef } from '../routing/RouteRef';\nimport { createExtensionDataRef } from './createExtensionDataRef';\n\n/** @public */\nexport const coreExtensionData = {\n reactElement: createExtensionDataRef<JSX.Element>().with({\n id: 'core.reactElement',\n }),\n routePath: createExtensionDataRef<string>().with({ id: 'core.routing.path' }),\n routeRef: createExtensionDataRef<RouteRef>().with({ id: 'core.routing.ref' }),\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,YAAA,EAAc,sBAAoC,EAAA,CAAE,IAAK,CAAA;AAAA,IACvD,EAAI,EAAA;AAAA,GACL,CAAA;AAAA,EACD,WAAW,sBAA+B,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,qBAAqB,CAAA;AAAA,EAC5E,UAAU,sBAAiC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,oBAAoB;AAC9E;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-plugin-api",
|
|
3
|
-
"version": "0.10.3
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"test": "backstage-cli package test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@backstage/core-components": "0.17.3
|
|
35
|
-
"@backstage/core-plugin-api": "1.10.
|
|
36
|
-
"@backstage/types": "1.2.1",
|
|
37
|
-
"@backstage/version-bridge": "1.0.11",
|
|
34
|
+
"@backstage/core-components": "^0.17.3",
|
|
35
|
+
"@backstage/core-plugin-api": "^1.10.8",
|
|
36
|
+
"@backstage/types": "^1.2.1",
|
|
37
|
+
"@backstage/version-bridge": "^1.0.11",
|
|
38
38
|
"@material-ui/core": "^4.12.4",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"zod": "^3.22.4",
|
|
41
41
|
"zod-to-json-schema": "^3.21.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@backstage/cli": "0.33.0
|
|
45
|
-
"@backstage/frontend-app-api": "0.11.3
|
|
46
|
-
"@backstage/frontend-test-utils": "0.3.3
|
|
47
|
-
"@backstage/test-utils": "1.7.
|
|
44
|
+
"@backstage/cli": "^0.33.0",
|
|
45
|
+
"@backstage/frontend-app-api": "^0.11.3",
|
|
46
|
+
"@backstage/frontend-test-utils": "^0.3.3",
|
|
47
|
+
"@backstage/test-utils": "^1.7.9",
|
|
48
48
|
"@testing-library/jest-dom": "^6.0.0",
|
|
49
49
|
"@testing-library/react": "^16.0.0",
|
|
50
50
|
"@types/react": "^18.0.0",
|