@backstage/frontend-plugin-api 0.1.0-next.0 → 0.1.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage/frontend-plugin-api
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 628ca7e458e4: Initial release
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/core-plugin-api@1.6.0
13
+ - @backstage/types@1.1.1
14
+
3
15
  ## 0.1.0-next.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import React, { ComponentType, ReactNode } from 'react';
2
+ import React, { JSX as JSX$1, ReactNode } from 'react';
3
3
  import { JsonObject } from '@backstage/types';
4
- import { AnyApiFactory, RouteRef, AnyApiRef } from '@backstage/core-plugin-api';
4
+ import { IconComponent, RouteRef, AnyApiFactory, AnyApiRef } from '@backstage/core-plugin-api';
5
5
  import { z, ZodSchema, ZodTypeDef } from 'zod';
6
6
 
7
7
  /** @public */
@@ -24,12 +24,19 @@ interface ConfigurableExtensionDataRef<TData, TConfig extends {
24
24
  /** @public */
25
25
  declare function createExtensionDataRef<TData>(id: string): ConfigurableExtensionDataRef<TData>;
26
26
 
27
+ /** @public */
28
+ type NavTarget = {
29
+ title: string;
30
+ icon: IconComponent;
31
+ routeRef: RouteRef<{}>;
32
+ };
27
33
  /** @public */
28
34
  declare const coreExtensionData: {
29
- reactComponent: ConfigurableExtensionDataRef<ComponentType<{}>, {}>;
35
+ reactElement: ConfigurableExtensionDataRef<JSX$1.Element, {}>;
30
36
  routePath: ConfigurableExtensionDataRef<string, {}>;
31
37
  apiFactory: ConfigurableExtensionDataRef<AnyApiFactory, {}>;
32
- routeRef: ConfigurableExtensionDataRef<RouteRef<any>, {}>;
38
+ routeRef: ConfigurableExtensionDataRef<RouteRef, {}>;
39
+ navTarget: ConfigurableExtensionDataRef<NavTarget, {}>;
33
40
  };
34
41
 
35
42
  /** @public */
@@ -42,27 +49,22 @@ type PortableSchema<TOutput> = {
42
49
  declare function createSchemaFromZod<TOutput, TInput>(schemaCreator: (zImpl: typeof z) => ZodSchema<TOutput, ZodTypeDef, TInput>): PortableSchema<TOutput>;
43
50
 
44
51
  /** @public */
45
- type AnyExtensionDataMap = {
46
- [name in string]: ExtensionDataRef<any, any>;
47
- };
48
- /** @public */
49
- interface Extension<TConfig> {
50
- $$type: '@backstage/Extension';
51
- id: string;
52
- at: string;
53
- disabled: boolean;
54
- inputs: Record<string, {
55
- extensionData: AnyExtensionDataMap;
56
- }>;
57
- output: AnyExtensionDataMap;
58
- configSchema?: PortableSchema<TConfig>;
59
- factory(options: {
60
- source?: BackstagePlugin;
61
- bind: ExtensionDataBind<AnyExtensionDataMap>;
62
- config: TConfig;
63
- inputs: Record<string, Array<Record<string, unknown>>>;
64
- }): void;
52
+ interface ExtensionInput<TExtensionData extends AnyExtensionDataMap, TConfig extends {
53
+ singleton: boolean;
54
+ optional: boolean;
55
+ }> {
56
+ $$type: '@backstage/ExtensionInput';
57
+ extensionData: TExtensionData;
58
+ config: TConfig;
65
59
  }
60
+ /** @public */
61
+ declare function createExtensionInput<TExtensionData extends AnyExtensionDataMap, TConfig extends {
62
+ singleton?: boolean;
63
+ optional?: boolean;
64
+ }>(extensionData: TExtensionData, config?: TConfig): ExtensionInput<TExtensionData, {
65
+ singleton: TConfig['singleton'] extends true ? true : false;
66
+ optional: TConfig['optional'] extends true ? true : false;
67
+ }>;
66
68
 
67
69
  /** @public */
68
70
  interface PluginOptions {
@@ -79,35 +81,49 @@ interface BackstagePlugin {
79
81
  declare function createPlugin(options: PluginOptions): BackstagePlugin;
80
82
 
81
83
  /** @public */
82
- type ExtensionDataInputValues<TInputs extends {
83
- [name in string]: {
84
- extensionData: AnyExtensionDataMap;
85
- };
86
- }> = {
87
- [InputName in keyof TInputs]: Array<{
88
- [DataName in keyof TInputs[InputName]['extensionData'] as TInputs[InputName]['extensionData'][DataName]['config'] extends {
89
- optional: true;
90
- } ? never : DataName]: TInputs[InputName]['extensionData'][DataName]['T'];
91
- } & {
92
- [DataName in keyof TInputs[InputName]['extensionData'] as TInputs[InputName]['extensionData'][DataName]['config'] extends {
93
- optional: true;
94
- } ? DataName : never]?: TInputs[InputName]['extensionData'][DataName]['T'];
84
+ type AnyExtensionDataMap = {
85
+ [name in string]: ExtensionDataRef<unknown, {
86
+ optional?: true;
95
87
  }>;
96
88
  };
97
89
  /** @public */
98
- type ExtensionDataBind<TMap extends AnyExtensionDataMap> = (values: {
99
- [DataName in keyof TMap as TMap[DataName]['config'] extends {
90
+ type AnyExtensionInputMap = {
91
+ [inputName in string]: ExtensionInput<AnyExtensionDataMap, {
92
+ optional: boolean;
93
+ singleton: boolean;
94
+ }>;
95
+ };
96
+ /**
97
+ * Utility type to expand type aliases into their equivalent type.
98
+ * @ignore
99
+ */
100
+ type Expand<T> = T extends infer O ? {
101
+ [K in keyof O]: O[K];
102
+ } : never;
103
+ /**
104
+ * Converts an extension data map into the matching concrete data values type.
105
+ * @public
106
+ */
107
+ type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {
108
+ [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {
100
109
  optional: true;
101
- } ? never : DataName]: TMap[DataName]['T'];
110
+ } ? never : DataName]: TExtensionData[DataName]['T'];
102
111
  } & {
103
- [DataName in keyof TMap as TMap[DataName]['config'] extends {
112
+ [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {
104
113
  optional: true;
105
- } ? DataName : never]?: TMap[DataName]['T'];
106
- }) => void;
114
+ } ? DataName : never]?: TExtensionData[DataName]['T'];
115
+ };
116
+ /**
117
+ * Converts an extension input map into the matching concrete input values type.
118
+ * @public
119
+ */
120
+ type ExtensionInputValues<TInputs extends {
121
+ [name in string]: ExtensionInput<any, any>;
122
+ }> = {
123
+ [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton'] ? Array<Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>>> : false extends TInputs[InputName]['config']['optional'] ? Expand<ExtensionDataValues<TInputs[InputName]['extensionData']>> : Expand<ExtensionDataValues<TInputs[InputName]['extensionData']> | undefined>;
124
+ };
107
125
  /** @public */
108
- interface CreateExtensionOptions<TOutput extends AnyExtensionDataMap, TInputs extends Record<string, {
109
- extensionData: AnyExtensionDataMap;
110
- }>, TConfig> {
126
+ interface CreateExtensionOptions<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig> {
111
127
  id: string;
112
128
  at: string;
113
129
  disabled?: boolean;
@@ -116,15 +132,29 @@ interface CreateExtensionOptions<TOutput extends AnyExtensionDataMap, TInputs ex
116
132
  configSchema?: PortableSchema<TConfig>;
117
133
  factory(options: {
118
134
  source?: BackstagePlugin;
119
- bind: ExtensionDataBind<TOutput>;
135
+ bind(values: Expand<ExtensionDataValues<TOutput>>): void;
136
+ config: TConfig;
137
+ inputs: Expand<ExtensionInputValues<TInputs>>;
138
+ }): void;
139
+ }
140
+ /** @public */
141
+ interface Extension<TConfig> {
142
+ $$type: '@backstage/Extension';
143
+ id: string;
144
+ at: string;
145
+ disabled: boolean;
146
+ inputs: AnyExtensionInputMap;
147
+ output: AnyExtensionDataMap;
148
+ configSchema?: PortableSchema<TConfig>;
149
+ factory(options: {
150
+ source?: BackstagePlugin;
151
+ bind(values: ExtensionInputValues<any>): void;
120
152
  config: TConfig;
121
- inputs: ExtensionDataInputValues<TInputs>;
153
+ inputs: Record<string, undefined | Record<string, unknown> | Array<Record<string, unknown>>>;
122
154
  }): void;
123
155
  }
124
156
  /** @public */
125
- declare function createExtension<TOutput extends AnyExtensionDataMap, TInputs extends Record<string, {
126
- extensionData: AnyExtensionDataMap;
127
- }>, TConfig = never>(options: CreateExtensionOptions<TOutput, TInputs, TConfig>): Extension<TConfig>;
157
+ declare function createExtension<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig = never>(options: CreateExtensionOptions<TOutput, TInputs, TConfig>): Extension<TConfig>;
128
158
 
129
159
  /** @public */
130
160
  interface ExtensionBoundaryProps {
@@ -135,13 +165,11 @@ interface ExtensionBoundaryProps {
135
165
  declare function ExtensionBoundary(props: ExtensionBoundaryProps): React.JSX.Element;
136
166
 
137
167
  /** @public */
138
- declare function createApiExtension<TConfig extends {}, TInputs extends Record<string, {
139
- extensionData: AnyExtensionDataMap;
140
- }>>(options: ({
168
+ declare function createApiExtension<TConfig extends {}, TInputs extends AnyExtensionInputMap>(options: ({
141
169
  api: AnyApiRef;
142
170
  factory: (options: {
143
171
  config: TConfig;
144
- inputs: ExtensionDataInputValues<TInputs>;
172
+ inputs: Expand<ExtensionInputValues<TInputs>>;
145
173
  }) => AnyApiFactory;
146
174
  } | {
147
175
  factory: AnyApiFactory;
@@ -157,9 +185,7 @@ declare function createApiExtension<TConfig extends {}, TInputs extends Record<s
157
185
  */
158
186
  declare function createPageExtension<TConfig extends {
159
187
  path: string;
160
- }, TInputs extends Record<string, {
161
- extensionData: AnyExtensionDataMap;
162
- }>>(options: ({
188
+ }, TInputs extends AnyExtensionInputMap>(options: ({
163
189
  defaultPath: string;
164
190
  } | {
165
191
  configSchema: PortableSchema<TConfig>;
@@ -169,13 +195,26 @@ declare function createPageExtension<TConfig extends {
169
195
  disabled?: boolean;
170
196
  inputs?: TInputs;
171
197
  routeRef?: RouteRef;
172
- component: (props: {
198
+ loader: (options: {
173
199
  config: TConfig;
174
- inputs: ExtensionDataInputValues<TInputs>;
200
+ inputs: Expand<ExtensionInputValues<TInputs>>;
175
201
  }) => Promise<JSX.Element>;
176
202
  }): Extension<TConfig>;
177
203
 
204
+ /**
205
+ * Helper for creating extensions for a nav item.
206
+ * @public
207
+ */
208
+ declare function createNavItemExtension(options: {
209
+ id: string;
210
+ routeRef: RouteRef;
211
+ title: string;
212
+ icon: IconComponent;
213
+ }): Extension<{
214
+ title: string;
215
+ }>;
216
+
178
217
  /** @public */
179
218
  declare function useRouteRef(routeRef: RouteRef<any>): () => string;
180
219
 
181
- export { AnyExtensionDataMap, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataBind, ExtensionDataInputValues, ExtensionDataRef, PluginOptions, PortableSchema, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createPageExtension, createPlugin, createSchemaFromZod, useRouteRef };
220
+ 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, useRouteRef };
package/dist/index.esm.js CHANGED
@@ -20,10 +20,11 @@ function createExtensionDataRef(id) {
20
20
  }
21
21
 
22
22
  const coreExtensionData = {
23
- reactComponent: createExtensionDataRef("core.reactComponent"),
23
+ reactElement: createExtensionDataRef("core.reactElement"),
24
24
  routePath: createExtensionDataRef("core.routing.path"),
25
25
  apiFactory: createExtensionDataRef("core.api.factory"),
26
- routeRef: createExtensionDataRef("core.routing.ref")
26
+ routeRef: createExtensionDataRef("core.routing.ref"),
27
+ navTarget: createExtensionDataRef("core.nav.target")
27
28
  };
28
29
 
29
30
  function createExtension(options) {
@@ -43,6 +44,17 @@ function createExtension(options) {
43
44
  };
44
45
  }
45
46
 
47
+ function createExtensionInput(extensionData, config) {
48
+ return {
49
+ $$type: "@backstage/ExtensionInput",
50
+ extensionData,
51
+ config: {
52
+ singleton: Boolean(config == null ? void 0 : config.singleton),
53
+ optional: Boolean(config == null ? void 0 : config.optional)
54
+ }
55
+ };
56
+ }
57
+
46
58
  function createPlugin(options) {
47
59
  var _a;
48
60
  return {
@@ -112,7 +124,7 @@ function createPageExtension(options) {
112
124
  at: (_a = options.at) != null ? _a : "core.routes/routes",
113
125
  disabled: options.disabled,
114
126
  output: {
115
- component: coreExtensionData.reactComponent,
127
+ element: coreExtensionData.reactElement,
116
128
  path: coreExtensionData.routePath,
117
129
  routeRef: coreExtensionData.routeRef.optional()
118
130
  },
@@ -120,17 +132,42 @@ function createPageExtension(options) {
120
132
  configSchema,
121
133
  factory({ bind, config, inputs, source }) {
122
134
  const LazyComponent = React.lazy(
123
- () => options.component({ config, inputs }).then((element) => ({ default: () => element }))
135
+ () => options.loader({ config, inputs }).then((element) => ({ default: () => element }))
124
136
  );
125
137
  bind({
126
138
  path: config.path,
127
- component: () => /* @__PURE__ */ React.createElement(ExtensionBoundary, { source }, /* @__PURE__ */ React.createElement(React.Suspense, { fallback: "..." }, /* @__PURE__ */ React.createElement(LazyComponent, null))),
139
+ element: /* @__PURE__ */ React.createElement(ExtensionBoundary, { source }, /* @__PURE__ */ React.createElement(React.Suspense, { fallback: "..." }, /* @__PURE__ */ React.createElement(LazyComponent, null))),
128
140
  routeRef: options.routeRef
129
141
  });
130
142
  }
131
143
  });
132
144
  }
133
145
 
146
+ function createNavItemExtension(options) {
147
+ const { id, routeRef, title, icon } = options;
148
+ return createExtension({
149
+ id,
150
+ at: "core.nav/items",
151
+ configSchema: createSchemaFromZod(
152
+ (z) => z.object({
153
+ title: z.string().default(title)
154
+ })
155
+ ),
156
+ output: {
157
+ navTarget: coreExtensionData.navTarget
158
+ },
159
+ factory: ({ bind, config }) => {
160
+ bind({
161
+ navTarget: {
162
+ title: config.title,
163
+ icon,
164
+ routeRef
165
+ }
166
+ });
167
+ }
168
+ });
169
+ }
170
+
134
171
  function useRouteRef(routeRef) {
135
172
  const { pathname } = useLocation();
136
173
  const resolver = useContext(RoutingContext);
@@ -144,5 +181,5 @@ function useRouteRef(routeRef) {
144
181
  return routeFunc;
145
182
  }
146
183
 
147
- export { ExtensionBoundary, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createPageExtension, createPlugin, createSchemaFromZod, useRouteRef };
184
+ export { ExtensionBoundary, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, useRouteRef };
148
185
  //# sourceMappingURL=index.esm.js.map
@@ -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/createPlugin.ts","../src/extensions/createApiExtension.ts","../src/schema/createSchemaFromZod.ts","../src/extensions/createPageExtension.tsx","../src/routing/useRouteRef.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 { AnyApiFactory, RouteRef } from '@backstage/core-plugin-api';\nimport { ComponentType } from 'react';\nimport { createExtensionDataRef } from './createExtensionDataRef';\n\n/** @public */\nexport const coreExtensionData = {\n reactComponent: createExtensionDataRef<ComponentType>('core.reactComponent'),\n routePath: createExtensionDataRef<string>('core.routing.path'),\n apiFactory: createExtensionDataRef<AnyApiFactory>('core.api.factory'),\n routeRef: createExtensionDataRef<RouteRef>('core.routing.ref'),\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 { BackstagePlugin } from './createPlugin';\nimport { AnyExtensionDataMap, Extension } from './types';\n\n/** @public */\nexport type ExtensionDataInputValues<\n TInputs extends { [name in string]: { extensionData: AnyExtensionDataMap } },\n> = {\n [InputName in keyof TInputs]: Array<\n {\n [DataName in keyof TInputs[InputName]['extensionData'] as TInputs[InputName]['extensionData'][DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TInputs[InputName]['extensionData'][DataName]['T'];\n } & {\n [DataName in keyof TInputs[InputName]['extensionData'] as TInputs[InputName]['extensionData'][DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TInputs[InputName]['extensionData'][DataName]['T'];\n }\n >;\n};\n\n/** @public */\nexport type ExtensionDataBind<TMap extends AnyExtensionDataMap> = (\n values: {\n [DataName in keyof TMap as TMap[DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TMap[DataName]['T'];\n } & {\n [DataName in keyof TMap as TMap[DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TMap[DataName]['T'];\n },\n) => void;\n\n/** @public */\nexport interface CreateExtensionOptions<\n TOutput extends AnyExtensionDataMap,\n TInputs extends Record<string, { extensionData: AnyExtensionDataMap }>,\n TConfig,\n> {\n id: string;\n at: string;\n disabled?: boolean;\n inputs?: TInputs;\n output: TOutput;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n source?: BackstagePlugin;\n bind: ExtensionDataBind<TOutput>;\n config: TConfig;\n inputs: ExtensionDataInputValues<TInputs>;\n }): void;\n}\n\n/** @public */\nexport function createExtension<\n TOutput extends AnyExtensionDataMap,\n TInputs extends Record<string, { extensionData: AnyExtensionDataMap }>,\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 ExtensionDataInputValues<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 { Extension } from './types';\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 AnyExtensionDataMap,\n ExtensionDataInputValues,\n createExtension,\n coreExtensionData,\n} from '../wiring';\n\n/** @public */\nexport function createApiExtension<\n TConfig extends {},\n TInputs extends Record<string, { extensionData: AnyExtensionDataMap }>,\n>(\n options: (\n | {\n api: AnyApiRef;\n factory: (options: {\n config: TConfig;\n inputs: ExtensionDataInputValues<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 at: 'core/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 AnyExtensionDataMap,\n coreExtensionData,\n createExtension,\n Extension,\n ExtensionDataInputValues,\n} from '../wiring';\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 Record<string, { extensionData: AnyExtensionDataMap }>,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n id: string;\n at?: string;\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n component: (props: {\n config: TConfig;\n inputs: ExtensionDataInputValues<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 at: options.at ?? 'core.routes/routes',\n disabled: options.disabled,\n output: {\n component: coreExtensionData.reactComponent,\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 .component({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n bind({\n path: config.path,\n component: () => (\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 { RouteRef } from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-forbidden-package-imports\nimport { RoutingContext } from '@backstage/frontend-app-api/src/routing/RoutingContext';\nimport { useContext, useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\n\n/** @public */\nexport function useRouteRef(routeRef: RouteRef<any>): () => string {\n const { pathname } = useLocation();\n const resolver = useContext(RoutingContext);\n\n const routeFunc = useMemo(\n () => resolver && resolver.resolve(routeRef, { pathname }),\n [resolver, routeRef, pathname],\n );\n\n if (!routeFunc) {\n throw new Error(`Failed to resolve routeRef ${routeRef}`);\n }\n\n return routeFunc;\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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,CAAA,CAAA;AAAA,GAC1D;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
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/routing/useRouteRef.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 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};\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 at: 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 at: 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 at: 'core/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 at?: 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 at: options.at ?? 'core.routes/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 at: 'core.nav/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 { RouteRef } from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-forbidden-package-imports\nimport { RoutingContext } from '@backstage/frontend-app-api/src/routing/RoutingContext';\nimport { useContext, useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\n\n/** @public */\nexport function useRouteRef(routeRef: RouteRef<any>): () => string {\n const { pathname } = useLocation();\n const resolver = useContext(RoutingContext);\n\n const routeFunc = useMemo(\n () => resolver && resolver.resolve(routeRef, { pathname }),\n [resolver, routeRef, pathname],\n );\n\n if (!routeFunc) {\n throw new Error(`Failed to resolve routeRef ${routeRef}`);\n }\n\n return routeFunc;\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;;AChBO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,YAAA,EAAc,uBAAoC,mBAAmB,CAAA;AAAA,EACrE,SAAA,EAAW,uBAA+B,mBAAmB,CAAA;AAAA,EAC7D,UAAA,EAAY,uBAAsC,kBAAk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AAA;AAAA,QACP,KAAO,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,OAChC,CAAA;AAAA,KACH;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAW,iBAAkB,CAAA,SAAA;AAAA,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;;AC7BO,SAAS,YAAY,QAAuC,EAAA;AACjE,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,WAAY,EAAA,CAAA;AACjC,EAAM,MAAA,QAAA,GAAW,WAAW,cAAc,CAAA,CAAA;AAE1C,EAAA,MAAM,SAAY,GAAA,OAAA;AAAA,IAChB,MAAM,QAAY,IAAA,QAAA,CAAS,QAAQ,QAAU,EAAA,EAAE,UAAU,CAAA;AAAA,IACzD,CAAC,QAAU,EAAA,QAAA,EAAU,QAAQ,CAAA;AAAA,GAC/B,CAAA;AAEA,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAA8B,2BAAA,EAAA,QAAQ,CAAE,CAAA,CAAA,CAAA;AAAA,GAC1D;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/frontend-plugin-api",
3
- "version": "0.1.0-next.0",
3
+ "version": "0.1.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -23,9 +23,9 @@
23
23
  "postpack": "backstage-cli package postpack"
24
24
  },
25
25
  "devDependencies": {
26
- "@backstage/cli": "^0.22.13-next.3",
27
- "@backstage/frontend-app-api": "^0.1.0-next.0",
28
- "@backstage/test-utils": "^1.4.3-next.3",
26
+ "@backstage/cli": "^0.22.13",
27
+ "@backstage/frontend-app-api": "^0.1.0",
28
+ "@backstage/test-utils": "^1.4.3",
29
29
  "@testing-library/jest-dom": "^5.10.1",
30
30
  "@testing-library/react": "^12.1.3"
31
31
  },
@@ -37,8 +37,8 @@
37
37
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
38
38
  },
39
39
  "dependencies": {
40
- "@backstage/core-plugin-api": "^1.6.0-next.3",
41
- "@backstage/types": "^1.1.1-next.0",
40
+ "@backstage/core-plugin-api": "^1.6.0",
41
+ "@backstage/types": "^1.1.1",
42
42
  "@types/react": "^16.13.1 || ^17.0.0",
43
43
  "lodash": "^4.17.21",
44
44
  "zod": "^3.21.4",