@backstage/plugin-api-docs 0.11.8-next.2 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
+ ## 0.11.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 770ba02: `ConsumingComponentsCard` and `ProvidingComponentsCard` will now optionally accept `columns` to override which table columns are displayed
8
+ - fe1fbb2: Migrating usages of the deprecated `createExtension` `v1` format to the newer `v2` format, and old `create*Extension` extension creators to blueprints.
9
+ - ebfeb40: Added `resolvers` prop to `AsyncApiDefinitionWidget`. This allows to override the default http/https resolvers, for example to add authentication to requests to internal schema registries.
10
+ - 4b6d2cb: Updated dependency `@graphiql/react` to `^0.23.0`.
11
+ - 6582799: Add `tableOptions` to all tables and additionally `title` to API tables.
12
+ - Updated dependencies
13
+ - @backstage/plugin-catalog@1.22.0
14
+ - @backstage/frontend-plugin-api@0.7.0
15
+ - @backstage/plugin-catalog-react@1.12.3
16
+ - @backstage/core-components@0.14.10
17
+ - @backstage/core-compat-api@0.2.8
18
+ - @backstage/catalog-model@1.6.0
19
+ - @backstage/core-plugin-api@1.9.3
20
+ - @backstage/plugin-catalog-common@1.0.26
21
+ - @backstage/plugin-permission-react@0.4.25
22
+
23
+ ## 0.11.8-next.3
24
+
25
+ ### Patch Changes
26
+
27
+ - 6582799: Add `tableOptions` to all tables and additionally `title` to API tables.
28
+ - Updated dependencies
29
+ - @backstage/frontend-plugin-api@0.7.0-next.3
30
+ - @backstage/plugin-catalog@1.22.0-next.3
31
+ - @backstage/catalog-model@1.6.0-next.0
32
+ - @backstage/core-compat-api@0.2.8-next.3
33
+ - @backstage/plugin-catalog-react@1.12.3-next.3
34
+ - @backstage/core-components@0.14.10-next.0
35
+ - @backstage/core-plugin-api@1.9.3
36
+ - @backstage/plugin-catalog-common@1.0.26-next.2
37
+ - @backstage/plugin-permission-react@0.4.25-next.1
38
+
3
39
  ## 0.11.8-next.2
4
40
 
5
41
  ### Patch Changes
package/README.md CHANGED
@@ -222,10 +222,6 @@ security:
222
222
  - [read_pets, write_pets]
