@backstage/plugin-api-docs 0.12.6-next.1 → 0.12.6-next.2
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 +19 -0
- package/dist/alpha.d.ts +10 -10
- package/dist/alpha.esm.js +14 -11
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiDefinitionCard.esm.js +15 -12
- package/dist/components/ApiDefinitionCard/ApiDefinitionCard.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiDefinitionWidget.esm.js +6 -6
- package/dist/components/ApiDefinitionCard/ApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/ApiDefinitionCard/ApiTypeTitle.esm.js +2 -2
- package/dist/components/ApiDefinitionCard/ApiTypeTitle.esm.js.map +1 -1
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js +45 -30
- package/dist/components/ApiDefinitionDialog/ApiDefinitionDialog.esm.js.map +1 -1
- package/dist/components/ApiExplorerPage/ApiExplorerPage.esm.js +2 -2
- package/dist/components/ApiExplorerPage/ApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js +33 -17
- package/dist/components/ApiExplorerPage/DefaultApiExplorerPage.esm.js.map +1 -1
- package/dist/components/ApisCards/ConsumedApisCard.esm.js +21 -14
- package/dist/components/ApisCards/ConsumedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/HasApisCard.esm.js +14 -7
- package/dist/components/ApisCards/HasApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/ProvidedApisCard.esm.js +21 -14
- package/dist/components/ApisCards/ProvidedApisCard.esm.js.map +1 -1
- package/dist/components/ApisCards/presets.esm.js +23 -19
- package/dist/components/ApisCards/presets.esm.js.map +1 -1
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinition.esm.js +2 -2
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinition.esm.js.map +1 -1
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.esm.js +4 -3
- package/dist/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js +10 -7
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js +10 -7
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js.map +1 -1
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinition.esm.js +6 -6
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinition.esm.js.map +1 -1
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.esm.js +4 -3
- package/dist/components/GraphQlDefinitionWidget/GraphQlDefinitionWidget.esm.js.map +1 -1
- package/dist/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.esm.js +2 -2
- package/dist/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinition.esm.js +4 -3
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinition.esm.js.map +1 -1
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js +5 -4
- package/dist/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js +2 -2
- package/dist/components/PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js.map +1 -1
- package/dist/components/TrpcDefinitionWidget/TrpcApiDefinitionWidget.esm.js +2 -2
- package/dist/components/TrpcDefinitionWidget/TrpcApiDefinitionWidget.esm.js.map +1 -1
- package/dist/index.d.ts +25 -25
- package/dist/plugin.esm.js +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage/plugin-api-docs
|
|
2
2
|
|
|
3
|
+
## 0.12.6-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
8
|
+
|
|
9
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-catalog@1.29.0-next.2
|
|
13
|
+
- @backstage/frontend-plugin-api@0.10.1-next.1
|
|
14
|
+
- @backstage/core-compat-api@0.4.1-next.2
|
|
15
|
+
- @backstage/core-components@0.17.1-next.1
|
|
16
|
+
- @backstage/core-plugin-api@1.10.6-next.0
|
|
17
|
+
- @backstage/plugin-permission-react@0.4.33-next.0
|
|
18
|
+
- @backstage/plugin-catalog-react@1.17.0-next.2
|
|
19
|
+
- @backstage/catalog-model@1.7.3
|
|
20
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
21
|
+
|
|
3
22
|
## 0.12.6-next.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
2
2
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
3
|
+
import * as react from 'react';
|
|
3
4
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
4
5
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
5
|
-
import React__default from 'react';
|
|
6
6
|
|
|
7
7
|
declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
8
8
|
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
@@ -31,7 +31,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
31
31
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
32
32
|
type?: "content" | "summary" | "info" | undefined;
|
|
33
33
|
};
|
|
34
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
34
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
35
35
|
optional: true;
|
|
36
36
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
37
37
|
optional: true;
|
|
@@ -56,7 +56,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
56
56
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
57
57
|
type?: "content" | "summary" | "info" | undefined;
|
|
58
58
|
};
|
|
59
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
59
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
60
60
|
optional: true;
|
|
61
61
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
62
62
|
optional: true;
|
|
@@ -81,7 +81,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
81
81
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
82
82
|
type?: "content" | "summary" | "info" | undefined;
|
|
83
83
|
};
|
|
84
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
84
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
85
85
|
optional: true;
|
|
86
86
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
87
87
|
optional: true;
|
|
@@ -106,7 +106,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
106
106
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
107
107
|
type?: "content" | "summary" | "info" | undefined;
|
|
108
108
|
};
|
|
109
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
109
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
110
110
|
optional: true;
|
|
111
111
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
112
112
|
optional: true;
|
|
@@ -131,7 +131,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
131
131
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
132
132
|
type?: "content" | "summary" | "info" | undefined;
|
|
133
133
|
};
|
|
134
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
134
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
135
135
|
optional: true;
|
|
136
136
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
137
137
|
optional: true;
|
|
@@ -156,7 +156,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
156
156
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
157
157
|
type?: "content" | "summary" | "info" | undefined;
|
|
158
158
|
};
|
|
159
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
159
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
160
160
|
optional: true;
|
|
161
161
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
162
162
|
optional: true;
|
|
@@ -185,7 +185,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
185
185
|
path?: string | undefined;
|
|
186
186
|
group?: string | false | undefined;
|
|
187
187
|
};
|
|
188
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
188
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
189
189
|
optional: true;
|
|
190
190
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
191
191
|
optional: true;
|
|
@@ -219,7 +219,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
219
219
|
path?: string | undefined;
|
|
220
220
|
group?: string | false | undefined;
|
|
221
221
|
};
|
|
222
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
222
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
223
223
|
optional: true;
|
|
224
224
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
225
225
|
optional: true;
|
|
@@ -266,7 +266,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
|
266
266
|
} & {
|
|
267
267
|
path?: string | undefined;
|
|
268
268
|
};
|
|
269
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
269
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
270
270
|
optional: true;
|
|
271
271
|
}>;
|
|
272
272
|
inputs: {
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import Grid from '@material-ui/core/Grid';
|
|
3
3
|
import { NavItemBlueprint, ApiBlueprint, createApiFactory, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
|
|
@@ -17,7 +17,7 @@ const apiDocsNavItem = NavItemBlueprint.make({
|
|
|
17
17
|
params: {
|
|
18
18
|
title: "APIs",
|
|
19
19
|
routeRef: convertLegacyRouteRef(rootRoute),
|
|
20
|
-
icon: () => compatWrapper(/* @__PURE__ */
|
|
20
|
+
icon: () => compatWrapper(/* @__PURE__ */ jsx(AppIcon, { id: "kind:api" }))
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const apiDocsConfigApi = ApiBlueprint.make({
|
|
@@ -50,7 +50,7 @@ const apiDocsExplorerPage = PageBlueprint.makeWithOverrides({
|
|
|
50
50
|
routeRef: convertLegacyRouteRef(rootRoute),
|
|
51
51
|
loader: () => import('./components/ApiExplorerPage/index.esm.js').then(
|
|
52
52
|
(m) => compatWrapper(
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
54
|
m.ApiExplorerIndexPage,
|
|
55
55
|
{
|
|
56
56
|
initiallySelectedFilter: config.initiallySelectedFilter
|
|
@@ -73,7 +73,7 @@ const apiDocsHasApisEntityCard = EntityCardBlueprint.make({
|
|
|
73
73
|
);
|
|
74
74
|
},
|
|
75
75
|
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
76
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
76
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.HasApisCard, {}))
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
});
|
|
@@ -82,7 +82,7 @@ const apiDocsDefinitionEntityCard = EntityCardBlueprint.make({
|
|
|
82
82
|
params: {
|
|
83
83
|
filter: "kind:api",
|
|
84
84
|
loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
|
|
85
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
85
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.ApiDefinitionCard, {}))
|
|
86
86
|
)
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -94,7 +94,7 @@ const apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({
|
|
|
94
94
|
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
95
95
|
filter: "kind:component",
|
|
96
96
|
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
97
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
97
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.ConsumedApisCard, {}))
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -106,7 +106,7 @@ const apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({
|
|
|
106
106
|
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
107
107
|
filter: "kind:component",
|
|
108
108
|
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
109
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
109
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.ProvidedApisCard, {}))
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
112
|
});
|
|
@@ -118,7 +118,7 @@ const apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({
|
|
|
118
118
|
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
119
119
|
filter: "kind:api",
|
|
120
120
|
loader: () => import('./components/ComponentsCards/index.esm.js').then(
|
|
121
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
121
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.ConsumingComponentsCard, {}))
|
|
122
122
|
)
|
|
123
123
|
}
|
|
124
124
|
});
|
|
@@ -130,7 +130,7 @@ const apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({
|
|
|
130
130
|
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
131
131
|
filter: "kind:api",
|
|
132
132
|
loader: () => import('./components/ComponentsCards/index.esm.js').then(
|
|
133
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
133
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.ProvidingComponentsCard, {}))
|
|
134
134
|
)
|
|
135
135
|
}
|
|
136
136
|
});
|
|
@@ -142,7 +142,7 @@ const apiDocsDefinitionEntityContent = EntityContentBlueprint.make({
|
|
|
142
142
|
filter: "kind:api",
|
|
143
143
|
loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
|
|
144
144
|
(m) => compatWrapper(
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(m.ApiDefinitionCard, {}) }) })
|
|
146
146
|
)
|
|
147
147
|
)
|
|
148
148
|
}
|
|
@@ -155,7 +155,10 @@ const apiDocsApisEntityContent = EntityContentBlueprint.make({
|
|
|
155
155
|
filter: "kind:component",
|
|
156
156
|
loader: async () => import('./components/ApisCards/index.esm.js').then(
|
|
157
157
|
(m) => compatWrapper(
|
|
158
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, alignItems: "stretch", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(m.ProvidedApisCard, {}) }),
|
|
160
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(m.ConsumedApisCard, {}) })
|
|
161
|
+
] })
|
|
159
162
|
)
|
|
160
163
|
)
|
|
161
164
|
}
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n },\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/definition',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgDA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qCAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAA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AAa,sBAAsB,yBAAyB;AAAA,GAC9D;AAAA,EACA,UAAY,EAAA;AAAA,IACV,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,wBAAA;AAAA,IACA,2BAAA;AAAA,IACA,6BAAA;AAAA,IACA,6BAAA;AAAA,IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n },\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/definition',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+CA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qBAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE;AAAA;AAEvD,CAAC,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,gBAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AACb,QAAA,MAAM,oBAAoB,wBAAyB,EAAA;AACnD,QAAO,OAAA;AAAA,UACL,sBAAA,EAAwB,CAAC,SAAyB,KAAA;AAChD,YAAA,OAAO,kBAAkB,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,SAAA,CAAU,KAAK,IAAI,CAAA;AAAA;AACnE,SACF;AAAA;AACF,KACD;AAAA;AAEL,CAAC,CAAA;AAED,MAAM,mBAAA,GAAsB,cAAc,iBAAkB,CAAA;AAAA,EAC1D,MAAQ,EAAA;AAA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A,QAAA,EAAA;AAAA,0BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,EAAmB,CACtB,EAAA,CAAA;AAAA,0BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,EAAmB,CACtB,EAAA;AAAA,SACF,EAAA;AAAA;AACF;AACF;AAEN,CAAC,CAAA;AAED,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,sBAAsB,SAAS;AAAA,GACvC;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,WAAA,EAAa,sBAAsB,yBAAyB;AAAA,GAC9D;AAAA,EACA,UAAY,EAAA;AAAA,IACV,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,wBAAA;AAAA,IACA,2BAAA;AAAA,IACA,6BAAA;AAAA,IACA,6BAAA;AAAA,IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
2
3
|
import Alert from '@material-ui/lab/Alert';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import { apiDocsConfigRef } from '../../config.esm.js';
|
|
5
5
|
import { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js';
|
|
6
6
|
import { TabbedCard, CardTab } from '@backstage/core-components';
|
|
@@ -11,32 +11,35 @@ const ApiDefinitionCard = () => {
|
|
|
11
11
|
const config = useApi(apiDocsConfigRef);
|
|
12
12
|
const { getApiDefinitionWidget } = config;
|
|
13
13
|
if (!entity) {
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx(Alert, { severity: "error", children: "Could not fetch the API" });
|
|
15
15
|
}
|
|
16
16
|
const definitionWidget = getApiDefinitionWidget(entity);
|
|
17
17
|
const entityTitle = entity.metadata.title ?? entity.metadata.name;
|
|
18
18
|
if (definitionWidget) {
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
return /* @__PURE__ */ jsxs(TabbedCard, { title: entityTitle, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(CardTab, { label: definitionWidget.title, children: definitionWidget.component(entity.spec.definition) }, "widget"),
|
|
21
|
+
/* @__PURE__ */ jsx(CardTab, { label: "Raw", children: /* @__PURE__ */ jsx(
|
|
22
|
+
PlainApiDefinitionWidget,
|
|
23
|
+
{
|
|
24
|
+
definition: entity.spec.definition,
|
|
25
|
+
language: definitionWidget.rawLanguage || entity.spec.type
|
|
26
|
+
}
|
|
27
|
+
) }, "raw")
|
|
28
|
+
] });
|
|
26
29
|
}
|
|
27
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
28
31
|
TabbedCard,
|
|
29
32
|
{
|
|
30
33
|
title: entityTitle,
|
|
31
34
|
children: [
|
|
32
35
|
// Has to be an array, otherwise typescript doesn't like that this has only a single child
|
|
33
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ jsx(CardTab, { label: entity.spec.type, children: /* @__PURE__ */ jsx(
|
|
34
37
|
PlainApiDefinitionWidget,
|
|
35
38
|
{
|
|
36
39
|
definition: entity.spec.definition,
|
|
37
40
|
language: entity.spec.type
|
|
38
41
|
}
|
|
39
|
-
))
|
|
42
|
+
) }, "raw")
|
|
40
43
|
]
|
|
41
44
|
}
|
|
42
45
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiDefinitionCard.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiDefinitionCard.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 { ApiEntity } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport Alert from '@material-ui/lab/Alert';\nimport
|
|
1
|
+
{"version":3,"file":"ApiDefinitionCard.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiDefinitionCard.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 { ApiEntity } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport Alert from '@material-ui/lab/Alert';\nimport { apiDocsConfigRef } from '../../config';\nimport { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget';\n\nimport { CardTab, TabbedCard } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const ApiDefinitionCard = () => {\n const { entity } = useEntity<ApiEntity>();\n const config = useApi(apiDocsConfigRef);\n const { getApiDefinitionWidget } = config;\n\n if (!entity) {\n return <Alert severity=\"error\">Could not fetch the API</Alert>;\n }\n\n const definitionWidget = getApiDefinitionWidget(entity);\n const entityTitle = entity.metadata.title ?? entity.metadata.name;\n\n if (definitionWidget) {\n return (\n <TabbedCard title={entityTitle}>\n <CardTab label={definitionWidget.title} key=\"widget\">\n {definitionWidget.component(entity.spec.definition)}\n </CardTab>\n <CardTab label=\"Raw\" key=\"raw\">\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={definitionWidget.rawLanguage || entity.spec.type}\n />\n </CardTab>\n </TabbedCard>\n );\n }\n\n return (\n <TabbedCard\n title={entityTitle}\n children={[\n // Has to be an array, otherwise typescript doesn't like that this has only a single child\n <CardTab label={entity.spec.type} key=\"raw\">\n <PlainApiDefinitionWidget\n definition={entity.spec.definition}\n language={entity.spec.type}\n />\n </CardTab>,\n ]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,oBAAoB,MAAM;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAqB,EAAA;AACxC,EAAM,MAAA,MAAA,GAAS,OAAO,gBAAgB,CAAA;AACtC,EAAM,MAAA,EAAE,wBAA2B,GAAA,MAAA;AAEnC,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAA,uBAAQ,GAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAQ,QAAuB,EAAA,yBAAA,EAAA,CAAA;AAAA;AAGxD,EAAM,MAAA,gBAAA,GAAmB,uBAAuB,MAAM,CAAA;AACtD,EAAA,MAAM,WAAc,GAAA,MAAA,CAAO,QAAS,CAAA,KAAA,IAAS,OAAO,QAAS,CAAA,IAAA;AAE7D,EAAA,IAAI,gBAAkB,EAAA;AACpB,IACE,uBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAO,WACjB,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,OAAA,EAAA,EAAQ,KAAO,EAAA,gBAAA,CAAiB,KAC9B,EAAA,QAAA,EAAA,gBAAA,CAAiB,UAAU,MAAO,CAAA,IAAA,CAAK,UAAU,CAAA,EAAA,EADR,QAE5C,CAAA;AAAA,sBACA,GAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAM,KACb,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,wBAAA;AAAA,QAAA;AAAA,UACC,UAAA,EAAY,OAAO,IAAK,CAAA,UAAA;AAAA,UACxB,QAAU,EAAA,gBAAA,CAAiB,WAAe,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA;AAAA,WAHjC,KAKzB;AAAA,KACF,EAAA,CAAA;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,WAAA;AAAA,MACP,QAAU,EAAA;AAAA;AAAA,wBAEP,GAAA,CAAA,OAAA,EAAA,EAAQ,KAAO,EAAA,MAAA,CAAO,KAAK,IAC1B,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,wBAAA;AAAA,UAAA;AAAA,YACC,UAAA,EAAY,OAAO,IAAK,CAAA,UAAA;AAAA,YACxB,QAAA,EAAU,OAAO,IAAK,CAAA;AAAA;AAAA,aAHY,KAKtC;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.esm.js';
|
|
3
3
|
import { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget/GraphQlDefinitionWidget.esm.js';
|
|
4
4
|
import { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget/OpenApiDefinitionWidget.esm.js';
|
|
@@ -11,29 +11,29 @@ function defaultDefinitionWidgets() {
|
|
|
11
11
|
type: "openapi",
|
|
12
12
|
title: "OpenAPI",
|
|
13
13
|
rawLanguage: "yaml",
|
|
14
|
-
component: (definition) => /* @__PURE__ */
|
|
14
|
+
component: (definition) => /* @__PURE__ */ jsx(OpenApiDefinitionWidget, { definition })
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
type: "asyncapi",
|
|
18
18
|
title: "AsyncAPI",
|
|
19
19
|
rawLanguage: "yaml",
|
|
20
|
-
component: (definition) => /* @__PURE__ */
|
|
20
|
+
component: (definition) => /* @__PURE__ */ jsx(AsyncApiDefinitionWidget, { definition })
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
type: "graphql",
|
|
24
24
|
title: "GraphQL",
|
|
25
25
|
rawLanguage: "graphql",
|
|
26
|
-
component: (definition) => /* @__PURE__ */
|
|
26
|
+
component: (definition) => /* @__PURE__ */ jsx(GraphQlDefinitionWidget, { definition })
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
type: "grpc",
|
|
30
30
|
title: "gRPC",
|
|
31
|
-
component: (definition) => /* @__PURE__ */
|
|
31
|
+
component: (definition) => /* @__PURE__ */ jsx(GrpcApiDefinitionWidget, { definition })
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
type: "trpc",
|
|
35
35
|
title: "tRPC",
|
|
36
|
-
component: (definition) => /* @__PURE__ */
|
|
36
|
+
component: (definition) => /* @__PURE__ */ jsx(TrpcApiDefinitionWidget, { definition })
|
|
37
37
|
}
|
|
38
38
|
];
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiDefinitionWidget.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiDefinitionWidget.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 */\nimport
|
|
1
|
+
{"version":3,"file":"ApiDefinitionWidget.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiDefinitionWidget.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 */\nimport { ReactElement } from 'react';\nimport { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget';\nimport { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget';\nimport { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget';\nimport { GrpcApiDefinitionWidget } from '../GrpcApiDefinitionWidget';\nimport { TrpcApiDefinitionWidget } from '../TrpcDefinitionWidget';\n\n/** @public */\nexport type ApiDefinitionWidget = {\n type: string;\n title: string;\n component: (definition: string) => ReactElement;\n rawLanguage?: string;\n};\n\n/** @public */\nexport function defaultDefinitionWidgets(): ApiDefinitionWidget[] {\n return [\n {\n type: 'openapi',\n title: 'OpenAPI',\n rawLanguage: 'yaml',\n component: definition => (\n <OpenApiDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'asyncapi',\n title: 'AsyncAPI',\n rawLanguage: 'yaml',\n component: definition => (\n <AsyncApiDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'graphql',\n title: 'GraphQL',\n rawLanguage: 'graphql',\n component: definition => (\n <GraphQlDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'grpc',\n title: 'gRPC',\n component: definition => (\n <GrpcApiDefinitionWidget definition={definition} />\n ),\n },\n {\n type: 'trpc',\n title: 'tRPC',\n component: definition => (\n <TrpcApiDefinitionWidget definition={definition} />\n ),\n },\n ];\n}\n"],"names":[],"mappings":";;;;;;;AA+BO,SAAS,wBAAkD,GAAA;AAChE,EAAO,OAAA;AAAA,IACL;AAAA,MACE,IAAM,EAAA,SAAA;AAAA,MACN,KAAO,EAAA,SAAA;AAAA,MACP,WAAa,EAAA,MAAA;AAAA,MACb,SAAW,EAAA,CAAA,UAAA,qBACR,GAAA,CAAA,uBAAA,EAAA,EAAwB,UAAwB,EAAA;AAAA,KAErD;AAAA,IACA;AAAA,MACE,IAAM,EAAA,UAAA;AAAA,MACN,KAAO,EAAA,UAAA;AAAA,MACP,WAAa,EAAA,MAAA;AAAA,MACb,SAAW,EAAA,CAAA,UAAA,qBACR,GAAA,CAAA,wBAAA,EAAA,EAAyB,UAAwB,EAAA;AAAA,KAEtD;AAAA,IACA;AAAA,MACE,IAAM,EAAA,SAAA;AAAA,MACN,KAAO,EAAA,SAAA;AAAA,MACP,WAAa,EAAA,SAAA;AAAA,MACb,SAAW,EAAA,CAAA,UAAA,qBACR,GAAA,CAAA,uBAAA,EAAA,EAAwB,UAAwB,EAAA;AAAA,KAErD;AAAA,IACA;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,CAAA,UAAA,qBACR,GAAA,CAAA,uBAAA,EAAA,EAAwB,UAAwB,EAAA;AAAA,KAErD;AAAA,IACA;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,CAAA,UAAA,qBACR,GAAA,CAAA,uBAAA,EAAA,EAAwB,UAAwB,EAAA;AAAA;AAErD,GACF;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Typography from '@material-ui/core/Typography';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
import { apiDocsConfigRef } from '../../config.esm.js';
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ const ApiTypeTitle = (props) => {
|
|
|
8
8
|
const config = useApi(apiDocsConfigRef);
|
|
9
9
|
const definition = config.getApiDefinitionWidget(apiEntity);
|
|
10
10
|
const type = definition ? definition.title : apiEntity.spec.type;
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx(Typography, { component: "span", variant: "inherit", children: type });
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { ApiTypeTitle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiTypeTitle.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiTypeTitle.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 { ApiEntity } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport
|
|
1
|
+
{"version":3,"file":"ApiTypeTitle.esm.js","sources":["../../../src/components/ApiDefinitionCard/ApiTypeTitle.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 { ApiEntity } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport { apiDocsConfigRef } from '../../config';\nimport { useApi } from '@backstage/core-plugin-api';\n\n/**\n * @public\n */\nexport const ApiTypeTitle = (props: { apiEntity: ApiEntity }) => {\n const { apiEntity } = props;\n const config = useApi(apiDocsConfigRef);\n const definition = config.getApiDefinitionWidget(apiEntity);\n const type = definition ? definition.title : apiEntity.spec.type;\n\n return (\n <Typography component=\"span\" variant=\"inherit\">\n {type}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;AAwBa,MAAA,YAAA,GAAe,CAAC,KAAoC,KAAA;AAC/D,EAAM,MAAA,EAAE,WAAc,GAAA,KAAA;AACtB,EAAM,MAAA,MAAA,GAAS,OAAO,gBAAgB,CAAA;AACtC,EAAM,MAAA,UAAA,GAAa,MAAO,CAAA,sBAAA,CAAuB,SAAS,CAAA;AAC1D,EAAA,MAAM,IAAO,GAAA,UAAA,GAAa,UAAW,CAAA,KAAA,GAAQ,UAAU,IAAK,CAAA,IAAA;AAE5D,EAAA,2BACG,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,OAAA,EAAQ,WAClC,QACH,EAAA,IAAA,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
2
3
|
import Box from '@material-ui/core/Box';
|
|
3
4
|
import Button from '@material-ui/core/Button';
|
|
@@ -9,7 +10,7 @@ import Tab from '@material-ui/core/Tab';
|
|
|
9
10
|
import Tabs from '@material-ui/core/Tabs';
|
|
10
11
|
import Typography from '@material-ui/core/Typography';
|
|
11
12
|
import { makeStyles } from '@material-ui/core/styles';
|
|
12
|
-
import
|
|
13
|
+
import { useState, useEffect } from 'react';
|
|
13
14
|
import { apiDocsConfigRef } from '../../config.esm.js';
|
|
14
15
|
import { PlainApiDefinitionWidget } from '../PlainApiDefinitionWidget/PlainApiDefinitionWidget.esm.js';
|
|
15
16
|
|
|
@@ -48,7 +49,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
48
49
|
function TabPanel(props) {
|
|
49
50
|
const { children, value, index, ...other } = props;
|
|
50
51
|
const classes = useStyles();
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
52
53
|
"div",
|
|
53
54
|
{
|
|
54
55
|
role: "tabpanel",
|
|
@@ -56,9 +57,9 @@ function TabPanel(props) {
|
|
|
56
57
|
id: `vertical-tabpanel-${index}`,
|
|
57
58
|
"aria-labelledby": `vertical-tab-${index}`,
|
|
58
59
|
className: classes.tabContents,
|
|
59
|
-
...other
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
...other,
|
|
61
|
+
children: value === index && /* @__PURE__ */ jsx(Box, { pl: 3, pr: 3, children })
|
|
62
|
+
}
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
function a11yProps(index) {
|
|
@@ -69,7 +70,7 @@ function a11yProps(index) {
|
|
|
69
70
|
}
|
|
70
71
|
function ApiDefinitionDialog(props) {
|
|
71
72
|
const { open, entity, onClose } = props;
|
|
72
|
-
const [activeTab, setActiveTab] =
|
|
73
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
73
74
|
const classes = useStyles();
|
|
74
75
|
useEffect(() => {
|
|
75
76
|
setActiveTab(0);
|
|
@@ -78,7 +79,7 @@ function ApiDefinitionDialog(props) {
|
|
|
78
79
|
const definitionWidget = config.getApiDefinitionWidget(entity);
|
|
79
80
|
let tabIndex = 0;
|
|
80
81
|
let tabPanelIndex = 0;
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
82
83
|
Dialog,
|
|
83
84
|
{
|
|
84
85
|
fullWidth: true,
|
|
@@ -86,29 +87,43 @@ function ApiDefinitionDialog(props) {
|
|
|
86
87
|
open,
|
|
87
88
|
onClose,
|
|
88
89
|
"aria-labelledby": "api-definition-dialog-title",
|
|
89
|
-
PaperProps: { className: classes.fullHeightDialog }
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
90
|
+
PaperProps: { className: classes.fullHeightDialog },
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsxs(DialogTitle, { id: "api-definition-dialog-title", disableTypography: true, children: [
|
|
93
|
+
/* @__PURE__ */ jsxs(Typography, { className: classes.type, children: [
|
|
94
|
+
"API - ",
|
|
95
|
+
definitionWidget?.title ?? "Raw"
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.title, variant: "h1", children: entity.metadata.title ?? entity.metadata.name })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsxs(DialogContent, { dividers: true, className: classes.root, children: [
|
|
100
|
+
/* @__PURE__ */ jsxs(
|
|
101
|
+
Tabs,
|
|
102
|
+
{
|
|
103
|
+
orientation: "vertical",
|
|
104
|
+
variant: "scrollable",
|
|
105
|
+
value: activeTab,
|
|
106
|
+
onChange: (_, newValue) => setActiveTab(newValue),
|
|
107
|
+
"aria-label": "API definition options",
|
|
108
|
+
className: classes.tabs,
|
|
109
|
+
children: [
|
|
110
|
+
definitionWidget ? /* @__PURE__ */ jsx(Tab, { label: definitionWidget.title, ...a11yProps(tabIndex++) }) : null,
|
|
111
|
+
/* @__PURE__ */ jsx(Tab, { label: "Raw", ...a11yProps(tabIndex++) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
definitionWidget ? /* @__PURE__ */ jsx(TabPanel, { value: activeTab, index: tabPanelIndex++, children: definitionWidget.component(entity.spec.definition) }) : null,
|
|
116
|
+
/* @__PURE__ */ jsx(TabPanel, { value: activeTab, index: tabPanelIndex++, children: /* @__PURE__ */ jsx(
|
|
117
|
+
PlainApiDefinitionWidget,
|
|
118
|
+
{
|
|
119
|
+
definition: entity.spec.definition,
|
|
120
|
+
language: definitionWidget?.rawLanguage ?? entity.spec.type
|
|
121
|
+
}
|
|
122
|
+
) })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, color: "primary", children: "Close" }) })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
112
127
|
);
|
|
113
128
|
}
|
|
114
129
|
|