@webiny/app-graphql-playground 0.0.0-mt-1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/package.json +71 -0
- package/plugins/Playground.d.ts +5 -0
- package/plugins/Playground.js +120 -0
- package/plugins/Playground.styles.d.ts +23 -0
- package/plugins/Playground.styles.js +43 -0
- package/plugins/graphql.svg +1 -0
- package/plugins/index.d.ts +17 -0
- package/plugins/index.js +46 -0
- package/plugins/placeholder.graphql +18 -0
- package/plugins/settings.d.ts +1 -0
- package/plugins/settings.js +18 -0
- package/types.d.ts +15 -0
- package/types.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @webiny/app-graphql-playground
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/app-graphql-playground",
|
|
3
|
+
"version": "0.0.0-mt-1",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
8
|
+
},
|
|
9
|
+
"author": "Webiny Ltd",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@emotion/core": "10.1.1",
|
|
13
|
+
"@emotion/styled": "10.0.27",
|
|
14
|
+
"@webiny/app": "0.0.0-mt-1",
|
|
15
|
+
"@webiny/app-admin": "0.0.0-mt-1",
|
|
16
|
+
"@webiny/app-i18n": "0.0.0-mt-1",
|
|
17
|
+
"@webiny/app-security": "0.0.0-mt-1",
|
|
18
|
+
"@webiny/plugins": "0.0.0-mt-1",
|
|
19
|
+
"@webiny/react-router": "0.0.0-mt-1",
|
|
20
|
+
"@webiny/ui": "0.0.0-mt-1",
|
|
21
|
+
"apollo-cache": "1.3.5",
|
|
22
|
+
"apollo-client": "2.6.10",
|
|
23
|
+
"apollo-link": "1.2.14",
|
|
24
|
+
"apollo-link-context": "1.0.20",
|
|
25
|
+
"apollo-utilities": "1.3.4",
|
|
26
|
+
"graphql": "14.7.0",
|
|
27
|
+
"load-script": "1.0.0",
|
|
28
|
+
"prop-types": "15.7.2",
|
|
29
|
+
"react": "16.14.0",
|
|
30
|
+
"react-dom": "16.14.0",
|
|
31
|
+
"react-helmet": "5.2.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@babel/cli": "^7.5.5",
|
|
35
|
+
"@babel/core": "^7.5.5",
|
|
36
|
+
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
|
37
|
+
"@babel/preset-env": "^7.5.5",
|
|
38
|
+
"@babel/preset-react": "^7.0.0",
|
|
39
|
+
"@babel/preset-typescript": "^7.8.3",
|
|
40
|
+
"@webiny/cli": "^0.0.0-mt-1",
|
|
41
|
+
"@webiny/project-utils": "^0.0.0-mt-1",
|
|
42
|
+
"babel-plugin-emotion": "^9.2.8",
|
|
43
|
+
"babel-plugin-lodash": "^3.3.4",
|
|
44
|
+
"rimraf": "^3.0.2",
|
|
45
|
+
"typescript": "^4.1.3"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"directory": "dist"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "yarn webiny run build",
|
|
53
|
+
"watch": "yarn webiny run watch"
|
|
54
|
+
},
|
|
55
|
+
"svgo": {
|
|
56
|
+
"plugins": {
|
|
57
|
+
"removeViewBox": false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"adio": {
|
|
61
|
+
"ignore": {
|
|
62
|
+
"src": [
|
|
63
|
+
"!!raw-loader!."
|
|
64
|
+
],
|
|
65
|
+
"peerDependencies": [
|
|
66
|
+
"react-dom"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"gitHead": "37736d8456a6ecb342a6c3645060bd9a3f2d4bb0"
|
|
71
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
import React, { Fragment, useEffect, useRef, useCallback, useState } from "react";
|
|
6
|
+
import { ApolloLink } from "apollo-link";
|
|
7
|
+
import { setContext } from "apollo-link-context";
|
|
8
|
+
import loadScript from "load-script";
|
|
9
|
+
import { Global } from "@emotion/core";
|
|
10
|
+
import { plugins } from "@webiny/plugins";
|
|
11
|
+
import { useI18N } from "@webiny/app-i18n/hooks/useI18N";
|
|
12
|
+
import { useSecurity } from "@webiny/app-security";
|
|
13
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
14
|
+
import { playgroundDialog, PlaygroundContainer } from "./Playground.styles";
|
|
15
|
+
import { settings } from "./settings";
|
|
16
|
+
|
|
17
|
+
var withHeaders = function withHeaders(link, headers) {
|
|
18
|
+
return ApolloLink.from([setContext( /*#__PURE__*/function () {
|
|
19
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_, req) {
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
return _context.abrupt("return", {
|
|
25
|
+
headers: _objectSpread(_objectSpread({}, req.headers), headers)
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
case 1:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
return function (_x, _x2) {
|
|
37
|
+
return _ref.apply(this, arguments);
|
|
38
|
+
};
|
|
39
|
+
}()), link]);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var initScripts = function initScripts() {
|
|
43
|
+
return new Promise(function (resolve) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
if (window.GraphQLPlayground) {
|
|
46
|
+
return resolve();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return loadScript("https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js", resolve);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var Playground = function Playground(_ref2) {
|
|
54
|
+
var createApolloClient = _ref2.createApolloClient;
|
|
55
|
+
|
|
56
|
+
var _useState = useState(true),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
loading = _useState2[0],
|
|
59
|
+
setLoading = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useI18N = useI18N(),
|
|
62
|
+
getCurrentLocale = _useI18N.getCurrentLocale;
|
|
63
|
+
|
|
64
|
+
var _useSecurity = useSecurity(),
|
|
65
|
+
identity = _useSecurity.identity;
|
|
66
|
+
|
|
67
|
+
var links = useRef({});
|
|
68
|
+
var locale = getCurrentLocale("content");
|
|
69
|
+
var tabs = plugins.byType("graphql-playground-tab").map(function (pl) {
|
|
70
|
+
return pl.tab({
|
|
71
|
+
locale: locale,
|
|
72
|
+
identity: identity
|
|
73
|
+
});
|
|
74
|
+
}).filter(Boolean);
|
|
75
|
+
var createApolloLink = useCallback(function (_ref3) {
|
|
76
|
+
var endpoint = _ref3.endpoint,
|
|
77
|
+
headers = _ref3.headers;
|
|
78
|
+
|
|
79
|
+
// If the request endpoint is not know to us, return the first available
|
|
80
|
+
if (!endpoint.includes(process.env.REACT_APP_API_URL)) {
|
|
81
|
+
return {
|
|
82
|
+
link: withHeaders(Object.values(links.current)[0], headers)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!links.current[endpoint]) {
|
|
87
|
+
links.current[endpoint] = createApolloClient({
|
|
88
|
+
uri: endpoint
|
|
89
|
+
}).link;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
link: withHeaders(links.current[endpoint], headers)
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
96
|
+
useEffect(function () {
|
|
97
|
+
initScripts().then(function () {
|
|
98
|
+
setLoading(false);
|
|
99
|
+
});
|
|
100
|
+
}, []);
|
|
101
|
+
useEffect(function () {
|
|
102
|
+
if (!loading) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
window.GraphQLPlayground.init(document.getElementById("graphql-playground"), {
|
|
105
|
+
tabs: tabs,
|
|
106
|
+
createApolloLink: createApolloLink,
|
|
107
|
+
settings: settings
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [loading]);
|
|
111
|
+
return /*#__PURE__*/React.createElement(Fragment, null, loading ? /*#__PURE__*/React.createElement(CircularProgress, {
|
|
112
|
+
label: "Loading playground..."
|
|
113
|
+
}) : /*#__PURE__*/React.createElement(PlaygroundContainer, {
|
|
114
|
+
id: "graphql-playground"
|
|
115
|
+
}), /*#__PURE__*/React.createElement(Global, {
|
|
116
|
+
styles: playgroundDialog
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default Playground;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PlaygroundContainer: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "hidden" | "dir" | "slot" | "style" | "title" | "color" | "translate" | "children" | "defaultValue" | "id" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css">, object>;
|
|
3
|
+
export declare const playgroundDialog: {
|
|
4
|
+
".ReactModalPortal": {
|
|
5
|
+
"p, a, h1, h2, h3, h4, ul, pre, code": {
|
|
6
|
+
margin: number;
|
|
7
|
+
padding: number;
|
|
8
|
+
color: string;
|
|
9
|
+
};
|
|
10
|
+
"a:active, a:focus, button:focus, input:focus": {
|
|
11
|
+
outline: string;
|
|
12
|
+
};
|
|
13
|
+
"input, button, submit": {
|
|
14
|
+
border: string;
|
|
15
|
+
};
|
|
16
|
+
"input, button, pre": {
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
};
|
|
19
|
+
code: {
|
|
20
|
+
fontFamily: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
var sharedStyles = {
|
|
4
|
+
"p, a, h1, h2, h3, h4, ul, pre, code": {
|
|
5
|
+
margin: 0,
|
|
6
|
+
padding: 0,
|
|
7
|
+
color: "inherit"
|
|
8
|
+
},
|
|
9
|
+
"a:active, a:focus, button:focus, input:focus": {
|
|
10
|
+
outline: "none"
|
|
11
|
+
},
|
|
12
|
+
"input, button, submit": {
|
|
13
|
+
border: "none"
|
|
14
|
+
},
|
|
15
|
+
"input, button, pre": {
|
|
16
|
+
fontFamily: "'Open Sans', sans-serif"
|
|
17
|
+
},
|
|
18
|
+
code: {
|
|
19
|
+
fontFamily: "Consolas, monospace"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export var PlaygroundContainer = /*#__PURE__*/styled("div", {
|
|
23
|
+
target: "e1o47c380",
|
|
24
|
+
label: "PlaygroundContainer"
|
|
25
|
+
})({
|
|
26
|
+
marginTop: -3,
|
|
27
|
+
overflow: "hidden",
|
|
28
|
+
".playground": _objectSpread({
|
|
29
|
+
height: "calc(100vh - 64px)",
|
|
30
|
+
margin: 0,
|
|
31
|
+
padding: 0,
|
|
32
|
+
fontFamily: "'Open Sans', sans-serif",
|
|
33
|
+
WebkitFontSmoothing: "antialiased",
|
|
34
|
+
MozOsxFontSmoothing: "grayscale",
|
|
35
|
+
color: "rgba(0,0,0,.8)",
|
|
36
|
+
lineHeight: 1.5,
|
|
37
|
+
letterSpacing: 0.53,
|
|
38
|
+
marginRight: "-1px !important"
|
|
39
|
+
}, sharedStyles)
|
|
40
|
+
});
|
|
41
|
+
export var playgroundDialog = {
|
|
42
|
+
".ReactModalPortal": sharedStyles
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M14.051 2.751l4.935 2.85c.816-.859 2.173-.893 3.032-.077.148.14.274.301.377.477.589 1.028.232 2.339-.796 2.928-.174.1-.361.175-.558.223v5.699c1.146.273 1.854 1.423 1.58 2.569-.048.204-.127.4-.232.581-.592 1.023-1.901 1.374-2.927.782-.196-.113-.375-.259-.526-.429l-4.905 2.832c.372 1.124-.238 2.335-1.361 2.706-.217.071-.442.108-.67.108-1.181.001-2.139-.955-2.14-2.136 0-.205.029-.41.088-.609l-4.936-2.847c-.816.854-2.171.887-3.026.07-.854-.816-.886-2.171-.07-3.026.283-.297.646-.506 1.044-.603l.001-5.699c-1.15-.276-1.858-1.433-1.581-2.584.047-.198.123-.389.224-.566.592-1.024 1.902-1.374 2.927-.782.177.101.339.228.48.377l4.938-2.85C9.613 1.612 10.26.423 11.39.088 11.587.029 11.794 0 12 0c1.181-.001 2.139.954 2.14 2.134.001.209-.03.418-.089.617zm-.515.877c-.019.021-.037.039-.058.058l6.461 11.19c.026-.009.056-.016.082-.023V9.146c-1.145-.283-1.842-1.442-1.558-2.588.006-.024.012-.049.019-.072l-4.946-2.858zm-3.015.059l-.06-.06-4.946 2.852c.327 1.135-.327 2.318-1.461 2.645-.026.008-.051.014-.076.021v5.708l.084.023 6.461-11.19-.002.001zm2.076.507c-.39.112-.803.112-1.192 0l-6.46 11.189c.294.283.502.645.6 1.041h12.911c.097-.398.307-.761.603-1.044L12.597 4.194zm.986 16.227l4.913-2.838c-.015-.047-.027-.094-.038-.142H5.542l-.021.083 4.939 2.852c.388-.404.934-.653 1.54-.653.627 0 1.19.269 1.583.698z"/></svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ApolloClient from "apollo-client";
|
|
2
|
+
import { RoutePlugin } from "@webiny/app/types";
|
|
3
|
+
import { UIViewPlugin } from "@webiny/app-admin/ui/UIView";
|
|
4
|
+
import { NavigationView } from "@webiny/app-admin/ui/views/NavigationView";
|
|
5
|
+
declare type GraphQLPlaygroundOptions = {
|
|
6
|
+
createApolloClient(params: {
|
|
7
|
+
uri: string;
|
|
8
|
+
}): ApolloClient<any>;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: (options: GraphQLPlaygroundOptions) => (RoutePlugin | import("@webiny/plugins/types").Plugin<{
|
|
11
|
+
type: "graphql-playground-tab";
|
|
12
|
+
tab(params: {
|
|
13
|
+
locale: string;
|
|
14
|
+
identity: import("@webiny/app-security/types").SecurityIdentity;
|
|
15
|
+
}): import("../types").GraphQLPlaygroundTab;
|
|
16
|
+
}> | UIViewPlugin<NavigationView>)[];
|
|
17
|
+
export default _default;
|
package/plugins/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Helmet from "react-helmet";
|
|
3
|
+
import { Route } from "@webiny/react-router";
|
|
4
|
+
import { AdminLayout } from "@webiny/app-admin/components/AdminLayout";
|
|
5
|
+
import { ReactComponent as InfoIcon } from "@svgr/webpack!./graphql.svg";
|
|
6
|
+
import Playground from "./Playground";
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import placeholder from "!!raw-loader!./placeholder.graphql";
|
|
9
|
+
import { NavigationMenuElement } from "@webiny/app-admin/ui/elements/NavigationMenuElement";
|
|
10
|
+
import { UIViewPlugin } from "@webiny/app-admin/ui/UIView";
|
|
11
|
+
import { NavigationView } from "@webiny/app-admin/ui/views/NavigationView";
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
export default (function (options) {
|
|
14
|
+
return [new UIViewPlugin(NavigationView, function (view) {
|
|
15
|
+
view.getFooterElement().addMenuElement(new NavigationMenuElement("apiPlayground", {
|
|
16
|
+
label: "API Playground",
|
|
17
|
+
icon: /*#__PURE__*/React.createElement(InfoIcon, null),
|
|
18
|
+
path: "/api-playground",
|
|
19
|
+
onClick: function onClick() {
|
|
20
|
+
view.getNavigationHook().hideMenu();
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
}), {
|
|
24
|
+
name: "route-api-playground",
|
|
25
|
+
type: "route",
|
|
26
|
+
route: /*#__PURE__*/React.createElement(Route, {
|
|
27
|
+
exact: true,
|
|
28
|
+
path: "/api-playground",
|
|
29
|
+
render: function render() {
|
|
30
|
+
return /*#__PURE__*/React.createElement(AdminLayout, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, "API Playground")), /*#__PURE__*/React.createElement(Playground, {
|
|
31
|
+
createApolloClient: options.createApolloClient
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}, {
|
|
36
|
+
type: "graphql-playground-tab",
|
|
37
|
+
tab: function tab() {
|
|
38
|
+
return {
|
|
39
|
+
name: "Main API",
|
|
40
|
+
endpoint: process.env.REACT_APP_API_URL + "/graphql",
|
|
41
|
+
headers: {},
|
|
42
|
+
query: placeholder
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}];
|
|
46
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Webiny Main API
|
|
2
|
+
#
|
|
3
|
+
# This is the core API that has access to all the features of your Webiny instance.
|
|
4
|
+
#
|
|
5
|
+
# Note: to use the API outside of the playground, you will need to provide an API key via the Authorization header.
|
|
6
|
+
#
|
|
7
|
+
# Example query - list all users:
|
|
8
|
+
{
|
|
9
|
+
adminUsers {
|
|
10
|
+
listUsers {
|
|
11
|
+
data {
|
|
12
|
+
email
|
|
13
|
+
firstName
|
|
14
|
+
createdOn
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const settings: any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var settings = {
|
|
2
|
+
"editor.cursorShape": "line",
|
|
3
|
+
"editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
|
|
4
|
+
"editor.fontSize": 14,
|
|
5
|
+
"editor.reuseHeaders": true,
|
|
6
|
+
"editor.theme": "dark",
|
|
7
|
+
"general.betaUpdates": false,
|
|
8
|
+
"prettier.printWidth": 80,
|
|
9
|
+
"prettier.tabWidth": 2,
|
|
10
|
+
"prettier.useTabs": false,
|
|
11
|
+
"request.credentials": "omit",
|
|
12
|
+
"schema.disableComments": true,
|
|
13
|
+
"schema.polling.enable": false,
|
|
14
|
+
"schema.polling.endpointFilter": "*localhost*",
|
|
15
|
+
"schema.polling.interval": 2000000,
|
|
16
|
+
"tracing.hideTracingResponse": true,
|
|
17
|
+
"queryPlan.hideQueryPlanResponse": true
|
|
18
|
+
};
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
import { SecurityIdentity } from "@webiny/app-security/types";
|
|
3
|
+
export declare type GraphQLPlaygroundTab = {
|
|
4
|
+
name: string;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
query: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type GraphQLPlaygroundTabPlugin = Plugin<{
|
|
10
|
+
type: "graphql-playground-tab";
|
|
11
|
+
tab(params: {
|
|
12
|
+
locale: string;
|
|
13
|
+
identity: SecurityIdentity;
|
|
14
|
+
}): GraphQLPlaygroundTab;
|
|
15
|
+
}>;
|
package/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|