@0no-co/graphql.web 0.1.1 → 0.1.3

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.
@@ -36,7 +36,7 @@ var r;
36
36
  }(r || (r = {}));
37
37
 
38
38
  class GraphQLError extends Error {
39
- constructor(e, r, i, n, t, a, o) {
39
+ constructor(e, r, n, i, t, a, o) {
40
40
  super(e);
41
41
  this.name = "GraphQLError";
42
42
  this.message = e;
@@ -46,19 +46,19 @@ class GraphQLError extends Error {
46
46
  if (r) {
47
47
  this.nodes = Array.isArray(r) ? r : [ r ];
48
48
  }
49
- if (i) {
50
- this.source = i;
51
- }
52
49
  if (n) {
53
- this.positions = n;
50
+ this.source = n;
51
+ }
52
+ if (i) {
53
+ this.positions = i;
54
54
  }
55
55
  if (a) {
56
56
  this.originalError = a;
57
57
  }
58
58
  if (!o && a) {
59
- var s = a.extensions;
60
- if (s && "object" == typeof s) {
61
- s;
59
+ var u = a.extensions;
60
+ if (u && "object" == typeof u) {
61
+ u;
62
62
  }
63
63
  }
64
64
  this.extensions = o || {};
@@ -73,18 +73,18 @@ class GraphQLError extends Error {
73
73
  }
74
74
  }
75
75
 
76
- var i;
77
-
78
76
  var n;
79
77
 
78
+ var i;
79
+
80
80
  function error(e) {
81
- return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e}`);
81
+ return new GraphQLError(`Syntax Error: Unexpected token at ${i} in ${e}`);
82
82
  }
83
83
 
84
84
  function advance(e) {
85
- e.lastIndex = n;
86
- if (e.test(i)) {
87
- return i.slice(n, n = e.lastIndex);
85
+ e.lastIndex = i;
86
+ if (e.test(n)) {
87
+ return n.slice(i, i = e.lastIndex);
88
88
  }
89
89
  }
90
90
 
@@ -92,25 +92,25 @@ var t = / +(?=[^\s])/y;
92
92
 
93
93
  function blockString(e) {
94
94
  var r = "";
95
- var i = 0;
96
95
  var n = 0;
96
+ var i = 0;
97
97
  var a = -1;
98
98
  var o = e.split("\n");
99
- for (var s = 0; s < o.length; s++) {
99
+ for (var u = 0; u < o.length; u++) {
100
100
  t.lastIndex = 0;
101
- if (t.test(o[s])) {
102
- if (s && (!i || t.lastIndex < i)) {
103
- i = t.lastIndex;
101
+ if (t.test(o[u])) {
102
+ if (u && (!n || t.lastIndex < n)) {
103
+ n = t.lastIndex;
104
104
  }
105
- n = n || s;
106
- a = s;
105
+ i = i || u;
106
+ a = u;
107
107
  }
108
108
  }
109
- for (var d = n; d <= a; d++) {
110
- if (d !== n) {
109
+ for (var s = i; s <= a; s++) {
110
+ if (s !== i) {
111
111
  r += "\n";
112
112
  }
113
- r += o[d].slice(i);
113
+ r += o[s].slice(n).replace(/\\"""/g, '"""');
114
114
  }
115
115
  return r;
116
116
  }
@@ -118,9 +118,9 @@ function blockString(e) {
118
118
  var a = /(?:[\s,]*|#[^\n\r]*)*/y;
119
119
 
120
120
  function ignored() {
121
- a.lastIndex = n;
122
- a.test(i);
123
- n = a.lastIndex;
121
+ a.lastIndex = i;
122
+ a.test(n);
123
+ i = a.lastIndex;
124
124
  }
125
125
 
126
126
  var o = /[_\w][_\d\w]*/y;
@@ -135,15 +135,15 @@ function name() {
135
135
  }
136
136
  }
137
137
 
138
- var s = /null/y;
138
+ var u = /null/y;
139
139
 
140
- var d = /true|false/y;
140
+ var s = /true|false/y;
141
141
 
142
- var u = /\$[_\w][_\d\w]*/y;
142
+ var l = /\$[_\w][_\d\w]*/y;
143
143
 
144
144
  var v = /[-]?\d+/y;
145
145
 
146
- var l = /[-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
146
+ var d = /(?:[-]?\d+)?(?:\.\d+)(?:[eE][+-]?\d+)?/y;
147
147
 
148
148
  var c = /\\/g;
149
149
 
@@ -154,16 +154,16 @@ var E = /"(?:[^"\r\n]+)?"/y;
154
154
  function value(e) {
155
155
  var t;
156
156
  var a;
157
- if (advance(s)) {
157
+ if (advance(u)) {
158
158
  t = {
159
159
  kind: r.NULL
160
160
  };
161
- } else if (a = advance(d)) {
161
+ } else if (a = advance(s)) {
162
162
  t = {
163
163
  kind: r.BOOLEAN,
164
164
  value: "true" === a
165
165
  };
166
- } else if (!e && (a = advance(u))) {
166
+ } else if (!e && (a = advance(l))) {
167
167
  t = {
168
168
  kind: r.VARIABLE,
169
169
  name: {
@@ -171,7 +171,7 @@ function value(e) {
171
171
  value: a.slice(1)
172
172
  }
173
173
  };
174
- } else if (a = advance(l)) {
174
+ } else if (a = advance(d)) {
175
175
  t = {
176
176
  kind: r.FLOAT,
177
177
  value: a
@@ -200,14 +200,14 @@ function value(e) {
200
200
  };
201
201
  } else if (t = function list(e) {
202
202
  var t;
203
- if (91 === i.charCodeAt(n)) {
204
- n++;
203
+ if (91 === n.charCodeAt(i)) {
204
+ i++;
205
205
  ignored();
206
206
  var a = [];
207
207
  while (t = value(e)) {
208
208
  a.push(t);
209
209
  }
210
- if (93 !== i.charCodeAt(n++)) {
210
+ if (93 !== n.charCodeAt(i++)) {
211
211
  throw error(r.LIST);
212
212
  }
213
213
  ignored();
@@ -217,14 +217,14 @@ function value(e) {
217
217
  };
218
218
  }
219
219
  }(e) || function object(e) {
220
- if (123 === i.charCodeAt(n)) {
221
- n++;
220
+ if (123 === n.charCodeAt(i)) {
221
+ i++;
222
222
  ignored();
223
223
  var t = [];
224
224
  var a;
225
225
  while (a = name()) {
226
226
  ignored();
227
- if (58 !== i.charCodeAt(n++)) {
227
+ if (58 !== n.charCodeAt(i++)) {
228
228
  throw error(r.OBJECT_FIELD);
229
229
  }
230
230
  ignored();
@@ -238,7 +238,7 @@ function value(e) {
238
238
  value: o
239
239
  });
240
240
  }
241
- if (125 !== i.charCodeAt(n++)) {
241
+ if (125 !== n.charCodeAt(i++)) {
242
242
  throw error(r.OBJECT);
243
243
  }
244
244
  ignored();
@@ -257,13 +257,13 @@ function value(e) {
257
257
  function arguments_(e) {
258
258
  var t = [];
259
259
  ignored();
260
- if (40 === i.charCodeAt(n)) {
261
- n++;
260
+ if (40 === n.charCodeAt(i)) {
261
+ i++;
262
262
  ignored();
263
263
  var a;
264
264
  while (a = name()) {
265
265
  ignored();
266
- if (58 !== i.charCodeAt(n++)) {
266
+ if (58 !== n.charCodeAt(i++)) {
267
267
  throw error(r.ARGUMENT);
268
268
  }
269
269
  ignored();
@@ -277,7 +277,7 @@ function arguments_(e) {
277
277
  value: o
278
278
  });
279
279
  }
280
- if (!t.length || 41 !== i.charCodeAt(n++)) {
280
+ if (!t.length || 41 !== n.charCodeAt(i++)) {
281
281
  throw error(r.ARGUMENT);
282
282
  }
283
283
  ignored();
@@ -288,8 +288,8 @@ function arguments_(e) {
288
288
  function directives(e) {
289
289
  var t = [];
290
290
  ignored();
291
- while (64 === i.charCodeAt(n)) {
292
- n++;
291
+ while (64 === n.charCodeAt(i)) {
292
+ i++;
293
293
  var a = name();
294
294
  if (!a) {
295
295
  throw error(r.DIRECTIVE);
@@ -310,8 +310,8 @@ function field() {
310
310
  if (e) {
311
311
  ignored();
312
312
  var t;
313
- if (58 === i.charCodeAt(n)) {
314
- n++;
313
+ if (58 === n.charCodeAt(i)) {
314
+ i++;
315
315
  ignored();
316
316
  t = e;
317
317
  if (!(e = name())) {
@@ -333,11 +333,11 @@ function field() {
333
333
  function type() {
334
334
  var e;
335
335
  ignored();
336
- if (91 === i.charCodeAt(n)) {
337
- n++;
336
+ if (91 === n.charCodeAt(i)) {
337
+ i++;
338
338
  ignored();
339
339
  var t = type();
340
- if (!t || 93 !== i.charCodeAt(n++)) {
340
+ if (!t || 93 !== n.charCodeAt(i++)) {
341
341
  throw error(r.LIST_TYPE);
342
342
  }
343
343
  e = {
@@ -353,8 +353,8 @@ function type() {
353
353
  throw error(r.NAMED_TYPE);
354
354
  }
355
355
  ignored();
356
- if (33 === i.charCodeAt(n)) {
357
- n++;
356
+ if (33 === n.charCodeAt(i)) {
357
+ i++;
358
358
  ignored();
359
359
  return {
360
360
  kind: r.NON_NULL_TYPE,
@@ -382,31 +382,33 @@ function typeCondition() {
382
382
  }
383
383
  }
384
384
 
385
- var I = /\.\.\./y;
385
+ var N = /\.\.\./y;
386
386
 
387
387
  function fragmentSpread() {
388
388
  ignored();
389
- if (advance(I)) {
389
+ if (advance(N)) {
390
390
  ignored();
391
- var e;
392
- if (e = name()) {
391
+ var e = i;
392
+ var n;
393
+ if ((n = name()) && "on" !== n.value) {
393
394
  return {
394
395
  kind: r.FRAGMENT_SPREAD,
395
- name: e,
396
+ name: n,
396
397
  directives: directives(!1)
397
398
  };
398
399
  } else {
399
- var i = typeCondition();
400
- var n = directives(!1);
401
- var t = selectionSet();
402
- if (!t) {
400
+ i = e;
401
+ var t = typeCondition();
402
+ var a = directives(!1);
403
+ var o = selectionSet();
404
+ if (!o) {
403
405
  throw error(r.INLINE_FRAGMENT);
404
406
  }
405
407
  return {
406
408
  kind: r.INLINE_FRAGMENT,
407
- typeCondition: i,
408
- directives: n,
409
- selectionSet: t
409
+ typeCondition: t,
410
+ directives: a,
411
+ selectionSet: o
410
412
  };
411
413
  }
412
414
  }
@@ -415,14 +417,14 @@ function fragmentSpread() {
415
417
  function selectionSet() {
416
418
  var e;
417
419
  ignored();
418
- if (123 === i.charCodeAt(n)) {
419
- n++;
420
+ if (123 === n.charCodeAt(i)) {
421
+ i++;
420
422
  ignored();
421
423
  var t = [];
422
424
  while (e = fragmentSpread() || field()) {
423
425
  t.push(e);
424
426
  }
425
- if (!t.length || 125 !== i.charCodeAt(n++)) {
427
+ if (!t.length || 125 !== n.charCodeAt(i++)) {
426
428
  throw error(r.SELECTION_SET);
427
429
  }
428
430
  ignored();
@@ -433,21 +435,21 @@ function selectionSet() {
433
435
  }
434
436
  }
435
437
 
436
- var N = /fragment/y;
438
+ var I = /fragment/y;
437
439
 
438
440
  function fragmentDefinition() {
439
- if (advance(N)) {
441
+ if (advance(I)) {
440
442
  ignored();
441
443
  var e = name();
442
444
  if (!e) {
443
445
  throw error(r.FRAGMENT_DEFINITION);
444
446
  }
445
447
  ignored();
446
- var i = typeCondition();
447
- if (!i) {
448
+ var n = typeCondition();
449
+ if (!n) {
448
450
  throw error(r.FRAGMENT_DEFINITION);
449
451
  }
450
- var n = directives(!1);
452
+ var i = directives(!1);
451
453
  var t = selectionSet();
452
454
  if (!t) {
453
455
  throw error(r.FRAGMENT_DEFINITION);
@@ -455,8 +457,8 @@ function fragmentDefinition() {
455
457
  return {
456
458
  kind: r.FRAGMENT_DEFINITION,
457
459
  name: e,
458
- typeCondition: i,
459
- directives: n,
460
+ typeCondition: n,
461
+ directives: i,
460
462
  selectionSet: t
461
463
  };
462
464
  }
@@ -476,12 +478,12 @@ function operationDefinition() {
476
478
  var e;
477
479
  var t = [];
478
480
  ignored();
479
- if (40 === i.charCodeAt(n)) {
480
- n++;
481
+ if (40 === n.charCodeAt(i)) {
482
+ i++;
481
483
  ignored();
482
- while (e = advance(u)) {
484
+ while (e = advance(l)) {
483
485
  ignored();
484
- if (58 !== i.charCodeAt(n++)) {
486
+ if (58 !== n.charCodeAt(i++)) {
485
487
  throw error(r.VARIABLE_DEFINITION);
486
488
  }
487
489
  var a = type();
@@ -489,8 +491,8 @@ function operationDefinition() {
489
491
  throw error(r.VARIABLE_DEFINITION);
490
492
  }
491
493
  var o = void 0;
492
- if (61 === i.charCodeAt(n)) {
493
- n++;
494
+ if (61 === n.charCodeAt(i)) {
495
+ i++;
494
496
  ignored();
495
497
  if (!(o = value(!0))) {
496
498
  throw error(r.VARIABLE_DEFINITION);
@@ -511,7 +513,7 @@ function operationDefinition() {
511
513
  directives: directives(!0)
512
514
  });
513
515
  }
514
- if (41 !== i.charCodeAt(n++)) {
516
+ if (41 !== n.charCodeAt(i++)) {
515
517
  throw error(r.VARIABLE_DEFINITION);
516
518
  }
517
519
  ignored();
@@ -520,22 +522,22 @@ function operationDefinition() {
520
522
  }();
521
523
  o = directives(!1);
522
524
  }
523
- var s = selectionSet();
524
- if (s) {
525
+ var u = selectionSet();
526
+ if (u) {
525
527
  return {
526
528
  kind: r.OPERATION_DEFINITION,
527
529
  operation: e || "query",
528
530
  name: t,
529
531
  variableDefinitions: a,
530
532
  directives: o,
531
- selectionSet: s
533
+ selectionSet: u
532
534
  };
533
535
  }
534
536
  }
535
537
 
536
538
  function parse(e) {
537
- i = e;
538
- n = 0;
539
+ n = e;
540
+ i = 0;
539
541
  return function document() {
540
542
  var e;
541
543
  ignored();
@@ -543,7 +545,7 @@ function parse(e) {
543
545
  while (e = fragmentDefinition() || operationDefinition()) {
544
546
  t.push(e);
545
547
  }
546
- if (n !== i.length) {
548
+ if (i !== n.length) {
547
549
  throw error(r.DOCUMENT);
548
550
  }
549
551
  return {
@@ -554,90 +556,90 @@ function parse(e) {
554
556
  }
555
557
 
556
558
  function parseValue(e) {
557
- i = e;
558
- n = 0;
559
+ n = e;
560
+ i = 0;
559
561
  ignored();
560
562
  return value(!1);
561
563
  }
562
564
 
563
565
  function parseType(e) {
564
- i = e;
565
- n = 0;
566
+ n = e;
567
+ i = 0;
566
568
  return type();
567
569
  }
568
570
 
569
571
  var A = {};
570
572
 
571
573
  function visit(e, r) {
572
- var i = [];
573
574
  var n = [];
575
+ var i = [];
574
576
  try {
575
577
  var t = function traverse(e, t, a) {
576
578
  var o = !1;
577
- var s = r[e.kind] && r[e.kind].enter || r[e.kind];
578
- var d = s && s.call(r, e, t, a, n, i);
579
- if (!1 === d) {
579
+ var u = r[e.kind] && r[e.kind].enter || r[e.kind];
580
+ var s = u && u.call(r, e, t, a, i, n);
581
+ if (!1 === s) {
580
582
  return e;
581
- } else if (null === d) {
583
+ } else if (null === s) {
582
584
  return null;
583
- } else if (d === A) {
585
+ } else if (s === A) {
584
586
  throw A;
585
- } else if (d && "string" == typeof d.kind) {
586
- o = d !== e;
587
- e = d;
587
+ } else if (s && "string" == typeof s.kind) {
588
+ o = s !== e;
589
+ e = s;
588
590
  }
589
591
  if (a) {
590
- i.push(a);
592
+ n.push(a);
591
593
  }
592
- var u;
594
+ var l;
593
595
  var v = {
594
596
  ...e
595
597
  };
596
- for (var l in e) {
597
- n.push(l);
598
- var c = e[l];
598
+ for (var d in e) {
599
+ i.push(d);
600
+ var c = e[d];
599
601
  if (Array.isArray(c)) {
600
602
  var f = [];
601
603
  for (var E = 0; E < c.length; E++) {
602
604
  if (null != c[E] && "string" == typeof c[E].kind) {
603
- i.push(e);
604
- n.push(E);
605
- u = traverse(c[E], E, c);
606
- n.pop();
605
+ n.push(e);
606
+ i.push(E);
607
+ l = traverse(c[E], E, c);
607
608
  i.pop();
608
- if (void 0 === u) {
609
+ n.pop();
610
+ if (void 0 === l) {
609
611
  f.push(c[E]);
610
- } else if (null === u) {
612
+ } else if (null === l) {
611
613
  o = !0;
612
614
  } else {
613
- o = o || u !== c[E];
614
- f.push(u);
615
+ o = o || l !== c[E];
616
+ f.push(l);
615
617
  }
616
618
  }
617
619
  }
618
620
  c = f;
619
621
  } else if (null != c && "string" == typeof c.kind) {
620
- if (void 0 !== (u = traverse(c, l, e))) {
621
- o = o || c !== u;
622
- c = u;
622
+ if (void 0 !== (l = traverse(c, d, e))) {
623
+ o = o || c !== l;
624
+ c = l;
623
625
  }
624
626
  }
625
- n.pop();
627
+ i.pop();
626
628
  if (o) {
627
- v[l] = c;
629
+ v[d] = c;
628
630
  }
629
631
  }
630
632
  if (a) {
631
- i.pop();
633
+ n.pop();
632
634
  }
633
635
  var p = r[e.kind] && r[e.kind].leave;
634
- var I = p && p.call(r, e, t, a, n, i);
635
- if (I === A) {
636
+ var N = p && p.call(r, e, t, a, i, n);
637
+ if (N === A) {
636
638
  throw A;
637
- } else if (void 0 !== I) {
638
- return I;
639
- } else if (void 0 !== d) {
640
- return o ? v : d;
639
+ } else if (void 0 !== N) {
640
+ return N;
641
+ } else if (void 0 !== s) {
642
+ return o ? v : s;
641
643
  } else {
642
644
  return o ? v : e;
643
645
  }
@@ -661,47 +663,51 @@ function printBlockString(e) {
661
663
 
662
664
  var hasItems = e => !(!e || !e.length);
663
665
 
666
+ var h = 80;
667
+
664
668
  function print(e) {
665
- var i;
669
+ var n;
666
670
  switch (e.kind) {
667
671
  case r.OPERATION_DEFINITION:
668
672
  if ("query" === e.operation && !e.name && !hasItems(e.variableDefinitions) && !hasItems(e.directives)) {
669
673
  return print(e.selectionSet);
670
674
  }
671
- i = e.operation;
675
+ n = e.operation;
672
676
  if (e.name) {
673
- i += " " + e.name.value;
677
+ n += " " + e.name.value;
674
678
  }
675
679
  if (hasItems(e.variableDefinitions)) {
676
680
  if (!e.name) {
677
- i += " ";
681
+ n += " ";
678
682
  }
679
- i += "(" + e.variableDefinitions.map(print).join(", ") + ")";
683
+ n += "(" + e.variableDefinitions.map(print).join(", ") + ")";
680
684
  }
681
685
  if (hasItems(e.directives)) {
682
- i += " " + e.directives.map(print).join(" ");
686
+ n += " " + e.directives.map(print).join(" ");
683
687
  }
684
- return i + " " + print(e.selectionSet);
688
+ return n + " " + print(e.selectionSet);
685
689
 
686
690
  case r.VARIABLE_DEFINITION:
687
- i = print(e.variable) + ": " + print(e.type);
691
+ n = print(e.variable) + ": " + print(e.type);
688
692
  if (e.defaultValue) {
689
- i += " = " + print(e.defaultValue);
693
+ n += " = " + print(e.defaultValue);
690
694
  }
691
695
  if (hasItems(e.directives)) {
692
- i += " " + e.directives.map(print).join(" ");
696
+ n += " " + e.directives.map(print).join(" ");
693
697
  }
694
- return i;
698
+ return n;
695
699
 
696
700
  case r.FIELD:
697
- i = (e.alias ? print(e.alias) + ": " : "") + e.name.value;
701
+ n = (e.alias ? print(e.alias) + ": " : "") + e.name.value;
698
702
  if (hasItems(e.arguments)) {
699
- i += "(" + e.arguments.map(print).join(", ") + ")";
703
+ var i = e.arguments.map(print);
704
+ var t = n + "(" + i.join(", ") + ")";
705
+ n = t.length > h ? n + "(\n " + i.join("\n").replace(/\n/g, "\n ") + "\n)" : t;
700
706
  }
701
707
  if (hasItems(e.directives)) {
702
- i += " " + e.directives.map(print).join(" ");
708
+ n += " " + e.directives.map(print).join(" ");
703
709
  }
704
- return e.selectionSet ? i + " " + print(e.selectionSet) : i;
710
+ return e.selectionSet ? n + " " + print(e.selectionSet) : n;
705
711
 
706
712
  case r.STRING:
707
713
  return e.block ? printBlockString(e.value) : printString(e.value);
@@ -740,36 +746,36 @@ function print(e) {
740
746
  return e.name.value + ": " + print(e.value);
741
747
 
742
748
  case r.FRAGMENT_SPREAD:
743
- i = "..." + e.name.value;
749
+ n = "..." + e.name.value;
744
750
  if (hasItems(e.directives)) {
745
- i += " " + e.directives.map(print).join(" ");
751
+ n += " " + e.directives.map(print).join(" ");
746
752
  }
747
- return i;
753
+ return n;
748
754
 
749
755
  case r.INLINE_FRAGMENT:
750
- i = "...";
756
+ n = "...";
751
757
  if (e.typeCondition) {
752
- i += " on " + e.typeCondition.name.value;
758
+ n += " on " + e.typeCondition.name.value;
753
759
  }
754
760
  if (hasItems(e.directives)) {
755
- i += " " + e.directives.map(print).join(" ");
761
+ n += " " + e.directives.map(print).join(" ");
756
762
  }
757
- return i + " " + print(e.selectionSet);
763
+ return n + " " + print(e.selectionSet);
758
764
 
759
765
  case r.FRAGMENT_DEFINITION:
760
- i = "fragment " + e.name.value;
761
- i += " on " + e.typeCondition.name.value;
766
+ n = "fragment " + e.name.value;
767
+ n += " on " + e.typeCondition.name.value;
762
768
  if (hasItems(e.directives)) {
763
- i += " " + e.directives.map(print).join(" ");
769
+ n += " " + e.directives.map(print).join(" ");
764
770
  }
765
- return i + " " + print(e.selectionSet);
771
+ return n + " " + print(e.selectionSet);
766
772
 
767
773
  case r.DIRECTIVE:
768
- i = "@" + e.name.value;
774
+ n = "@" + e.name.value;
769
775
  if (hasItems(e.arguments)) {
770
- i += "(" + e.arguments.map(print).join(", ") + ")";
776
+ n += "(" + e.arguments.map(print).join(", ") + ")";
771
777
  }
772
- return i;
778
+ return n;
773
779
 
774
780
  case r.NAMED_TYPE:
775
781
  return e.name.value;
@@ -782,5 +788,75 @@ function print(e) {
782
788
  }
783
789
  }
784
790
 
785
- export { A as BREAK, GraphQLError, r as Kind, e as OperationTypeNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, visit };
791
+ function valueFromASTUntyped(e, n) {
792
+ switch (e.kind) {
793
+ case r.NULL:
794
+ return null;
795
+
796
+ case r.INT:
797
+ return parseInt(e.value, 10);
798
+
799
+ case r.FLOAT:
800
+ return parseFloat(e.value);
801
+
802
+ case r.STRING:
803
+ case r.ENUM:
804
+ case r.BOOLEAN:
805
+ return e.value;
806
+
807
+ case r.LIST:
808
+ var i = [];
809
+ for (var t = 0, a = e.values; t < a.length; t += 1) {
810
+ i.push(valueFromASTUntyped(a[t], n));
811
+ }
812
+ return i;
813
+
814
+ case r.OBJECT:
815
+ var o = Object.create(null);
816
+ for (var u = 0, s = e.fields; u < s.length; u += 1) {
817
+ var l = s[u];
818
+ o[l.name.value] = valueFromASTUntyped(l.value, n);
819
+ }
820
+ return o;
821
+
822
+ case r.VARIABLE:
823
+ return n && n[e.name.value];
824
+ }
825
+ }
826
+
827
+ function valueFromTypeNode(e, n, i) {
828
+ if (e.kind === r.VARIABLE) {
829
+ return i ? valueFromTypeNode(i[e.name.value], n, i) : void 0;
830
+ } else if (n.kind === r.NON_NULL_TYPE) {
831
+ return e.kind !== r.NULL ? valueFromTypeNode(e, n, i) : void 0;
832
+ } else if (e.kind === r.NULL) {
833
+ return null;
834
+ } else if (n.kind === r.LIST_TYPE) {
835
+ if (e.kind === r.LIST) {
836
+ var t = [];
837
+ for (var a = 0, o = e.values; a < o.length; a += 1) {
838
+ var u = valueFromTypeNode(o[a], n.type, i);
839
+ if (void 0 === u) {
840
+ return;
841
+ } else {
842
+ t.push(u);
843
+ }
844
+ }
845
+ return t;
846
+ }
847
+ } else if (n.kind === r.NAMED_TYPE) {
848
+ switch (n.name.value) {
849
+ case "Int":
850
+ case "Float":
851
+ case "String":
852
+ case "Bool":
853
+ return n.name.value + "Value" === e.kind ? valueFromASTUntyped(e, i) : void 0;
854
+
855
+ default:
856
+ return valueFromASTUntyped(e, i);
857
+ }
858
+ }
859
+ }
860
+
861
+ export { A as BREAK, GraphQLError, r as Kind, e as OperationTypeNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
786
862
  //# sourceMappingURL=graphql.web.mjs.map