soonjs 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deps/{acorn-tklbyr11e.js → acorn-1oc5bnxht.js} +10 -10
- package/dist/deps/acorn-8dcdyq2ew.js +2895 -0
- package/dist/deps/angular-46ezrk1u4.js +1 -0
- package/dist/deps/angular-s1xz11ikt.js +1448 -0
- package/dist/deps/babel-0wg32lzwx.js +6844 -0
- package/dist/deps/{babel-48ei1aig4.js → babel-ukpqzojf5.js} +10 -10
- package/dist/deps/estree-kdvyujfa4.js +4265 -0
- package/dist/deps/{estree-4o5bj9gvd.js → estree-keanyt70z.js} +23 -23
- package/dist/deps/flow-0bur80d37.js +26221 -0
- package/dist/deps/{flow-xlruu7boa.js → flow-ugrhj6801.js} +15 -15
- package/dist/deps/glimmer-fj2j8ttlo.js +2756 -0
- package/dist/deps/{glimmer-kyfivr6g7.js → glimmer-g89edvgvf.js} +18 -18
- package/dist/deps/{graphql-xojtytb2p.js → graphql-amtjbpo5r.js} +12 -12
- package/dist/deps/graphql-y9qq36k5p.js +1212 -0
- package/dist/deps/html-2g2e1kuqu.js +2623 -0
- package/dist/deps/{html-jal5w2b1p.js → html-flg3eek30.js} +17 -17
- package/dist/deps/markdown-4jfu7be9n.js +3058 -0
- package/dist/deps/{markdown-qhqqns7vp.js → markdown-7x2u7akwf.js} +40 -40
- package/dist/deps/meriyah-3gk7mqup6.js +2320 -0
- package/dist/deps/meriyah-6mdlkd9e4.js +4 -0
- package/dist/deps/{postcss-vq400h6ym.js → postcss-2wa48tg1s.js} +21 -21
- package/dist/deps/postcss-zmmc2gk0l.js +4664 -0
- package/dist/deps/soon-id-4bhrd5e6a.js +30 -0
- package/dist/deps/soon-id-exfiforio.js +1 -0
- package/dist/deps/typescript-bgdn0fi0y.js +12794 -0
- package/dist/deps/{typescript-jihynpl9y.js → typescript-q1t5ixgyo.js} +11 -11
- package/dist/deps/yaml-ajia8oazz.js +4088 -0
- package/dist/deps/{yaml-auqgv4vnk.js → yaml-wpxyjc78l.js} +26 -26
- package/dist/index.cjs +15 -0
- package/dist/index.js +2217 -9
- package/dist/vite-plugin-soon-client.cjs +249 -0
- package/dist/vite-plugin-soon-client.js +48725 -152
- package/dist/vite-plugin-soon-server.cjs +272 -0
- package/dist/vite-plugin-soon-server.d.ts +1 -0
- package/dist/vite-plugin-soon-server.js +3276 -19
- package/package.json +18 -1
- package/dist/deps/angular-m17t0gdsi.js +0 -1
- package/dist/deps/meriyah-sl495y757.js +0 -4
- package/dist/deps/soon-id-gmzr57ufv.js +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
1
|
+
"use strict";var ye=Object.defineProperty;var Oe=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Q=(e,t,n)=>Oe(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Ae=Object.defineProperty,Z=(e,t)=>{for(var n in t)Ae(e,n,{get:t[n],enumerable:!0})},ee={};Z(ee,{languages:()=>ce,options:()=>ue,parsers:()=>q,printers:()=>ve});var De=(e,t,n,r)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(n,r):n.global?t.replace(n,r):t.split(n).join(r)},B=De,xe="indent",ge="group",_e="if-break",Y="line",ke="break-parent",Se=()=>{},Ce=Se;function v(e){return{type:xe,contents:e}}function y(e,t={}){return Ce(t.expandedStates),{type:ge,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function A(e,t="",n={}){return{type:_e,breakContents:e,flatContents:t,groupId:n.groupId}}var be={type:ke},Le={type:Y,hard:!0},C={type:Y},p={type:Y,soft:!0},h=[Le,be];function E(e,t){let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}function J(e){return(t,n,r)=>{let i=!!(r!=null&&r.backwards);if(n===!1)return!1;let{length:s}=t,o=n;for(;o>=0&&o<s;){let c=t.charAt(o);if(e instanceof RegExp){if(!e.test(c))return o}else if(!e.includes(c))return o;i?o--:o++}return o===-1||o===s?o:!1}}var te=J(" "),Re=J(",; "),Fe=J(/[^\n\r]/u);function we(e,t,n){let r=!!(n!=null&&n.backwards);if(t===!1)return!1;let i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
|
|
2
2
|
`)return t-2;if(i===`
|
|
3
3
|
`||i==="\r"||i==="\u2028"||i==="\u2029")return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
|
|
4
4
|
`)return t+2;if(i===`
|
|
5
|
-
`||i==="\r"||i==="\u2028"||i==="\u2029")return t+1}return t}var
|
|
5
|
+
`||i==="\r"||i==="\u2028"||i==="\u2029")return t+1}return t}var ne=we;function Pe(e,t,n={}){let r=te(e,n.backwards?t-1:t,n),i=ne(e,r,n);return r!==i}var Ue=Pe;function Ve(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var Me=Ve;function Be(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Fe(e,t):t}var je=Be;function Ke(e,t){let n=null,r=t;for(;r!==n;)n=r,r=Re(e,r),r=Me(e,r),r=te(e,r);return r=je(e,r),r=ne(e,r),r!==!1&&Ue(e,r)}var $e=Ke;function Ge(e){return Array.isArray(e)&&e.length>0}var ie=Ge,Ye=class extends Error{constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`);Q(this,"name","UnexpectedNodeError");this.node=t}},Je=Ye,L=null;function F(e){if(L!==null&&typeof L.property){let t=L;return L=F.prototype=null,t}return L=F.prototype=e??Object.create(null),new F}var qe=10;for(let e=0;e<=qe;e++)F();function Qe(e){return F(e)}function Xe(e,t="type"){Qe(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var ze=Xe,He=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},re=class{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,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}}},se={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","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"]};new Set(Object.keys(se));var S;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(S||(S={}));var We=ze(se,"kind"),Ze=We;function ae(e){return e.loc.start}function oe(e){return e.loc.end}function et(e){return/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u.test(e)}function tt(e){return`# @format
|
|
6
6
|
|
|
7
|
-
`+e}function
|
|
7
|
+
`+e}function nt(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(C):i.push(h),i}var x=nt;function it(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...E(h,O(e,t,n,"definitions")),h];case"OperationDefinition":{let i=t.originalText[ae(r)]!=="{",s=!!r.name;return[i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&ie(r.variableDefinitions)?" ":"",X(e,n),N(e,n,r),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return["fragment ",n("name"),X(e,n)," on ",n("typeCondition"),N(e,n,r)," ",n("selectionSet")];case"SelectionSet":return["{",v([h,E(h,O(e,t,n,"selections"))]),h,"}"];case"Field":return y([r.alias?[n("alias"),": "]:"",n("name"),r.arguments.length>0?y(["(",v([p,E([A("",", "),p],O(e,t,n,"arguments"))]),p,")"]):"",N(e,n,r),r.selectionSet?" ":"",n("selectionSet")]);case"Name":return r.value;case"StringValue":if(r.block){let i=B(!1,r.value,'"""',String.raw`\"""`).split(`
|
|
8
8
|
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),E(h,['"""',...i,'"""'])}return['"',B(!1,B(!1,r.value,/["\\]/gu,String.raw`\$&`),`
|
|
9
|
-
`,String.raw`\n`),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":return y(["[",v([p,E([A("",", "),p],e.map(n,"values"))]),p,"]"]);case"ObjectValue":{let i=t.bracketSpacing&&r.fields.length>0?" ":"";return y(["{",i,v([p,E([A("",", "),p],e.map(n,"fields"))]),p,A("",i),"}"])}case"ObjectField":case"Argument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),r.arguments.length>0?y(["(",v([p,E([A("",", "),p],
|
|
10
|
-
`)&&(t.value=e.value.trim())}
|
|
11
|
-
`,m=r.split(/\r\n|[\n\r]/g),_=m[i];if(_.length>120){let D=Math.floor(u/80),M=u%80,T=[];for(let k=0;k<_.length;k+=80)T.push(_.slice(k,k+80));return I+
|
|
12
|
-
`)}function
|
|
9
|
+
`,String.raw`\n`),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":return y(["[",v([p,E([A("",", "),p],e.map(n,"values"))]),p,"]"]);case"ObjectValue":{let i=t.bracketSpacing&&r.fields.length>0?" ":"";return y(["{",i,v([p,E([A("",", "),p],e.map(n,"fields"))]),p,A("",i),"}"])}case"ObjectField":case"Argument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),r.arguments.length>0?y(["(",v([p,E([A("",", "),p],O(e,t,n,"arguments"))]),p,")"]):""];case"NamedType":return n("name");case"VariableDefinition":return[n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",N(e,n,r)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(x(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&r.interfaces.length>0&&s.push(" implements ",...at(e,t,n)),s.push(N(e,n,r)),r.fields.length>0&&s.push([" {",v([h,E(h,O(e,t,n,"fields"))]),h,"}"]),s}case"FieldDefinition":return[x(e,t,n),n("name"),r.arguments.length>0?y(["(",v([p,E([A("",", "),p],O(e,t,n,"arguments"))]),p,")"]):"",": ",n("type"),N(e,n,r)];case"DirectiveDefinition":return[x(e,t,n),"directive ","@",n("name"),r.arguments.length>0?y(["(",v([p,E([A("",", "),p],O(e,t,n,"arguments"))]),p,")"]):"",r.repeatable?" repeatable":""," on ",...E(" | ",e.map(n,"locations"))];case"EnumTypeExtension":case"EnumTypeDefinition":return[x(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),N(e,n,r),r.values.length>0?[" {",v([h,E(h,O(e,t,n,"values"))]),h,"}"]:""];case"EnumValueDefinition":return[x(e,t,n),n("name"),N(e,n,r)];case"InputValueDefinition":return[x(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",N(e,n,r)];case"SchemaExtension":return["extend schema",N(e,n,r),...r.operationTypes.length>0?[" {",v([h,E(h,O(e,t,n,"operationTypes"))]),h,"}"]:[]];case"SchemaDefinition":return[x(e,t,n),"schema",N(e,n,r)," {",r.operationTypes.length>0?v([h,E(h,O(e,t,n,"operationTypes"))]):"",h,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),N(e,n,r)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",N(e,n,r)," ",n("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return y([x(e,t,n),y([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),N(e,n,r),r.types.length>0?[" =",A(""," "),v([A([C,"| "]),E([C,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[x(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),N(e,n,r)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Je(r,"Graphql","kind")}}function N(e,t,n){if(n.directives.length===0)return"";let r=E(C,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?y([C,r]):[" ",y(v([p,r]))]}function O(e,t,n,r){return e.map(({isLast:i,node:s})=>{let o=n();return!i&&$e(t.originalText,oe(s))?[o,h]:o},r)}function rt(e){return e.kind!=="Comment"}function st(e){let t=e.node;if(t.kind==="Comment")return"#"+t.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(t))}function at(e,t,n){let{node:r}=e,i=[],{interfaces:s}=r,o=e.map(n,"interfaces");for(let c=0;c<s.length;c++){let u=s[c];i.push(o[c]);let I=s[c+1];if(I){let m=t.originalText.slice(u.loc.end,I.loc.start).includes("#");i.push(" &",m?C:" ")}}return i}function X(e,t){let{node:n}=e;return ie(n.variableDefinitions)?y(["(",v([p,E([A("",", "),p],e.map(t,"variableDefinitions"))]),p,")"]):""}function le(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
10
|
+
`)&&(t.value=e.value.trim())}le.ignoredProperties=new Set(["loc","comments"]);function ot(e){var t;let{node:n}=e;return(t=n==null?void 0:n.comments)==null?void 0:t.some(r=>r.value.trim()==="prettier-ignore")}var lt={print:it,massageAstNode:le,hasPrettierIgnore:ot,insertPragma:tt,printComment:st,canAttachComment:rt,getVisitorKeys:Ze},ct=lt,ce=[{linguistLanguageId:139,name:"GraphQL",type:"data",color:"#e10098",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",aceMode:"text",parsers:["graphql"],vscodeLanguageIds:["graphql"]}],ut={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}},pt={bracketSpacing:ut.bracketSpacing},ue=pt,q={};Z(q,{graphql:()=>Xt});function ht(e){return typeof e=="object"&&e!==null}function dt(e,t){throw new Error("Unexpected invariant triggered.")}var ft=/\r\n|[\n\r]/g;function $(e,t){let n=0,r=1;for(let i of e.body.matchAll(ft)){if(typeof i.index=="number"||dt(),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Et(e){return pe(e.source,$(e.source,e.start))}function pe(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,c=t.line===1?n:0,u=t.column+c,I=`${e.name}:${o}:${u}
|
|
11
|
+
`,m=r.split(/\r\n|[\n\r]/g),_=m[i];if(_.length>120){let D=Math.floor(u/80),M=u%80,T=[];for(let k=0;k<_.length;k+=80)T.push(_.slice(k,k+80));return I+z([[`${o} |`,T[0]],...T.slice(1,D+1).map(k=>["|",k]),["|","^".padStart(M)],["|",T[D+1]]])}return I+z([[`${o-1} |`,m[i-1]],[`${o} |`,_],["|","^".padStart(u)],[`${o+1} |`,m[i+1]]])}function z(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
12
|
+
`)}function mt(e){let 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}var Tt=class he extends Error{constructor(t,...n){var r,i,s;let{nodes:o,source:c,positions:u,path:I,originalError:m,extensions:_}=mt(n);super(t),this.name="GraphQLError",this.path=I??void 0,this.originalError=m??void 0,this.nodes=H(Array.isArray(o)?o:o?[o]:void 0);let D=H((r=this.nodes)===null||r===void 0?void 0:r.map(T=>T.loc).filter(T=>T!=null));this.source=c??(D==null||(i=D[0])===null||i===void 0?void 0:i.source),this.positions=u??(D==null?void 0:D.map(T=>T.start)),this.locations=u&&c?u.map(T=>$(c,T)):D==null?void 0:D.map(T=>$(T.source,T.start));let M=ht(m==null?void 0:m.extensions)?m==null?void 0:m.extensions:void 0;this.extensions=(s=_??M)!==null&&s!==void 0?s: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}}),m!=null&&m.stack?Object.defineProperty(this,"stack",{value:m.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,he):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(let n of this.nodes)n.loc&&(t+=`
|
|
13
13
|
|
|
14
|
-
`+
|
|
14
|
+
`+Et(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
15
15
|
|
|
16
|
-
`+
|
|
17
|
-
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw f(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function
|
|
18
|
-
`));return e.line+=u.length-1,e.lineStart=i,m}if(I===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){c+=n.slice(o,s),o=s+1,s+=4;continue}if(I===10||I===13){c+=n.slice(o,s),u.push(c),I===13&&n.charCodeAt(s+1)===10?s+=2:++s,c="",o=s,i=s;continue}if(b(I))++s;else if(U(n,s))s+=2;else throw f(e.source,s,`Invalid character within String: ${g(e,s)}.`)}throw f(e.source,s,"Unterminated string.")}function
|
|
16
|
+
`+pe(this.source,n);return t}toJSON(){let 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 H(e){return e===void 0||e.length===0?void 0:e}function f(e,t,n){return new Tt(`Syntax Error: ${n}`,{source:e,positions:[t]})}var G;(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"})(G||(G={}));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 Nt(e){return e===9||e===32}function w(e){return e>=48&&e<=57}function de(e){return e>=97&&e<=122||e>=65&&e<=90}function fe(e){return de(e)||e===95}function It(e){return de(e)||w(e)||e===95}function vt(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let o=0;o<e.length;++o){var s;let c=e[o],u=yt(c);u!==c.length&&(r=(s=r)!==null&&s!==void 0?s:o,i=o,o!==0&&u<n&&(n=u))}return e.map((o,c)=>c===0?o:o.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function yt(e){let t=0;for(;t<e.length&&Nt(e.charCodeAt(t));)++t;return t}var a;(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"})(a||(a={}));var Ot=class{constructor(e){let t=new re(a.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.EOF)do if(e.next)e=e.next;else{let t=Dt(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.COMMENT);return e}};function At(e){return e===a.BANG||e===a.DOLLAR||e===a.AMP||e===a.PAREN_L||e===a.PAREN_R||e===a.SPREAD||e===a.COLON||e===a.EQUALS||e===a.AT||e===a.BRACKET_L||e===a.BRACKET_R||e===a.BRACE_L||e===a.PIPE||e===a.BRACE_R}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function U(e,t){return Ee(e.charCodeAt(t))&&me(e.charCodeAt(t+1))}function Ee(e){return e>=55296&&e<=56319}function me(e){return e>=56320&&e<=57343}function g(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return a.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function d(e,t,n,r,i){let s=e.line,o=1+n-e.lineStart;return new re(t,n,r,s,o,i)}function Dt(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return xt(e,i);case 33:return d(e,a.BANG,i,i+1);case 36:return d(e,a.DOLLAR,i,i+1);case 38:return d(e,a.AMP,i,i+1);case 40:return d(e,a.PAREN_L,i,i+1);case 41:return d(e,a.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return d(e,a.SPREAD,i,i+3);break;case 58:return d(e,a.COLON,i,i+1);case 61:return d(e,a.EQUALS,i,i+1);case 64:return d(e,a.AT,i,i+1);case 91:return d(e,a.BRACKET_L,i,i+1);case 93:return d(e,a.BRACKET_R,i,i+1);case 123:return d(e,a.BRACE_L,i,i+1);case 124:return d(e,a.PIPE,i,i+1);case 125:return d(e,a.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?bt(e,i):_t(e,i)}if(w(s)||s===45)return gt(e,i,s);if(fe(s))return Lt(e,i);throw f(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:b(s)||U(n,i)?`Unexpected character: ${g(e,i)}.`:`Invalid character: ${g(e,i)}.`)}return d(e,a.EOF,r,r)}function xt(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(s===10||s===13)break;if(b(s))++i;else if(U(n,i))i+=2;else break}return d(e,a.COMMENT,t,i,n.slice(t+1,i))}function gt(e,t,n){let r=e.source.body,i=t,s=n,o=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),w(s))throw f(e.source,i,`Invalid number, unexpected digit after 0: ${g(e,i)}.`)}else i=j(e,i,s),s=r.charCodeAt(i);if(s===46&&(o=!0,s=r.charCodeAt(++i),i=j(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(o=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=j(e,i,s),s=r.charCodeAt(i)),s===46||fe(s))throw f(e.source,i,`Invalid number, expected digit but got: ${g(e,i)}.`);return d(e,o?a.FLOAT:a.INT,t,i,r.slice(t,i))}function j(e,t,n){if(!w(n))throw f(e.source,t,`Invalid number, expected digit but got: ${g(e,t)}.`);let r=e.source.body,i=t+1;for(;w(r.charCodeAt(i));)++i;return i}function _t(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,o="";for(;i<r;){let c=n.charCodeAt(i);if(c===34)return o+=n.slice(s,i),d(e,a.STRING,t,i+1,o);if(c===92){o+=n.slice(s,i);let u=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?kt(e,i):St(e,i):Ct(e,i);o+=u.value,i+=u.size,s=i;continue}if(c===10||c===13)break;if(b(c))++i;else if(U(n,i))i+=2;else throw f(e.source,i,`Invalid character within String: ${g(e,i)}.`)}throw f(e.source,i,"Unterminated string.")}function kt(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!b(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|R(s),r<0)break}throw f(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function St(e,t){let n=e.source.body,r=W(n,t+2);if(b(r))return{value:String.fromCodePoint(r),size:6};if(Ee(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=W(n,t+8);if(me(i))return{value:String.fromCodePoint(r,i),size:12}}throw f(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function W(e,t){return R(e.charCodeAt(t))<<12|R(e.charCodeAt(t+1))<<8|R(e.charCodeAt(t+2))<<4|R(e.charCodeAt(t+3))}function R(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ct(e,t){let n=e.source.body;switch(n.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:`
|
|
17
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw f(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function bt(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,o=s,c="",u=[];for(;s<r;){let I=n.charCodeAt(s);if(I===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){c+=n.slice(o,s),u.push(c);let m=d(e,a.BLOCK_STRING,t,s+3,vt(u).join(`
|
|
18
|
+
`));return e.line+=u.length-1,e.lineStart=i,m}if(I===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){c+=n.slice(o,s),o=s+1,s+=4;continue}if(I===10||I===13){c+=n.slice(o,s),u.push(c),I===13&&n.charCodeAt(s+1)===10?s+=2:++s,c="",o=s,i=s;continue}if(b(I))++s;else if(U(n,s))s+=2;else throw f(e.source,s,`Invalid character within String: ${g(e,s)}.`)}throw f(e.source,s,"Unterminated string.")}function Lt(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(It(s))++i;else break}return d(e,a.NAME,t,i,n.slice(t,i))}function K(e,t){throw new Error(t)}function Te(e){return V(e,[])}function V(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Rt(e,t);default:return String(e)}}function Rt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(Ft(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:V(r,n)}else if(Array.isArray(e))return Pt(e,n);return wt(e,n)}function Ft(e){return typeof e.toJSON=="function"}function wt(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+Ut(e)+"]":"{ "+n.map(([r,i])=>r+": "+V(i,t)).join(", ")+" }"}function Pt(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(V(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Ut(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var Vt=globalThis.process&&!0,Mt=Vt?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var n;let r=t.prototype[Symbol.toStringTag],i=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(r===i){let s=Te(e);throw new Error(`Cannot use ${r} "${s}" from another module or realm.
|
|
19
19
|
|
|
20
20
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
21
21
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -26,4 +26,4 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
26
26
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
27
27
|
versions may have different capabilities and behavior. The data from one
|
|
28
28
|
version used in the function from another could produce confusing and
|
|
29
|
-
spurious results.`)}}return!1},me=class{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||K(!1,`Body must be a string. Received: ${Ee(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||K(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||K(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function Mt(e){return Vt(e,me)}function Bt(e,t){return new jt(e,t).parseDocument()}var jt=class{constructor(e,t={}){let n=Mt(e)?e:new me(e);this._lexer=new yt(n),this._options=t,this._tokenCounter=0}parseName(){let e=this.expectToken(a.NAME);return this.node(e,{kind:l.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:l.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===a.NAME){switch(t.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(e)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(e,{kind:l.OPERATION_DEFINITION,operation:S.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseOperationType(),n;return this.peek(a.NAME)&&(n=this.parseName()),this.node(e,{kind:l.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(a.NAME);switch(e.value){case"query":return S.QUERY;case"mutation":return S.MUTATION;case"subscription":return S.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:l.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(e,{kind:l.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:l.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(a.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:l.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,t,a.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(a.SPREAD);let t=this.expectOptionalKeyword("on");return!t&&this.peek(a.NAME)?this.node(e,{kind:l.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:l.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{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(e,{kind:l.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){let t=this._lexer.token;switch(t.kind){case a.BRACKET_L:return this.parseList(e);case a.BRACE_L:return this.parseObject(e);case a.INT:return this.advanceLexer(),this.node(t,{kind:l.INT,value:t.value});case a.FLOAT:return this.advanceLexer(),this.node(t,{kind:l.FLOAT,value:t.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:l.BOOLEAN,value:!0});case"false":return this.node(t,{kind:l.BOOLEAN,value:!1});case"null":return this.node(t,{kind:l.NULL});default:return this.node(t,{kind:l.ENUM,value:t.value})}case a.DOLLAR:if(e)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){let n=this._lexer.token.value;throw f(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:l.STRING,value:e.value,block:e.kind===a.BLOCK_STRING})}parseList(e){let t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:l.LIST,values:this.any(a.BRACKET_L,t,a.BRACKET_R)})}parseObject(e){let t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:l.OBJECT,fields:this.any(a.BRACE_L,t,a.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(a.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(a.AT),this.node(t,{kind:l.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(a.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(a.BRACKET_R),t=this.node(e,{kind:l.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(e,{kind:l.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:l.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.many(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(e,{kind:l.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(a.COLON);let n=this.parseNamedType();return this.node(e,{kind:l.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:l.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(a.COLON);let i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:l.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(a.COLON);let r=this.parseTypeReference(),i;this.expectOptionalToken(a.EQUALS)&&(i=this.parseConstValueLiteral());let s=this.parseConstDirectives();return this.node(e,{kind:l.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:l.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:l.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:l.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw f(this._lexer.source,this._lexer.token.start,`${P(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===a.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let t=this.parseConstDirectives(),n=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:l.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:l.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:l.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:l.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);let n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let s=this.parseDirectiveLocations();return this.node(e,{kind:l.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(G,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new Qe(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw f(this._lexer.source,t.start,`Expected ${Te(e)}, found ${P(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){let t=this._lexer.token;if(t.kind===a.NAME&&t.value===e)this.advanceLexer();else throw f(this._lexer.source,t.start,`Expected "${e}", found ${P(t)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===a.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){let t=e??this._lexer.token;return f(this._lexer.source,t.start,`Unexpected ${P(t)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,t=this._lexer.advance();if(e!==void 0&&t.kind!==a.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw f(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function P(e){let t=e.value;return Te(e.kind)+(t!=null?` "${t}"`:"")}function Te(e){return xt(e)?`"${e}"`:e}function Kt(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var $t=Kt;function Gt(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var Yt={allowLegacyFragmentVariables:!0};function Jt(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return $t(t,{loc:{start:n},cause:e})}return e}function qt(e){let t;try{t=Bt(e,Yt)}catch(n){throw Jt(n)}return t.comments=Gt(t),t}var Qt={parse:qt,astFormat:"graphql",hasPragma:He,locStart:se,locEnd:ae},Xt={graphql:at},Ht=Z;export{Ht as default,ot as languages,ut as options,le as parsers,Xt as printers};
|
|
29
|
+
spurious results.`)}}return!1},Ne=class{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||K(!1,`Body must be a string. Received: ${Te(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||K(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||K(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function Bt(e){return Mt(e,Ne)}function jt(e,t){return new Kt(e,t).parseDocument()}var Kt=class{constructor(e,t={}){let n=Bt(e)?e:new Ne(e);this._lexer=new Ot(n),this._options=t,this._tokenCounter=0}parseName(){let e=this.expectToken(a.NAME);return this.node(e,{kind:l.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:l.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===a.NAME){switch(t.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(e)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(e,{kind:l.OPERATION_DEFINITION,operation:S.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseOperationType(),n;return this.peek(a.NAME)&&(n=this.parseName()),this.node(e,{kind:l.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(a.NAME);switch(e.value){case"query":return S.QUERY;case"mutation":return S.MUTATION;case"subscription":return S.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:l.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(e,{kind:l.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:l.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(a.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:l.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,t,a.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(a.SPREAD);let t=this.expectOptionalKeyword("on");return!t&&this.peek(a.NAME)?this.node(e,{kind:l.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:l.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{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(e,{kind:l.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){let t=this._lexer.token;switch(t.kind){case a.BRACKET_L:return this.parseList(e);case a.BRACE_L:return this.parseObject(e);case a.INT:return this.advanceLexer(),this.node(t,{kind:l.INT,value:t.value});case a.FLOAT:return this.advanceLexer(),this.node(t,{kind:l.FLOAT,value:t.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:l.BOOLEAN,value:!0});case"false":return this.node(t,{kind:l.BOOLEAN,value:!1});case"null":return this.node(t,{kind:l.NULL});default:return this.node(t,{kind:l.ENUM,value:t.value})}case a.DOLLAR:if(e)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){let n=this._lexer.token.value;throw f(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:l.STRING,value:e.value,block:e.kind===a.BLOCK_STRING})}parseList(e){let t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:l.LIST,values:this.any(a.BRACKET_L,t,a.BRACKET_R)})}parseObject(e){let t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:l.OBJECT,fields:this.any(a.BRACE_L,t,a.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(a.COLON),this.node(t,{kind:l.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(a.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(a.AT),this.node(t,{kind:l.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(a.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(a.BRACKET_R),t=this.node(e,{kind:l.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(e,{kind:l.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:l.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.many(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(e,{kind:l.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(a.COLON);let n=this.parseNamedType();return this.node(e,{kind:l.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:l.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(a.COLON);let i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:l.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(a.COLON);let r=this.parseTypeReference(),i;this.expectOptionalToken(a.EQUALS)&&(i=this.parseConstValueLiteral());let s=this.parseConstDirectives();return this.node(e,{kind:l.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:l.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:l.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:l.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:l.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw f(this._lexer.source,this._lexer.token.start,`${P(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===a.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let t=this.parseConstDirectives(),n=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:l.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:l.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:l.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:l.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:l.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);let n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let s=this.parseDirectiveLocations();return this.node(e,{kind:l.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(G,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new He(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw f(this._lexer.source,t.start,`Expected ${Ie(e)}, found ${P(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){let t=this._lexer.token;if(t.kind===a.NAME&&t.value===e)this.advanceLexer();else throw f(this._lexer.source,t.start,`Expected "${e}", found ${P(t)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===a.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){let t=e??this._lexer.token;return f(this._lexer.source,t.start,`Unexpected ${P(t)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,t=this._lexer.advance();if(e!==void 0&&t.kind!==a.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw f(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function P(e){let t=e.value;return Ie(e.kind)+(t!=null?` "${t}"`:"")}function Ie(e){return At(e)?`"${e}"`:e}function $t(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var Gt=$t;function Yt(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var Jt={allowLegacyFragmentVariables:!0};function qt(e){if((e==null?void 0:e.name)==="GraphQLError"){let{message:t,locations:[n]}=e;return Gt(t,{loc:{start:n},cause:e})}return e}function Qt(e){let t;try{t=jt(e,Jt)}catch(n){throw qt(n)}return t.comments=Yt(t),t}var Xt={parse:Qt,astFormat:"graphql",hasPragma:et,locStart:ae,locEnd:oe},ve={graphql:ct},zt=ee;exports.default=zt;exports.languages=ce;exports.options=ue;exports.parsers=q;exports.printers=ve;
|