@webiny/app-graphql-playground 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f
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/index.d.ts +10 -0
- package/index.js +34 -0
- package/index.js.map +1 -0
- package/package.json +26 -33
- package/plugins/Playground.d.ts +9 -4
- package/plugins/Playground.js +68 -67
- package/plugins/Playground.js.map +1 -0
- package/plugins/Playground.styles.d.ts +6 -1
- package/plugins/Playground.styles.js +15 -6
- package/plugins/Playground.styles.js.map +1 -0
- package/plugins/index.d.ts +2 -16
- package/plugins/index.js +24 -45
- package/plugins/index.js.map +1 -0
- package/plugins/settings.js +9 -2
- package/plugins/settings.js.map +1 -0
- package/types.d.ts +7 -6
- package/types.js +5 -1
- package/types.js.map +1 -0
- /package/{plugins → assets}/graphql.svg +0 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ApolloClient } from "apollo-client";
|
|
3
|
+
interface CreateApolloClientParams {
|
|
4
|
+
uri: string;
|
|
5
|
+
}
|
|
6
|
+
interface GraphQLPlaygroundProps {
|
|
7
|
+
createApolloClient(params: CreateApolloClientParams): ApolloClient<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const GraphQLPlayground: React.NamedExoticComponent<GraphQLPlaygroundProps>;
|
|
10
|
+
export {};
|
package/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GraphQLPlayground = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _plugins = require("@webiny/plugins");
|
|
11
|
+
var _appAdmin = require("@webiny/app-admin");
|
|
12
|
+
var _graphql = require("./assets/graphql.svg");
|
|
13
|
+
var _Playground = _interopRequireDefault(require("./plugins/Playground"));
|
|
14
|
+
var _plugins2 = _interopRequireDefault(require("./plugins"));
|
|
15
|
+
var GraphQLPlaygroundExtension = function GraphQLPlaygroundExtension(_ref) {
|
|
16
|
+
var createApolloClient = _ref.createApolloClient;
|
|
17
|
+
_plugins.plugins.register(_plugins2.default);
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_appAdmin.Plugins, null, /*#__PURE__*/_react.default.createElement(_appAdmin.AddMenu, {
|
|
19
|
+
name: "apiPlayground",
|
|
20
|
+
label: "API Playground",
|
|
21
|
+
path: "/api-playground",
|
|
22
|
+
icon: /*#__PURE__*/_react.default.createElement(_graphql.ReactComponent, null),
|
|
23
|
+
tags: ["footer"]
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement(_appAdmin.AddRoute, {
|
|
25
|
+
exact: true,
|
|
26
|
+
path: "/api-playground"
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_appAdmin.Layout, {
|
|
28
|
+
title: "API Playground"
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_Playground.default, {
|
|
30
|
+
createApolloClient: createApolloClient
|
|
31
|
+
}))));
|
|
32
|
+
};
|
|
33
|
+
var GraphQLPlayground = /*#__PURE__*/(0, _react.memo)(GraphQLPlaygroundExtension);
|
|
34
|
+
exports.GraphQLPlayground = GraphQLPlayground;
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GraphQLPlaygroundExtension","createApolloClient","plugins","register","playgroundPlugins","GraphQLPlayground","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport { ApolloClient } from \"apollo-client\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Plugins, AddMenu, AddRoute, Layout } from \"@webiny/app-admin\";\nimport { ReactComponent as InfoIcon } from \"./assets/graphql.svg\";\nimport Playground from \"./plugins/Playground\";\nimport playgroundPlugins from \"./plugins\";\n\ninterface CreateApolloClientParams {\n uri: string;\n}\ninterface GraphQLPlaygroundProps {\n createApolloClient(params: CreateApolloClientParams): ApolloClient<any>;\n}\n\nconst GraphQLPlaygroundExtension: React.FC<GraphQLPlaygroundProps> = ({ createApolloClient }) => {\n plugins.register(playgroundPlugins);\n\n return (\n <Plugins>\n <AddMenu\n name={\"apiPlayground\"}\n label={\"API Playground\"}\n path={\"/api-playground\"}\n icon={<InfoIcon />}\n tags={[\"footer\"]}\n />\n <AddRoute exact path={\"/api-playground\"}>\n <Layout title={\"API Playground\"}>\n <Playground createApolloClient={createApolloClient} />\n </Layout>\n </AddRoute>\n </Plugins>\n );\n};\n\nexport const GraphQLPlayground = memo(GraphQLPlaygroundExtension);\n"],"mappings":";;;;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AASA,IAAMA,0BAA4D,GAAG,SAA/DA,0BAA4D,OAA+B;EAAA,IAAzBC,kBAAkB,QAAlBA,kBAAkB;EACtFC,gBAAO,CAACC,QAAQ,CAACC,iBAAiB,CAAC;EAEnC,oBACI,6BAAC,iBAAO,qBACJ,6BAAC,iBAAO;IACJ,IAAI,EAAE,eAAgB;IACtB,KAAK,EAAE,gBAAiB;IACxB,IAAI,EAAE,iBAAkB;IACxB,IAAI,eAAE,6BAAC,uBAAQ,OAAI;IACnB,IAAI,EAAE,CAAC,QAAQ;EAAE,EACnB,eACF,6BAAC,kBAAQ;IAAC,KAAK;IAAC,IAAI,EAAE;EAAkB,gBACpC,6BAAC,gBAAM;IAAC,KAAK,EAAE;EAAiB,gBAC5B,6BAAC,mBAAU;IAAC,kBAAkB,EAAEH;EAAmB,EAAG,CACjD,CACF,CACL;AAElB,CAAC;AAEM,IAAMI,iBAAiB,gBAAG,IAAAC,WAAI,EAACN,0BAA0B,CAAC;AAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-graphql-playground",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-unstable.085ff6572f",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,40 +9,38 @@
|
|
|
9
9
|
"author": "Webiny Ltd",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@emotion/
|
|
13
|
-
"@emotion/styled": "10.
|
|
14
|
-
"@webiny/app": "0.0.0-
|
|
15
|
-
"@webiny/app-admin": "0.0.0-
|
|
16
|
-
"@webiny/app-i18n": "0.0.0-
|
|
17
|
-
"@webiny/app-security": "0.0.0-
|
|
18
|
-
"@webiny/plugins": "0.0.0-
|
|
19
|
-
"@webiny/
|
|
20
|
-
"@webiny/ui": "0.0.0-mt-3",
|
|
12
|
+
"@emotion/react": "11.10.8",
|
|
13
|
+
"@emotion/styled": "11.10.6",
|
|
14
|
+
"@webiny/app": "0.0.0-unstable.085ff6572f",
|
|
15
|
+
"@webiny/app-admin": "0.0.0-unstable.085ff6572f",
|
|
16
|
+
"@webiny/app-i18n": "0.0.0-unstable.085ff6572f",
|
|
17
|
+
"@webiny/app-security": "0.0.0-unstable.085ff6572f",
|
|
18
|
+
"@webiny/plugins": "0.0.0-unstable.085ff6572f",
|
|
19
|
+
"@webiny/ui": "0.0.0-unstable.085ff6572f",
|
|
21
20
|
"apollo-cache": "1.3.5",
|
|
22
21
|
"apollo-client": "2.6.10",
|
|
23
22
|
"apollo-link": "1.2.14",
|
|
24
23
|
"apollo-link-context": "1.0.20",
|
|
25
24
|
"apollo-utilities": "1.3.4",
|
|
26
|
-
"graphql": "
|
|
25
|
+
"graphql": "15.8.0",
|
|
27
26
|
"load-script": "1.0.0",
|
|
28
|
-
"prop-types": "15.
|
|
29
|
-
"react": "
|
|
30
|
-
"react-dom": "
|
|
31
|
-
"react-helmet": "5.2.1"
|
|
27
|
+
"prop-types": "15.8.1",
|
|
28
|
+
"react": "17.0.2",
|
|
29
|
+
"react-dom": "17.0.2"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
|
-
"@babel/cli": "
|
|
35
|
-
"@babel/core": "
|
|
36
|
-
"@babel/plugin-proposal-class-properties": "
|
|
37
|
-
"@babel/preset-env": "
|
|
38
|
-
"@babel/preset-react": "
|
|
39
|
-
"@babel/preset-typescript": "
|
|
40
|
-
"@webiny/cli": "
|
|
41
|
-
"@webiny/project-utils": "
|
|
42
|
-
"babel-plugin-emotion": "
|
|
43
|
-
"babel-plugin-lodash": "
|
|
44
|
-
"rimraf": "
|
|
45
|
-
"typescript": "
|
|
32
|
+
"@babel/cli": "7.20.7",
|
|
33
|
+
"@babel/core": "7.20.12",
|
|
34
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
35
|
+
"@babel/preset-env": "7.20.2",
|
|
36
|
+
"@babel/preset-react": "7.18.6",
|
|
37
|
+
"@babel/preset-typescript": "7.18.6",
|
|
38
|
+
"@webiny/cli": "0.0.0-unstable.085ff6572f",
|
|
39
|
+
"@webiny/project-utils": "0.0.0-unstable.085ff6572f",
|
|
40
|
+
"babel-plugin-emotion": "9.2.11",
|
|
41
|
+
"babel-plugin-lodash": "3.3.4",
|
|
42
|
+
"rimraf": "3.0.2",
|
|
43
|
+
"typescript": "4.7.4"
|
|
46
44
|
},
|
|
47
45
|
"publishConfig": {
|
|
48
46
|
"access": "public",
|
|
@@ -52,11 +50,6 @@
|
|
|
52
50
|
"build": "yarn webiny run build",
|
|
53
51
|
"watch": "yarn webiny run watch"
|
|
54
52
|
},
|
|
55
|
-
"svgo": {
|
|
56
|
-
"plugins": {
|
|
57
|
-
"removeViewBox": false
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
53
|
"adio": {
|
|
61
54
|
"ignore": {
|
|
62
55
|
"src": [
|
|
@@ -67,5 +60,5 @@
|
|
|
67
60
|
]
|
|
68
61
|
}
|
|
69
62
|
},
|
|
70
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "085ff6572f6bb6a76d218088b06d9f4ef92bbea7"
|
|
71
64
|
}
|
package/plugins/Playground.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ApolloClient from "apollo-client";
|
|
3
|
+
interface CreateApolloClientParams {
|
|
4
|
+
uri: string;
|
|
5
|
+
}
|
|
6
|
+
interface PlaygroundProps {
|
|
7
|
+
createApolloClient: (params: CreateApolloClientParams) => ApolloClient<any>;
|
|
8
|
+
}
|
|
9
|
+
declare const Playground: React.FC<PlaygroundProps>;
|
|
5
10
|
export default Playground;
|
package/plugins/Playground.js
CHANGED
|
@@ -1,120 +1,121 @@
|
|
|
1
|
-
|
|
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";
|
|
1
|
+
"use strict";
|
|
16
2
|
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _apolloLink = require("apollo-link");
|
|
15
|
+
var _apolloLinkContext = require("apollo-link-context");
|
|
16
|
+
var _loadScript = _interopRequireDefault(require("load-script"));
|
|
17
|
+
var _react2 = require("@emotion/react");
|
|
18
|
+
var _plugins = require("@webiny/plugins");
|
|
19
|
+
var _useI18N2 = require("@webiny/app-i18n/hooks/useI18N");
|
|
20
|
+
var _appSecurity = require("@webiny/app-security");
|
|
21
|
+
var _Progress = require("@webiny/ui/Progress");
|
|
22
|
+
var _Playground = require("./Playground.styles");
|
|
23
|
+
var _settings = require("./settings");
|
|
24
|
+
var _config = require("@webiny/app/config");
|
|
25
|
+
/**
|
|
26
|
+
* Package load-script does not have types.
|
|
27
|
+
*/
|
|
28
|
+
// @ts-ignore
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var withHeaders = function withHeaders(link, headers) {
|
|
31
|
+
return _apolloLink.ApolloLink.from([(0, _apolloLinkContext.setContext)( /*#__PURE__*/function () {
|
|
32
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_, req) {
|
|
33
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
return _context.abrupt("return", {
|
|
37
|
+
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, req.headers), headers)
|
|
38
|
+
});
|
|
39
|
+
case 1:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
32
42
|
}
|
|
33
43
|
}, _callee);
|
|
34
44
|
}));
|
|
35
|
-
|
|
36
45
|
return function (_x, _x2) {
|
|
37
46
|
return _ref.apply(this, arguments);
|
|
38
47
|
};
|
|
39
48
|
}()), link]);
|
|
40
49
|
};
|
|
41
|
-
|
|
42
50
|
var initScripts = function initScripts() {
|
|
43
51
|
return new Promise(function (resolve) {
|
|
44
52
|
// @ts-ignore
|
|
45
53
|
if (window.GraphQLPlayground) {
|
|
46
54
|
return resolve();
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
return loadScript("https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js", resolve);
|
|
56
|
+
return (0, _loadScript.default)("https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js", resolve);
|
|
50
57
|
});
|
|
51
58
|
};
|
|
52
|
-
|
|
53
59
|
var Playground = function Playground(_ref2) {
|
|
54
60
|
var createApolloClient = _ref2.createApolloClient;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useSecurity = useSecurity(),
|
|
65
|
-
identity = _useSecurity.identity;
|
|
66
|
-
|
|
67
|
-
var links = useRef({});
|
|
61
|
+
var _useState = (0, _react.useState)(true),
|
|
62
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
63
|
+
loading = _useState2[0],
|
|
64
|
+
setLoading = _useState2[1];
|
|
65
|
+
var _useI18N = (0, _useI18N2.useI18N)(),
|
|
66
|
+
getCurrentLocale = _useI18N.getCurrentLocale;
|
|
67
|
+
var _useSecurity = (0, _appSecurity.useSecurity)(),
|
|
68
|
+
identity = _useSecurity.identity;
|
|
69
|
+
var links = (0, _react.useRef)({});
|
|
68
70
|
var locale = getCurrentLocale("content");
|
|
69
|
-
var tabs = plugins.byType("graphql-playground-tab").map(function (pl) {
|
|
71
|
+
var tabs = _plugins.plugins.byType("graphql-playground-tab").map(function (pl) {
|
|
70
72
|
return pl.tab({
|
|
71
73
|
locale: locale,
|
|
72
74
|
identity: identity
|
|
73
75
|
});
|
|
74
76
|
}).filter(Boolean);
|
|
75
|
-
var createApolloLink = useCallback(function (_ref3) {
|
|
77
|
+
var createApolloLink = (0, _react.useCallback)(function (_ref3) {
|
|
76
78
|
var endpoint = _ref3.endpoint,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
headers = _ref3.headers;
|
|
80
|
+
var current = links.current;
|
|
79
81
|
// If the request endpoint is not know to us, return the first available
|
|
80
|
-
|
|
82
|
+
var apiUrl = _config.config.getKey("API_URL", process.env.REACT_APP_API_URL);
|
|
83
|
+
if (!endpoint.includes(apiUrl)) {
|
|
81
84
|
return {
|
|
82
|
-
link: withHeaders(Object.values(
|
|
85
|
+
link: withHeaders(Object.values(current)[0], headers)
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
links.current[endpoint] = createApolloClient({
|
|
88
|
+
if (!current[endpoint]) {
|
|
89
|
+
current[endpoint] = createApolloClient({
|
|
88
90
|
uri: endpoint
|
|
89
91
|
}).link;
|
|
90
92
|
}
|
|
91
|
-
|
|
92
93
|
return {
|
|
93
|
-
link: withHeaders(
|
|
94
|
+
link: withHeaders(current[endpoint], headers)
|
|
94
95
|
};
|
|
95
96
|
}, []);
|
|
96
|
-
useEffect(function () {
|
|
97
|
+
(0, _react.useEffect)(function () {
|
|
97
98
|
initScripts().then(function () {
|
|
98
99
|
setLoading(false);
|
|
99
100
|
});
|
|
100
101
|
}, []);
|
|
101
|
-
useEffect(function () {
|
|
102
|
+
(0, _react.useEffect)(function () {
|
|
102
103
|
if (!loading) {
|
|
103
104
|
// @ts-ignore
|
|
104
105
|
window.GraphQLPlayground.init(document.getElementById("graphql-playground"), {
|
|
105
106
|
tabs: tabs,
|
|
106
107
|
createApolloLink: createApolloLink,
|
|
107
|
-
settings: settings
|
|
108
|
+
settings: _settings.settings
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
}, [loading]);
|
|
111
|
-
return /*#__PURE__*/
|
|
112
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, loading ? /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, {
|
|
112
113
|
label: "Loading playground..."
|
|
113
|
-
}) : /*#__PURE__*/
|
|
114
|
+
}) : /*#__PURE__*/_react.default.createElement(_Playground.PlaygroundContainer, {
|
|
114
115
|
id: "graphql-playground"
|
|
115
|
-
}), /*#__PURE__*/
|
|
116
|
-
styles: playgroundDialog
|
|
116
|
+
}), /*#__PURE__*/_react.default.createElement(_react2.Global, {
|
|
117
|
+
styles: _Playground.playgroundDialog
|
|
117
118
|
}));
|
|
118
119
|
};
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
var _default = Playground;
|
|
121
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withHeaders","link","headers","ApolloLink","from","setContext","_","req","initScripts","Promise","resolve","window","GraphQLPlayground","loadScript","Playground","createApolloClient","useState","loading","setLoading","useI18N","getCurrentLocale","useSecurity","identity","links","useRef","locale","tabs","plugins","byType","map","pl","tab","filter","Boolean","createApolloLink","useCallback","endpoint","current","apiUrl","appConfig","getKey","process","env","REACT_APP_API_URL","includes","Object","values","uri","useEffect","then","init","document","getElementById","settings","playgroundDialog"],"sources":["Playground.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useCallback, useState } from \"react\";\nimport { ApolloLink } from \"apollo-link\";\nimport { setContext } from \"apollo-link-context\";\n/**\n * Package load-script does not have types.\n */\n// @ts-ignore\nimport loadScript from \"load-script\";\nimport { Global } from \"@emotion/react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { useI18N } from \"@webiny/app-i18n/hooks/useI18N\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { playgroundDialog, PlaygroundContainer } from \"./Playground.styles\";\nimport { settings } from \"./settings\";\nimport { config as appConfig } from \"@webiny/app/config\";\nimport ApolloClient from \"apollo-client\";\nimport { GraphQLPlaygroundTabPlugin } from \"~/types\";\nimport { SecurityIdentity } from \"@webiny/app-security/types\";\n\nconst withHeaders = (link: ApolloLink, headers: Record<string, string>): ApolloLink => {\n return ApolloLink.from([\n setContext(async (_, req) => {\n return {\n headers: {\n ...req.headers,\n ...headers\n }\n };\n }),\n link\n ]);\n};\n\nconst initScripts = () => {\n return new Promise((resolve: any) => {\n // @ts-ignore\n if (window.GraphQLPlayground) {\n return resolve();\n }\n\n return loadScript(\n \"https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js\",\n resolve\n );\n });\n};\n\ninterface CreateApolloClientParams {\n uri: string;\n}\ninterface PlaygroundProps {\n createApolloClient: (params: CreateApolloClientParams) => ApolloClient<any>;\n}\nconst Playground: React.FC<PlaygroundProps> = ({ createApolloClient }) => {\n const [loading, setLoading] = useState(true);\n const { getCurrentLocale } = useI18N();\n const { identity } = useSecurity();\n const links = useRef<Record<string, ApolloLink>>({});\n\n const locale = getCurrentLocale(\"content\");\n\n const tabs = plugins\n .byType<GraphQLPlaygroundTabPlugin>(\"graphql-playground-tab\")\n .map(pl =>\n pl.tab({\n locale: locale as string,\n identity: identity as SecurityIdentity\n })\n )\n .filter(Boolean);\n\n const createApolloLink = useCallback(({ endpoint, headers }) => {\n const current = links.current;\n // If the request endpoint is not know to us, return the first available\n const apiUrl = appConfig.getKey(\"API_URL\", process.env.REACT_APP_API_URL);\n if (!endpoint.includes(apiUrl)) {\n return { link: withHeaders(Object.values(current)[0], headers) };\n }\n\n if (!current[endpoint]) {\n current[endpoint] = createApolloClient({ uri: endpoint }).link;\n }\n\n return {\n link: withHeaders(current[endpoint], headers)\n };\n }, []);\n\n useEffect(() => {\n initScripts().then(() => {\n setLoading(false);\n });\n }, []);\n\n useEffect(() => {\n if (!loading) {\n // @ts-ignore\n window.GraphQLPlayground.init(document.getElementById(\"graphql-playground\"), {\n tabs,\n createApolloLink,\n settings\n });\n }\n }, [loading]);\n\n return (\n <Fragment>\n {loading ? (\n <CircularProgress label={\"Loading playground...\"} />\n ) : (\n <PlaygroundContainer id={\"graphql-playground\"} />\n )}\n <Global styles={playgroundDialog} />\n </Fragment>\n );\n};\n\nexport default Playground;\n"],"mappings":"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"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
/// <reference types="web" />
|
|
4
|
+
export declare const PlaygroundContainer: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
8
|
export declare const playgroundDialog: {
|
|
4
9
|
".ReactModalPortal": {
|
|
5
10
|
"p, a, h1, h2, h3, h4, ul, pre, code": {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.playgroundDialog = exports.PlaygroundContainer = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
3
10
|
var sharedStyles = {
|
|
4
11
|
"p, a, h1, h2, h3, h4, ul, pre, code": {
|
|
5
12
|
margin: 0,
|
|
@@ -19,13 +26,13 @@ var sharedStyles = {
|
|
|
19
26
|
fontFamily: "Consolas, monospace"
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
|
-
|
|
29
|
+
var PlaygroundContainer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
23
30
|
target: "e1o47c380",
|
|
24
31
|
label: "PlaygroundContainer"
|
|
25
32
|
})({
|
|
26
33
|
marginTop: -3,
|
|
27
34
|
overflow: "hidden",
|
|
28
|
-
".playground":
|
|
35
|
+
".playground": (0, _objectSpread2.default)({
|
|
29
36
|
height: "calc(100vh - 64px)",
|
|
30
37
|
margin: 0,
|
|
31
38
|
padding: 0,
|
|
@@ -38,6 +45,8 @@ export var PlaygroundContainer = /*#__PURE__*/styled("div", {
|
|
|
38
45
|
marginRight: "-1px !important"
|
|
39
46
|
}, sharedStyles)
|
|
40
47
|
});
|
|
41
|
-
|
|
48
|
+
exports.PlaygroundContainer = PlaygroundContainer;
|
|
49
|
+
var playgroundDialog = {
|
|
42
50
|
".ReactModalPortal": sharedStyles
|
|
43
|
-
};
|
|
51
|
+
};
|
|
52
|
+
exports.playgroundDialog = playgroundDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sharedStyles","margin","padding","color","outline","border","fontFamily","code","PlaygroundContainer","styled","marginTop","overflow","height","WebkitFontSmoothing","MozOsxFontSmoothing","lineHeight","letterSpacing","marginRight","playgroundDialog"],"sources":["Playground.styles.ts"],"sourcesContent":["import styled from \"@emotion/styled\";\n\nconst sharedStyles = {\n \"p, a, h1, h2, h3, h4, ul, pre, code\": {\n margin: 0,\n padding: 0,\n color: \"inherit\"\n },\n \"a:active, a:focus, button:focus, input:focus\": {\n outline: \"none\"\n },\n \"input, button, submit\": {\n border: \"none\"\n },\n \"input, button, pre\": {\n fontFamily: \"'Open Sans', sans-serif\"\n },\n code: {\n fontFamily: \"Consolas, monospace\"\n }\n};\n\nexport const PlaygroundContainer = styled(\"div\")({\n marginTop: -3,\n overflow: \"hidden\",\n \".playground\": {\n height: \"calc(100vh - 64px)\",\n margin: 0,\n padding: 0,\n fontFamily: \"'Open Sans', sans-serif\",\n WebkitFontSmoothing: \"antialiased\",\n MozOsxFontSmoothing: \"grayscale\",\n color: \"rgba(0,0,0,.8)\",\n lineHeight: 1.5,\n letterSpacing: 0.53,\n marginRight: \"-1px !important\",\n ...sharedStyles\n }\n});\n\nexport const playgroundDialog = {\n \".ReactModalPortal\": sharedStyles\n};\n"],"mappings":";;;;;;;;AAAA;AAEA,IAAMA,YAAY,GAAG;EACjB,qCAAqC,EAAE;IACnCC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE,CAAC;IACVC,KAAK,EAAE;EACX,CAAC;EACD,8CAA8C,EAAE;IAC5CC,OAAO,EAAE;EACb,CAAC;EACD,uBAAuB,EAAE;IACrBC,MAAM,EAAE;EACZ,CAAC;EACD,oBAAoB,EAAE;IAClBC,UAAU,EAAE;EAChB,CAAC;EACDC,IAAI,EAAE;IACFD,UAAU,EAAE;EAChB;AACJ,CAAC;AAEM,IAAME,mBAAmB,oBAAGC,eAAM,EAAC,KAAK;EAAA;EAAA;AAAA,GAAE;EAC7CC,SAAS,EAAE,CAAC,CAAC;EACbC,QAAQ,EAAE,QAAQ;EAClB,aAAa;IACTC,MAAM,EAAE,oBAAoB;IAC5BX,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE,CAAC;IACVI,UAAU,EAAE,yBAAyB;IACrCO,mBAAmB,EAAE,aAAa;IAClCC,mBAAmB,EAAE,WAAW;IAChCX,KAAK,EAAE,gBAAgB;IACvBY,UAAU,EAAE,GAAG;IACfC,aAAa,EAAE,IAAI;IACnBC,WAAW,EAAE;EAAiB,GAC3BjB,YAAY;AAEvB,CAAC,CAAC;AAAC;AAEI,IAAMkB,gBAAgB,GAAG;EAC5B,mBAAmB,EAAElB;AACzB,CAAC;AAAC"}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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>)[];
|
|
1
|
+
import { GraphQLPlaygroundTabPlugin } from "../types";
|
|
2
|
+
declare const _default: GraphQLPlaygroundTabPlugin[];
|
|
17
3
|
export default _default;
|
package/plugins/index.js
CHANGED
|
@@ -1,46 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _placeholder = _interopRequireDefault(require("!!raw-loader!./placeholder.graphql"));
|
|
9
|
+
var _config = require("@webiny/app/config");
|
|
7
10
|
// @ts-ignore
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
});
|
|
11
|
+
|
|
12
|
+
var plugin = {
|
|
13
|
+
type: "graphql-playground-tab",
|
|
14
|
+
tab: function tab() {
|
|
15
|
+
var apiUrl = _config.config.getKey("API_URL", process.env.REACT_APP_API_URL);
|
|
16
|
+
return {
|
|
17
|
+
name: "Main API",
|
|
18
|
+
endpoint: apiUrl + "/graphql",
|
|
19
|
+
headers: {},
|
|
20
|
+
query: _placeholder.default
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var _default = [plugin];
|
|
25
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["plugin","type","tab","apiUrl","appConfig","getKey","process","env","REACT_APP_API_URL","name","endpoint","headers","query","placeholder"],"sources":["index.tsx"],"sourcesContent":["import { GraphQLPlaygroundTabPlugin } from \"~/types\";\n// @ts-ignore\nimport placeholder from \"!!raw-loader!./placeholder.graphql\";\nimport { config as appConfig } from \"@webiny/app/config\";\n\nconst plugin: GraphQLPlaygroundTabPlugin = {\n type: \"graphql-playground-tab\",\n tab() {\n const apiUrl = appConfig.getKey(\"API_URL\", process.env.REACT_APP_API_URL) as string;\n return {\n name: \"Main API\",\n endpoint: apiUrl + \"/graphql\",\n headers: {},\n query: placeholder\n };\n }\n};\nexport default [plugin];\n"],"mappings":";;;;;;;AAEA;AACA;AAFA;;AAIA,IAAMA,MAAkC,GAAG;EACvCC,IAAI,EAAE,wBAAwB;EAC9BC,GAAG,iBAAG;IACF,IAAMC,MAAM,GAAGC,cAAS,CAACC,MAAM,CAAC,SAAS,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,CAAW;IACnF,OAAO;MACHC,IAAI,EAAE,UAAU;MAChBC,QAAQ,EAAEP,MAAM,GAAG,UAAU;MAC7BQ,OAAO,EAAE,CAAC,CAAC;MACXC,KAAK,EAAEC;IACX,CAAC;EACL;AACJ,CAAC;AAAC,eACa,CAACb,MAAM,CAAC;AAAA"}
|
package/plugins/settings.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.settings = void 0;
|
|
7
|
+
var settings = {
|
|
2
8
|
"editor.cursorShape": "line",
|
|
3
9
|
"editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
|
|
4
10
|
"editor.fontSize": 14,
|
|
@@ -15,4 +21,5 @@ export var settings = {
|
|
|
15
21
|
"schema.polling.interval": 2000000,
|
|
16
22
|
"tracing.hideTracingResponse": true,
|
|
17
23
|
"queryPlan.hideQueryPlanResponse": true
|
|
18
|
-
};
|
|
24
|
+
};
|
|
25
|
+
exports.settings = settings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["settings"],"sources":["settings.ts"],"sourcesContent":["export const settings: any = {\n \"editor.cursorShape\": \"line\",\n \"editor.fontFamily\": `'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace`,\n \"editor.fontSize\": 14,\n \"editor.reuseHeaders\": true,\n \"editor.theme\": \"dark\",\n \"general.betaUpdates\": false,\n \"prettier.printWidth\": 80,\n \"prettier.tabWidth\": 2,\n \"prettier.useTabs\": false,\n \"request.credentials\": \"omit\",\n \"schema.disableComments\": true,\n \"schema.polling.enable\": false,\n \"schema.polling.endpointFilter\": \"*localhost*\",\n \"schema.polling.interval\": 2000000,\n \"tracing.hideTracingResponse\": true,\n \"queryPlan.hideQueryPlanResponse\": true\n};\n"],"mappings":";;;;;;AAAO,IAAMA,QAAa,GAAG;EACzB,oBAAoB,EAAE,MAAM;EAC5B,mBAAmB,wFAAwF;EAC3G,iBAAiB,EAAE,EAAE;EACrB,qBAAqB,EAAE,IAAI;EAC3B,cAAc,EAAE,MAAM;EACtB,qBAAqB,EAAE,KAAK;EAC5B,qBAAqB,EAAE,EAAE;EACzB,mBAAmB,EAAE,CAAC;EACtB,kBAAkB,EAAE,KAAK;EACzB,qBAAqB,EAAE,MAAM;EAC7B,wBAAwB,EAAE,IAAI;EAC9B,uBAAuB,EAAE,KAAK;EAC9B,+BAA+B,EAAE,aAAa;EAC9C,yBAAyB,EAAE,OAAO;EAClC,6BAA6B,EAAE,IAAI;EACnC,iCAAiC,EAAE;AACvC,CAAC;AAAC"}
|
package/types.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins/types";
|
|
2
2
|
import { SecurityIdentity } from "@webiny/app-security/types";
|
|
3
|
-
export
|
|
3
|
+
export interface GraphQLPlaygroundTabParams {
|
|
4
|
+
locale: string;
|
|
5
|
+
identity: SecurityIdentity;
|
|
6
|
+
}
|
|
7
|
+
export interface GraphQLPlaygroundTab {
|
|
4
8
|
name: string;
|
|
5
9
|
endpoint: string;
|
|
6
10
|
headers: Record<string, string>;
|
|
7
11
|
query: string;
|
|
8
|
-
}
|
|
12
|
+
}
|
|
9
13
|
export declare type GraphQLPlaygroundTabPlugin = Plugin<{
|
|
10
14
|
type: "graphql-playground-tab";
|
|
11
|
-
tab(params:
|
|
12
|
-
locale: string;
|
|
13
|
-
identity: SecurityIdentity;
|
|
14
|
-
}): GraphQLPlaygroundTab;
|
|
15
|
+
tab: (params: GraphQLPlaygroundTabParams) => GraphQLPlaygroundTab | null;
|
|
15
16
|
}>;
|
package/types.js
CHANGED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport { SecurityIdentity } from \"@webiny/app-security/types\";\n\nexport interface GraphQLPlaygroundTabParams {\n locale: string;\n identity: SecurityIdentity;\n}\nexport interface GraphQLPlaygroundTab {\n name: string;\n endpoint: string;\n headers: Record<string, string>;\n query: string;\n}\n\nexport type GraphQLPlaygroundTabPlugin = Plugin<{\n type: \"graphql-playground-tab\";\n tab: (params: GraphQLPlaygroundTabParams) => GraphQLPlaygroundTab | null;\n}>;\n"],"mappings":""}
|
|
File without changes
|