UNPKG

msw

Version:

Seamless REST/GraphQL API mocking library for browser and Node.js.

1,386 lines (1,367 loc) 980 kB
"use strict"; var MockServiceWorker = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json var require_codes = __commonJS({ "node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json"(exports, module) { module.exports = { "100": "Continue", "101": "Switching Protocols", "102": "Processing", "103": "Early Hints", "200": "OK", "201": "Created", "202": "Accepted", "203": "Non-Authoritative Information", "204": "No Content", "205": "Reset Content", "206": "Partial Content", "207": "Multi-Status", "208": "Already Reported", "226": "IM Used", "300": "Multiple Choices", "301": "Moved Permanently", "302": "Found", "303": "See Other", "304": "Not Modified", "305": "Use Proxy", "307": "Temporary Redirect", "308": "Permanent Redirect", "400": "Bad Request", "401": "Unauthorized", "402": "Payment Required", "403": "Forbidden", "404": "Not Found", "405": "Method Not Allowed", "406": "Not Acceptable", "407": "Proxy Authentication Required", "408": "Request Timeout", "409": "Conflict", "410": "Gone", "411": "Length Required", "412": "Precondition Failed", "413": "Payload Too Large", "414": "URI Too Long", "415": "Unsupported Media Type", "416": "Range Not Satisfiable", "417": "Expectation Failed", "418": "I'm a Teapot", "421": "Misdirected Request", "422": "Unprocessable Entity", "423": "Locked", "424": "Failed Dependency", "425": "Too Early", "426": "Upgrade Required", "428": "Precondition Required", "429": "Too Many Requests", "431": "Request Header Fields Too Large", "451": "Unavailable For Legal Reasons", "500": "Internal Server Error", "501": "Not Implemented", "502": "Bad Gateway", "503": "Service Unavailable", "504": "Gateway Timeout", "505": "HTTP Version Not Supported", "506": "Variant Also Negotiates", "507": "Insufficient Storage", "508": "Loop Detected", "509": "Bandwidth Limit Exceeded", "510": "Not Extended", "511": "Network Authentication Required" }; } }); // node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js var require_statuses = __commonJS({ "node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js"(exports, module) { "use strict"; var codes = require_codes(); module.exports = status; status.message = codes; status.code = createMessageToStatusCodeMap(codes); status.codes = createStatusCodeList(codes); status.redirect = { 300: true, 301: true, 302: true, 303: true, 305: true, 307: true, 308: true }; status.empty = { 204: true, 205: true, 304: true }; status.retry = { 502: true, 503: true, 504: true }; function createMessageToStatusCodeMap(codes2) { var map = {}; Object.keys(codes2).forEach(function forEachCode(code) { var message4 = codes2[code]; var status2 = Number(code); map[message4.toLowerCase()] = status2; }); return map; } function createStatusCodeList(codes2) { return Object.keys(codes2).map(function mapCode(code) { return Number(code); }); } function getStatusCode(message4) { var msg = message4.toLowerCase(); if (!Object.prototype.hasOwnProperty.call(status.code, msg)) { throw new Error('invalid status message: "' + message4 + '"'); } return status.code[msg]; } function getStatusMessage(code) { if (!Object.prototype.hasOwnProperty.call(status.message, code)) { throw new Error("invalid status code: " + code); } return status.message[code]; } function status(code) { if (typeof code === "number") { return getStatusMessage(code); } if (typeof code !== "string") { throw new TypeError("code must be a number or string"); } var n = parseInt(code, 10); if (!isNaN(n)) { return getStatusMessage(n); } return getStatusCode(code); } } }); // node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js var require_dist = __commonJS({ "node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = parse5; exports.serialize = serialize2; var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/; var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/; var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i; var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/; var __toString = Object.prototype.toString; var NullObject = /* @__PURE__ */ (() => { const C = function() { }; C.prototype = /* @__PURE__ */ Object.create(null); return C; })(); function parse5(str, options) { const obj = new NullObject(); const len = str.length; if (len < 2) return obj; const dec = options?.decode || decode; let index = 0; do { const eqIdx = str.indexOf("=", index); if (eqIdx === -1) break; const colonIdx = str.indexOf(";", index); const endIdx = colonIdx === -1 ? len : colonIdx; if (eqIdx > endIdx) { index = str.lastIndexOf(";", eqIdx - 1) + 1; continue; } const keyStartIdx = startIndex(str, index, eqIdx); const keyEndIdx = endIndex(str, eqIdx, keyStartIdx); const key = str.slice(keyStartIdx, keyEndIdx); if (obj[key] === void 0) { let valStartIdx = startIndex(str, eqIdx + 1, endIdx); let valEndIdx = endIndex(str, endIdx, valStartIdx); const value = dec(str.slice(valStartIdx, valEndIdx)); obj[key] = value; } index = endIdx + 1; } while (index < len); return obj; } function startIndex(str, index, max) { do { const code = str.charCodeAt(index); if (code !== 32 && code !== 9) return index; } while (++index < max); return max; } function endIndex(str, index, min) { while (index > min) { const code = str.charCodeAt(--index); if (code !== 32 && code !== 9) return index + 1; } return min; } function serialize2(name, val, options) { const enc = options?.encode || encodeURIComponent; if (!cookieNameRegExp.test(name)) { throw new TypeError(`argument name is invalid: ${name}`); } const value = enc(val); if (!cookieValueRegExp.test(value)) { throw new TypeError(`argument val is invalid: ${val}`); } let str = name + "=" + value; if (!options) return str; if (options.maxAge !== void 0) { if (!Number.isInteger(options.maxAge)) { throw new TypeError(`option maxAge is invalid: ${options.maxAge}`); } str += "; Max-Age=" + options.maxAge; } if (options.domain) { if (!domainValueRegExp.test(options.domain)) { throw new TypeError(`option domain is invalid: ${options.domain}`); } str += "; Domain=" + options.domain; } if (options.path) { if (!pathValueRegExp.test(options.path)) { throw new TypeError(`option path is invalid: ${options.path}`); } str += "; Path=" + options.path; } if (options.expires) { if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) { throw new TypeError(`option expires is invalid: ${options.expires}`); } str += "; Expires=" + options.expires.toUTCString(); } if (options.httpOnly) { str += "; HttpOnly"; } if (options.secure) { str += "; Secure"; } if (options.partitioned) { str += "; Partitioned"; } if (options.priority) { const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0; switch (priority) { case "low": str += "; Priority=Low"; break; case "medium": str += "; Priority=Medium"; break; case "high": str += "; Priority=High"; break; default: throw new TypeError(`option priority is invalid: ${options.priority}`); } } if (options.sameSite) { const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite; switch (sameSite) { case true: case "strict": str += "; SameSite=Strict"; break; case "lax": str += "; SameSite=Lax"; break; case "none": str += "; SameSite=None"; break; default: throw new TypeError(`option sameSite is invalid: ${options.sameSite}`); } } return str; } function decode(str) { if (str.indexOf("%") === -1) return str; try { return decodeURIComponent(str); } catch (e) { return str; } } function isDate(val) { return __toString.call(val) === "[object Date]"; } } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/version.mjs var version2, versionInfo; var init_version = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/version.mjs"() { "use strict"; version2 = "16.12.0"; versionInfo = Object.freeze({ major: 16, minor: 12, patch: 0, preReleaseTag: null }); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/devAssert.mjs function devAssert(condition, message4) { const booleanCondition = Boolean(condition); if (!booleanCondition) { throw new Error(message4); } } var init_devAssert = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/devAssert.mjs"() { "use strict"; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/isPromise.mjs function isPromise(value) { return typeof (value === null || value === void 0 ? void 0 : value.then) === "function"; } var init_isPromise = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/isPromise.mjs"() { "use strict"; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/isObjectLike.mjs function isObjectLike(value) { return typeof value == "object" && value !== null; } var init_isObjectLike = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/isObjectLike.mjs"() { "use strict"; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/invariant.mjs function invariant2(condition, message4) { const booleanCondition = Boolean(condition); if (!booleanCondition) { throw new Error( message4 != null ? message4 : "Unexpected invariant triggered." ); } } var init_invariant = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/jsutils/invariant.mjs"() { "use strict"; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/location.mjs function getLocation(source, position) { let lastLineStart = 0; let line = 1; for (const match2 of source.body.matchAll(LineRegExp)) { typeof match2.index === "number" || invariant2(false); if (match2.index >= position) { break; } lastLineStart = match2.index + match2[0].length; line += 1; } return { line, column: position + 1 - lastLineStart }; } var LineRegExp; var init_location = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/location.mjs"() { "use strict"; init_invariant(); LineRegExp = /\r\n|[\n\r]/g; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/printLocation.mjs function printLocation(location2) { return printSourceLocation( location2.source, getLocation(location2.source, location2.start) ); } function printSourceLocation(source, sourceLocation) { const firstLineColumnOffset = source.locationOffset.column - 1; const body = "".padStart(firstLineColumnOffset) + source.body; const lineIndex = sourceLocation.line - 1; const lineOffset = source.locationOffset.line - 1; const lineNum = sourceLocation.line + lineOffset; const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; const columnNum = sourceLocation.column + columnOffset; const locationStr = `${source.name}:${lineNum}:${columnNum} `; const lines = body.split(/\r\n|[\n\r]/g); const locationLine = lines[lineIndex]; if (locationLine.length > 120) { const subLineIndex = Math.floor(columnNum / 80); const subLineColumnNum = columnNum % 80; const subLines = []; for (let i = 0; i < locationLine.length; i += 80) { subLines.push(locationLine.slice(i, i + 80)); } return locationStr + printPrefixedLines([ [`${lineNum} |`, subLines[0]], ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]), ["|", "^".padStart(subLineColumnNum)], ["|", subLines[subLineIndex + 1]] ]); } return locationStr + printPrefixedLines([ // Lines specified like this: ["prefix", "string"], [`${lineNum - 1} |`, lines[lineIndex - 1]], [`${lineNum} |`, locationLine], ["|", "^".padStart(columnNum)], [`${lineNum + 1} |`, lines[lineIndex + 1]] ]); } function printPrefixedLines(lines) { const existingLines = lines.filter(([_, line]) => line !== void 0); const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n"); } var init_printLocation = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/printLocation.mjs"() { "use strict"; init_location(); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/error/GraphQLError.mjs function toNormalizedOptions(args) { const firstArg = args[0]; if (firstArg == null || "kind" in firstArg || "length" in firstArg) { return { nodes: firstArg, source: args[1], positions: args[2], path: args[3], originalError: args[4], extensions: args[5] }; } return firstArg; } function undefinedIfEmpty(array) { return array === void 0 || array.length === 0 ? void 0 : array; } function printError(error3) { return error3.toString(); } function formatError(error3) { return error3.toJSON(); } var GraphQLError; var init_GraphQLError = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/error/GraphQLError.mjs"() { "use strict"; init_isObjectLike(); init_location(); init_printLocation(); GraphQLError = class _GraphQLError 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(message4, ...rawArgs) { var _this$nodes, _nodeLocations$, _ref; const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs); super(message4); this.name = "GraphQLError"; this.path = path !== null && path !== void 0 ? path : void 0; this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0; this.nodes = undefinedIfEmpty( Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0 ); const nodeLocations = undefinedIfEmpty( (_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null) ); this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source; this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start); this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start)); const originalExtensions = isObjectLike( originalError === null || originalError === void 0 ? void 0 : originalError.extensions ) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0; this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null); Object.defineProperties(this, { message: { writable: true, enumerable: true }, name: { enumerable: false }, nodes: { enumerable: false }, source: { enumerable: false }, positions: { enumerable: false }, originalError: { enumerable: false } }); if (originalError !== null && originalError !== void 0 && originalError.stack) { Object.defineProperty(this, "stack", { value: originalError.stack, writable: true, configurable: true }); } else if (Error.captureStackTrace) { Error.captureStackTrace(this, _GraphQLError); } else { Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true }); } } get [Symbol.toStringTag]() { return "GraphQLError"; } toString() { let output = this.message; if (this.nodes) { for (const node of this.nodes) { if (node.loc) { output += "\n\n" + printLocation(node.loc); } } } else if (this.source && this.locations) { for (const location2 of this.locations) { output += "\n\n" + printSourceLocation(this.source, location2); } } return output; } toJSON() { const formattedError = { message: this.message }; if (this.locations != null) { formattedError.locations = this.locations; } if (this.path != null) { formattedError.path = this.path; } if (this.extensions != null && Object.keys(this.extensions).length > 0) { formattedError.extensions = this.extensions; } return formattedError; } }; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/error/syntaxError.mjs function syntaxError(source, position, description) { return new GraphQLError(`Syntax Error: ${description}`, { source, positions: [position] }); } var init_syntaxError = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/error/syntaxError.mjs"() { "use strict"; init_GraphQLError(); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/ast.mjs function isNode(maybeNode) { const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; return typeof maybeKind === "string" && kindValues.has(maybeKind); } var Location, Token, QueryDocumentKeys, kindValues, OperationTypeNode; var init_ast = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/ast.mjs"() { "use strict"; Location = 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(startToken, endToken, source) { this.start = startToken.start; this.end = endToken.end; this.startToken = startToken; this.endToken = endToken; this.source = source; } get [Symbol.toStringTag]() { return "Location"; } toJSON() { return { start: this.start, end: this.end }; } }; Token = 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(kind, start, end, line, column, value) { this.kind = kind; this.start = start; this.end = end; this.line = line; this.column = column; this.value = value; 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 }; } }; QueryDocumentKeys = { Name: [], Document: ["definitions"], OperationDefinition: [ "description", "name", "variableDefinitions", "directives", "selectionSet" ], VariableDefinition: [ "description", "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: [ "description", "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"], TypeCoordinate: ["name"], MemberCoordinate: ["name", "memberName"], ArgumentCoordinate: ["name", "fieldName", "argumentName"], DirectiveCoordinate: ["name"], DirectiveArgumentCoordinate: ["name", "argumentName"] }; kindValues = new Set(Object.keys(QueryDocumentKeys)); (function(OperationTypeNode2) { OperationTypeNode2["QUERY"] = "query"; OperationTypeNode2["MUTATION"] = "mutation"; OperationTypeNode2["SUBSCRIPTION"] = "subscription"; })(OperationTypeNode || (OperationTypeNode = {})); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/directiveLocation.mjs var DirectiveLocation; var init_directiveLocation = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/directiveLocation.mjs"() { "use strict"; (function(DirectiveLocation2) { DirectiveLocation2["QUERY"] = "QUERY"; DirectiveLocation2["MUTATION"] = "MUTATION"; DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION"; DirectiveLocation2["FIELD"] = "FIELD"; DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION"; DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD"; DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT"; DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION"; DirectiveLocation2["SCHEMA"] = "SCHEMA"; DirectiveLocation2["SCALAR"] = "SCALAR"; DirectiveLocation2["OBJECT"] = "OBJECT"; DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION"; DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION"; DirectiveLocation2["INTERFACE"] = "INTERFACE"; DirectiveLocation2["UNION"] = "UNION"; DirectiveLocation2["ENUM"] = "ENUM"; DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE"; DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT"; DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION"; })(DirectiveLocation || (DirectiveLocation = {})); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/kinds.mjs var Kind; var init_kinds = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/kinds.mjs"() { "use strict"; (function(Kind2) { Kind2["NAME"] = "Name"; Kind2["DOCUMENT"] = "Document"; Kind2["OPERATION_DEFINITION"] = "OperationDefinition"; Kind2["VARIABLE_DEFINITION"] = "VariableDefinition"; Kind2["SELECTION_SET"] = "SelectionSet"; Kind2["FIELD"] = "Field"; Kind2["ARGUMENT"] = "Argument"; Kind2["FRAGMENT_SPREAD"] = "FragmentSpread"; Kind2["INLINE_FRAGMENT"] = "InlineFragment"; Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition"; Kind2["VARIABLE"] = "Variable"; Kind2["INT"] = "IntValue"; Kind2["FLOAT"] = "FloatValue"; Kind2["STRING"] = "StringValue"; Kind2["BOOLEAN"] = "BooleanValue"; Kind2["NULL"] = "NullValue"; Kind2["ENUM"] = "EnumValue"; Kind2["LIST"] = "ListValue"; Kind2["OBJECT"] = "ObjectValue"; Kind2["OBJECT_FIELD"] = "ObjectField"; Kind2["DIRECTIVE"] = "Directive"; Kind2["NAMED_TYPE"] = "NamedType"; Kind2["LIST_TYPE"] = "ListType"; Kind2["NON_NULL_TYPE"] = "NonNullType"; Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition"; Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition"; Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition"; Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition"; Kind2["FIELD_DEFINITION"] = "FieldDefinition"; Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition"; Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition"; Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition"; Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition"; Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition"; Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition"; Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition"; Kind2["SCHEMA_EXTENSION"] = "SchemaExtension"; Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension"; Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension"; Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension"; Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension"; Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension"; Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension"; Kind2["TYPE_COORDINATE"] = "TypeCoordinate"; Kind2["MEMBER_COORDINATE"] = "MemberCoordinate"; Kind2["ARGUMENT_COORDINATE"] = "ArgumentCoordinate"; Kind2["DIRECTIVE_COORDINATE"] = "DirectiveCoordinate"; Kind2["DIRECTIVE_ARGUMENT_COORDINATE"] = "DirectiveArgumentCoordinate"; })(Kind || (Kind = {})); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/characterClasses.mjs function isWhiteSpace(code) { return code === 9 || code === 32; } function isDigit(code) { return code >= 48 && code <= 57; } function isLetter(code) { return code >= 97 && code <= 122 || // A-Z code >= 65 && code <= 90; } function isNameStart(code) { return isLetter(code) || code === 95; } function isNameContinue(code) { return isLetter(code) || isDigit(code) || code === 95; } var init_characterClasses = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/characterClasses.mjs"() { "use strict"; } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/blockString.mjs function dedentBlockStringLines(lines) { var _firstNonEmptyLine2; let commonIndent = Number.MAX_SAFE_INTEGER; let firstNonEmptyLine = null; let lastNonEmptyLine = -1; for (let i = 0; i < lines.length; ++i) { var _firstNonEmptyLine; const line = lines[i]; const indent2 = leadingWhitespace(line); if (indent2 === line.length) { continue; } firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i; lastNonEmptyLine = i; if (i !== 0 && indent2 < commonIndent) { commonIndent = indent2; } } return lines.map((line, i) => i === 0 ? line : line.slice(commonIndent)).slice( (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0, lastNonEmptyLine + 1 ); } function leadingWhitespace(str) { let i = 0; while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { ++i; } return i; } function isPrintableAsBlockString(value) { if (value === "") { return true; } let isEmptyLine = true; let hasIndent = false; let hasCommonIndent = true; let seenNonEmptyLine = false; for (let i = 0; i < value.length; ++i) { switch (value.codePointAt(i)) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 11: case 12: case 14: case 15: return false; // Has non-printable characters case 13: return false; // Has \r or \r\n which will be replaced as \n case 10: if (isEmptyLine && !seenNonEmptyLine) { return false; } seenNonEmptyLine = true; isEmptyLine = true; hasIndent = false; break; case 9: // \t case 32: hasIndent || (hasIndent = isEmptyLine); break; default: hasCommonIndent && (hasCommonIndent = hasIndent); isEmptyLine = false; } } if (isEmptyLine) { return false; } if (hasCommonIndent && seenNonEmptyLine) { return false; } return true; } function printBlockString(value, options) { const escapedValue = value.replace(/"""/g, '\\"""'); const lines = escapedValue.split(/\r\n|[\n\r]/g); const isSingleLine = lines.length === 1; const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; const hasTrailingSlash = value.endsWith("\\"); const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes); let result = ""; const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0)); if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) { result += "\n"; } result += escapedValue; if (printAsMultipleLines || forceTrailingNewline) { result += "\n"; } return '"""' + result + '"""'; } var init_blockString = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/blockString.mjs"() { "use strict"; init_characterClasses(); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/tokenKind.mjs var TokenKind; var init_tokenKind = __esm({ "node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/tokenKind.mjs"() { "use strict"; (function(TokenKind2) { TokenKind2["SOF"] = "<SOF>"; TokenKind2["EOF"] = "<EOF>"; TokenKind2["BANG"] = "!"; TokenKind2["DOLLAR"] = "$"; TokenKind2["AMP"] = "&"; TokenKind2["PAREN_L"] = "("; TokenKind2["PAREN_R"] = ")"; TokenKind2["DOT"] = "."; TokenKind2["SPREAD"] = "..."; TokenKind2["COLON"] = ":"; TokenKind2["EQUALS"] = "="; TokenKind2["AT"] = "@"; TokenKind2["BRACKET_L"] = "["; TokenKind2["BRACKET_R"] = "]"; TokenKind2["BRACE_L"] = "{"; TokenKind2["PIPE"] = "|"; TokenKind2["BRACE_R"] = "}"; TokenKind2["NAME"] = "Name"; TokenKind2["INT"] = "Int"; TokenKind2["FLOAT"] = "Float"; TokenKind2["STRING"] = "String"; TokenKind2["BLOCK_STRING"] = "BlockString"; TokenKind2["COMMENT"] = "Comment"; })(TokenKind || (TokenKind = {})); } }); // node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/language/lexer.mjs function isPunctuatorTokenKind(kind) { return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.DOT || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; } function isUnicodeScalarValue(code) { return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111; } function isSupplementaryCodePoint(body, location2) { return isLeadingSurrogate(body.charCodeAt(location2)) && isTrailingSurrogate(body.charCodeAt(location2 + 1)); } function isLeadingSurrogate(code) { return code >= 55296 && code <= 56319; } function isTrailingSurrogate(code) { return code >= 56320 && code <= 57343; } function printCodePointAt(lexer2, location2) { const code = lexer2.source.body.codePointAt(location2); if (code === void 0) { return TokenKind.EOF; } else if (code >= 32 && code <= 126) { const char = String.fromCodePoint(code); return char === '"' ? `'"'` : `"${char}"`; } return "U+" + code.toString(16).toUpperCase().padStart(4, "0"); } function createToken(lexer2, kind, start, end, value) { const line = lexer2.line; const col = 1 + start - lexer2.lineStart; return new Token(kind, start, end, line, col, value); } function readNextToken(lexer2, start) { const body = lexer2.source.body; const bodyLength = body.length; let position = start; while (position < bodyLength) { const code = body.charCodeAt(position); switch (code) { // Ignored :: // - UnicodeBOM // - WhiteSpace // - LineTerminator // - Comment // - Comma // // UnicodeBOM :: "Byte Order Mark (U+FEFF)" // // WhiteSpace :: // - "Horizontal Tab (U+0009)" // - "Space (U+0020)" // // Comma :: , case 65279: // <BOM> case 9: // \t case 32: // <space> case 44: ++position; continue; // LineTerminator :: // - "New Line (U+000A)" // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] // - "Carriage Return (U+000D)" "New Line (U+000A)" case 10: ++position; ++lexer2.line; lexer2.lineStart = position; continue; case 13: if (body.charCodeAt(position + 1) === 10) { position += 2; } else { ++position; } ++lexer2.line; lexer2.lineStart = position; continue; // Comment case 35: return readComment(lexer2, position); // Token :: // - Punctuator // - Name // - IntValue // - FloatValue // - StringValue // // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } case 33: return createToken(lexer2, TokenKind.BANG, position, position + 1); case 36: return createToken(lexer2, TokenKind.DOLLAR, position, position + 1); case 38: return createToken(lexer2, TokenKind.AMP, position, position + 1); case 40: return createToken(lexer2, TokenKind.PAREN_L, position, position + 1); case 41: return createToken(lexer2, TokenKind.PAREN_R, position, position + 1); case 46: if (body.charCodeAt(position + 1) === 46 && body.charCodeAt(position + 2) === 46) { return createToken(lexer2, TokenKind.SPREAD, position, position + 3); } break; case 58: return createToken(lexer2, TokenKind.COLON, position, position + 1); case 61: return createToken(lexer2, TokenKind.EQUALS, position, position + 1); case 64: return createToken(lexer2, TokenKind.AT, position, position + 1); case 91: return createToken(lexer2, TokenKind.BRACKET_L, position, position + 1); case 93: return createToken(lexer2, TokenKind.BRACKET_R, position, position + 1); case 123: return createToken(lexer2, TokenKind.BRACE_L, position, position + 1); case 124: return createToken(lexer2, TokenKind.PIPE, position, position + 1); case 125: return createToken(lexer2, TokenKind.BRACE_R, position, position + 1); // StringValue case 34: if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { return readBlockString(lexer2, position); } return readString(lexer2, position); } if (isDigit(code) || code === 45) { return readNumber(lexer2, position, code); } if (isNameStart(code)) { return readName(lexer2, position); } throw syntaxError( lexer2.source, position, code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) ? `Unexpected character: ${printCodePointAt(lexer2, position)}.` : `Invalid character: ${printCodePointAt(lexer2, position)}.` ); } return createToken(lexer2, TokenKind.EOF, bodyLength, bodyLength); } function readComment(lexer2, start) { const body = lexer2.source.body; const bodyLength = body.length; let position = start + 1; while (position < bodyLength) { const code = body.charCodeAt(position); if (code === 10 || code === 13) { break; } if (isUnicodeScalarValue(code)) { ++position; } else if (isSupplementaryCodePoint(body, position)) { position += 2; } else { break; } } return createToken( lexer2, TokenKind.COMMENT, start, position, body.slice(start + 1, position) ); } function readNumber(lexer2, start, firstCode) { const body = lexer2.source.body; let position = start; let code = firstCode; let isFloat = false; if (code === 45) { code = body.charCodeAt(++position); } if (code === 48) { code = body.charCodeAt(++position); if (isDigit(code)) { throw syntaxError( lexer2.source, position, `Invalid number, unexpected digit after 0: ${printCodePointAt( lexer2, position )}.` ); } } else { position = readDigits(lexer2, position, code); code = body.charCodeAt(position); } if (code === 46) { isFloat = true; code = body.charCodeAt(++position); position = readDigits(lexer2, position, code); code = body.charCodeAt(position); } if (code === 69 || code === 101) { isFloat = true; code = body.charCodeAt(++position); if (code === 43 || code === 45) { code = body.charCodeAt(++position); } position = readDigits(lexer2, position, code); code = body.charCodeAt(position); } if (code === 46 || isNameStart(code)) { throw syntaxError( lexer2.source, position, `Invalid number, expected digit but got: ${printCodePointAt( lexer2, position )}.` ); } return createToken( lexer2, isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, body.slice(start, position) ); } function readDigits(lexer2, start, firstCode) { if (!isDigit(firstCode)) { throw syntaxError( lexer2.source, start, `Invalid number, expected digit but got: ${printCodePointAt( lexer2, start )}.` ); } const body = lexer2.source.body; let position = start + 1; while (isDigit(body.charCodeAt(position))) { ++position; } return position; } function readString(lexer2, start) { const body = lexer2.source.body; const bodyLength = body.length; let position = start + 1; let chunkStart = position; let value = ""; while (position < bodyLength) { const code = body.charCodeAt(position); if (code === 34) { value += body.slice(chunkStart, position); return createToken(lexer2, TokenKind.STRING, start, position + 1, value); } if (code === 92) { value += body.slice(chunkStart, position); const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer2, position) : readEscapedUnicodeFixedWidth(lexer2, position) : readEscapedCharacter(lexer2, position); value += escape.value; position += escape.size; chunkStart = position; continue; } if (code === 10 || code === 13) { break; } if (isUnicodeScalarValue(code)) { ++position; } else if (isSupplementaryCodePoint(body, position)) { position += 2; } else { throw syntaxError( lexer2.source, position, `Invalid character within String: ${printCodePointAt( lexer2, position )}.` ); } } throw syntaxError(lexer2.source, position, "Unterminated string."); } function readEscapedUnicodeVariableWidth(lexer2, position) { const body = lexer2.sou