@webiny/app-graphql-playground 6.0.0-alpha.0 → 6.0.0-alpha.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/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/package.json +9 -9
- package/plugins/Playground.d.ts +1 -1
- package/plugins/Playground.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js.map +1 -1
- package/types.d.ts +2 -2
- package/types.js.map +1 -1
package/index.d.ts
CHANGED
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 { 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","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":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-graphql-playground",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.1",
|
|
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": "6.0.0-alpha.
|
|
15
|
-
"@webiny/app-admin": "6.0.0-alpha.
|
|
16
|
-
"@webiny/app-i18n": "6.0.0-alpha.
|
|
17
|
-
"@webiny/app-security": "6.0.0-alpha.
|
|
18
|
-
"@webiny/plugins": "6.0.0-alpha.
|
|
19
|
-
"@webiny/ui": "6.0.0-alpha.
|
|
14
|
+
"@webiny/app": "6.0.0-alpha.1",
|
|
15
|
+
"@webiny/app-admin": "6.0.0-alpha.1",
|
|
16
|
+
"@webiny/app-i18n": "6.0.0-alpha.1",
|
|
17
|
+
"@webiny/app-security": "6.0.0-alpha.1",
|
|
18
|
+
"@webiny/plugins": "6.0.0-alpha.1",
|
|
19
|
+
"@webiny/ui": "6.0.0-alpha.1",
|
|
20
20
|
"apollo-cache": "1.3.5",
|
|
21
21
|
"apollo-client": "2.6.10",
|
|
22
22
|
"apollo-link": "1.2.14",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@emotion/babel-plugin": "11.11.0",
|
|
33
|
-
"@webiny/project-utils": "6.0.0-alpha.
|
|
33
|
+
"@webiny/project-utils": "6.0.0-alpha.1",
|
|
34
34
|
"rimraf": "6.0.1",
|
|
35
35
|
"typescript": "5.3.3"
|
|
36
36
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "9bd236cf5e689f209a11bec089207dcc2d41a53c"
|
|
56
56
|
}
|
package/plugins/Playground.d.ts
CHANGED
|
@@ -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 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":"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,i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;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","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,UA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AwB,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":[]}
|
package/plugins/index.d.ts
CHANGED
package/plugins/index.js.map
CHANGED
|
@@ -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 { 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\";\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":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
-
import { SecurityIdentity } from "@webiny/app-security/types";
|
|
1
|
+
import type { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
import type { SecurityIdentity } from "@webiny/app-security/types";
|
|
3
3
|
export interface GraphQLPlaygroundTabParams {
|
|
4
4
|
locale: string;
|
|
5
5
|
identity: SecurityIdentity;
|
package/types.js.map
CHANGED
|
@@ -1 +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":"","ignoreList":[]}
|
|
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":[]}
|