@backstage-community/plugin-graphql-voyager 0.1.18 → 0.1.20

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,17 @@
1
1
  # @backstage-community/plugin-graphql-voyager
2
2
 
3
+ ## 0.1.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 0915bc6: Backstage version bump to v1.30.2
8
+
9
+ ## 0.1.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 104fab5: Backstage version bump to v1.29.2
14
+
3
15
  ## 0.1.18
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,62 @@
1
+ import { introspectionQuery } from '../../lib/api/types.esm.js';
2
+ import React, { useState, Suspense } from 'react';
3
+ import Tab from '@material-ui/core/Tab';
4
+ import Tabs from '@material-ui/core/Tabs';
5
+ import Typography from '@material-ui/core/Typography';
6
+ import { makeStyles } from '@material-ui/core/styles';
7
+ import { Progress, Content, ErrorPanel } from '@backstage/core-components';
8
+ import { Voyager } from 'graphql-voyager';
9
+ import useAsync from 'react-use/esm/useAsync';
10
+
11
+ const useStyles = makeStyles({
12
+ root: {
13
+ height: "100%",
14
+ display: "flex",
15
+ flexFlow: "column nowrap"
16
+ }
17
+ });
18
+ const NoEndpoints = () => {
19
+ return /* @__PURE__ */ React.createElement(Typography, { variant: "h4" }, "No endpoints available");
20
+ };
21
+ const VoyagerBrowserContent = ({
22
+ endpoint
23
+ }) => {
24
+ const { id, introspection, introspectionErrorMessage, voyagerProps } = endpoint;
25
+ const { value, loading, error } = useAsync(
26
+ () => introspection(introspectionQuery),
27
+ [endpoint]
28
+ );
29
+ if (loading) {
30
+ return /* @__PURE__ */ React.createElement(Progress, null);
31
+ } else if (error) {
32
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
33
+ }
34
+ return value.data ? /* @__PURE__ */ React.createElement(Voyager, { key: id, introspection: value, ...voyagerProps }) : /* @__PURE__ */ React.createElement(Typography, { variant: "h4", color: "error" }, introspectionErrorMessage);
35
+ };
36
+ const VoyagerBrowser = (props) => {
37
+ const { endpoints } = props;
38
+ const [tabIndex, setTabIndex] = useState(0);
39
+ const classes = useStyles();
40
+ return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(
41
+ Tabs,
42
+ {
43
+ value: tabIndex,
44
+ onChange: (_, value) => setTabIndex(value),
45
+ indicatorColor: "primary"
46
+ },
47
+ endpoints.map(({ title, id }, index) => /* @__PURE__ */ React.createElement(Tab, { key: id, label: title, value: index }))
48
+ ), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(VoyagerBrowserContent, { endpoint: endpoints[tabIndex] }))));
49
+ };
50
+ const GraphQLVoyagerBrowser = (props) => {
51
+ const hasEndpoints = checkEndpoints(props);
52
+ if (!hasEndpoints) {
53
+ return /* @__PURE__ */ React.createElement(NoEndpoints, null);
54
+ }
55
+ return /* @__PURE__ */ React.createElement(VoyagerBrowser, { ...props });
56
+ };
57
+ function checkEndpoints(props) {
58
+ return props.endpoints.length;
59
+ }
60
+
61
+ export { GraphQLVoyagerBrowser };
62
+ //# sourceMappingURL=GraphQLVoyagerBrowser.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLVoyagerBrowser.esm.js","sources":["../../../src/components/GraphQLVoyagerBrowser/GraphQLVoyagerBrowser.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 GraphQLVoyagerEndpoint,\n introspectionQuery,\n} from '../../lib/api/types';\nimport { useState } from 'react';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { Suspense } from 'react';\nimport { Content, ErrorPanel, Progress } from '@backstage/core-components';\nimport { Voyager } from 'graphql-voyager';\nimport useAsync from 'react-use/esm/useAsync';\n\nconst useStyles = makeStyles({\n root: {\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n});\n\ntype GraphQLVoyagerBrowserProps = {\n endpoints: GraphQLVoyagerEndpoint[];\n};\n\nconst NoEndpoints = () => {\n return <Typography variant=\"h4\">No endpoints available</Typography>;\n};\n\nconst VoyagerBrowserContent = ({\n endpoint,\n}: {\n endpoint: GraphQLVoyagerEndpoint;\n}) => {\n const { id, introspection, introspectionErrorMessage, voyagerProps } =\n endpoint;\n const { value, loading, error } = useAsync(\n () => introspection(introspectionQuery),\n [endpoint],\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n return value.data ? (\n <Voyager key={id} introspection={value} {...voyagerProps} />\n ) : (\n <Typography variant=\"h4\" color=\"error\">\n {introspectionErrorMessage}\n </Typography>\n );\n};\n\nconst VoyagerBrowser = (props: GraphQLVoyagerBrowserProps) => {\n const { endpoints } = props;\n const [tabIndex, setTabIndex] = useState(0);\n const classes = useStyles();\n\n return (\n <div className={classes.root}>\n <Suspense fallback={<Progress />}>\n <Tabs\n value={tabIndex}\n onChange={(_, value) => setTabIndex(value)}\n indicatorColor=\"primary\"\n >\n {endpoints.map(({ title, id }, index) => (\n <Tab key={id} label={title} value={index} />\n ))}\n </Tabs>\n <Content>\n <VoyagerBrowserContent endpoint={endpoints[tabIndex]} />\n </Content>\n </Suspense>\n </div>\n );\n};\n\n/** @public */\nexport const GraphQLVoyagerBrowser = (props: GraphQLVoyagerBrowserProps) => {\n const hasEndpoints = checkEndpoints(props);\n\n if (!hasEndpoints) {\n return <NoEndpoints />;\n }\n return <VoyagerBrowser {...props} />;\n};\n\nfunction checkEndpoints(props: GraphQLVoyagerBrowserProps) {\n return props.endpoints.length;\n}\n"],"names":[],"mappings":";;;;;;;;;;AA8BA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,eAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAMD,MAAM,cAAc,MAAM;AACxB,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAA,EAAK,wBAAsB,CAAA,CAAA;AACxD,CAAA,CAAA;AAEA,MAAM,wBAAwB,CAAC;AAAA,EAC7B,QAAA;AACF,CAEM,KAAA;AACJ,EAAA,MAAM,EAAE,EAAA,EAAI,aAAe,EAAA,yBAAA,EAA2B,cACpD,GAAA,QAAA,CAAA;AACF,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,MAAM,cAAc,kBAAkB,CAAA;AAAA,IACtC,CAAC,QAAQ,CAAA;AAAA,GACX,CAAA;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA,CAAA;AAAA,GACnC;AACA,EAAA,OAAO,MAAM,IACX,mBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,GAAA,EAAK,IAAI,aAAe,EAAA,KAAA,EAAQ,GAAG,YAAA,EAAc,oBAEzD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IAAK,EAAA,KAAA,EAAM,WAC5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AA,GACtB;AACA,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAgB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AACpC,EAAA;AAEA,SAAS,eAAe,KAAmC,EAAA;AACzD,EAAA,OAAO,MAAM,SAAU,CAAA,MAAA,CAAA;AACzB;;;;"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Page, Header, Content, Progress, ErrorPanel } from '@backstage/core-components';
3
+ import { useApi } from '@backstage/core-plugin-api';
4
+ import 'graphql-voyager/dist/voyager.css';
5
+ import { graphQlVoyagerApiRef } from '../../lib/api/types.esm.js';
6
+ import useAsync from 'react-use/esm/useAsync';
7
+ import { GraphQLVoyagerBrowser } from '../GraphQLVoyagerBrowser/GraphQLVoyagerBrowser.esm.js';
8
+
9
+ const VoyagerContent = () => {
10
+ const graphQLVoyagerApi = useApi(graphQlVoyagerApiRef);
11
+ const { value, loading, error } = useAsync(
12
+ () => graphQLVoyagerApi.getEndpoints()
13
+ );
14
+ if (loading) {
15
+ return /* @__PURE__ */ React.createElement(Progress, null);
16
+ } else if (error) {
17
+ return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
18
+ }
19
+ return /* @__PURE__ */ React.createElement(GraphQLVoyagerBrowser, { endpoints: value });
20
+ };
21
+ const GraphQLVoyagerPage = (props) => {
22
+ const { title = "Welcome to Voyager!" } = props;
23
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(VoyagerContent, null)));
24
+ };
25
+
26
+ export { GraphQLVoyagerPage };
27
+ //# sourceMappingURL=GraphQLVoyagerPage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLVoyagerPage.esm.js","sources":["../../../src/components/GraphQLVoyagerPage/GraphQLVoyagerPage.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport {\n Header,\n Page,\n Content,\n Progress,\n ErrorPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport 'graphql-voyager/dist/voyager.css';\nimport { graphQlVoyagerApiRef } from '../../lib/api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { GraphQLVoyagerBrowser } from '../GraphQLVoyagerBrowser';\n\n/** @public */\nexport type GraphQLVoyagerPageProps = {\n title?: string;\n};\n\nconst VoyagerContent = () => {\n const graphQLVoyagerApi = useApi(graphQlVoyagerApiRef);\n\n const { value, loading, error } = useAsync(() =>\n graphQLVoyagerApi.getEndpoints(),\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n return <GraphQLVoyagerBrowser endpoints={value!} />;\n};\n\n/** @public */\nexport const GraphQLVoyagerPage = (props: GraphQLVoyagerPageProps) => {\n const { title = 'Welcome to Voyager!' } = props;\n\n return (\n <Page themeId=\"tool\">\n <Header title={title} />\n <Content>\n <VoyagerContent />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAkCA,MAAM,iBAAiB,MAAM;AAC3B,EAAM,MAAA,iBAAA,GAAoB,OAAO,oBAAoB,CAAA,CAAA;AAErD,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAAS,MACzC,kBAAkB,YAAa,EAAA;AAAA,GACjC,CAAA;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,qBAAsB,EAAA,EAAA,SAAA,EAAW,KAAQ,EAAA,CAAA,CAAA;AACnD,CAAA,CAAA;AAGa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAM,MAAA,EAAE,KAAQ,GAAA,qBAAA,EAA0B,GAAA,KAAA,CAAA;AAE1C,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,kBACX,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,KAAc,EAAA,CAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,CAClB,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,3 @@
1
+ export { GraphQLVoyagerPage } from './GraphQLVoyagerPage/GraphQLVoyagerPage.esm.js';
2
+ export { GraphQLVoyagerBrowser } from './GraphQLVoyagerBrowser/GraphQLVoyagerBrowser.esm.js';
3
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/index.esm.js CHANGED
@@ -1,12 +1,6 @@
1
- export { c as GraphQLVoyagerEndpoints, b as GraphqlVoyagerPage, G as Router, d as graphQlVoyagerApiRef, g as graphqlVoyagerPlugin, i as introspectionQuery } from './esm/index-DR0gwXc7.esm.js';
2
- import '@backstage/core-plugin-api';
3
- import 'react';
4
- import '@backstage/core-components';
5
- import 'graphql-voyager/dist/voyager.css';
6
- import 'react-use/esm/useAsync';
7
- import '@material-ui/core/Tab';
8
- import '@material-ui/core/Tabs';
9
- import '@material-ui/core/Typography';
10
- import '@material-ui/core/styles';
11
- import 'graphql-voyager';
1
+ export { GraphqlVoyagerPage, graphqlVoyagerPlugin } from './plugin.esm.js';
2
+ export { GraphQLVoyagerPage as Router } from './components/GraphQLVoyagerPage/GraphQLVoyagerPage.esm.js';
3
+ import './components/GraphQLVoyagerBrowser/GraphQLVoyagerBrowser.esm.js';
4
+ export { GraphQLVoyagerEndpoints } from './lib/api/GraphQLVoyagerEndpoints.esm.js';
5
+ export { graphQlVoyagerApiRef, introspectionQuery } from './lib/api/types.esm.js';
12
6
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,14 @@
1
+ class GraphQLVoyagerEndpoints {
2
+ constructor(endpoints) {
3
+ this.endpoints = endpoints;
4
+ }
5
+ static from(endpoints) {
6
+ return new GraphQLVoyagerEndpoints(endpoints);
7
+ }
8
+ async getEndpoints() {
9
+ return this.endpoints;
10
+ }
11
+ }
12
+
13
+ export { GraphQLVoyagerEndpoints };
14
+ //# sourceMappingURL=GraphQLVoyagerEndpoints.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLVoyagerEndpoints.esm.js","sources":["../../../src/lib/api/GraphQLVoyagerEndpoints.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { GraphQLVoyagerApi, GraphQLVoyagerEndpoint } from './types';\n\n/** @public */\nexport class GraphQLVoyagerEndpoints implements GraphQLVoyagerApi {\n private constructor(private readonly endpoints: GraphQLVoyagerEndpoint[]) {}\n\n static from(endpoints: GraphQLVoyagerEndpoint[]) {\n return new GraphQLVoyagerEndpoints(endpoints);\n }\n\n async getEndpoints() {\n return this.endpoints;\n }\n}\n"],"names":[],"mappings":"AAkBO,MAAM,uBAAqD,CAAA;AAAA,EACxD,YAA6B,SAAqC,EAAA;AAArC,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAA,GAAsC;AAAA,EAE3E,OAAO,KAAK,SAAqC,EAAA;AAC/C,IAAO,OAAA,IAAI,wBAAwB,SAAS,CAAA,CAAA;AAAA,GAC9C;AAAA,EAEA,MAAM,YAAe,GAAA;AACnB,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GACd;AACF;;;;"}
@@ -0,0 +1,104 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+
3
+ const graphQlVoyagerApiRef = createApiRef({
4
+ id: "plugin.graphqlvoyager.api"
5
+ });
6
+ const introspectionQuery = `query IntrospectionQuery {
7
+ __schema {
8
+
9
+ queryType { name }
10
+ mutationType { name }
11
+ subscriptionType { name }
12
+ types {
13
+ ...FullType
14
+ }
15
+ directives {
16
+ name
17
+ description
18
+
19
+ locations
20
+ args {
21
+ ...InputValue
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ fragment FullType on __Type {
28
+ kind
29
+ name
30
+ description
31
+
32
+ fields(includeDeprecated: true) {
33
+ name
34
+ description
35
+ args {
36
+ ...InputValue
37
+ }
38
+ type {
39
+ ...TypeRef
40
+ }
41
+ isDeprecated
42
+ deprecationReason
43
+ }
44
+ inputFields {
45
+ ...InputValue
46
+ }
47
+ interfaces {
48
+ ...TypeRef
49
+ }
50
+ enumValues(includeDeprecated: true) {
51
+ name
52
+ description
53
+ isDeprecated
54
+ deprecationReason
55
+ }
56
+ possibleTypes {
57
+ ...TypeRef
58
+ }
59
+ }
60
+
61
+ fragment InputValue on __InputValue {
62
+ name
63
+ description
64
+ type { ...TypeRef }
65
+ defaultValue
66
+
67
+
68
+ }
69
+
70
+ fragment TypeRef on __Type {
71
+ kind
72
+ name
73
+ ofType {
74
+ kind
75
+ name
76
+ ofType {
77
+ kind
78
+ name
79
+ ofType {
80
+ kind
81
+ name
82
+ ofType {
83
+ kind
84
+ name
85
+ ofType {
86
+ kind
87
+ name
88
+ ofType {
89
+ kind
90
+ name
91
+ ofType {
92
+ kind
93
+ name
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }`;
102
+
103
+ export { graphQlVoyagerApiRef, introspectionQuery };
104
+ //# sourceMappingURL=types.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.esm.js","sources":["../../../src/lib/api/types.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { VoyagerProps } from 'graphql-voyager';\n\n/** @public */\nexport type GraphQLVoyagerEndpoint = {\n id: string;\n title: string;\n introspection: (body: any) => Promise<any>;\n introspectionErrorMessage: string;\n voyagerProps?: VoyagerProps;\n};\n\n/** @public */\nexport type GraphQLVoyagerApi = {\n getEndpoints(): Promise<GraphQLVoyagerEndpoint[]>;\n};\n\n/** @public */\nexport const graphQlVoyagerApiRef = createApiRef<GraphQLVoyagerApi>({\n id: 'plugin.graphqlvoyager.api',\n});\n\n/** @public */\nexport const introspectionQuery: string = `query IntrospectionQuery {\n __schema {\n \n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n \n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n \n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n \n \n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }`;\n"],"names":[],"mappings":";;AAiCO,MAAM,uBAAuB,YAAgC,CAAA;AAAA,EAClE,EAAI,EAAA,2BAAA;AACN,CAAC,EAAA;AAGM,MAAM,kBAA6B,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAA;;;;"}
@@ -0,0 +1,19 @@
1
+ import { createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
2
+ import { rootRouteRef } from './routes.esm.js';
3
+
4
+ const graphqlVoyagerPlugin = createPlugin({
5
+ id: "graphql-voyager",
6
+ routes: {
7
+ root: rootRouteRef
8
+ }
9
+ });
10
+ const GraphqlVoyagerPage = graphqlVoyagerPlugin.provide(
11
+ createRoutableExtension({
12
+ name: "GraphqlVoyagerPage",
13
+ component: () => import('./components/index.esm.js').then((m) => m.GraphQLVoyagerPage),
14
+ mountPoint: rootRouteRef
15
+ })
16
+ );
17
+
18
+ export { GraphqlVoyagerPage, graphqlVoyagerPlugin };
19
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\n\n/** @public */\nexport const graphqlVoyagerPlugin = createPlugin({\n id: 'graphql-voyager',\n routes: {\n root: rootRouteRef,\n },\n});\n\n/** @public */\nexport const GraphqlVoyagerPage = graphqlVoyagerPlugin.provide(\n createRoutableExtension({\n name: 'GraphqlVoyagerPage',\n component: () => import('./components').then(m => m.GraphQLVoyagerPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;AAuBO,MAAM,uBAAuB,YAAa,CAAA;AAAA,EAC/C,EAAI,EAAA,iBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAGM,MAAM,qBAAqB,oBAAqB,CAAA,OAAA;AAAA,EACrD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,oBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,2BAAc,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,kBAAkB,CAAA;AAAA,IACtE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
@@ -0,0 +1,8 @@
1
+ import { createRouteRef } from '@backstage/core-plugin-api';
2
+
3
+ const rootRouteRef = createRouteRef({
4
+ id: "graphql-voyager"
5
+ });
6
+
7
+ export { rootRouteRef };
8
+ //# sourceMappingURL=routes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'graphql-voyager',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,iBAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-graphql-voyager",
3
3
  "description": "Backstage plugin for GraphQL Voyager",
4
- "version": "0.1.18",
4
+ "version": "0.1.20",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -11,7 +11,11 @@
11
11
  "types": "dist/index.d.ts"
12
12
  },
13
13
  "backstage": {
14
- "role": "frontend-plugin"
14
+ "role": "frontend-plugin",
15
+ "pluginId": "graphql-voyager",
16
+ "pluginPackages": [
17
+ "@backstage-community/plugin-graphql-voyager"
18
+ ]
15
19
  },
16
20
  "homepage": "https://backstage.io",
17
21
  "repository": {
@@ -30,8 +34,8 @@
30
34
  "postpack": "backstage-cli package postpack"
31
35
  },
32
36
  "dependencies": {
33
- "@backstage/core-components": "^0.14.4",
34
- "@backstage/core-plugin-api": "^1.9.2",
37
+ "@backstage/core-components": "^0.14.10",
38
+ "@backstage/core-plugin-api": "^1.9.3",
35
39
  "@material-ui/core": "^4.12.2",
36
40
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
37
41
  "graphql-voyager": "^2.0.0",
@@ -43,8 +47,8 @@
43
47
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
44
48
  },
45
49
  "devDependencies": {
46
- "@backstage/cli": "^0.26.3",
47
- "@backstage/test-utils": "^1.5.4",
50
+ "@backstage/cli": "^0.27.0",
51
+ "@backstage/test-utils": "^1.5.10",
48
52
  "@testing-library/dom": "^10.0.0",
49
53
  "@testing-library/jest-dom": "^6.0.0",
50
54
  "@testing-library/react": "^15.0.0",
@@ -1,210 +0,0 @@
1
- import { createRouteRef, createPlugin, createRoutableExtension, createApiRef, useApi } from '@backstage/core-plugin-api';
2
- import React, { useState, Suspense } from 'react';
3
- import { Progress, Content, ErrorPanel, Page, Header } from '@backstage/core-components';
4
- import 'graphql-voyager/dist/voyager.css';
5
- import useAsync from 'react-use/esm/useAsync';
6
- import Tab from '@material-ui/core/Tab';
7
- import Tabs from '@material-ui/core/Tabs';
8
- import Typography from '@material-ui/core/Typography';
9
- import { makeStyles } from '@material-ui/core/styles';
10
- import { Voyager } from 'graphql-voyager';
11
-
12
- const rootRouteRef = createRouteRef({
13
- id: "graphql-voyager"
14
- });
15
-
16
- const graphqlVoyagerPlugin = createPlugin({
17
- id: "graphql-voyager",
18
- routes: {
19
- root: rootRouteRef
20
- }
21
- });
22
- const GraphqlVoyagerPage = graphqlVoyagerPlugin.provide(
23
- createRoutableExtension({
24
- name: "GraphqlVoyagerPage",
25
- component: () => import('./index-DfFlOE_s.esm.js').then((m) => m.GraphQLVoyagerPage),
26
- mountPoint: rootRouteRef
27
- })
28
- );
29
-
30
- class GraphQLVoyagerEndpoints {
31
- constructor(endpoints) {
32
- this.endpoints = endpoints;
33
- }
34
- static from(endpoints) {
35
- return new GraphQLVoyagerEndpoints(endpoints);
36
- }
37
- async getEndpoints() {
38
- return this.endpoints;
39
- }
40
- }
41
-
42
- const graphQlVoyagerApiRef = createApiRef({
43
- id: "plugin.graphqlvoyager.api"
44
- });
45
- const introspectionQuery = `query IntrospectionQuery {
46
- __schema {
47
-
48
- queryType { name }
49
- mutationType { name }
50
- subscriptionType { name }
51
- types {
52
- ...FullType
53
- }
54
- directives {
55
- name
56
- description
57
-
58
- locations
59
- args {
60
- ...InputValue
61
- }
62
- }
63
- }
64
- }
65
-
66
- fragment FullType on __Type {
67
- kind
68
- name
69
- description
70
-
71
- fields(includeDeprecated: true) {
72
- name
73
- description
74
- args {
75
- ...InputValue
76
- }
77
- type {
78
- ...TypeRef
79
- }
80
- isDeprecated
81
- deprecationReason
82
- }
83
- inputFields {
84
- ...InputValue
85
- }
86
- interfaces {
87
- ...TypeRef
88
- }
89
- enumValues(includeDeprecated: true) {
90
- name
91
- description
92
- isDeprecated
93
- deprecationReason
94
- }
95
- possibleTypes {
96
- ...TypeRef
97
- }
98
- }
99
-
100
- fragment InputValue on __InputValue {
101
- name
102
- description
103
- type { ...TypeRef }
104
- defaultValue
105
-
106
-
107
- }
108
-
109
- fragment TypeRef on __Type {
110
- kind
111
- name
112
- ofType {
113
- kind
114
- name
115
- ofType {
116
- kind
117
- name
118
- ofType {
119
- kind
120
- name
121
- ofType {
122
- kind
123
- name
124
- ofType {
125
- kind
126
- name
127
- ofType {
128
- kind
129
- name
130
- ofType {
131
- kind
132
- name
133
- }
134
- }
135
- }
136
- }
137
- }
138
- }
139
- }
140
- }`;
141
-
142
- const useStyles = makeStyles({
143
- root: {
144
- height: "100%",
145
- display: "flex",
146
- flexFlow: "column nowrap"
147
- }
148
- });
149
- const NoEndpoints = () => {
150
- return /* @__PURE__ */ React.createElement(Typography, { variant: "h4" }, "No endpoints available");
151
- };
152
- const VoyagerBrowserContent = ({
153
- endpoint
154
- }) => {
155
- const { id, introspection, introspectionErrorMessage, voyagerProps } = endpoint;
156
- const { value, loading, error } = useAsync(
157
- () => introspection(introspectionQuery),
158
- [endpoint]
159
- );
160
- if (loading) {
161
- return /* @__PURE__ */ React.createElement(Progress, null);
162
- } else if (error) {
163
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
164
- }
165
- return value.data ? /* @__PURE__ */ React.createElement(Voyager, { key: id, introspection: value, ...voyagerProps }) : /* @__PURE__ */ React.createElement(Typography, { variant: "h4", color: "error" }, introspectionErrorMessage);
166
- };
167
- const VoyagerBrowser = (props) => {
168
- const { endpoints } = props;
169
- const [tabIndex, setTabIndex] = useState(0);
170
- const classes = useStyles();
171
- return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(
172
- Tabs,
173
- {
174
- value: tabIndex,
175
- onChange: (_, value) => setTabIndex(value),
176
- indicatorColor: "primary"
177
- },
178
- endpoints.map(({ title, id }, index) => /* @__PURE__ */ React.createElement(Tab, { key: id, label: title, value: index }))
179
- ), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(VoyagerBrowserContent, { endpoint: endpoints[tabIndex] }))));
180
- };
181
- const GraphQLVoyagerBrowser = (props) => {
182
- const hasEndpoints = checkEndpoints(props);
183
- if (!hasEndpoints) {
184
- return /* @__PURE__ */ React.createElement(NoEndpoints, null);
185
- }
186
- return /* @__PURE__ */ React.createElement(VoyagerBrowser, { ...props });
187
- };
188
- function checkEndpoints(props) {
189
- return props.endpoints.length;
190
- }
191
-
192
- const VoyagerContent = () => {
193
- const graphQLVoyagerApi = useApi(graphQlVoyagerApiRef);
194
- const { value, loading, error } = useAsync(
195
- () => graphQLVoyagerApi.getEndpoints()
196
- );
197
- if (loading) {
198
- return /* @__PURE__ */ React.createElement(Progress, null);
199
- } else if (error) {
200
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
201
- }
202
- return /* @__PURE__ */ React.createElement(GraphQLVoyagerBrowser, { endpoints: value });
203
- };
204
- const GraphQLVoyagerPage = (props) => {
205
- const { title = "Welcome to Voyager!" } = props;
206
- return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(VoyagerContent, null)));
207
- };
208
-
209
- export { GraphQLVoyagerPage as G, GraphQLVoyagerBrowser as a, GraphqlVoyagerPage as b, GraphQLVoyagerEndpoints as c, graphQlVoyagerApiRef as d, graphqlVoyagerPlugin as g, introspectionQuery as i };
210
- //# sourceMappingURL=index-DR0gwXc7.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DR0gwXc7.esm.js","sources":["../../src/routes.ts","../../src/plugin.ts","../../src/lib/api/GraphQLVoyagerEndpoints.ts","../../src/lib/api/types.ts","../../src/components/GraphQLVoyagerBrowser/GraphQLVoyagerBrowser.tsx","../../src/components/GraphQLVoyagerPage/GraphQLVoyagerPage.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'graphql-voyager',\n});\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\n\n/** @public */\nexport const graphqlVoyagerPlugin = createPlugin({\n id: 'graphql-voyager',\n routes: {\n root: rootRouteRef,\n },\n});\n\n/** @public */\nexport const GraphqlVoyagerPage = graphqlVoyagerPlugin.provide(\n createRoutableExtension({\n name: 'GraphqlVoyagerPage',\n component: () => import('./components').then(m => m.GraphQLVoyagerPage),\n mountPoint: rootRouteRef,\n }),\n);\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { GraphQLVoyagerApi, GraphQLVoyagerEndpoint } from './types';\n\n/** @public */\nexport class GraphQLVoyagerEndpoints implements GraphQLVoyagerApi {\n private constructor(private readonly endpoints: GraphQLVoyagerEndpoint[]) {}\n\n static from(endpoints: GraphQLVoyagerEndpoint[]) {\n return new GraphQLVoyagerEndpoints(endpoints);\n }\n\n async getEndpoints() {\n return this.endpoints;\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { VoyagerProps } from 'graphql-voyager';\n\n/** @public */\nexport type GraphQLVoyagerEndpoint = {\n id: string;\n title: string;\n introspection: (body: any) => Promise<any>;\n introspectionErrorMessage: string;\n voyagerProps?: VoyagerProps;\n};\n\n/** @public */\nexport type GraphQLVoyagerApi = {\n getEndpoints(): Promise<GraphQLVoyagerEndpoint[]>;\n};\n\n/** @public */\nexport const graphQlVoyagerApiRef = createApiRef<GraphQLVoyagerApi>({\n id: 'plugin.graphqlvoyager.api',\n});\n\n/** @public */\nexport const introspectionQuery: string = `query IntrospectionQuery {\n __schema {\n \n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n \n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n \n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n \n \n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }`;\n","/*\n * Copyright 2023 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 GraphQLVoyagerEndpoint,\n introspectionQuery,\n} from '../../lib/api/types';\nimport { useState } from 'react';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { Suspense } from 'react';\nimport { Content, ErrorPanel, Progress } from '@backstage/core-components';\nimport { Voyager } from 'graphql-voyager';\nimport useAsync from 'react-use/esm/useAsync';\n\nconst useStyles = makeStyles({\n root: {\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n});\n\ntype GraphQLVoyagerBrowserProps = {\n endpoints: GraphQLVoyagerEndpoint[];\n};\n\nconst NoEndpoints = () => {\n return <Typography variant=\"h4\">No endpoints available</Typography>;\n};\n\nconst VoyagerBrowserContent = ({\n endpoint,\n}: {\n endpoint: GraphQLVoyagerEndpoint;\n}) => {\n const { id, introspection, introspectionErrorMessage, voyagerProps } =\n endpoint;\n const { value, loading, error } = useAsync(\n () => introspection(introspectionQuery),\n [endpoint],\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n return value.data ? (\n <Voyager key={id} introspection={value} {...voyagerProps} />\n ) : (\n <Typography variant=\"h4\" color=\"error\">\n {introspectionErrorMessage}\n </Typography>\n );\n};\n\nconst VoyagerBrowser = (props: GraphQLVoyagerBrowserProps) => {\n const { endpoints } = props;\n const [tabIndex, setTabIndex] = useState(0);\n const classes = useStyles();\n\n return (\n <div className={classes.root}>\n <Suspense fallback={<Progress />}>\n <Tabs\n value={tabIndex}\n onChange={(_, value) => setTabIndex(value)}\n indicatorColor=\"primary\"\n >\n {endpoints.map(({ title, id }, index) => (\n <Tab key={id} label={title} value={index} />\n ))}\n </Tabs>\n <Content>\n <VoyagerBrowserContent endpoint={endpoints[tabIndex]} />\n </Content>\n </Suspense>\n </div>\n );\n};\n\n/** @public */\nexport const GraphQLVoyagerBrowser = (props: GraphQLVoyagerBrowserProps) => {\n const hasEndpoints = checkEndpoints(props);\n\n if (!hasEndpoints) {\n return <NoEndpoints />;\n }\n return <VoyagerBrowser {...props} />;\n};\n\nfunction checkEndpoints(props: GraphQLVoyagerBrowserProps) {\n return props.endpoints.length;\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport {\n Header,\n Page,\n Content,\n Progress,\n ErrorPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport 'graphql-voyager/dist/voyager.css';\nimport { graphQlVoyagerApiRef } from '../../lib/api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { GraphQLVoyagerBrowser } from '../GraphQLVoyagerBrowser';\n\n/** @public */\nexport type GraphQLVoyagerPageProps = {\n title?: string;\n};\n\nconst VoyagerContent = () => {\n const graphQLVoyagerApi = useApi(graphQlVoyagerApiRef);\n\n const { value, loading, error } = useAsync(() =>\n graphQLVoyagerApi.getEndpoints(),\n );\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n return <GraphQLVoyagerBrowser endpoints={value!} />;\n};\n\n/** @public */\nexport const GraphQLVoyagerPage = (props: GraphQLVoyagerPageProps) => {\n const { title = 'Welcome to Voyager!' } = props;\n\n return (\n <Page themeId=\"tool\">\n <Header title={title} />\n <Content>\n <VoyagerContent />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,iBAAA;AACN,CAAC,CAAA;;ACIM,MAAM,uBAAuB,YAAa,CAAA;AAAA,EAC/C,EAAI,EAAA,iBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAGM,MAAM,qBAAqB,oBAAqB,CAAA,OAAA;AAAA,EACrD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,oBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,yBAAc,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,kBAAkB,CAAA;AAAA,IACtE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;ACnBO,MAAM,uBAAqD,CAAA;AAAA,EACxD,YAA6B,SAAqC,EAAA;AAArC,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AAAA,GAAsC;AAAA,EAE3E,OAAO,KAAK,SAAqC,EAAA;AAC/C,IAAO,OAAA,IAAI,wBAAwB,SAAS,CAAA,CAAA;AAAA,GAC9C;AAAA,EAEA,MAAM,YAAe,GAAA;AACnB,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GACd;AACF;;ACKO,MAAM,uBAAuB,YAAgC,CAAA;AAAA,EAClE,EAAI,EAAA,2BAAA;AACN,CAAC,EAAA;AAGM,MAAM,kBAA6B,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,CAAA,MAAA,EAAA,EAAO,KAAc,EAAA,CAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,CAClB,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +0,0 @@
1
- export { a as GraphQLVoyagerBrowser, G as GraphQLVoyagerPage } from './index-DR0gwXc7.esm.js';
2
- import '@backstage/core-plugin-api';
3
- import 'react';
4
- import '@backstage/core-components';
5
- import 'graphql-voyager/dist/voyager.css';
6
- import 'react-use/esm/useAsync';
7
- import '@material-ui/core/Tab';
8
- import '@material-ui/core/Tabs';
9
- import '@material-ui/core/Typography';
10
- import '@material-ui/core/styles';
11
- import 'graphql-voyager';
12
- //# sourceMappingURL=index-DfFlOE_s.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DfFlOE_s.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}