@backstage/plugin-api-docs 0.6.20 → 0.6.21

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,16 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
+ ## 0.6.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 11b81683a9: Support customizing index page layouts via outlets
8
+ - Updated dependencies
9
+ - @backstage/core-plugin-api@0.4.1
10
+ - @backstage/plugin-catalog-react@0.6.10
11
+ - @backstage/core-components@0.8.3
12
+ - @backstage/plugin-catalog@0.7.7
13
+
3
14
  ## 0.6.20
4
15
 
5
16
  ### Patch Changes
@@ -1,9 +1,11 @@
1
- export { A as ApiDefinitionCard, a as ApiTypeTitle, d as defaultDefinitionWidgets } from './index-83f082c6.esm.js';
2
- import '@backstage/plugin-catalog-react';
3
- import '@material-ui/lab';
1
+ export { ApiExplorerIndexPage, DefaultApiExplorerPage } from '../index.esm.js';
4
2
  import 'react';
5
- import '@backstage/core-plugin-api';
3
+ import 'react-router';
6
4
  import '@backstage/core-components';
5
+ import '@backstage/core-plugin-api';
6
+ import '@backstage/plugin-catalog';
7
+ import '@backstage/plugin-catalog-react';
8
+ import '@material-ui/lab';
7
9
  import '@backstage/catalog-model';
8
10
  import '@material-ui/core';
9
- //# sourceMappingURL=index-00af9be1.esm.js.map
11
+ //# sourceMappingURL=index-02cb4cdc.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-02cb4cdc.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1,9 +1,11 @@
1
- export { C as ConsumedApisCard, H as HasApisCard, P as ProvidedApisCard } from './index-83f082c6.esm.js';
2
- import '@backstage/plugin-catalog-react';
3
- import '@material-ui/lab';
1
+ export { ConsumingComponentsCard, ProvidingComponentsCard } from '../index.esm.js';
4
2
  import 'react';
5
- import '@backstage/core-plugin-api';
3
+ import 'react-router';
6
4
  import '@backstage/core-components';
5
+ import '@backstage/core-plugin-api';
6
+ import '@backstage/plugin-catalog';
7
+ import '@backstage/plugin-catalog-react';
8
+ import '@material-ui/lab';
7
9
  import '@backstage/catalog-model';
8
10
  import '@material-ui/core';
9
- //# sourceMappingURL=index-a8bf5768.esm.js.map
11
+ //# sourceMappingURL=index-30e4d7f8.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-30e4d7f8.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1,9 +1,11 @@
1
- export { b as ConsumingComponentsCard, e as ProvidingComponentsCard } from './index-83f082c6.esm.js';
2
- import '@backstage/plugin-catalog-react';
3
- import '@material-ui/lab';
1
+ export { ConsumedApisCard, HasApisCard, ProvidedApisCard } from '../index.esm.js';
4
2
  import 'react';
5
- import '@backstage/core-plugin-api';
3
+ import 'react-router';
6
4
  import '@backstage/core-components';
5
+ import '@backstage/core-plugin-api';
6
+ import '@backstage/plugin-catalog';
7
+ import '@backstage/plugin-catalog-react';
8
+ import '@material-ui/lab';
7
9
  import '@backstage/catalog-model';
8
10
  import '@material-ui/core';
9
- //# sourceMappingURL=index-674cfd0b.esm.js.map
11
+ //# sourceMappingURL=index-32c80387.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-32c80387.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ export { ApiDefinitionCard, ApiTypeTitle, defaultDefinitionWidgets } from '../index.esm.js';
2
+ import 'react';
3
+ import 'react-router';
4
+ import '@backstage/core-components';
5
+ import '@backstage/core-plugin-api';
6
+ import '@backstage/plugin-catalog';
7
+ import '@backstage/plugin-catalog-react';
8
+ import '@material-ui/lab';
9
+ import '@backstage/catalog-model';
10
+ import '@material-ui/core';
11
+ //# sourceMappingURL=index-89d097b6.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-89d097b6.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,32 @@
1
1
  /// <reference types="react" />
2
+ import { TableColumn, TableProps } from '@backstage/core-components';
3
+ import { CatalogTableRow } from '@backstage/plugin-catalog';
4
+ import { UserListFilterKind } from '@backstage/plugin-catalog-react';
2
5
  import * as _backstage_catalog_model from '@backstage/catalog-model';
