@0no-co/graphql.web 0.1.4 → 0.1.5

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.
@@ -10,6 +10,13 @@ var e = {
10
10
  INLINE_FRAGMENT: "InlineFragment",
11
11
  FRAGMENT_DEFINITION: "FragmentDefinition",
12
12
  VARIABLE: "Variable",
13
+ INT: "IntValue",
14
+ FLOAT: "FloatValue",
15
+ STRING: "StringValue",
16
+ BOOLEAN: "BooleanValue",
17
+ NULL: "NullValue",
18
+ ENUM: "EnumValue",
19
+ LIST: "ListValue",
13
20
  OBJECT: "ObjectValue",
14
21
  OBJECT_FIELD: "ObjectField",
15
22
  DIRECTIVE: "Directive",
@@ -25,12 +32,12 @@ var r = {
25
32
  };
26
33
 
27
34
  class GraphQLError extends Error {
28
- constructor(e, r, i, n, t, a, o) {
35
+ constructor(e, r, i, n, a, t, o) {
29
36
  super(e);
30
37
  this.name = "GraphQLError";
31
38
  this.message = e;
32
- if (t) {
33
- this.path = t;
39
+ if (a) {
40
+ this.path = a;
34
41
  }
35
42
  if (r) {
36
43
  this.nodes = Array.isArray(r) ? r : [ r ];
@@ -41,16 +48,17 @@ class GraphQLError extends Error {
41
48
  if (n) {
42
49
  this.positions = n;
43
50
  }
44
- if (a) {
45
- this.originalError = a;
51
+ if (t) {
52
+ this.originalError = t;
46
53
  }
47
- if (!o && a) {
48
- var l = a.extensions;
49
- if (l && "object" == typeof l) {
50
- l;
54
+ var l = o;
55
+ if (!l && t) {
56
+ var u = t.extensions;
57
+ if (u && "object" == typeof u) {
58
+ l = u;
51
59
  }
52
60
  }
53
- this.extensions = o || {};
61
+ this.extensions = l || {};
54
62
  }
55
63
  toJSON() {
56
64
  return {
@@ -80,46 +88,47 @@ function advance(e) {
80
88
  }
81
89
  }
82
90
 
83
- var t = / +(?=[^\s])/y;
91
+ var a = / +(?=[^\s])/y;
84
92
 
85
93
  function blockString(e) {
86
- var r = "";
87
- var i = 0;
94
+ var r = e.split("\n");
95
+ var i = "";
88
96
  var n = 0;
89
- var a = -1;
90
- var o = e.split("\n");
91
- for (var l = 0; l < o.length; l++) {
92
- t.lastIndex = 0;
93
- if (t.test(o[l])) {
94
- if (l && (!i || t.lastIndex < i)) {
95
- i = t.lastIndex;
97
+ var t = 0;
98
+ var o = r.length - 1;
99
+ for (var l = 0; l < r.length; l++) {
100
+ a.lastIndex = 0;
101
+ if (a.test(r[l])) {
102
+ if (l && (!n || a.lastIndex < n)) {
103
+ n = a.lastIndex;
96
104
  }
97
- n = n || l;
98
- a = l;
105
+ t = t || l;
106
+ o = l;
99
107
  }
100
108
  }
101
- for (var u = n; u <= a; u++) {
102
- if (u !== n) {
103
- r += "\n";
109
+ for (var u = t; u <= o; u++) {
110
+ if (u !== t) {
111
+ i += "\n";
104
112
  }
105
- r += o[u].slice(i).replace(/\\"""/g, '"""');
113
+ i += r[u].slice(n).replace(/\\"""/g, '"""');
106
114
  }
107
- return r;
115
+ return i;
108
116
  }
109
117
 
110
- var a = /(?:[\s,]*|#[^\n\r]*)*/y;
111
-
112
118
  function ignored() {
113
- a.lastIndex = n;
114
- a.test(i);
115
- n = a.lastIndex;
119
+ for (var e = 0 | i.charCodeAt(n++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | i.charCodeAt(n++)) {
120
+ if (35 === e) {
121
+ while (10 !== (e = i.charCodeAt(n++)) && 13 !== e) {}
122
+ }
123
+ }
124
+ n--;
116
125
  }
117
126
 
118
- var o = /[_\w][_\d\w]*/y;
127
+ var t = /[_\w][_\d\w]*/y;
119
128
 
120
129
  function name() {
121
130
  var e;
122
- if (e = advance(o)) {
131
+ if (e = advance(t)) {
123
132
  return {
124
133
  kind: "Name",
125
134
  value: e
@@ -127,63 +136,63 @@ function name() {
127
136
  }
128
137
  }
129
138
 
130
- var l = /null|true|false/y;
139
+ var o = /null|true|false/y;
131
140
 
132
- var u = /\$[_\w][_\d\w]*/y;
141
+ var l = /\$[_\w][_\d\w]*/y;
133
142
 
134
- var s = /[-]?\d+/y;
143
+ var u = /[-]?\d+/y;
135
144
 
136
- var d = /(?:[-]?\d+)?(?:\.\d+)(?:[eE][+-]?\d+)?/y;
145
+ var v = /(?:[-]?\d+)?(?:\.\d+)(?:[eE][+-]?\d+)?/y;
137
146
 
138
- var v = /\\/g;
147
+ var d = /\\/g;
139
148
 
140
- var c = /"""(?:[\s\S]+(?="""))?"""/y;
149
+ var s = /"""(?:[\s\S]+(?="""))?"""/y;
141
150
 
142
- var f = /"(?:[^"\r\n]+)?"/y;
151
+ var c = /"(?:[^"\r\n]+)?"/y;
143
152
 
144
153
  function value(e) {
145
154
  var r;
146
- var t;
147
- if (t = advance(l)) {
148
- r = "null" === t ? {
155
+ var a;
156
+ if (a = advance(o)) {
157
+ r = "null" === a ? {
149
158
  kind: "NullValue"
150
159
  } : {
151
160
  kind: "BooleanValue",
152
- value: "true" === t
161
+ value: "true" === a
153
162
  };
154
- } else if (!e && (t = advance(u))) {
163
+ } else if (!e && (a = advance(l))) {
155
164
  r = {
156
165
  kind: "Variable",
157
166
  name: {
158
167
  kind: "Name",
159
- value: t.slice(1)
168
+ value: a.slice(1)
160
169
  }
161
170
  };
162
- } else if (t = advance(d)) {
171
+ } else if (a = advance(v)) {
163
172
  r = {
164
173
  kind: "FloatValue",
165
- value: t
174
+ value: a
166
175
  };
167
- } else if (t = advance(s)) {
176
+ } else if (a = advance(u)) {
168
177
  r = {
169
178
  kind: "IntValue",
170
- value: t
179
+ value: a
171
180
  };
172
- } else if (t = advance(o)) {
181
+ } else if (a = advance(t)) {
173
182
  r = {
174
183
  kind: "EnumValue",
175
- value: t
184
+ value: a
176
185
  };
177
- } else if (t = advance(c)) {
186
+ } else if (a = advance(s)) {
178
187
  r = {
179
188
  kind: "StringValue",
180
- value: blockString(t.slice(3, -3)),
189
+ value: blockString(a.slice(3, -3)),
181
190
  block: !0
182
191
  };
183
- } else if (t = advance(f)) {
192
+ } else if (a = advance(c)) {
184
193
  r = {
185
194
  kind: "StringValue",
186
- value: v.test(t) ? JSON.parse(t) : t.slice(1, -1),
195
+ value: d.test(a) ? JSON.parse(a) : a.slice(1, -1),
187
196
  block: !1
188
197
  };
189
198
  } else if (r = function list(e) {
@@ -191,9 +200,9 @@ function value(e) {
191
200
  if (91 === i.charCodeAt(n)) {
192
201
  n++;
193
202
  ignored();
194
- var t = [];
203
+ var a = [];
195
204
  while (r = value(e)) {
196
- t.push(r);
205
+ a.push(r);
197
206
  }
198
207
  if (93 !== i.charCodeAt(n++)) {
199
208
  throw error("ListValue");
@@ -201,7 +210,7 @@ function value(e) {
201
210
  ignored();
202
211
  return {
203
212
  kind: "ListValue",
204
- values: t
213
+ values: a
205
214
  };
206
215
  }
207
216
  }(e) || function object(e) {
@@ -209,21 +218,21 @@ function value(e) {
209
218
  n++;
210
219
  ignored();
211
220
  var r = [];
212
- var t;
213
- while (t = name()) {
221
+ var a;
222
+ while (a = name()) {
214
223
  ignored();
215
224
  if (58 !== i.charCodeAt(n++)) {
216
225
  throw error("ObjectField");
217
226
  }
218
227
  ignored();
219
- var a = value(e);
220
- if (!a) {
228
+ var t = value(e);
229
+ if (!t) {
221
230
  throw error("ObjectField");
222
231
  }
223
232
  r.push({
224
233
  kind: "ObjectField",
225
- name: t,
226
- value: a
234
+ name: a,
235
+ value: t
227
236
  });
228
237
  }
229
238
  if (125 !== i.charCodeAt(n++)) {
@@ -248,21 +257,21 @@ function arguments_(e) {
248
257
  if (40 === i.charCodeAt(n)) {
249
258
  n++;
250
259
  ignored();
251
- var t;
252
- while (t = name()) {
260
+ var a;
261
+ while (a = name()) {
253
262
  ignored();
254
263
  if (58 !== i.charCodeAt(n++)) {
255
264
  throw error("Argument");
256
265
  }
257
266
  ignored();
258
- var a = value(e);
259
- if (!a) {
267
+ var t = value(e);
268
+ if (!t) {
260
269
  throw error("Argument");
261
270
  }
262
271
  r.push({
263
272
  kind: "Argument",
264
- name: t,
265
- value: a
273
+ name: a,
274
+ value: t
266
275
  });
267
276
  }
268
277
  if (!r.length || 41 !== i.charCodeAt(n++)) {
@@ -278,14 +287,14 @@ function directives(e) {
278
287
  ignored();
279
288
  while (64 === i.charCodeAt(n)) {
280
289
  n++;
281
- var t = name();
282
- if (!t) {
290
+ var a = name();
291
+ if (!a) {
283
292
  throw error("Directive");
284
293
  }
285
294
  ignored();
286
295
  r.push({
287
296
  kind: "Directive",
288
- name: t,
297
+ name: a,
289
298
  arguments: arguments_(e)
290
299
  });
291
300
  }
@@ -293,7 +302,6 @@ function directives(e) {
293
302
  }
294
303
 
295
304
  function field() {
296
- ignored();
297
305
  var e = name();
298
306
  if (e) {
299
307
  ignored();
@@ -353,10 +361,10 @@ function type() {
353
361
  }
354
362
  }
355
363
 
356
- var p = /on/y;
364
+ var f = /on/y;
357
365
 
358
366
  function typeCondition() {
359
- if (advance(p)) {
367
+ if (advance(f)) {
360
368
  ignored();
361
369
  var e = name();
362
370
  if (!e) {
@@ -370,11 +378,10 @@ function typeCondition() {
370
378
  }
371
379
  }
372
380
 
373
- var m = /\.\.\./y;
381
+ var p = /\.\.\./y;
374
382
 
375
383
  function fragmentSpread() {
376
- ignored();
377
- if (advance(m)) {
384
+ if (advance(p)) {
378
385
  ignored();
379
386
  var e = n;
380
387
  var r;
@@ -387,16 +394,16 @@ function fragmentSpread() {
387
394
  } else {
388
395
  n = e;
389
396
  var i = typeCondition();
390
- var t = directives(!1);
391
- var a = selectionSet();
392
- if (!a) {
397
+ var a = directives(!1);
398
+ var t = selectionSet();
399
+ if (!t) {
393
400
  throw error("InlineFragment");
394
401
  }
395
402
  return {
396
403
  kind: "InlineFragment",
397
404
  typeCondition: i,
398
- directives: t,
399
- selectionSet: a
405
+ directives: a,
406
+ selectionSet: t
400
407
  };
401
408
  }
402
409
  }
@@ -423,10 +430,10 @@ function selectionSet() {
423
430
  }
424
431
  }
425
432
 
426
- var g = /fragment/y;
433
+ var m = /fragment/y;
427
434
 
428
435
  function fragmentDefinition() {
429
- if (advance(g)) {
436
+ if (advance(m)) {
430
437
  ignored();
431
438
  var e = name();
432
439
  if (!e) {
@@ -452,37 +459,37 @@ function fragmentDefinition() {
452
459
  }
453
460
  }
454
461
 
455
- var h = /query|mutation|subscription/y;
462
+ var g = /query|mutation|subscription/y;
456
463
 
457
464
  function operationDefinition() {
458
465
  var e;
459
466
  var r;
460
- var t = [];
461
467
  var a = [];
462
- if (e = advance(h)) {
468
+ var t = [];
469
+ if (e = advance(g)) {
463
470
  ignored();
464
471
  r = name();
465
- t = function variableDefinitions() {
472
+ a = function variableDefinitions() {
466
473
  var e;
467
474
  var r = [];
468
475
  ignored();
469
476
  if (40 === i.charCodeAt(n)) {
470
477
  n++;
471
478
  ignored();
472
- while (e = advance(u)) {
479
+ while (e = advance(l)) {
473
480
  ignored();
474
481
  if (58 !== i.charCodeAt(n++)) {
475
482
  throw error("VariableDefinition");
476
483
  }
477
- var t = type();
478
- if (!t) {
484
+ var a = type();
485
+ if (!a) {
479
486
  throw error("VariableDefinition");
480
487
  }
481
- var a = void 0;
488
+ var t = void 0;
482
489
  if (61 === i.charCodeAt(n)) {
483
490
  n++;
484
491
  ignored();
485
- if (!(a = value(!0))) {
492
+ if (!(t = value(!0))) {
486
493
  throw error("VariableDefinition");
487
494
  }
488
495
  }
@@ -496,8 +503,8 @@ function operationDefinition() {
496
503
  value: e.slice(1)
497
504
  }
498
505
  },
499
- type: t,
500
- defaultValue: a,
506
+ type: a,
507
+ defaultValue: t,
501
508
  directives: directives(!0)
502
509
  });
503
510
  }
@@ -508,7 +515,7 @@ function operationDefinition() {
508
515
  }
509
516
  return r;
510
517
  }();
511
- a = directives(!1);
518
+ t = directives(!1);
512
519
  }
513
520
  var o = selectionSet();
514
521
  if (o) {
@@ -516,8 +523,8 @@ function operationDefinition() {
516
523
  kind: "OperationDefinition",
517
524
  operation: e || "query",
518
525
  name: r,
519
- variableDefinitions: t,
520
- directives: a,
526
+ variableDefinitions: a,
527
+ directives: t,
521
528
  selectionSet: o
522
529
  };
523
530
  }
@@ -547,91 +554,91 @@ function parseValue(e, r) {
547
554
  i = "string" == typeof e.body ? e.body : e;
548
555
  n = 0;
549
556
  ignored();
550
- var t = value(!1);
551
- if (!t) {
557
+ var a = value(!1);
558
+ if (!a) {
552
559
  throw error("ValueNode");
553
560
  }
554
- return t;
561
+ return a;
555
562
  }
556
563
 
557
564
  function parseType(e, r) {
558
565
  i = "string" == typeof e.body ? e.body : e;
559
566
  n = 0;
560
- var t = type();
561
- if (!t) {
567
+ var a = type();
568
+ if (!a) {
562
569
  throw error("TypeNode");
563
570
  }
564
- return t;
571
+ return a;
565
572
  }
566
573
 
567
- var y = {};
574
+ var h = {};
568
575
 
569
576
  function visit(e, r) {
570
577
  var i = [];
571
578
  var n = [];
572
579
  try {
573
- var t = function traverse(e, t, a) {
580
+ var a = function traverse(e, a, t) {
574
581
  var o = !1;
575
- var l = r[e.kind] && r[e.kind].enter || r[e.kind];
576
- var u = l && l.call(r, e, t, a, n, i);
582
+ var l = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter;
583
+ var u = l && l.call(r, e, a, t, n, i);
577
584
  if (!1 === u) {
578
585
  return e;
579
586
  } else if (null === u) {
580
587
  return null;
581
- } else if (u === y) {
582
- throw y;
588
+ } else if (u === h) {
589
+ throw h;
583
590
  } else if (u && "string" == typeof u.kind) {
584
591
  o = u !== e;
585
592
  e = u;
586
593
  }
587
- if (a) {
588
- i.push(a);
594
+ if (t) {
595
+ i.push(t);
589
596
  }
590
- var s;
597
+ var v;
591
598
  var d = {
592
599
  ...e
593
600
  };
594
- for (var v in e) {
595
- n.push(v);
596
- var c = e[v];
601
+ for (var s in e) {
602
+ n.push(s);
603
+ var c = e[s];
597
604
  if (Array.isArray(c)) {
598
605
  var f = [];
599
606
  for (var p = 0; p < c.length; p++) {
600
607
  if (null != c[p] && "string" == typeof c[p].kind) {
601
608
  i.push(e);
602
609
  n.push(p);
603
- s = traverse(c[p], p, c);
610
+ v = traverse(c[p], p, c);
604
611
  n.pop();
605
612
  i.pop();
606
- if (void 0 === s) {
613
+ if (void 0 === v) {
607
614
  f.push(c[p]);
608
- } else if (null === s) {
615
+ } else if (null === v) {
609
616
  o = !0;
610
617
  } else {
611
- o = o || s !== c[p];
612
- f.push(s);
618
+ o = o || v !== c[p];
619
+ f.push(v);
613
620
  }
614
621
  }
615
622
  }
616
623
  c = f;
617
624
  } else if (null != c && "string" == typeof c.kind) {
618
- if (void 0 !== (s = traverse(c, v, e))) {
619
- o = o || c !== s;
620
- c = s;
625
+ if (void 0 !== (v = traverse(c, s, e))) {
626
+ o = o || c !== v;
627
+ c = v;
621
628
  }
622
629
  }
623
630
  n.pop();
624
631
  if (o) {
625
- d[v] = c;
632
+ d[s] = c;
626
633
  }
627
634
  }
628
- if (a) {
635
+ if (t) {
629
636
  i.pop();
630
637
  }
631
- var m = r[e.kind] && r[e.kind].leave;
632
- var g = m && m.call(r, e, t, a, n, i);
633
- if (g === y) {
634
- throw y;
638
+ var m = r[e.kind] && r[e.kind].leave || r.leave;
639
+ var g = m && m.call(r, e, a, t, n, i);
640
+ if (g === h) {
641
+ throw h;
635
642
  } else if (void 0 !== g) {
636
643
  return g;
637
644
  } else if (void 0 !== u) {
@@ -640,9 +647,9 @@ function visit(e, r) {
640
647
  return o ? d : e;
641
648
  }
642
649
  }(e);
643
- return void 0 !== t && !1 !== t ? t : e;
650
+ return void 0 !== a && !1 !== a ? a : e;
644
651
  } catch (r) {
645
- if (r !== y) {
652
+ if (r !== h) {
646
653
  throw r;
647
654
  }
648
655
  return e;
@@ -659,16 +666,12 @@ function printBlockString(e) {
659
666
 
660
667
  var hasItems = e => !(!e || !e.length);
661
668
 
662
- var S = 80;
663
-
664
- function print(e) {
665
- var r;
666
- switch (e.kind) {
667
- case "OperationDefinition":
669
+ var y = {
670
+ OperationDefinition(e) {
668
671
  if ("query" === e.operation && !e.name && !hasItems(e.variableDefinitions) && !hasItems(e.directives)) {
669
- return print(e.selectionSet);
672
+ return y.SelectionSet(e.selectionSet);
670
673
  }
671
- r = e.operation;
674
+ var r = e.operation;
672
675
  if (e.name) {
673
676
  r += " " + e.name.value;
674
677
  }
@@ -676,113 +679,88 @@ function print(e) {
676
679
  if (!e.name) {
677
680
  r += " ";
678
681
  }
679
- r += "(" + e.variableDefinitions.map(print).join(", ") + ")";
682
+ r += "(" + e.variableDefinitions.map(y.VariableDefinition).join(", ") + ")";
680
683
  }
681
684
  if (hasItems(e.directives)) {
682
- r += " " + e.directives.map(print).join(" ");
685
+ r += " " + e.directives.map(y.Directive).join(" ");
683
686
  }
684
- return r + " " + print(e.selectionSet);
685
-
686
- case "VariableDefinition":
687
- r = print(e.variable) + ": " + print(e.type);
687
+ return r + " " + y.SelectionSet(e.selectionSet);
688
+ },
689
+ VariableDefinition(e) {
690
+ var r = y.Variable(e.variable) + ": " + print(e.type);
688
691
  if (e.defaultValue) {
689
692
  r += " = " + print(e.defaultValue);
690
693
  }
691
694
  if (hasItems(e.directives)) {
692
- r += " " + e.directives.map(print).join(" ");
695
+ r += " " + e.directives.map(y.Directive).join(" ");
693
696
  }
694
697
  return r;
695
-
696
- case "Field":
697
- r = (e.alias ? print(e.alias) + ": " : "") + e.name.value;
698
+ },
699
+ Field(e) {
700
+ var r = (e.alias ? e.alias.value + ": " : "") + e.name.value;
698
701
  if (hasItems(e.arguments)) {
699
- var i = e.arguments.map(print);
702
+ var i = e.arguments.map(y.Argument);
700
703
  var n = r + "(" + i.join(", ") + ")";
701
- r = n.length > S ? r + "(\n " + i.join("\n").replace(/\n/g, "\n ") + "\n)" : n;
704
+ r = n.length > 80 ? r + "(\n " + i.join("\n").replace(/\n/g, "\n ") + "\n)" : n;
702
705
  }
703
706
  if (hasItems(e.directives)) {
704
- r += " " + e.directives.map(print).join(" ");
705
- }
706
- return e.selectionSet ? r + " " + print(e.selectionSet) : r;
707
-
708
- case "StringValue":
709
- return e.block ? printBlockString(e.value) : printString(e.value);
710
-
711
- case "BooleanValue":
712
- return "" + e.value;
713
-
714
- case "NullValue":
715
- return "null";
716
-
717
- case "IntValue":
718
- case "FloatValue":
719
- case "EnumValue":
720
- case "Name":
721
- return e.value;
722
-
723
- case "ListValue":
724
- return "[" + e.values.map(print).join(", ") + "]";
725
-
726
- case "ObjectValue":
727
- return "{" + e.fields.map(print).join(", ") + "}";
728
-
729
- case "ObjectField":
730
- case "Argument":
731
- return e.name.value + ": " + print(e.value);
732
-
733
- case "Variable":
734
- return "$" + e.name.value;
735
-
736
- case "Document":
737
- return hasItems(e.definitions) ? e.definitions.map(print).join("\n\n") : "";
738
-
739
- case "SelectionSet":
740
- return "{\n " + e.selections.map(print).join("\n").replace(/\n/g, "\n ") + "\n}";
741
-
742
- case "FragmentSpread":
743
- r = "..." + e.name.value;
707
+ r += " " + e.directives.map(y.Directive).join(" ");
708
+ }
709
+ return e.selectionSet ? r + " " + y.SelectionSet(e.selectionSet) : r;
710
+ },
711
+ StringValue: e => e.block ? printBlockString(e.value) : printString(e.value),
712
+ BooleanValue: e => "" + e.value,
713
+ NullValue: e => "null",
714
+ IntValue: e => e.value,
715
+ FloatValue: e => e.value,
716
+ EnumValue: e => e.value,
717
+ Name: e => e.value,
718
+ Variable: e => "$" + e.name.value,
719
+ ListValue: e => "[" + e.values.map(print).join(", ") + "]",
720
+ ObjectValue: e => "{" + e.fields.map(y.ObjectField).join(", ") + "}",
721
+ ObjectField: e => e.name.value + ": " + print(e.value),
722
+ Document: e => hasItems(e.definitions) ? e.definitions.map(print).join("\n\n") : "",
723
+ SelectionSet: e => "{\n " + e.selections.map(print).join("\n").replace(/\n/g, "\n ") + "\n}",
724
+ Argument: e => e.name.value + ": " + print(e.value),
725
+ FragmentSpread(e) {
726
+ var r = "..." + e.name.value;
744
727
  if (hasItems(e.directives)) {
745
- r += " " + e.directives.map(print).join(" ");
728
+ r += " " + e.directives.map(y.Directive).join(" ");
746
729
  }
747
730
  return r;
748
-
749
- case "InlineFragment":
750
- r = "...";
731
+ },
732
+ InlineFragment(e) {
733
+ var r = "...";
751
734
  if (e.typeCondition) {
752
735
  r += " on " + e.typeCondition.name.value;
753
736
  }
754
737
  if (hasItems(e.directives)) {
755
- r += " " + e.directives.map(print).join(" ");
738
+ r += " " + e.directives.map(y.Directive).join(" ");
756
739
  }
757
740
  return r + " " + print(e.selectionSet);
758
-
759
- case "FragmentDefinition":
760
- r = "fragment " + e.name.value;
741
+ },
742
+ FragmentDefinition(e) {
743
+ var r = "fragment " + e.name.value;
761
744
  r += " on " + e.typeCondition.name.value;
762
745
  if (hasItems(e.directives)) {
763
- r += " " + e.directives.map(print).join(" ");
746
+ r += " " + e.directives.map(y.Directive).join(" ");
764
747
  }
765
748
  return r + " " + print(e.selectionSet);
766
-
767
- case "Directive":
768
- r = "@" + e.name.value;
749
+ },
750
+ Directive(e) {
751
+ var r = "@" + e.name.value;
769
752
  if (hasItems(e.arguments)) {
770
- r += "(" + e.arguments.map(print).join(", ") + ")";
753
+ r += "(" + e.arguments.map(y.Argument).join(", ") + ")";
771
754
  }
772
755
  return r;
756
+ },
757
+ NamedType: e => e.name.value,
758
+ ListType: e => "[" + print(e.type) + "]",
759
+ NonNullType: e => print(e.type) + "!"
760
+ };
773
761
 
774
- case "NamedType":
775
- return e.name.value;
776
-
777
- case "ListType":
778
- return "[" + print(e.type) + "]";
779
-
780
- case "NonNullType":
781
- return print(e.type) + "!";
782
-
783
- default:
784
- return "";
785
- }
762
+ function print(e) {
763
+ return y[e.kind] ? y[e.kind](e) : "";
786
764
  }
787
765
 
788
766
  function valueFromASTUntyped(e, r) {
@@ -803,18 +781,18 @@ function valueFromASTUntyped(e, r) {
803
781
 
804
782
  case "ListValue":
805
783
  var i = [];
806
- for (var n = 0, t = e.values; n < t.length; n += 1) {
807
- i.push(valueFromASTUntyped(t[n], r));
784
+ for (var n = 0, a = e.values; n < a.length; n += 1) {
785
+ i.push(valueFromASTUntyped(a[n], r));
808
786
  }
809
787
  return i;
810
788
 
811
789
  case "ObjectValue":
812
- var a = Object.create(null);
790
+ var t = Object.create(null);
813
791
  for (var o = 0, l = e.fields; o < l.length; o += 1) {
814
792
  var u = l[o];
815
- a[u.name.value] = valueFromASTUntyped(u.value, r);
793
+ t[u.name.value] = valueFromASTUntyped(u.value, r);
816
794
  }
817
- return a;
795
+ return t;
818
796
 
819
797
  case "Variable":
820
798
  return r && r[e.name.value];
@@ -831,8 +809,8 @@ function valueFromTypeNode(e, r, i) {
831
809
  } else if ("ListType" === r.kind) {
832
810
  if ("ListValue" === e.kind) {
833
811
  var n = [];
834
- for (var t = 0, a = e.values; t < a.length; t += 1) {
835
- var o = valueFromTypeNode(a[t], r.type, i);
812
+ for (var a = 0, t = e.values; a < t.length; a += 1) {
813
+ var o = valueFromTypeNode(t[a], r.type, i);
836
814
  if (void 0 === o) {
837
815
  return;
838
816
  } else {
@@ -855,5 +833,5 @@ function valueFromTypeNode(e, r, i) {
855
833
  }
856
834
  }
857
835
 
858
- export { y as BREAK, GraphQLError, e as Kind, r as OperationTypeNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
836
+ export { h as BREAK, GraphQLError, e as Kind, r as OperationTypeNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
859
837
  //# sourceMappingURL=graphql.web.mjs.map