@backstage/plugin-api-docs 0.6.20 → 0.7.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs",
3
3
  "description": "A Backstage plugin that helps represent API entities in the frontend",
4
- "version": "0.6.20",
4
+ "version": "0.7.0",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -30,12 +30,12 @@
30
30
  "clean": "backstage-cli clean"
31
31
  },
32
32
  "dependencies": {
33
- "@asyncapi/react-component": "^1.0.0-next.25",
34
- "@backstage/catalog-model": "^0.9.7",
35
- "@backstage/core-components": "^0.8.2",
36
- "@backstage/core-plugin-api": "^0.4.0",
37
- "@backstage/plugin-catalog": "^0.7.6",
38
- "@backstage/plugin-catalog-react": "^0.6.9",
33
+ "@asyncapi/react-component": "1.0.0-next.32",
34
+ "@backstage/catalog-model": "^0.9.10",
35
+ "@backstage/core-components": "^0.8.5",
36
+ "@backstage/core-plugin-api": "^0.6.0",
37
+ "@backstage/plugin-catalog": "^0.7.9",
38
+ "@backstage/plugin-catalog-react": "^0.6.12",
39
39
  "@backstage/theme": "^0.2.14",
40
40
  "@material-ui/core": "^4.12.2",
41
41
  "@material-ui/icons": "^4.9.1",
@@ -46,29 +46,28 @@
46
46
  "react-router": "6.0.0-beta.0",
47
47
  "react-router-dom": "6.0.0-beta.0",
48
48
  "react-use": "^17.2.4",
49
- "swagger-client": "3.16.1",
50
- "swagger-ui-react": "^4.0.0-rc.3"
49
+ "swagger-ui-react": "^4.1.3"
51
50
  },
52
51
  "peerDependencies": {
53
52
  "@types/react": "^16.13.1 || ^17.0.0",
54
53
  "react": "^16.13.1 || ^17.0.0"
55
54
  },
56
55
  "devDependencies": {
57
- "@backstage/cli": "^0.10.4",
58
- "@backstage/core-app-api": "^0.3.0",
59
- "@backstage/dev-utils": "^0.2.15",
60
- "@backstage/test-utils": "^0.2.1",
56
+ "@backstage/cli": "^0.12.0",
57
+ "@backstage/core-app-api": "^0.5.0",
58
+ "@backstage/dev-utils": "^0.2.18",
59
+ "@backstage/test-utils": "^0.2.3",
61
60
  "@testing-library/jest-dom": "^5.10.1",
62
61
  "@testing-library/react": "^11.2.5",
63
62
  "@testing-library/user-event": "^13.1.8",
64
63
  "@types/jest": "^26.0.7",
65
64
  "@types/node": "^14.14.32",
66
- "@types/swagger-ui-react": "^3.23.3",
65
+ "@types/swagger-ui-react": "^4.1.1",
67
66
  "cross-fetch": "^3.0.6",
68
67
  "msw": "^0.35.0"
69
68
  },
70
69
  "files": [
71
70
  "dist"
72
71
  ],
