@backstage/plugin-api-docs 0.11.8-next.3 → 0.11.9-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 CHANGED
@@ -1,5 +1,41 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
+ ## 0.11.9-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fec8b57: Updated exports to use the new type parameters for extensions and extension blueprints.
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.8.0-next.0
10
+ - @backstage/core-compat-api@0.2.9-next.0
11
+ - @backstage/plugin-catalog-react@1.12.4-next.0
12
+ - @backstage/plugin-catalog@1.22.1-next.0
13
+ - @backstage/catalog-model@1.6.0
14
+ - @backstage/core-components@0.14.10
15
+ - @backstage/core-plugin-api@1.9.3
16
+ - @backstage/plugin-catalog-common@1.0.26
17
+ - @backstage/plugin-permission-react@0.4.25
18
+
19
+ ## 0.11.8
20
+
21
+ ### Patch Changes
22
+
23
+ - 770ba02: `ConsumingComponentsCard` and `ProvidingComponentsCard` will now optionally accept `columns` to override which table columns are displayed
24
+ - fe1fbb2: Migrating usages of the deprecated `createExtension` `v1` format to the newer `v2` format, and old `create*Extension` extension creators to blueprints.
25
+ - ebfeb40: Added `resolvers` prop to `AsyncApiDefinitionWidget`. This allows to override the default http/https resolvers, for example to add authentication to requests to internal schema registries.
26
+ - 4b6d2cb: Updated dependency `@graphiql/react` to `^0.23.0`.
27
+ - 6582799: Add `tableOptions` to all tables and additionally `title` to API tables.
28
+ - Updated dependencies
29
+ - @backstage/plugin-catalog@1.22.0
30
+ - @backstage/frontend-plugin-api@0.7.0
31
+ - @backstage/plugin-catalog-react@1.12.3
32
+ - @backstage/core-components@0.14.10
33
+ - @backstage/core-compat-api@0.2.8
34
+ - @backstage/catalog-model@1.6.0
35
+ - @backstage/core-plugin-api@1.9.3
36
+ - @backstage/plugin-catalog-common@1.0.26
37
+ - @backstage/plugin-permission-react@0.4.25
38
+
3
39
  ## 0.11.8-next.3
4
40
 
5
41
  ### Patch Changes
package/README.md CHANGED
@@ -222,10 +222,6 @@ security:
222
222
  - [read_pets, write_pets]
