@webiny/app-graphql-playground 0.0.0-unstable.e53eceafb5 β†’ 0.0.0-unstable.e6f0dc8ca7

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.
@@ -0,0 +1,15 @@
1
+ export declare const DEV_TOOLS_PERMISSIONS_SCHEMA: {
2
+ readonly prefix: "dev-tools";
3
+ readonly fullAccess: true;
4
+ readonly entities: [{
5
+ readonly id: "graphql-playground";
6
+ readonly title: "GraphQL Playground";
7
+ readonly permission: "dev-tools.graphql-playground.*";
8
+ readonly scopes: ["full"];
9
+ }, {
10
+ readonly id: "sdk-playground";
11
+ readonly title: "SDK Playground";
12
+ readonly permission: "dev-tools.sdk-playground.*";
13
+ readonly scopes: ["full"];
14
+ }];
15
+ };
@@ -0,0 +1,18 @@
1
+ import { createPermissionSchema } from "@webiny/app-admin";
2
+ export const DEV_TOOLS_PERMISSIONS_SCHEMA = createPermissionSchema({
3
+ prefix: "dev-tools",
4
+ fullAccess: true,
5
+ entities: [{
6
+ id: "graphql-playground",
7
+ title: "GraphQL Playground",
8
+ permission: "dev-tools.graphql-playground.*",
9
+ scopes: ["full"]
10
+ }, {
11
+ id: "sdk-playground",
12
+ title: "SDK Playground",
13
+ permission: "dev-tools.sdk-playground.*",
14
+ scopes: ["full"]
15
+ }]
16
+ });
17
+
18
+ //# sourceMappingURL=PermissionsSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createPermissionSchema","DEV_TOOLS_PERMISSIONS_SCHEMA","prefix","fullAccess","entities","id","title","permission","scopes"],"sources":["PermissionsSchema.ts"],"sourcesContent":["import { createPermissionSchema } from \"@webiny/app-admin\";\n\nexport const DEV_TOOLS_PERMISSIONS_SCHEMA = createPermissionSchema({\n prefix: \"dev-tools\",\n fullAccess: true,\n entities: [\n {\n id: \"graphql-playground\",\n title: \"GraphQL Playground\",\n permission: \"dev-tools.graphql-playground.*\",\n scopes: [\"full\"]\n },\n {\n id: \"sdk-playground\",\n title: \"SDK Playground\",\n permission: \"dev-tools.sdk-playground.*\",\n scopes: [\"full\"]\n }\n ]\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,mBAAmB;AAE1D,OAAO,MAAMC,4BAA4B,GAAGD,sBAAsB,CAAC;EAC/DE,MAAM,EAAE,WAAW;EACnBC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,CACN;IACIC,EAAE,EAAE,oBAAoB;IACxBC,KAAK,EAAE,oBAAoB;IAC3BC,UAAU,EAAE,gCAAgC;IAC5CC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC,EACD;IACIH,EAAE,EAAE,gBAAgB;IACpBC,KAAK,EAAE,gBAAgB;IACvBC,UAAU,EAAE,4BAA4B;IACxCC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
package/README.md CHANGED
@@ -1 +1,11 @@
1
1
  # @webiny/app-graphql-playground