73
- "gitHead": "4b2a8ed96ff427735c872a72c1864321ef698436"
72
+ "gitHead": "600d6e3c854bbfb12a0078ca6f726d1c0d1fea0b"
74
73
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-00af9be1.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,51 +0,0 @@
1
- import { PageWithHeader, Content, ContentHeader, CreateButton, SupportButton } from '@backstage/core-components';
2
- import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
3
- import { CatalogTable, FilteredEntityLayout, FilterContainer, EntityListContainer } from '@backstage/plugin-catalog';
4
- import { EntityListProvider, EntityKindPicker, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
5
- import React from 'react';
6
- import { c as createComponentRouteRef } from './index-83f082c6.esm.js';
7
- import '@material-ui/lab';
8
- import '@backstage/catalog-model';
9
- import '@material-ui/core';
10
-
11
- const defaultColumns = [
12
- CatalogTable.columns.createNameColumn({ defaultKind: "API" }),
13
- CatalogTable.columns.createSystemColumn(),
14
- CatalogTable.columns.createOwnerColumn(),
15
- CatalogTable.columns.createSpecTypeColumn(),
16
- CatalogTable.columns.createSpecLifecycleColumn(),
17
- CatalogTable.columns.createMetadataDescriptionColumn(),
18
- CatalogTable.columns.createTagsColumn()
19
- ];
20
- const ApiExplorerPage = ({
21
- initiallySelectedFilter = "all",
22
- columns,
23
- actions
24
- }) => {
25
- var _a;
26
- const configApi = useApi(configApiRef);
27
- const generatedSubtitle = `${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"} API Explorer`;
28
- const createComponentLink = useRouteRef(createComponentRouteRef);
29
- return /* @__PURE__ */ React.createElement(PageWithHeader, {
30
- themeId: "apis",
31
- title: "APIs",
32
- subtitle: generatedSubtitle,
33
- pageTitleOverride: "APIs"
34
- }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
35
- title: ""
36
- }, /* @__PURE__ */ React.createElement(CreateButton, {
37
- title: "Register Existing API",
38
- to: createComponentLink == null ? void 0 : createComponentLink()
39
- }), /* @__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, {
40
- initialFilter: "api",
41
- hidden: true
42
- }), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
43
- initialFilter: initiallySelectedFilter
44
- }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(EntityListContainer, null, /* @__PURE__ */ React.createElement(CatalogTable, {
45
- columns: columns || defaultColumns,
46
- actions
47
- }))))));
48
- };
49
-
50
- export { ApiExplorerPage };
51
- //# sourceMappingURL=index-160e3ddd.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-160e3ddd.esm.js","sources":["../../src/components/ApiExplorerPage/ApiExplorerPage.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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogTable,\n CatalogTableRow,\n FilteredEntityLayout,\n EntityListContainer,\n FilterContainer,\n} from '@backstage/plugin-catalog';\nimport {\n EntityKindPicker,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createComponentRouteRef } from '../../routes';\n\nconst defaultColumns: TableColumn<CatalogTableRow>[] = [\n CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),\n CatalogTable.columns.createSystemColumn(),\n CatalogTable.columns.createOwnerColumn(),\n CatalogTable.columns.createSpecTypeColumn(),\n CatalogTable.columns.createSpecLifecycleColumn(),\n CatalogTable.columns.createMetadataDescriptionColumn(),\n CatalogTable.columns.createTagsColumn(),\n];\n\ntype ApiExplorerPageProps = {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n};\n\nexport const ApiExplorerPage = ({\n initiallySelectedFilter = 'all',\n columns,\n actions,\n}: ApiExplorerPageProps) => {\n const configApi = useApi(configApiRef);\n const generatedSubtitle = `${\n configApi.getOptionalString('organization.name') ?? 'Backstage'\n } API Explorer`;\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n return (\n <PageWithHeader\n themeId=\"apis\"\n title=\"APIs\"\n subtitle={generatedSubtitle}\n pageTitleOverride=\"APIs\"\n >\n <Content>\n <ContentHeader title=\"\">\n <CreateButton\n title=\"Register Existing API\"\n to={createComponentLink?.()}\n />\n <SupportButton>All your APIs</SupportButton>\n </ContentHeader>\n <EntityListProvider>\n <FilteredEntityLayout>\n <FilterContainer>\n <EntityKindPicker initialFilter=\"api\" hidden />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n </FilterContainer>\n <EntityListContainer>\n <CatalogTable\n columns={columns || defaultColumns}\n actions={actions}\n />\n </EntityListContainer>\n </FilteredEntityLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8CA,MAAM,iBAAiD;AAAA,EACrD,aAAa,QAAQ,iBAAiB,EAAE,aAAa;AAAA,EACrD,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA,EACrB,aAAa,QAAQ;AAAA;MASV,kBAAkB,CAAC;AAAA,EAC9B,0BAA0B;AAAA,EAC1B;AAAA,EACA;AAAA,MAC0B;AAlE5B;AAmEE,QAAM,YAAY,OAAO;AACzB,QAAM,oBAAoB,GACxB,gBAAU,kBAAkB,yBAA5B,YAAoD;AAEtD,QAAM,sBAAsB,YAAY;AAExC,6CACG,gBAAD;AAAA,IACE,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,UAAU;AAAA,IACV,mBAAkB;AAAA,yCAEjB,SAAD,0CACG,eAAD;AAAA,IAAe,OAAM;AAAA,yCAClB,cAAD;AAAA,IACE,OAAM;AAAA,IACN,IAAI;AAAA,0CAEL,eAAD,MAAe,uDAEhB,oBAAD,0CACG,sBAAD,0CACG,iBAAD,0CACG,kBAAD;AAAA,IAAkB,eAAc;AAAA,IAAM,QAAM;AAAA,0CAC3C,kBAAD,2CACC,gBAAD;AAAA,IAAgB,eAAe;AAAA,0CAC9B,mBAAD,2CACC,uBAAD,2CACC,iBAAD,4CAED,qBAAD,0CACG,cAAD;AAAA,IACE,SAAS,WAAW;AAAA,IACpB;AAAA;AAAA;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-674cfd0b.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,435 +0,0 @@
1
- import { useEntity, EntityTable, useRelatedEntities } from '@backstage/plugin-catalog-react';
2
- import { Alert } from '@material-ui/lab';
3
- import React, { Suspense } from 'react';
4
- import { createApiRef, useApi, createRouteRef, createExternalRouteRef, createPlugin, createApiFactory, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
5
- import { CodeSnippet, TabbedCard, CardTab, Progress, InfoCard, WarningPanel, Link } from '@backstage/core-components';
6
- import { RELATION_CONSUMES_API, RELATION_HAS_PART, RELATION_PROVIDES_API, RELATION_API_CONSUMED_BY, RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
7
- import { Typography } from '@material-ui/core';
8
-
9
- const apiDocsConfigRef = createApiRef({
10
- id: "plugin.api-docs.config"
11
- });
12
-
13
- const PlainApiDefinitionWidget = (props) => {
14
- return /* @__PURE__ */ React.createElement(CodeSnippet, {
15
- text: props.definition,
16
- language: props.language,
17
- showCopyCodeButton: true
18
- });
19
- };
20
-
21
- const ApiDefinitionCard = (_) => {
22
- var _a;
23
- const { entity } = useEntity();
24
- const config = useApi(apiDocsConfigRef);
25
- const { getApiDefinitionWidget } = config;
26
- if (!entity) {
27
- return /* @__PURE__ */ React.createElement(Alert, {
28
- severity: "error"
29
- }, "Could not fetch the API");
30
- }
31
- const definitionWidget = getApiDefinitionWidget(entity);
32
- const entityTitle = (_a = entity.metadata.title) != null ? _a : entity.metadata.name;
33
- if (definitionWidget) {
34
- return /* @__PURE__ */ React.createElement(TabbedCard, {
35
- title: entityTitle
36
- }, /* @__PURE__ */ React.createElement(CardTab, {
37
- label: definitionWidget.title,
38
- key: "widget"
39
- }, definitionWidget.component(entity.spec.definition)), /* @__PURE__ */ React.createElement(CardTab, {
40
- label: "Raw",
41
- key: "raw"
42
- }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
43
- definition: entity.spec.definition,
44
- language: definitionWidget.rawLanguage || entity.spec.type
45
- })));
46
- }
47
- return /* @__PURE__ */ React.createElement(TabbedCard, {
48
- title: entityTitle,
49
- children: [
50
- /* @__PURE__ */ React.createElement(CardTab, {
51
- label: entity.spec.type,
52
- key: "raw"
53
- }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
54
- definition: entity.spec.definition,
55
- language: entity.spec.type
56
- }))
57
- ]
58
- });
59
- };
60
-
61
- const LazyAsyncApiDefinition = React.lazy(() => import('./AsyncApiDefinition-c39ae15d.esm.js').then((m) => ({
62
- default: m.AsyncApiDefinition
63
- })));
64
- const AsyncApiDefinitionWidget = (props) => {
65
- return /* @__PURE__ */ React.createElement(Suspense, {
66
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
67
- }, /* @__PURE__ */ React.createElement(LazyAsyncApiDefinition, {
68
- ...props
69
- }));
70
- };
71
-
72
- const LazyGraphQlDefinition = React.lazy(() => import('./GraphQlDefinition-fa85d425.esm.js').then((m) => ({
73
- default: m.GraphQlDefinition
74
- })));
75
- const GraphQlDefinitionWidget = (props) => {
76
- return /* @__PURE__ */ React.createElement(Suspense, {
77
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
78
- }, /* @__PURE__ */ React.createElement(LazyGraphQlDefinition, {
79
- ...props
80
- }));
81
- };
82
-
83
- const LazyOpenApiDefinition = React.lazy(() => import('./OpenApiDefinition-48ae3040.esm.js').then((m) => ({
84
- default: m.OpenApiDefinition
85
- })));
86
- const OpenApiDefinitionWidget = (props) => {
87
- return /* @__PURE__ */ React.createElement(Suspense, {
88
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
89
- }, /* @__PURE__ */ React.createElement(LazyOpenApiDefinition, {
90
- ...props
91
- }));
92
- };
93
-
94
- function defaultDefinitionWidgets() {
95
- return [
96
- {
97
- type: "openapi",
98
- title: "OpenAPI",
99
- rawLanguage: "yaml",
100
- component: (definition) => /* @__PURE__ */ React.createElement(OpenApiDefinitionWidget, {
101
- definition
102
- })
103
- },
104
- {
105
- type: "asyncapi",
106
- title: "AsyncAPI",
107
- rawLanguage: "yaml",
108
- component: (definition) => /* @__PURE__ */ React.createElement(AsyncApiDefinitionWidget, {
109
- definition
110
- })
111
- },
112
- {
113
- type: "graphql",
114
- title: "GraphQL",
115
- rawLanguage: "graphql",
116
- component: (definition) => /* @__PURE__ */ React.createElement(GraphQlDefinitionWidget, {
117
- definition
118
- })
119
- }
120
- ];
121
- }
122
-
123
- const ApiTypeTitle = ({ apiEntity }) => {
124
- const config = useApi(apiDocsConfigRef);
125
- const definition = config.getApiDefinitionWidget(apiEntity);
126
- const type = definition ? definition.title : apiEntity.spec.type;
127
- return /* @__PURE__ */ React.createElement("span", null, type);
128
- };
129
-
130
- function createSpecApiTypeColumn() {
131
- return {
132
- title: "Type",
133
- field: "spec.type",
134
- render: (entity) => /* @__PURE__ */ React.createElement(ApiTypeTitle, {
135
- apiEntity: entity
136
- })
137
- };
138
- }
139
- const apiEntityColumns = [
140
- EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
141
- EntityTable.columns.createSystemColumn(),
142
- EntityTable.columns.createOwnerColumn(),
143
- createSpecApiTypeColumn(),
144
- EntityTable.columns.createSpecLifecycleColumn(),
145
- EntityTable.columns.createMetadataDescriptionColumn()
146
- ];
147
-
148
- const ConsumedApisCard = ({ variant = "gridItem" }) => {
149
- const { entity } = useEntity();
150
- const { entities, loading, error } = useRelatedEntities(entity, {
151
- type: RELATION_CONSUMES_API
152
- });
153
- if (loading) {
154
- return /* @__PURE__ */ React.createElement(InfoCard, {
155
- variant,
156
- title: "Consumed APIs"
157
- }, /* @__PURE__ */ React.createElement(Progress, null));
158
- }
159
- if (error || !entities) {
160
- return /* @__PURE__ */ React.createElement(InfoCard, {
161
- variant,
162
- title: "Consumed APIs"
163
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
164
- severity: "error",
165
- title: "Could not load APIs",
166
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
167
- text: `${error}`,
168
- language: "text"
169
- })
170
- }));
171
- }
172
- return /* @__PURE__ */ React.createElement(EntityTable, {
173
- title: "Consumed APIs",
174
- variant,
175
- emptyContent: /* @__PURE__ */ React.createElement("div", {
176
- style: { textAlign: "center" }
177
- }, /* @__PURE__ */ React.createElement(Typography, {
178
- variant: "body1"
179
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography, {
180
- variant: "body2"
181
- }, /* @__PURE__ */ React.createElement(Link, {
182
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
183
- }, "Learn how to change this."))),
184
- columns: apiEntityColumns,
185
- entities
186
- });
187
- };
188
-
189
- const columns = [
190
- EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
191
- EntityTable.columns.createOwnerColumn(),
192
- createSpecApiTypeColumn(),
193
- EntityTable.columns.createSpecLifecycleColumn(),
194
- EntityTable.columns.createMetadataDescriptionColumn()
195
- ];
196
- const HasApisCard = ({ variant = "gridItem" }) => {
197
- const { entity } = useEntity();
198
- const { entities, loading, error } = useRelatedEntities(entity, {
199
- type: RELATION_HAS_PART,
200
- kind: "API"
201
- });
202
- if (loading) {
203
- return /* @__PURE__ */ React.createElement(InfoCard, {
204
- variant,
205
- title: "APIs"
206
- }, /* @__PURE__ */ React.createElement(Progress, null));
207
- }
208
- if (error || !entities) {
209
- return /* @__PURE__ */ React.createElement(InfoCard, {
210
- variant,
211
- title: "APIs"
212
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
213
- severity: "error",
214
- title: "Could not load APIs",
215
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
216
- text: `${error}`,
217
- language: "text"
218
- })
219
- }));
220
- }
221
- return /* @__PURE__ */ React.createElement(EntityTable, {
222
- title: "APIs",
223
- variant,
224
- emptyContent: /* @__PURE__ */ React.createElement("div", {
225
- style: { textAlign: "center" }
226
- }, /* @__PURE__ */ React.createElement(Typography, {
227
- variant: "body1"
228
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography, {
229
- variant: "body2"
230
- }, /* @__PURE__ */ React.createElement(Link, {
231
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api"
232
- }, "Learn how to change this."))),
233
- columns,
234
- entities
235
- });
236
- };
237
-
238
- const ProvidedApisCard = ({ variant = "gridItem" }) => {
239
- const { entity } = useEntity();
240
- const { entities, loading, error } = useRelatedEntities(entity, {
241
- type: RELATION_PROVIDES_API
242
- });
243
- if (loading) {
244
- return /* @__PURE__ */ React.createElement(InfoCard, {
245
- variant,
246
- title: "Provided APIs"
247
- }, /* @__PURE__ */ React.createElement(Progress, null));
248
- }
249
- if (error || !entities) {
250
- return /* @__PURE__ */ React.createElement(InfoCard, {
251
- variant,
252
- title: "Provided APIs"
253
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
254
- severity: "error",
255
- title: "Could not load APIs",
256
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
257
- text: `${error}`,
258
- language: "text"
259
- })
260
- }));
261
- }
262
- return /* @__PURE__ */ React.createElement(EntityTable, {
263
- title: "Provided APIs",
264
- variant,
265
- emptyContent: /* @__PURE__ */ React.createElement("div", {
266
- style: { textAlign: "center" }
267
- }, /* @__PURE__ */ React.createElement(Typography, {
268
- variant: "body1"
269
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography, {
270
- variant: "body2"
271
- }, /* @__PURE__ */ React.createElement(Link, {
272
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
273
- }, "Learn how to change this."))),
274
- columns: apiEntityColumns,
275
- entities
276
- });
277
- };
278
-
279
- const ConsumingComponentsCard = ({ variant = "gridItem" }) => {
280
- const { entity } = useEntity();
281
- const { entities, loading, error } = useRelatedEntities(entity, {
282
- type: RELATION_API_CONSUMED_BY
283
- });
284
- if (loading) {
285
- return /* @__PURE__ */ React.createElement(InfoCard, {
286
- variant,
287
- title: "Consumers"
288
- }, /* @__PURE__ */ React.createElement(Progress, null));
289
- }
290
- if (error || !entities) {
291
- return /* @__PURE__ */ React.createElement(InfoCard, {
292
- variant,
293
- title: "Consumers"
294
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
295
- severity: "error",
296
- title: "Could not load components",
297
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
298
- text: `${error}`,
299
- language: "text"
300
- })
301
- }));
302
- }
303
- return /* @__PURE__ */ React.createElement(EntityTable, {
304
- title: "Consumers",
305
- variant,
306
- emptyContent: /* @__PURE__ */ React.createElement("div", {
307
- style: { textAlign: "center" }
308
- }, /* @__PURE__ */ React.createElement(Typography, {
309
- variant: "body1"
310
- }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, {
311
- variant: "body2"
312
- }, /* @__PURE__ */ React.createElement(Link, {
313
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
314
- }, "Learn how to change this."))),
315
- columns: EntityTable.componentEntityColumns,
316
- entities
317
- });
318
- };
319
-
320
- const ProvidingComponentsCard = ({ variant = "gridItem" }) => {
321
- const { entity } = useEntity();
322
- const { entities, loading, error } = useRelatedEntities(entity, {
323
- type: RELATION_API_PROVIDED_BY
324
- });
325
- if (loading) {
326
- return /* @__PURE__ */ React.createElement(InfoCard, {
327
- variant,
328
- title: "Providers"
329
- }, /* @__PURE__ */ React.createElement(Progress, null));
330
- }
331
- if (error || !entities) {
332
- return /* @__PURE__ */ React.createElement(InfoCard, {
333
- variant,
334
- title: "Providers"
335
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
336
- severity: "error",
337
- title: "Could not load components",
338
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
339
- text: `${error}`,
340
- language: "text"
341
- })
342
- }));
343
- }
344
- return /* @__PURE__ */ React.createElement(EntityTable, {
345
- title: "Providers",
346
- variant,
347
- emptyContent: /* @__PURE__ */ React.createElement("div", {
348
- style: { textAlign: "center" }
349
- }, /* @__PURE__ */ React.createElement(Typography, {
350
- variant: "body1"
351
- }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, {
352
- variant: "body2"
353
- }, /* @__PURE__ */ React.createElement(Link, {
354
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
355
- }, "Learn how to change this."))),
356
- columns: EntityTable.componentEntityColumns,
357
- entities
358
- });
359
- };
360
-
361
- const rootRoute = createRouteRef({
362
- id: "api-docs"
363
- });
364
- const createComponentRouteRef = createExternalRouteRef({
365
- id: "create-component",
366
- optional: true
367
- });
368
-
369
- const apiDocsPlugin = createPlugin({
370
- id: "api-docs",
371
- routes: {
372
- root: rootRoute
373
- },
374
- apis: [
375
- createApiFactory({
376
- api: apiDocsConfigRef,
377
- deps: {},
378
- factory: () => {
379
- const definitionWidgets = defaultDefinitionWidgets();
380
- return {
381
- getApiDefinitionWidget: (apiEntity) => {
382
- return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
383
- }
384
- };
385
- }
386
- })
387
- ],
388
- externalRoutes: {
389
- createComponent: createComponentRouteRef
390
- }
391
- });
392
- const ApiExplorerPage = apiDocsPlugin.provide(createRoutableExtension({
393
- name: "ApiExplorerPage",
394
- component: () => import('./index-160e3ddd.esm.js').then((m) => m.ApiExplorerPage),
395
- mountPoint: rootRoute
396
- }));
397
- const EntityApiDefinitionCard = apiDocsPlugin.provide(createComponentExtension({
398
- name: "EntityApiDefinitionCard",
399
- component: {
400
- lazy: () => import('./index-00af9be1.esm.js').then((m) => m.ApiDefinitionCard)
401
- }
402
- }));
403
- const EntityConsumedApisCard = apiDocsPlugin.provide(createComponentExtension({
404
- name: "EntityConsumedApisCard",
405
- component: {
406
- lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.ConsumedApisCard)
407
- }
408
- }));
409
- const EntityConsumingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
410
- name: "EntityConsumingComponentsCard",
411
- component: {
412
- lazy: () => import('./index-674cfd0b.esm.js').then((m) => m.ConsumingComponentsCard)
413
- }
414
- }));
415
- const EntityProvidedApisCard = apiDocsPlugin.provide(createComponentExtension({
416
- name: "EntityProvidedApisCard",
417
- component: {
418
- lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.ProvidedApisCard)
419
- }
420
- }));
421
- const EntityProvidingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
422
- name: "EntityProvidingComponentsCard",
423
- component: {
424
- lazy: () => import('./index-674cfd0b.esm.js').then((m) => m.ProvidingComponentsCard)
425
- }
426
- }));
427
- const EntityHasApisCard = apiDocsPlugin.provide(createComponentExtension({
428
- name: "EntityHasApisCard",
429
- component: {
430
- lazy: () => import('./index-a8bf5768.esm.js').then((m) => m.HasApisCard)
431
- }
432
- }));
433
-
434
- export { ApiDefinitionCard as A, ConsumedApisCard as C, EntityApiDefinitionCard as E, HasApisCard as H, OpenApiDefinitionWidget as O, ProvidedApisCard as P, ApiTypeTitle as a, ConsumingComponentsCard as b, createComponentRouteRef as c, defaultDefinitionWidgets as d, ProvidingComponentsCard as e, apiDocsConfigRef as f, apiDocsPlugin as g, ApiExplorerPage as h, EntityConsumedApisCard as i, EntityConsumingComponentsCard as j, EntityHasApisCard as k, EntityProvidedApisCard as l, EntityProvidingComponentsCard as m, AsyncApiDefinitionWidget as n, PlainApiDefinitionWidget as o };
435
- //# sourceMappingURL=index-83f082c6.esm.js.map