@0no-co/graphql.web
Advanced tools
Comparing version 1.0.13 to 1.1.0-canary-2984e7be4859ae53671646c15d1df5943c34199b
@@ -6,7 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
class GraphQLError extends Error { | ||
constructor(e, r, n, i, t, a, o) { | ||
super(e); | ||
this.name = "GraphQLError"; | ||
this.message = e; | ||
if (t) { | ||
constructor(e, r, i, n, t, a, o) { | ||
if (super(e), this.name = "GraphQLError", this.message = e, t) { | ||
this.path = t; | ||
@@ -17,8 +14,8 @@ } | ||
} | ||
if (i) { | ||
this.source = i; | ||
} | ||
if (n) { | ||
this.source = n; | ||
this.positions = n; | ||
} | ||
if (i) { | ||
this.positions = i; | ||
} | ||
if (a) { | ||
@@ -29,5 +26,5 @@ this.originalError = a; | ||
if (!l && a) { | ||
var u = a.extensions; | ||
if (u && "object" == typeof u) { | ||
l = u; | ||
var d = a.extensions; | ||
if (d && "object" == typeof d) { | ||
l = d; | ||
} | ||
@@ -59,14 +56,13 @@ } | ||
function advance(n) { | ||
n.lastIndex = r; | ||
if (n.test(e)) { | ||
return e.slice(r, r = n.lastIndex); | ||
function advance(i) { | ||
if (i.lastIndex = r, i.test(e)) { | ||
return e.slice(r, r = i.lastIndex); | ||
} | ||
} | ||
var n = / +(?=[^\s])/y; | ||
var i = / +(?=[^\s])/y; | ||
function blockString(e) { | ||
var r = e.split("\n"); | ||
var i = ""; | ||
var n = ""; | ||
var t = 0; | ||
@@ -76,24 +72,22 @@ var a = 0; | ||
for (var l = 0; l < r.length; l++) { | ||
n.lastIndex = 0; | ||
if (n.test(r[l])) { | ||
if (l && (!t || n.lastIndex < t)) { | ||
t = n.lastIndex; | ||
if (i.lastIndex = 0, i.test(r[l])) { | ||
if (l && (!t || i.lastIndex < t)) { | ||
t = i.lastIndex; | ||
} | ||
a = a || l; | ||
o = l; | ||
a = a || l, o = l; | ||
} | ||
} | ||
for (var u = a; u <= o; u++) { | ||
if (u !== a) { | ||
i += "\n"; | ||
for (var d = a; d <= o; d++) { | ||
if (d !== a) { | ||
n += "\n"; | ||
} | ||
i += r[u].slice(t).replace(/\\"""/g, '"""'); | ||
n += r[d].slice(t).replace(/\\"""/g, '"""'); | ||
} | ||
return i; | ||
return n; | ||
} | ||
function ignored() { | ||
for (var n = 0 | e.charCodeAt(r++); 9 === n || 10 === n || 13 === n || 32 === n || 35 === n || 44 === n || 65279 === n; n = 0 | e.charCodeAt(r++)) { | ||
if (35 === n) { | ||
while (10 !== (n = e.charCodeAt(r++)) && 13 !== n) {} | ||
for (var i = 0 | e.charCodeAt(r++); 9 === i || 10 === i || 13 === i || 32 === i || 35 === i || 44 === i || 65279 === i; i = 0 | e.charCodeAt(r++)) { | ||
if (35 === i) { | ||
for (;10 !== (i = e.charCodeAt(r++)) && 13 !== i; ) {} | ||
} | ||
@@ -104,171 +98,186 @@ } | ||
var i = /[_A-Za-z]\w*/y; | ||
function name() { | ||
var i = r; | ||
for (var n = 0 | e.charCodeAt(r++); n >= 48 && n <= 57 || n >= 65 && n <= 90 || 95 === n || n >= 97 && n <= 122; n = 0 | e.charCodeAt(r++)) {} | ||
if (i === r - 1) { | ||
throw error("Name"); | ||
} | ||
var t = e.slice(i, --r); | ||
return ignored(), t; | ||
} | ||
var t = new RegExp("(?:(null|true|false)|\\$(" + i.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + i.source + "))", "y"); | ||
function nameNode() { | ||
return { | ||
kind: "Name", | ||
value: name() | ||
}; | ||
} | ||
var a = function(e) { | ||
e[e.Const = 1] = "Const"; | ||
e[e.Var = 2] = "Var"; | ||
e[e.Int = 3] = "Int"; | ||
e[e.Float = 4] = "Float"; | ||
e[e.BlockString = 5] = "BlockString"; | ||
e[e.String = 6] = "String"; | ||
e[e.Enum = 7] = "Enum"; | ||
return e; | ||
}(a || {}); | ||
var n = /(?:"""|(?:[\s\S]*?[^\\])""")/y; | ||
var o = /\\/; | ||
var t = /(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y; | ||
function value(n) { | ||
var l; | ||
var u; | ||
t.lastIndex = r; | ||
if (91 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var d = []; | ||
while (93 !== e.charCodeAt(r)) { | ||
d.push(value(n)); | ||
function value(i) { | ||
var a; | ||
switch (e.charCodeAt(r)) { | ||
case 91: | ||
r++, ignored(); | ||
var o = []; | ||
for (;93 !== e.charCodeAt(r); ) { | ||
o.push(value(i)); | ||
} | ||
r++; | ||
ignored(); | ||
return { | ||
return r++, ignored(), { | ||
kind: "ListValue", | ||
values: d | ||
values: o | ||
}; | ||
} else if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var s = []; | ||
while (125 !== e.charCodeAt(r)) { | ||
if (null == (l = advance(i))) { | ||
throw error("ObjectField"); | ||
} | ||
ignored(); | ||
case 123: | ||
r++, ignored(); | ||
var l = []; | ||
for (;125 !== e.charCodeAt(r); ) { | ||
var d = nameNode(); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("ObjectField"); | ||
} | ||
ignored(); | ||
s.push({ | ||
ignored(), l.push({ | ||
kind: "ObjectField", | ||
name: { | ||
kind: "Name", | ||
value: l | ||
}, | ||
value: value(n) | ||
name: d, | ||
value: value(i) | ||
}); | ||
} | ||
r++; | ||
ignored(); | ||
return { | ||
return r++, ignored(), { | ||
kind: "ObjectValue", | ||
fields: s | ||
fields: l | ||
}; | ||
} else if (null != (u = t.exec(e))) { | ||
r = t.lastIndex; | ||
ignored(); | ||
if (null != (l = u[a.Const])) { | ||
return "null" === l ? { | ||
kind: "NullValue" | ||
} : { | ||
kind: "BooleanValue", | ||
value: "true" === l | ||
}; | ||
} else if (null != (l = u[a.Var])) { | ||
if (n) { | ||
throw error("Variable"); | ||
} else { | ||
return { | ||
kind: "Variable", | ||
name: { | ||
kind: "Name", | ||
value: l | ||
} | ||
}; | ||
case 36: | ||
if (i) { | ||
throw error("Variable"); | ||
} | ||
return r++, { | ||
kind: "Variable", | ||
name: nameNode() | ||
}; | ||
case 34: | ||
if (34 === e.charCodeAt(r + 1) && 34 === e.charCodeAt(r + 2)) { | ||
if (r += 3, null == (a = advance(n))) { | ||
throw error("StringValue"); | ||
} | ||
} else if (null != (l = u[a.Int])) { | ||
var v; | ||
if (null != (v = u[a.Float])) { | ||
return { | ||
kind: "FloatValue", | ||
value: l + v | ||
}; | ||
} else { | ||
return { | ||
kind: "IntValue", | ||
value: l | ||
}; | ||
} | ||
} else if (null != (l = u[a.BlockString])) { | ||
return { | ||
return ignored(), { | ||
kind: "StringValue", | ||
value: blockString(l.slice(3, -3)), | ||
value: blockString(a.slice(0, -3)), | ||
block: !0 | ||
}; | ||
} else if (null != (l = u[a.String])) { | ||
return { | ||
} else { | ||
var u = r; | ||
var s; | ||
r++; | ||
var c = !1; | ||
for (s = 0 | e.charCodeAt(r++); 92 === s && (r++, c = !0) || 10 !== s && 13 !== s && 34 !== s && s; s = 0 | e.charCodeAt(r++)) {} | ||
if (34 !== s) { | ||
throw error("StringValue"); | ||
} | ||
return a = e.slice(u, r), ignored(), { | ||
kind: "StringValue", | ||
value: o.test(l) ? JSON.parse(l) : l.slice(1, -1), | ||
value: c ? JSON.parse(a) : a.slice(1, -1), | ||
block: !1 | ||
}; | ||
} else if (null != (l = u[a.Enum])) { | ||
return { | ||
kind: "EnumValue", | ||
value: l | ||
} | ||
case 45: | ||
case 48: | ||
case 49: | ||
case 50: | ||
case 51: | ||
case 52: | ||
case 53: | ||
case 54: | ||
case 55: | ||
case 56: | ||
case 57: | ||
var v = r++; | ||
var f; | ||
for (;(f = 0 | e.charCodeAt(r++)) >= 48 && f <= 57; ) {} | ||
var p = e.slice(v, --r); | ||
if (46 === (f = e.charCodeAt(r)) || 69 === f || 101 === f) { | ||
if (null == (a = advance(t))) { | ||
throw error("FloatValue"); | ||
} | ||
return ignored(), { | ||
kind: "FloatValue", | ||
value: p + a | ||
}; | ||
} else { | ||
return ignored(), { | ||
kind: "IntValue", | ||
value: p | ||
}; | ||
} | ||
case 110: | ||
if (117 === e.charCodeAt(r + 1) && 108 === e.charCodeAt(r + 2) && 108 === e.charCodeAt(r + 3)) { | ||
return r += 4, ignored(), { | ||
kind: "NullValue" | ||
}; | ||
} else { | ||
break; | ||
} | ||
case 116: | ||
if (114 === e.charCodeAt(r + 1) && 117 === e.charCodeAt(r + 2) && 101 === e.charCodeAt(r + 3)) { | ||
return r += 4, ignored(), { | ||
kind: "BooleanValue", | ||
value: !0 | ||
}; | ||
} else { | ||
break; | ||
} | ||
case 102: | ||
if (97 === e.charCodeAt(r + 1) && 108 === e.charCodeAt(r + 2) && 115 === e.charCodeAt(r + 3) && 101 === e.charCodeAt(r + 4)) { | ||
return r += 5, ignored(), { | ||
kind: "BooleanValue", | ||
value: !1 | ||
}; | ||
} else { | ||
break; | ||
} | ||
} | ||
throw error("Value"); | ||
return { | ||
kind: "EnumValue", | ||
value: name() | ||
}; | ||
} | ||
function arguments_(n) { | ||
function arguments_(i) { | ||
if (40 === e.charCodeAt(r)) { | ||
var t = []; | ||
r++; | ||
ignored(); | ||
var a; | ||
var n = []; | ||
r++, ignored(); | ||
do { | ||
if (null == (a = advance(i))) { | ||
throw error("Argument"); | ||
} | ||
ignored(); | ||
var t = nameNode(); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("Argument"); | ||
} | ||
ignored(); | ||
t.push({ | ||
ignored(), n.push({ | ||
kind: "Argument", | ||
name: { | ||
kind: "Name", | ||
value: a | ||
}, | ||
value: value(n) | ||
name: t, | ||
value: value(i) | ||
}); | ||
} while (41 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return t; | ||
return r++, ignored(), n; | ||
} | ||
} | ||
function directives(n) { | ||
function directives(i) { | ||
if (64 === e.charCodeAt(r)) { | ||
var t = []; | ||
var a; | ||
var n = []; | ||
do { | ||
r++; | ||
if (null == (a = advance(i))) { | ||
throw error("Directive"); | ||
} | ||
ignored(); | ||
t.push({ | ||
r++, n.push({ | ||
kind: "Directive", | ||
name: { | ||
kind: "Name", | ||
value: a | ||
}, | ||
arguments: arguments_(n) | ||
name: nameNode(), | ||
arguments: arguments_(i) | ||
}); | ||
} while (64 === e.charCodeAt(r)); | ||
return t; | ||
return n; | ||
} | ||
@@ -278,269 +287,179 @@ } | ||
function type() { | ||
var n; | ||
var t = 0; | ||
while (91 === e.charCodeAt(r)) { | ||
t++; | ||
r++; | ||
ignored(); | ||
var i = 0; | ||
for (;91 === e.charCodeAt(r); ) { | ||
i++, r++, ignored(); | ||
} | ||
if (null == (n = advance(i))) { | ||
throw error("NamedType"); | ||
} | ||
ignored(); | ||
var a = { | ||
var n = { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: n | ||
} | ||
name: nameNode() | ||
}; | ||
do { | ||
if (33 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
a = { | ||
r++, ignored(), n = { | ||
kind: "NonNullType", | ||
type: a | ||
type: n | ||
}; | ||
} | ||
if (t) { | ||
if (i) { | ||
if (93 !== e.charCodeAt(r++)) { | ||
throw error("NamedType"); | ||
} | ||
ignored(); | ||
a = { | ||
ignored(), n = { | ||
kind: "ListType", | ||
type: a | ||
type: n | ||
}; | ||
} | ||
} while (t--); | ||
return a; | ||
} while (i--); | ||
return n; | ||
} | ||
var l = new RegExp("(?:(\\.{3})|(" + i.source + "))", "y"); | ||
function selectionSetStart() { | ||
if (123 !== e.charCodeAt(r++)) { | ||
throw error("SelectionSet"); | ||
} | ||
return ignored(), selectionSet(); | ||
} | ||
var u = function(e) { | ||
e[e.Spread = 1] = "Spread"; | ||
e[e.Name = 2] = "Name"; | ||
return e; | ||
}(u || {}); | ||
function selectionSet() { | ||
var n = []; | ||
var t; | ||
var a; | ||
var i = []; | ||
do { | ||
l.lastIndex = r; | ||
if (null != (a = l.exec(e))) { | ||
r = l.lastIndex; | ||
if (null != a[u.Spread]) { | ||
ignored(); | ||
var o = advance(i); | ||
if (null != o && "on" !== o) { | ||
ignored(); | ||
n.push({ | ||
kind: "FragmentSpread", | ||
name: { | ||
kind: "Name", | ||
value: o | ||
if (46 === e.charCodeAt(r)) { | ||
if (46 !== e.charCodeAt(++r) || 46 !== e.charCodeAt(++r)) { | ||
throw error("SelectionSet"); | ||
} | ||
switch (r++, ignored(), e.charCodeAt(r)) { | ||
case 64: | ||
i.push({ | ||
kind: "InlineFragment", | ||
typeCondition: void 0, | ||
directives: directives(!1), | ||
selectionSet: selectionSetStart() | ||
}); | ||
break; | ||
case 111: | ||
if (110 === e.charCodeAt(r + 1)) { | ||
r += 2, ignored(), i.push({ | ||
kind: "InlineFragment", | ||
typeCondition: { | ||
kind: "NamedType", | ||
name: nameNode() | ||
}, | ||
directives: directives(!1) | ||
directives: directives(!1), | ||
selectionSet: selectionSetStart() | ||
}); | ||
} else { | ||
ignored(); | ||
if ("on" === o) { | ||
if (null == (o = advance(i))) { | ||
throw error("NamedType"); | ||
} | ||
ignored(); | ||
} | ||
var d = directives(!1); | ||
if (123 !== e.charCodeAt(r++)) { | ||
throw error("InlineFragment"); | ||
} | ||
ignored(); | ||
n.push({ | ||
kind: "InlineFragment", | ||
typeCondition: o ? { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: o | ||
} | ||
} : void 0, | ||
directives: d, | ||
selectionSet: selectionSet() | ||
i.push({ | ||
kind: "FragmentSpread", | ||
name: nameNode(), | ||
directives: directives(!1) | ||
}); | ||
} | ||
} else if (null != (t = a[u.Name])) { | ||
var s = void 0; | ||
ignored(); | ||
if (58 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
s = t; | ||
if (null == (t = advance(i))) { | ||
throw error("Field"); | ||
} | ||
ignored(); | ||
} | ||
var v = arguments_(!1); | ||
ignored(); | ||
var c = directives(!1); | ||
var f = void 0; | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
f = selectionSet(); | ||
} | ||
n.push({ | ||
kind: "Field", | ||
alias: s ? { | ||
kind: "Name", | ||
value: s | ||
} : void 0, | ||
name: { | ||
kind: "Name", | ||
value: t | ||
}, | ||
arguments: v, | ||
directives: c, | ||
selectionSet: f | ||
break; | ||
case 123: | ||
r++, ignored(), i.push({ | ||
kind: "InlineFragment", | ||
typeCondition: void 0, | ||
directives: void 0, | ||
selectionSet: selectionSet() | ||
}); | ||
break; | ||
default: | ||
i.push({ | ||
kind: "FragmentSpread", | ||
name: nameNode(), | ||
directives: directives(!1) | ||
}); | ||
} | ||
} else { | ||
throw error("SelectionSet"); | ||
var n = nameNode(); | ||
var t = void 0; | ||
if (58 === e.charCodeAt(r)) { | ||
r++, ignored(), t = n, n = nameNode(); | ||
} | ||
var a = arguments_(!1); | ||
var o = directives(!1); | ||
var l = void 0; | ||
if (123 === e.charCodeAt(r)) { | ||
r++, ignored(), l = selectionSet(); | ||
} | ||
i.push({ | ||
kind: "Field", | ||
alias: t, | ||
name: n, | ||
arguments: a, | ||
directives: o, | ||
selectionSet: l | ||
}); | ||
} | ||
} while (125 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return { | ||
return r++, ignored(), { | ||
kind: "SelectionSet", | ||
selections: n | ||
selections: i | ||
}; | ||
} | ||
function variableDefinitions() { | ||
if (ignored(), 40 === e.charCodeAt(r)) { | ||
var i = []; | ||
r++, ignored(); | ||
do { | ||
if (36 !== e.charCodeAt(r++)) { | ||
throw error("Variable"); | ||
} | ||
var n = nameNode(); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("VariableDefinition"); | ||
} | ||
ignored(); | ||
var t = type(); | ||
var a = void 0; | ||
if (61 === e.charCodeAt(r)) { | ||
r++, ignored(), a = value(!0); | ||
} | ||
ignored(), i.push({ | ||
kind: "VariableDefinition", | ||
variable: { | ||
kind: "Variable", | ||
name: n | ||
}, | ||
type: t, | ||
defaultValue: a, | ||
directives: directives(!0) | ||
}); | ||
} while (41 !== e.charCodeAt(r)); | ||
return r++, ignored(), i; | ||
} | ||
} | ||
function fragmentDefinition() { | ||
var n; | ||
var t; | ||
if (null == (n = advance(i))) { | ||
var i = nameNode(); | ||
if (111 !== e.charCodeAt(r++) || 110 !== e.charCodeAt(r++)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if ("on" !== advance(i)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if (null == (t = advance(i))) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
var a = directives(!1); | ||
if (123 !== e.charCodeAt(r++)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
return { | ||
return ignored(), { | ||
kind: "FragmentDefinition", | ||
name: { | ||
kind: "Name", | ||
value: n | ||
}, | ||
name: i, | ||
typeCondition: { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: t | ||
} | ||
name: nameNode() | ||
}, | ||
directives: a, | ||
selectionSet: selectionSet() | ||
directives: directives(!1), | ||
selectionSet: selectionSetStart() | ||
}; | ||
} | ||
var d = /(?:query|mutation|subscription|fragment)/y; | ||
var a = {}; | ||
function operationDefinition(n) { | ||
var t; | ||
var a; | ||
var o; | ||
if (n) { | ||
ignored(); | ||
t = advance(i); | ||
a = function variableDefinitions() { | ||
ignored(); | ||
if (40 === e.charCodeAt(r)) { | ||
var n = []; | ||
r++; | ||
ignored(); | ||
var t; | ||
do { | ||
if (36 !== e.charCodeAt(r++)) { | ||
throw error("Variable"); | ||
} | ||
if (null == (t = advance(i))) { | ||
throw error("Variable"); | ||
} | ||
ignored(); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("VariableDefinition"); | ||
} | ||
ignored(); | ||
var a = type(); | ||
var o = void 0; | ||
if (61 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
o = value(!0); | ||
} | ||
ignored(); | ||
n.push({ | ||
kind: "VariableDefinition", | ||
variable: { | ||
kind: "Variable", | ||
name: { | ||
kind: "Name", | ||
value: t | ||
} | ||
}, | ||
type: a, | ||
defaultValue: o, | ||
directives: directives(!0) | ||
}); | ||
} while (41 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return n; | ||
} | ||
}(); | ||
o = directives(!1); | ||
} | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "OperationDefinition", | ||
operation: n || "query", | ||
name: t ? { | ||
kind: "Name", | ||
value: t | ||
} : void 0, | ||
variableDefinitions: a, | ||
directives: o, | ||
selectionSet: selectionSet() | ||
}; | ||
} | ||
} | ||
var s = {}; | ||
function mapJoin(e, r, n) { | ||
var i = ""; | ||
function mapJoin(e, r, i) { | ||
var n = ""; | ||
for (var t = 0; t < e.length; t++) { | ||
if (t) { | ||
i += r; | ||
n += r; | ||
} | ||
i += n(e[t]); | ||
n += i(e[t]); | ||
} | ||
return i; | ||
return n; | ||
} | ||
@@ -556,5 +475,5 @@ | ||
var v = "\n"; | ||
var o = "\n"; | ||
var c = { | ||
var l = { | ||
OperationDefinition(e) { | ||
@@ -569,11 +488,11 @@ var r = e.operation; | ||
} | ||
r += "(" + mapJoin(e.variableDefinitions, ", ", c.VariableDefinition) + ")"; | ||
r += "(" + mapJoin(e.variableDefinitions, ", ", l.VariableDefinition) + ")"; | ||
} | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
return "query" !== r ? r + " " + c.SelectionSet(e.selectionSet) : c.SelectionSet(e.selectionSet); | ||
return "query" !== r ? r + " " + l.SelectionSet(e.selectionSet) : l.SelectionSet(e.selectionSet); | ||
}, | ||
VariableDefinition(e) { | ||
var r = c.Variable(e.variable) + ": " + _print(e.type); | ||
var r = l.Variable(e.variable) + ": " + _print(e.type); | ||
if (e.defaultValue) { | ||
@@ -583,3 +502,3 @@ r += " = " + _print(e.defaultValue); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
@@ -591,14 +510,14 @@ return r; | ||
if (e.arguments && e.arguments.length) { | ||
var n = mapJoin(e.arguments, ", ", c.Argument); | ||
if (r.length + n.length + 2 > 80) { | ||
r += "(" + (v += " ") + mapJoin(e.arguments, v, c.Argument) + (v = v.slice(0, -2)) + ")"; | ||
var i = mapJoin(e.arguments, ", ", l.Argument); | ||
if (r.length + i.length + 2 > 80) { | ||
r += "(" + (o += " ") + mapJoin(e.arguments, o, l.Argument) + (o = o.slice(0, -2)) + ")"; | ||
} else { | ||
r += "(" + n + ")"; | ||
r += "(" + i + ")"; | ||
} | ||
} | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
if (e.selectionSet && e.selectionSet.selections.length) { | ||
r += " " + c.SelectionSet(e.selectionSet); | ||
r += " " + l.SelectionSet(e.selectionSet); | ||
} | ||
@@ -609,3 +528,3 @@ return r; | ||
if (e.block) { | ||
return printBlockString(e.value).replace(/\n/g, v); | ||
return printBlockString(e.value).replace(/\n/g, o); | ||
} else { | ||
@@ -623,3 +542,3 @@ return printString(e.value); | ||
ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]", | ||
ObjectValue: e => "{" + mapJoin(e.fields, ", ", c.ObjectField) + "}", | ||
ObjectValue: e => "{" + mapJoin(e.fields, ", ", l.ObjectField) + "}", | ||
ObjectField: e => e.name.value + ": " + _print(e.value), | ||
@@ -629,6 +548,7 @@ Document(e) { | ||
return ""; | ||
} else { | ||
return mapJoin(e.definitions, "\n\n", _print); | ||
} | ||
return mapJoin(e.definitions, "\n\n", _print); | ||
}, | ||
SelectionSet: e => "{" + (v += " ") + mapJoin(e.selections, v, _print) + (v = v.slice(0, -2)) + "}", | ||
SelectionSet: e => "{" + (o += " ") + mapJoin(e.selections, o, _print) + (o = o.slice(0, -2)) + "}", | ||
Argument: e => e.name.value + ": " + _print(e.value), | ||
@@ -638,3 +558,3 @@ FragmentSpread(e) { | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
@@ -649,13 +569,12 @@ return r; | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
return r += " " + c.SelectionSet(e.selectionSet); | ||
return r += " " + l.SelectionSet(e.selectionSet); | ||
}, | ||
FragmentDefinition(e) { | ||
var r = "fragment " + e.name.value; | ||
r += " on " + e.typeCondition.name.value; | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
if (r += " on " + e.typeCondition.name.value, e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", l.Directive); | ||
} | ||
return r + " " + c.SelectionSet(e.selectionSet); | ||
return r + " " + l.SelectionSet(e.selectionSet); | ||
}, | ||
@@ -665,3 +584,3 @@ Directive(e) { | ||
if (e.arguments && e.arguments.length) { | ||
r += "(" + mapJoin(e.arguments, ", ", c.Argument) + ")"; | ||
r += "(" + mapJoin(e.arguments, ", ", l.Argument) + ")"; | ||
} | ||
@@ -675,3 +594,3 @@ return r; | ||
var _print = e => c[e.kind](e); | ||
var _print = e => l[e.kind](e); | ||
@@ -695,7 +614,7 @@ function valueFromASTUntyped(e, r) { | ||
case "ListValue": | ||
var n = []; | ||
for (var i = 0, t = e.values.length; i < t; i++) { | ||
n.push(valueFromASTUntyped(e.values[i], r)); | ||
var i = []; | ||
for (var n = 0, t = e.values.length; n < t; n++) { | ||
i.push(valueFromASTUntyped(e.values[n], r)); | ||
} | ||
return n; | ||
return i; | ||
@@ -705,4 +624,4 @@ case "ObjectValue": | ||
for (var o = 0, l = e.fields.length; o < l; o++) { | ||
var u = e.fields[o]; | ||
a[u.name.value] = valueFromASTUntyped(u.value, r); | ||
var d = e.fields[o]; | ||
a[d.name.value] = valueFromASTUntyped(d.value, r); | ||
} | ||
@@ -716,7 +635,3 @@ return a; | ||
exports.BREAK = s; | ||
exports.GraphQLError = GraphQLError; | ||
exports.Kind = { | ||
exports.BREAK = a, exports.GraphQLError = GraphQLError, exports.Kind = { | ||
NAME: "Name", | ||
@@ -746,15 +661,11 @@ DOCUMENT: "Document", | ||
NON_NULL_TYPE: "NonNullType" | ||
}; | ||
exports.OperationTypeNode = { | ||
}, exports.OperationTypeNode = { | ||
QUERY: "query", | ||
MUTATION: "mutation", | ||
SUBSCRIPTION: "subscription" | ||
}; | ||
exports.Source = function Source(e, r, n) { | ||
}, exports.Source = function Source(e, r, i) { | ||
return { | ||
body: e, | ||
name: r, | ||
locationOffset: n || { | ||
locationOffset: i || { | ||
line: 1, | ||
@@ -764,36 +675,59 @@ column: 1 | ||
}; | ||
}; | ||
exports.isSelectionNode = function isSelectionNode(e) { | ||
}, exports.isSelectionNode = function isSelectionNode(e) { | ||
return "Field" === e.kind || "FragmentSpread" === e.kind || "InlineFragment" === e.kind; | ||
}; | ||
exports.parse = function parse(n, i) { | ||
r = 0; | ||
return function document(e, n) { | ||
var i; | ||
var t; | ||
}, exports.parse = function parse(i, n) { | ||
return r = 0, function document(e, i) { | ||
ignored(); | ||
var a = []; | ||
var n = []; | ||
do { | ||
if ("fragment" === (i = advance(d))) { | ||
ignored(); | ||
a.push(fragmentDefinition()); | ||
} else if (null != (t = operationDefinition(i))) { | ||
a.push(t); | ||
if (123 === e.charCodeAt(r)) { | ||
n.push({ | ||
kind: "OperationDefinition", | ||
operation: "query", | ||
name: void 0, | ||
variableDefinitions: void 0, | ||
directives: void 0, | ||
selectionSet: selectionSetStart() | ||
}); | ||
} else { | ||
throw error("Document"); | ||
var t = name(); | ||
switch (t) { | ||
case "fragment": | ||
n.push(fragmentDefinition()); | ||
break; | ||
case "query": | ||
case "mutation": | ||
case "subscription": | ||
var a; | ||
var o = void 0; | ||
if (40 !== (a = e.charCodeAt(r)) && 64 !== a && 123 !== a) { | ||
o = nameNode(); | ||
} | ||
n.push({ | ||
kind: "OperationDefinition", | ||
operation: t, | ||
name: o, | ||
variableDefinitions: variableDefinitions(), | ||
directives: directives(!1), | ||
selectionSet: selectionSetStart() | ||
}); | ||
break; | ||
default: | ||
throw error("Document"); | ||
} | ||
} | ||
} while (r < e.length); | ||
if (!n) { | ||
var o; | ||
if (!i) { | ||
var l; | ||
return { | ||
kind: "Document", | ||
definitions: a, | ||
definitions: n, | ||
set loc(e) { | ||
o = e; | ||
l = e; | ||
}, | ||
get loc() { | ||
if (!o) { | ||
o = { | ||
if (!l) { | ||
l = { | ||
start: 0, | ||
@@ -813,3 +747,3 @@ end: e.length, | ||
} | ||
return o; | ||
return l; | ||
} | ||
@@ -820,36 +754,17 @@ }; | ||
kind: "Document", | ||
definitions: a | ||
definitions: n | ||
}; | ||
}(e = "string" == typeof n.body ? n.body : n, i && i.noLocation); | ||
}; | ||
exports.parseType = function parseType(n, i) { | ||
e = "string" == typeof n.body ? n.body : n; | ||
r = 0; | ||
return type(); | ||
}; | ||
exports.parseValue = function parseValue(n, i) { | ||
e = "string" == typeof n.body ? n.body : n; | ||
r = 0; | ||
ignored(); | ||
return value(!1); | ||
}; | ||
exports.print = function print(e) { | ||
v = "\n"; | ||
return c[e.kind] ? c[e.kind](e) : ""; | ||
}; | ||
exports.printBlockString = printBlockString; | ||
exports.printString = printString; | ||
exports.valueFromASTUntyped = valueFromASTUntyped; | ||
exports.valueFromTypeNode = function valueFromTypeNode(e, r, n) { | ||
}(e = i.body ? i.body : i, n && n.noLocation); | ||
}, exports.parseType = function parseType(i, n) { | ||
return e = i.body ? i.body : i, r = 0, type(); | ||
}, exports.parseValue = function parseValue(i, n) { | ||
return e = i.body ? i.body : i, r = 0, ignored(), value(!1); | ||
}, exports.print = function print(e) { | ||
return o = "\n", l[e.kind] ? l[e.kind](e) : ""; | ||
}, exports.printBlockString = printBlockString, exports.printString = printString, | ||
exports.valueFromASTUntyped = valueFromASTUntyped, exports.valueFromTypeNode = function valueFromTypeNode(e, r, i) { | ||
if ("Variable" === e.kind) { | ||
return n ? valueFromTypeNode(n[e.name.value], r, n) : void 0; | ||
return i ? valueFromTypeNode(i[e.name.value], r, i) : void 0; | ||
} else if ("NonNullType" === r.kind) { | ||
return "NullValue" !== e.kind ? valueFromTypeNode(e, r, n) : void 0; | ||
return "NullValue" !== e.kind ? valueFromTypeNode(e, r, i) : void 0; | ||
} else if ("NullValue" === e.kind) { | ||
@@ -859,12 +774,12 @@ return null; | ||
if ("ListValue" === e.kind) { | ||
var i = []; | ||
var n = []; | ||
for (var t = 0, a = e.values.length; t < a; t++) { | ||
var o = valueFromTypeNode(e.values[t], r.type, n); | ||
var o = valueFromTypeNode(e.values[t], r.type, i); | ||
if (void 0 === o) { | ||
return; | ||
} else { | ||
i.push(o); | ||
n.push(o); | ||
} | ||
} | ||
return i; | ||
return n; | ||
} | ||
@@ -877,18 +792,16 @@ } else if ("NamedType" === r.kind) { | ||
case "Bool": | ||
return r.name.value + "Value" === e.kind ? valueFromASTUntyped(e, n) : void 0; | ||
return r.name.value + "Value" === e.kind ? valueFromASTUntyped(e, i) : void 0; | ||
default: | ||
return valueFromASTUntyped(e, n); | ||
return valueFromASTUntyped(e, i); | ||
} | ||
} | ||
}; | ||
exports.visit = function visit(e, r) { | ||
}, exports.visit = function visit(e, r) { | ||
var i = []; | ||
var n = []; | ||
var i = []; | ||
try { | ||
var t = function traverse(e, t, a) { | ||
var o = !1; | ||
var l = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter; | ||
var u = l && l.call(r, e, t, a, i, n); | ||
var t = function traverse(e, t, o) { | ||
var l = !1; | ||
var d = r[e.kind] && r[e.kind].enter || r[e.kind] || r.enter; | ||
var u = d && d.call(r, e, t, o, n, i); | ||
if (!1 === u) { | ||
@@ -898,32 +811,25 @@ return e; | ||
return null; | ||
} else if (u === s) { | ||
throw s; | ||
} else if (u === a) { | ||
throw a; | ||
} else if (u && "string" == typeof u.kind) { | ||
o = u !== e; | ||
e = u; | ||
l = u !== e, e = u; | ||
} | ||
if (a) { | ||
n.push(a); | ||
if (o) { | ||
i.push(o); | ||
} | ||
var d; | ||
var v = { | ||
var s; | ||
var c = { | ||
...e | ||
}; | ||
for (var c in e) { | ||
i.push(c); | ||
var f = e[c]; | ||
for (var v in e) { | ||
n.push(v); | ||
var f = e[v]; | ||
if (Array.isArray(f)) { | ||
var p = []; | ||
for (var g = 0; g < f.length; g++) { | ||
if (null != f[g] && "string" == typeof f[g].kind) { | ||
n.push(e); | ||
i.push(g); | ||
d = traverse(f[g], g, f); | ||
i.pop(); | ||
n.pop(); | ||
if (null == d) { | ||
o = !0; | ||
for (var m = 0; m < f.length; m++) { | ||
if (null != f[m] && "string" == typeof f[m].kind) { | ||
if (i.push(e), n.push(m), s = traverse(f[m], m, f), n.pop(), i.pop(), null == s) { | ||
l = !0; | ||
} else { | ||
o = o || d !== f[g]; | ||
p.push(d); | ||
l = l || s !== f[m], p.push(s); | ||
} | ||
@@ -934,25 +840,23 @@ } | ||
} else if (null != f && "string" == typeof f.kind) { | ||
if (void 0 !== (d = traverse(f, c, e))) { | ||
o = o || f !== d; | ||
f = d; | ||
if (void 0 !== (s = traverse(f, v, e))) { | ||
l = l || f !== s, f = s; | ||
} | ||
} | ||
i.pop(); | ||
if (o) { | ||
v[c] = f; | ||
if (n.pop(), l) { | ||
c[v] = f; | ||
} | ||
} | ||
if (a) { | ||
n.pop(); | ||
if (o) { | ||
i.pop(); | ||
} | ||
var m = r[e.kind] && r[e.kind].leave || r.leave; | ||
var h = m && m.call(r, e, t, a, i, n); | ||
if (h === s) { | ||
throw s; | ||
} else if (void 0 !== h) { | ||
return h; | ||
var h = r[e.kind] && r[e.kind].leave || r.leave; | ||
var g = h && h.call(r, e, t, o, n, i); | ||
if (g === a) { | ||
throw a; | ||
} else if (void 0 !== g) { | ||
return g; | ||
} else if (void 0 !== u) { | ||
return o ? v : u; | ||
return l ? c : u; | ||
} else { | ||
return o ? v : e; | ||
return l ? c : e; | ||
} | ||
@@ -962,3 +866,3 @@ }(e); | ||
} catch (r) { | ||
if (r !== s) { | ||
if (r !== a) { | ||
throw r; | ||
@@ -965,0 +869,0 @@ } |
{ | ||
"name": "@0no-co/graphql.web", | ||
"description": "A spec-compliant client-side GraphQL implementation", | ||
"version": "1.0.13", | ||
"version": "1.1.0-canary-2984e7be4859ae53671646c15d1df5943c34199b", | ||
"author": "0no.co <hi@0no.co>", | ||
@@ -6,0 +6,0 @@ "source": "./src/index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
173061
2410
2