2
+
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const SecurityPermission: () => React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { AdminConfig } from "@webiny/app-admin";
3
+ import { ReactComponent as DevToolsIcon } from "@webiny/icons/developer_mode.svg";
4
+ import { DEV_TOOLS_PERMISSIONS_SCHEMA } from "./PermissionsSchema.js";
5
+ const {
6
+ Security
7
+ } = AdminConfig;
8
+ export const SecurityPermission = () => {
9
+ return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Security.Permissions, {
10
+ name: "dev-tools",
11
+ title: "Dev Tools",
12
+ description: "Manage Dev Tools access.",
13
+ icon: /*#__PURE__*/React.createElement(DevToolsIcon, null),
14
+ schema: DEV_TOOLS_PERMISSIONS_SCHEMA
15
+ }));
16
+ };
17
+
18
+ //# sourceMappingURL=SecurityPermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","AdminConfig","ReactComponent","DevToolsIcon","DEV_TOOLS_PERMISSIONS_SCHEMA","Security","SecurityPermission","createElement","Permissions","name","title","description","icon","schema"],"sources":["SecurityPermission.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { ReactComponent as DevToolsIcon } from \"@webiny/icons/developer_mode.svg\";\nimport { DEV_TOOLS_PERMISSIONS_SCHEMA } from \"./PermissionsSchema.js\";\n\nconst { Security } = AdminConfig;\n\nexport const SecurityPermission = () => {\n return (\n <AdminConfig>\n <Security.Permissions\n name=\"dev-tools\"\n title=\"Dev Tools\"\n description=\"Manage Dev Tools access.\"\n icon={<DevToolsIcon />}\n schema={DEV_TOOLS_PERMISSIONS_SCHEMA}\n />\n </AdminConfig>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,cAAc,IAAIC,YAAY,QAAQ,kCAAkC;AACjF,SAASC,4BAA4B;AAErC,MAAM;EAAEC;AAAS,CAAC,GAAGJ,WAAW;AAEhC,OAAO,MAAMK,kBAAkB,GAAGA,CAAA,KAAM;EACpC,oBACIN,KAAA,CAAAO,aAAA,CAACN,WAAW,qBACRD,KAAA,CAAAO,aAAA,CAACF,QAAQ,CAACG,WAAW;IACjBC,IAAI,EAAC,WAAW;IAChBC,KAAK,EAAC,WAAW;IACjBC,WAAW,EAAC,0BAA0B;IACtCC,IAAI,eAAEZ,KAAA,CAAAO,aAAA,CAACJ,YAAY,MAAE,CAAE;IACvBU,MAAM,EAAET;EAA6B,CACxC,CACQ,CAAC;AAEtB,CAAC","ignoreList":[]}
package/index.js CHANGED
@@ -1,24 +1,53 @@
1
1
  import React, { memo } from "react";
2
2
  import { plugins } from "@webiny/plugins";
3
- import { AdminConfig, Layout } from "@webiny/app-admin";
4
- import Playground from "./plugins/Playground";
5
- import playgroundPlugins from "./plugins";
3
+ import { useRouter, AdminConfig, AdminLayout, HasPermission } from "@webiny/app-admin";
4
+ import { ReactComponent as ApiPlaygroundIcon } from "@webiny/icons/graphql_playground.svg";
5
+ import { ReactComponent as DevToolsIcon } from "@webiny/icons/developer_mode.svg";
6
+ import Playground from "./plugins/Playground.js";
7
+ import playgroundPlugins from "./plugins/index.js";
8
+ import { SecurityPermission } from "./SecurityPermission.js";
9
+ import { Routes } from "./routes.js";
6
10
  const {
7
- Route
11
+ Route,
12
+ Menu
8
13
  } = AdminConfig;
9
14
  const GraphQLPlaygroundExtension = ({
10
15
  createApolloClient
11
16
  }) => {
17
+ const router = useRouter();
12
18
  plugins.register(playgroundPlugins);
13
- return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Route, {
14
- name: "apiPlayground",
15
- path: "/api-playground",
16
- element: /*#__PURE__*/React.createElement(Layout, {
17
- title: "API Playground"
19
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SecurityPermission, null), /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Menu, {
20
+ name: "dev-tools",
21
+ hideIfEmpty: true,
22
+ pin: "end",
23
+ element: /*#__PURE__*/React.createElement(Menu.Item, {
24
+ text: "Dev Tools",
25
+ icon: /*#__PURE__*/React.createElement(Menu.Item.Icon, {
26
+ label: "Dev Tools",
27
+ element: /*#__PURE__*/React.createElement(DevToolsIcon, null)
28
+ })
29
+ })
30
+ }), /*#__PURE__*/React.createElement(HasPermission, {
31
+ any: ["dev-tools.*", "dev-tools.graphql-playground.*"]
32
+ }, /*#__PURE__*/React.createElement(Menu, {
33
+ name: "dev-tools.graphql",
34
+ parent: "dev-tools",
35
+ element: /*#__PURE__*/React.createElement(Menu.Link, {
36
+ text: "GraphQL Playground",
37
+ to: router.getLink(Routes.ApiPlayground),
38
+ icon: /*#__PURE__*/React.createElement(Menu.Link.Icon, {
39
+ label: "GraphQL Playground",
40
+ element: /*#__PURE__*/React.createElement(ApiPlaygroundIcon, null)
41
+ })
42
+ })
43
+ })), /*#__PURE__*/React.createElement(Route, {
44
+ route: Routes.ApiPlayground,
45
+ element: /*#__PURE__*/React.createElement(AdminLayout, {
46
+ title: "GraphQL Playground"
18
47
  }, /*#__PURE__*/React.createElement(Playground, {
19
48
  createApolloClient: createApolloClient
20
49
  }))
21
- }));
50
+ })));
22
51
  };
