@backstage/plugin-api-docs 0.6.19 → 0.6.23-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/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.19",
4
+ "version": "0.6.23-next.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.5",
38
- "@backstage/plugin-catalog-react": "^0.6.8",
33
+ "@asyncapi/react-component": "1.0.0-next.26",
34
+ "@backstage/catalog-model": "^0.9.10-next.0",
35
+ "@backstage/core-components": "^0.8.5-next.0",
36
+ "@backstage/core-plugin-api": "^0.6.0-next.0",
37
+ "@backstage/plugin-catalog": "^0.7.9-next.0",
38
+ "@backstage/plugin-catalog-react": "^0.6.12-next.0",
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.3",
58
- "@backstage/core-app-api": "^0.3.0",
59
- "@backstage/dev-utils": "^0.2.15",
60
- "@backstage/test-utils": "^0.2.0",
56
+ "@backstage/cli": "^0.12.0-next.0",
57
+ "@backstage/core-app-api": "^0.5.0-next.0",
58
+ "@backstage/dev-utils": "^0.2.18-next.0",
59
+ "@backstage/test-utils": "^0.2.3-next.0",
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": "b315430f9dfcfa19ab0dd90f5b4ac6904938fba7"
72
+ "gitHead": "31184691d5a38cb78b091c8f7ad6db80604519a6"
74
73
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-0bbaf1ad.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-59179174.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-be2646c3.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-61a0b1ae.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-61a0b1ae.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,433 +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
- const { entity } = useEntity();
23
- const config = useApi(apiDocsConfigRef);
24
- const { getApiDefinitionWidget } = config;
25
- if (!entity) {
26
- return /* @__PURE__ */ React.createElement(Alert, {
27
- severity: "error"
28
- }, "Could not fetch the API");
29
- }
30
- const definitionWidget = getApiDefinitionWidget(entity);
31
- if (definitionWidget) {
32
- return /* @__PURE__ */ React.createElement(TabbedCard, {
33
- title: entity.metadata.name
34
- }, /* @__PURE__ */ React.createElement(CardTab, {
35
- label: definitionWidget.title,
36
- key: "widget"
37
- }, definitionWidget.component(entity.spec.definition)), /* @__PURE__ */ React.createElement(CardTab, {
38
- label: "Raw",
39
- key: "raw"
40
- }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
41
- definition: entity.spec.definition,
42
- language: definitionWidget.rawLanguage || entity.spec.type
43
- })));
44
- }
45
- return /* @__PURE__ */ React.createElement(TabbedCard, {
46
- title: entity.metadata.name,
47
- children: [
48
- /* @__PURE__ */ React.createElement(CardTab, {
49
- label: entity.spec.type,
50
- key: "raw"
51
- }, /* @__PURE__ */ React.createElement(PlainApiDefinitionWidget, {
52
- definition: entity.spec.definition,
53
- language: entity.spec.type
54
- }))
55
- ]
56
- });
57
- };
58
-
59
- const LazyAsyncApiDefinition = React.lazy(() => import('./AsyncApiDefinition-c39ae15d.esm.js').then((m) => ({
60
- default: m.AsyncApiDefinition
61
- })));
62
- const AsyncApiDefinitionWidget = (props) => {
63
- return /* @__PURE__ */ React.createElement(Suspense, {
64
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
65
- }, /* @__PURE__ */ React.createElement(LazyAsyncApiDefinition, {
66
- ...props
67
- }));
68
- };
69
-
70
- const LazyGraphQlDefinition = React.lazy(() => import('./GraphQlDefinition-fa85d425.esm.js').then((m) => ({
71
- default: m.GraphQlDefinition
72
- })));
73
- const GraphQlDefinitionWidget = (props) => {
74
- return /* @__PURE__ */ React.createElement(Suspense, {
75
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
76
- }, /* @__PURE__ */ React.createElement(LazyGraphQlDefinition, {
77
- ...props
78
- }));
79
- };
80
-
81
- const LazyOpenApiDefinition = React.lazy(() => import('./OpenApiDefinition-48ae3040.esm.js').then((m) => ({
82
- default: m.OpenApiDefinition
83
- })));
84
- const OpenApiDefinitionWidget = (props) => {
85
- return /* @__PURE__ */ React.createElement(Suspense, {
86
- fallback: /* @__PURE__ */ React.createElement(Progress, null)
87
- }, /* @__PURE__ */ React.createElement(LazyOpenApiDefinition, {
88
- ...props
89
- }));
90
- };
91
-
92
- function defaultDefinitionWidgets() {
93
- return [
94
- {
95
- type: "openapi",
96
- title: "OpenAPI",
97
- rawLanguage: "yaml",
98
- component: (definition) => /* @__PURE__ */ React.createElement(OpenApiDefinitionWidget, {
99
- definition
100
- })
101
- },
102
- {
103
- type: "asyncapi",
104
- title: "AsyncAPI",
105
- rawLanguage: "yaml",
106
- component: (definition) => /* @__PURE__ */ React.createElement(AsyncApiDefinitionWidget, {
107
- definition
108
- })
109
- },
110
- {
111
- type: "graphql",
112
- title: "GraphQL",
113
- rawLanguage: "graphql",
114
- component: (definition) => /* @__PURE__ */ React.createElement(GraphQlDefinitionWidget, {
115
- definition
116
- })
117
- }
118
- ];
119
- }
120
-
121
- const ApiTypeTitle = ({ apiEntity }) => {
122
- const config = useApi(apiDocsConfigRef);
123
- const definition = config.getApiDefinitionWidget(apiEntity);
124
- const type = definition ? definition.title : apiEntity.spec.type;
125
- return /* @__PURE__ */ React.createElement("span", null, type);
126
- };
127
-
128
- function createSpecApiTypeColumn() {
129
- return {
130
- title: "Type",
131
- field: "spec.type",
132
- render: (entity) => /* @__PURE__ */ React.createElement(ApiTypeTitle, {
133
- apiEntity: entity
134
- })
135
- };
136
- }
137
- const apiEntityColumns = [
138
- EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
139
- EntityTable.columns.createSystemColumn(),
140
- EntityTable.columns.createOwnerColumn(),
141
- createSpecApiTypeColumn(),
142
- EntityTable.columns.createSpecLifecycleColumn(),
143
- EntityTable.columns.createMetadataDescriptionColumn()
144
- ];
145
-
146
- const ConsumedApisCard = ({ variant = "gridItem" }) => {
147
- const { entity } = useEntity();
148
- const { entities, loading, error } = useRelatedEntities(entity, {
149
- type: RELATION_CONSUMES_API
150
- });
151
- if (loading) {
152
- return /* @__PURE__ */ React.createElement(InfoCard, {
153
- variant,
154
- title: "Consumed APIs"
155
- }, /* @__PURE__ */ React.createElement(Progress, null));
156
- }
157
- if (error || !entities) {
158
- return /* @__PURE__ */ React.createElement(InfoCard, {
159
- variant,
160
- title: "Consumed APIs"
161
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
162
- severity: "error",
163
- title: "Could not load APIs",
164
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
165
- text: `${error}`,
166
- language: "text"
167
- })
168
- }));
169
- }
170
- return /* @__PURE__ */ React.createElement(EntityTable, {
171
- title: "Consumed APIs",
172
- variant,
173
- emptyContent: /* @__PURE__ */ React.createElement("div", {
174
- style: { textAlign: "center" }
175
- }, /* @__PURE__ */ React.createElement(Typography, {
176
- variant: "body1"
177
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography, {
178
- variant: "body2"
179
- }, /* @__PURE__ */ React.createElement(Link, {
180
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
181
- }, "Learn how to change this."))),
182
- columns: apiEntityColumns,
183
- entities
184
- });
185
- };
186
-
187
- const columns = [
188
- EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
189
- EntityTable.columns.createOwnerColumn(),
190
- createSpecApiTypeColumn(),
191
- EntityTable.columns.createSpecLifecycleColumn(),
192
- EntityTable.columns.createMetadataDescriptionColumn()
193
- ];
194
- const HasApisCard = ({ variant = "gridItem" }) => {
195
- const { entity } = useEntity();
196
- const { entities, loading, error } = useRelatedEntities(entity, {
197
- type: RELATION_HAS_PART,
198
- kind: "API"
199
- });
200
- if (loading) {
201
- return /* @__PURE__ */ React.createElement(InfoCard, {
202
- variant,
203
- title: "APIs"
204
- }, /* @__PURE__ */ React.createElement(Progress, null));
205
- }
206
- if (error || !entities) {
207
- return /* @__PURE__ */ React.createElement(InfoCard, {
208
- variant,
209
- title: "APIs"
210
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
211
- severity: "error",
212
- title: "Could not load APIs",
213
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
214
- text: `${error}`,
215
- language: "text"
216
- })
217
- }));
218
- }
219
- return /* @__PURE__ */ React.createElement(EntityTable, {
220
- title: "APIs",
221
- variant,
222
- emptyContent: /* @__PURE__ */ React.createElement("div", {
223
- style: { textAlign: "center" }
224
- }, /* @__PURE__ */ React.createElement(Typography, {
225
- variant: "body1"
226
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography, {
227
- variant: "body2"
228
- }, /* @__PURE__ */ React.createElement(Link, {
229
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api"
230
- }, "Learn how to change this."))),
231
- columns,
232
- entities
233
- });
234
- };
235
-
236
- const ProvidedApisCard = ({ variant = "gridItem" }) => {
237
- const { entity } = useEntity();
238
- const { entities, loading, error } = useRelatedEntities(entity, {
239
- type: RELATION_PROVIDES_API
240
- });
241
- if (loading) {
242
- return /* @__PURE__ */ React.createElement(InfoCard, {
243
- variant,
244
- title: "Provided APIs"
245
- }, /* @__PURE__ */ React.createElement(Progress, null));
246
- }
247
- if (error || !entities) {
248
- return /* @__PURE__ */ React.createElement(InfoCard, {
249
- variant,
250
- title: "Provided APIs"
251
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
252
- severity: "error",
253
- title: "Could not load APIs",
254
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
255
- text: `${error}`,
256
- language: "text"
257
- })
258
- }));
259
- }
260
- return /* @__PURE__ */ React.createElement(EntityTable, {
261
- title: "Provided APIs",
262
- variant,
263
- emptyContent: /* @__PURE__ */ React.createElement("div", {
264
- style: { textAlign: "center" }
265
- }, /* @__PURE__ */ React.createElement(Typography, {
266
- variant: "body1"
267
- }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography, {
268
- variant: "body2"
269
- }, /* @__PURE__ */ React.createElement(Link, {
270
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
271
- }, "Learn how to change this."))),
272
- columns: apiEntityColumns,
273
- entities
274
- });
275
- };
276
-
277
- const ConsumingComponentsCard = ({ variant = "gridItem" }) => {
278
- const { entity } = useEntity();
279
- const { entities, loading, error } = useRelatedEntities(entity, {
280
- type: RELATION_API_CONSUMED_BY
281
- });
282
- if (loading) {
283
- return /* @__PURE__ */ React.createElement(InfoCard, {
284
- variant,
285
- title: "Consumers"
286
- }, /* @__PURE__ */ React.createElement(Progress, null));
287
- }
288
- if (error || !entities) {
289
- return /* @__PURE__ */ React.createElement(InfoCard, {
290
- variant,
291
- title: "Consumers"
292
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
293
- severity: "error",
294
- title: "Could not load components",
295
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
296
- text: `${error}`,
297
- language: "text"
298
- })
299
- }));
300
- }
301
- return /* @__PURE__ */ React.createElement(EntityTable, {
302
- title: "Consumers",
303
- variant,
304
- emptyContent: /* @__PURE__ */ React.createElement("div", {
305
- style: { textAlign: "center" }
306
- }, /* @__PURE__ */ React.createElement(Typography, {
307
- variant: "body1"
308
- }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, {
309
- variant: "body2"
310
- }, /* @__PURE__ */ React.createElement(Link, {
311
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional"
312
- }, "Learn how to change this."))),
313
- columns: EntityTable.componentEntityColumns,
314
- entities
315
- });
316
- };
317
-
318
- const ProvidingComponentsCard = ({ variant = "gridItem" }) => {
319
- const { entity } = useEntity();
320
- const { entities, loading, error } = useRelatedEntities(entity, {
321
- type: RELATION_API_PROVIDED_BY
322
- });
323
- if (loading) {
324
- return /* @__PURE__ */ React.createElement(InfoCard, {
325
- variant,
326
- title: "Providers"
327
- }, /* @__PURE__ */ React.createElement(Progress, null));
328
- }
329
- if (error || !entities) {
330
- return /* @__PURE__ */ React.createElement(InfoCard, {
331
- variant,
332
- title: "Providers"
333
- }, /* @__PURE__ */ React.createElement(WarningPanel, {
334
- severity: "error",
335
- title: "Could not load components",
336
- message: /* @__PURE__ */ React.createElement(CodeSnippet, {
337
- text: `${error}`,
338
- language: "text"
339
- })
340
- }));
341
- }
342
- return /* @__PURE__ */ React.createElement(EntityTable, {
343
- title: "Providers",
344
- variant,
345
- emptyContent: /* @__PURE__ */ React.createElement("div", {
346
- style: { textAlign: "center" }
347
- }, /* @__PURE__ */ React.createElement(Typography, {
348
- variant: "body1"
349
- }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, {
350
- variant: "body2"
351
- }, /* @__PURE__ */ React.createElement(Link, {
352
- to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional"
353
- }, "Learn how to change this."))),
354
- columns: EntityTable.componentEntityColumns,
355
- entities
356
- });
357
- };
358
-
359
- const rootRoute = createRouteRef({
360
- id: "api-docs"
361
- });
362
- const createComponentRouteRef = createExternalRouteRef({
363
- id: "create-component",
364
- optional: true
365
- });
366
-
367
- const apiDocsPlugin = createPlugin({
368
- id: "api-docs",
369
- routes: {
370
- root: rootRoute
371
- },
372
- apis: [
373
- createApiFactory({
374
- api: apiDocsConfigRef,
375
- deps: {},
376
- factory: () => {
377
- const definitionWidgets = defaultDefinitionWidgets();
378
- return {
379
- getApiDefinitionWidget: (apiEntity) => {
380
- return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
381
- }
382
- };
383
- }
384
- })
385
- ],
386
- externalRoutes: {
387
- createComponent: createComponentRouteRef
388
- }
389
- });
390
- const ApiExplorerPage = apiDocsPlugin.provide(createRoutableExtension({
391
- name: "ApiExplorerPage",
392
- component: () => import('./index-61a0b1ae.esm.js').then((m) => m.ApiExplorerPage),
393
- mountPoint: rootRoute
394
- }));
395
- const EntityApiDefinitionCard = apiDocsPlugin.provide(createComponentExtension({
396
- name: "EntityApiDefinitionCard",
397
- component: {
398
- lazy: () => import('./index-dce83687.esm.js').then((m) => m.ApiDefinitionCard)
399
- }
400
- }));
401
- const EntityConsumedApisCard = apiDocsPlugin.provide(createComponentExtension({
402
- name: "EntityConsumedApisCard",
403
- component: {
404
- lazy: () => import('./index-0bbaf1ad.esm.js').then((m) => m.ConsumedApisCard)
405
- }
406
- }));
407
- const EntityConsumingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
408
- name: "EntityConsumingComponentsCard",
409
- component: {
410
- lazy: () => import('./index-59179174.esm.js').then((m) => m.ConsumingComponentsCard)
411
- }
412
- }));
413
- const EntityProvidedApisCard = apiDocsPlugin.provide(createComponentExtension({
414
- name: "EntityProvidedApisCard",
415
- component: {
416
- lazy: () => import('./index-0bbaf1ad.esm.js').then((m) => m.ProvidedApisCard)
417
- }
418
- }));
419
- const EntityProvidingComponentsCard = apiDocsPlugin.provide(createComponentExtension({
420
- name: "EntityProvidingComponentsCard",
421
- component: {
422
- lazy: () => import('./index-59179174.esm.js').then((m) => m.ProvidingComponentsCard)
423
- }
424
- }));
425
- const EntityHasApisCard = apiDocsPlugin.provide(createComponentExtension({
426
- name: "EntityHasApisCard",
427
- component: {
428
- lazy: () => import('./index-0bbaf1ad.esm.js').then((m) => m.HasApisCard)
429
- }
430
- }));
431
-
432
- 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 };
433
- //# sourceMappingURL=index-be2646c3.esm.js.map