3
6
  import { ApiEntity, Entity } from '@backstage/catalog-model';
4
7
  import React from 'react';
5
8
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
6
- import * as _material_table_core from '@material-table/core';
7
- import * as _backstage_core_components from '@backstage/core-components';
8
- import * as _backstage_plugin_catalog from '@backstage/plugin-catalog';
9
- import * as _backstage_plugin_catalog_react from '@backstage/plugin-catalog-react';
9
+
10
+ /**
11
+ * DefaultApiExplorerPageProps
12
+ * @public
13
+ */
14
+ declare type DefaultApiExplorerPageProps = {
15
+ initiallySelectedFilter?: UserListFilterKind;
16
+ columns?: TableColumn<CatalogTableRow>[];
17
+ actions?: TableProps<CatalogTableRow>['actions'];
18
+ };
19
+ /**
20
+ * DefaultApiExplorerPage
21
+ * @public
22
+ */
23
+ declare const DefaultApiExplorerPage: ({ initiallySelectedFilter, columns, actions, }: DefaultApiExplorerPageProps) => JSX.Element;
24
+
25
+ /**
26
+ * ApiExplorerPage
27
+ * @public
28
+ */
29
+ declare const ApiExplorerPage$1: (props: DefaultApiExplorerPageProps) => JSX.Element;
10
30
 
11
31
  declare type Props$5 = {
12
32
  /** @deprecated The entity is now grabbed from context instead */
@@ -85,14 +105,7 @@ declare const apiDocsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
85
105
  }, {
86
106
  createComponent: _backstage_core_plugin_api.ExternalRouteRef<undefined, true>;
87
107
  }>;
88
- declare const ApiExplorerPage: ({ initiallySelectedFilter, columns, actions, }: {
89
- initiallySelectedFilter?: _backstage_plugin_catalog_react.UserListFilterKind | undefined;
90
- columns?: _backstage_core_components.TableColumn<_backstage_plugin_catalog.CatalogTableRow>[] | undefined;
91
- actions?: (_material_table_core.Action<_backstage_plugin_catalog.CatalogTableRow> | {
92
- action: (rowData: _backstage_plugin_catalog.CatalogTableRow) => _material_table_core.Action<_backstage_plugin_catalog.CatalogTableRow>;
93
- position: string;
94
- } | ((rowData: _backstage_plugin_catalog.CatalogTableRow) => _material_table_core.Action<_backstage_plugin_catalog.CatalogTableRow>))[] | undefined;
95
- }) => JSX.Element;
108
+ declare const ApiExplorerPage: (props: DefaultApiExplorerPageProps) => JSX.Element;
96
109
  declare const EntityApiDefinitionCard: (_: {
97
110
  apiEntity?: ApiEntity | undefined;
98
111
  }) => JSX.Element;
@@ -116,4 +129,4 @@ declare const EntityHasApisCard: ({ variant }: {
116
129
  variant?: "gridItem" | undefined;
117
130
  }) => JSX.Element;
118
131
 