23
52
  export const GraphQLPlayground = /*#__PURE__*/memo(GraphQLPlaygroundExtension);
24
53
 
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React","memo","plugins","AdminConfig","Layout","Playground","playgroundPlugins","Route","GraphQLPlaygroundExtension","createApolloClient","register","createElement","name","path","element","title","GraphQLPlayground"],"sources":["index.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport type { ApolloClient } from \"apollo-client\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AdminConfig, Layout } from \"@webiny/app-admin\";\nimport Playground from \"./plugins/Playground\";\nimport playgroundPlugins from \"./plugins\";\n\nconst { Route } = AdminConfig;\n\ninterface CreateApolloClientParams {\n uri: string;\n}\n\ninterface GraphQLPlaygroundProps {\n createApolloClient(params: CreateApolloClientParams): ApolloClient<any>;\n}\n\nconst GraphQLPlaygroundExtension = ({ createApolloClient }: GraphQLPlaygroundProps) => {\n plugins.register(playgroundPlugins);\n\n return (\n <AdminConfig>\n <Route\n name={\"apiPlayground\"}\n path={\"/api-playground\"}\n element={\n <Layout title={\"API Playground\"}>\n <Playground createApolloClient={createApolloClient} />\n </Layout>\n }\n />\n </AdminConfig>\n );\n};\n\nexport const GraphQLPlayground = memo(GraphQLPlaygroundExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAEnC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,WAAW,EAAEC,MAAM,QAAQ,mBAAmB;AACvD,OAAOC,UAAU;AACjB,OAAOC,iBAAiB;AAExB,MAAM;EAAEC;AAAM,CAAC,GAAGJ,WAAW;AAU7B,MAAMK,0BAA0B,GAAGA,CAAC;EAAEC;AAA2C,CAAC,KAAK;EACnFP,OAAO,CAACQ,QAAQ,CAACJ,iBAAiB,CAAC;EAEnC,oBACIN,KAAA,CAAAW,aAAA,CAACR,WAAW,qBACRH,KAAA,CAAAW,aAAA,CAACJ,KAAK;IACFK,IAAI,EAAE,eAAgB;IACtBC,IAAI,EAAE,iBAAkB;IACxBC,OAAO,eACHd,KAAA,CAAAW,aAAA,CAACP,MAAM;MAACW,KAAK,EAAE;IAAiB,gBAC5Bf,KAAA,CAAAW,aAAA,CAACN,UAAU;MAACI,kBAAkB,EAAEA;IAAmB,CAAE,CACjD;EACX,CACJ,CACQ,CAAC;AAEtB,CAAC;AAED,OAAO,MAAMO,iBAAiB,gBAAGf,IAAI,CAACO,0BAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","memo","plugins","useRouter","AdminConfig","AdminLayout","HasPermission","ReactComponent","ApiPlaygroundIcon","DevToolsIcon","Playground","playgroundPlugins","SecurityPermission","Routes","Route","Menu","GraphQLPlaygroundExtension","createApolloClient","router","register","createElement","Fragment","name","hideIfEmpty","pin","element","Item","text","icon","Icon","label","any","parent","Link","to","getLink","ApiPlayground","route","title","GraphQLPlayground"],"sources":["index.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport type { ApolloClient } from \"apollo-client\";\nimport { plugins } from \"@webiny/plugins\";\nimport { useRouter, AdminConfig, AdminLayout, HasPermission } from \"@webiny/app-admin\";\nimport { ReactComponent as ApiPlaygroundIcon } from \"@webiny/icons/graphql_playground.svg\";\nimport { ReactComponent as DevToolsIcon } from \"@webiny/icons/developer_mode.svg\";\nimport Playground from \"./plugins/Playground.js\";\nimport playgroundPlugins from \"./plugins/index.js\";\nimport { SecurityPermission } from \"./SecurityPermission.js\";\nimport { Routes } from \"~/routes.js\";\n\nconst { Route, Menu } = AdminConfig;\n\ninterface CreateApolloClientParams {\n uri: string;\n}\n\ninterface GraphQLPlaygroundProps {\n createApolloClient(params: CreateApolloClientParams): ApolloClient<any>;\n}\n\nconst GraphQLPlaygroundExtension = ({ createApolloClient }: GraphQLPlaygroundProps) => {\n const router = useRouter();\n plugins.register(playgroundPlugins);\n\n return (\n <>\n <SecurityPermission />\n <AdminConfig>\n <Menu\n name={\"dev-tools\"}\n hideIfEmpty={true}\n pin={\"end\"}\n element={\n <Menu.Item\n text={\"Dev Tools\"}\n icon={<Menu.Item.Icon label=\"Dev Tools\" element={<DevToolsIcon />} />}\n />\n }\n />\n <HasPermission any={[\"dev-tools.*\", \"dev-tools.graphql-playground.*\"]}>\n <Menu\n name={\"dev-tools.graphql\"}\n parent={\"dev-tools\"}\n element={\n <Menu.Link\n text={\"GraphQL Playground\"}\n to={router.getLink(Routes.ApiPlayground)}\n icon={\n <Menu.Link.Icon\n label=\"GraphQL Playground\"\n element={<ApiPlaygroundIcon />}\n />\n }\n />\n }\n />\n </HasPermission>\n\n <Route\n route={Routes.ApiPlayground}\n element={\n <AdminLayout title={\"GraphQL Playground\"}>\n <Playground createApolloClient={createApolloClient} />\n </AdminLayout>\n }\n />\n </AdminConfig>\n </>\n );\n};\n\nexport const GraphQLPlayground = memo(GraphQLPlaygroundExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAEnC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,EAAEC,aAAa,QAAQ,mBAAmB;AACtF,SAASC,cAAc,IAAIC,iBAAiB,QAAQ,sCAAsC;AAC1F,SAASD,cAAc,IAAIE,YAAY,QAAQ,kCAAkC;AACjF,OAAOC,UAAU;AACjB,OAAOC,iBAAiB;AACxB,SAASC,kBAAkB;AAC3B,SAASC,MAAM;AAEf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B;QAC1BL,OAAO,eAAEzB,KAAA,CAAAoB,aAAA,CAACZ,iBAAiB,MAAE;MAAE,CAClC;IACJ,CACJ;EACJ,CACJ,CACU,CAAC,eAEhBR,KAAA,CAAAoB,aAAA,CAACN,KAAK;IACFuB,KAAK,EAAExB,MAAM,CAACuB,aAAc;IAC5BX,OAAO,eACHzB,KAAA,CAAAoB,aAAA,CAACf,WAAW;MAACiC,KAAK,EAAE;IAAqB,gBACrCtC,KAAA,CAAAoB,aAAA,CAACV,UAAU;MAACO,kBAAkB,EAAEA;IAAmB,CAAE,CAC5C;EAChB,CACJ,CACQ,CACf,CAAC;AAEX,CAAC;AAED,OAAO,MAAMsB,iBAAiB,gBAAGtC,IAAI,CAACe,0BAA0B,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/app-graphql-playground",
3
- "version": "0.0.0-unstable.e53eceafb5",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.e6f0dc8ca7",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "repository": {
6
10
  "type": "git",
7
11
  "url": "https://github.com/webiny/webiny-js.git"
@@ -9,39 +13,33 @@
9
13
  "author": "Webiny Ltd",
10
14
  "license": "MIT",
11
15
  "dependencies": {
12
- "@emotion/react": "11.10.8",
13
- "@emotion/styled": "11.10.6",
14
- "@webiny/app": "0.0.0-unstable.e53eceafb5",
15
- "@webiny/app-admin": "0.0.0-unstable.e53eceafb5",
16
- "@webiny/app-i18n": "0.0.0-unstable.e53eceafb5",
17
- "@webiny/app-security": "0.0.0-unstable.e53eceafb5",
18
- "@webiny/plugins": "0.0.0-unstable.e53eceafb5",
19
- "@webiny/ui": "0.0.0-unstable.e53eceafb5",
16
+ "@emotion/react": "11.14.0",
17
+ "@emotion/styled": "11.14.1",
18
+ "@webiny/admin-ui": "0.0.0-unstable.e6f0dc8ca7",
19
+ "@webiny/app": "0.0.0-unstable.e6f0dc8ca7",
20
+ "@webiny/app-admin": "0.0.0-unstable.e6f0dc8ca7",
21
+ "@webiny/icons": "0.0.0-unstable.e6f0dc8ca7",
22
+ "@webiny/plugins": "0.0.0-unstable.e6f0dc8ca7",
20
23
  "apollo-cache": "1.3.5",
21
24
  "apollo-client": "2.6.10",
22
25
  "apollo-link": "1.2.14",
23
26
  "apollo-link-context": "1.0.20",
24
27
  "apollo-utilities": "1.3.4",
25
- "graphql": "15.9.0",
26
- "load-script": "1.0.0",
27
- "prop-types": "15.8.1",
28
- "react": "18.2.0",
29
- "react-dom": "18.2.0"
28
+ "graphql": "16.14.0",
29
+ "load-script": "2.0.0",
30
+ "react": "18.3.1",
31
+ "react-dom": "18.3.1"
30
32
  },
31
33
  "devDependencies": {
32
- "@emotion/babel-plugin": "11.11.0",
33
- "@webiny/project-utils": "0.0.0-unstable.e53eceafb5",
34
- "rimraf": "6.0.1",
35
- "typescript": "5.3.3"
34
+ "@emotion/babel-plugin": "11.13.5",
35
+ "@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
36
+ "rimraf": "6.1.3",
37
+ "typescript": "6.0.3"
36
38
  },
37
39
  "publishConfig": {
38
40
  "access": "public",
39
41
  "directory": "dist"
40
42
  },
41
- "scripts": {
42
- "build": "node ../cli/bin.js run build",
43
- "watch": "node ../cli/bin.js run watch"
44
- },
45
43
  "adio": {
46
44
  "ignore": {
47
45
  "src": [
@@ -52,5 +50,5 @@
52
50
  ]
53
51
  }
54
52
  },
55
- "gitHead": "e53eceafb5ce1a3872c9b4548939bb2eae5b1aef"
53
+ "gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
56
54
  }
