@webiny/app-graphql-playground 5.41.0-dbt.0 → 5.41.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/package.json +10 -10
- package/plugins/Playground.js +7 -1
- package/plugins/Playground.js.map +1 -1
- package/plugins/constants.d.ts +2 -0
- package/plugins/constants.js +10 -0
- package/plugins/constants.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-graphql-playground",
|
|
3
|
-
"version": "5.41.0
|
|
3
|
+
"version": "5.41.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@emotion/react": "11.10.8",
|
|
13
13
|
"@emotion/styled": "11.10.6",
|
|
14
|
-
"@webiny/app": "5.41.0
|
|
15
|
-
"@webiny/app-admin": "5.41.0
|
|
16
|
-
"@webiny/app-i18n": "5.41.0
|
|
17
|
-
"@webiny/app-security": "5.41.0
|
|
18
|
-
"@webiny/plugins": "5.41.0
|
|
19
|
-
"@webiny/ui": "5.41.0
|
|
14
|
+
"@webiny/app": "5.41.0",
|
|
15
|
+
"@webiny/app-admin": "5.41.0",
|
|
16
|
+
"@webiny/app-i18n": "5.41.0",
|
|
17
|
+
"@webiny/app-security": "5.41.0",
|
|
18
|
+
"@webiny/plugins": "5.41.0",
|
|
19
|
+
"@webiny/ui": "5.41.0",
|
|
20
20
|
"apollo-cache": "1.3.5",
|
|
21
21
|
"apollo-client": "2.6.10",
|
|
22
22
|
"apollo-link": "1.2.14",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@babel/preset-react": "7.24.1",
|
|
37
37
|
"@babel/preset-typescript": "7.24.1",
|
|
38
38
|
"@emotion/babel-plugin": "11.11.0",
|
|
39
|
-
"@webiny/cli": "5.41.0
|
|
40
|
-
"@webiny/project-utils": "5.41.0
|
|
39
|
+
"@webiny/cli": "5.41.0",
|
|
40
|
+
"@webiny/project-utils": "5.41.0",
|
|
41
41
|
"rimraf": "5.0.5",
|
|
42
42
|
"typescript": "4.9.5"
|
|
43
43
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
]
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a542f4d0806744c5e2333b3786478c4af3b6b750"
|
|
63
63
|
}
|
package/plugins/Playground.js
CHANGED
|
@@ -20,6 +20,7 @@ var _Progress = require("@webiny/ui/Progress");
|
|
|
20
20
|
var _Playground = require("./Playground.styles");
|
|
21
21
|
var _settings = require("./settings");
|
|
22
22
|
var _config = require("@webiny/app/config");
|
|
23
|
+
var _constants = require("./constants");
|
|
23
24
|
/**
|
|
24
25
|
* Package load-script does not have types.
|
|
25
26
|
*/
|
|
@@ -38,7 +39,12 @@ var initScripts = function initScripts() {
|
|
|
38
39
|
if (window.GraphQLPlayground) {
|
|
39
40
|
return resolve();
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
(0, _loadScript.default)(_constants.PATCHED_GQL_PLAYGROUND_URL, function (err) {
|
|
43
|
+
if (err) {
|
|
44
|
+
return (0, _loadScript.default)(_constants.ORIGINAL_GQL_PLAYGROUND_URL, resolve);
|
|
45
|
+
}
|
|
46
|
+
resolve();
|
|
47
|
+
});
|
|
42
48
|
});
|
|
43
49
|
};
|
|
44
50
|
var Playground = function Playground(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_apolloLink","_apolloLinkContext","_loadScript","_interopRequireDefault","_react2","_plugins","_useI18N2","_appSecurity","_Progress","_Playground","_settings","_config","withHeaders","link","headers","ApolloLink","from","setContext","_","req","_objectSpread2","default","initScripts","Promise","resolve","window","GraphQLPlayground","loadScript","Playground","_ref","createApolloClient","_useState","useState","_useState2","_slicedToArray2","loading","setLoading","_useI18N","useI18N","getCurrentLocale","_useSecurity","useSecurity","identity","links","useRef","locale","tabs","plugins","byType","map","pl","tab","filter","Boolean","createApolloLink","useCallback","_ref2","endpoint","current","apiUrl","appConfig","getKey","process","env","REACT_APP_API_URL","includes","Object","values","uri","useEffect","then","init","document","getElementById","settings","createElement","Fragment","CircularProgress","label","PlaygroundContainer","id","Global","styles","playgroundDialog","_default","exports"],"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-expect-error\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-expect-error\n if (window.GraphQLPlayground) {\n return resolve();\n }\n\n return loadScript(
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_apolloLink","_apolloLinkContext","_loadScript","_interopRequireDefault","_react2","_plugins","_useI18N2","_appSecurity","_Progress","_Playground","_settings","_config","_constants","withHeaders","link","headers","ApolloLink","from","setContext","_","req","_objectSpread2","default","initScripts","Promise","resolve","window","GraphQLPlayground","loadScript","PATCHED_GQL_PLAYGROUND_URL","err","ORIGINAL_GQL_PLAYGROUND_URL","Playground","_ref","createApolloClient","_useState","useState","_useState2","_slicedToArray2","loading","setLoading","_useI18N","useI18N","getCurrentLocale","_useSecurity","useSecurity","identity","links","useRef","locale","tabs","plugins","byType","map","pl","tab","filter","Boolean","createApolloLink","useCallback","_ref2","endpoint","current","apiUrl","appConfig","getKey","process","env","REACT_APP_API_URL","includes","Object","values","uri","useEffect","then","init","document","getElementById","settings","createElement","Fragment","CircularProgress","label","PlaygroundContainer","id","Global","styles","playgroundDialog","_default","exports"],"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-expect-error\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\";\nimport { ORIGINAL_GQL_PLAYGROUND_URL, PATCHED_GQL_PLAYGROUND_URL } from \"./constants\";\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-expect-error\n if (window.GraphQLPlayground) {\n return resolve();\n }\n\n loadScript(PATCHED_GQL_PLAYGROUND_URL, (err: Error) => {\n if (err) {\n return loadScript(ORIGINAL_GQL_PLAYGROUND_URL, resolve);\n }\n\n resolve();\n });\n });\n};\n\ninterface CreateApolloClientParams {\n uri: string;\n}\n\ninterface PlaygroundProps {\n createApolloClient: (params: CreateApolloClientParams) => ApolloClient<any>;\n}\n\ninterface CreateApolloLinkCallableParams {\n endpoint: string;\n headers: Record<string, string>;\n}\n\ninterface CreateApolloLinkCallableResult {\n link: ApolloLink;\n}\n\ninterface CreateApolloLinkCallable {\n (params: CreateApolloLinkCallableParams): CreateApolloLinkCallableResult;\n}\n\nconst Playground = ({ createApolloClient }: PlaygroundProps) => {\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<CreateApolloLinkCallable>(({ 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) as string;\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-expect-error\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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D,aAAA,CAAC3E,OAAA,CAAAiF,MAAM;IAACC,MAAM,EAAEC;EAAiB,CAAE,CAC7B,CAAC;AAEnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnE,OAAA,GAEaU,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ORIGINAL_GQL_PLAYGROUND_URL = "https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js";
|
|
2
|
+
export declare const PATCHED_GQL_PLAYGROUND_URL = "https://webiny-public.s3.us-east-2.amazonaws.com/project-scripts/gql-playground-mw-1.7.42-patched.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PATCHED_GQL_PLAYGROUND_URL = exports.ORIGINAL_GQL_PLAYGROUND_URL = void 0;
|
|
7
|
+
var ORIGINAL_GQL_PLAYGROUND_URL = exports.ORIGINAL_GQL_PLAYGROUND_URL = "https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js";
|
|
8
|
+
var PATCHED_GQL_PLAYGROUND_URL = exports.PATCHED_GQL_PLAYGROUND_URL = "https://webiny-public.s3.us-east-2.amazonaws.com/project-scripts/gql-playground-mw-1.7.42-patched.js";
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ORIGINAL_GQL_PLAYGROUND_URL","exports","PATCHED_GQL_PLAYGROUND_URL"],"sources":["constants.ts"],"sourcesContent":["export const ORIGINAL_GQL_PLAYGROUND_URL =\n \"https://cdn.jsdelivr.net/npm/@apollographql/graphql-playground-react@1.7.32/build/static/js/middleware.js\";\n\nexport const PATCHED_GQL_PLAYGROUND_URL =\n \"https://webiny-public.s3.us-east-2.amazonaws.com/project-scripts/gql-playground-mw-1.7.42-patched.js\";\n"],"mappings":";;;;;;AAAO,IAAMA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GACpC,2GAA2G;AAExG,IAAME,0BAA0B,GAAAD,OAAA,CAAAC,0BAAA,GACnC,sGAAsG","ignoreList":[]}
|