UNPKG

1.09 kBJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 * @format
9 */
10'use strict';
11
12var NodeKeys = {
13 Argument: ['value'],
14 Condition: ['condition', 'selections'],
15 Defer: ['selections', 'if'],
16 Directive: ['args'],
17 Fragment: ['argumentDefinitions', 'directives', 'selections'],
18 FragmentSpread: ['args', 'directives'],
19 InlineFragment: ['directives', 'selections'],
20 LinkedField: ['args', 'directives', 'selections'],
21 Literal: [],
22 LocalArgumentDefinition: [],
23 MatchField: ['args', 'directives', 'selections'],
24 MatchBranch: ['selections'],
25 Request: ['fragment', 'root'],
26 Root: ['argumentDefinitions', 'directives', 'selections'],
27 RootArgumentDefinition: [],
28 ScalarField: ['args', 'directives'],
29 SplitOperation: ['selections'],
30 Stream: ['selections', 'if', 'initialCount'],
31 Variable: []
32};
33
34function visitIR(root, visitor) {
35 return require("graphql").visit(root, visitor, NodeKeys);
36}
37
38module.exports = {
39 visit: visitIR
40};
\No newline at end of file