@backstage-community/plugin-apollo-explorer 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/ApolloExplorerBrowser/ApolloExplorerBrowser.esm.js +27 -22
- package/dist/components/ApolloExplorerBrowser/ApolloExplorerBrowser.esm.js.map +1 -1
- package/dist/components/ApolloExplorerPage/ApolloExplorerPage.esm.js +5 -2
- package/dist/components/ApolloExplorerPage/ApolloExplorerPage.esm.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/package.json +12 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-apollo-explorer
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ca428bd: Backstage version bump to v1.39.0
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 6385b4f: Backstage version bump to v1.38.1
|
|
14
|
+
|
|
3
15
|
## 0.6.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import Divider from '@material-ui/core/Divider';
|
|
3
4
|
import Tab from '@material-ui/core/Tab';
|
|
4
5
|
import Tabs from '@material-ui/core/Tabs';
|
|
@@ -44,27 +45,31 @@ const ApolloExplorerBrowser = ({ endpoints }) => {
|
|
|
44
45
|
if (authCallback === void 0) return void 0;
|
|
45
46
|
return () => authCallback({ apiHolder });
|
|
46
47
|
};
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.root, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
Tabs,
|
|
51
|
+
{
|
|
52
|
+
classes: { root: classes.tabs },
|
|
53
|
+
value: tabIndex,
|
|
54
|
+
onChange: (_, value) => setTabIndex(value),
|
|
55
|
+
indicatorColor: "primary",
|
|
56
|
+
children: endpoints.map(({ title }, index) => /* @__PURE__ */ jsx(Tab, { label: title, value: index }, index))
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
60
|
+
/* @__PURE__ */ jsx(Content, { className: classes.content, children: /* @__PURE__ */ jsx(
|
|
61
|
+
ApolloExplorer,
|
|
62
|
+
{
|
|
63
|
+
className: classes.explorer,
|
|
64
|
+
graphRef: endpoints[tabIndex].graphRef,
|
|
65
|
+
handleRequest: handleAuthRequest({
|
|
66
|
+
authCallback: getAuthCallback(tabIndex)
|
|
67
|
+
}),
|
|
68
|
+
persistExplorerState: endpoints[tabIndex].persistExplorerState,
|
|
69
|
+
initialState: endpoints[tabIndex].initialState
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
] });
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
export { ApolloExplorerBrowser, handleAuthRequest };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloExplorerBrowser.esm.js","sources":["../../../src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.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
|
|
1
|
+
{"version":3,"file":"ApolloExplorerBrowser.esm.js","sources":["../../../src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.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 { useState } from 'react';\nimport Divider from '@material-ui/core/Divider';\nimport Tab from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { ApolloExplorer } from '@apollo/explorer/react';\nimport { Content } from '@backstage/core-components';\nimport { HandleRequest } from '@apollo/explorer/src/helpers/postMessageRelayHelpers';\nimport { EndpointProps } from '../ApolloExplorerPage';\nimport { useApiHolder } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n tabs: {\n background: theme.palette.background.paper,\n },\n root: {\n height: '100%',\n },\n content: {\n height: '100%',\n },\n explorer: {\n height: '95%',\n },\n}));\n\ntype Props = {\n endpoints: EndpointProps[];\n authCallback?: () => Promise<{ token: string }>;\n};\n\nexport const handleAuthRequest = ({\n authCallback,\n}: {\n authCallback: Props['authCallback'];\n}): HandleRequest => {\n const handleRequest: HandleRequest = async (endpointUrl, options) =>\n fetch(endpointUrl, {\n ...options,\n headers: {\n ...options.headers,\n ...(authCallback && {\n Authorization: `Bearer ${(await authCallback()).token}`,\n }),\n },\n });\n return handleRequest;\n};\n\nexport const ApolloExplorerBrowser = ({ endpoints }: Props) => {\n const classes = useStyles();\n const [tabIndex, setTabIndex] = useState(0);\n\n const apiHolder = useApiHolder();\n\n const getAuthCallback = (index: number) => {\n const authCallback = endpoints[index].authCallback;\n if (authCallback === undefined) return undefined;\n return () => authCallback({ apiHolder });\n };\n\n return (\n <div className={classes.root}>\n <Tabs\n classes={{ root: classes.tabs }}\n value={tabIndex}\n onChange={(_, value) => setTabIndex(value)}\n indicatorColor=\"primary\"\n >\n {endpoints.map(({ title }, index) => (\n <Tab key={index} label={title} value={index} />\n ))}\n </Tabs>\n <Divider />\n <Content className={classes.content}>\n <ApolloExplorer\n className={classes.explorer}\n graphRef={endpoints[tabIndex].graphRef}\n handleRequest={handleAuthRequest({\n authCallback: getAuthCallback(tabIndex),\n })}\n persistExplorerState={endpoints[tabIndex].persistExplorerState}\n initialState={endpoints[tabIndex].initialState}\n />\n </Content>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA;AAAA,GACvC;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,OAAS,EAAA;AAAA,IACP,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,QAAU,EAAA;AAAA,IACR,MAAQ,EAAA;AAAA;AAEZ,CAAE,CAAA,CAAA;AAOK,MAAM,oBAAoB,CAAC;AAAA,EAChC;AACF,CAEqB,KAAA;AACnB,EAAA,MAAM,aAA+B,GAAA,OAAO,WAAa,EAAA,OAAA,KACvD,MAAM,WAAa,EAAA;AAAA,IACjB,GAAG,OAAA;AAAA,IACH,OAAS,EAAA;AAAA,MACP,GAAG,OAAQ,CAAA,OAAA;AAAA,MACX,GAAI,YAAgB,IAAA;AAAA,QAClB,aA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B,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAQ,CAAA,QAAA;AAAA,QACnB,QAAA,EAAU,SAAU,CAAA,QAAQ,CAAE,CAAA,QAAA;AAAA,QAC9B,eAAe,iBAAkB,CAAA;AAAA,UAC/B,YAAA,EAAc,gBAAgB,QAAQ;AAAA,SACvC,CAAA;AAAA,QACD,oBAAA,EAAsB,SAAU,CAAA,QAAQ,CAAE,CAAA,oBAAA;AAAA,QAC1C,YAAA,EAAc,SAAU,CAAA,QAAQ,CAAE,CAAA;AAAA;AAAA,KAEtC,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Page, Header, Content } from '@backstage/core-components';
|
|
3
3
|
import { ApolloExplorerBrowser } from '../ApolloExplorerBrowser/ApolloExplorerBrowser.esm.js';
|
|
4
4
|
|
|
5
5
|
const ApolloExplorerPage = (props) => {
|
|
6
6
|
const { title, subtitle, endpoints } = props;
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
|
|
8
|
+
/* @__PURE__ */ jsx(Header, { title: title ?? "Apollo Explorer \u{1F469}\u200D\u{1F680}", subtitle: subtitle ?? "" }),
|
|
9
|
+
/* @__PURE__ */ jsx(Content, { noPadding: true, children: /* @__PURE__ */ jsx(ApolloExplorerBrowser, { endpoints }) })
|
|
10
|
+
] });
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
export { ApolloExplorerPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloExplorerPage.esm.js","sources":["../../../src/components/ApolloExplorerPage/ApolloExplorerPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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
|
|
1
|
+
{"version":3,"file":"ApolloExplorerPage.esm.js","sources":["../../../src/components/ApolloExplorerPage/ApolloExplorerPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { Content, Header, Page } from '@backstage/core-components';\nimport { ApolloExplorerBrowser } from '../ApolloExplorerBrowser';\nimport { JSONObject } from '@apollo/explorer/src/helpers/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\n\n/**\n * Export types to be used with {@link @backstage/apollo-explorer#ApolloExplorerPage}.\n *\n * @public\n */\nexport type EndpointProps = {\n title: string;\n graphRef: string;\n authCallback?: AuthCallback;\n persistExplorerState?: boolean;\n initialState?: {\n document?: string;\n variables?: JSONObject;\n headers?: Record<string, string>;\n displayOptions: {\n docsPanelState?: 'open' | 'closed';\n showHeadersAndEnvVars?: boolean;\n theme?: 'dark' | 'light';\n };\n };\n};\n\n/**\n * Export types to be used with {@link @backstage/apollo-explorer#ApolloExplorerPage}.\n *\n * @public\n */\nexport type AuthCallback = (options: {\n apiHolder: ApiHolder;\n}) => Promise<{ token: string }>;\n\ntype Props = {\n title?: string | undefined;\n subtitle?: string | undefined;\n endpoints: EndpointProps[];\n};\n\nexport const ApolloExplorerPage = (props: Props) => {\n const { title, subtitle, endpoints } = props;\n\n return (\n <Page themeId=\"tool\">\n <Header title={title ?? 'Apollo Explorer 👩🚀'} subtitle={subtitle ?? ''} />\n <Content noPadding>\n <ApolloExplorerBrowser endpoints={endpoints} />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;AA0Da,MAAA,kBAAA,GAAqB,CAAC,KAAiB,KAAA;AAClD,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA;AAEvC,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,UAAO,KAAO,EAAA,KAAA,IAAS,0CAAyB,EAAA,QAAA,EAAU,YAAY,EAAI,EAAA,CAAA;AAAA,wBAC1E,OAAQ,EAAA,EAAA,SAAA,EAAS,MAChB,QAAC,kBAAA,GAAA,CAAA,qBAAA,EAAA,EAAsB,WAAsB,CAC/C,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { JSONObject } from '@apollo/explorer/src/helpers/types';
|
|
4
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
4
|
import { ApiHolder } from '@backstage/core-plugin-api';
|
|
@@ -51,6 +50,6 @@ declare const ApolloExplorerPage: (props: {
|
|
|
51
50
|
title?: string | undefined;
|
|
52
51
|
subtitle?: string | undefined;
|
|
53
52
|
endpoints: EndpointProps[];
|
|
54
|
-
}) =>
|
|
53
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
55
54
|
|
|
56
55
|
export { ApolloExplorerPage, type AuthCallback, type EndpointProps, apolloExplorerPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-apollo-explorer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "apollo-explorer",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@apollo/explorer": "^3.0.0",
|
|
40
|
-
"@backstage/core-components": "^0.17.
|
|
41
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
40
|
+
"@backstage/core-components": "^0.17.2",
|
|
41
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
42
42
|
"@material-ui/core": "^4.12.2",
|
|
43
43
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
44
44
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"use-deep-compare-effect": "^1.8.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@backstage/cli": "^0.
|
|
50
|
-
"@backstage/dev-utils": "^1.1.
|
|
49
|
+
"@backstage/cli": "^0.32.1",
|
|
50
|
+
"@backstage/dev-utils": "^1.1.10",
|
|
51
51
|
"@testing-library/dom": "^10.0.0",
|
|
52
52
|
"@testing-library/jest-dom": "^6.0.0",
|
|
53
53
|
"@testing-library/react": "^15.0.0",
|
|
@@ -61,5 +61,12 @@
|
|
|
61
61
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
62
62
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
63
63
|
},
|
|
64
|
+
"typesVersions": {
|
|
65
|
+
"*": {
|
|
66
|
+
"package.json": [
|
|
67
|
+
"package.json"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
64
71
|
"module": "./dist/index.esm.js"
|
|
65
72
|
}
|