@launchdarkly/session-replay
Version:
Browser observability for your web app. Record session replays to visualize usage patterns.
1,753 lines (1,748 loc) • 557 kB
JavaScript
var ou = Object.defineProperty, lu = (e, t, i) => t in e ? ou(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, He = (e, t, i) => lu(e, typeof t != "symbol" ? t + "" : t, i), au = (e, t, i) => new Promise((n, s) => {
var r = (a) => {
try {
o(i.next(a));
} catch (c) {
s(c);
}
}, l = (a) => {
try {
o(i.throw(a));
} catch (c) {
s(c);
}
}, o = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(r, l);
o((i = i.apply(e, t)).next());
});
const Hr = /* @__PURE__ */ Object.create(null), Ve = (e, t, ...i) => {
const n = `[@launchdarkly plugins]: (${e}): `;
console[t].apply(console, [n, ...i]), cu(n, ...i);
}, ot = (e, t, i, ...n) => {
Hr[`${e}-${t}`] || (Hr[`${e}-${t}`] = !0, Ve(e, i, ...n));
}, cu = (e, ...t) => au(void 0, null, function* () {
try {
const { LDObserve: i } = yield import("./LDObserve-Cc16WfBI.js");
i.recordLog(`${e}${t}`, "warn");
} catch {
}
});
class Vl {
constructor(t, i) {
He(this, "debug"), He(this, "name"), this.debug = t, this.name = i;
}
log(...t) {
if (this.debug) {
let i = `[${Date.now()}]`;
this.name && (i += ` - ${this.name}`), console.log.apply(console, [i, ...t]);
}
}
warn(...t) {
let i = `[${Date.now()}]`;
this.name && (i += ` - ${this.name}`), console.warn.apply(console, [i, ...t]);
}
}
let Xl = class {
constructor() {
He(this, "_sdk"), He(this, "_isLoaded", !1), He(this, "_callBuffer", []), He(this, "_capacity", 1e5), He(this, "_droppedEvents", 0), He(this, "_exceededCapacity", !1), He(this, "_logger", new Vl());
}
_bufferCall(t, i) {
if (this._isLoaded)
try {
return this._sdk[t](...i);
} catch (n) {
Ve(
`Error executing buffered call to ${t}:`,
"error",
n
);
}
else {
this._enqueue({ method: t, args: i });
return;
}
}
_enqueue(t) {
this._callBuffer.length < this._capacity ? (this._callBuffer.push(t), this._exceededCapacity = !1) : (this._exceededCapacity || (this._exceededCapacity = !0, Ve(
"Exceeded event queue capacity. Increase capacity to avoid dropping events.",
"warn"
)), this._droppedEvents += 1);
}
load(t) {
this._sdk = t, this._isLoaded = !0;
for (const { method: i, args: n } of this._callBuffer)
try {
this._sdk[i](...n);
} catch (s) {
Ve(
`Error executing buffered call to ${i}:`,
"error",
s
);
}
this._callBuffer = [];
}
};
var uu = Object.defineProperty, du = Object.defineProperties, hu = Object.getOwnPropertyDescriptors, rn = Object.getOwnPropertySymbols, Cl = Object.prototype.hasOwnProperty, Wl = Object.prototype.propertyIsEnumerable, bs = (e, t, i) => t in e ? uu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, Q = (e, t) => {
for (var i in t || (t = {}))
Cl.call(t, i) && bs(e, i, t[i]);
if (rn)
for (var i of rn(t))
Wl.call(t, i) && bs(e, i, t[i]);
return e;
}, on = (e, t) => du(e, hu(t)), Qt = (e, t) => {
var i = {};
for (var n in e)
Cl.call(e, n) && t.indexOf(n) < 0 && (i[n] = e[n]);
if (e != null && rn)
for (var n of rn(e))
t.indexOf(n) < 0 && Wl.call(e, n) && (i[n] = e[n]);
return i;
}, ni = (e, t, i) => bs(e, typeof t != "symbol" ? t + "" : t, i), Ct = (e, t, i) => new Promise((n, s) => {
var r = (a) => {
try {
o(i.next(a));
} catch (c) {
s(c);
}
}, l = (a) => {
try {
o(i.throw(a));
} catch (c) {
s(c);
}
}, o = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(r, l);
o((i = i.apply(e, t)).next());
});
function pu(e, t) {
for (var i = 0; i < t.length; i++) {
const n = t[i];
if (typeof n != "string" && !Array.isArray(n)) {
for (const s in n)
if (s !== "default" && !(s in e)) {
const r = Object.getOwnPropertyDescriptor(n, s);
r && Object.defineProperty(e, s, r.get ? r : {
enumerable: !0,
get: () => n[s]
});
}
}
}
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
}
function Di(e, t) {
throw new Error(t);
}
function mu(e) {
return typeof e == "object" && e !== null;
}
function bu(e, t) {
throw new Error(
"Unexpected invariant triggered."
);
}
const fu = /\r\n|[\n\r]/g;
function fs(e, t) {
let i = 0, n = 1;
for (const s of e.body.matchAll(fu)) {
if (typeof s.index == "number" || bu(), s.index >= t)
break;
i = s.index + s[0].length, n += 1;
}
return {
line: n,
column: t + 1 - i
};
}
function yu(e) {
return Rl(
e.source,
fs(e.source, e.start)
);
}
function Rl(e, t) {
const i = e.locationOffset.column - 1, n = "".padStart(i) + e.body, s = t.line - 1, r = e.locationOffset.line - 1, l = t.line + r, o = t.line === 1 ? i : 0, a = t.column + o, c = `${e.name}:${l}:${a}
`, u = n.split(/\r\n|[\n\r]/g), h = u[s];
if (h.length > 120) {
const p = Math.floor(a / 80), m = a % 80, b = [];
for (let d = 0; d < h.length; d += 80)
b.push(h.slice(d, d + 80));
return c + Pr([
[`${l} |`, b[0]],
...b.slice(1, p + 1).map((d) => ["|", d]),
["|", "^".padStart(m)],
["|", b[p + 1]]
]);
}
return c + Pr([
// Lines specified like this: ["prefix", "string"],
[`${l - 1} |`, u[s - 1]],
[`${l} |`, h],
["|", "^".padStart(a)],
[`${l + 1} |`, u[s + 1]]
]);
}
function Pr(e) {
const t = e.filter(([n, s]) => s !== void 0), i = Math.max(...t.map(([n]) => n.length));
return t.map(([n, s]) => n.padStart(i) + (s ? " " + s : "")).join(`
`);
}
function gu(e) {
const t = e[0];
return t == null || "kind" in t || "length" in t ? {
nodes: t,
source: e[1],
positions: e[2],
path: e[3],
originalError: e[4],
extensions: e[5]
} : t;
}
let Zu = class kl extends Error {
/**
* An array of `{ line, column }` locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
/**
* The source GraphQL document for the first location of this error.
*
* Note that if this Error represents more than one node, the source may not
* represent nodes after the first node.
*/
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
/**
* The original error thrown from a field resolver during execution.
*/
/**
* Extension fields to add to the formatted error.
*/
/**
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
*/
constructor(t, ...i) {
var n, s, r;
const { nodes: l, source: o, positions: a, path: c, originalError: u, extensions: h } = gu(i);
super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = u ?? void 0, this.nodes = Br(
Array.isArray(l) ? l : l ? [l] : void 0
);
const p = Br(
(n = this.nodes) === null || n === void 0 ? void 0 : n.map((b) => b.loc).filter((b) => b != null)
);
this.source = o ?? (p == null || (s = p[0]) === null || s === void 0 ? void 0 : s.source), this.positions = a ?? p?.map((b) => b.start), this.locations = a && o ? a.map((b) => fs(o, b)) : p?.map((b) => fs(b.source, b.start));
const m = mu(
u?.extensions
) ? u?.extensions : void 0;
this.extensions = (r = h ?? m) !== null && r !== void 0 ? r : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
message: {
writable: !0,
enumerable: !0
},
name: {
enumerable: !1
},
nodes: {
enumerable: !1
},
source: {
enumerable: !1
},
positions: {
enumerable: !1
},
originalError: {
enumerable: !1
}
}), u != null && u.stack ? Object.defineProperty(this, "stack", {
value: u.stack,
writable: !0,
configurable: !0
}) : Error.captureStackTrace ? Error.captureStackTrace(this, kl) : Object.defineProperty(this, "stack", {
value: Error().stack,
writable: !0,
configurable: !0
});
}
get [Symbol.toStringTag]() {
return "GraphQLError";
}
toString() {
let t = this.message;
if (this.nodes)
for (const i of this.nodes)
i.loc && (t += `
` + yu(i.loc));
else if (this.source && this.locations)
for (const i of this.locations)
t += `
` + Rl(this.source, i);
return t;
}
toJSON() {
const t = {
message: this.message
};
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
}
};
function Br(e) {
return e === void 0 || e.length === 0 ? void 0 : e;
}
function ue(e, t, i) {
return new Zu(`Syntax Error: ${i}`, {
source: e,
positions: [t]
});
}
let Iu = class {
/**
* The character offset at which this Node begins.
*/
/**
* The character offset at which this Node ends.
*/
/**
* The Token at which this Node begins.
*/
/**
* The Token at which this Node ends.
*/
/**
* The Source document the AST represents.
*/
constructor(t, i, n) {
this.start = t.start, this.end = i.end, this.startToken = t, this.endToken = i, this.source = n;
}
get [Symbol.toStringTag]() {
return "Location";
}
toJSON() {
return {
start: this.start,
end: this.end
};
}
}, vl = class {
/**
* The kind of Token.
*/
/**
* The character offset at which this Node begins.
*/
/**
* The character offset at which this Node ends.
*/
/**
* The 1-indexed line number on which this Token appears.
*/
/**
* The 1-indexed column number at which this Token begins.
*/
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*
* Note: is undefined for punctuation tokens, but typed as string for
* convenience in the parser.
*/
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
constructor(t, i, n, s, r, l) {
this.kind = t, this.start = i, this.end = n, this.line = s, this.column = r, this.value = l, this.prev = null, this.next = null;
}
get [Symbol.toStringTag]() {
return "Token";
}
toJSON() {
return {
kind: this.kind,
value: this.value,
line: this.line,
column: this.column
};
}
};
const wl = {
Name: [],
Document: ["definitions"],
OperationDefinition: [
"name",
"variableDefinitions",
"directives",
"selectionSet"
],
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
Variable: ["name"],
SelectionSet: ["selections"],
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
Argument: ["name", "value"],
FragmentSpread: ["name", "directives"],
InlineFragment: ["typeCondition", "directives", "selectionSet"],
FragmentDefinition: [
"name",
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
"variableDefinitions",
"typeCondition",
"directives",
"selectionSet"
],
IntValue: [],
FloatValue: [],
StringValue: [],
BooleanValue: [],
NullValue: [],
EnumValue: [],
ListValue: ["values"],
ObjectValue: ["fields"],
ObjectField: ["name", "value"],
Directive: ["name", "arguments"],
NamedType: ["name"],
ListType: ["type"],
NonNullType: ["type"],
SchemaDefinition: ["description", "directives", "operationTypes"],
OperationTypeDefinition: ["type"],
ScalarTypeDefinition: ["description", "name", "directives"],
ObjectTypeDefinition: [
"description",
"name",
"interfaces",
"directives",
"fields"
],
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
InputValueDefinition: [
"description",
"name",
"type",
"defaultValue",
"directives"
],
InterfaceTypeDefinition: [
"description",
"name",
"interfaces",
"directives",
"fields"
],
UnionTypeDefinition: ["description", "name", "directives", "types"],
EnumTypeDefinition: ["description", "name", "directives", "values"],
EnumValueDefinition: ["description", "name", "directives"],
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
DirectiveDefinition: ["description", "name", "arguments", "locations"],
SchemaExtension: ["directives", "operationTypes"],
ScalarTypeExtension: ["name", "directives"],
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
UnionTypeExtension: ["name", "directives", "types"],
EnumTypeExtension: ["name", "directives", "values"],
InputObjectTypeExtension: ["name", "directives", "fields"]
}, Su = new Set(Object.keys(wl));
function Dr(e) {
const t = e?.kind;
return typeof t == "string" && Su.has(t);
}
var It;
(function(e) {
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
})(It || (It = {}));
var ys;
(function(e) {
e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
})(ys || (ys = {}));
var L;
(function(e) {
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
})(L || (L = {}));
function gs(e) {
return e === 9 || e === 32;
}
function si(e) {
return e >= 48 && e <= 57;
}
function xl(e) {
return e >= 97 && e <= 122 || // A-Z
e >= 65 && e <= 90;
}
function Tl(e) {
return xl(e) || e === 95;
}
function Gu(e) {
return xl(e) || si(e) || e === 95;
}
function Vu(e) {
var t;
let i = Number.MAX_SAFE_INTEGER, n = null, s = -1;
for (let l = 0; l < e.length; ++l) {
var r;
const o = e[l], a = Xu(o);
a !== o.length && (n = (r = n) !== null && r !== void 0 ? r : l, s = l, l !== 0 && a < i && (i = a));
}
return e.map((l, o) => o === 0 ? l : l.slice(i)).slice(
(t = n) !== null && t !== void 0 ? t : 0,
s + 1
);
}
function Xu(e) {
let t = 0;
for (; t < e.length && gs(e.charCodeAt(t)); )
++t;
return t;
}
function Cu(e, t) {
const i = e.replace(/"""/g, '\\"""'), n = i.split(/\r\n|[\n\r]/g), s = n.length === 1, r = n.length > 1 && n.slice(1).every((m) => m.length === 0 || gs(m.charCodeAt(0))), l = i.endsWith('\\"""'), o = e.endsWith('"') && !l, a = e.endsWith("\\"), c = o || a, u = (
// add leading and trailing new lines only if it improves readability
!s || e.length > 70 || c || r || l
);
let h = "";
const p = s && gs(e.charCodeAt(0));
return (u && !p || r) && (h += `
`), h += i, (u || c) && (h += `
`), '"""' + h + '"""';
}
var Z;
(function(e) {
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
})(Z || (Z = {}));
let Wu = class {
/**
* The previously focused non-ignored token.
*/
/**
* The currently focused non-ignored token.
*/
/**
* The (1-indexed) line containing the current token.
*/
/**
* The character offset at which the current line begins.
*/
constructor(t) {
const i = new vl(Z.SOF, 0, 0, 0, 0);
this.source = t, this.lastToken = i, this.token = i, this.line = 1, this.lineStart = 0;
}
get [Symbol.toStringTag]() {
return "Lexer";
}
/**
* Advances the token stream to the next non-ignored token.
*/
advance() {
return this.lastToken = this.token, this.token = this.lookahead();
}
/**
* Looks ahead and returns the next non-ignored token, but does not change
* the state of Lexer.
*/
lookahead() {
let t = this.token;
if (t.kind !== Z.EOF)
do
if (t.next)
t = t.next;
else {
const i = ku(this, t.end);
t.next = i, i.prev = t, t = i;
}
while (t.kind === Z.COMMENT);
return t;
}
};
function Ru(e) {
return e === Z.BANG || e === Z.DOLLAR || e === Z.AMP || e === Z.PAREN_L || e === Z.PAREN_R || e === Z.SPREAD || e === Z.COLON || e === Z.EQUALS || e === Z.AT || e === Z.BRACKET_L || e === Z.BRACKET_R || e === Z.BRACE_L || e === Z.PIPE || e === Z.BRACE_R;
}
function Jt(e) {
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
}
function xn(e, t) {
return Nl(e.charCodeAt(t)) && Ll(e.charCodeAt(t + 1));
}
function Nl(e) {
return e >= 55296 && e <= 56319;
}
function Ll(e) {
return e >= 56320 && e <= 57343;
}
function lt(e, t) {
const i = e.source.body.codePointAt(t);
if (i === void 0)
return Z.EOF;
if (i >= 32 && i <= 126) {
const n = String.fromCodePoint(i);
return n === '"' ? `'"'` : `"${n}"`;
}
return "U+" + i.toString(16).toUpperCase().padStart(4, "0");
}
function le(e, t, i, n, s) {
const r = e.line, l = 1 + i - e.lineStart;
return new vl(t, i, n, r, l, s);
}
function ku(e, t) {
const i = e.source.body, n = i.length;
let s = t;
for (; s < n; ) {
const r = i.charCodeAt(s);
switch (r) {
case 65279:
case 9:
case 32:
case 44:
++s;
continue;
case 10:
++s, ++e.line, e.lineStart = s;
continue;
case 13:
i.charCodeAt(s + 1) === 10 ? s += 2 : ++s, ++e.line, e.lineStart = s;
continue;
case 35:
return vu(e, s);
case 33:
return le(e, Z.BANG, s, s + 1);
case 36:
return le(e, Z.DOLLAR, s, s + 1);
case 38:
return le(e, Z.AMP, s, s + 1);
case 40:
return le(e, Z.PAREN_L, s, s + 1);
case 41:
return le(e, Z.PAREN_R, s, s + 1);
case 46:
if (i.charCodeAt(s + 1) === 46 && i.charCodeAt(s + 2) === 46)
return le(e, Z.SPREAD, s, s + 3);
break;
case 58:
return le(e, Z.COLON, s, s + 1);
case 61:
return le(e, Z.EQUALS, s, s + 1);
case 64:
return le(e, Z.AT, s, s + 1);
case 91:
return le(e, Z.BRACKET_L, s, s + 1);
case 93:
return le(e, Z.BRACKET_R, s, s + 1);
case 123:
return le(e, Z.BRACE_L, s, s + 1);
case 124:
return le(e, Z.PIPE, s, s + 1);
case 125:
return le(e, Z.BRACE_R, s, s + 1);
case 34:
return i.charCodeAt(s + 1) === 34 && i.charCodeAt(s + 2) === 34 ? Ju(e, s) : xu(e, s);
}
if (si(r) || r === 45)
return wu(e, s, r);
if (Tl(r))
return Yu(e, s);
throw ue(
e.source,
s,
r === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : Jt(r) || xn(i, s) ? `Unexpected character: ${lt(e, s)}.` : `Invalid character: ${lt(e, s)}.`
);
}
return le(e, Z.EOF, n, n);
}
function vu(e, t) {
const i = e.source.body, n = i.length;
let s = t + 1;
for (; s < n; ) {
const r = i.charCodeAt(s);
if (r === 10 || r === 13)
break;
if (Jt(r))
++s;
else if (xn(i, s))
s += 2;
else
break;
}
return le(
e,
Z.COMMENT,
t,
s,
i.slice(t + 1, s)
);
}
function wu(e, t, i) {
const n = e.source.body;
let s = t, r = i, l = !1;
if (r === 45 && (r = n.charCodeAt(++s)), r === 48) {
if (r = n.charCodeAt(++s), si(r))
throw ue(
e.source,
s,
`Invalid number, unexpected digit after 0: ${lt(
e,
s
)}.`
);
} else
s = Dn(e, s, r), r = n.charCodeAt(s);
if (r === 46 && (l = !0, r = n.charCodeAt(++s), s = Dn(e, s, r), r = n.charCodeAt(s)), (r === 69 || r === 101) && (l = !0, r = n.charCodeAt(++s), (r === 43 || r === 45) && (r = n.charCodeAt(++s)), s = Dn(e, s, r), r = n.charCodeAt(s)), r === 46 || Tl(r))
throw ue(
e.source,
s,
`Invalid number, expected digit but got: ${lt(
e,
s
)}.`
);
return le(
e,
l ? Z.FLOAT : Z.INT,
t,
s,
n.slice(t, s)
);
}
function Dn(e, t, i) {
if (!si(i))
throw ue(
e.source,
t,
`Invalid number, expected digit but got: ${lt(
e,
t
)}.`
);
const n = e.source.body;
let s = t + 1;
for (; si(n.charCodeAt(s)); )
++s;
return s;
}
function xu(e, t) {
const i = e.source.body, n = i.length;
let s = t + 1, r = s, l = "";
for (; s < n; ) {
const o = i.charCodeAt(s);
if (o === 34)
return l += i.slice(r, s), le(e, Z.STRING, t, s + 1, l);
if (o === 92) {
l += i.slice(r, s);
const a = i.charCodeAt(s + 1) === 117 ? i.charCodeAt(s + 2) === 123 ? Tu(e, s) : Nu(e, s) : Lu(e, s);
l += a.value, s += a.size, r = s;
continue;
}
if (o === 10 || o === 13)
break;
if (Jt(o))
++s;
else if (xn(i, s))
s += 2;
else
throw ue(
e.source,
s,
`Invalid character within String: ${lt(
e,
s
)}.`
);
}
throw ue(e.source, s, "Unterminated string.");
}
function Tu(e, t) {
const i = e.source.body;
let n = 0, s = 3;
for (; s < 12; ) {
const r = i.charCodeAt(t + s++);
if (r === 125) {
if (s < 5 || !Jt(n))
break;
return {
value: String.fromCodePoint(n),
size: s
};
}
if (n = n << 4 | Dt(r), n < 0)
break;
}
throw ue(
e.source,
t,
`Invalid Unicode escape sequence: "${i.slice(
t,
t + s
)}".`
);
}
function Nu(e, t) {
const i = e.source.body, n = jr(i, t + 2);
if (Jt(n))
return {
value: String.fromCodePoint(n),
size: 6
};
if (Nl(n) && i.charCodeAt(t + 6) === 92 && i.charCodeAt(t + 7) === 117) {
const s = jr(i, t + 8);
if (Ll(s))
return {
value: String.fromCodePoint(n, s),
size: 12
};
}
throw ue(
e.source,
t,
`Invalid Unicode escape sequence: "${i.slice(t, t + 6)}".`
);
}
function jr(e, t) {
return Dt(e.charCodeAt(t)) << 12 | Dt(e.charCodeAt(t + 1)) << 8 | Dt(e.charCodeAt(t + 2)) << 4 | Dt(e.charCodeAt(t + 3));
}
function Dt(e) {
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
}
function Lu(e, t) {
const i = e.source.body;
switch (i.charCodeAt(t + 1)) {
case 34:
return {
value: '"',
size: 2
};
case 92:
return {
value: "\\",
size: 2
};
case 47:
return {
value: "/",
size: 2
};
case 98:
return {
value: "\b",
size: 2
};
case 102:
return {
value: "\f",
size: 2
};
case 110:
return {
value: `
`,
size: 2
};
case 114:
return {
value: "\r",
size: 2
};
case 116:
return {
value: " ",
size: 2
};
}
throw ue(
e.source,
t,
`Invalid character escape sequence: "${i.slice(
t,
t + 2
)}".`
);
}
function Ju(e, t) {
const i = e.source.body, n = i.length;
let s = e.lineStart, r = t + 3, l = r, o = "";
const a = [];
for (; r < n; ) {
const c = i.charCodeAt(r);
if (c === 34 && i.charCodeAt(r + 1) === 34 && i.charCodeAt(r + 2) === 34) {
o += i.slice(l, r), a.push(o);
const u = le(
e,
Z.BLOCK_STRING,
t,
r + 3,
// Return a string of the lines joined with U+000A.
Vu(a).join(`
`)
);
return e.line += a.length - 1, e.lineStart = s, u;
}
if (c === 92 && i.charCodeAt(r + 1) === 34 && i.charCodeAt(r + 2) === 34 && i.charCodeAt(r + 3) === 34) {
o += i.slice(l, r), l = r + 1, r += 4;
continue;
}
if (c === 10 || c === 13) {
o += i.slice(l, r), a.push(o), c === 13 && i.charCodeAt(r + 1) === 10 ? r += 2 : ++r, o = "", l = r, s = r;
continue;
}
if (Jt(c))
++r;
else if (xn(i, r))
r += 2;
else
throw ue(
e.source,
r,
`Invalid character within String: ${lt(
e,
r
)}.`
);
}
throw ue(e.source, r, "Unterminated string.");
}
function Yu(e, t) {
const i = e.source.body, n = i.length;
let s = t + 1;
for (; s < n; ) {
const r = i.charCodeAt(s);
if (Gu(r))
++s;
else
break;
}
return le(
e,
Z.NAME,
t,
s,
i.slice(t, s)
);
}
const Fu = 10, Jl = 2;
function ur(e) {
return Tn(e, []);
}
function Tn(e, t) {
switch (typeof e) {
case "string":
return JSON.stringify(e);
case "function":
return e.name ? `[function ${e.name}]` : "[function]";
case "object":
return Uu(e, t);
default:
return String(e);
}
}
function Uu(e, t) {
if (e === null)
return "null";
if (t.includes(e))
return "[Circular]";
const i = [...t, e];
if (Ku(e)) {
const n = e.toJSON();
if (n !== e)
return typeof n == "string" ? n : Tn(n, i);
} else if (Array.isArray(e))
return Eu(e, i);
return Ou(e, i);
}
function Ku(e) {
return typeof e.toJSON == "function";
}
function Ou(e, t) {
const i = Object.entries(e);
return i.length === 0 ? "{}" : t.length > Jl ? "[" + Mu(e) + "]" : "{ " + i.map(
([n, s]) => n + ": " + Tn(s, t)
).join(", ") + " }";
}
function Eu(e, t) {
if (e.length === 0)
return "[]";
if (t.length > Jl)
return "[Array]";
const i = Math.min(Fu, e.length), n = e.length - i, s = [];
for (let r = 0; r < i; ++r)
s.push(Tn(e[r], t));
return n === 1 ? s.push("... 1 more item") : n > 1 && s.push(`... ${n} more items`), "[" + s.join(", ") + "]";
}
function Mu(e) {
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
if (t === "Object" && typeof e.constructor == "function") {
const i = e.constructor.name;
if (typeof i == "string" && i !== "")
return i;
}
return t;
}
const zu = globalThis.process && // eslint-disable-next-line no-undef
process.env.NODE_ENV === "production", Hu = (
/* c8 ignore next 6 */
// FIXME: https://github.com/graphql/graphql-js/issues/2317
zu ? function(e, t) {
return e instanceof t;
} : function(e, t) {
if (e instanceof t)
return !0;
if (typeof e == "object" && e !== null) {
var i;
const n = t.prototype[Symbol.toStringTag], s = (
// We still need to support constructor's name to detect conflicts with older versions of this library.
Symbol.toStringTag in e ? e[Symbol.toStringTag] : (i = e.constructor) === null || i === void 0 ? void 0 : i.name
);
if (n === s) {
const r = ur(e);
throw new Error(`Cannot use ${n} "${r}" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.`);
}
}
return !1;
}
);
let Yl = class {
constructor(t, i = "GraphQL request", n = {
line: 1,
column: 1
}) {
typeof t == "string" || Di(!1, `Body must be a string. Received: ${ur(t)}.`), this.body = t, this.name = i, this.locationOffset = n, this.locationOffset.line > 0 || Di(
!1,
"line in locationOffset is 1-indexed and must be positive."
), this.locationOffset.column > 0 || Di(
!1,
"column in locationOffset is 1-indexed and must be positive."
);
}
get [Symbol.toStringTag]() {
return "Source";
}
};
function Pu(e) {
return Hu(e, Yl);
}
function Fl(e, t) {
const i = new Bu(e, t), n = i.parseDocument();
return Object.defineProperty(n, "tokenCount", {
enumerable: !1,
value: i.tokenCount
}), n;
}
let Bu = class {
constructor(t, i = {}) {
const n = Pu(t) ? t : new Yl(t);
this._lexer = new Wu(n), this._options = i, this._tokenCounter = 0;
}
get tokenCount() {
return this._tokenCounter;
}
/**
* Converts a name lex token into a name parse node.
*/
parseName() {
const t = this.expectToken(Z.NAME);
return this.node(t, {
kind: L.NAME,
value: t.value
});
}
// Implements the parsing rules in the Document section.
/**
* Document : Definition+
*/
parseDocument() {
return this.node(this._lexer.token, {
kind: L.DOCUMENT,
definitions: this.many(
Z.SOF,
this.parseDefinition,
Z.EOF
)
});
}
/**
* Definition :
* - ExecutableDefinition
* - TypeSystemDefinition
* - TypeSystemExtension
*
* ExecutableDefinition :
* - OperationDefinition
* - FragmentDefinition
*
* TypeSystemDefinition :
* - SchemaDefinition
* - TypeDefinition
* - DirectiveDefinition
*
* TypeDefinition :
* - ScalarTypeDefinition
* - ObjectTypeDefinition
* - InterfaceTypeDefinition
* - UnionTypeDefinition
* - EnumTypeDefinition
* - InputObjectTypeDefinition
*/
parseDefinition() {
if (this.peek(Z.BRACE_L))
return this.parseOperationDefinition();
const t = this.peekDescription(), i = t ? this._lexer.lookahead() : this._lexer.token;
if (i.kind === Z.NAME) {
switch (i.value) {
case "schema":
return this.parseSchemaDefinition();
case "scalar":
return this.parseScalarTypeDefinition();
case "type":
return this.parseObjectTypeDefinition();
case "interface":
return this.parseInterfaceTypeDefinition();
case "union":
return this.parseUnionTypeDefinition();
case "enum":
return this.parseEnumTypeDefinition();
case "input":
return this.parseInputObjectTypeDefinition();
case "directive":
return this.parseDirectiveDefinition();
}
if (t)
throw ue(
this._lexer.source,
this._lexer.token.start,
"Unexpected description, descriptions are supported only on type definitions."
);
switch (i.value) {
case "query":
case "mutation":
case "subscription":
return this.parseOperationDefinition();
case "fragment":
return this.parseFragmentDefinition();
case "extend":
return this.parseTypeSystemExtension();
}
}
throw this.unexpected(i);
}
// Implements the parsing rules in the Operations section.
/**
* OperationDefinition :
* - SelectionSet
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
*/
parseOperationDefinition() {
const t = this._lexer.token;
if (this.peek(Z.BRACE_L))
return this.node(t, {
kind: L.OPERATION_DEFINITION,
operation: It.QUERY,
name: void 0,
variableDefinitions: [],
directives: [],
selectionSet: this.parseSelectionSet()
});
const i = this.parseOperationType();
let n;
return this.peek(Z.NAME) && (n = this.parseName()), this.node(t, {
kind: L.OPERATION_DEFINITION,
operation: i,
name: n,
variableDefinitions: this.parseVariableDefinitions(),
directives: this.parseDirectives(!1),
selectionSet: this.parseSelectionSet()
});
}
/**
* OperationType : one of query mutation subscription
*/
parseOperationType() {
const t = this.expectToken(Z.NAME);
switch (t.value) {
case "query":
return It.QUERY;
case "mutation":
return It.MUTATION;
case "subscription":
return It.SUBSCRIPTION;
}
throw this.unexpected(t);
}
/**
* VariableDefinitions : ( VariableDefinition+ )
*/
parseVariableDefinitions() {
return this.optionalMany(
Z.PAREN_L,
this.parseVariableDefinition,
Z.PAREN_R
);
}
/**
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
*/
parseVariableDefinition() {
return this.node(this._lexer.token, {
kind: L.VARIABLE_DEFINITION,
variable: this.parseVariable(),
type: (this.expectToken(Z.COLON), this.parseTypeReference()),
defaultValue: this.expectOptionalToken(Z.EQUALS) ? this.parseConstValueLiteral() : void 0,
directives: this.parseConstDirectives()
});
}
/**
* Variable : $ Name
*/
parseVariable() {
const t = this._lexer.token;
return this.expectToken(Z.DOLLAR), this.node(t, {
kind: L.VARIABLE,
name: this.parseName()
});
}
/**
* ```
* SelectionSet : { Selection+ }
* ```
*/
parseSelectionSet() {
return this.node(this._lexer.token, {
kind: L.SELECTION_SET,
selections: this.many(
Z.BRACE_L,
this.parseSelection,
Z.BRACE_R
)
});
}
/**
* Selection :
* - Field
* - FragmentSpread
* - InlineFragment
*/
parseSelection() {
return this.peek(Z.SPREAD) ? this.parseFragment() : this.parseField();
}
/**
* Field : Alias? Name Arguments? Directives? SelectionSet?
*
* Alias : Name :
*/
parseField() {
const t = this._lexer.token, i = this.parseName();
let n, s;
return this.expectOptionalToken(Z.COLON) ? (n = i, s = this.parseName()) : s = i, this.node(t, {
kind: L.FIELD,
alias: n,
name: s,
arguments: this.parseArguments(!1),
directives: this.parseDirectives(!1),
selectionSet: this.peek(Z.BRACE_L) ? this.parseSelectionSet() : void 0
});
}
/**
* Arguments[Const] : ( Argument[?Const]+ )
*/
parseArguments(t) {
const i = t ? this.parseConstArgument : this.parseArgument;
return this.optionalMany(Z.PAREN_L, i, Z.PAREN_R);
}
/**
* Argument[Const] : Name : Value[?Const]
*/
parseArgument(t = !1) {
const i = this._lexer.token, n = this.parseName();
return this.expectToken(Z.COLON), this.node(i, {
kind: L.ARGUMENT,
name: n,
value: this.parseValueLiteral(t)
});
}
parseConstArgument() {
return this.parseArgument(!0);
}
// Implements the parsing rules in the Fragments section.
/**
* Corresponds to both FragmentSpread and InlineFragment in the spec.
*
* FragmentSpread : ... FragmentName Directives?
*
* InlineFragment : ... TypeCondition? Directives? SelectionSet
*/
parseFragment() {
const t = this._lexer.token;
this.expectToken(Z.SPREAD);
const i = this.expectOptionalKeyword("on");
return !i && this.peek(Z.NAME) ? this.node(t, {
kind: L.FRAGMENT_SPREAD,
name: this.parseFragmentName(),
directives: this.parseDirectives(!1)
}) : this.node(t, {
kind: L.INLINE_FRAGMENT,
typeCondition: i ? this.parseNamedType() : void 0,
directives: this.parseDirectives(!1),
selectionSet: this.parseSelectionSet()
});
}
/**
* FragmentDefinition :
* - fragment FragmentName on TypeCondition Directives? SelectionSet
*
* TypeCondition : NamedType
*/
parseFragmentDefinition() {
const t = this._lexer.token;
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
kind: L.FRAGMENT_DEFINITION,
name: this.parseFragmentName(),
variableDefinitions: this.parseVariableDefinitions(),
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
directives: this.parseDirectives(!1),
selectionSet: this.parseSelectionSet()
}) : this.node(t, {
kind: L.FRAGMENT_DEFINITION,
name: this.parseFragmentName(),
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
directives: this.parseDirectives(!1),
selectionSet: this.parseSelectionSet()
});
}
/**
* FragmentName : Name but not `on`
*/
parseFragmentName() {
if (this._lexer.token.value === "on")
throw this.unexpected();
return this.parseName();
}
// Implements the parsing rules in the Values section.
/**
* Value[Const] :
* - [~Const] Variable
* - IntValue
* - FloatValue
* - StringValue
* - BooleanValue
* - NullValue
* - EnumValue
* - ListValue[?Const]
* - ObjectValue[?Const]
*
* BooleanValue : one of `true` `false`
*
* NullValue : `null`
*
* EnumValue : Name but not `true`, `false` or `null`
*/
parseValueLiteral(t) {
const i = this._lexer.token;
switch (i.kind) {
case Z.BRACKET_L:
return this.parseList(t);
case Z.BRACE_L:
return this.parseObject(t);
case Z.INT:
return this.advanceLexer(), this.node(i, {
kind: L.INT,
value: i.value
});
case Z.FLOAT:
return this.advanceLexer(), this.node(i, {
kind: L.FLOAT,
value: i.value
});
case Z.STRING:
case Z.BLOCK_STRING:
return this.parseStringLiteral();
case Z.NAME:
switch (this.advanceLexer(), i.value) {
case "true":
return this.node(i, {
kind: L.BOOLEAN,
value: !0
});
case "false":
return this.node(i, {
kind: L.BOOLEAN,
value: !1
});
case "null":
return this.node(i, {
kind: L.NULL
});
default:
return this.node(i, {
kind: L.ENUM,
value: i.value
});
}
case Z.DOLLAR:
if (t)
if (this.expectToken(Z.DOLLAR), this._lexer.token.kind === Z.NAME) {
const n = this._lexer.token.value;
throw ue(
this._lexer.source,
i.start,
`Unexpected variable "$${n}" in constant value.`
);
} else
throw this.unexpected(i);
return this.parseVariable();
default:
throw this.unexpected();
}
}
parseConstValueLiteral() {
return this.parseValueLiteral(!0);
}
parseStringLiteral() {
const t = this._lexer.token;
return this.advanceLexer(), this.node(t, {
kind: L.STRING,
value: t.value,
block: t.kind === Z.BLOCK_STRING
});
}
/**
* ListValue[Const] :
* - [ ]
* - [ Value[?Const]+ ]
*/
parseList(t) {
const i = () => this.parseValueLiteral(t);
return this.node(this._lexer.token, {
kind: L.LIST,
values: this.any(Z.BRACKET_L, i, Z.BRACKET_R)
});
}
/**
* ```
* ObjectValue[Const] :
* - { }
* - { ObjectField[?Const]+ }
* ```
*/
parseObject(t) {
const i = () => this.parseObjectField(t);
return this.node(this._lexer.token, {
kind: L.OBJECT,
fields: this.any(Z.BRACE_L, i, Z.BRACE_R)
});
}
/**
* ObjectField[Const] : Name : Value[?Const]
*/
parseObjectField(t) {
const i = this._lexer.token, n = this.parseName();
return this.expectToken(Z.COLON), this.node(i, {
kind: L.OBJECT_FIELD,
name: n,
value: this.parseValueLiteral(t)
});
}
// Implements the parsing rules in the Directives section.
/**
* Directives[Const] : Directive[?Const]+
*/
parseDirectives(t) {
const i = [];
for (; this.peek(Z.AT); )
i.push(this.parseDirective(t));
return i;
}
parseConstDirectives() {
return this.parseDirectives(!0);
}
/**
* ```
* Directive[Const] : @ Name Arguments[?Const]?
* ```
*/
parseDirective(t) {
const i = this._lexer.token;
return this.expectToken(Z.AT), this.node(i, {
kind: L.DIRECTIVE,
name: this.parseName(),
arguments: this.parseArguments(t)
});
}
// Implements the parsing rules in the Types section.
/**
* Type :
* - NamedType
* - ListType
* - NonNullType
*/
parseTypeReference() {
const t = this._lexer.token;
let i;
if (this.expectOptionalToken(Z.BRACKET_L)) {
const n = this.parseTypeReference();
this.expectToken(Z.BRACKET_R), i = this.node(t, {
kind: L.LIST_TYPE,
type: n
});
} else
i = this.parseNamedType();
return this.expectOptionalToken(Z.BANG) ? this.node(t, {
kind: L.NON_NULL_TYPE,
type: i
}) : i;
}
/**
* NamedType : Name
*/
parseNamedType() {
return this.node(this._lexer.token, {
kind: L.NAMED_TYPE,
name: this.parseName()
});
}
// Implements the parsing rules in the Type Definition section.
peekDescription() {
return this.peek(Z.STRING) || this.peek(Z.BLOCK_STRING);
}
/**
* Description : StringValue
*/
parseDescription() {
if (this.peekDescription())
return this.parseStringLiteral();
}
/**
* ```
* SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
* ```
*/
parseSchemaDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("schema");
const n = this.parseConstDirectives(), s = this.many(
Z.BRACE_L,
this.parseOperationTypeDefinition,
Z.BRACE_R
);
return this.node(t, {
kind: L.SCHEMA_DEFINITION,
description: i,
directives: n,
operationTypes: s
});
}
/**
* OperationTypeDefinition : OperationType : NamedType
*/
parseOperationTypeDefinition() {
const t = this._lexer.token, i = this.parseOperationType();
this.expectToken(Z.COLON);
const n = this.parseNamedType();
return this.node(t, {
kind: L.OPERATION_TYPE_DEFINITION,
operation: i,
type: n
});
}
/**
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
*/
parseScalarTypeDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("scalar");
const n = this.parseName(), s = this.parseConstDirectives();
return this.node(t, {
kind: L.SCALAR_TYPE_DEFINITION,
description: i,
name: n,
directives: s
});
}
/**
* ObjectTypeDefinition :
* Description?
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
*/
parseObjectTypeDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("type");
const n = this.parseName(), s = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), l = this.parseFieldsDefinition();
return this.node(t, {
kind: L.OBJECT_TYPE_DEFINITION,
description: i,
name: n,
interfaces: s,
directives: r,
fields: l
});
}
/**
* ImplementsInterfaces :
* - implements `&`? NamedType
* - ImplementsInterfaces & NamedType
*/
parseImplementsInterfaces() {
return this.expectOptionalKeyword("implements") ? this.delimitedMany(Z.AMP, this.parseNamedType) : [];
}
/**
* ```
* FieldsDefinition : { FieldDefinition+ }
* ```
*/
parseFieldsDefinition() {
return this.optionalMany(
Z.BRACE_L,
this.parseFieldDefinition,
Z.BRACE_R
);
}
/**
* FieldDefinition :
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
*/
parseFieldDefinition() {
const t = this._lexer.token, i = this.parseDescription(), n = this.parseName(), s = this.parseArgumentDefs();
this.expectToken(Z.COLON);
const r = this.parseTypeReference(), l = this.parseConstDirectives();
return this.node(t, {
kind: L.FIELD_DEFINITION,
description: i,
name: n,
arguments: s,
type: r,
directives: l
});
}
/**
* ArgumentsDefinition : ( InputValueDefinition+ )
*/
parseArgumentDefs() {
return this.optionalMany(
Z.PAREN_L,
this.parseInputValueDef,
Z.PAREN_R
);
}
/**
* InputValueDefinition :
* - Description? Name : Type DefaultValue? Directives[Const]?
*/
parseInputValueDef() {
const t = this._lexer.token, i = this.parseDescription(), n = this.parseName();
this.expectToken(Z.COLON);
const s = this.parseTypeReference();
let r;
this.expectOptionalToken(Z.EQUALS) && (r = this.parseConstValueLiteral());
const l = this.parseConstDirectives();
return this.node(t, {
kind: L.INPUT_VALUE_DEFINITION,
description: i,
name: n,
type: s,
defaultValue: r,
directives: l
});
}
/**
* InterfaceTypeDefinition :
* - Description? interface Name Directives[Const]? FieldsDefinition?
*/
parseInterfaceTypeDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("interface");
const n = this.parseName(), s = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), l = this.parseFieldsDefinition();
return this.node(t, {
kind: L.INTERFACE_TYPE_DEFINITION,
description: i,
name: n,
interfaces: s,
directives: r,
fields: l
});
}
/**
* UnionTypeDefinition :
* - Description? union Name Directives[Const]? UnionMemberTypes?
*/
parseUnionTypeDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("union");
const n = this.parseName(), s = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
return this.node(t, {
kind: L.UNION_TYPE_DEFINITION,
description: i,
name: n,
directives: s,
types: r
});
}
/**
* UnionMemberTypes :
* - = `|`? NamedType
* - UnionMemberTypes | NamedType
*/
parseUnionMemberTypes() {
return this.expectOptionalToken(Z.EQUALS) ? this.delimitedMany(Z.PIPE, this.parseNamedType) : [];
}
/**
* EnumTypeDefinition :
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
*/
parseEnumTypeDefinition() {
const t = this._lexer.token, i = this.parseDescription();
this.expectKeyword("enum");
const n = this.parseName(), s = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
return this.node(t, {
kind: L.ENUM_TYPE_DEFINITION,
description: i,
name: n,
directives: s,
values: r
});
}
/**
* ```
* EnumValuesDefinition : { EnumValueDefinition+ }
* ```
*/
parseEnumValuesDefinition() {
return this.optionalMany(
Z.BRACE_L,
this.parseEnumValueDefinition,
Z.BRACE_R
);
}
/**
* EnumValueDefinition : Description? EnumValue Directives[Const]?
*/
parseEnumValueDefinition() {
const t = this._lexer.token, i = this.parseDescription(), n = this.parseEnumValueName(), s = this.parseConstDirectives();
return this.node(t, {
kind: L.ENUM_VALUE_DEFINITION,
description: i,
name: n,
directives: s
});
}
/**
* EnumValue : Name but not `true`, `false` or `null`
*/
parseEnumValueName() {
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
throw ue(
this._lexer.source,
this._lexer.token