223
223
  ```
224
224
 
225
- ## Links
226
-
227
- - [The Backstage homepage](https://backstage.io)
228
-
229
225
  ### Adding `requestInterceptor` to Swagger UI
230
226
 
231
227
  To configure a [`requestInterceptor` for Swagger UI](https://github.com/swagger-api/swagger-ui/tree/master/flavors/swagger-ui-react#requestinterceptor-proptypesfunc) you'll need to add the following to your `api.tsx`:
@@ -319,3 +315,62 @@ export const apis: AnyApiFactory[] = [
319
315
 
320
316
  N.B. if you wish to disable the `Try It Out` feature for your API, you can provide an empty list to
321
317
  the `supportedSubmitMethods` parameter.
318
+
319
+ ### Custom Resolvers for AsyncApi
320
+
321
+ You can override the default http/https resolvers, for example to add authentication to requests to internal schema registries by providing the `resolvers` prop to the `AsyncApiDefinitionWidget`. This is an example:
322
+
323
+ ```tsx
324
+ ...
325
+ import {
326
+ AsyncApiDefinitionWidget,
327
+ apiDocsConfigRef,
328
+ defaultDefinitionWidgets,
329
+ } from '@backstage/plugin-api-docs';
330
+ import { ApiEntity } from '@backstage/catalog-model';
331
+
332
+ export const apis: AnyApiFactory[] = [
333
+ ...
334
+ createApiFactory({
335
+ api: apiDocsConfigRef,
336
+ deps: {},
337
+ factory: () => {
338
+ const myCustomResolver = {
339
+ schema: 'https',
340
+ order: 1,
341
+ canRead: true,
342
+ async read(uri: any) {
343
+ const response = await fetch(request, {
344
+ headers: {
345
+ X-Custom: 'Custom',
346
+ },
347
+ });
348
+ return response.text();
349
+ },
350
+ };
351
+
352
+ const definitionWidgets = defaultDefinitionWidgets().map(obj => {
353
+ if (obj.type === 'asyncapi') {
354
+ return {
355
+ ...obj,
356
+ component: (definition) => (
357
+ <AsyncApiDefinitionWidget definition={definition} resolvers={[myCustomResolver]} />
358
+ ),
359
+ };
360
+ }
361
+ return obj;
362
+ });
363
+
364
+ return {
365
+ getApiDefinitionWidget: (apiEntity: ApiEntity) => {
366
+ return definitionWidgets.find(d => d.type === apiEntity.spec.type);
367
+ },
368
+ };
369
+ }
370
+ })
371
+ ]
372
+ ```
373
+
374
+ ## Links
375
+
376
+ - [The Backstage homepage](https://backstage.io)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs__alpha",
3
- "version": "0.11.8-next.2",
3
+ "version": "0.11.8",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.d.ts CHANGED
@@ -1,9 +1,163 @@
1
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
2
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
1
3
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
4
+ import React__default from 'react';
2
5
 
3
6
  declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
4
7
  root: _backstage_frontend_plugin_api.RouteRef<undefined>;
5
8
  }, {
6
9
  registerApi: _backstage_frontend_plugin_api.ExternalRouteRef<undefined>;
10
+ }, {
11
+ "nav-item:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{}, {}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
12
+ title: string;
13
+ icon: _backstage_core_plugin_api.IconComponent;
14
+ routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
15
+ }, "core.nav-item.target", {}>, {}, {
16
+ kind: "nav-item";
17
+ namespace: undefined;
18
+ name: undefined;
19
+ }>;
20
+ "api:api-docs/config": _backstage_frontend_plugin_api.ExtensionDefinition<{}, {}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>, {}, {
21
+ kind: "api";
22
+ namespace: undefined;
23
+ name: "config";
24
+ }>;
25
+ "page:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{
26
+ initiallySelectedFilter: "all" | "owned" | "starred" | undefined;
27
+ } & {
28
+ path: string | undefined;
29
+ }, {
30
+ initiallySelectedFilter?: "all" | "owned" | "starred" | undefined;
31
+ } & {
32
+ path?: string | undefined;
33
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.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", {
34
+ optional: true;
35
+ }>, {
36
+ [x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
37
+ optional: boolean;
38
+ singleton: boolean;
39
+ }>;
40
+ }, {
41
+ kind: "page";
42
+ namespace: undefined;
43
+ name: undefined;
44
+ }>;
45
+ "entity-card:api-docs/has-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
46
+ filter: string | undefined;
47
+ }, {
48
+ filter?: string | undefined;
49
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
50
+ optional: true;
51
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
52
+ optional: true;
53
+ }>, {}, {
54
+ kind: "entity-card";
55
+ namespace: undefined;
56
+ name: "has-apis";
57
+ }>;
58
+ "entity-card:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
59
+ filter: string | undefined;
60
+ }, {
61
+ filter?: string | undefined;
62
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
63
+ optional: true;
64
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
65
+ optional: true;
66
+ }>, {}, {
67
+ kind: "entity-card";
68
+ namespace: undefined;
69
+ name: "definition";
70
+ }>;
71
+ "entity-card:api-docs/consumed-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
72
+ filter: string | undefined;
73
+ }, {
74
+ filter?: string | undefined;
75
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
76
+ optional: true;
77
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
78
+ optional: true;
79
+ }>, {}, {
80
+ kind: "entity-card";
81
+ namespace: undefined;
82
+ name: "consumed-apis";
83
+ }>;
84
+ "entity-card:api-docs/provided-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
85
+ filter: string | undefined;
86
+ }, {
87
+ filter?: string | undefined;
88
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
89
+ optional: true;
90
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
91
+ optional: true;
92
+ }>, {}, {
93
+ kind: "entity-card";
94
+ namespace: undefined;
95
+ name: "provided-apis";
96
+ }>;
97
+ "entity-card:api-docs/consuming-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
98
+ filter: string | undefined;
99
+ }, {
100
+ filter?: string | undefined;
101
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
102
+ optional: true;
103
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
104
+ optional: true;
105
+ }>, {}, {
106
+ kind: "entity-card";
107
+ namespace: undefined;
108
+ name: "consuming-components";
109
+ }>;
110
+ "entity-card:api-docs/providing-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
111
+ filter: string | undefined;
112
+ }, {
113
+ filter?: string | undefined;
114
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
115
+ optional: true;
116
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
117
+ optional: true;
118
+ }>, {}, {
119
+ kind: "entity-card";
120
+ namespace: undefined;
121
+ name: "providing-components";
122
+ }>;
123
+ "entity-content:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
124
+ path: string | undefined;
125
+ title: string | undefined;
126
+ filter: string | undefined;
127
+ }, {
128
+ filter?: string | undefined;
129
+ title?: string | undefined;
130
+ path?: string | undefined;
131
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.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", {
132
+ optional: true;
133
+ }> | _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", {
134
+ optional: true;
135
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
136
+ optional: true;
137
+ }>, {}, {
138
+ kind: "entity-content";
139
+ namespace: undefined;
140
+ name: "definition";
141
+ }>;
142
+ "entity-content:api-docs/apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
143
+ path: string | undefined;
144
+ title: string | undefined;
145
+ filter: string | undefined;
146
+ }, {
147
+ filter?: string | undefined;
148
+ title?: string | undefined;
149
+ path?: string | undefined;
150
+ }, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.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", {
151
+ optional: true;
152
+ }> | _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", {
153
+ optional: true;
154
+ }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
155
+ optional: true;
156
+ }>, {}, {
157
+ kind: "entity-content";
158
+ namespace: undefined;
159
+ name: "apis";
160
+ }>;
7
161
  }>;
8
162
 
9
163
  export { _default as default };
package/dist/alpha.esm.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
- import { createNavItemExtension, createApiExtension, createApiFactory, createPageExtension, createSchemaFromZod, createPlugin } from '@backstage/frontend-plugin-api';
3
+ import { NavItemBlueprint, ApiBlueprint, createApiFactory, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
4
4
  import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
5
- import { createEntityCardExtension, createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
6
5
  import { RELATION_HAS_PART, parseEntityRef } from '@backstage/catalog-model';
7
6
  import '@backstage/plugin-catalog-react';
8
7
  import '@material-ui/lab/Alert';
@@ -12,132 +11,156 @@ import '@backstage/core-plugin-api';
12
11
  import { defaultDefinitionWidgets } from './components/ApiDefinitionCard/ApiDefinitionWidget.esm.js';
13
12
  import '@material-ui/core/Typography';
14
13
  import { rootRoute, registerComponentRouteRef } from './routes.esm.js';
14
+ import { EntityCardBlueprint, EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
15
15
 
16
- const apiDocsNavItem = createNavItemExtension({
17
- title: "APIs",
18
- routeRef: convertLegacyRouteRef(rootRoute),
19
- icon: () => compatWrapper(/* @__PURE__ */ React.createElement(AppIcon, { id: "kind:api" }))
16
+ const apiDocsNavItem = NavItemBlueprint.make({
17
+ params: {
18
+ title: "APIs",
19
+ routeRef: convertLegacyRouteRef(rootRoute),
20
+ icon: () => compatWrapper(/* @__PURE__ */ React.createElement(AppIcon, { id: "kind:api" }))
21
+ }
20
22
  });
21
- const apiDocsConfigApi = createApiExtension({
22
- factory: createApiFactory({
23
- api: apiDocsConfigRef,
24
- deps: {},
25
- factory: () => {
26
- const definitionWidgets = defaultDefinitionWidgets();
27
- return {
28
- getApiDefinitionWidget: (apiEntity) => {
29
- return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
30
- }
31
- };
32
- }
33
- })
23
+ const apiDocsConfigApi = ApiBlueprint.make({
24
+ name: "config",
25
+ params: {
26
+ factory: createApiFactory({
27
+ api: apiDocsConfigRef,
28
+ deps: {},
29
+ factory: () => {
30
+ const definitionWidgets = defaultDefinitionWidgets();
31
+ return {
32
+ getApiDefinitionWidget: (apiEntity) => {
33
+ return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
34
+ }
35
+ };
36
+ }
37
+ })
38
+ }
34
39
  });
35
- const apiDocsExplorerPage = createPageExtension({
36
- defaultPath: "/api-docs",
37
- routeRef: convertLegacyRouteRef(rootRoute),
38
- // Mapping DefaultApiExplorerPageProps to config
39
- configSchema: createSchemaFromZod(
40
- (z) => z.object({
41
- path: z.string().default("/api-docs"),
42
- initiallySelectedFilter: z.enum(["owned", "starred", "all"]).optional()
40
+ const apiDocsExplorerPage = PageBlueprint.makeWithOverrides({
41
+ config: {
42
+ schema: {
43
43
  // Ommiting columns and actions for now as their types are too complex to map to zod
44
- })
45
- ),
46
- loader: ({ config }) => import('./components/ApiExplorerPage/index.esm.js').then(
47
- (m) => compatWrapper(
48
- /* @__PURE__ */ React.createElement(
49
- m.ApiExplorerIndexPage,
50
- {
51
- initiallySelectedFilter: config.initiallySelectedFilter
52
- }
44
+ initiallySelectedFilter: (z) => z.enum(["owned", "starred", "all"]).optional()
45
+ }
46
+ },
47
+ factory(originalFactory, { config }) {
48
+ return originalFactory({
49
+ defaultPath: "/api-docs",
50
+ routeRef: convertLegacyRouteRef(rootRoute),
51
+ loader: () => import('./components/ApiExplorerPage/index.esm.js').then(
52
+ (m) => compatWrapper(
53
+ /* @__PURE__ */ React.createElement(
54
+ m.ApiExplorerIndexPage,
55
+ {
56
+ initiallySelectedFilter: config.initiallySelectedFilter
57
+ }
58
+ )
59
+ )
53
60
  )
54
- )
55
- )
61
+ });
62
+ }
56
63
  });
57
- const apiDocsHasApisEntityCard = createEntityCardExtension({
64
+ const apiDocsHasApisEntityCard = EntityCardBlueprint.make({
58
65
  name: "has-apis",
59
- // Ommiting configSchema for now
60
- // We are skipping variants and columns are too complex to map to zod
61
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
62
- filter: (entity) => {
63
- return entity.kind === "Component" && entity.relations?.some(
64
- ({ type, targetRef }) => type.toLocaleLowerCase("en-US") === RELATION_HAS_PART && parseEntityRef(targetRef).kind === "API"
65
- );
66
- },
67
- loader: () => import('./components/ApisCards/index.esm.js').then(
68
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.HasApisCard, null))
69
- )
66
+ params: {
67
+ // Ommiting configSchema for now
68
+ // We are skipping variants and columns are too complex to map to zod
69
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
70
+ filter: (entity) => {
71
+ return entity.kind === "Component" && entity.relations?.some(
72
+ ({ type, targetRef }) => type.toLocaleLowerCase("en-US") === RELATION_HAS_PART && parseEntityRef(targetRef).kind === "API"
73
+ );
74
+ },
75
+ loader: () => import('./components/ApisCards/index.esm.js').then(
76
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.HasApisCard, null))
77
+ )
78
+ }
70
79
  });
71
- const apiDocsDefinitionEntityCard = createEntityCardExtension({
80
+ const apiDocsDefinitionEntityCard = EntityCardBlueprint.make({
72
81
  name: "definition",
73
- filter: "kind:api",
74
- loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
75
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null))
76
- )
82
+ params: {
83
+ filter: "kind:api",
84
+ loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
85
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null))
86
+ )
87
+ }
77
88
  });
78
- const apiDocsConsumedApisEntityCard = createEntityCardExtension({
89
+ const apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({
79
90
  name: "consumed-apis",
80
- // Ommiting configSchema for now
81
- // We are skipping variants and columns are too complex to map to zod
82
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
83
- filter: "kind:component",
84
- loader: () => import('./components/ApisCards/index.esm.js').then(
85
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumedApisCard, null))
86
- )
91
+ params: {
92
+ // Ommiting configSchema for now
93
+ // We are skipping variants and columns are too complex to map to zod
94
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
95
+ filter: "kind:component",
96
+ loader: () => import('./components/ApisCards/index.esm.js').then(
97
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumedApisCard, null))
98
+ )
99
+ }
87
100
  });
88
- const apiDocsProvidedApisEntityCard = createEntityCardExtension({
101
+ const apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({
89
102
  name: "provided-apis",
90
- // Ommiting configSchema for now
91
- // We are skipping variants and columns are too complex to map to zod
92
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
93
- filter: "kind:component",
94
- loader: () => import('./components/ApisCards/index.esm.js').then(
95
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidedApisCard, null))
96
- )
103
+ params: {
104
+ // Ommiting configSchema for now
105
+ // We are skipping variants and columns are too complex to map to zod
106
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
107
+ filter: "kind:component",
108
+ loader: () => import('./components/ApisCards/index.esm.js').then(
109
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidedApisCard, null))
110
+ )
111
+ }
97
112
  });
98
- const apiDocsConsumingComponentsEntityCard = createEntityCardExtension({
113
+ const apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({
99
114
  name: "consuming-components",
100
- // Ommiting configSchema for now
101
- // We are skipping variants
102
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
103
- filter: "kind:api",
104
- loader: () => import('./components/ComponentsCards/index.esm.js').then(
105
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumingComponentsCard, null))
106
- )
115
+ params: {
116
+ // Ommiting configSchema for now
117
+ // We are skipping variants
118
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
119
+ filter: "kind:api",
120
+ loader: () => import('./components/ComponentsCards/index.esm.js').then(
121
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumingComponentsCard, null))
122
+ )
123
+ }
107
124
  });
108
- const apiDocsProvidingComponentsEntityCard = createEntityCardExtension({
125
+ const apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({
109
126
  name: "providing-components",
110
- // Ommiting configSchema for now
111
- // We are skipping variants
112
- // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
113
- filter: "kind:api",
114
- loader: () => import('./components/ComponentsCards/index.esm.js').then(
115
- (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidingComponentsCard, null))
116
- )
127
+ params: {
128
+ // Ommiting configSchema for now
129
+ // We are skipping variants
130
+ // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
131
+ filter: "kind:api",
132
+ loader: () => import('./components/ComponentsCards/index.esm.js').then(
133
+ (m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidingComponentsCard, null))
134
+ )
135
+ }
117
136
  });
118
- const apiDocsDefinitionEntityContent = createEntityContentExtension({
137
+ const apiDocsDefinitionEntityContent = EntityContentBlueprint.make({
119
138
  name: "definition",
120
- defaultPath: "/defintion",
121
- defaultTitle: "Definition",
122
- filter: "kind:api",
123
- loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
124
- (m) => compatWrapper(
125
- /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null)))
139
+ params: {
140
+ defaultPath: "/defintion",
141
+ defaultTitle: "Definition",
142
+ filter: "kind:api",
143
+ loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
144
+ (m) => compatWrapper(
145
+ /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null)))
146
+ )
126
147
  )
127
- )
148
+ }
128
149
  });
129
- const apiDocsApisEntityContent = createEntityContentExtension({
150
+ const apiDocsApisEntityContent = EntityContentBlueprint.make({
130
151
  name: "apis",
131
- defaultPath: "/apis",
132
- defaultTitle: "APIs",
133
- filter: "kind:component",
134
- loader: async () => import('./components/ApisCards/index.esm.js').then(
135
- (m) => compatWrapper(
136
- /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ProvidedApisCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ConsumedApisCard, null)))
152
+ params: {
153
+ defaultPath: "/apis",
154
+ defaultTitle: "APIs",
155
+ filter: "kind:component",
156
+ loader: async () => import('./components/ApisCards/index.esm.js').then(
157
+ (m) => compatWrapper(
158
+ /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ProvidedApisCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ConsumedApisCard, null)))
159
+ )
137
160
  )
138
- )
161
+ }
139
162
  });
140
- var alpha = createPlugin({
163
+ var alpha = createFrontendPlugin({
141
164
  id: "api-docs",
142
165
  routes: {
143
166
  root: convertLegacyRouteRef(rootRoute)
@@ -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 createApiExtension,\n createApiFactory,\n createNavItemExtension,\n createPageExtension,\n createPlugin,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n createEntityCardExtension,\n createEntityContentExtension,\n} from '@backstage/plugin-catalog-react/alpha';\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\nconst apiDocsNavItem = createNavItemExtension({\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n});\n\nconst apiDocsConfigApi = createApiExtension({\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\nconst apiDocsExplorerPage = createPageExtension({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n // Mapping DefaultApiExplorerPageProps to config\n configSchema: createSchemaFromZod(z =>\n z.object({\n path: z.string().default('/api-docs'),\n initiallySelectedFilter: z.enum(['owned', 'starred', 'all']).optional(),\n // Ommiting columns and actions for now as their types are too complex to map to zod\n }),\n ),\n loader: ({ config }) =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n});\n\nconst apiDocsHasApisEntityCard = createEntityCardExtension({\n name: 'has-apis',\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\nconst apiDocsDefinitionEntityCard = createEntityCardExtension({\n name: 'definition',\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n});\n\nconst apiDocsConsumedApisEntityCard = createEntityCardExtension({\n name: 'consumed-apis',\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\nconst apiDocsProvidedApisEntityCard = createEntityCardExtension({\n name: 'provided-apis',\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\nconst apiDocsConsumingComponentsEntityCard = createEntityCardExtension({\n name: 'consuming-components',\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\nconst apiDocsProvidingComponentsEntityCard = createEntityCardExtension({\n name: 'providing-components',\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\nconst apiDocsDefinitionEntityContent = createEntityContentExtension({\n name: 'definition',\n defaultPath: '/defintion',\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\nconst apiDocsApisEntityContent = createEntityContentExtension({\n name: 'apis',\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\nexport default createPlugin({\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,iBAAiB,sBAAuB,CAAA;AAAA,EAC5C,KAAO,EAAA,MAAA;AAAA,EACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,EACzC,MAAM,MAAM,aAAA,qCAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE,CAAA;AACrD,CAAC,CAAA,CAAA;AAED,MAAM,mBAAmB,kBAAmB,CAAA;AAAA,EAC1C,SAAS,gBAAiB,CAAA;AAAA,IACxB,GAAK,EAAA,gBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,SAAS,MAAM;AACb,MAAA,MAAM,oBAAoB,wBAAyB,EAAA,CAAA;AACnD,MAAO,OAAA;AAAA,QACL,sBAAA,EAAwB,CAAC,SAAyB,KAAA;AAChD,UAAA,OAAO,kBAAkB,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,SAAA,CAAU,KAAK,IAAI,CAAA,CAAA;AAAA,SACnE;AAAA,OAC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,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAG,UAAW,EAAA,SAAA,EAAA,kBACpC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,gBAAA,EAAF,IAAmB,CACtB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,IAAmB,CACtB,CACF,CAAA;AAAA,KACF;AAAA,GACF;AACJ,CAAC,CAAA,CAAA;AAED,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,sBAAsB,SAAS,CAAA;AAAA,GACvC;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,WAAA,EAAa,sBAAsB,yBAAyB,CAAA;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,wBAAA;AAAA,GACF;AACF,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 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: '/defintion',\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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A,EAAF,IAAmB,CACtB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,gBAAF,EAAA,IAAmB,CACtB,CACF,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACJ;AACF,CAAC,CAAA,CAAA;AAED,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,UAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,sBAAsB,SAAS,CAAA;AAAA,GACvC;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,WAAA,EAAa,sBAAsB,yBAAyB,CAAA;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,wBAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
@@ -6,16 +6,21 @@ import { apiEntityColumns } from './presets.esm.js';
6
6
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
7
7
 
8
8
  const ConsumedApisCard = (props) => {
9
- const { variant = "gridItem", columns = apiEntityColumns } = props;
9
+ const {
10
+ variant = "gridItem",
11
+ title = "Consumed APIs",
12
+ columns = apiEntityColumns,
13
+ tableOptions = {}
14
+ } = props;
10
15
  const { entity } = useEntity();
11
16
  const { entities, loading, error } = useRelatedEntities(entity, {
12
17
  type: RELATION_CONSUMES_API
13
18
  });
14
19
  if (loading) {
15
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumed APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
20
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(Progress, null));
16
21
  }
17
22
  if (error || !entities) {
18
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Consumed APIs" }, /* @__PURE__ */ React.createElement(
23
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(
19
24
  WarningPanel,
20
25
  {
21
26
  severity: "error",
@@ -27,10 +32,11 @@ const ConsumedApisCard = (props) => {
27
32
  return /* @__PURE__ */ React.createElement(
28
33
  EntityTable,
29
34
  {
30
- title: "Consumed APIs",
35
+ title,
31
36
  variant,
32
37
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not consume any APIs."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
33
38
  columns,
39
+ tableOptions,
34
40
  entities
35
41
  }
36
42
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumedApisCard.esm.js","sources":["../../../src/components/ApisCards/ConsumedApisCard.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, RELATION_CONSUMES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumedApisCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ApiEntity>[];\n}) => {\n const { variant = 'gridItem', columns = apiEntityColumns } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_CONSUMES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumed APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumed APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumed APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not consume any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsCa,MAAA,gBAAA,GAAmB,CAAC,KAG3B,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,OAAA,GAAU,kBAAqB,GAAA,KAAA,CAAA;AAC7D,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,qBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EA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Content":["/*\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, RELATION_CONSUMES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumedApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const {\n variant = 'gridItem',\n title = 'Consumed APIs',\n columns = apiEntityColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_CONSUMES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not consume any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAQ,GAAA,eAAA;AAAA,IACR,OAAU,GAAA,gBAAA;AAAA,IACV,eAAe,EAAC;AAAA,GACd,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,qBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,qBAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,YACE,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,SAAA,EAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,SACpB,MAAO,CAAA,IAAA,CAAK,iBAAkB,CAAA,OAAO,CAAE,EAAA,6BAE/C,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGAAkG,EAAA,EAAA,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -13,17 +13,22 @@ const presetColumns = [
13
13
  EntityTable.columns.createMetadataDescriptionColumn()
14
14
  ];
15
15
  const HasApisCard = (props) => {
16
- const { variant = "gridItem", columns = presetColumns } = props;
16
+ const {
17
+ variant = "gridItem",
18
+ title = "APIs",
19
+ columns = presetColumns,
20
+ tableOptions = {}
21
+ } = props;
17
22
  const { entity } = useEntity();
18
23
  const { entities, loading, error } = useRelatedEntities(entity, {
19
24
  type: RELATION_HAS_PART,
20
25
  kind: "API"
21
26
  });
22
27
  if (loading) {
23
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
28
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(Progress, null));
24
29
  }
25
30
  if (error || !entities) {
26
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "APIs" }, /* @__PURE__ */ React.createElement(
31
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(
27
32
  WarningPanel,
28
33
  {
29
34
  severity: "error",
@@ -35,10 +40,11 @@ const HasApisCard = (props) => {
35
40
  return /* @__PURE__ */ React.createElement(
36
41
  EntityTable,
37
42
  {
38
- title: "APIs",
43
+ title,
39
44
  variant,
40
45
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not contain any APIs."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api" }, "Learn how to change this."))),
41
46
  columns,
47
+ tableOptions,
42
48
  entities
43
49
  }
44
50
  );
@@ -1 +1 @@
1
- {"version":3,"file":"HasApisCard.esm.js","sources":["../../../src/components/ApisCards/HasApisCard.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, RELATION_HAS_PART } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createSpecApiTypeColumn } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\nconst presetColumns: TableColumn<ApiEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\n\n/**\n * @public\n */\nexport const HasApisCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ApiEntity>[];\n}) => {\n const { variant = 'gridItem', columns = presetColumns } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_HAS_PART,\n kind: 'API',\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not contain any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmCA,MAAM,aAA0C,GAAA;AAAA,EAC9C,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,EAChE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,uBAAwB,EAAA;AAAA,EACxB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,EAC9C,WAAA,CAAY,QAAQ,+BAAgC,EAAA;AACtD,CAAA,CAAA;AAKa,MAAA,WAAA,GAAc,CAAC,KAGtB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,OAAA,GAAU,eAAkB,GAAA,KAAA,CAAA;AAC1D,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,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EAAG,gFAAiF,EAAA,EAAA,2BAE1F,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HasApisCard.esm.js","sources":["../../../src/components/ApisCards/HasApisCard.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, RELATION_HAS_PART } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createSpecApiTypeColumn } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\n\nconst presetColumns: TableColumn<ApiEntity>[] = [\n EntityTable.columns.createEntityRefColumn({ defaultKind: 'API' }),\n EntityTable.columns.createOwnerColumn(),\n createSpecApiTypeColumn(),\n EntityTable.columns.createSpecLifecycleColumn(),\n EntityTable.columns.createMetadataDescriptionColumn(),\n];\n\n/**\n * @public\n */\nexport const HasApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const {\n variant = 'gridItem',\n title = 'APIs',\n columns = presetColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_HAS_PART,\n kind: 'API',\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not contain any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,aAA0C,GAAA;AAAA,EAC9C,YAAY,OAAQ,CAAA,qBAAA,CAAsB,EAAE,WAAA,EAAa,OAAO,CAAA;AAAA,EAChE,WAAA,CAAY,QAAQ,iBAAkB,EAAA;AAAA,EACtC,uBAAwB,EAAA;AAAA,EACxB,WAAA,CAAY,QAAQ,yBAA0B,EAAA;AAAA,EAC9C,WAAA,CAAY,QAAQ,+BAAgC,EAAA;AACtD,CAAA,CAAA;AAKa,MAAA,WAAA,GAAc,CAAC,KAKtB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAQ,GAAA,MAAA;AAAA,IACR,OAAU,GAAA,aAAA;AAAA,IACV,eAAe,EAAC;AAAA,GACd,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,iBAAA;AAAA,IACN,IAAM,EAAA,KAAA;AAAA,GACP,CAAA,CAAA;AA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{ apiEntityColumns } from './presets.esm.js';
6
6
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
7
7
 
8
8
  const ProvidedApisCard = (props) => {
9
- const { variant = "gridItem", columns = apiEntityColumns } = props;
9
+ const {
10
+ variant = "gridItem",
11
+ title = "Provided APIs",
12
+ columns = apiEntityColumns,
13
+ tableOptions = {}
14
+ } = props;
10
15
  const { entity } = useEntity();
11
16
  const { entities, loading, error } = useRelatedEntities(entity, {
12
17
  type: RELATION_PROVIDES_API
13
18
  });
14
19
  if (loading) {
15
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Provided APIs" }, /* @__PURE__ */ React.createElement(Progress, null));
20
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(Progress, null));
16
21
  }
17
22
  if (error || !entities) {
18
- return /* @__PURE__ */ React.createElement(InfoCard, { variant, title: "Provided APIs" }, /* @__PURE__ */ React.createElement(
23
+ return /* @__PURE__ */ React.createElement(InfoCard, { variant, title }, /* @__PURE__ */ React.createElement(
19
24
  WarningPanel,
20
25
  {
21
26
  severity: "error",
@@ -27,10 +32,11 @@ const ProvidedApisCard = (props) => {
27
32
  return /* @__PURE__ */ React.createElement(
28
33
  EntityTable,
29
34
  {
30
- title: "Provided APIs",
35
+ title,
31
36
  variant,
32
37
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "This ", entity.kind.toLocaleLowerCase("en-US"), " does not provide any APIs."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
33
38
  columns,
39
+ tableOptions,
34
40
  entities
35
41
  }
36
42
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.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, RELATION_PROVIDES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ProvidedApisCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ApiEntity>[];\n}) => {\n const { variant = 'gridItem', columns = apiEntityColumns } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_PROVIDES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Provided APIs\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Provided APIs\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Provided APIs\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not provide any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\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AA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,SACpB,MAAO,CAAA,IAAA,CAAK,iBAAkB,CAAA,OAAO,CAAE,EAAA,6BAE/C,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGAAkG,EAAA,EAAA,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ProvidedApisCard.esm.js","sources":["../../../src/components/ApisCards/ProvidedApisCard.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, RELATION_PROVIDES_API } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { apiEntityColumns } from './presets';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n TableOptions,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ProvidedApisCard = (props: {\n variant?: InfoCardVariants;\n title?: string;\n columns?: TableColumn<ApiEntity>[];\n tableOptions?: TableOptions;\n}) => {\n const {\n variant = 'gridItem',\n title = 'Provided APIs',\n columns = apiEntityColumns,\n tableOptions = {},\n } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_PROVIDES_API,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title={title}>\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title={title}>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load APIs\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title={title}\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n This {entity.kind.toLocaleLowerCase('en-US')} does not provide any\n APIs.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n tableOptions={tableOptions}\n entities={entities as ApiEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuCa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAU,GAAA,UAAA;AAAA,IACV,KAAQ,GAAA,eAAA;AAAA,IACR,OAAU,GAAA,gBAAA;AAAA,IACV,eAAe,EAAC;AAAA,GACd,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,qBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,OAAA,EAAkB,KAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,qBAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,YACE,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,SAAA,EAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,SACpB,MAAO,CAAA,IAAA,CAAK,iBAAkB,CAAA,OAAO,CAAE,EAAA,6BAE/C,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,iGAAkG,EAAA,EAAA,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -143,19 +143,25 @@ const httpFetchResolver = {
143
143
  return response.text();
144
144
  }
145
145
  };
146
- const config = {
147
- parserOptions: {
148
- __unstable: {
149
- resolver: {
150
- resolvers: [httpsFetchResolver, httpFetchResolver]
151
- }
152
- }
153
- }
154
- };
155
- const AsyncApiDefinition = ({ definition }) => {
146
+ const AsyncApiDefinition = ({
147
+ definition,
148
+ resolvers
149
+ }) => {
156
150
  const classes = useStyles();
157
151
  const theme = useTheme();
158
152
  const classNames = `${classes.root} ${theme.palette.type === "dark" ? classes.dark : ""}`;
153
+ const config = {
154
+ parserOptions: {
155
+ __unstable: {
156
+ resolver: {
157
+ resolvers: [httpsFetchResolver, httpFetchResolver]
158
+ }
159
+ }
160
+ }
161
+ };
162
+ if (resolvers) {
163
+ config.parserOptions.__unstable.resolver.resolvers = resolvers;
164
+ }
159
165
  return /* @__PURE__ */ React.createElement("div", { className: classNames }, /* @__PURE__ */ React.createElement(AsyncApi, { schema: definition, config }));
160
166
  };
161
167
 
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useTheme } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n};\n\ntype Props = {\n definition: string;\n};\n\nexport const AsyncApiDefinition = ({ definition }: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,SAAA;AAAA,IACZ,aAAe,EAAA;AAAA,MACb,UAAY,EAAA,MAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA;AAAA,MACb,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,WAAa,EAAA,KAAA,CAAM,KAAM,CAAA,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAAA,KAC9C;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA,aAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AA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AAO,SAAS,IAAK,EAAA,CAAA;AAAA,GACvB;AACF,CAAA,CAAA;AAEA,MAAM,iBAAoB,GAAA;AAAA,EACxB,MAAQ,EAAA,MAAA;AAAA,EACR,KAAO,EAAA,CAAA;AAAA,EACP,OAAS,EAAA,IAAA;AAAA,EACT,MAAM,KAAK,GAAU,EAAA;AACnB,IAAA,MAAM,QAAW,GAAA,MAAM,KAAM,CAAA,GAAA,CAAI,UAAU,CAAA,CAAA;AAC3C,IAAA,OAAO,SAAS,IAAK,EAAA,CAAA;AAAA,GACvB;AACF,CAAA,CAAA;AAEA,MAAM,MAAS,GAAA;AAAA,EACb,aAAe,EAAA;AAAA,IACb,UAAY,EAAA;AAAA,MACV,QAAU,EAAA;AAAA,QACR,SAAA,EAAW,CAAC,kBAAA,EAAoB,iBAAiB,CAAA;AAAA,OACnD;AAAA,KACF;AAAA,GACF;AACF,CAAA,CAAA;AAMO,MAAM,kBAAqB,GAAA,CAAC,EAAE,UAAA,EAAqC,KAAA;AACxE,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAM,MAAA,UAAA,GAAa,CAAG,EAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAChC,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,GAAS,OAAQ,CAAA,IAAA,GAAO,EACjD,CAAA,CAAA,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,UAAA,EAAA,sCACb,QAAS,EAAA,EAAA,MAAA,EAAQ,UAAY,EAAA,MAAA,EAAgB,CAChD,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.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 AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3': {\n color: theme.palette.text.primary,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver: AsyncApiResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver: AsyncApiResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,SAAA;AAAA,IACZ,aAAe,EAAA;AAAA,MACb,UAAY,EAAA,MAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA;AAAA,MACb,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,GAAG,MAAM,UAAW,CAAA,EAAA;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,WAAa,EAAA,KAAA,CAAM,KAAM,CAAA,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAAA,KAC9C;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA,aAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,EAAA;AAAA,KACxC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,IAAA;AAAA,KACtC;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,KAAA;AAAA,KACtC;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,IAAA;AAAA,KACzC;AAAA,IACA,iBAAmB,EAAA;AAAA,MACjB,K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MAAM,qBAAqB,CAAC;AAAA,EACjC,UAAA;AAAA,EACA,SAAA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAM,MAAA,UAAA,GAAa,CAAG,EAAA,OAAA,CAAQ,IAAI,CAAA,CAAA,EAChC,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,GAAS,OAAQ,CAAA,IAAA,GAAO,EACjD,CAAA,CAAA,CAAA;AAEA,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,aAAe,EAAA;AAAA,MACb,UAAY,EAAA;AAAA,QACV,QAAU,EAAA;AAAA,UACR,SAAA,EAAW,CAAC,kBAAA,EAAoB,iBAAiB,CAAA;AAAA,SACnD;AAAA,OACF;AAAA,KACF;AAAA,GACF,CAAA;AAGA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,MAAA,CAAA,aAAA,CAAc,UAAW,CAAA,QAAA,CAAS,SAAY,GAAA,SAAA,CAAA;AAAA,GACvD;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,UAAA,EAAA,sCACb,QAAS,EAAA,EAAA,MAAA,EAAQ,UAAY,EAAA,MAAA,EAAgB,CAChD,CAAA,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = React.lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;AAqBA,MAAM,yBAAyB,KAAM,CAAA,IAAA;AAAA,EAAK,MACxC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACxC,SAAS,CAAE,CAAA,kBAAA;AAAA,GACX,CAAA,CAAA;AACJ,CAAA,CAAA;AAQa,MAAA,wBAAA,GAA2B,CACtC,KACG,KAAA;AACH,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,qBAC3B,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CACrC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.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 { Progress } from '@backstage/core-components';\nimport React, { Suspense } from 'react';\nimport { AsyncApiResolver } from './AsyncApiDefinition';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = React.lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;AAsBA,MAAM,yBAAyB,KAAM,CAAA,IAAA;AAAA,EAAK,MACxC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAM,CAAA,MAAA;AAAA,IACxC,SAAS,CAAE,CAAA,kBAAA;AAAA,GACX,CAAA,CAAA;AACJ,CAAA,CAAA;AASa,MAAA,wBAAA,GAA2B,CACtC,KACG,KAAA;AACH,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,kBAAW,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,qBAC3B,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CACrC,CAAA,CAAA;AAEJ;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { RELATION_API_CONSUMED_BY } from '@backstage/catalog-model';
2
2
  import Typography from '@material-ui/core/Typography';
3
- import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
3
+ import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
4
4
  import React from 'react';
5
5
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
6
6
 
7
7
  const ConsumingComponentsCard = (props) => {
8
- const { variant = "gridItem" } = props;
8
+ const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
9
9
  const { entity } = useEntity();
10
10
  const { entities, loading, error } = useRelatedEntities(entity, {
11
11
  type: RELATION_API_CONSUMED_BY
@@ -29,7 +29,7 @@ const ConsumingComponentsCard = (props) => {
29
29
  title: "Consumers",
30
30
  variant,
31
31
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
32
- columns: EntityTable.componentEntityColumns,
32
+ columns,
33
33
  entities
34
34
  }
35
35
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.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 ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem' } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuCa,MAAA,uBAAA,GAA0B,CAAC,KAElC,KAAA;AACJ,EAAM,MAAA,EAAE,OAAU,GAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AACjC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,wBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,OAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAkB,EAAA,KAAA,EAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,2BAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,OAAA;AAAA,MACA,YAAA,kBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,WAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,SAAS,WAAY,CAAA,sBAAA;AAAA,MACrB,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.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 ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA,CAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA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ION_API_PROVIDED_BY } from '@backstage/catalog-model';
2
2
  import Typography from '@material-ui/core/Typography';
3
- import { useEntity, useRelatedEntities, EntityTable } from '@backstage/plugin-catalog-react';
3
+ import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
4
4
  import React from 'react';
5
5
  import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
6
6
 
7
7
  const ProvidingComponentsCard = (props) => {
8
- const { variant = "gridItem" } = props;
8
+ const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
9
9
  const { entity } = useEntity();
10
10
  const { entities, loading, error } = useRelatedEntities(entity, {
11
11
  type: RELATION_API_PROVIDED_BY
@@ -29,7 +29,7 @@ const ProvidingComponentsCard = (props) => {
29
29
  title: "Providers",
30
30
  variant,
31
31
  emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
32
- columns: EntityTable.componentEntityColumns,
32
+ columns,
33
33
  entities
34
34
  }
35
35
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.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 ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem' } = props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={EntityTable.componentEntityColumns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAqCa,MAAA,uBAAA,GAA0B,CAAC,KAElC,KAAA;AACJ,EAAM,MAAA,EAAE,OAAU,GAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AACjC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,wBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,OAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAkB,EAAA,KAAA,EAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,2BAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,OAAA;AAAA,MACA,YAAA,kBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,WAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,SAAS,WAAY,CAAA,sBAAA;AAAA,MACrB,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.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 ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAsCa,MAA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A,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,10 +2,11 @@
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import * as _backstage_core_components from '@backstage/core-components';
5
- import { TableColumn, TableProps, InfoCardVariants } from '@backstage/core-components';
5
+ import { TableColumn, TableProps, InfoCardVariants, TableOptions } from '@backstage/core-components';
6
6
  import { CatalogTableRow } from '@backstage/plugin-catalog';
7
7
  import { UserListFilterKind, EntityOwnerPickerProps } from '@backstage/plugin-catalog-react';
8
- import { ApiEntity } from '@backstage/catalog-model';
8
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
9
+ import { ApiEntity, ComponentEntity } from '@backstage/catalog-model';
9
10
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
10
11
 
11
12
  /**
@@ -66,7 +67,9 @@ declare function ApiDefinitionDialog(props: {
66
67
  */
67
68
  declare const ConsumedApisCard: (props: {
68
69
  variant?: InfoCardVariants;
70
+ title?: string;
69
71
  columns?: TableColumn<ApiEntity>[];
72
+ tableOptions?: TableOptions;
70
73
  }) => React__default.JSX.Element;
71
74
 
72
75
  /**
@@ -74,7 +77,9 @@ declare const ConsumedApisCard: (props: {
74
77
  */
75
78
  declare const HasApisCard: (props: {
76
79
  variant?: InfoCardVariants;
80
+ title?: string;
77
81
  columns?: TableColumn<ApiEntity>[];
82
+ tableOptions?: TableOptions;
78
83
  }) => React__default.JSX.Element;
79
84
 
80
85
  /**
@@ -82,12 +87,23 @@ declare const HasApisCard: (props: {
82
87
  */
83
88
  declare const ProvidedApisCard: (props: {
84
89
  variant?: InfoCardVariants;
90
+ title?: string;
85
91
  columns?: TableColumn<ApiEntity>[];
92
+ tableOptions?: TableOptions;
86
93
  }) => React__default.JSX.Element;
87
94
 
95
+ /** @public */
96
+ type AsyncApiResolver = {
97
+ schema: string;
98
+ order: number;
99
+ canRead: boolean;
100
+ read(uri: any): Promise<string>;
101
+ };
102
+
88
103
  /** @public */
89
104
  type AsyncApiDefinitionWidgetProps = {
90
105
  definition: string;
106
+ resolvers?: AsyncApiResolver[];
91
107
  };
92
108
  /** @public */
93
109
  declare const AsyncApiDefinitionWidget: (props: AsyncApiDefinitionWidgetProps) => React__default.JSX.Element;
@@ -97,11 +113,13 @@ declare const AsyncApiDefinitionWidget: (props: AsyncApiDefinitionWidgetProps) =
97
113
  */
98
114
  declare const ConsumingComponentsCard: (props: {
99
115
  variant?: InfoCardVariants;
116
+ columns?: TableColumn<ComponentEntity>[];
100
117
  }) => React__default.JSX.Element;
101
118
 
102
119
  /** @public */
103
120
  declare const ProvidingComponentsCard: (props: {
104
121
  variant?: InfoCardVariants;
122
+ columns?: TableColumn<ComponentEntity>[];
105
123
  }) => React__default.JSX.Element;
106
124
 
107
125
  /** @public */
@@ -155,25 +173,33 @@ declare const EntityApiDefinitionCard: () => React.JSX.Element;
155
173
  /** @public */
156
174
  declare const EntityConsumedApisCard: (props: {
157
175
  variant?: _backstage_core_components.InfoCardVariants | undefined;
176
+ title?: string | undefined;
158
177
  columns?: _backstage_core_components.TableColumn<ApiEntity>[] | undefined;
178
+ tableOptions?: _backstage_core_components.TableOptions<{}> | undefined;
159
179
  }) => React.JSX.Element;
160
180
  /** @public */
161
181
  declare const EntityConsumingComponentsCard: (props: {
162
182
  variant?: _backstage_core_components.InfoCardVariants | undefined;
183
+ columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
163
184
  }) => React.JSX.Element;
164
185
  /** @public */
165
186
  declare const EntityProvidedApisCard: (props: {
166
187
  variant?: _backstage_core_components.InfoCardVariants | undefined;
188
+ title?: string | undefined;
167
189
  columns?: _backstage_core_components.TableColumn<ApiEntity>[] | undefined;
190
+ tableOptions?: _backstage_core_components.TableOptions<{}> | undefined;
168
191
  }) => React.JSX.Element;
169
192
  /** @public */
170
193
  declare const EntityProvidingComponentsCard: (props: {
171
194
  variant?: _backstage_core_components.InfoCardVariants | undefined;
195
+ columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
172
196
  }) => React.JSX.Element;
173
197
  /** @public */
174
198
  declare const EntityHasApisCard: (props: {
175
199
  variant?: _backstage_core_components.InfoCardVariants | undefined;
200
+ title?: string | undefined;
176
201
  columns?: _backstage_core_components.TableColumn<ApiEntity>[] | undefined;
202
+ tableOptions?: _backstage_core_components.TableOptions<{}> | undefined;
177
203
  }) => React.JSX.Element;
178
204
 
179
- export { ApiDefinitionCard, ApiDefinitionDialog, type ApiDefinitionWidget, type ApiDocsConfig, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, type AsyncApiDefinitionWidgetProps, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, type DefaultApiExplorerPageProps, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, GraphQlDefinitionWidget, type GraphQlDefinitionWidgetProps, HasApisCard, OpenApiDefinitionWidget, type OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, type PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, TrpcApiDefinitionWidget, type TrpcApiDefinitionWidgetProps, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
205
+ export { ApiDefinitionCard, ApiDefinitionDialog, type ApiDefinitionWidget, type ApiDocsConfig, ApiExplorerPage$1 as ApiExplorerIndexPage, ApiExplorerPage, ApiTypeTitle, AsyncApiDefinitionWidget, type AsyncApiDefinitionWidgetProps, type AsyncApiResolver, ConsumedApisCard, ConsumingComponentsCard, DefaultApiExplorerPage, type DefaultApiExplorerPageProps, EntityApiDefinitionCard, EntityConsumedApisCard, EntityConsumingComponentsCard, EntityHasApisCard, EntityProvidedApisCard, EntityProvidingComponentsCard, GraphQlDefinitionWidget, type GraphQlDefinitionWidgetProps, HasApisCard, OpenApiDefinitionWidget, type OpenApiDefinitionWidgetProps, PlainApiDefinitionWidget, type PlainApiDefinitionWidgetProps, ProvidedApisCard, ProvidingComponentsCard, TrpcApiDefinitionWidget, type TrpcApiDefinitionWidgetProps, apiDocsConfigRef, apiDocsPlugin, defaultDefinitionWidgets, apiDocsPlugin as plugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs",
3
- "version": "0.11.8-next.2",
3
+ "version": "0.11.8",
4
4
  "description": "A Backstage plugin that helps represent API entities in the frontend",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -53,15 +53,15 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@asyncapi/react-component": "1.3.1",
56
- "@backstage/catalog-model": "^1.5.0",
57
- "@backstage/core-compat-api": "^0.2.8-next.2",
58
- "@backstage/core-components": "^0.14.10-next.0",
56
+ "@backstage/catalog-model": "^1.6.0",
57
+ "@backstage/core-compat-api": "^0.2.8",
58
+ "@backstage/core-components": "^0.14.10",
59
59
  "@backstage/core-plugin-api": "^1.9.3",
60
- "@backstage/frontend-plugin-api": "^0.7.0-next.2",
61
- "@backstage/plugin-catalog": "^1.22.0-next.2",
62
- "@backstage/plugin-catalog-common": "^1.0.26-next.1",
63
- "@backstage/plugin-catalog-react": "^1.12.3-next.2",
64
- "@backstage/plugin-permission-react": "^0.4.25-next.1",
60
+ "@backstage/frontend-plugin-api": "^0.7.0",
61
+ "@backstage/plugin-catalog": "^1.22.0",
62
+ "@backstage/plugin-catalog-common": "^1.0.26",
63
+ "@backstage/plugin-catalog-react": "^1.12.3",
64
+ "@backstage/plugin-permission-react": "^0.4.25",
65
65
  "@graphiql/react": "^0.23.0",
66
66
  "@material-ui/core": "^4.12.2",
67
67
  "@material-ui/icons": "^4.9.1",
@@ -75,10 +75,10 @@
75
75
  "swagger-ui-react": "^5.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@backstage/cli": "^0.27.0-next.3",
79
- "@backstage/core-app-api": "^1.14.2-next.0",
80
- "@backstage/dev-utils": "^1.0.37-next.2",
81
- "@backstage/test-utils": "^1.5.10-next.2",
78
+ "@backstage/cli": "^0.27.0",
79
+ "@backstage/core-app-api": "^1.14.2",
80
+ "@backstage/dev-utils": "^1.0.37",
81
+ "@backstage/test-utils": "^1.5.10",
82
82
  "@testing-library/dom": "^10.0.0",
83
83
  "@testing-library/jest-dom": "^6.0.0",
84
84
  "@testing-library/react": "^15.0.0",