1 | import { __assign } from "tslib";
|
2 | import { visit } from "graphql";
|
3 | export function filterOperationVariables(variables, query) {
|
4 | var result = __assign({}, variables);
|
5 | var unusedNames = new Set(Object.keys(variables));
|
6 | visit(query, {
|
7 | Variable: function (node, _key, parent) {
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | if (parent &&
|
13 | parent.kind !== "VariableDefinition") {
|
14 | unusedNames.delete(node.name.value);
|
15 | }
|
16 | },
|
17 | });
|
18 | unusedNames.forEach(function (name) {
|
19 | delete result[name];
|
20 | });
|
21 | return result;
|
22 | }
|
23 |
|
\ | No newline at end of file |