@@ -1,20 +1,15 @@
1
1
  import React, { Fragment, useEffect, useRef, useCallback, useState } from "react";
2
2
  import { ApolloLink } from "apollo-link";
3
3
  import { setContext } from "apollo-link-context";
4
- /**
5
- * Package load-script does not have types.
6
- */
7
- // @ts-expect-error
8
4
  import loadScript from "load-script";
9
5
  import { Global } from "@emotion/react";
10
6
  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
- import { config as appConfig } from "@webiny/app/config";
17
- import { ORIGINAL_GQL_PLAYGROUND_URL, PATCHED_GQL_PLAYGROUND_URL } from "./constants";
7
+ import { useIdentity } from "@webiny/app-admin";
8
+ import { OverlayLoader } from "@webiny/admin-ui";
9
+ import { playgroundDialog, PlaygroundContainer } from "./Playground.styles.js";
10
+ import { settings } from "./settings.js";
11
+ import { config as appConfig } from "@webiny/app/config.js";
12
+ import { ORIGINAL_GQL_PLAYGROUND_URL, PATCHED_GQL_PLAYGROUND_URL } from "./constants.js";
18
13
  const withHeaders = (link, headers) => {
19
14
  return ApolloLink.from([setContext(async (_, req) => {
20
15
  return {
@@ -43,16 +38,11 @@ const Playground = ({
43
38
  createApolloClient
44
39
  }) => {
45
40
  const [loading, setLoading] = useState(true);
46
- const {
47
- getCurrentLocale
48
- } = useI18N();
49
41
  const {
50
42
  identity
51
- } = useSecurity();
43
+ } = useIdentity();
52
44
  const links = useRef({});
53
- const locale = getCurrentLocale("content");
54
45
  const tabs = plugins.byType("graphql-playground-tab").map(pl => pl.tab({
55
- locale: locale,
56
46
  identity: identity
57
47
  })).filter(Boolean);
58
48
  const createApolloLink = useCallback(({
@@ -91,8 +81,8 @@ const Playground = ({
91
81
  });
92
82
  }
93
83
  }, [loading]);
94
- return /*#__PURE__*/React.createElement(Fragment, null, loading ? /*#__PURE__*/React.createElement(CircularProgress, {
95
- label: "Loading playground..."
84
+ return /*#__PURE__*/React.createElement(Fragment, null, loading ? /*#__PURE__*/React.createElement(OverlayLoader, {
85
+ text: "Loading playground..."
96
86
  }) : /*#__PURE__*/React.createElement(PlaygroundContainer, {
97
87
  id: "graphql-playground"
98
88
  }), /*#__PURE__*/React.createElement(Global, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Fragment","useEffect","useRef","useCallback","useState","ApolloLink","setContext","loadScript","Global","plugins","useI18N","useSecurity","CircularProgress","playgroundDialog","PlaygroundContainer","settings","config","appConfig","ORIGINAL_GQL_PLAYGROUND_URL","PATCHED_GQL_PLAYGROUND_URL","withHeaders","link","headers","from","_","req","initScripts","Promise","resolve","window","GraphQLPlayground","err","Playground","createApolloClient","loading","setLoading","getCurrentLocale","identity","links","locale","tabs","byType","map","pl","tab","filter","Boolean","createApolloLink","endpoint","current","apiUrl","getKey","process","env","REACT_APP_API_URL","includes","Object","values","uri","then","init","document","getElementById","createElement","label","id","styles"],"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 type ApolloClient from \"apollo-client\";\nimport type { GraphQLPlaygroundTabPlugin } from \"~/types\";\nimport type { 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":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACjF,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA;AACA;AACA;AACA,OAAOC,UAAU,MAAM,aAAa;AACpC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,OAAO,QAAQ,gCAAgC;AACxD,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,gBAAgB,EAAEC,mBAAmB;AAC9C,SAASC,QAAQ;AACjB,SAASC,MAAM,IAAIC,SAAS,QAAQ,oBAAoB;AAIxD,SAASC,2BAA2B,EAAEC,0BAA0B;AAEhE,MAAMC,WAAW,GAAGA,CAACC,IAAgB,EAAEC,OAA+B,KAAiB;EACnF,OAAOjB,UAAU,CAACkB,IAAI,CAAC,CACnBjB,UAAU,CAAC,OAAOkB,CAAC,EAAEC,GAAG,KAAK;IACzB,OAAO;MACHH,OAAO,EAAE;QACL,GAAGG,GAAG,CAACH,OAAO;QACd,GAAGA;MACP;IACJ,CAAC;EACL,CAAC,CAAC,EACFD,IAAI,CACP,CAAC;AACN,CAAC;AAED,MAAMK,WAAW,GAAGA,CAAA,KAAM;EACtB,OAAO,IAAIC,OAAO,CAAEC,OAAY,IAAK;IACjC;IACA,IAAIC,MAAM,CAACC,iBAAiB,EAAE;MAC1B,OAAOF,OAAO,CAAC,CAAC;IACpB;IAEArB,UAAU,CAACY,0BAA0B,EAAGY,GAAU,IAAK;MACnD,IAAIA,GAAG,EAAE;QACL,OAAOxB,UAAU,CAACW,2BAA2B,EAAEU,OAAO,CAAC;MAC3D;MAEAA,OAAO,CAAC,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CAAC,CAAC,CAAC3B,IAAI;IAClE;IAEA,OAAO;MACHA,IAAI,EAAED,WAAW,CAAC6B,OAAO,CAACD,QAAQ,CAAC,EAAE1B,OAAO;IAChD,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAENrB,SAAS,CAAC,MAAM;IACZyB,WAAW,CAAC,CAAC,CAACiC,IAAI,CAAC,MAAM;MACrBxB,UAAU,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAENlC,SAAS,CAAC,MAAM;IACZ,IAAI,CAACiC,OAAO,EAAE;MACV;MACAL,MAAM,CAACC,iBAAiB,CAAC8B,IAAI,CAACC,QAAQ,CAACC,cAAc,CAAC,oBAAoB,CAAC,EAAE;QACzEtB,IAAI;QACJO,gBAAgB;QAChBhC;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,EAAE,CAACmB,OAAO,CAAC,CAAC;EAEb,oBACInC,KAAA,CAAAgE,aAAA,CAAC/D,QAAQ,QACJkC,OAAO,gBACJnC,KAAA,CAAAgE,aAAA,CAACnD,gBAAgB;IAACoD,KAAK,EAAE;EAAwB,CAAE,CAAC,gBAEpDjE,KAAA,CAAAgE,aAAA,CAACjD,mBAAmB;IAACmD,EAAE,EAAE;EAAqB,CAAE,CACnD,eACDlE,KAAA,CAAAgE,aAAA,CAACvD,MAAM;IAAC0D,MAAM,EAAErD;EAAiB,CAAE,CAC7B,CAAC;AAEnB,CAAC;AAED,eAAemB,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["React","Fragment","useEffect","useRef","useCallback","useState","ApolloLink","setContext","loadScript","Global","plugins","useIdentity","OverlayLoader","playgroundDialog","PlaygroundContainer","settings","config","appConfig","ORIGINAL_GQL_PLAYGROUND_URL","PATCHED_GQL_PLAYGROUND_URL","withHeaders","link","headers","from","_","req","initScripts","Promise","resolve","window","GraphQLPlayground","err","Playground","createApolloClient","loading","setLoading","identity","links","tabs","byType","map","pl","tab","filter","Boolean","createApolloLink","endpoint","current","apiUrl","getKey","process","env","REACT_APP_API_URL","includes","Object","values","uri","then","init","document","getElementById","createElement","text","id","styles"],"sources":["Playground.tsx"],"sourcesContent":["import React, { Fragment, useEffect, useRef, useCallback, useState } from \"react\";\nimport { ApolloLink } from \"apollo-link\";\nimport { setContext } from \"apollo-link-context\";\nimport loadScript from \"load-script\";\nimport { Global } from \"@emotion/react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { useIdentity } from \"@webiny/app-admin\";\nimport type { Identity } from \"@webiny/app-admin/domain/Identity.js\";\nimport { OverlayLoader } from \"@webiny/admin-ui\";\nimport { playgroundDialog, PlaygroundContainer } from \"./Playground.styles.js\";\nimport { settings } from \"./settings.js\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport type ApolloClient from \"apollo-client\";\nimport type { GraphQLPlaygroundTabPlugin } from \"~/types.js\";\nimport { ORIGINAL_GQL_PLAYGROUND_URL, PATCHED_GQL_PLAYGROUND_URL } from \"./constants.js\";\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 => {\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 { identity } = useIdentity();\n const links = useRef<Record<string, ApolloLink>>({});\n\n const tabs = plugins\n .byType<GraphQLPlaygroundTabPlugin>(\"graphql-playground-tab\")\n .map(pl =>\n pl.tab({\n identity: identity as Identity\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 <OverlayLoader text={\"Loading playground...\"} />\n ) : (\n <PlaygroundContainer id={\"graphql-playground\"} />\n )}\n <Global styles={playgroundDialog} />\n </Fragment>\n );\n};\n\nexport default Playground;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACjF,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,UAAU,QAAQ,qBAAqB;AAChD,OAAOC,UAAU,MAAM,aAAa;AACpC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,gBAAgB,EAAEC,mBAAmB;AAC9C,SAASC,QAAQ;AACjB,SAAS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AAE;EAAwB,CAAE,CAAC,gBAEhD9D,KAAA,CAAA6D,aAAA,CAAC/C,mBAAmB;IAACiD,EAAE,EAAE;EAAqB,CAAE,CACnD,eACD/D,KAAA,CAAA6D,aAAA,CAACpD,MAAM;IAACuD,MAAM,EAAEnD;EAAiB,CAAE,CAC7B,CAAC;AAEnB,CAAC;AAED,eAAemB,UAAU","ignoreList":[]}
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  export declare const PlaygroundContainer: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
5
  export declare const playgroundDialog: {
7
6
  ".ReactModalPortal": {
@@ -1,3 +1,3 @@
1
- import type { GraphQLPlaygroundTabPlugin } from "../types";
1
+ import type { GraphQLPlaygroundTabPlugin } from "../types.js";
2
2
  declare const _default: GraphQLPlaygroundTabPlugin[];
3
3
  export default _default;
package/plugins/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-expect-error
2
2
  import placeholder from "!!raw-loader!./placeholder.graphql";
3
- import { config as appConfig } from "@webiny/app/config";
3
+ import { config as appConfig } from "@webiny/app/config.js";
4
4
  const plugin = {
5
5
  type: "graphql-playground-tab",
6
6
  tab() {
@@ -1 +1 @@
1
- {"version":3,"names":["placeholder","config","appConfig","plugin","type","tab","apiUrl","getKey","process","env","REACT_APP_API_URL","name","endpoint","headers","query"],"sources":["index.tsx"],"sourcesContent":["import type { GraphQLPlaygroundTabPlugin } from \"~/types\";\n// @ts-expect-error\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":"AACA;AACA,OAAOA,WAAW,MAAM,oCAAoC;AAC5D,SAASC,MAAM,IAAIC,SAAS,QAAQ,oBAAoB;AAExD,MAAMC,MAAkC,GAAG;EACvCC,IAAI,EAAE,wBAAwB;EAC9BC,GAAGA,CAAA,EAAG;IACF,MAAMC,MAAM,GAAGJ,SAAS,CAACK,MAAM,CAAC,SAAS,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,CAAW;IACnF,OAAO;MACHC,IAAI,EAAE,UAAU;MAChBC,QAAQ,EAAEN,MAAM,GAAG,UAAU;MAC7BO,OAAO,EAAE,CAAC,CAAC;MACXC,KAAK,EAAEd;IACX,CAAC;EACL;AACJ,CAAC;AACD,eAAe,CAACG,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["placeholder","config","appConfig","plugin","type","tab","apiUrl","getKey","process","env","REACT_APP_API_URL","name","endpoint","headers","query"],"sources":["index.tsx"],"sourcesContent":["import type { GraphQLPlaygroundTabPlugin } from \"~/types.js\";\n// @ts-expect-error\nimport placeholder from \"!!raw-loader!./placeholder.graphql\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\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":"AACA;AACA,OAAOA,WAAW,MAAM,oCAAoC;AAC5D,SAASC,MAAM,IAAIC,SAAS,QAAQ,uBAAuB;AAE3D,MAAMC,MAAkC,GAAG;EACvCC,IAAI,EAAE,wBAAwB;EAC9BC,GAAGA,CAAA,EAAG;IACF,MAAMC,MAAM,GAAGJ,SAAS,CAACK,MAAM,CAAC,SAAS,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,CAAW;IACnF,OAAO;MACHC,IAAI,EAAE,UAAU;MAChBC,QAAQ,EAAEN,MAAM,GAAG,UAAU;MAC7BO,OAAO,EAAE,CAAC,CAAC;MACXC,KAAK,EAAEd;IACX,CAAC;EACL;AACJ,CAAC;AACD,eAAe,CAACG,MAAM,CAAC","ignoreList":[]}
package/routes.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Route } from "@webiny/app-admin";
2
+ export declare const Routes: {
3
+ ApiPlayground: Route<undefined>;
4
+ };
package/routes.js ADDED
@@ -0,0 +1,9 @@
1
+ import { Route } from "@webiny/app-admin";
2
+ export const Routes = {
3
+ ApiPlayground: new Route({
4
+ name: "ApiPlayground",
5
+ path: "/api-playground"
6
+ })
7
+ };
8
+
9
+ //# sourceMappingURL=routes.js.map
package/routes.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Route","Routes","ApiPlayground","name","path"],"sources":["routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n ApiPlayground: new Route({\n name: \"ApiPlayground\",\n path: \"/api-playground\"\n })\n};\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,mBAAmB;AAEzC,OAAO,MAAMC,MAAM,GAAG;EAClBC,aAAa,EAAE,IAAIF,KAAK,CAAC;IACrBG,IAAI,EAAE,eAAe;IACrBC,IAAI,EAAE;EACV,CAAC;AACL,CAAC","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { Plugin } from "@webiny/plugins/types";
2
- import type { SecurityIdentity } from "@webiny/app-security/types";
1
+ import type { Identity } from "@webiny/app-admin/domain/Identity.js";
2
+ import type { Plugin } from "@webiny/plugins/types.js";
3
3
  export interface GraphQLPlaygroundTabParams {
4
- locale: string;
5
- identity: SecurityIdentity;
4
+ identity: Identity;
6
5
  }
7
6
  export interface GraphQLPlaygroundTab {
8
7
  name: string;
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Plugin } from \"@webiny/plugins/types\";\nimport type { 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":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Identity } from \"@webiny/app-admin/domain/Identity.js\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\n\nexport interface GraphQLPlaygroundTabParams {\n identity: Identity;\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":"","ignoreList":[]}