@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.
- package/README.md +14 -0
- package/dist/graphql.web.d.ts +1 -2
- package/dist/graphql.web.js +213 -243
- package/dist/graphql.web.js.map +1 -1
- package/dist/graphql.web.mjs +214 -244
- package/dist/graphql.web.mjs.map +1 -1
- package/package.json +4 -3
package/dist/graphql.web.mjs
CHANGED
|
@@ -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,
|
|
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 (
|
|
33
|
-
this.path =
|
|
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 (
|
|
45
|
-
this.originalError =
|
|
51
|
+
if (t) {
|
|
52
|
+
this.originalError = t;
|
|
46
53
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 =
|
|
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
|
|
92
|
+
var a = / +(?=[^\s])/y;
|
|
84
93
|
|
|
85
94
|
function blockString(e) {
|
|
86
|
-
var r = "";
|
|
87
|
-
var i =
|
|
95
|
+
var r = e.split("\n");
|
|
96
|
+
var i = "";
|
|
88
97
|
var n = 0;
|
|
89
|
-
var
|
|
90
|
-
var o =
|
|
91
|
-
for (var l = 0; l <
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
if (l && (!
|
|
95
|
-
|
|
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
|
-
|
|
98
|
-
|
|
106
|
+
t = t || l;
|
|
107
|
+
o = l;
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
|
-
for (var u =
|
|
102
|
-
if (u !==
|
|
103
|
-
|
|
110
|
+
for (var u = t; u <= o; u++) {
|
|
111
|
+
if (u !== t) {
|
|
112
|
+
i += "\n";
|
|
104
113
|
}
|
|
105
|
-
|
|
114
|
+
i += r[u].slice(n).replace(/\\"""/g, '"""');
|
|
106
115
|
}
|
|
107
|
-
return
|
|
116
|
+
return i;
|
|
108
117
|
}
|
|
109
118
|
|
|
110
|
-
var a = /(?:[\s,]*|#[^\n\r]*)*/y;
|
|
111
|
-
|
|
112
119
|
function ignored() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
128
|
+
var t = /[_\w][_\d\w]*/y;
|
|
119
129
|
|
|
120
130
|
function name() {
|
|
121
131
|
var e;
|
|
122
|
-
if (e = advance(
|
|
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
|
|
140
|
+
var o = /null|true|false/y;
|
|
131
141
|
|
|
132
|
-
var
|
|
142
|
+
var l = /\$[_\w][_\d\w]*/y;
|
|
133
143
|
|
|
134
|
-
var
|
|
144
|
+
var u = /-?\d+/y;
|
|
135
145
|
|
|
136
|
-
var
|
|
146
|
+
var v = /(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
|
|
137
147
|
|
|
138
|
-
var
|
|
148
|
+
var d = /\\/g;
|
|
139
149
|
|
|
140
|
-
var
|
|
150
|
+
var s = /"""(?:[\s\S]+(?="""))?"""/y;
|
|
141
151
|
|
|
142
|
-
var
|
|
152
|
+
var c = /"(?:[^"\r\n]+)?"/y;
|
|
143
153
|
|
|
144
154
|
function value(e) {
|
|
145
155
|
var r;
|
|
146
|
-
var
|
|
147
|
-
if (
|
|
148
|
-
r = "null" ===
|
|
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" ===
|
|
162
|
+
value: "true" === a
|
|
153
163
|
};
|
|
154
|
-
} else if (!e && (
|
|
164
|
+
} else if (!e && (a = advance(l))) {
|
|
155
165
|
r = {
|
|
156
166
|
kind: "Variable",
|
|
157
167
|
name: {
|
|
158
168
|
kind: "Name",
|
|
159
|
-
value:
|
|
169
|
+
value: a.slice(1)
|
|
160
170
|
}
|
|
161
171
|
};
|
|
162
|
-
} else if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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:
|
|
188
|
+
value: a
|
|
176
189
|
};
|
|
177
|
-
} else if (
|
|
190
|
+
} else if (a = advance(s)) {
|
|
178
191
|
r = {
|
|
179
192
|
kind: "StringValue",
|
|
180
|
-
value: blockString(
|
|
193
|
+
value: blockString(a.slice(3, -3)),
|
|
181
194
|
block: !0
|
|
182
195
|
};
|
|
183
|
-
} else if (
|
|
196
|
+
} else if (a = advance(c)) {
|
|
184
197
|
r = {
|
|
185
198
|
kind: "StringValue",
|
|
186
|
-
value:
|
|
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
|
|
207
|
+
var a = [];
|
|
195
208
|
while (r = value(e)) {
|
|
196
|
-
|
|
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:
|
|
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
|
|
213
|
-
while (
|
|
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
|
|
220
|
-
if (!
|
|
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:
|
|
226
|
-
value:
|
|
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
|
|
252
|
-
while (
|
|
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
|
|
259
|
-
if (!
|
|
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:
|
|
265
|
-
value:
|
|
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
|
|
282
|
-
if (!
|
|
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:
|
|
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
|
|
368
|
+
var f = /on/y;
|
|
357
369
|
|
|
358
370
|
function typeCondition() {
|
|
359
|
-
if (advance(
|
|
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
|
|
385
|
+
var p = /\.\.\./y;
|
|
374
386
|
|
|
375
387
|
function fragmentSpread() {
|
|
376
|
-
|
|
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
|
|
391
|
-
var
|
|
392
|
-
if (!
|
|
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:
|
|
399
|
-
selectionSet:
|
|
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
|
|
437
|
+
var m = /fragment/y;
|
|
427
438
|
|
|
428
439
|
function fragmentDefinition() {
|
|
429
|
-
if (advance(
|
|
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
|
|
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
|
-
|
|
472
|
+
var t = [];
|
|
473
|
+
if (e = advance(g)) {
|
|
463
474
|
ignored();
|
|
464
475
|
r = name();
|
|
465
|
-
|
|
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(
|
|
483
|
+
while (e = advance(l)) {
|
|
473
484
|
ignored();
|
|
474
485
|
if (58 !== i.charCodeAt(n++)) {
|
|
475
486
|
throw error("VariableDefinition");
|
|
476
487
|
}
|
|
477
|
-
var
|
|
478
|
-
|
|
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 (!(
|
|
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:
|
|
500
|
-
defaultValue:
|
|
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
|
-
|
|
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:
|
|
520
|
-
directives:
|
|
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
|
|
551
|
-
if (!
|
|
555
|
+
var a = value(!1);
|
|
556
|
+
if (!a) {
|
|
552
557
|
throw error("ValueNode");
|
|
553
558
|
}
|
|
554
|
-
return
|
|
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
|
-
|
|
561
|
-
if (!t) {
|
|
562
|
-
throw error("TypeNode");
|
|
563
|
-
}
|
|
564
|
-
return t;
|
|
565
|
+
return type();
|
|
565
566
|
}
|
|
566
567
|
|
|
567
|
-
var
|
|
568
|
+
var h = {};
|
|
568
569
|
|
|
569
570
|
function visit(e, r) {
|
|
570
571
|
var i = [];
|
|
571
572
|
var n = [];
|
|
572
573
|
try {
|
|
573
|
-
var
|
|
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,
|
|
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 ===
|
|
582
|
-
throw
|
|
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 (
|
|
588
|
-
i.push(
|
|
588
|
+
if (t) {
|
|
589
|
+
i.push(t);
|
|
589
590
|
}
|
|
590
|
-
var
|
|
591
|
+
var v;
|
|
591
592
|
var d = {
|
|
592
593
|
...e
|
|
593
594
|
};
|
|
594
|
-
for (var
|
|
595
|
-
n.push(
|
|
596
|
-
var c = e[
|
|
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
|
-
|
|
604
|
+
v = traverse(c[p], p, c);
|
|
604
605
|
n.pop();
|
|
605
606
|
i.pop();
|
|
606
|
-
if (
|
|
607
|
-
f.push(c[p]);
|
|
608
|
-
} else if (null === s) {
|
|
607
|
+
if (null == v) {
|
|
609
608
|
o = !0;
|
|
610
609
|
} else {
|
|
611
|
-
o = o ||
|
|
612
|
-
f.push(
|
|
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 !== (
|
|
619
|
-
o = o || c !==
|
|
620
|
-
c =
|
|
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[
|
|
624
|
+
d[s] = c;
|
|
626
625
|
}
|
|
627
626
|
}
|
|
628
|
-
if (
|
|
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,
|
|
633
|
-
if (g ===
|
|
634
|
-
throw
|
|
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 !==
|
|
642
|
+
return void 0 !== a && !1 !== a ? a : e;
|
|
644
643
|
} catch (r) {
|
|
645
|
-
if (r !==
|
|
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
|
|
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
|
|
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(
|
|
674
|
+
r += "(" + e.variableDefinitions.map(y.VariableDefinition).join(", ") + ")";
|
|
680
675
|
}
|
|
681
676
|
if (hasItems(e.directives)) {
|
|
682
|
-
r += " " + e.directives.map(
|
|
677
|
+
r += " " + e.directives.map(y.Directive).join(" ");
|
|
683
678
|
}
|
|
684
|
-
return r + " " +
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
r =
|
|
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(
|
|
687
|
+
r += " " + e.directives.map(y.Directive).join(" ");
|
|
693
688
|
}
|
|
694
689
|
return r;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
r = (e.alias ?
|
|
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(
|
|
694
|
+
var i = e.arguments.map(y.Argument);
|
|
700
695
|
var n = r + "(" + i.join(", ") + ")";
|
|
701
|
-
r = n.length >
|
|
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(
|
|
705
|
-
}
|
|
706
|
-
return e.selectionSet ? r + " " +
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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(
|
|
720
|
+
r += " " + e.directives.map(y.Directive).join(" ");
|
|
746
721
|
}
|
|
747
722
|
return r;
|
|
748
|
-
|
|
749
|
-
|
|
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(
|
|
730
|
+
r += " " + e.directives.map(y.Directive).join(" ");
|
|
756
731
|
}
|
|
757
732
|
return r + " " + print(e.selectionSet);
|
|
758
|
-
|
|
759
|
-
|
|
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(
|
|
738
|
+
r += " " + e.directives.map(y.Directive).join(" ");
|
|
764
739
|
}
|
|
765
740
|
return r + " " + print(e.selectionSet);
|
|
766
|
-
|
|
767
|
-
|
|
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(
|
|
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
|
-
|
|
775
|
-
|
|
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,
|
|
807
|
-
i.push(valueFromASTUntyped(
|
|
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
|
|
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
|
-
|
|
785
|
+
t[u.name.value] = valueFromASTUntyped(u.value, r);
|
|
816
786
|
}
|
|
817
|
-
return
|
|
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
|
|
835
|
-
var o = valueFromTypeNode(a
|
|
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 {
|
|
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
|