223
223
  ```
224
224
 
225
- ## Links
226
-
227
- - [The Backstage homepage](https://backstage.io)
228
-
229
225
  ### Adding `requestInterceptor` to Swagger UI
230
226
 
231
227
  To configure a [`requestInterceptor` for Swagger UI](https://github.com/swagger-api/swagger-ui/tree/master/flavors/swagger-ui-react#requestinterceptor-proptypesfunc) you'll need to add the following to your `api.tsx`:
@@ -319,3 +315,62 @@ export const apis: AnyApiFactory[] = [
319
315
 
320
316
  N.B. if you wish to disable the `Try It Out` feature for your API, you can provide an empty list to
321
317
  the `supportedSubmitMethods` parameter.
318
+
319
+ ### Custom Resolvers for AsyncApi
320
+
321
+ You can override the default http/https resolvers, for example to add authentication to requests to internal schema registries by providing the `resolvers` prop to the `AsyncApiDefinitionWidget`. This is an example:
322
+
323
+ ```tsx
324
+ ...
325
+ import {
326
+ AsyncApiDefinitionWidget,
327
+ apiDocsConfigRef,
328
+ defaultDefinitionWidgets,
329
+ } from '@backstage/plugin-api-docs';
330
+ import { ApiEntity } from '@backstage/catalog-model';
331
+
332
+ export const apis: AnyApiFactory[] = [
333
+ ...
334
+ createApiFactory({
335
+ api: apiDocsConfigRef,
336
+ deps: {},
337
+ factory: () => {
338
+ const myCustomResolver = {
339
+ schema: 'https',
340
+ order: 1,
341
+ canRead: true,
342
+ async read(uri: any) {
343
+ const response = await fetch(request, {
344
+ headers: {
345
+ X-Custom: 'Custom',
346
+ },
347
+ });
348
+ return response.text();
349
+ },
350
+ };
351
+
352
+ const definitionWidgets = defaultDefinitionWidgets().map(obj => {
353
+ if (obj.type === 'asyncapi') {
354
+ return {
355
+ ...obj,
356
+ component: (definition) => (
357
+ <AsyncApiDefinitionWidget definition={definition} resolvers={[myCustomResolver]} />
358
+ ),
359
+ };
360
+ }
361
+ return obj;
362
+ });
363
+
364
+ return {
365
+ getApiDefinitionWidget: (apiEntity: ApiEntity) => {
366
+ return definitionWidgets.find(d => d.type === apiEntity.spec.type);
367
+ },
368
+ };
369
+ }
370
+ })
371
+ ]
372
+ ```
373
+
374
+ ## Links
375
+
376
+ - [The Backstage homepage](https://backstage.io)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs__alpha",
3
- "version": "0.11.8-next.3",
3
+ "version": "0.11.9-next.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.d.ts CHANGED
@@ -1,9 +1,207 @@
1
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
2
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
1
3
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
4
+ import React__default from 'react';
2
5
 
3
6
  declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
4
7
  root: _backstage_frontend_plugin_api.RouteRef<undefined>;
5
8
  }, {
6
9
  registerApi: _backstage_frontend_plugin_api.ExternalRouteRef<undefined>;
7
- }, {}>;
10
+ }, {
11
+ "nav-item:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{
12
+ kind: "nav-item";
13
+ namespace: undefined;
14
+ name: undefined;
15
+ config: {};
16
+ configInput: {};
17
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
18
+ title: string;
19
+ icon: _backstage_core_plugin_api.IconComponent;
20
+ routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
21
+ }, "core.nav-item.target", {}>;
22
+ inputs: {};
23
+ }>;
24
+ "api:api-docs/config": _backstage_frontend_plugin_api.ExtensionDefinition<{
25
+ kind: "api";
26
+ namespace: undefined;
27
+ name: "config";
28
+ config: {};
29
+ configInput: {};
30
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
31
+ inputs: {};
32
+ }>;
33
+ "page:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{
34
+ config: {
35
+ initiallySelectedFilter: "all" | "owned" | "starred" | undefined;
36
+ } & {
37
+ path: string | undefined;
38
+ };
39
+ configInput: {
40
+ initiallySelectedFilter?: "all" | "owned" | "starred" | undefined;
41
+ } & {
42
+ path?: string | undefined;
43
+ };
44
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
45
+ optional: true;
46
+ }>;
47
+ inputs: {
48
+ [x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
49
+ optional: boolean;
50
+ singleton: boolean;
51
+ }>;
52
+ };
53
+ kind: "page";
54
+ namespace: undefined;
55
+ name: undefined;
56
+ }>;
57
+ "entity-card:api-docs/has-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
58
+ kind: "entity-card";
59
+ namespace: undefined;
60
+ name: "has-apis";
61
+ config: {
62
+ filter: string | undefined;
63
+ };
64
+ configInput: {
65
+ filter?: string | undefined;
66
+ };
67
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
68
+ optional: true;
69
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
70
+ optional: true;
71
+ }>;
72
+ inputs: {};
73
+ }>;
74
+ "entity-card:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
75
+ kind: "entity-card";
76
+ namespace: undefined;
77
+ name: "definition";
78
+ config: {
79
+ filter: string | undefined;
80
+ };
81
+ configInput: {
82
+ filter?: string | undefined;
83
+ };
84
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
85
+ optional: true;
86
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
87
+ optional: true;
88
+ }>;
89
+ inputs: {};
90
+ }>;
91
+ "entity-card:api-docs/consumed-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
92
+ kind: "entity-card";
93
+ namespace: undefined;
94
+ name: "consumed-apis";
95
+ config: {
96
+ filter: string | undefined;
97
+ };
98
+ configInput: {
99
+ filter?: string | undefined;
100
+ };
101
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
102
+ optional: true;
103
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
104
+ optional: true;
105
+ }>;
106
+ inputs: {};
107
+ }>;
108
+ "entity-card:api-docs/provided-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
109
+ kind: "entity-card";
110
+ namespace: undefined;
111
+ name: "provided-apis";
112
+ config: {
113
+ filter: string | undefined;
114
+ };
115
+ configInput: {
116
+ filter?: string | undefined;
117
+ };
118
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
119
+ optional: true;
120
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
121
+ optional: true;
122
+ }>;
123
+ inputs: {};
124
+ }>;
125
+ "entity-card:api-docs/consuming-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
126
+ kind: "entity-card";
127
+ namespace: undefined;
128
+ name: "consuming-components";
129
+ config: {
130
+ filter: string | undefined;
131
+ };
132
+ configInput: {
133
+ filter?: string | undefined;
134
+ };
135
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
136
+ optional: true;
137
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
138
+ optional: true;
139
+ }>;
140
+ inputs: {};
141
+ }>;
142
+ "entity-card:api-docs/providing-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
143
+ kind: "entity-card";
144
+ namespace: undefined;
145
+ name: "providing-components";
146
+ config: {
147
+ filter: string | undefined;
148
+ };
149
+ configInput: {
150
+ filter?: string | undefined;
151
+ };
152
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
153
+ optional: true;
154
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
155
+ optional: true;
156
+ }>;
157
+ inputs: {};
158
+ }>;
159
+ "entity-content:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
160
+ kind: "entity-content";
161
+ namespace: undefined;
162
+ name: "definition";
163
+ config: {
164
+ path: string | undefined;
165
+ title: string | undefined;
166
+ filter: string | undefined;
167
+ };
168
+ configInput: {
169
+ filter?: string | undefined;
170
+ title?: string | undefined;
171
+ path?: string | undefined;
172
+ };
173
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
174
+ optional: true;
175
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
176
+ optional: true;
177
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
178
+ optional: true;
179
+ }>;
180
+ inputs: {};
181
+ }>;
182
+ "entity-content:api-docs/apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
183
+ kind: "entity-content";
184
+ namespace: undefined;
185
+ name: "apis";
186
+ config: {
187
+ path: string | undefined;
188
+ title: string | undefined;
189
+ filter: string | undefined;
190
+ };
191
+ configInput: {
192
+ filter?: string | undefined;
193
+ title?: string | undefined;
194
+ path?: string | undefined;
195
+ };
196
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
197
+ optional: true;
198
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
199
+ optional: true;
200
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
201
+ optional: true;
202
+ }>;
203
+ inputs: {};
204
+ }>;
205
+ }>;
8
206
 
9
207
  export { _default as default };
package/dist/alpha.esm.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
- import { createNavItemExtension, createApiExtension, createApiFactory, createPageExtension, createSchemaFromZod, createPlugin } from '@backstage/frontend-plugin-api';
3
+ import { NavItemBlueprint, ApiBlueprint, createApiFactory, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
4
4
  import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
5
- import { createEntityCardExtension, createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
6
5
  import { RELATION_HAS_PART, parseEntityRef } from '@backstage/catalog-model';
7
6
  import '@backstage/plugin-catalog-react';
8
7
  import '@material-ui/lab/Alert';
@@ -12,132 +11,156 @@ import '@backstage/core-plugin-api';
12
11
  import { defaultDefinitionWidgets } from './components/ApiDefinitionCard/ApiDefinitionWidget.esm.js';
13
12
  import '@material-ui/core/Typography';
14
13
  import { rootRoute, registerComponentRouteRef } from './routes.esm.js';
14
+ import { EntityCardBlueprint, EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
15
15
 
16
- const apiDocsNavItem = createNavItemExtension({
17
- title: "APIs",
18
- routeRef: convertLegacyRouteRef(rootRoute),
19
- icon: () => compatWrapper(/* @__PURE__ */ React.createElement(AppIcon, { id: "kind:api" }))
16
+ const apiDocsNavItem = NavItemBlueprint.make({
17
+ params: {
18
+ title: "APIs",
19
+ routeRef: convertLegacyRouteRef(rootRoute),
20
+ icon: () => compatWrapper(/* @__PURE__ */ React.createElement(AppIcon, { id: "kind:api" }))
21
+ }
20
22
  });
21
- const apiDocsConfigApi = createApiExtension({
22
- factory: createApiFactory({
23
- api: apiDocsConfigRef,
24
- deps: {},
25
- factory: () => {
26
- const definitionWidgets = defaultDefinitionWidgets();
27
- return {
28
- getApiDefinitionWidget: (apiEntity) => {
29
- return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
30
- }
31
- };
32
- }
33
- })
23
+ const apiDocsConfigApi = ApiBlueprint.make({
24
+ name: "config",
25
+ params: {
26
+ factory: createApiFactory({
27
+ api: apiDocsConfigRef,
28
+ deps: {},
29
+ factory: () => {
30
+ const definitionWidgets = defaultDefinitionWidgets();
31
+ return {
32
+ getApiDefinitionWidget: (apiEntity) => {
33
+ return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
34
+ }
35
+ };
36
+ }
37
+ })
38
+ }
34
39
  });
35
- const apiDocsExplorerPage = createPageExtension({
36
- defaultPath: "/api-docs",
37
- routeRef: convertLegacyRouteRef(rootRoute),
38
- // Mapping DefaultApiExplorerPageProps to config
39
- configSchema: createSchemaFromZod(
40
- (z) => z.object({
41
- path: z.string().default("/api-docs"),
42
- initiallySelectedFilter: z.enum(["owned", "starred", "all"]).optional()
40
+ const apiDocsExplorerPage = PageBlueprint.makeWithOverrides({
41
+ config: {
42
+ schema: {
43
43
  // Ommiting columns and actions for now as their types are too complex to map to zod
44
- })
45
- ),
46
- loader: ({ config }) => import('./components/ApiExplorerPage/index.esm.js').then(
47
- (m) => compatWrapper(
48
- /* @__PURE__ */ React.createElement(
49
- m.ApiExplorerIndexPage,
50
- {
51
- initiallySelectedFilter: config.initiallySelectedFilter
52
- }
44
+ initiallySelectedFilter: (z) => z.enum(["owned", "starred", "all"]).optional()
45
+ }
46
+ },
47
+ factory(originalFactory, { config }) {
48
+ return originalFactory({
49
+ defaultPath: "/api-docs",
50
+ routeRef: convertLegacyRouteRef(rootRoute),
51
+ loader: () => import('./components/ApiExplorerPage/index.esm.js').then(
52
+ (m) => compatWrapper(
53
+ /* @__PURE__ */ React.createElement(
54
+ m.ApiExplorerIndexPage,
55
+ {
56
+ initiallySelectedFilter: config.initiallySelectedFilter
57
+ }
58
+ )
59
+ )
53
60
  )
54
- )
55
- )
61
+ });
62
+ }
56
63
  });
57
- const apiDocsHasApisEntityCard = createEntityCardExtension({
64
+ const apiDocsHasApisEntityCard = EntityCardBlueprint.make({
58
65
  name: "has-apis",
59
- // Ommiting configSchema for now
60
- // We are skipping variants and columns are too complex to map to zod
61
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
62
- filter: (entity) => {
63
- return entity.kind === "Component" && entity.relations?.some(
64
- ({ type, targetRef }) => type.toLocaleLowerCase("en-US") === RELATION_HAS_PART && parseEntityRef(targetRef).kind === "API"
65
- );
66
- },
67
- loader: () => import('./components/ApisCards/index.esm.js').then(
68
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.HasApisCard, null))
69
- )
66
+ params: {
67
+ // Ommiting configSchema for now
68
+ // We are skipping variants and columns are too complex to map to zod
69
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
70
+ filter: (entity) => {
71
+ return entity.kind === "Component" && entity.relations?.some(
72
+ ({ type, targetRef }) => type.toLocaleLowerCase("en-US") === RELATION_HAS_PART && parseEntityRef(targetRef).kind === "API"
73
+ );
74
+ },
75
+ loader: () => import('./components/ApisCards/index.esm.js').then(
76
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.HasApisCard, null))
77
+ )
78
+ }
70
79
  });
71
- const apiDocsDefinitionEntityCard = createEntityCardExtension({
80
+ const apiDocsDefinitionEntityCard = EntityCardBlueprint.make({
72
81
  name: "definition",
73
- filter: "kind:api",
74
- loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
75
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null))
76
- )
82
+ params: {
83
+ filter: "kind:api",
84
+ loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
85
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null))
86
+ )
87
+ }
77
88
  });
78
- const apiDocsConsumedApisEntityCard = createEntityCardExtension({
89
+ const apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({
79
90
  name: "consumed-apis",
80
- // Ommiting configSchema for now
81
- // We are skipping variants and columns are too complex to map to zod
82
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
83
- filter: "kind:component",
84
- loader: () => import('./components/ApisCards/index.esm.js').then(
85
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumedApisCard, null))
86
- )
91
+ params: {
92
+ // Ommiting configSchema for now
93
+ // We are skipping variants and columns are too complex to map to zod
94
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
95
+ filter: "kind:component",
96
+ loader: () => import('./components/ApisCards/index.esm.js').then(
97
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumedApisCard, null))
98
+ )
99
+ }
87
100
  });
88
- const apiDocsProvidedApisEntityCard = createEntityCardExtension({
101
+ const apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({
89
102
  name: "provided-apis",
90
- // Ommiting configSchema for now
91
- // We are skipping variants and columns are too complex to map to zod
92
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
93
- filter: "kind:component",
94
- loader: () => import('./components/ApisCards/index.esm.js').then(
95
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidedApisCard, null))
96
- )
103
+ params: {
104
+ // Ommiting configSchema for now
105
+ // We are skipping variants and columns are too complex to map to zod
106
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
107
+ filter: "kind:component",
108
+ loader: () => import('./components/ApisCards/index.esm.js').then(
109
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidedApisCard, null))
110
+ )
111
+ }
97
112
  });
98
- const apiDocsConsumingComponentsEntityCard = createEntityCardExtension({
113
+ const apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({
99
114
  name: "consuming-components",
100
- // Ommiting configSchema for now
101
- // We are skipping variants
102
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
103
- filter: "kind:api",
104
- loader: () => import('./components/ComponentsCards/index.esm.js').then(
105
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumingComponentsCard, null))
106
- )
115
+ params: {
116
+ // Ommiting configSchema for now
117
+ // We are skipping variants
118
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
119
+ filter: "kind:api",
120
+ loader: () => import('./components/ComponentsCards/index.esm.js').then(
121
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumingComponentsCard, null))
122
+ )
123
+ }
107
124
  });
108
- const apiDocsProvidingComponentsEntityCard = createEntityCardExtension({
125
+ const apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({
109
126
  name: "providing-components",
110
- // Ommiting configSchema for now
111
- // We are skipping variants
112
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
113
- filter: "kind:api",
114
- loader: () => import('./components/ComponentsCards/index.esm.js').then(
115
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidingComponentsCard, null))
116
- )
127
+ params: {
128
+ // Ommiting configSchema for now
129
+ // We are skipping variants
130
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
131
+ filter: "kind:api",
132
+ loader: () => import('./components/ComponentsCards/index.esm.js').then(
133
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidingComponentsCard, null))
134
+ )
135
+ }
117
136
  });
118
- const apiDocsDefinitionEntityContent = createEntityContentExtension({
137
+ const apiDocsDefinitionEntityContent = EntityContentBlueprint.make({
119
138
  name: "definition",
120
- defaultPath: "/defintion",
121
- defaultTitle: "Definition",
122
- filter: "kind:api",
123
- loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
124
- (m) => compatWrapper(
125
- /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null)))
139
+ params: {
140
+ defaultPath: "/defintion",
141
+ defaultTitle: "Definition",
142
+ filter: "kind:api",
143
+ loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
144
+ (m) => compatWrapper(
145
+ /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null)))
146
+ )
126
147
  )
127
- )
148
+ }
128
149
  });
129
- const apiDocsApisEntityContent = createEntityContentExtension({
150
+ const apiDocsApisEntityContent = EntityContentBlueprint.make({
130
151
  name: "apis",
131
- defaultPath: "/apis",
132
- defaultTitle: "APIs",
133
- filter: "kind:component",
134
- loader: async () => import('./components/ApisCards/index.esm.js').then(
135
- (m) => compatWrapper(
136
- /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ProvidedApisCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ConsumedApisCard, null)))
152
+ params: {
153
+ defaultPath: "/apis",
154
+ defaultTitle: "APIs",
155
+ filter: "kind:component",
156
+ loader: async () => import('./components/ApisCards/index.esm.js').then(
157
+ (m) => compatWrapper(
158
+ /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ProvidedApisCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ConsumedApisCard, null)))
159
+ )
137
160
  )
138
- )
161
+ }
139
162
  });
140
- var alpha = createPlugin({
163
+ var alpha = createFrontendPlugin({
141
164
  id: "api-docs",
142
165
  routes: {
143
166
  root: convertLegacyRouteRef(rootRoute)
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 from 'react';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n createApiExtension,\n createApiFactory,\n createNavItemExtension,\n createPageExtension,\n createPlugin,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n createEntityCardExtension,\n createEntityContentExtension,\n} from '@backstage/plugin-catalog-react/alpha';\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nconst apiDocsNavItem = createNavItemExtension({\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n});\n\nconst apiDocsConfigApi = createApiExtension({\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n});\n\nconst apiDocsExplorerPage = createPageExtension({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n // Mapping DefaultApiExplorerPageProps to config\n configSchema: createSchemaFromZod(z =>\n z.object({\n path: z.string().default('/api-docs'),\n initiallySelectedFilter: z.enum(['owned', 'starred', 'all']).optional(),\n // Ommiting columns and actions for now as their types are too complex to map to zod\n }),\n ),\n loader: ({ config }) =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n});\n\nconst apiDocsHasApisEntityCard = createEntityCardExtension({\n name: 'has-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n});\n\nconst apiDocsDefinitionEntityCard = createEntityCardExtension({\n name: 'definition',\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n});\n\nconst apiDocsConsumedApisEntityCard = createEntityCardExtension({\n name: 'consumed-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n});\n\nconst apiDocsProvidedApisEntityCard = createEntityCardExtension({\n name: 'provided-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n});\n\nconst apiDocsConsumingComponentsEntityCard = createEntityCardExtension({\n name: 'consuming-components',\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n});\n\nconst apiDocsProvidingComponentsEntityCard = createEntityCardExtension({\n name: 'providing-components',\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n});\n\nconst apiDocsDefinitionEntityContent = createEntityContentExtension({\n name: 'definition',\n defaultPath: '/defintion',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n});\n\nconst apiDocsApisEntityContent = createEntityContentExtension({\n name: 'apis',\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n});\n\nexport default createPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgDA,MAAM,iBAAiB,sBAAuB,CAAA;AAAA,EAC5C,KAAO,EAAA,MAAA;AAAA,EACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,EACzC,MAAM,MAAM,aAAA,qCAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE,CAAA;AACrD,CAAC,CAAA,CAA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IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA,wBAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 from 'react';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n },\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/defintion',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgDA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qCAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE,CAAA;AAAA,GACrD;AACF,CAAC,CAAA,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,gBAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AACb,QAAA,MAAM,oBAAoB,wBAAyB,EAAA,CAAA;AACnD,QAAO,OAAA;AAAA,UACL,sBAAA,EAAwB,CAAC,SAAyB,KAAA;AAChD,YAAA,OAAO,kBAAkB,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,SAAA,CAAU,KAAK,IAAI,CAAA,CAAA;AAAA,WACnE;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF,CAAC,CAAA,CAAA;AAED,MAAM,mBAAA,GAAsB,cAAc,iBAAkB,CAAA;AAAA,EAC1D,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAAA,MAEN,uBAAA,EAAyB,CACvB,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,CAAC,SAAS,SAAW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ACd,MAAQ,EAAA,gBAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,qCAAwB,CAAE,CAAA,IAAA;AAAA,MAAK,CACpC,CAAA,KAAA,aAAA;AAAA,wBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAG,UAAW,EAAA,SAAA,EAAA,kBACpC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,gBAAA,EAAF,IAAmB,CACtB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,IAAmB,CACtB,CACF,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACJ;AACF,CAAC,CAAA,CAAA;AAED,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,sBAAsB,SAAS,CAAA;AAAA,GACvC;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,WAAA,EAAa,sBAAsB,yBAAyB,CAAA;AAAA,GAC9D;AAAA,EACA,UAAY,EAAA;AAAA,IACV,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,wBAAA;AAAA,IACA,2BAAA;AAAA,IACA,6BAAA;AAAA,IACA,6BAAA;AAAA,IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA,wBAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
@@ -143,19 +143,25 @@ const httpFetchResolver = {
143
143
  return response.text();
144
144
  }
145
145
  };
146
- const config = {
147
- parserOptions: {
148
- __unstable: {
149
- resolver: {
150
- resolvers: [httpsFetchResolver, httpFetchResolver]
151
- }
152
- }
153
- }
154
- };
155
- const AsyncApiDefinition = ({ definition }) => {
146
+ const AsyncApiDefinition = ({
147
+ definition,
148
+ resolvers
149
+ }) => {
156
150
  const classes = useStyles();
157
151
  const theme = useTheme();
158
152
  const classNames = `${classes.root} ${theme.palette.type === "dark" ? classes.dark : ""}`;
153
+ const config = {
154
+ parserOptions: {
155
+ __unstable: {
156
+ resolver: {
157
+ resolvers: [httpsFetchResolver, httpFetchResolver]
158
+ }
159
+ }
160
+ }
161
+ };
162
+ if (resolvers) {
163
+ config.parserOptions.__unstable.resolver.resolvers = resolvers;
164
+ }
159
165
  return /* @__PURE__ */ React.createElement("div", { className: classNames }, /* @__PURE__ */ React.createElement(AsyncApi, { schema: definition, config }));
160
166
  };
161
167
 
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.tsx"],"sourcesContent":["/*\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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useTheme } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n};\n\ntype Props = {\n definition: string;\n};\n\nexport const AsyncApiDefinition = ({ definition }: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,SAAA;AAAA,IACZ,aAAe,EAAA;AAAA,MACb,UAAY,EAAA,MAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA;AAAA,MACb,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,WAAa,EAAA,KAAA,CAAM,KAAM,CAAA,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAAA,KAC9C;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA,aAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,OAAS,EAAA,MAAA;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efinition.tsx"],"sourcesContent":["/*\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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver: AsyncApiResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver: AsyncApiResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,SAAA;AAAA,IACZ,aAAe,EAAA;AAAA,MACb,UAAY,EAAA,MAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA;AAAA,MACb,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,WAAa,EAAA,KAAA,CAAM,KAAM,CAAA,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAAA,KAC9C;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA,aAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AAAA,KACxC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,IAAA;AAAA,KACtC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,KAAA;AAAA,KACtC;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,e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AAA,CAAI,UAAU,CAAA,CAAA;AAC3C,IAAA,OAAO,SAAS,IAAK,EAAA,CAAA;AAAA,GACvB;AACF,CAAA,CAAA;AAOO,MAAM,qBAAqB,CAAC;AAAA,EACjC,UAAA;AAAA,EACA,SAAA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAM,MAAA,UAAA,GAAa,CAAG,EAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAChC,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,GAAS,OAAQ,CAAA,IAAA,GAAO,EACjD,CAAA,CAAA,CAAA;AAEA,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,aAAe,EAAA;AAAA,MACb,UAAY,EAAA;AAAA,QACV,QAAU,EAAA;AAAA,UACR,SAAA,EAAW,CAAC,kBAAA,EAAoB,iBAAiB,CAAA;AAAA,SACnD;AAAA,OACF;AAAA,KACF;AAAA,GACF,CAAA;AAGA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,MAAA,CAAA,aAAA,CAAc,UAAW,CAAA,QAAA,CAAS,SAAY,GAAA,SAAA,CAAA;AAAA,GACvD;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,UAAA,EAAA,sCACb,QAAS,EAAA,EAAA,MAAA,EAAQ,UAAY,EAAA,MAAA,EAAgB,CAChD,CAAA,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx"],"sourcesContent":["/*\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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = React.lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;AAqBA,MAAM,yBAAyB,KAAM,CAAA,IAAA;AAAA,EAAK,MACxC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACxC,SAAS,CAAE,CAAA,kBAAA;AAAA,GACX,CAAA,CAAA;AACJ,CAAA,CAAA;AAQa,MAAA,wBAAA,GAA2B,CACtC,KACG,KAAA;AACH,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,qBAC3B,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CACrC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx"],"sourcesContent":["/*\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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\nimport { AsyncApiResolver } from './AsyncApiDefinition';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = React.lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;AAsBA,MAAM,yBAAyB,KAAM,CAAA,IAAA;AAAA,EAAK,MACxC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACxC,SAAS,CAAE,CAAA,kBAAA;AAAA,GACX,CAAA,CAAA;AACJ,CAAA,CAAA;AASa,MAAA,wBAAA,GAA2B,CACtC,KACG,KAAA;AACH,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,qBAC3B,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CACrC,CAAA,CAAA;AAEJ;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { RELATION_API_CONSUMED_BY } from '@backstage/catalog-model';
2
2
  import Typography from '@material-ui/core/Typography';
3
- import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
3
+ import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
4
4
  import React from 'react';
5
5
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
6
6
 
7
7
  const ConsumingComponentsCard = (props) => {
8
- const { variant = "gridItem" } = props;
8
+ const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
9
9
  const { entity } = useEntity();
10
10
  const { entities, loading, error } = useRelatedEntities(entity, {
11
11
  type: RELATION_API_CONSUMED_BY
@@ -29,7 +29,7 @@ const ConsumingComponentsCard = (props) => {
29
29
  title: "Consumers",
30
30
  variant,
31
31
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
32
- columns: EntityTable.componentEntityColumns,
32
+ columns,
33
33
  entities
34
34
  }
35
35
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\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 {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem' } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuCa,MAAA,uBAAA,GAA0B,CAAC,KAElC,KAAA;AACJ,EAAM,MAAA,EAAE,OAAU,GAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AACjC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,wBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,OAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAkB,EAAA,KAAA,EAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,2BAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,OAAA;AAAA,MACA,YAAA,kBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,WAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,SAAS,WAAY,CAAA,sBAAA;AAAA,MACrB,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\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 {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA,CAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI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AA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
2
2
  import Typography from '@material-ui/core/Typography';
3
- import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
3
+ import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
4
4
  import React from 'react';
5
5
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
6
6
 
7
7
  const ProvidingComponentsCard = (props) => {
8
- const { variant = "gridItem" } = props;
8
+ const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
9
9
  const { entity } = useEntity();
10
10
  const { entities, loading, error } = useRelatedEntities(entity, {
11
11
  type: RELATION_API_PROVIDED_BY
@@ -29,7 +29,7 @@ const ProvidingComponentsCard = (props) => {
29
29
  title: "Providers",
30
30
  variant,
31
31
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
32
- columns: EntityTable.componentEntityColumns,
32
+ columns,
33
33
  entities
34
34
  }
35
35
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\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 {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem' } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAqCa,MAAA,uBAAA,GAA0B,CAAC,KAElC,KAAA;AACJ,EAAM,MAAA,EAAE,OAAU,GAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AACjC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA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,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\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 {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how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,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@ import * as _backstage_core_components from '@backstage/core-components';
5
5
  import { TableColumn, TableProps, InfoCardVariants, TableOptions } from '@backstage/core-components';
6
6
  import { CatalogTableRow } from '@backstage/plugin-catalog';
7
7
  import { UserListFilterKind, EntityOwnerPickerProps } from '@backstage/plugin-catalog-react';
8
- import { ApiEntity } from '@backstage/catalog-model';
8
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
9
+ import { ApiEntity, ComponentEntity } from '@backstage/catalog-model';
9
10
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
10
11
 
11
12
  /**
@@ -91,9 +92,18 @@ declare const ProvidedApisCard: (props: {
91
92
  tableOptions?: TableOptions;
92
93
  }) => React__default.JSX.Element;
93
94
 
95
+ /** @public */
96
+ type AsyncApiResolver = {
97
+ schema: string;
98
+ order: number;
99
+ canRead: boolean;
100
+ read(uri: any): Promise<string>;
101
+ };
102
+
94
103
  /** @public */
95
104
  type AsyncApiDefinitionWidgetProps = {
96
105
  definition: string;
106
+ resolvers?: AsyncApiResolver[];
97
107
  };
98
108
  /** @public */
99
109
  declare const AsyncApiDefinitionWidget: (props: AsyncApiDefinitionWidgetProps) => React__default.JSX.Element;
@@ -103,11 +113,13 @@ declare const AsyncApiDefinitionWidget: (props: AsyncApiDefinitionWidgetProps) =
103
113
  */
104
114
  declare const ConsumingComponentsCard: (props: {
105
115
  variant?: InfoCardVariants;
116
+ columns?: TableColumn<ComponentEntity>[];
106
117
  }) => React__default.JSX.Element;
107
118
 
108
119
  /** @public */
109
120
  declare const ProvidingComponentsCard: (props: {
110
121
  variant?: InfoCardVariants;
122
+ columns?: TableColumn<ComponentEntity>[];
111
123
  }) => React__default.JSX.Element;
112
124
 
113
125
  /** @public */
@@ -168,6 +180,7 @@ declare const EntityConsumedApisCard: (props: {
168
180
  /** @public */
169
181
  declare const EntityConsumingComponentsCard: (props: {
170
182
  variant?: _backstage_core_components.InfoCardVariants | undefined;
183
+ columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
171
184
  }) => React.JSX.Element;
172
185
  /** @public */
173
186
  declare const EntityProvidedApisCard: (props: {
@@ -179,6 +192,7 @@ declare const EntityProvidedApisCard: (props: {
179
192
  /** @public */
180
193
  declare const EntityProvidingComponentsCard: (props: {
181
194
  variant?: _backstage_core_components.InfoCardVariants | undefined;
195
+ columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
182
196
  }) => React.JSX.Element;
183
197
  /** @public */
184
198
  declare const EntityHasApisCard: (props: {
@@ -188,4 +202,4 @@ declare const EntityHasApisCard: (props: {
188
202
  tableOptions?: _backstage_core_components.TableOptions<{}> | undefined;
189
203
  }) => React.JSX.Element;
190
204
 
191
- export { ApiDefinitionCard, ApiDefinitionDialog, type ApiDefinitionWidget, type ApiDocsConfig, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, type AsyncApiDefinitionWidgetProps, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, type DefaultApiExplorerPageProps, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, GraphQlDefinitionWidget, type GraphQlDefinitionWidgetProps, HasApisCard, OpenApiDefinitionWidget, type OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, type PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, TrpcApiDefinitionWidget, type TrpcApiDefinitionWidgetProps, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
205
+ export { ApiDefinitionCard, ApiDefinitionDialog, type ApiDefinitionWidget, type ApiDocsConfig, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, type AsyncApiDefinitionWidgetProps, type AsyncApiResolver, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, type DefaultApiExplorerPageProps, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, GraphQlDefinitionWidget, type GraphQlDefinitionWidgetProps, HasApisCard, OpenApiDefinitionWidget, type OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, type PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, TrpcApiDefinitionWidget, type TrpcApiDefinitionWidgetProps, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs",
3
- "version": "0.11.8-next.3",
3
+ "version": "0.11.9-next.0",
4
4
  "description": "A Backstage plugin that helps represent API entities in the frontend",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -53,15 +53,15 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@asyncapi/react-component": "1.3.1",
56
- "@backstage/catalog-model": "^1.6.0-next.0",
57
- "@backstage/core-compat-api": "^0.2.8-next.3",
58
- "@backstage/core-components": "^0.14.10-next.0",
56
+ "@backstage/catalog-model": "^1.6.0",
57
+ "@backstage/core-compat-api": "^0.2.9-next.0",
58
+ "@backstage/core-components": "^0.14.10",
59
59
  "@backstage/core-plugin-api": "^1.9.3",
60
- "@backstage/frontend-plugin-api": "^0.7.0-next.3",
61
- "@backstage/plugin-catalog": "^1.22.0-next.3",
62
- "@backstage/plugin-catalog-common": "^1.0.26-next.2",
63
- "@backstage/plugin-catalog-react": "^1.12.3-next.3",
64
- "@backstage/plugin-permission-react": "^0.4.25-next.1",
60
+ "@backstage/frontend-plugin-api": "^0.8.0-next.0",
61
+ "@backstage/plugin-catalog": "^1.22.1-next.0",
62
+ "@backstage/plugin-catalog-common": "^1.0.26",
63
+ "@backstage/plugin-catalog-react": "^1.12.4-next.0",
64
+ "@backstage/plugin-permission-react": "^0.4.25",
65
65
  "@graphiql/react": "^0.23.0",
66
66
  "@material-ui/core": "^4.12.2",
67
67
  "@material-ui/icons": "^4.9.1",
@@ -75,10 +75,10 @@
75
75
  "swagger-ui-react": "^5.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@backstage/cli": "^0.27.0-next.4",
79
- "@backstage/core-app-api": "^1.14.2-next.0",
80
- "@backstage/dev-utils": "^1.0.37-next.3",
81
- "@backstage/test-utils": "^1.5.10-next.2",
78
+ "@backstage/cli": "^0.27.1-next.0",
79
+ "@backstage/core-app-api": "^1.14.2",
80
+ "@backstage/dev-utils": "^1.0.38-next.0",
81
+ "@backstage/test-utils": "^1.6.0-next.0",
82
82
  "@testing-library/dom": "^10.0.0",
83
83
  "@testing-library/jest-dom": "^6.0.0",
84
84
  "@testing-library/react": "^15.0.0",