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

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