Skip to content

Commit 14787d8

Browse files
chore: update graphiql 3.0.6 (#1855)
### 📝 Description removing plugins as they are incompatible with v3 -- non official plugins. ### 🔗 Related Issues #1854
1 parent 46f2994 commit 14787d8

File tree

1 file changed

+5
-76
lines changed

1 file changed

+5
-76
lines changed

servers/graphql-kotlin-server/src/main/resources/graphql-graphiql.html

Lines changed: 5 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
}
2020
</style>
2121

22-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.css" />
23-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@graphiql/[email protected]/dist/style.css" />
24-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@graphiql/[email protected]/dist/style.css" />
22+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.css" />
2523
</head>
2624

2725
<body>
@@ -33,14 +31,8 @@
3331
<script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.development.js"
3432
integrity="sha512-Wr9OKCTtq1anK0hq5bY3X/AvDI5EflDSAh0mE9gma+4hl+kXdTJPKZ3TwLMBcrgUeoY0s3dq9JjhCQc7vddtFg=="
3533
crossorigin="anonymous"></script>
36-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.js"
37-
integrity="sha512-FVCV2//UVo1qJ3Kg6kkHLe0Hg+IJhjrGa+aYHh8xD4KmwbbjthIzvaAcCJsQgA43+k+6u7HqORKXMyMt82Srfw=="
38-
crossorigin="anonymous"></script>
39-
<script src="https://cdn.jsdelivr.net/npm/@graphiql/[email protected]/dist/graphiql-plugin-explorer.umd.js"
40-
integrity="sha512-VQtND1w103C6dmo8VAhbV2DlkFdXKtWpr2nVuYEdj2dFB0UIMYeSbpKDLAD7n+UP+b0Eg79Gn40Onju687384A=="
41-
crossorigin="anonymous"></script>
42-
<script src="https://cdn.jsdelivr.net/npm/@graphiql/[email protected]/dist/graphiql-plugin-code-exporter.umd.js"
43-
integrity="sha512-bZesuT5p2QZ6cSlpgPxI83Db5G3Bw35RTKz+Z+kc6RUu4/PtPkNddzax0VWA6VoXvIwT8s4i5nQklZ+AGJQD2Q=="
34+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.js"
35+
integrity="sha512-J1qOEDzw11Yb9g9NS8iyR/Gq92y7k3fGnIxFBvQd9VRuS0iRbDkZo6S+k0SK+3UjQotW35LP/jSXgJfu2LsjHA=="
4436
crossorigin="anonymous"></script>
4537

4638
<script>
@@ -52,76 +44,12 @@
5244
subscriptionUrl
5345
});
5446

55-
var fetchSnippet = {
56-
language: 'JavaScript',
57-
name: 'Fetch',
58-
codeMirrorMode: 'jsx',
59-
options: [],
60-
generate: (generateOptions) => {
61-
const operation = generateOptions.operationDataList[0];
62-
const context = generateOptions.context;
63-
const headers = context.headers.length !== 0 ? `headers: ${context.headers},\n ` : '';
64-
const variables = JSON.stringify(operation.variables);
65-
return `
66-
const res = await fetch("${context.serverUrl}", {
67-
method: 'POST',
68-
${headers}body: JSON.stringify({
69-
operationName: "${operation.name}",
70-
query: \`${operation.query.replaceAll("\n", "\\n")}\`,
71-
variables: ${variables}
72-
}),
73-
});
74-
75-
const { errors, data } = await res.json();
76-
77-
// Do something with the response
78-
console.log(data, errors);
79-
`;
80-
}
81-
};
82-
83-
var curlSnippet = {
84-
language: 'Bash',
85-
name: 'Curl',
86-
codeMirrorMode: 'jsx',
87-
options: [],
88-
generate: (generateOptions) => {
89-
const operation = generateOptions.operationDataList[0];
90-
const context = generateOptions.context;
91-
let headersObject;
92-
try {
93-
headersObject = JSON.parse(context.headers);
94-
} catch (e) {
95-
headersObject = {};
96-
}
97-
const headers = Object.entries(headersObject)
98-
.reduce((acc, [headerName, headerValue]) => `${acc} -H '${headerName}: ${headerValue}' \\\n`, '');
99-
const payload = JSON.stringify({
100-
operationName: operation.name,
101-
query: `${operation.query.replaceAll("\n", "\\n")}`,
102-
variables: operation.variables
103-
})
104-
return `curl '${context.serverUrl}' \\\n${headers}--data-raw $'${payload}' --compressed`;
105-
}
106-
}
107-
10847
function GraphiQLWithPlugins() {
10948
var [query, setQuery] = React.useState('');
11049
var [variables, setVariables] = React.useState('');
11150
var [headers, setHeaders] = React.useState('');
11251
var defaultHeaders = `{\n "content-type": "application/json"\n}`;
11352

114-
var explorerPlugin = GraphiQLPluginExplorer.useExplorerPlugin({
115-
query,
116-
onEdit: setQuery,
117-
});
118-
var exporterPlugin = GraphiQLPluginCodeExporter.useExporterPlugin({
119-
query,
120-
variables,
121-
context: { serverUrl, headers },
122-
snippets: [curlSnippet, fetchSnippet]
123-
});
124-
12553
return React.createElement(GraphiQL, {
12654
fetcher,
12755
query,
@@ -132,7 +60,8 @@
13260
onEditHeaders: setHeaders,
13361
defaultHeaders,
13462
defaultEditorToolsVisibility: true,
135-
plugins: [explorerPlugin, exporterPlugin]
63+
plugins: [],
64+
shouldPersistHeaders: true
13665
});
13766
}
13867

0 commit comments

Comments
 (0)