@0no-co/graphql.web
Advanced tools
Comparing version 1.0.5-canary-3f3b440609b30b6a7775f617f6df419b1d306731 to 1.0.5-canary-4f3e17a22d40020aa6a052eb44dd76753fad2825
@@ -534,3 +534,3 @@ /*!@ts-ignore*/ | ||
type StringValueNode = Or< | ||
GraphQL.FloatValueNode, | ||
GraphQL.StringValueNode, | ||
{ | ||
@@ -537,0 +537,0 @@ readonly kind: Kind.STRING; |
@@ -101,138 +101,129 @@ Object.defineProperty(exports, "__esModule", { | ||
function name() { | ||
var e; | ||
if (e = advance(n)) { | ||
return { | ||
kind: "Name", | ||
value: e | ||
}; | ||
} | ||
} | ||
var t = new RegExp("(?:(null|true|false)|\\$(" + n.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + n.source + "))", "y"); | ||
var t = /(?:null|true|false)/y; | ||
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 a = /\$[_A-Za-z]\w*/y; | ||
var o = /\\/g; | ||
var o = /-?\d+/y; | ||
var l = /(?:\.\d+)?[eE][+-]?\d+|\.\d+/y; | ||
var u = /\\/g; | ||
var v = /"""(?:"""|(?:[\s\S]*?[^\\])""")/y; | ||
var d = /"(?:"|[^\r\n]*?[^\\]")/y; | ||
function value(i) { | ||
var s; | ||
var c; | ||
if (c = advance(t)) { | ||
s = "null" === c ? { | ||
kind: "NullValue" | ||
} : { | ||
kind: "BooleanValue", | ||
value: "true" === c | ||
var l; | ||
var u; | ||
t.lastIndex = r; | ||
if (91 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var d = []; | ||
while (93 !== e.charCodeAt(r)) { | ||
d.push(value(i)); | ||
} | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "ListValue", | ||
values: d | ||
}; | ||
} else if (!i && (c = advance(a))) { | ||
s = { | ||
kind: "Variable", | ||
name: { | ||
kind: "Name", | ||
value: c.slice(1) | ||
} else if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var s = []; | ||
while (125 !== e.charCodeAt(r)) { | ||
if (null == (l = advance(n))) { | ||
throw error("ObjectField"); | ||
} | ||
}; | ||
} else if (c = advance(o)) { | ||
var f = c; | ||
if (c = advance(l)) { | ||
s = { | ||
kind: "FloatValue", | ||
value: f + c | ||
}; | ||
} else { | ||
s = { | ||
kind: "IntValue", | ||
value: f | ||
}; | ||
} | ||
} else if (c = advance(n)) { | ||
s = { | ||
kind: "EnumValue", | ||
value: c | ||
}; | ||
} else if (c = advance(v)) { | ||
s = { | ||
kind: "StringValue", | ||
value: blockString(c.slice(3, -3)), | ||
block: !0 | ||
}; | ||
} else if (c = advance(d)) { | ||
s = { | ||
kind: "StringValue", | ||
value: u.test(c) ? JSON.parse(c) : c.slice(1, -1), | ||
block: !1 | ||
}; | ||
} else if (s = function list(i) { | ||
var n; | ||
if (91 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var t = []; | ||
while (n = value(i)) { | ||
t.push(n); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("ObjectField"); | ||
} | ||
if (93 !== e.charCodeAt(r++)) { | ||
throw error("ListValue"); | ||
} | ||
ignored(); | ||
return { | ||
kind: "ListValue", | ||
values: t | ||
s.push({ | ||
kind: "ObjectField", | ||
name: { | ||
kind: "Name", | ||
value: l | ||
}, | ||
value: value(i) | ||
}); | ||
} | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "ObjectValue", | ||
fields: s | ||
}; | ||
} 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 | ||
}; | ||
} | ||
}(i) || function object(i) { | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var n = []; | ||
var t; | ||
while (t = name()) { | ||
ignored(); | ||
if (58 !== e.charCodeAt(r++)) { | ||
throw error("ObjectField"); | ||
} | ||
ignored(); | ||
var a = value(i); | ||
if (!a) { | ||
throw error("ObjectField"); | ||
} | ||
n.push({ | ||
kind: "ObjectField", | ||
name: t, | ||
value: a | ||
}); | ||
} else if (null != (l = u[a.Var])) { | ||
if (i) { | ||
throw error("Variable"); | ||
} else { | ||
return { | ||
kind: "Variable", | ||
name: { | ||
kind: "Name", | ||
value: l | ||
} | ||
}; | ||
} | ||
if (125 !== e.charCodeAt(r++)) { | ||
throw error("ObjectValue"); | ||
} 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 | ||
}; | ||
} | ||
ignored(); | ||
} else if (null != (l = u[a.BlockString])) { | ||
return { | ||
kind: "ObjectValue", | ||
fields: n | ||
kind: "StringValue", | ||
value: blockString(l.slice(3, -3)), | ||
block: !0 | ||
}; | ||
} else if (null != (l = u[a.String])) { | ||
return { | ||
kind: "StringValue", | ||
value: o.test(l) ? JSON.parse(l) : l.slice(1, -1), | ||
block: !1 | ||
}; | ||
} else if (null != (l = u[a.Enum])) { | ||
return { | ||
kind: "EnumValue", | ||
value: l | ||
}; | ||
} | ||
}(i)) { | ||
return s; | ||
} | ||
ignored(); | ||
return s; | ||
throw error("Value"); | ||
} | ||
function arguments_(i) { | ||
var n = []; | ||
ignored(); | ||
if (40 === e.charCodeAt(r)) { | ||
var t = []; | ||
r++; | ||
ignored(); | ||
var t; | ||
while (t = name()) { | ||
var a; | ||
do { | ||
if (null == (a = advance(n))) { | ||
throw error("Argument"); | ||
} | ||
ignored(); | ||
@@ -243,61 +234,37 @@ if (58 !== e.charCodeAt(r++)) { | ||
ignored(); | ||
var a = value(i); | ||
if (!a) { | ||
throw error("Argument"); | ||
} | ||
n.push({ | ||
t.push({ | ||
kind: "Argument", | ||
name: t, | ||
value: a | ||
name: { | ||
kind: "Name", | ||
value: a | ||
}, | ||
value: value(i) | ||
}); | ||
} | ||
if (!n.length || 41 !== e.charCodeAt(r++)) { | ||
throw error("Argument"); | ||
} | ||
} while (41 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return t; | ||
} | ||
return n; | ||
} | ||
function directives(i) { | ||
var n = []; | ||
ignored(); | ||
while (64 === e.charCodeAt(r)) { | ||
r++; | ||
var t = name(); | ||
if (!t) { | ||
throw error("Directive"); | ||
} | ||
ignored(); | ||
n.push({ | ||
kind: "Directive", | ||
name: t, | ||
arguments: arguments_(i) | ||
}); | ||
} | ||
return n; | ||
} | ||
function field() { | ||
var i = name(); | ||
if (i) { | ||
ignored(); | ||
var n; | ||
if (58 === e.charCodeAt(r)) { | ||
if (64 === e.charCodeAt(r)) { | ||
var t = []; | ||
var a; | ||
do { | ||
r++; | ||
ignored(); | ||
n = i; | ||
if (!(i = name())) { | ||
throw error("Field"); | ||
if (null == (a = advance(n))) { | ||
throw error("Directive"); | ||
} | ||
ignored(); | ||
} | ||
return { | ||
kind: "Field", | ||
alias: n, | ||
name: i, | ||
arguments: arguments_(!1), | ||
directives: directives(!1), | ||
selectionSet: selectionSet() | ||
}; | ||
t.push({ | ||
kind: "Directive", | ||
name: { | ||
kind: "Name", | ||
value: a | ||
}, | ||
arguments: arguments_(i) | ||
}); | ||
} while (64 === e.charCodeAt(r)); | ||
return t; | ||
} | ||
@@ -308,151 +275,205 @@ } | ||
var i; | ||
ignored(); | ||
if (91 === e.charCodeAt(r)) { | ||
var t = 0; | ||
while (91 === e.charCodeAt(r)) { | ||
t++; | ||
r++; | ||
ignored(); | ||
var n = type(); | ||
if (!n || 93 !== e.charCodeAt(r++)) { | ||
throw error("ListType"); | ||
} | ||
i = { | ||
kind: "ListType", | ||
type: n | ||
}; | ||
} else if (i = name()) { | ||
i = { | ||
kind: "NamedType", | ||
name: i | ||
}; | ||
} else { | ||
} | ||
if (null == (i = advance(n))) { | ||
throw error("NamedType"); | ||
} | ||
ignored(); | ||
if (33 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "NonNullType", | ||
type: i | ||
}; | ||
} else { | ||
return i; | ||
} | ||
} | ||
var s = /on/y; | ||
function typeCondition() { | ||
if (advance(s)) { | ||
ignored(); | ||
var e = name(); | ||
if (!e) { | ||
throw error("NamedType"); | ||
var a = { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: i | ||
} | ||
ignored(); | ||
return { | ||
kind: "NamedType", | ||
name: e | ||
}; | ||
} | ||
} | ||
var c = /\.\.\./y; | ||
function fragmentSpread() { | ||
if (advance(c)) { | ||
ignored(); | ||
var e = r; | ||
var i; | ||
if ((i = name()) && "on" !== i.value) { | ||
return { | ||
kind: "FragmentSpread", | ||
name: i, | ||
directives: directives(!1) | ||
}; | ||
do { | ||
if (33 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
a = { | ||
kind: "NonNullType", | ||
type: a | ||
}; | ||
} else { | ||
r = e; | ||
var n = typeCondition(); | ||
var t = directives(!1); | ||
var a = selectionSet(); | ||
if (!a) { | ||
throw error("InlineFragment"); | ||
} | ||
if (t) { | ||
if (93 !== e.charCodeAt(r++)) { | ||
throw error("NamedType"); | ||
} | ||
return { | ||
kind: "InlineFragment", | ||
typeCondition: n, | ||
directives: t, | ||
selectionSet: a | ||
ignored(); | ||
a = { | ||
kind: "ListType", | ||
type: a | ||
}; | ||
} | ||
} | ||
} while (t--); | ||
return a; | ||
} | ||
var l = new RegExp("(?:(\\.{3})|(" + n.source + "))", "y"); | ||
var u = function(e) { | ||
e[e.Spread = 1] = "Spread"; | ||
e[e.Name = 2] = "Name"; | ||
return e; | ||
}(u || {}); | ||
function selectionSet() { | ||
var i; | ||
ignored(); | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
var n = []; | ||
while (i = fragmentSpread() || field()) { | ||
n.push(i); | ||
} | ||
if (!n.length || 125 !== e.charCodeAt(r++)) { | ||
var i = []; | ||
var t; | ||
var a; | ||
do { | ||
l.lastIndex = r; | ||
if (null != (a = l.exec(e))) { | ||
r = l.lastIndex; | ||
if (null != a[u.Spread]) { | ||
ignored(); | ||
var o = advance(n); | ||
if (null != o && "on" !== o) { | ||
ignored(); | ||
i.push({ | ||
kind: "FragmentSpread", | ||
name: { | ||
kind: "Name", | ||
value: o | ||
}, | ||
directives: directives(!1) | ||
}); | ||
} else { | ||
ignored(); | ||
if ("on" === o) { | ||
if (null == (o = advance(n))) { | ||
throw error("NamedType"); | ||
} | ||
ignored(); | ||
} | ||
var d = directives(!1); | ||
if (123 !== e.charCodeAt(r++)) { | ||
throw error("InlineFragment"); | ||
} | ||
ignored(); | ||
i.push({ | ||
kind: "InlineFragment", | ||
typeCondition: o ? { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: o | ||
} | ||
} : void 0, | ||
directives: d, | ||
selectionSet: selectionSet() | ||
}); | ||
} | ||
} 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(n))) { | ||
throw error("Field"); | ||
} | ||
} | ||
var v = arguments_(!1); | ||
ignored(); | ||
var c = directives(!1); | ||
var f = void 0; | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
f = selectionSet(); | ||
} | ||
i.push({ | ||
kind: "Field", | ||
alias: s ? { | ||
kind: "Name", | ||
value: s | ||
} : void 0, | ||
name: { | ||
kind: "Name", | ||
value: t | ||
}, | ||
arguments: v, | ||
directives: c, | ||
selectionSet: f | ||
}); | ||
} | ||
} else { | ||
throw error("SelectionSet"); | ||
} | ||
ignored(); | ||
return { | ||
kind: "SelectionSet", | ||
selections: n | ||
}; | ||
} | ||
} while (125 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "SelectionSet", | ||
selections: i | ||
}; | ||
} | ||
var f = /fragment/y; | ||
function fragmentDefinition() { | ||
if (advance(f)) { | ||
ignored(); | ||
var e = name(); | ||
if (!e) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
var r = typeCondition(); | ||
if (!r) { | ||
throw error("FragmentDefinition"); | ||
} | ||
var i = directives(!1); | ||
var n = selectionSet(); | ||
if (!n) { | ||
throw error("FragmentDefinition"); | ||
} | ||
return { | ||
kind: "FragmentDefinition", | ||
name: e, | ||
typeCondition: r, | ||
directives: i, | ||
selectionSet: n | ||
}; | ||
var i; | ||
var t; | ||
if (null == (i = advance(n))) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if ("on" !== advance(n)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if (null == (t = advance(n))) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
var a = directives(!1); | ||
if (123 !== e.charCodeAt(r++)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
return { | ||
kind: "FragmentDefinition", | ||
name: { | ||
kind: "Name", | ||
value: i | ||
}, | ||
typeCondition: { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: t | ||
} | ||
}, | ||
directives: a, | ||
selectionSet: selectionSet() | ||
}; | ||
} | ||
var p = /(?:query|mutation|subscription)/y; | ||
var d = /(?:query|mutation|subscription|fragment)/y; | ||
function operationDefinition() { | ||
var i; | ||
var n; | ||
var t = []; | ||
var o = []; | ||
if (i = advance(p)) { | ||
function operationDefinition(i) { | ||
var t; | ||
var a; | ||
var o; | ||
if (i) { | ||
ignored(); | ||
n = name(); | ||
t = function variableDefinitions() { | ||
var i; | ||
var n = []; | ||
t = advance(n); | ||
a = function variableDefinitions() { | ||
ignored(); | ||
if (40 === e.charCodeAt(r)) { | ||
var i = []; | ||
r++; | ||
ignored(); | ||
while (i = advance(a)) { | ||
var t; | ||
do { | ||
if (36 !== e.charCodeAt(r++)) { | ||
throw error("Variable"); | ||
} | ||
if (null == (t = advance(n))) { | ||
throw error("Variable"); | ||
} | ||
ignored(); | ||
@@ -462,3 +483,4 @@ if (58 !== e.charCodeAt(r++)) { | ||
} | ||
var t = type(); | ||
ignored(); | ||
var a = type(); | ||
var o = void 0; | ||
@@ -468,8 +490,6 @@ if (61 === e.charCodeAt(r)) { | ||
ignored(); | ||
if (!(o = value(!0))) { | ||
throw error("VariableDefinition"); | ||
} | ||
o = value(!0); | ||
} | ||
ignored(); | ||
n.push({ | ||
i.push({ | ||
kind: "VariableDefinition", | ||
@@ -480,28 +500,30 @@ variable: { | ||
kind: "Name", | ||
value: i.slice(1) | ||
value: t | ||
} | ||
}, | ||
type: t, | ||
type: a, | ||
defaultValue: o, | ||
directives: directives(!0) | ||
}); | ||
} | ||
if (41 !== e.charCodeAt(r++)) { | ||
throw error("VariableDefinition"); | ||
} | ||
} while (41 !== e.charCodeAt(r)); | ||
r++; | ||
ignored(); | ||
return i; | ||
} | ||
return n; | ||
}(); | ||
o = directives(!1); | ||
} | ||
var l = selectionSet(); | ||
if (l) { | ||
if (123 === e.charCodeAt(r)) { | ||
r++; | ||
ignored(); | ||
return { | ||
kind: "OperationDefinition", | ||
operation: i || "query", | ||
name: n, | ||
variableDefinitions: t, | ||
name: t ? { | ||
kind: "Name", | ||
value: t | ||
} : void 0, | ||
variableDefinitions: a, | ||
directives: o, | ||
selectionSet: l | ||
selectionSet: selectionSet() | ||
}; | ||
@@ -511,4 +533,15 @@ } | ||
var m = {}; | ||
var s = {}; | ||
function mapJoin(e, r, i) { | ||
var n = ""; | ||
for (var t = 0; t < e.length; t++) { | ||
if (t) { | ||
n += r; | ||
} | ||
n += i(e[t]); | ||
} | ||
return n; | ||
} | ||
function printString(e) { | ||
@@ -522,9 +555,6 @@ return JSON.stringify(e); | ||
var hasItems = e => !(!e || !e.length); | ||
var v = "\n"; | ||
var g = { | ||
var c = { | ||
OperationDefinition(e) { | ||
if ("query" === e.operation && !e.name && !hasItems(e.variableDefinitions) && !hasItems(e.directives)) { | ||
return g.SelectionSet(e.selectionSet); | ||
} | ||
var r = e.operation; | ||
@@ -534,20 +564,20 @@ if (e.name) { | ||
} | ||
if (hasItems(e.variableDefinitions)) { | ||
if (e.variableDefinitions && e.variableDefinitions.length) { | ||
if (!e.name) { | ||
r += " "; | ||
} | ||
r += "(" + e.variableDefinitions.map(g.VariableDefinition).join(", ") + ")"; | ||
r += "(" + mapJoin(e.variableDefinitions, ", ", c.VariableDefinition) + ")"; | ||
} | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
return r + " " + g.SelectionSet(e.selectionSet); | ||
return "query" !== r ? r + " " + c.SelectionSet(e.selectionSet) : c.SelectionSet(e.selectionSet); | ||
}, | ||
VariableDefinition(e) { | ||
var r = g.Variable(e.variable) + ": " + print(e.type); | ||
var r = c.Variable(e.variable) + ": " + _print(e.type); | ||
if (e.defaultValue) { | ||
r += " = " + print(e.defaultValue); | ||
r += " = " + _print(e.defaultValue); | ||
} | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
@@ -557,14 +587,26 @@ return r; | ||
Field(e) { | ||
var r = (e.alias ? e.alias.value + ": " : "") + e.name.value; | ||
if (hasItems(e.arguments)) { | ||
var i = e.arguments.map(g.Argument); | ||
var n = r + "(" + i.join(", ") + ")"; | ||
r = n.length > 80 ? r + "(\n " + i.join("\n").replace(/\n/g, "\n ") + "\n)" : n; | ||
var r = e.alias ? e.alias.value + ": " + e.name.value : e.name.value; | ||
if (e.arguments && e.arguments.length) { | ||
var i = mapJoin(e.arguments, ", ", c.Argument); | ||
if (r.length + i.length + 2 > 80) { | ||
r += "(" + (v += " ") + mapJoin(e.arguments, v, c.Argument) + (v = v.slice(0, -2)) + ")"; | ||
} else { | ||
r += "(" + i + ")"; | ||
} | ||
} | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
return e.selectionSet ? r + " " + g.SelectionSet(e.selectionSet) : r; | ||
if (e.selectionSet) { | ||
r += " " + c.SelectionSet(e.selectionSet); | ||
} | ||
return r; | ||
}, | ||
StringValue: e => e.block ? printBlockString(e.value) : printString(e.value), | ||
StringValue(e) { | ||
if (e.block) { | ||
return printBlockString(e.value).replace(/\n/g, v); | ||
} else { | ||
return printString(e.value); | ||
} | ||
}, | ||
BooleanValue: e => "" + e.value, | ||
@@ -577,12 +619,17 @@ NullValue: e => "null", | ||
Variable: e => "$" + e.name.value, | ||
ListValue: e => "[" + e.values.map(print).join(", ") + "]", | ||
ObjectValue: e => "{" + e.fields.map(g.ObjectField).join(", ") + "}", | ||
ObjectField: e => e.name.value + ": " + print(e.value), | ||
Document: e => hasItems(e.definitions) ? e.definitions.map(print).join("\n\n") : "", | ||
SelectionSet: e => "{\n " + e.selections.map(print).join("\n").replace(/\n/g, "\n ") + "\n}", | ||
Argument: e => e.name.value + ": " + print(e.value), | ||
ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]", | ||
ObjectValue: e => "{" + mapJoin(e.fields, ", ", c.ObjectField) + "}", | ||
ObjectField: e => e.name.value + ": " + _print(e.value), | ||
Document(e) { | ||
if (!e.definitions || !e.definitions.length) { | ||
return ""; | ||
} | ||
return mapJoin(e.definitions, "\n\n", _print); | ||
}, | ||
SelectionSet: e => "{" + (v += " ") + mapJoin(e.selections, v, _print) + (v = v.slice(0, -2)) + "}", | ||
Argument: e => e.name.value + ": " + _print(e.value), | ||
FragmentSpread(e) { | ||
var r = "..." + e.name.value; | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
@@ -596,6 +643,6 @@ return r; | ||
} | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
return r + " " + print(e.selectionSet); | ||
return r += " " + c.SelectionSet(e.selectionSet); | ||
}, | ||
@@ -605,11 +652,11 @@ FragmentDefinition(e) { | ||
r += " on " + e.typeCondition.name.value; | ||
if (hasItems(e.directives)) { | ||
r += " " + e.directives.map(g.Directive).join(" "); | ||
if (e.directives && e.directives.length) { | ||
r += " " + mapJoin(e.directives, " ", c.Directive); | ||
} | ||
return r + " " + print(e.selectionSet); | ||
return r + " " + c.SelectionSet(e.selectionSet); | ||
}, | ||
Directive(e) { | ||
var r = "@" + e.name.value; | ||
if (hasItems(e.arguments)) { | ||
r += "(" + e.arguments.map(g.Argument).join(", ") + ")"; | ||
if (e.arguments && e.arguments.length) { | ||
r += "(" + mapJoin(e.arguments, ", ", c.Argument) + ")"; | ||
} | ||
@@ -619,9 +666,7 @@ return r; | ||
NamedType: e => e.name.value, | ||
ListType: e => "[" + print(e.type) + "]", | ||
NonNullType: e => print(e.type) + "!" | ||
ListType: e => "[" + _print(e.type) + "]", | ||
NonNullType: e => _print(e.type) + "!" | ||
}; | ||
function print(e) { | ||
return g[e.kind] ? g[e.kind](e) : ""; | ||
} | ||
var _print = e => c[e.kind](e); | ||
@@ -663,3 +708,3 @@ function valueFromASTUntyped(e, r) { | ||
exports.BREAK = m; | ||
exports.BREAK = s; | ||
@@ -705,11 +750,19 @@ exports.GraphQLError = GraphQLError; | ||
return function document() { | ||
var e; | ||
var i; | ||
var n; | ||
ignored(); | ||
var r = []; | ||
while (e = fragmentDefinition() || operationDefinition()) { | ||
r.push(e); | ||
} | ||
var t = []; | ||
do { | ||
if ("fragment" === (i = advance(d))) { | ||
ignored(); | ||
t.push(fragmentDefinition()); | ||
} else if (null != (n = operationDefinition(i))) { | ||
t.push(n); | ||
} else { | ||
throw error("Document"); | ||
} | ||
} while (r < e.length); | ||
return { | ||
kind: "Document", | ||
definitions: r | ||
definitions: t | ||
}; | ||
@@ -729,10 +782,9 @@ }(); | ||
ignored(); | ||
var t = value(!1); | ||
if (!t) { | ||
throw error("ValueNode"); | ||
} | ||
return t; | ||
return value(!1); | ||
}; | ||
exports.print = print; | ||
exports.print = function print(e) { | ||
v = "\n"; | ||
return c[e.kind] ? c[e.kind](e) : ""; | ||
}; | ||
@@ -791,4 +843,4 @@ exports.printBlockString = printBlockString; | ||
return null; | ||
} else if (u === m) { | ||
throw m; | ||
} else if (u === s) { | ||
throw s; | ||
} else if (u && "string" == typeof u.kind) { | ||
@@ -801,31 +853,31 @@ o = u !== e; | ||
} | ||
var v; | ||
var d = { | ||
var d; | ||
var v = { | ||
...e | ||
}; | ||
for (var s in e) { | ||
n.push(s); | ||
var c = e[s]; | ||
if (Array.isArray(c)) { | ||
var f = []; | ||
for (var p = 0; p < c.length; p++) { | ||
if (null != c[p] && "string" == typeof c[p].kind) { | ||
for (var c in e) { | ||
n.push(c); | ||
var f = e[c]; | ||
if (Array.isArray(f)) { | ||
var p = []; | ||
for (var m = 0; m < f.length; m++) { | ||
if (null != f[m] && "string" == typeof f[m].kind) { | ||
i.push(e); | ||
n.push(p); | ||
v = traverse(c[p], p, c); | ||
n.push(m); | ||
d = traverse(f[m], m, f); | ||
n.pop(); | ||
i.pop(); | ||
if (null == v) { | ||
if (null == d) { | ||
o = !0; | ||
} else { | ||
o = o || v !== c[p]; | ||
f.push(v); | ||
o = o || d !== f[m]; | ||
p.push(d); | ||
} | ||
} | ||
} | ||
c = f; | ||
} else if (null != c && "string" == typeof c.kind) { | ||
if (void 0 !== (v = traverse(c, s, e))) { | ||
o = o || c !== v; | ||
c = v; | ||
f = p; | ||
} else if (null != f && "string" == typeof f.kind) { | ||
if (void 0 !== (d = traverse(f, c, e))) { | ||
o = o || f !== d; | ||
f = d; | ||
} | ||
@@ -835,3 +887,3 @@ } | ||
if (o) { | ||
d[s] = c; | ||
v[c] = f; | ||
} | ||
@@ -844,10 +896,10 @@ } | ||
var h = g && g.call(r, e, t, a, n, i); | ||
if (h === m) { | ||
throw m; | ||
if (h === s) { | ||
throw s; | ||
} else if (void 0 !== h) { | ||
return h; | ||
} else if (void 0 !== u) { | ||
return o ? d : u; | ||
return o ? v : u; | ||
} else { | ||
return o ? d : e; | ||
return o ? v : e; | ||
} | ||
@@ -857,3 +909,3 @@ }(e); | ||
} catch (r) { | ||
if (r !== m) { | ||
if (r !== s) { | ||
throw r; | ||
@@ -860,0 +912,0 @@ } |
{ | ||
"name": "@0no-co/graphql.web", | ||
"description": "A spec-compliant client-side GraphQL implementation", | ||
"version": "1.0.5-canary-3f3b440609b30b6a7775f617f6df419b1d306731", | ||
"version": "1.0.5-canary-4f3e17a22d40020aa6a052eb44dd76753fad2825", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170255
2492