@backstage/plugin-api-docs 0.10.4-next.2 → 0.11.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 +45 -0
- package/README.md +4 -1
- package/alpha/package.json +7 -0
- package/dist/alpha.d.ts +9 -0
- package/dist/alpha.esm.js +169 -0
- package/dist/alpha.esm.js.map +1 -0
- package/dist/esm/ApiDefinitionCard-504c2432.esm.js +47 -0
- package/dist/esm/ApiDefinitionCard-504c2432.esm.js.map +1 -0
- package/dist/esm/ApiDefinitionWidget-798ee85f.esm.js +116 -0
- package/dist/esm/ApiDefinitionWidget-798ee85f.esm.js.map +1 -0
- package/dist/esm/ApiExplorerPage-ce544a95.esm.js +60 -0
- package/dist/esm/ApiExplorerPage-ce544a95.esm.js.map +1 -0
- package/dist/esm/ApiTypeTitle-cc79a2f3.esm.js +27 -0
- package/dist/esm/ApiTypeTitle-cc79a2f3.esm.js.map +1 -0
- package/dist/esm/ProvidedApisCard-e92fbd29.esm.js +256 -0
- package/dist/esm/ProvidedApisCard-e92fbd29.esm.js.map +1 -0
- package/dist/esm/ProvidingComponentsCard-5b679445.esm.js +70 -0
- package/dist/esm/ProvidingComponentsCard-5b679445.esm.js.map +1 -0
- package/dist/esm/{index-3c5f9414.esm.js → index-435dfc01.esm.js} +4 -8
- package/dist/esm/index-435dfc01.esm.js.map +1 -0
- package/dist/esm/{index-3d17238a.esm.js → index-5f0727eb.esm.js} +9 -11
- package/dist/esm/index-5f0727eb.esm.js.map +1 -0
- package/dist/esm/index-6f21bd2e.esm.js +11 -0
- package/dist/esm/index-6f21bd2e.esm.js.map +1 -0
- package/dist/esm/index-c969ed3d.esm.js +7 -0
- package/dist/esm/index-c969ed3d.esm.js.map +1 -0
- package/dist/index.esm.js +29 -539
- package/dist/index.esm.js.map +1 -1
- package/package.json +32 -18
- package/dist/esm/index-1081c12a.esm.js +0 -16
- package/dist/esm/index-1081c12a.esm.js.map +0 -1
- package/dist/esm/index-3c5f9414.esm.js.map +0 -1
- package/dist/esm/index-3d17238a.esm.js.map +0 -1
- package/dist/esm/index-ca71e2a1.esm.js +0 -16
- package/dist/esm/index-ca71e2a1.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,534 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const defaultColumns = [
|
|
25
|
-
CatalogTable.columns.createTitleColumn({ hidden: true }),
|
|
26
|
-
CatalogTable.columns.createNameColumn({ defaultKind: "API" }),
|
|
27
|
-
CatalogTable.columns.createSystemColumn(),
|
|
28
|
-
CatalogTable.columns.createOwnerColumn(),
|
|
29
|
-
CatalogTable.columns.createSpecTypeColumn(),
|
|
30
|
-
CatalogTable.columns.createSpecLifecycleColumn(),
|
|
31
|
-
CatalogTable.columns.createMetadataDescriptionColumn(),
|
|
32
|
-
CatalogTable.columns.createTagsColumn()
|
|
33
|
-
];
|
|
34
|
-
const DefaultApiExplorerPage = (props) => {
|
|
35
|
-
var _a;
|
|
36
|
-
const { initiallySelectedFilter = "all", columns, actions } = props;
|
|
37
|
-
const configApi = useApi(configApiRef);
|
|
38
|
-
const generatedSubtitle = `${(_a = configApi.getOptionalString("organization.name")) != null ? _a : "Backstage"} API Explorer`;
|
|
39
|
-
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
40
|
-
const { allowed } = usePermission({
|
|
41
|
-
permission: catalogEntityCreatePermission
|
|
42
|
-
});
|
|
43
|
-
return /* @__PURE__ */ React.createElement(
|
|
44
|
-
PageWithHeader,
|
|
45
|
-
{
|
|
46
|
-
themeId: "apis",
|
|
47
|
-
title: "APIs",
|
|
48
|
-
subtitle: generatedSubtitle,
|
|
49
|
-
pageTitleOverride: "APIs"
|
|
50
|
-
},
|
|
51
|
-
/* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "" }, allowed && /* @__PURE__ */ React.createElement(
|
|
52
|
-
CreateButton,
|
|
53
|
-
{
|
|
54
|
-
title: "Register Existing API",
|
|
55
|
-
to: registerComponentLink == null ? void 0 : registerComponentLink()
|
|
56
|
-
}
|
|
57
|
-
), /* @__PURE__ */ React.createElement(SupportButton, null, "All your APIs")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(EntityKindPicker, { initialFilter: "api", hidden: true }), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, { initialFilter: initiallySelectedFilter }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, null), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
|
|
58
|
-
CatalogTable,
|
|
59
|
-
{
|
|
60
|
-
columns: columns || defaultColumns,
|
|
61
|
-
actions
|
|
62
|
-
}
|
|
63
|
-
)))))
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const ApiExplorerPage$1 = (props) => {
|
|
68
|
-
const outlet = useOutlet();
|
|
69
|
-
return outlet || /* @__PURE__ */ React.createElement(DefaultApiExplorerPage, { ...props });
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const apiDocsConfigRef = createApiRef({
|
|
73
|
-
id: "plugin.api-docs.config"
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const PlainApiDefinitionWidget = (props) => {
|
|
77
|
-
return /* @__PURE__ */ React.createElement(
|
|
78
|
-
CodeSnippet,
|
|
79
|
-
{
|
|
80
|
-
text: props.definition,
|
|
81
|
-
language: props.language,
|
|
82
|
-
showCopyCodeButton: true
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const ApiDefinitionCard = () => {
|
|
88
|
-
var _a;
|
|
89
|
-
const { entity } = useEntity();
|
|
90
|
-
const config = useApi(apiDocsConfigRef);
|
|
91
|
-
const { getApiDefinitionWidget } = config;
|
|
92
|
-
if (!entity) {
|
|
93
|
-
return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Could not fetch the API");
|
|
94
|
-
}
|
|
95
|
-
const definitionWidget = getApiDefinitionWidget(entity);
|
|
96
|
-
const entityTitle = (_a = entity.metadata.title) != null ? _a : entity.metadata.name;
|
|
97
|
-
if (definitionWidget) {
|
|
98
|
-
return /* @__PURE__ */ React.createElement(TabbedCard, { title: entityTitle }, /* @__PURE__ */ React.createElement(CardTab, { label: definitionWidget.title, key: "widget" }, definitionWidget.component(entity.spec.definition)), /* @__PURE__ */ React.createElement(CardTab, { label: "Raw", key: "raw" }, /* @__PURE__ */ React.createElement(
|
|
99
|
-
PlainApiDefinitionWidget,
|
|
100
|
-
{
|
|
101
|
-
definition: entity.spec.definition,
|
|
102
|
-
language: definitionWidget.rawLanguage || entity.spec.type
|
|
103
|
-
}
|
|
104
|
-
)));
|
|
105
|
-
}
|
|
106
|
-
return /* @__PURE__ */ React.createElement(
|
|
107
|
-
TabbedCard,
|
|
108
|
-
{
|
|
109
|
-
title: entityTitle,
|
|
110
|
-
children: [
|
|
111
|
-
// Has to be an array, otherwise typescript doesn't like that this has only a single child
|
|
112
|
-
/* @__PURE__ */ React.createElement(CardTab, { label: entity.spec.type, key: "raw" }, /* @__PURE__ */ React.createElement(
|
|
113
|
-
PlainApiDefinitionWidget,
|
|
114
|
-
{
|
|
115
|
-
definition: entity.spec.definition,
|
|
116
|
-
language: entity.spec.type
|
|
117
|
-
}
|
|
118
|
-
))
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const LazyAsyncApiDefinition = React.lazy(
|
|
125
|
-
() => import('./esm/AsyncApiDefinition-ffed9c50.esm.js').then((m) => ({
|
|
126
|
-
default: m.AsyncApiDefinition
|
|
127
|
-
}))
|
|
128
|
-
);
|
|
129
|
-
const AsyncApiDefinitionWidget = (props) => {
|
|
130
|
-
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(LazyAsyncApiDefinition, { ...props }));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const LazyGraphQlDefinition = React.lazy(
|
|
134
|
-
() => import('./esm/GraphQlDefinition-49cc2c3b.esm.js').then((m) => ({
|
|
135
|
-
default: m.GraphQlDefinition
|
|
136
|
-
}))
|
|
137
|
-
);
|
|
138
|
-
const GraphQlDefinitionWidget = (props) => {
|
|
139
|
-
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(LazyGraphQlDefinition, { ...props }));
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const LazyOpenApiDefinition = React.lazy(
|
|
143
|
-
() => import('./esm/OpenApiDefinition-20ae2e8c.esm.js').then((m) => ({
|
|
144
|
-
default: m.OpenApiDefinition
|
|
145
|
-
}))
|
|
146
|
-
);
|
|
147
|
-
const OpenApiDefinitionWidget = (props) => {
|
|
148
|
-
var _a;
|
|
149
|
-
const validSubmitMethods = (_a = props.supportedSubmitMethods) == null ? void 0 : _a.map(
|
|
150
|
-
(method) => method.toLocaleLowerCase()
|
|
151
|
-
);
|
|
152
|
-
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(
|
|
153
|
-
LazyOpenApiDefinition,
|
|
154
|
-
{
|
|
155
|
-
...props,
|
|
156
|
-
supportedSubmitMethods: validSubmitMethods
|
|
157
|
-
}
|
|
158
|
-
));
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const GrpcApiDefinitionWidget = (props) => {
|
|
162
|
-
const theme = useTheme();
|
|
163
|
-
return /* @__PURE__ */ React.createElement(
|
|
164
|
-
CodeSnippet,
|
|
165
|
-
{
|
|
166
|
-
customStyle: { backgroundColor: theme.palette.background.default },
|
|
167
|
-
text: props.definition,
|
|
168
|
-
language: "protobuf",
|
|
169
|
-
showCopyCodeButton: true
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const TrpcApiDefinitionWidget = (props) => {
|
|
175
|
-
const { definition } = props;
|
|
176
|
-
const theme = useTheme();
|
|
177
|
-
return /* @__PURE__ */ React.createElement(
|
|
178
|
-
CodeSnippet,
|
|
179
|
-
{
|
|
180
|
-
customStyle: { backgroundColor: theme.palette.background.default },
|
|
181
|
-
text: definition,
|
|
182
|
-
language: "typescript",
|
|
183
|
-
showCopyCodeButton: true
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
function defaultDefinitionWidgets() {
|
|
189
|
-
return [
|
|
190
|
-
{
|
|
191
|
-
type: "openapi",
|
|
192
|
-
title: "OpenAPI",
|
|
193
|
-
rawLanguage: "yaml",
|
|
194
|
-
component: (definition) => /* @__PURE__ */ React.createElement(OpenApiDefinitionWidget, { definition })
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
type: "asyncapi",
|
|
198
|
-
title: "AsyncAPI",
|
|
199
|
-
rawLanguage: "yaml",
|
|
200
|
-
component: (definition) => /* @__PURE__ */ React.createElement(AsyncApiDefinitionWidget, { definition })
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
type: "graphql",
|
|
204
|
-
title: "GraphQL",
|
|
205
|
-
rawLanguage: "graphql",
|
|
206
|
-
component: (definition) => /* @__PURE__ */ React.createElement(GraphQlDefinitionWidget, { definition })
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
type: "grpc",
|
|
210
|
-
title: "gRPC",
|
|
211
|
-
component: (definition) => /* @__PURE__ */ React.createElement(GrpcApiDefinitionWidget, { definition })
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
type: "trpc",
|
|
215
|
-
title: "tRPC",
|
|
216
|
-
component: (definition) => /* @__PURE__ */ React.createElement(TrpcApiDefinitionWidget, { definition })
|
|
217
|
-
}
|
|
218
|
-
];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const ApiTypeTitle = (props) => {
|
|
222
|
-
const { apiEntity } = props;
|
|
223
|
-
const config = useApi(apiDocsConfigRef);
|
|
224
|
-
const definition = config.getApiDefinitionWidget(apiEntity);
|
|
225
|
-
const type = definition ? definition.title : apiEntity.spec.type;
|
|
226
|
-
return /* @__PURE__ */ React.createElement(Typography, { component: "span" }, type);
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const useStyles = makeStyles((theme) => ({
|
|
230
|
-
fullHeightDialog: {
|
|
231
|
-
height: "calc(100% - 64px)"
|
|
232
|
-
},
|
|
233
|
-
root: {
|
|
234
|
-
display: "flex",
|
|
235
|
-
flexGrow: 1,
|
|
236
|
-
width: "100%",
|
|
237
|
-
height: "100%"
|
|
238
|
-
},
|
|
239
|
-
tabs: {
|
|
240
|
-
borderRight: `1px solid ${theme.palette.divider}`,
|
|
241
|
-
flexShrink: 0
|
|
242
|
-
},
|
|
243
|
-
tabContents: {
|
|
244
|
-
flexGrow: 1,
|
|
245
|
-
overflowX: "auto"
|
|
246
|
-
},
|
|
247
|
-
title: {
|
|
248
|
-
color: theme.palette.text.primary,
|
|
249
|
-
wordBreak: "break-word",
|
|
250
|
-
fontSize: theme.typography.h3.fontSize,
|
|
251
|
-
marginBottom: 0
|
|
252
|
-
},
|
|
253
|
-
type: {
|
|
254
|
-
textTransform: "uppercase",
|
|
255
|
-
fontSize: 11,
|
|
256
|
-
opacity: 0.8,
|
|
257
|
-
marginBottom: theme.spacing(1),
|
|
258
|
-
color: theme.palette.text.primary
|
|
259
|
-
}
|
|
260
|
-
}));
|
|
261
|
-
function TabPanel(props) {
|
|
262
|
-
const { children, value, index, ...other } = props;
|
|
263
|
-
const classes = useStyles();
|
|
264
|
-
return /* @__PURE__ */ React.createElement(
|
|
265
|
-
"div",
|
|
266
|
-
{
|
|
267
|
-
role: "tabpanel",
|
|
268
|
-
hidden: value !== index,
|
|
269
|
-
id: `vertical-tabpanel-${index}`,
|
|
270
|
-
"aria-labelledby": `vertical-tab-${index}`,
|
|
271
|
-
className: classes.tabContents,
|
|
272
|
-
...other
|
|
273
|
-
},
|
|
274
|
-
value === index && /* @__PURE__ */ React.createElement(Box, { pl: 3, pr: 3 }, children)
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
function a11yProps(index) {
|
|
278
|
-
return {
|
|
279
|
-
id: `vertical-tab-${index}`,
|
|
280
|
-
"aria-controls": `vertical-tabpanel-${index}`
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
function ApiDefinitionDialog(props) {
|
|
284
|
-
var _a, _b, _c;
|
|
285
|
-
const { open, entity, onClose } = props;
|
|
286
|
-
const [activeTab, setActiveTab] = React.useState(0);
|
|
287
|
-
const classes = useStyles();
|
|
288
|
-
useEffect(() => {
|
|
289
|
-
setActiveTab(0);
|
|
290
|
-
}, [open]);
|
|
291
|
-
const config = useApi(apiDocsConfigRef);
|
|
292
|
-
const definitionWidget = config.getApiDefinitionWidget(entity);
|
|
293
|
-
let tabIndex = 0;
|
|
294
|
-
let tabPanelIndex = 0;
|
|
295
|
-
return /* @__PURE__ */ React.createElement(
|
|
296
|
-
Dialog,
|
|
297
|
-
{
|
|
298
|
-
fullWidth: true,
|
|
299
|
-
maxWidth: "xl",
|
|
300
|
-
open,
|
|
301
|
-
onClose,
|
|
302
|
-
"aria-labelledby": "api-definition-dialog-title",
|
|
303
|
-
PaperProps: { className: classes.fullHeightDialog }
|
|
304
|
-
},
|
|
305
|
-
/* @__PURE__ */ React.createElement(DialogTitle, { id: "api-definition-dialog-title", disableTypography: true }, /* @__PURE__ */ React.createElement(Typography$1, { className: classes.type }, "API - ", (_a = definitionWidget == null ? void 0 : definitionWidget.title) != null ? _a : "Raw"), /* @__PURE__ */ React.createElement(Typography$1, { className: classes.title, variant: "h1" }, (_b = entity.metadata.title) != null ? _b : entity.metadata.name)),
|
|
306
|
-
/* @__PURE__ */ React.createElement(DialogContent, { dividers: true, className: classes.root }, /* @__PURE__ */ React.createElement(
|
|
307
|
-
Tabs,
|
|
308
|
-
{
|
|
309
|
-
orientation: "vertical",
|
|
310
|
-
variant: "scrollable",
|
|
311
|
-
value: activeTab,
|
|
312
|
-
onChange: (_, newValue) => setActiveTab(newValue),
|
|
313
|
-
"aria-label": "API definition options",
|
|
314
|
-
className: classes.tabs
|
|
315
|
-
},
|
|
316
|
-
definitionWidget ? /* @__PURE__ */ React.createElement(Tab, { label: definitionWidget.title, ...a11yProps(tabIndex++) }) : null,
|
|
317
|
-
/* @__PURE__ */ React.createElement(Tab, { label: "Raw", ...a11yProps(tabIndex++) })
|
|
318
|
-
), definitionWidget ? /* @__PURE__ */ React.createElement(TabPanel, { value: activeTab, index: tabPanelIndex++ }, definitionWidget.component(entity.spec.definition)) : null, /* @__PURE__ */ React.createElement(TabPanel, { value: activeTab, index: tabPanelIndex++ }, /* @__PURE__ */ React.createElement(
|
|
319
|
-
PlainApiDefinitionWidget,
|
|
320
|
-
{
|
|
321
|
-
definition: entity.spec.definition,
|
|
322
|
-
language: (_c = definitionWidget == null ? void 0 : definitionWidget.rawLanguage) != null ? _c : entity.spec.type
|
|
323
|
-
}
|
|
324
|
-
))),
|
|
325
|
-
/* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { onClick: onClose, color: "primary" }, "Close"))
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function createSpecApiTypeColumn() {
|
|
330
|
-
return {
|
|
331
|
-
title: "Type",
|
|
332
|
-
field: "spec.type",
|
|
333
|
-
render: (entity) => /* @__PURE__ */ React.createElement(ApiTypeTitle, { apiEntity: entity })
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
const ApiDefinitionButton = ({ apiEntity }) => {
|
|
337
|
-
const [dialogOpen, setDialogOpen] = useState(false);
|
|
338
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
339
|
-
ToggleButton,
|
|
340
|
-
{
|
|
341
|
-
"aria-label": "Toggle API Definition Dialog",
|
|
342
|
-
onClick: () => setDialogOpen(!dialogOpen)
|
|
343
|
-
},
|
|
344
|
-
/* @__PURE__ */ React.createElement(ExtensionIcon, null)
|
|
345
|
-
), /* @__PURE__ */ React.createElement(
|
|
346
|
-
ApiDefinitionDialog,
|
|
347
|
-
{
|
|
348
|
-
entity: apiEntity,
|
|
349
|
-
open: dialogOpen,
|
|
350
|
-
onClose: () => setDialogOpen(false)
|
|
351
|
-
}
|
|
352
|
-
));
|
|
353
|
-
};
|
|
354
|
-
function createApiDefinitionColumn() {
|
|
355
|
-
return {
|
|
356
|
-
title: "API Definition",
|
|
357
|
-
render: (entity) => /* @__PURE__ */ React.createElement(ApiDefinitionButton, { apiEntity: entity })
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
const apiEntityColumns = [
|
|
361
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
362
|
-
EntityTable.columns.createSystemColumn(),
|
|
363
|
-
EntityTable.columns.createOwnerColumn(),
|
|
364
|
-
createSpecApiTypeColumn(),
|
|
365
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
366
|
-
EntityTable.columns.createMetadataDescriptionColumn(),
|
|
367
|
-
createApiDefinitionColumn()
|
|
368
|
-
];
|
|
369
|
-
|
|
370
|
-
const ConsumedApisCard = (props) => {
|
|
371
|
-
const { variant = "gridItem", columns = apiEntityColumns } = props;
|
|
372
|
-
const { entity } = useEntity();
|
|
373
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
374
|
-
type: RELATION_CONSUMES_API
|
|
375
|
-
});
|
|
376
|
-
if (loading) {
|
|
377
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumed APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
378
|
-
}
|
|
379
|
-
if (error || !entities) {
|
|
380
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumed APIs" }, /* @__PURE__ */ React.createElement(
|
|
381
|
-
WarningPanel,
|
|
382
|
-
{
|
|
383
|
-
severity: "error",
|
|
384
|
-
title: "Could not load APIs",
|
|
385
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, { text: `${error}`, language: "text" })
|
|
386
|
-
}
|
|
387
|
-
));
|
|
388
|
-
}
|
|
389
|
-
return /* @__PURE__ */ React.createElement(
|
|
390
|
-
EntityTable,
|
|
391
|
-
{
|
|
392
|
-
title: "Consumed APIs",
|
|
393
|
-
variant,
|
|
394
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography$1, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
|
|
395
|
-
columns,
|
|
396
|
-
entities
|
|
397
|
-
}
|
|
398
|
-
);
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
const presetColumns = [
|
|
402
|
-
EntityTable.columns.createEntityRefColumn({ defaultKind: "API" }),
|
|
403
|
-
EntityTable.columns.createOwnerColumn(),
|
|
404
|
-
createSpecApiTypeColumn(),
|
|
405
|
-
EntityTable.columns.createSpecLifecycleColumn(),
|
|
406
|
-
EntityTable.columns.createMetadataDescriptionColumn()
|
|
407
|
-
];
|
|
408
|
-
const HasApisCard = (props) => {
|
|
409
|
-
const { variant = "gridItem", columns = presetColumns } = props;
|
|
410
|
-
const { entity } = useEntity();
|
|
411
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
412
|
-
type: RELATION_HAS_PART,
|
|
413
|
-
kind: "API"
|
|
414
|
-
});
|
|
415
|
-
if (loading) {
|
|
416
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
417
|
-
}
|
|
418
|
-
if (error || !entities) {
|
|
419
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "APIs" }, /* @__PURE__ */ React.createElement(
|
|
420
|
-
WarningPanel,
|
|
421
|
-
{
|
|
422
|
-
severity: "error",
|
|
423
|
-
title: "Could not load APIs",
|
|
424
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, { text: `${error}`, language: "text" })
|
|
425
|
-
}
|
|
426
|
-
));
|
|
427
|
-
}
|
|
428
|
-
return /* @__PURE__ */ React.createElement(
|
|
429
|
-
EntityTable,
|
|
430
|
-
{
|
|
431
|
-
title: "APIs",
|
|
432
|
-
variant,
|
|
433
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography$1, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api" }, "Learn how to change this."))),
|
|
434
|
-
columns,
|
|
435
|
-
entities
|
|
436
|
-
}
|
|
437
|
-
);
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
const ProvidedApisCard = (props) => {
|
|
441
|
-
const { variant = "gridItem", columns = apiEntityColumns } = props;
|
|
442
|
-
const { entity } = useEntity();
|
|
443
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
444
|
-
type: RELATION_PROVIDES_API
|
|
445
|
-
});
|
|
446
|
-
if (loading) {
|
|
447
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Provided APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
448
|
-
}
|
|
449
|
-
if (error || !entities) {
|
|
450
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Provided APIs" }, /* @__PURE__ */ React.createElement(
|
|
451
|
-
WarningPanel,
|
|
452
|
-
{
|
|
453
|
-
severity: "error",
|
|
454
|
-
title: "Could not load APIs",
|
|
455
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, { text: `${error}`, language: "text" })
|
|
456
|
-
}
|
|
457
|
-
));
|
|
458
|
-
}
|
|
459
|
-
return /* @__PURE__ */ React.createElement(
|
|
460
|
-
EntityTable,
|
|
461
|
-
{
|
|
462
|
-
title: "Provided APIs",
|
|
463
|
-
variant,
|
|
464
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography$1, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
|
|
465
|
-
columns,
|
|
466
|
-
entities
|
|
467
|
-
}
|
|
468
|
-
);
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
const ConsumingComponentsCard = (props) => {
|
|
472
|
-
const { variant = "gridItem" } = props;
|
|
473
|
-
const { entity } = useEntity();
|
|
474
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
475
|
-
type: RELATION_API_CONSUMED_BY
|
|
476
|
-
});
|
|
477
|
-
if (loading) {
|
|
478
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumers" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
479
|
-
}
|
|
480
|
-
if (error || !entities) {
|
|
481
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumers" }, /* @__PURE__ */ React.createElement(
|
|
482
|
-
WarningPanel,
|
|
483
|
-
{
|
|
484
|
-
severity: "error",
|
|
485
|
-
title: "Could not load components",
|
|
486
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, { text: `${error}`, language: "text" })
|
|
487
|
-
}
|
|
488
|
-
));
|
|
489
|
-
}
|
|
490
|
-
return /* @__PURE__ */ React.createElement(
|
|
491
|
-
EntityTable,
|
|
492
|
-
{
|
|
493
|
-
title: "Consumers",
|
|
494
|
-
variant,
|
|
495
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography$1, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
|
|
496
|
-
columns: EntityTable.componentEntityColumns,
|
|
497
|
-
entities
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
const ProvidingComponentsCard = (props) => {
|
|
503
|
-
const { variant = "gridItem" } = props;
|
|
504
|
-
const { entity } = useEntity();
|
|
505
|
-
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
506
|
-
type: RELATION_API_PROVIDED_BY
|
|
507
|
-
});
|
|
508
|
-
if (loading) {
|
|
509
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Providers" }, /* @__PURE__ */ React.createElement(Progress, null));
|
|
510
|
-
}
|
|
511
|
-
if (error || !entities) {
|
|
512
|
-
return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Providers" }, /* @__PURE__ */ React.createElement(
|
|
513
|
-
WarningPanel,
|
|
514
|
-
{
|
|
515
|
-
severity: "error",
|
|
516
|
-
title: "Could not load components",
|
|
517
|
-
message: /* @__PURE__ */ React.createElement(CodeSnippet, { text: `${error}`, language: "text" })
|
|
518
|
-
}
|
|
519
|
-
));
|
|
520
|
-
}
|
|
521
|
-
return /* @__PURE__ */ React.createElement(
|
|
522
|
-
EntityTable,
|
|
523
|
-
{
|
|
524
|
-
title: "Providers",
|
|
525
|
-
variant,
|
|
526
|
-
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography$1, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
|
|
527
|
-
columns: EntityTable.componentEntityColumns,
|
|
528
|
-
entities
|
|
529
|
-
}
|
|
530
|
-
);
|
|
531
|
-
};
|
|
1
|
+
export { A as ApiExplorerIndexPage, D as DefaultApiExplorerPage } from './esm/ApiExplorerPage-ce544a95.esm.js';
|
|
2
|
+
export { A as ApiDefinitionCard } from './esm/ApiDefinitionCard-504c2432.esm.js';
|
|
3
|
+
import { r as rootRoute, a as apiDocsConfigRef, b as registerComponentRouteRef, d as defaultDefinitionWidgets } from './esm/ApiDefinitionWidget-798ee85f.esm.js';
|
|
4
|
+
export { A as AsyncApiDefinitionWidget, G as GraphQlDefinitionWidget, O as OpenApiDefinitionWidget, T as TrpcApiDefinitionWidget, a as apiDocsConfigRef, d as defaultDefinitionWidgets } from './esm/ApiDefinitionWidget-798ee85f.esm.js';
|
|
5
|
+
export { A as ApiTypeTitle, P as PlainApiDefinitionWidget } from './esm/ApiTypeTitle-cc79a2f3.esm.js';
|
|
6
|
+
export { A as ApiDefinitionDialog, C as ConsumedApisCard, H as HasApisCard, P as ProvidedApisCard } from './esm/ProvidedApisCard-e92fbd29.esm.js';
|
|
7
|
+
export { C as ConsumingComponentsCard, P as ProvidingComponentsCard } from './esm/ProvidingComponentsCard-5b679445.esm.js';
|
|
8
|
+
import '@backstage/plugin-catalog-react';
|
|
9
|
+
import '@material-ui/lab';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@backstage/core-components';
|
|
12
|
+
import { createPlugin, createApiFactory, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
13
|
+
import '@material-ui/core/Typography';
|
|
14
|
+
import 'react-router-dom';
|
|
15
|
+
import '@backstage/plugin-catalog';
|
|
16
|
+
import '@backstage/plugin-permission-react';
|
|
17
|
+
import '@backstage/plugin-catalog-common/alpha';
|
|
18
|
+
import '@material-ui/core/styles';
|
|
19
|
+
import '@backstage/catalog-model';
|
|
20
|
+
import '@material-ui/core';
|
|
21
|
+
import '@material-ui/icons/Extension';
|
|
532
22
|
|
|
533
23
|
const apiDocsPlugin = createPlugin({
|
|
534
24
|
id: "api-docs",
|
|
@@ -556,7 +46,7 @@ const apiDocsPlugin = createPlugin({
|
|
|
556
46
|
const ApiExplorerPage = apiDocsPlugin.provide(
|
|
557
47
|
createRoutableExtension({
|
|
558
48
|
name: "ApiExplorerPage",
|
|
559
|
-
component: () => import('./esm/index-
|
|
49
|
+
component: () => import('./esm/index-435dfc01.esm.js').then((m) => m.ApiExplorerIndexPage),
|
|
560
50
|
mountPoint: rootRoute
|
|
561
51
|
})
|
|
562
52
|
);
|
|
@@ -564,7 +54,7 @@ const EntityApiDefinitionCard = apiDocsPlugin.provide(
|
|
|
564
54
|
createComponentExtension({
|
|
565
55
|
name: "EntityApiDefinitionCard",
|
|
566
56
|
component: {
|
|
567
|
-
lazy: () => import('./esm/index-
|
|
57
|
+
lazy: () => import('./esm/index-6f21bd2e.esm.js').then((m) => m.ApiDefinitionCard)
|
|
568
58
|
}
|
|
569
59
|
})
|
|
570
60
|
);
|
|
@@ -572,7 +62,7 @@ const EntityConsumedApisCard = apiDocsPlugin.provide(
|
|
|
572
62
|
createComponentExtension({
|
|
573
63
|
name: "EntityConsumedApisCard",
|
|
574
64
|
component: {
|
|
575
|
-
lazy: () => import('./esm/index-
|
|
65
|
+
lazy: () => import('./esm/index-5f0727eb.esm.js').then((m) => m.ConsumedApisCard)
|
|
576
66
|
}
|
|
577
67
|
})
|
|
578
68
|
);
|
|
@@ -580,7 +70,7 @@ const EntityConsumingComponentsCard = apiDocsPlugin.provide(
|
|
|
580
70
|
createComponentExtension({
|
|
581
71
|
name: "EntityConsumingComponentsCard",
|
|
582
72
|
component: {
|
|
583
|
-
lazy: () => import('./esm/index-
|
|
73
|
+
lazy: () => import('./esm/index-c969ed3d.esm.js').then(
|
|
584
74
|
(m) => m.ConsumingComponentsCard
|
|
585
75
|
)
|
|
586
76
|
}
|
|
@@ -590,7 +80,7 @@ const EntityProvidedApisCard = apiDocsPlugin.provide(
|
|
|
590
80
|
createComponentExtension({
|
|
591
81
|
name: "EntityProvidedApisCard",
|
|
592
82
|
component: {
|
|
593
|
-
lazy: () => import('./esm/index-
|
|
83
|
+
lazy: () => import('./esm/index-5f0727eb.esm.js').then((m) => m.ProvidedApisCard)
|
|
594
84
|
}
|
|
595
85
|
})
|
|
596
86
|
);
|
|
@@ -598,7 +88,7 @@ const EntityProvidingComponentsCard = apiDocsPlugin.provide(
|
|
|
598
88
|
createComponentExtension({
|
|
599
89
|
name: "EntityProvidingComponentsCard",
|
|
600
90
|
component: {
|
|
601
|
-
lazy: () => import('./esm/index-
|
|
91
|
+
lazy: () => import('./esm/index-c969ed3d.esm.js').then(
|
|
602
92
|
(m) => m.ProvidingComponentsCard
|
|
603
93
|
)
|
|
604
94
|
}
|
|
@@ -608,10 +98,10 @@ const EntityHasApisCard = apiDocsPlugin.provide(
|
|
|
608
98
|
createComponentExtension({
|
|
609
99
|
name: "EntityHasApisCard",
|
|
610
100
|
component: {
|
|
611
|
-
lazy: () => import('./esm/index-
|
|
101
|
+
lazy: () => import('./esm/index-5f0727eb.esm.js').then((m) => m.HasApisCard)
|
|
612
102
|
}
|
|
613
103
|
})
|
|
614
104
|
);
|
|
615
105
|
|
|
616
|
-
export {
|
|
106
|
+
export { ApiExplorerPage, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, apiDocsPlugin, apiDocsPlugin as plugin };
|
|
617
107
|
//# sourceMappingURL=index.esm.js.map
|