@0no-co/graphql.web 0.1.2 → 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 u = n; u <= a; u++) {
110
- if (u !== n) {
109
+ for (var s = i; s <= a; s++) {
110
+ if (s !== i) {
111
111
  r += "\n";
112
112
  }
113
- r += o[u].slice(i).replace(/\\"""/g, '"""');
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 u = /true|false/y;
140
+ var s = /true|false/y;
141
141
 
142
- var d = /\$[_\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(u)) {
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(d))) {
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,22 +382,22 @@ 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 = n;
392
- var i;
393
- if ((i = name()) && "on" !== i.value) {
391
+ var e = i;
392
+ var n;
393
+ if ((n = name()) && "on" !== n.value) {
394
394
  return {
395
395
  kind: r.FRAGMENT_SPREAD,
396
- name: i,
396
+ name: n,
397
397
  directives: directives(!1)
398
398
  };
399
399
  } else {
400
- n = e;
400
+ i = e;
401
401
  var t = typeCondition();
402
402
  var a = directives(!1);
403
403
  var o = selectionSet();
@@ -417,14 +417,14 @@ function fragmentSpread() {
417
417
  function selectionSet() {
418
418
  var e;
419
419
  ignored();
420
- if (123 === i.charCodeAt(n)) {
421
- n++;
420
+ if (123 === n.charCodeAt(i)) {
421
+ i++;
422
422
  ignored();
423
423
  var t = [];
424
424
  while (e = fragmentSpread() || field()) {
425
425
  t.push(e);
426
426
  }
427
- if (!t.length || 125 !== i.charCodeAt(n++)) {
427
+ if (!t.length || 125 !== n.charCodeAt(i++)) {
428
428
  throw error(r.SELECTION_SET);
429
429
  }
430
430
  ignored();
@@ -435,21 +435,21 @@ function selectionSet() {
435
435
  }
436
436
  }
437
437
 
438
- var N = /fragment/y;
438
+ var I = /fragment/y;
439
439
 
440
440
  function fragmentDefinition() {
441
- if (advance(N)) {
441
+ if (advance(I)) {
442
442
  ignored();
443
443
  var e = name();
444
444
  if (!e) {
445
445
  throw error(r.FRAGMENT_DEFINITION);
446
446
  }
447
447
  ignored();
448
- var i = typeCondition();
449
- if (!i) {
448
+ var n = typeCondition();
449
+ if (!n) {
450
450
  throw error(r.FRAGMENT_DEFINITION);
451
451
  }
452
- var n = directives(!1);
452
+ var i = directives(!1);
453
453
  var t = selectionSet();
454
454
  if (!t) {
455
455
  throw error(r.FRAGMENT_DEFINITION);
@@ -457,8 +457,8 @@ function fragmentDefinition() {
457
457
  return {
458
458
  kind: r.FRAGMENT_DEFINITION,
459
459
  name: e,
460
- typeCondition: i,
461
- directives: n,
460
+ typeCondition: n,
461
+ directives: i,
462
462
  selectionSet: t
463
463
  };
464
464
  }
@@ -478,12 +478,12 @@ function operationDefinition() {
478
478
  var e;
479
479
  var t = [];
480
480
  ignored();
481
- if (40 === i.charCodeAt(n)) {
482
- n++;
481
+ if (40 === n.charCodeAt(i)) {
482
+ i++;
483
483
  ignored();
484
- while (e = advance(d)) {
484
+ while (e = advance(l)) {
485
485
  ignored();
486
- if (58 !== i.charCodeAt(n++)) {
486
+ if (58 !== n.charCodeAt(i++)) {
487
487
  throw error(r.VARIABLE_DEFINITION);
488
488
  }
489
489
  var a = type();
@@ -491,8 +491,8 @@ function operationDefinition() {
491
491
  throw error(r.VARIABLE_DEFINITION);
492
492
  }
493
493
  var o = void 0;
494
- if (61 === i.charCodeAt(n)) {
495
- n++;
494
+ if (61 === n.charCodeAt(i)) {
495
+ i++;
496
496
  ignored();
497
497
  if (!(o = value(!0))) {
498
498
  throw error(r.VARIABLE_DEFINITION);
@@ -513,7 +513,7 @@ function operationDefinition() {
513
513
  directives: directives(!0)
514
514
  });
515
515
  }
516
- if (41 !== i.charCodeAt(n++)) {
516
+ if (41 !== n.charCodeAt(i++)) {
517
517
  throw error(r.VARIABLE_DEFINITION);
518
518
  }
519
519
  ignored();
@@ -522,22 +522,22 @@ function operationDefinition() {
522
522
  }();
523
523
  o = directives(!1);
524
524
  }
525
- var s = selectionSet();
526
- if (s) {
525
+ var u = selectionSet();
526
+ if (u) {
527
527
  return {
528
528
  kind: r.OPERATION_DEFINITION,
529
529
  operation: e || "query",
530
530
  name: t,
531
531
  variableDefinitions: a,
532
532
  directives: o,
533
- selectionSet: s
533
+ selectionSet: u
534
534
  };
535
535
  }
536
536
  }
537
537
 
538
538
  function parse(e) {
539
- i = e;
540
- n = 0;
539
+ n = e;
540
+ i = 0;
541
541
  return function document() {
542
542
  var e;
543
543
  ignored();
@@ -545,7 +545,7 @@ function parse(e) {
545
545
  while (e = fragmentDefinition() || operationDefinition()) {
546
546
  t.push(e);
547
547
  }
548
- if (n !== i.length) {
548
+ if (i !== n.length) {
549
549
  throw error(r.DOCUMENT);
550
550
  }
551
551
  return {
@@ -556,97 +556,97 @@ function parse(e) {
556
556
  }
557
557
 
558
558
  function parseValue(e) {
559
- i = e;
560
- n = 0;
559
+ n = e;
560
+ i = 0;
561
561
  ignored();
562
562
  return value(!1);
563
563
  }
564
564
 
565
565
  function parseType(e) {
566
- i = e;
567
- n = 0;
566
+ n = e;
567
+ i = 0;
568
568
  return type();
569
569
  }
570
570
 
571
- var g = {};
571
+ var A = {};
572
572
 
573
573
  function visit(e, r) {
574
- var i = [];
575
574
  var n = [];
575
+ var i = [];
576
576
  try {
577
577
  var t = function traverse(e, t, a) {
578
578
  var o = !1;
579
- var s = r[e.kind] && r[e.kind].enter || r[e.kind];
580
- var u = s && s.call(r, e, t, a, n, i);
581
- if (!1 === u) {
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) {
582
582
  return e;
583
- } else if (null === u) {
583
+ } else if (null === s) {
584
584
  return null;
585
- } else if (u === g) {
586
- throw g;
587
- } else if (u && "string" == typeof u.kind) {
588
- o = u !== e;
589
- e = u;
585
+ } else if (s === A) {
586
+ throw A;
587
+ } else if (s && "string" == typeof s.kind) {
588
+ o = s !== e;
589
+ e = s;
590
590
  }
591
591
  if (a) {
592
- i.push(a);
592
+ n.push(a);
593
593
  }
594
- var d;
594
+ var l;
595
595
  var v = {
596
596
  ...e
597
597
  };
598
- for (var l in e) {
599
- n.push(l);
600
- var c = e[l];
598
+ for (var d in e) {
599
+ i.push(d);
600
+ var c = e[d];
601
601
  if (Array.isArray(c)) {
602
602
  var f = [];
603
603
  for (var E = 0; E < c.length; E++) {
604
604
  if (null != c[E] && "string" == typeof c[E].kind) {
605
- i.push(e);
606
- n.push(E);
607
- d = traverse(c[E], E, c);
608
- n.pop();
605
+ n.push(e);
606
+ i.push(E);
607
+ l = traverse(c[E], E, c);
609
608
  i.pop();
610
- if (void 0 === d) {
609
+ n.pop();
610
+ if (void 0 === l) {
611
611
  f.push(c[E]);
612
- } else if (null === d) {
612
+ } else if (null === l) {
613
613
  o = !0;
614
614
  } else {
615
- o = o || d !== c[E];
616
- f.push(d);
615
+ o = o || l !== c[E];
616
+ f.push(l);
617
617
  }
618
618
  }
619
619
  }
620
620
  c = f;
621
621
  } else if (null != c && "string" == typeof c.kind) {
622
- if (void 0 !== (d = traverse(c, l, e))) {
623
- o = o || c !== d;
624
- c = d;
622
+ if (void 0 !== (l = traverse(c, d, e))) {
623
+ o = o || c !== l;
624
+ c = l;
625
625
  }
626
626
  }
627
- n.pop();
627
+ i.pop();
628
628
  if (o) {
629
- v[l] = c;
629
+ v[d] = c;
630
630
  }
631
631
  }
632
632
  if (a) {
633
- i.pop();
633
+ n.pop();
634
634
  }
635
635
  var p = r[e.kind] && r[e.kind].leave;
636
- var I = p && p.call(r, e, t, a, n, i);
637
- if (I === g) {
638
- throw g;
639
- } else if (void 0 !== I) {
640
- return I;
641
- } else if (void 0 !== u) {
642
- return o ? v : u;
636
+ var N = p && p.call(r, e, t, a, i, n);
637
+ if (N === A) {
638
+ throw A;
639
+ } else if (void 0 !== N) {
640
+ return N;
641
+ } else if (void 0 !== s) {
642
+ return o ? v : s;
643
643
  } else {
644
644
  return o ? v : e;
645
645
  }
646
646
  }(e);
647
647
  return void 0 !== t && !1 !== t ? t : e;
648
648
  } catch (r) {
649
- if (r !== g) {
649
+ if (r !== A) {
650
650
  throw r;
651
651
  }
652
652
  return e;
@@ -663,51 +663,51 @@ function printBlockString(e) {
663
663
 
664
664
  var hasItems = e => !(!e || !e.length);
665
665
 
666
- var A = 80;
666
+ var h = 80;
667
667
 
668
668
  function print(e) {
669
- var i;
669
+ var n;
670
670
  switch (e.kind) {
671
671
  case r.OPERATION_DEFINITION:
672
672
  if ("query" === e.operation && !e.name && !hasItems(e.variableDefinitions) && !hasItems(e.directives)) {
673
673
  return print(e.selectionSet);
674
674
  }
675
- i = e.operation;
675
+ n = e.operation;
676
676
  if (e.name) {
677
- i += " " + e.name.value;
677
+ n += " " + e.name.value;
678
678
  }
679
679
  if (hasItems(e.variableDefinitions)) {
680
680
  if (!e.name) {
681
- i += " ";
681
+ n += " ";
682
682
  }
683
- i += "(" + e.variableDefinitions.map(print).join(", ") + ")";
683
+ n += "(" + e.variableDefinitions.map(print).join(", ") + ")";
684
684
  }
685
685
  if (hasItems(e.directives)) {
686
- i += " " + e.directives.map(print).join(" ");
686
+ n += " " + e.directives.map(print).join(" ");
687
687
  }
688
- return i + " " + print(e.selectionSet);
688
+ return n + " " + print(e.selectionSet);
689
689
 
690
690
  case r.VARIABLE_DEFINITION:
691
- i = print(e.variable) + ": " + print(e.type);
691
+ n = print(e.variable) + ": " + print(e.type);
692
692
  if (e.defaultValue) {
693
- i += " = " + print(e.defaultValue);
693
+ n += " = " + print(e.defaultValue);
694
694
  }
695
695
  if (hasItems(e.directives)) {
696
- i += " " + e.directives.map(print).join(" ");
696
+ n += " " + e.directives.map(print).join(" ");
697
697
  }
698
- return i;
698
+ return n;
699
699
 
700
700
  case r.FIELD:
701
- i = (e.alias ? print(e.alias) + ": " : "") + e.name.value;
701
+ n = (e.alias ? print(e.alias) + ": " : "") + e.name.value;
702
702
  if (hasItems(e.arguments)) {
703
- var n = e.arguments.map(print);
704
- var t = i + "(" + n.join(", ") + ")";
705
- i = t.length > A ? i + "(\n " + n.join("\n").replace(/\n/g, "\n ") + "\n)" : t;
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;
706
706
  }
707
707
  if (hasItems(e.directives)) {
708
- i += " " + e.directives.map(print).join(" ");
708
+ n += " " + e.directives.map(print).join(" ");
709
709
  }
710
- return e.selectionSet ? i + " " + print(e.selectionSet) : i;
710
+ return e.selectionSet ? n + " " + print(e.selectionSet) : n;
711
711
 
712
712
  case r.STRING:
713
713
  return e.block ? printBlockString(e.value) : printString(e.value);
@@ -746,36 +746,36 @@ function print(e) {
746
746
  return e.name.value + ": " + print(e.value);
747
747
 
748
748
  case r.FRAGMENT_SPREAD:
749
- i = "..." + e.name.value;
749
+ n = "..." + e.name.value;
750
750
  if (hasItems(e.directives)) {
751
- i += " " + e.directives.map(print).join(" ");
751
+ n += " " + e.directives.map(print).join(" ");
752
752
  }
753
- return i;
753
+ return n;
754
754
 
755
755
  case r.INLINE_FRAGMENT:
756
- i = "...";
756
+ n = "...";
757
757
  if (e.typeCondition) {
758
- i += " on " + e.typeCondition.name.value;
758
+ n += " on " + e.typeCondition.name.value;
759
759
  }
760
760
  if (hasItems(e.directives)) {
761
- i += " " + e.directives.map(print).join(" ");
761
+ n += " " + e.directives.map(print).join(" ");
762
762
  }
763
- return i + " " + print(e.selectionSet);
763
+ return n + " " + print(e.selectionSet);
764
764
 
765
765
  case r.FRAGMENT_DEFINITION:
766
- i = "fragment " + e.name.value;
767
- i += " on " + e.typeCondition.name.value;
766
+ n = "fragment " + e.name.value;
767
+ n += " on " + e.typeCondition.name.value;
768
768
  if (hasItems(e.directives)) {
769
- i += " " + e.directives.map(print).join(" ");
769
+ n += " " + e.directives.map(print).join(" ");
770
770
  }
771
- return i + " " + print(e.selectionSet);
771
+ return n + " " + print(e.selectionSet);
772
772
 
773
773
  case r.DIRECTIVE:
774
- i = "@" + e.name.value;
774
+ n = "@" + e.name.value;
775
775
  if (hasItems(e.arguments)) {
776
- i += "(" + e.arguments.map(print).join(", ") + ")";
776
+ n += "(" + e.arguments.map(print).join(", ") + ")";
777
777
  }
778
- return i;
778
+ return n;
779
779
 
780
780
  case r.NAMED_TYPE:
781
781
  return e.name.value;
@@ -788,5 +788,75 @@ function print(e) {
788
788
  }
789
789
  }
790
790
 
791
- export { g 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 };
792
862
  //# sourceMappingURL=graphql.web.mjs.map