119
- export { ApiDefinitionCard, ApiDefinitionWidget, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, AsyncApiDefinitionWidgetProps, ConsumedApisCard, ConsumingComponentsCard, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, HasApisCard, OpenApiDefinitionWidget, OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
132
+ export { ApiDefinitionCard, ApiDefinitionWidget, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, AsyncApiDefinitionWidgetProps, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, DefaultApiExplorerPageProps, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, HasApisCard, OpenApiDefinitionWidget, OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
package/dist/index.esm.js CHANGED
@@ -1,9 +1,483 @@
1
- export { A as ApiDefinitionCard, h as ApiExplorerPage, a as ApiTypeTitle, n as AsyncApiDefinitionWidget, C as ConsumedApisCard, b as ConsumingComponentsCard, E as EntityApiDefinitionCard, i as EntityConsumedApisCard, j as EntityConsumingComponentsCard, k as EntityHasApisCard, l as EntityProvidedApisCard, m as EntityProvidingComponentsCard, H as HasApisCard, O as OpenApiDefinitionWidget, o as PlainApiDefinitionWidget, P as ProvidedApisCard, e as ProvidingComponentsCard, f as apiDocsConfigRef, g as apiDocsPlugin, d as defaultDefinitionWidgets, g as plugin } from './esm/index-83f082c6.esm.js';
2
- import '@backstage/plugin-catalog-react';
3
- import '@material-ui/lab';
4
- import 'react';
5
- import '@backstage/core-plugin-api';
6
- import '@backstage/core-components';
7
- import '@backstage/catalog-model';
8
- import '@material-ui/core';
1
+ import React, { Suspense } from 'react';
2
+ import { useOutlet } from 'react-router';
3
+ import { PageWithHeader, Content, ContentHeader, CreateButton, SupportButton, CodeSnippet, TabbedCard, CardTab, Progress, InfoCard, WarningPanel, Link } from '@backstage/core-components';
4
+ import { createRouteRef, createExternalRouteRef, useApi, configApiRef, useRouteRef, createApiRef, createPlugin, createApiFactory, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
5
+ import { CatalogTable, FilteredEntityLayout, FilterContainer, EntityListContainer } from '@backstage/plugin-catalog';
6
+ import { EntityListProvider, EntityKindPicker, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker, useEntity, EntityTable, useRelatedEntities } from '@backstage/plugin-catalog-react';
7
+ import { Alert } from '@material-ui/lab';
8
+ import { RELATION_CONSUMES_API, RELATION_HAS_PART, RELATION_PROVIDES_API, RELATION_API_CONSUMED_BY, RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
9
+ import { Typography } from '@material-ui/core';
10
+
11
+ const rootRoute = createRouteRef({
12
+ id: "api-docs"
13
+ });
14
+ const createComponentRouteRef = createExternalRouteRef({
15
+ id: "create-component",
16
+ optional: true
17
+ });
18
+
19
+ const defaultColumns = [
20
+ CatalogTable.columns.createNameColumn({ defaultKind: "API" }),
21
+ CatalogTable.columns.createSystemColumn(),
22
+ CatalogTable.columns.createOwnerColumn(),
23
+ CatalogTable.columns.createSpecTypeColumn(),
24
+ CatalogTable.columns.createSpecLifecycleColumn(),
25
+ CatalogTable.columns.createMetadataDescriptionColumn(),
26
+ CatalogTable.columns.createTagsColumn()
27
+ ];
28
+ const DefaultApiExplorerPage = ({
29
+ initiallySelectedFilter = "all",
30
+ columns,
31
+ actions
32
+ }) => {
33
+ var _a;
34
+ const configApi = useApi(configApiRef);
35
+ const generatedSubtitle = `${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"} API Explorer`;
36
+ const createComponentLink = useRouteRef(createComponentRouteRef);
37
+ return /* @__PURE__ */ React.createElement(PageWithHeader, {
38
+ themeId: "apis",
39
+ title: "APIs",
40
+ subtitle: generatedSubtitle,
41
+ pageTitleOverride: "APIs"
42
+ }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
43
+ title: ""
44
+ }, /* @__PURE__ */ React.createElement(CreateButton, {
45
+ title: "Register Existing API",
46
+ to: createComponentLink == null ? void 0 : createComponentLink()
47
+ }), /* @__PURE__ */ React.createElement(SupportButton, null, "All your APIs")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(FilteredEntityLayout, null, /* @__PURE__ */ React.createElement(FilterContainer, null, /* @__PURE__ */ React.createElement(EntityKindPicker, {
48
+ initialFilter: "api",
49
+ hidden: true
50
+ }), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
51
+ initialFilter: initiallySelectedFilter
52
+ }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(EntityListContainer, null, /* @__PURE__ */ React.createElement(CatalogTable, {
53
+ columns: columns || defaultColumns,
54
+ actions
55
+ }))))));
56
+ };
57
+
58
+ const ApiExplorerPage$1 = (props) => {
59
+ const outlet = useOutlet();
60
+ return outlet || /* @__PURE__ */ React.createElement(DefaultApiExplorerPage, {
61
+ ...props
62
+ });
63
+ };
64
+
65
+ const apiDocsConfigRef = createApiRef({
66
+ id: "plugin.api-docs.config"
67
+ });
68
+
69
+ const PlainApiDefinitionWidget = (props) => {
70
+ return /* @__PURE__ */ React.createElement(CodeSnippet, {
71
+ text: props.definition,
72
+ language: props.language,
73
+ showCopyCodeButton: true
74
+ });
75
+ };
76
+
77
+ const ApiDefinitionCard = (_) => {
78
+ var _a;
79
+ const { entity } = useEntity();
80
+ const config = useApi(apiDocsConfigRef);
81
+ const { getApiDefinitionWidget } = config;
82
+ if (!entity) {
83
+ return /* @__PURE__ */ React.createElement(Alert, {
84
+ severity: "error"
85
+ }, "Could not fetch the API");
86
+ }
87
+ const definitionWidget = getApiDefinitionWidget(entity);
88
+ const entityTitle = (_a = entity.metadata.title) != null ? _a : entity.metadata.name;
89
+ if (definitionWidget) {
90
+ return /* @__PURE__ */ React.createElement(TabbedCard, {
91
+ title: entityTitle
92
+ }, /* @__PURE__ */ React.createElement(CardTab, {
93
+ label: definitionWidget.title,
94
+ key: "widget"
95
+ }, definitionWidget.component(entity.spec.definition)), /* @__PURE__ */ React.createElement(CardTab, {
96
+ label: "Raw",
97
+ key: "raw"
98
+ }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
99
+ definition: entity.spec.definition,
100
+ language: definitionWidget.rawLanguage || entity.spec.type
101
+ })));
102
+ }
103
+ return /* @__PURE__ */ React.createElement(TabbedCard, {
104
+ title: entityTitle,
105
+ children: [
106
+ /* @__PURE__ */ React.createElement(CardTab, {
107
+ label: entity.spec.type,
108
+ key: "raw"
109
+ }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
110
+ definition: entity.spec.definition,
111
+ language: entity.spec.type
112
+ }))
113
+ ]
114
+ });
115
+ };
116
+
117
+ const LazyAsyncApiDefinition = React.lazy(() => import('./esm/AsyncApiDefinition-c39ae15d.esm.js').then((m) => ({
118
+ default: m.AsyncApiDefinition
119
+ })));
120
+ const AsyncApiDefinitionWidget = (props) => {
121
+ return /* @__PURE__ */ React.createElement(Suspense, {
122
+ fallback: /* @__PURE__ */ React.createElement(Progress, null)
123
+ }, /* @__PURE__ */ React.createElement(LazyAsyncApiDefinition, {
124
+ ...props
125
+ }));
126
+ };
127
+
128
+ const LazyGraphQlDefinition = React.lazy(() => import('./esm/GraphQlDefinition-fa85d425.esm.js').then((m) => ({
129
+ default: m.GraphQlDefinition
130
+ })));
131
+ const GraphQlDefinitionWidget = (props) => {
132
+ return /* @__PURE__ */ React.createElement(Suspense, {
133
+ fallback: /* @__PURE__ */ React.createElement(Progress, null)
134
+ }, /* @__PURE__ */ React.createElement(LazyGraphQlDefinition, {
135
+ ...props
136
+ }));
137
+ };
138
+
139
+ const LazyOpenApiDefinition = React.lazy(() => import('./esm/OpenApiDefinition-48ae3040.esm.js').then((m) => ({
140
+ default: m.OpenApiDefinition
141
+ })));
142
+ const OpenApiDefinitionWidget = (props) => {
143
+ return /* @__PURE__ */ React.createElement(Suspense, {
144
+ fallback: /* @__PURE__ */ React.createElement(Progress, null)
145
+ }, /* @__PURE__ */ React.createElement(LazyOpenApiDefinition, {
146
+ ...props
147
+ }));
148
+ };
149
+
150
+ function defaultDefinitionWidgets() {
151
+ return [
152
+ {
153
+ type: "openapi",
154
+ title: "OpenAPI",
155
+ rawLanguage: "yaml",
156
+ component: (definition) => /* @__PURE__ */ React.createElement(OpenApiDefinitionWidget, {
157
+ definition
158
+ })
159
+ },
160
+ {
161
+ type: "asyncapi",
162
+ title: "AsyncAPI",
163
+ rawLanguage: "yaml",
164
+ component: (definition) => /* @__PURE__ */ React.createElement(AsyncApiDefinitionWidget, {
165
+ definition
166
+ })
167
+ },
168
+ {
169
+ type: "graphql",
170
+ title: "GraphQL",
171
+ rawLanguage: "graphql",
172
+ component: (definition) => /* @__PURE__ */ React.createElement(GraphQlDefinitionWidget, {
173
+ definition
174
+ })
175
+ }
176
+ ];
177
+ }
178
+
179
+ const ApiTypeTitle = ({ apiEntity }) => {
180
+ const config = useApi(apiDocsConfigRef);
181
+ const definition = config.getApiDefinitionWidget(apiEntity);
182
+ const type = definition ? definition.title : apiEntity.spec.type;
183
+ return /* @__PURE__ */ React.createElement("span", null, type);
184
+ };
185
+
186
+ function createSpecApiTypeColumn() {
187
+ return {
188
+ title: "Type",
189
+ field: "spec.type",
190
+ render: (entity) => /* @__PURE__ */ React.createElement(ApiTypeTitle, {
191
+ apiEntity: entity
192
+ })
193
+ };
194
+ }
195
+ const apiEntityColumns = [
196
+ EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
197
+ EntityTable.columns.createSystemColumn(),
198
+ EntityTable.columns.createOwnerColumn(),
199
+ createSpecApiTypeColumn(),
200
+ EntityTable.columns.createSpecLifecycleColumn(),
201
+ EntityTable.columns.createMetadataDescriptionColumn()
202
+ ];
203
+
204
+ const ConsumedApisCard = ({ variant = "gridItem" }) => {
205
+ const { entity } = useEntity();
206
+ const { entities, loading, error } = useRelatedEntities(entity, {
207
+ type: RELATION_CONSUMES_API
208
+ });
209
+ if (loading) {
210
+ return /* @__PURE__ */ React.createElement(InfoCard, {
211
+ variant,
212
+ title: "Consumed APIs"
213
+ }, /* @__PURE__ */ React.createElement(Progress, null));
214
+ }
215
+ if (error || !entities) {
216
+ return /* @__PURE__ */ React.createElement(InfoCard, {
217
+ variant,
218
+ title: "Consumed APIs"
219
+ }, /* @__PURE__ */ React.createElement(WarningPanel, {
220
+ severity: "error",
221
+ title: "Could not load APIs",
222
+ message: /* @__PURE__ */ React.createElement(CodeSnippet, {
223
+ text: `${error}`,
224
+ language: "text"
225
+ })
226
+ }));
227
+ }
228
+ return /* @__PURE__ */ React.createElement(EntityTable, {
229
+ title: "Consumed APIs",
230
+ variant,
231
+ emptyContent: /* @__PURE__ */ React.createElement("div", {
232
+ style: { textAlign: "center" }
233
+ }, /* @__PURE__ */ React.createElement(Typography, {
234
+ variant: "body1"
235
+ }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography, {
236
+ variant: "body2"
237
+ }, /* @__PURE__ */ React.createElement(Link, {
238
+ to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
239
+ }, "Learn how to change this."))),
240
+ columns: apiEntityColumns,
241
+ entities
242
+ });
243
+ };
244
+
245
+ const columns = [
246
+ EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
247
+ EntityTable.columns.createOwnerColumn(),
248
+ createSpecApiTypeColumn(),
249
+ EntityTable.columns.createSpecLifecycleColumn(),
250
+ EntityTable.columns.createMetadataDescriptionColumn()
251
+ ];
252
+ const HasApisCard = ({ variant = "gridItem" }) => {
253
+ const { entity } = useEntity();
254
+ const { entities, loading, error } = useRelatedEntities(entity, {
255
+ type: RELATION_HAS_PART,
256
+ kind: "API"
257
+ });
258
+ if (loading) {
259
+ return /* @__PURE__ */ React.createElement(InfoCard, {
260
+ variant,
261
+ title: "APIs"
262
+ }, /* @__PURE__ */ React.createElement(Progress, null));
263
+ }
264
+ if (error || !entities) {
265
+ return /* @__PURE__ */ React.createElement(InfoCard, {
266
+ variant,
267
+ title: "APIs"
268
+ }, /* @__PURE__ */ React.createElement(WarningPanel, {
269
+ severity: "error",
270
+ title: "Could not load APIs",
271
+ message: /* @__PURE__ */ React.createElement(CodeSnippet, {
272
+ text: `${error}`,
273
+ language: "text"
274
+ })
275
+ }));
276
+ }
277
+ return /* @__PURE__ */ React.createElement(EntityTable, {
278
+ title: "APIs",
279
+ variant,
280
+ emptyContent: /* @__PURE__ */ React.createElement("div", {
281
+ style: { textAlign: "center" }
282
+ }, /* @__PURE__ */ React.createElement(Typography, {
283
+ variant: "body1"
284
+ }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography, {
285
+ variant: "body2"
286
+ }, /* @__PURE__ */ React.createElement(Link, {
287
+ to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api"
288
+ }, "Learn how to change this."))),
289
+ columns,
290
+ entities
291
+ });
292
+ };
293
+
294
+ const ProvidedApisCard = ({ variant = "gridItem" }) => {
295
+ const { entity } = useEntity();
296
+ const { entities, loading, error } = useRelatedEntities(entity, {
297
+ type: RELATION_PROVIDES_API
298
+ });
299
+ if (loading) {
300
+ return /* @__PURE__ */ React.createElement(InfoCard, {
301
+ variant,
302
+ title: "Provided APIs"
303
+ }, /* @__PURE__ */ React.createElement(Progress, null));
304
+ }
305
+ if (error || !entities) {
306
+ return /* @__PURE__ */ React.createElement(InfoCard, {
307
+ variant,
308
+ title: "Provided APIs"
309
+ }, /* @__PURE__ */ React.createElement(WarningPanel, {
310
+ severity: "error",
311
+ title: "Could not load APIs",
312
+ message: /* @__PURE__ */ React.createElement(CodeSnippet, {
313
+ text: `${error}`,
314
+ language: "text"
315
+ })
316
+ }));
317
+ }
318
+ return /* @__PURE__ */ React.createElement(EntityTable, {
319
+ title: "Provided APIs",
320
+ variant,
321
+ emptyContent: /* @__PURE__ */ React.createElement("div", {
322
+ style: { textAlign: "center" }
323
+ }, /* @__PURE__ */ React.createElement(Typography, {
324
+ variant: "body1"
325
+ }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography, {
326
+ variant: "body2"
327
+ }, /* @__PURE__ */ React.createElement(Link, {
328
+ to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
329
+ }, "Learn how to change this."))),
330
+ columns: apiEntityColumns,
331
+ entities
332
+ });
333
+ };
334
+
335
+ const ConsumingComponentsCard = ({ variant = "gridItem" }) => {
336
+ const { entity } = useEntity();
337
+ const { entities, loading, error } = useRelatedEntities(entity, {
338
+ type: RELATION_API_CONSUMED_BY
339
+ });
340
+ if (loading) {
341
+ return /* @__PURE__ */ React.createElement(InfoCard, {
342
+ variant,
343
+ title: "Consumers"
344
+ }, /* @__PURE__ */ React.createElement(Progress, null));
345
+ }
346
+ if (error || !entities) {
347
+ return /* @__PURE__ */ React.createElement(InfoCard, {
348
+ variant,
349
+ title: "Consumers"
350
+ }, /* @__PURE__ */ React.createElement(WarningPanel, {
351
+ severity: "error",
352
+ title: "Could not load components",
353
+ message: /* @__PURE__ */ React.createElement(CodeSnippet, {
354
+ text: `${error}`,
355
+ language: "text"
356
+ })
357
+ }));
358
+ }
359
+ return /* @__PURE__ */ React.createElement(EntityTable, {
360
+ title: "Consumers",
361
+ variant,
362
+ emptyContent: /* @__PURE__ */ React.createElement("div", {
363
+ style: { textAlign: "center" }
364
+ }, /* @__PURE__ */ React.createElement(Typography, {
365
+ variant: "body1"
366
+ }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, {
367
+ variant: "body2"
368
+ }, /* @__PURE__ */ React.createElement(Link, {
369
+ to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
370
+ }, "Learn how to change this."))),
371
+ columns: EntityTable.componentEntityColumns,
372
+ entities
373
+ });
374
+ };
375
+
376
+ const ProvidingComponentsCard = ({ variant = "gridItem" }) => {
377
+ const { entity } = useEntity();
378
+ const { entities, loading, error } = useRelatedEntities(entity, {
379
+ type: RELATION_API_PROVIDED_BY
380
+ });
381
+ if (loading) {
382
+ return /* @__PURE__ */ React.createElement(InfoCard, {
383
+ variant,
384
+ title: "Providers"
385
+ }, /* @__PURE__ */ React.createElement(Progress, null));
386
+ }
387
+ if (error || !entities) {
388
+ return /* @__PURE__ */ React.createElement(InfoCard, {
389
+ variant,
390
+ title: "Providers"
391
+ }, /* @__PURE__ */ React.createElement(WarningPanel, {
392
+ severity: "error",
393
+ title: "Could not load components",
394
+ message: /* @__PURE__ */ React.createElement(CodeSnippet, {
395
+ text: `${error}`,
396
+ language: "text"
397
+ })
398
+ }));
399
+ }
400
+ return /* @__PURE__ */ React.createElement(EntityTable, {
401
+ title: "Providers",
402
+ variant,
403
+ emptyContent: /* @__PURE__ */ React.createElement("div", {
404
+ style: { textAlign: "center" }
405
+ }, /* @__PURE__ */ React.createElement(Typography, {
406
+ variant: "body1"
407
+ }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, {
408
+ variant: "body2"
409
+ }, /* @__PURE__ */ React.createElement(Link, {
410
+ to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
411
+ }, "Learn how to change this."))),
412
+ columns: EntityTable.componentEntityColumns,
413
+ entities
414
+ });
415
+ };
416
+
417
+ const apiDocsPlugin = createPlugin({
418
+ id: "api-docs",
419
+ routes: {
420
+ root: rootRoute
421
+ },
422
+ apis: [
423
+ createApiFactory({
424
+ api: apiDocsConfigRef,
425
+ deps: {},
426
+ factory: () => {
427
+ const definitionWidgets = defaultDefinitionWidgets();
428
+ return {
429
+ getApiDefinitionWidget: (apiEntity) => {
430
+ return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
431
+ }
432
+ };
433
+ }
434
+ })
435
+ ],
436
+ externalRoutes: {
437
+ createComponent: createComponentRouteRef
438
+ }
439
+ });
440
+ const ApiExplorerPage = apiDocsPlugin.provide(createRoutableExtension({
441
+ name: "ApiExplorerPage",
442
+ component: () => import('./esm/index-02cb4cdc.esm.js').then((m) => m.ApiExplorerIndexPage),
443
+ mountPoint: rootRoute
444
+ }));
445
+ const EntityApiDefinitionCard = apiDocsPlugin.provide(createComponentExtension({
446
+ name: "EntityApiDefinitionCard",
447
+ component: {
448
+ lazy: () => import('./esm/index-89d097b6.esm.js').then((m) => m.ApiDefinitionCard)
449
+ }
450
+ }));
451
+ const EntityConsumedApisCard = apiDocsPlugin.provide(createComponentExtension({
452
+ name: "EntityConsumedApisCard",
453
+ component: {
454
+ lazy: () => import('./esm/index-32c80387.esm.js').then((m) => m.ConsumedApisCard)
455
+ }
456
+ }));
457
+ const EntityConsumingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
458
+ name: "EntityConsumingComponentsCard",
459
+ component: {
460
+ lazy: () => import('./esm/index-30e4d7f8.esm.js').then((m) => m.ConsumingComponentsCard)
461
+ }
462
+ }));
463
+ const EntityProvidedApisCard = apiDocsPlugin.provide(createComponentExtension({
464
+ name: "EntityProvidedApisCard",
465
+ component: {
466
+ lazy: () => import('./esm/index-32c80387.esm.js').then((m) => m.ProvidedApisCard)
467
+ }
468
+ }));
469
+ const EntityProvidingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
470
+ name: "EntityProvidingComponentsCard",
471
+ component: {
472
+ lazy: () => import('./esm/index-30e4d7f8.esm.js').then((m) => m.ProvidingComponentsCard)
473
+ }
474
+ }));
475
+ const EntityHasApisCard = apiDocsPlugin.provide(createComponentExtension({
476
+ name: "EntityHasApisCard",
477
+ component: {
478
+ lazy: () => import('./esm/index-32c80387.esm.js').then((m) => m.HasApisCard)
479
+ }
480
+ }));
481
+
482
+ export { ApiDefinitionCard, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, HasApisCard, OpenApiDefinitionWidget, PlainApiDefinitionWidget, ProvidedApisCard, ProvidingComponentsCard, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
9
483
  //# sourceMappingURL=index.esm.js.map