@builtbystack/sq-shopify-theme-sdk 0.0.20 → 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/README.md +115 -1
- package/dist/sq-shopify-theme-sdk.d.ts +60 -1
- package/dist/sq-shopify-theme-sdk.js +173 -129
- package/dist/sq-shopify-theme-sdk.umd.js +51 -29
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(P,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(P=typeof globalThis<"u"?globalThis:P||self,D(P.SQ={}))})(this,function(P){"use strict";var vn=Object.defineProperty;var An=(P,D,B)=>D in P?vn(P,D,{enumerable:!0,configurable:!0,writable:!0,value:B}):P[D]=B;var je=(P,D,B)=>(An(P,typeof D!="symbol"?D+"":D,B),B);function D(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const B=JSON,$e=e=>e.toUpperCase(),He=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ye=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ze=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Qe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function X(e,t){if(!!!e)throw new Error(t)}function Je(e){return typeof e=="object"&&e!==null}function Xe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const We=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(We)){if(typeof i.index=="number"||Xe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ke(e){return Ne(e.source,le(e.source,e.start))}function Ne(e,t){const 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,h=t.column+c,p=`${e.name}:${o}:${h}
|
|
2
2
|
`,m=r.split(/\r\n|[\n\r]/g),y=m[i];if(y.length>120){const C=Math.floor(h/80),T=h%80,g=[];for(let N=0;N<y.length;N+=80)g.push(y.slice(N,N+80));return p+Ie([[`${o} |`,g[0]],...g.slice(1,C+1).map(N=>["|",N]),["|","^".padStart(T)],["|",g[C+1]]])}return p+Ie([[`${o-1} |`,m[i-1]],[`${o} |`,y],["|","^".padStart(h)],[`${o+1} |`,m[i+1]]])}function Ie(e){const 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(`
|
|
3
3
|
`)}function Ze(e){const t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}class de extends Error{constructor(t,...n){var r,i,s;const{nodes:o,source:c,positions:h,path:p,originalError:m,extensions:y}=Ze(n);super(t),this.name="GraphQLError",this.path=p??void 0,this.originalError=m??void 0,this.nodes=be(Array.isArray(o)?o:o?[o]:void 0);const C=be((r=this.nodes)===null||r===void 0?void 0:r.map(g=>g.loc).filter(g=>g!=null));this.source=c??(C==null||(i=C[0])===null||i===void 0?void 0:i.source),this.positions=h??(C==null?void 0:C.map(g=>g.start)),this.locations=h&&c?h.map(g=>le(c,g)):C==null?void 0:C.map(g=>le(g.source,g.start));const T=Je(m==null?void 0:m.extensions)?m==null?void 0:m.extensions:void 0;this.extensions=(s=y??T)!==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,de):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(t+=`
|
|
4
4
|
|
|
5
5
|
`+Ke(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
|
|
6
6
|
|
|
7
|
-
`+Ne(this.source,n);return t}toJSON(){const t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function be(e){return e===void 0||e.length===0?void 0:e}function b(e,t,n){return new de(`Syntax Error: ${n}`,{source:e,positions:[t]})}class et{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class xe{constructor(t,n,r,i,s,o){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const
|
|
7
|
+
`+Ne(this.source,n);return t}toJSON(){const t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function be(e){return e===void 0||e.length===0?void 0:e}function b(e,t,n){return new de(`Syntax Error: ${n}`,{source:e,positions:[t]})}class et{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class xe{constructor(t,n,r,i,s,o){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Re={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"]},tt=new Set(Object.keys(Re));function Se(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&tt.has(t)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(q||(q={}));var he;(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"})(he||(he={}));var f;(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"})(f||(f={}));function pe(e){return e===9||e===32}function H(e){return e>=48&&e<=57}function Oe(e){return e>=97&&e<=122||e>=65&&e<=90}function De(e){return Oe(e)||e===95}function nt(e){return Oe(e)||H(e)||e===95}function rt(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let o=0;o<e.length;++o){var s;const c=e[o],h=it(c);h!==c.length&&(r=(s=r)!==null&&s!==void 0?s:o,i=o,o!==0&&h<n&&(n=h))}return e.map((o,c)=>c===0?o:o.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function it(e){let t=0;for(;t<e.length&&pe(e.charCodeAt(t));)++t;return t}function st(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(T=>T.length===0||pe(T.charCodeAt(0))),o=n.endsWith('\\"""'),c=e.endsWith('"')&&!o,h=e.endsWith("\\"),p=c||h,m=!(t!=null&&t.minimize)&&(!i||e.length>70||p||s||o);let y="";const C=i&&pe(e.charCodeAt(0));return(m&&!C||s)&&(y+=`
|
|
8
8
|
`),y+=n,(m||p)&&(y+=`
|
|
9
|
-
`),'"""'+y+'"""'}var u;(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"})(u||(u={}));class ot{constructor(t){const n=new xe(u.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==u.EOF)do if(t.next)t=t.next;else{const n=ut(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===u.COMMENT);return t}}function at(e){return e===u.BANG||e===u.DOLLAR||e===u.AMP||e===u.PAREN_L||e===u.PAREN_R||e===u.SPREAD||e===u.COLON||e===u.EQUALS||e===u.AT||e===u.BRACKET_L||e===u.BRACKET_R||e===u.BRACE_L||e===u.PIPE||e===u.BRACE_R}function V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(e,t){return ke(e.charCodeAt(t))&&
|
|
9
|
+
`),'"""'+y+'"""'}var u;(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"})(u||(u={}));class ot{constructor(t){const n=new xe(u.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==u.EOF)do if(t.next)t=t.next;else{const n=ut(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===u.COMMENT);return t}}function at(e){return e===u.BANG||e===u.DOLLAR||e===u.AMP||e===u.PAREN_L||e===u.PAREN_R||e===u.SPREAD||e===u.COLON||e===u.EQUALS||e===u.AT||e===u.BRACKET_L||e===u.BRACKET_R||e===u.BRACE_L||e===u.PIPE||e===u.BRACE_R}function V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(e,t){return ke(e.charCodeAt(t))&&Pe(e.charCodeAt(t+1))}function ke(e){return e>=55296&&e<=56319}function Pe(e){return e>=56320&&e<=57343}function U(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return u.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function I(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new xe(t,n,r,s,o,i)}function ut(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const 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 ct(e,i);case 33:return I(e,u.BANG,i,i+1);case 36:return I(e,u.DOLLAR,i,i+1);case 38:return I(e,u.AMP,i,i+1);case 40:return I(e,u.PAREN_L,i,i+1);case 41:return I(e,u.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return I(e,u.SPREAD,i,i+3);break;case 58:return I(e,u.COLON,i,i+1);case 61:return I(e,u.EQUALS,i,i+1);case 64:return I(e,u.AT,i,i+1);case 91:return I(e,u.BRACKET_L,i,i+1);case 93:return I(e,u.BRACKET_R,i,i+1);case 123:return I(e,u.BRACE_L,i,i+1);case 124:return I(e,u.PIPE,i,i+1);case 125:return I(e,u.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?mt(e,i):dt(e,i)}if(H(s)||s===45)return lt(e,i,s);if(De(s))return gt(e,i);throw b(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:V(s)||W(n,i)?`Unexpected character: ${U(e,i)}.`:`Invalid character: ${U(e,i)}.`)}return I(e,u.EOF,r,r)}function ct(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(s===10||s===13)break;if(V(s))++i;else if(W(n,i))i+=2;else break}return I(e,u.COMMENT,t,i,n.slice(t+1,i))}function lt(e,t,n){const r=e.source.body;let i=t,s=n,o=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),H(s))throw b(e.source,i,`Invalid number, unexpected digit after 0: ${U(e,i)}.`)}else i=fe(e,i,s),s=r.charCodeAt(i);if(s===46&&(o=!0,s=r.charCodeAt(++i),i=fe(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=fe(e,i,s),s=r.charCodeAt(i)),s===46||De(s))throw b(e.source,i,`Invalid number, expected digit but got: ${U(e,i)}.`);return I(e,o?u.FLOAT:u.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!H(n))throw b(e.source,t,`Invalid number, expected digit but got: ${U(e,t)}.`);const r=e.source.body;let i=t+1;for(;H(r.charCodeAt(i));)++i;return i}function dt(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,o="";for(;i<r;){const c=n.charCodeAt(i);if(c===34)return o+=n.slice(s,i),I(e,u.STRING,t,i+1,o);if(c===92){o+=n.slice(s,i);const h=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ht(e,i):pt(e,i):ft(e,i);o+=h.value,i+=h.size,s=i;continue}if(c===10||c===13)break;if(V(c))++i;else if(W(n,i))i+=2;else throw b(e.source,i,`Invalid character within String: ${U(e,i)}.`)}throw b(e.source,i,"Unterminated string.")}function ht(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const s=n.charCodeAt(t+i++);if(s===125){if(i<5||!V(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Y(s),r<0)break}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function pt(e,t){const n=e.source.body,r=_e(n,t+2);if(V(r))return{value:String.fromCodePoint(r),size:6};if(ke(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=_e(n,t+8);if(Pe(i))return{value:String.fromCodePoint(r,i),size:12}}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function _e(e,t){return Y(e.charCodeAt(t))<<12|Y(e.charCodeAt(t+1))<<8|Y(e.charCodeAt(t+2))<<4|Y(e.charCodeAt(t+3))}function Y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ft(e,t){const 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:`
|
|
10
10
|
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw b(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function mt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,c="";const h=[];for(;s<r;){const p=n.charCodeAt(s);if(p===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){c+=n.slice(o,s),h.push(c);const m=I(e,u.BLOCK_STRING,t,s+3,rt(h).join(`
|
|
11
11
|
`));return e.line+=h.length-1,e.lineStart=i,m}if(p===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(p===10||p===13){c+=n.slice(o,s),h.push(c),p===13&&n.charCodeAt(s+1)===10?s+=2:++s,c="",o=s,i=s;continue}if(V(p))++s;else if(W(n,s))s+=2;else throw b(e.source,s,`Invalid character within String: ${U(e,s)}.`)}throw b(e.source,s,"Unterminated string.")}function gt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(nt(s))++i;else break}return I(e,u.NAME,t,i,n.slice(t,i))}const yt=10,Le=2;function me(e){return K(e,[])}function K(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Ct(e,t);default:return String(e)}}function Ct(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Et(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:K(r,n)}else if(Array.isArray(e))return At(e,n);return vt(e,n)}function Et(e){return typeof e.toJSON=="function"}function vt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Le?"["+Tt(e)+"]":"{ "+n.map(([i,s])=>i+": "+K(s,t)).join(", ")+" }"}function At(e,t){if(e.length===0)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(yt,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(K(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Tt(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}const Nt=globalThis.process&&globalThis.process.env.NODE_ENV==="production"?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var r;const i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){const o=me(t);throw new Error(`Cannot use ${i} "${o}" from another module or realm.
|
|
12
12
|
|
|
@@ -19,36 +19,36 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
19
19
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
20
20
|
versions may have different capabilities and behavior. The data from one
|
|
21
21
|
version used in the function from another could produce confusing and
|
|
22
|
-
spurious results.`)}}return!1};class we{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||X(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function It(e){return Nt(e,we)}function Fe(e,t){return new bt(e,t).parseDocument()}class bt{constructor(t,n={}){const r=It(t)?t:new we(t);this._lexer=new ot(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(u.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(u.SOF,this.parseDefinition,u.EOF)})}parseDefinition(){if(this.peek(u.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===u.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw b(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(u.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:q.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(u.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(u.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(u.PAREN_L,this.parseVariableDefinition,u.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(u.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(u.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(u.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(u.BRACE_L,this.parseSelection,u.BRACE_R)})}parseSelection(){return this.peek(u.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(u.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(u.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(u.PAREN_L,n,u.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(u.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(u.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(u.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:f.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(t){const n=this._lexer.token;switch(n.kind){case u.BRACKET_L:return this.parseList(t);case u.BRACE_L:return this.parseObject(t);case u.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case u.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case u.STRING:case u.BLOCK_STRING:return this.parseStringLiteral();case u.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case u.DOLLAR:if(t)if(this.expectToken(u.DOLLAR),this._lexer.token.kind===u.NAME){const r=this._lexer.token.value;throw b(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===u.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(u.BRACKET_L,n,u.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(u.BRACE_L,n,u.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(u.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(u.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(u.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(u.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(u.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(u.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(u.STRING)||this.peek(u.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(u.BRACE_L,this.parseOperationTypeDefinition,u.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(u.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(u.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(u.BRACE_L,this.parseFieldDefinition,u.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(u.COLON);const s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(u.PAREN_L,this.parseInputValueDef,u.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(u.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(u.EQUALS)&&(s=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(u.EQUALS)?this.delimitedMany(u.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(u.BRACE_L,this.parseEnumValueDefinition,u.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw b(this._lexer.source,this._lexer.token.start,`${Z(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(u.BRACE_L,this.parseInputValueDef,u.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===u.NAME)switch(t.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(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(u.BRACE_L,this.parseOperationTypeDefinition,u.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(u.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:o})}parseDirectiveLocations(){return this.delimitedMany(u.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(he,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new et(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw b(this._lexer.source,n.start,`Expected ${Be(t)}, found ${Z(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===u.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${Z(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===u.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${Z(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==u.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function Z(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function xt(e){return`"${e.replace(St,Dt)}"`}const St=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dt(e){return Ot[e.charCodeAt(0)]}const Ot=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Rt=Object.freeze({});function kt(e,t,n=Se){const r=new Map;for(const k of Object.values(f))r.set(k,_t(t,k));let i,s=Array.isArray(e),o=[e],c=-1,h=[],p=e,m,y;const C=[],T=[];do{c++;const k=c===o.length,oe=k&&h.length!==0;if(k){if(m=T.length===0?void 0:C[C.length-1],p=y,y=T.pop(),oe)if(s){p=p.slice();let L=0;for(const[$,ae]of h){const ue=$-L;ae===null?(p.splice(ue,1),L++):p[ue]=ae}}else{p=Object.defineProperties({},Object.getOwnPropertyDescriptors(p));for(const[L,$]of h)p[L]=$}c=i.index,o=i.keys,h=i.edits,s=i.inArray,i=i.prev}else if(y){if(m=s?c:o[c],p=y[m],p==null)continue;C.push(m)}let w;if(!Array.isArray(p)){var g,N;De(p)||X(!1,`Invalid AST Node: ${me(p)}.`);const L=k?(g=r.get(p.kind))===null||g===void 0?void 0:g.leave:(N=r.get(p.kind))===null||N===void 0?void 0:N.enter;if(w=L==null?void 0:L.call(t,p,m,y,C,T),w===Rt)break;if(w===!1){if(!k){C.pop();continue}}else if(w!==void 0&&(h.push([m,w]),!k))if(De(w))p=w;else{C.pop();continue}}if(w===void 0&&oe&&h.push([m,p]),k)C.pop();else{var O;i={inArray:s,index:c,keys:o,edits:h,prev:i},s=Array.isArray(p),o=s?p:(O=n[p.kind])!==null&&O!==void 0?O:[],c=-1,h=[],y&&T.push(y),y=p}}while(i!==void 0);return h.length!==0?h[h.length-1][1]:e}function _t(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function Pt(e){return kt(e,wt)}const Lt=80,wt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>d(e.definitions,`
|
|
22
|
+
spurious results.`)}}return!1};class we{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||X(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function It(e){return Nt(e,we)}function Fe(e,t){return new bt(e,t).parseDocument()}class bt{constructor(t,n={}){const r=It(t)?t:new we(t);this._lexer=new ot(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(u.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(u.SOF,this.parseDefinition,u.EOF)})}parseDefinition(){if(this.peek(u.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===u.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw b(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(u.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:q.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(u.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(u.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(u.PAREN_L,this.parseVariableDefinition,u.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(u.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(u.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(u.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(u.BRACE_L,this.parseSelection,u.BRACE_R)})}parseSelection(){return this.peek(u.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(u.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(u.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(u.PAREN_L,n,u.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(u.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(u.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(u.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:f.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(t){const n=this._lexer.token;switch(n.kind){case u.BRACKET_L:return this.parseList(t);case u.BRACE_L:return this.parseObject(t);case u.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case u.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case u.STRING:case u.BLOCK_STRING:return this.parseStringLiteral();case u.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case u.DOLLAR:if(t)if(this.expectToken(u.DOLLAR),this._lexer.token.kind===u.NAME){const r=this._lexer.token.value;throw b(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===u.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(u.BRACKET_L,n,u.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(u.BRACE_L,n,u.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(u.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(u.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(u.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(u.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(u.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(u.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(u.STRING)||this.peek(u.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(u.BRACE_L,this.parseOperationTypeDefinition,u.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(u.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(u.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(u.BRACE_L,this.parseFieldDefinition,u.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(u.COLON);const s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(u.PAREN_L,this.parseInputValueDef,u.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(u.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(u.EQUALS)&&(s=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(u.EQUALS)?this.delimitedMany(u.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(u.BRACE_L,this.parseEnumValueDefinition,u.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw b(this._lexer.source,this._lexer.token.start,`${Z(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(u.BRACE_L,this.parseInputValueDef,u.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===u.NAME)switch(t.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(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(u.BRACE_L,this.parseOperationTypeDefinition,u.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(u.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:o})}parseDirectiveLocations(){return this.delimitedMany(u.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(he,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new et(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw b(this._lexer.source,n.start,`Expected ${Be(t)}, found ${Z(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===u.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${Z(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===u.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${Z(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==u.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function Z(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function xt(e){return`"${e.replace(Rt,St)}"`}const Rt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function St(e){return Ot[e.charCodeAt(0)]}const Ot=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Dt=Object.freeze({});function kt(e,t,n=Re){const r=new Map;for(const k of Object.values(f))r.set(k,Pt(t,k));let i,s=Array.isArray(e),o=[e],c=-1,h=[],p=e,m,y;const C=[],T=[];do{c++;const k=c===o.length,oe=k&&h.length!==0;if(k){if(m=T.length===0?void 0:C[C.length-1],p=y,y=T.pop(),oe)if(s){p=p.slice();let L=0;for(const[$,ae]of h){const ue=$-L;ae===null?(p.splice(ue,1),L++):p[ue]=ae}}else{p=Object.defineProperties({},Object.getOwnPropertyDescriptors(p));for(const[L,$]of h)p[L]=$}c=i.index,o=i.keys,h=i.edits,s=i.inArray,i=i.prev}else if(y){if(m=s?c:o[c],p=y[m],p==null)continue;C.push(m)}let w;if(!Array.isArray(p)){var g,N;Se(p)||X(!1,`Invalid AST Node: ${me(p)}.`);const L=k?(g=r.get(p.kind))===null||g===void 0?void 0:g.leave:(N=r.get(p.kind))===null||N===void 0?void 0:N.enter;if(w=L==null?void 0:L.call(t,p,m,y,C,T),w===Dt)break;if(w===!1){if(!k){C.pop();continue}}else if(w!==void 0&&(h.push([m,w]),!k))if(Se(w))p=w;else{C.pop();continue}}if(w===void 0&&oe&&h.push([m,p]),k)C.pop();else{var O;i={inArray:s,index:c,keys:o,edits:h,prev:i},s=Array.isArray(p),o=s?p:(O=n[p.kind])!==null&&O!==void 0?O:[],c=-1,h=[],y&&T.push(y),y=p}}while(i!==void 0);return h.length!==0?h[h.length-1][1]:e}function Pt(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function _t(e){return kt(e,wt)}const Lt=80,wt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>d(e.definitions,`
|
|
23
23
|
|
|
24
|
-
`)},OperationDefinition:{leave(e){const t=v("(",d(e.variableDefinitions,", "),")"),n=d([e.operation,d([e.name,t]),d(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+v(" = ",n)+v(" ",d(r," "))},SelectionSet:{leave:({selections:e})=>
|
|
24
|
+
`)},OperationDefinition:{leave(e){const t=v("(",d(e.variableDefinitions,", "),")"),n=d([e.operation,d([e.name,t]),d(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+v(" = ",n)+v(" ",d(r," "))},SelectionSet:{leave:({selections:e})=>_(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=v("",e,": ")+t;let o=s+v("(",d(n,", "),")");return o.length>Lt&&(o=s+v(`(
|
|
25
25
|
`,ee(d(n,`
|
|
26
26
|
`)),`
|
|
27
27
|
)`)),d([o,d(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+v(" ",d(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>d(["...",v("on ",e),d(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${v("(",d(n,", "),")")} on ${t} ${v("",d(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?st(e):xt(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+d(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+d(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+v("(",d(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>v("",e,`
|
|
28
|
-
`)+d(["schema",d(t," "),
|
|
28
|
+
`)+d(["schema",d(t," "),_(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
|
|
29
29
|
`)+d(["scalar",t,d(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
|
|
30
|
-
`)+d(["type",t,v("implements ",d(n," & ")),d(r," "),
|
|
30
|
+
`)+d(["type",t,v("implements ",d(n," & ")),d(r," "),_(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>v("",e,`
|
|
31
31
|
`)+t+(Ue(n)?v(`(
|
|
32
32
|
`,ee(d(n,`
|
|
33
33
|
`)),`
|
|
34
34
|
)`):v("(",d(n,", "),")"))+": "+r+v(" ",d(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>v("",e,`
|
|
35
35
|
`)+d([t+": "+n,v("= ",r),d(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
|
|
36
|
-
`)+d(["interface",t,v("implements ",d(n," & ")),d(r," "),
|
|
36
|
+
`)+d(["interface",t,v("implements ",d(n," & ")),d(r," "),_(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>v("",e,`
|
|
37
37
|
`)+d(["union",t,d(n," "),v("= ",d(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>v("",e,`
|
|
38
|
-
`)+d(["enum",t,d(n," "),
|
|
38
|
+
`)+d(["enum",t,d(n," "),_(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
|
|
39
39
|
`)+d([t,d(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>v("",e,`
|
|
40
|
-
`)+d(["input",t,d(n," "),
|
|
40
|
+
`)+d(["input",t,d(n," "),_(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>v("",e,`
|
|
41
41
|
`)+"directive @"+t+(Ue(n)?v(`(
|
|
42
42
|
`,ee(d(n,`
|
|
43
43
|
`)),`
|
|
44
|
-
)`):v("(",d(n,", "),")"))+(r?" repeatable":"")+" on "+d(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>d(["extend schema",d(e," "),
|
|
44
|
+
)`):v("(",d(n,", "),")"))+(r?" repeatable":"")+" on "+d(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>d(["extend schema",d(e," "),_(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>d(["extend scalar",e,d(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>d(["extend type",e,v("implements ",d(t," & ")),d(n," "),_(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>d(["extend interface",e,v("implements ",d(t," & ")),d(n," "),_(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>d(["extend union",e,d(t," "),v("= ",d(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>d(["extend enum",e,d(t," "),_(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>d(["extend input",e,d(t," "),_(n)]," ")}};function d(e,t=""){var n;return(n=e==null?void 0:e.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function _(e){return v(`{
|
|
45
45
|
`,ee(d(e,`
|
|
46
46
|
`)),`
|
|
47
47
|
}`)}function v(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function ee(e){return v(" ",e.replace(/\n/g,`
|
|
48
48
|
`))}function Ue(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
|
|
49
|
-
`)))!==null&&t!==void 0?t:!1}const Me=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},ge=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Me(r)}catch{}return{query:e,operationName:n}}const t=Me(e);return{query:Pt(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ft,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(o){var c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function h(a){return a&&DataView.prototype.isPrototypeOf(a)}if(c.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(a){return a&&p.indexOf(Object.prototype.toString.call(a))>-1};function y(a){if(typeof a!="string"&&(a=String(a)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function C(a){return typeof a!="string"&&(a=String(a)),a}function T(a){var l={next:function(){var E=a.shift();return{done:E===void 0,value:E}}};return c.iterable&&(l[Symbol.iterator]=function(){return l}),l}function g(a){this.map={},a instanceof g?a.forEach(function(l,E){this.append(E,l)},this):Array.isArray(a)?a.forEach(function(l){this.append(l[0],l[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(l){this.append(l,a[l])},this)}g.prototype.append=function(a,l){a=y(a),l=C(l);var E=this.map[a];this.map[a]=E?E+", "+l:l},g.prototype.delete=function(a){delete this.map[y(a)]},g.prototype.get=function(a){return a=y(a),this.has(a)?this.map[a]:null},g.prototype.has=function(a){return this.map.hasOwnProperty(y(a))},g.prototype.set=function(a,l){this.map[y(a)]=C(l)},g.prototype.forEach=function(a,l){for(var E in this.map)this.map.hasOwnProperty(E)&&a.call(l,this.map[E],E,this)},g.prototype.keys=function(){var a=[];return this.forEach(function(l,E){a.push(E)}),T(a)},g.prototype.values=function(){var a=[];return this.forEach(function(l){a.push(l)}),T(a)},g.prototype.entries=function(){var a=[];return this.forEach(function(l,E){a.push([E,l])}),T(a)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function N(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function O(a){return new Promise(function(l,E){a.onload=function(){l(a.result)},a.onerror=function(){E(a.error)}})}function k(a){var l=new FileReader,E=O(l);return l.readAsArrayBuffer(a),E}function oe(a){var l=new FileReader,E=O(l);return l.readAsText(a),E}function w(a){for(var l=new Uint8Array(a),E=new Array(l.length),S=0;S<l.length;S++)E[S]=String.fromCharCode(l[S]);return E.join("")}function L(a){if(a.slice)return a.slice(0);var l=new Uint8Array(a.byteLength);return l.set(new Uint8Array(a)),l.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(a){this._bodyInit=a,a?typeof a=="string"?this._bodyText=a:c.blob&&Blob.prototype.isPrototypeOf(a)?this._bodyBlob=a:c.formData&&FormData.prototype.isPrototypeOf(a)?this._bodyFormData=a:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)?this._bodyText=a.toString():c.arrayBuffer&&c.blob&&h(a)?(this._bodyArrayBuffer=L(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(a)||m(a))?this._bodyArrayBuffer=L(a):this._bodyText=a=Object.prototype.toString.call(a):this._bodyText="",this.headers.get("content-type")||(typeof a=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var a=N(this);if(a)return a;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?N(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var a=N(this);if(a)return a;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(w(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(gn)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ue(a){var l=a.toUpperCase();return ae.indexOf(l)>-1?l:a}function M(a,l){l=l||{};var E=l.body;if(a instanceof M){if(a.bodyUsed)throw new TypeError("Already read");this.url=a.url,this.credentials=a.credentials,l.headers||(this.headers=new g(a.headers)),this.method=a.method,this.mode=a.mode,this.signal=a.signal,!E&&a._bodyInit!=null&&(E=a._bodyInit,a.bodyUsed=!0)}else this.url=String(a);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new g(l.headers)),this.method=ue(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function gn(a){var l=new FormData;return a.trim().split("&").forEach(function(E){if(E){var S=E.split("="),x=S.shift().replace(/\+/g," "),A=S.join("=").replace(/\+/g," ");l.append(decodeURIComponent(x),decodeURIComponent(A))}}),l}function yn(a){var l=new g,E=a.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(S){var x=S.split(":"),A=x.shift().trim();if(A){var ce=x.join(":").trim();l.append(A,ce)}}),l}$.call(M.prototype);function F(a,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new g(l.headers),this.url=l.url||"",this._initBody(a)}$.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},F.error=function(){var a=new F(null,{status:0,statusText:""});return a.type="error",a};var Cn=[301,302,303,307,308];F.redirect=function(a,l){if(Cn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new F(null,{status:l,headers:{location:a}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(l,E){this.message=l,this.name=E;var S=Error(l);this.stack=S.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Ae(a,l){return new Promise(function(E,S){var x=new M(a,l);if(x.signal&&x.signal.aborted)return S(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function ce(){A.abort()}A.onload=function(){var J={status:A.status,statusText:A.statusText,headers:yn(A.getAllResponseHeaders()||"")};J.url="responseURL"in A?A.responseURL:J.headers.get("X-Request-URL");var Te="response"in A?A.response:A.responseText;E(new F(Te,J))},A.onerror=function(){S(new TypeError("Network request failed"))},A.ontimeout=function(){S(new TypeError("Network request failed"))},A.onabort=function(){S(new o.DOMException("Aborted","AbortError"))},A.open(x.method,x.url,!0),x.credentials==="include"?A.withCredentials=!0:x.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&c.blob&&(A.responseType="blob"),x.headers.forEach(function(J,Te){A.setRequestHeader(Te,J)}),x.signal&&(x.signal.addEventListener("abort",ce),A.onreadystatechange=function(){A.readyState===4&&x.signal.removeEventListener("abort",ce)}),A.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return Ae.polyfill=!0,s.fetch||(s.fetch=Ae,s.Headers=g,s.Request=M,s.Response=F),o.Headers=g,o.Request=M,o.Response=F,o.fetch=Ae,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(ye,ye.exports);var te=ye.exports;const ne=Bt(te),Ut=R({__proto__:null,default:ne},[te]),j=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Ut&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Mt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:c,middleware:h}=t,p={...t.headers};let m="",y;e==="POST"?(y=jt(r,i,s,c.jsonSerializer),typeof y=="string"&&(p["Content-Type"]="application/json")):m=Mt({query:r,variables:i,operationName:s,jsonSerializer:c.jsonSerializer??B});const C={method:e,headers:p,body:y,...c};let T=n,g=C;if(h){const N=await Promise.resolve(h({...C,url:n,operationName:s,variables:i})),{url:O,...k}=N;T=O,g=k}return m&&(T=`${T}?${m}`),await o(T,g)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,o]=r,c=ze(i,s,o),{headers:h,fetch:p=ne,method:m="POST",requestMiddleware:y,responseMiddleware:C,...T}=this.requestConfig,{url:g}=this;c.signal!==void 0&&(T.signal=c.signal);const{operationName:N}=ge(c.query);return Ce({url:g,query:c.query,variables:c.variables,headers:{...j(Ee(h)),...j(c.requestHeaders)},operationName:N,fetch:p,method:m,fetchOptions:T,middleware:y}).then(O=>(C&&C(O),O)).catch(O=>{throw C&&C(O),O})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:o,fetch:c=ne,method:h="POST",requestMiddleware:p,responseMiddleware:m,...y}=this.requestConfig,{url:C}=this;s.signal!==void 0&&(y.signal=s.signal);const{query:T,operationName:g}=ge(s.document);return Ce({url:C,query:T,variables:s.variables,headers:{...j(Ee(o)),...j(s.requestHeaders)},operationName:g,fetch:c,method:h,fetchOptions:y,middleware:p}).then(N=>(m&&m(N),N.data)).catch(N=>{throw m&&m(N),N})}batchRequests(t,n){const r=Qe(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const o=r.documents.map(({document:h})=>ge(h).query),c=r.documents.map(({variables:h})=>h);return Ce({url:this.url,query:o,variables:c,headers:{...j(Ee(i)),...j(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(h=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h.data)).catch(h=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Ce=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=qt($e(e.method??"post")),s=Array.isArray(e.query),o=await i(e),c=await Gt(o,r.jsonSerializer??B),h=Array.isArray(c)?!c.some(({data:m})=>!m):!!c.data,p=Array.isArray(c)||!c.errors||Array.isArray(c.errors)&&!c.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(o.ok&&p&&h){const{errors:m,...y}=(Array.isArray(c),c),C=r.errorPolicy==="ignore"?y:c;return{...s?{data:C}:C,headers:o.headers,status:o.status}}else{const m=typeof c=="string"?{error:c}:c;throw new z({...m,status:o.status,headers:o.headers},{query:t,variables:n})}},jt=(e,t,n,r)=>{const i=r??B;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((o,c,h)=>(o.push({query:c,variables:t?t[h]:void 0}),o),[]);return i.stringify(s)},Gt=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Ee=e=>typeof e=="function"?e():e;var re=function(){return re=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},re.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var ie=new Map,ve=new Map,Ve=!0,se=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function $t(e){return je(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=$t(r.loc),o=ve.get(i);o&&!o.has(s)?Ve&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
49
|
+
`)))!==null&&t!==void 0?t:!1}const Me=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},ge=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Me(r)}catch{}return{query:e,operationName:n}}const t=Me(e);return{query:_t(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ft,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(o){var c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function h(a){return a&&DataView.prototype.isPrototypeOf(a)}if(c.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(a){return a&&p.indexOf(Object.prototype.toString.call(a))>-1};function y(a){if(typeof a!="string"&&(a=String(a)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function C(a){return typeof a!="string"&&(a=String(a)),a}function T(a){var l={next:function(){var E=a.shift();return{done:E===void 0,value:E}}};return c.iterable&&(l[Symbol.iterator]=function(){return l}),l}function g(a){this.map={},a instanceof g?a.forEach(function(l,E){this.append(E,l)},this):Array.isArray(a)?a.forEach(function(l){this.append(l[0],l[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(l){this.append(l,a[l])},this)}g.prototype.append=function(a,l){a=y(a),l=C(l);var E=this.map[a];this.map[a]=E?E+", "+l:l},g.prototype.delete=function(a){delete this.map[y(a)]},g.prototype.get=function(a){return a=y(a),this.has(a)?this.map[a]:null},g.prototype.has=function(a){return this.map.hasOwnProperty(y(a))},g.prototype.set=function(a,l){this.map[y(a)]=C(l)},g.prototype.forEach=function(a,l){for(var E in this.map)this.map.hasOwnProperty(E)&&a.call(l,this.map[E],E,this)},g.prototype.keys=function(){var a=[];return this.forEach(function(l,E){a.push(E)}),T(a)},g.prototype.values=function(){var a=[];return this.forEach(function(l){a.push(l)}),T(a)},g.prototype.entries=function(){var a=[];return this.forEach(function(l,E){a.push([E,l])}),T(a)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function N(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function O(a){return new Promise(function(l,E){a.onload=function(){l(a.result)},a.onerror=function(){E(a.error)}})}function k(a){var l=new FileReader,E=O(l);return l.readAsArrayBuffer(a),E}function oe(a){var l=new FileReader,E=O(l);return l.readAsText(a),E}function w(a){for(var l=new Uint8Array(a),E=new Array(l.length),R=0;R<l.length;R++)E[R]=String.fromCharCode(l[R]);return E.join("")}function L(a){if(a.slice)return a.slice(0);var l=new Uint8Array(a.byteLength);return l.set(new Uint8Array(a)),l.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(a){this._bodyInit=a,a?typeof a=="string"?this._bodyText=a:c.blob&&Blob.prototype.isPrototypeOf(a)?this._bodyBlob=a:c.formData&&FormData.prototype.isPrototypeOf(a)?this._bodyFormData=a:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)?this._bodyText=a.toString():c.arrayBuffer&&c.blob&&h(a)?(this._bodyArrayBuffer=L(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(a)||m(a))?this._bodyArrayBuffer=L(a):this._bodyText=a=Object.prototype.toString.call(a):this._bodyText="",this.headers.get("content-type")||(typeof a=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var a=N(this);if(a)return a;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?N(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var a=N(this);if(a)return a;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(w(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(yn)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ue(a){var l=a.toUpperCase();return ae.indexOf(l)>-1?l:a}function M(a,l){l=l||{};var E=l.body;if(a instanceof M){if(a.bodyUsed)throw new TypeError("Already read");this.url=a.url,this.credentials=a.credentials,l.headers||(this.headers=new g(a.headers)),this.method=a.method,this.mode=a.mode,this.signal=a.signal,!E&&a._bodyInit!=null&&(E=a._bodyInit,a.bodyUsed=!0)}else this.url=String(a);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new g(l.headers)),this.method=ue(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(E)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function yn(a){var l=new FormData;return a.trim().split("&").forEach(function(E){if(E){var R=E.split("="),x=R.shift().replace(/\+/g," "),A=R.join("=").replace(/\+/g," ");l.append(decodeURIComponent(x),decodeURIComponent(A))}}),l}function Cn(a){var l=new g,E=a.replace(/\r?\n[\t ]+/g," ");return E.split(/\r?\n/).forEach(function(R){var x=R.split(":"),A=x.shift().trim();if(A){var ce=x.join(":").trim();l.append(A,ce)}}),l}$.call(M.prototype);function F(a,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new g(l.headers),this.url=l.url||"",this._initBody(a)}$.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},F.error=function(){var a=new F(null,{status:0,statusText:""});return a.type="error",a};var En=[301,302,303,307,308];F.redirect=function(a,l){if(En.indexOf(l)===-1)throw new RangeError("Invalid status code");return new F(null,{status:l,headers:{location:a}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(l,E){this.message=l,this.name=E;var R=Error(l);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Ae(a,l){return new Promise(function(E,R){var x=new M(a,l);if(x.signal&&x.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function ce(){A.abort()}A.onload=function(){var J={status:A.status,statusText:A.statusText,headers:Cn(A.getAllResponseHeaders()||"")};J.url="responseURL"in A?A.responseURL:J.headers.get("X-Request-URL");var Te="response"in A?A.response:A.responseText;E(new F(Te,J))},A.onerror=function(){R(new TypeError("Network request failed"))},A.ontimeout=function(){R(new TypeError("Network request failed"))},A.onabort=function(){R(new o.DOMException("Aborted","AbortError"))},A.open(x.method,x.url,!0),x.credentials==="include"?A.withCredentials=!0:x.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&c.blob&&(A.responseType="blob"),x.headers.forEach(function(J,Te){A.setRequestHeader(Te,J)}),x.signal&&(x.signal.addEventListener("abort",ce),A.onreadystatechange=function(){A.readyState===4&&x.signal.removeEventListener("abort",ce)}),A.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return Ae.polyfill=!0,s.fetch||(s.fetch=Ae,s.Headers=g,s.Request=M,s.Response=F),o.Headers=g,o.Request=M,o.Response=F,o.fetch=Ae,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(ye,ye.exports);var te=ye.exports;const ne=Bt(te),Ut=D({__proto__:null,default:ne},[te]),G=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Ut&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Mt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:c,middleware:h}=t,p={...t.headers};let m="",y;e==="POST"?(y=Gt(r,i,s,c.jsonSerializer),typeof y=="string"&&(p["Content-Type"]="application/json")):m=Mt({query:r,variables:i,operationName:s,jsonSerializer:c.jsonSerializer??B});const C={method:e,headers:p,body:y,...c};let T=n,g=C;if(h){const N=await Promise.resolve(h({...C,url:n,operationName:s,variables:i})),{url:O,...k}=N;T=O,g=k}return m&&(T=`${T}?${m}`),await o(T,g)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,o]=r,c=ze(i,s,o),{headers:h,fetch:p=ne,method:m="POST",requestMiddleware:y,responseMiddleware:C,...T}=this.requestConfig,{url:g}=this;c.signal!==void 0&&(T.signal=c.signal);const{operationName:N}=ge(c.query);return Ce({url:g,query:c.query,variables:c.variables,headers:{...G(Ee(h)),...G(c.requestHeaders)},operationName:N,fetch:p,method:m,fetchOptions:T,middleware:y}).then(O=>(C&&C(O),O)).catch(O=>{throw C&&C(O),O})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:o,fetch:c=ne,method:h="POST",requestMiddleware:p,responseMiddleware:m,...y}=this.requestConfig,{url:C}=this;s.signal!==void 0&&(y.signal=s.signal);const{query:T,operationName:g}=ge(s.document);return Ce({url:C,query:T,variables:s.variables,headers:{...G(Ee(o)),...G(s.requestHeaders)},operationName:g,fetch:c,method:h,fetchOptions:y,middleware:p}).then(N=>(m&&m(N),N.data)).catch(N=>{throw m&&m(N),N})}batchRequests(t,n){const r=Qe(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const o=r.documents.map(({document:h})=>ge(h).query),c=r.documents.map(({variables:h})=>h);return Ce({url:this.url,query:o,variables:c,headers:{...G(Ee(i)),...G(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(h=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h.data)).catch(h=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const Ce=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=qt($e(e.method??"post")),s=Array.isArray(e.query),o=await i(e),c=await jt(o,r.jsonSerializer??B),h=Array.isArray(c)?!c.some(({data:m})=>!m):!!c.data,p=Array.isArray(c)||!c.errors||Array.isArray(c.errors)&&!c.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(o.ok&&p&&h){const{errors:m,...y}=(Array.isArray(c),c),C=r.errorPolicy==="ignore"?y:c;return{...s?{data:C}:C,headers:o.headers,status:o.status}}else{const m=typeof c=="string"?{error:c}:c;throw new z({...m,status:o.status,headers:o.headers},{query:t,variables:n})}},Gt=(e,t,n,r)=>{const i=r??B;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((o,c,h)=>(o.push({query:c,variables:t?t[h]:void 0}),o),[]);return i.stringify(s)},jt=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Ee=e=>typeof e=="function"?e():e;var re=function(){return re=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},re.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var ie=new Map,ve=new Map,Ve=!0,se=!1;function Ge(e){return e.replace(/[\s,]+/g," ").trim()}function $t(e){return Ge(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=$t(r.loc),o=ve.get(i);o&&!o.has(s)?Ve&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
50
50
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
51
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||ve.set(i,o=new Set),o.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),re(re({},e),{definitions:n})}function Yt(e){var t=new Set(e.definitions);t.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(i){var s=r[i];s&&typeof s=="object"&&t.add(s)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function zt(e){var t=
|
|
51
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||ve.set(i,o=new Set),o.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),re(re({},e),{definitions:n})}function Yt(e){var t=new Set(e.definitions);t.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(i){var s=r[i];s&&typeof s=="object"&&t.add(s)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function zt(e){var t=Ge(e);if(!ie.has(t)){var n=Fe(e,{experimentalFragmentVariables:se,allowLegacyFragmentVariables:se});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");ie.set(t,Yt(Ht(n)))}return ie.get(t)}function j(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var r=e[0];return t.forEach(function(i,s){i&&i.kind==="Document"?r+=i.loc.source.body:r+=i,r+=e[s+1]}),zt(r)}function Qt(){ie.clear(),ve.clear()}function Jt(){Ve=!1}function Xt(){se=!0}function Wt(){se=!1}var Q={gql:j,resetCaches:Qt,disableFragmentWarnings:Jt,enableExperimentalFragmentVariables:Xt,disableExperimentalFragmentVariables:Wt};(function(e){e.gql=Q.gql,e.resetCaches=Q.resetCaches,e.disableFragmentWarnings=Q.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Q.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Q.disableExperimentalFragmentVariables})(j||(j={})),j.default=j;const S=j,Kt=S`
|
|
52
52
|
query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
53
53
|
locationAvailabilities(
|
|
54
54
|
sku: $sku
|
|
@@ -62,6 +62,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
62
62
|
name
|
|
63
63
|
phone
|
|
64
64
|
mapURL
|
|
65
|
+
tags
|
|
65
66
|
address {
|
|
66
67
|
id
|
|
67
68
|
countryCode
|
|
@@ -86,7 +87,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
`,Zt=
|
|
90
|
+
`,Zt=S`
|
|
90
91
|
query GetLocationAvailability($sku: String!, $locationID: ID!) {
|
|
91
92
|
locationAvailability(sku: $sku, locationID: $locationID) {
|
|
92
93
|
location {
|
|
@@ -94,6 +95,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
94
95
|
name
|
|
95
96
|
phone
|
|
96
97
|
mapURL
|
|
98
|
+
tags
|
|
97
99
|
address {
|
|
98
100
|
id
|
|
99
101
|
countryCode
|
|
@@ -111,7 +113,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
111
113
|
inventoryQuantity
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
|
-
`,en=
|
|
116
|
+
`,en=S`
|
|
115
117
|
query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
|
|
116
118
|
purchasingCustomerMetafield(namespace: $namespace, key: $key) {
|
|
117
119
|
id
|
|
@@ -120,21 +122,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
120
122
|
value
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
|
-
`,tn=
|
|
125
|
+
`,tn=S`
|
|
124
126
|
query GetPoints {
|
|
125
127
|
purchasingCustomer {
|
|
126
128
|
pointsApproved
|
|
127
129
|
pointsPending
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
|
-
`,nn=
|
|
131
|
-
query GetLocations($first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
132
|
-
locations(
|
|
132
|
+
`,nn=S`
|
|
133
|
+
query GetLocations($tag: String, $provinceCodes: [String!], $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
134
|
+
locations(
|
|
135
|
+
first: $first
|
|
136
|
+
after: $after
|
|
137
|
+
isReverse: $isReverse
|
|
138
|
+
filter: {tag: $tag, provinceCodes: $provinceCodes}
|
|
139
|
+
) {
|
|
133
140
|
nodes {
|
|
134
141
|
id
|
|
135
142
|
name
|
|
136
143
|
phone
|
|
137
144
|
mapURL
|
|
145
|
+
tags
|
|
138
146
|
address {
|
|
139
147
|
id
|
|
140
148
|
countryCode
|
|
@@ -157,7 +165,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
|
-
`,rn=
|
|
168
|
+
`,rn=S`
|
|
161
169
|
query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
162
170
|
purchasingCustomer {
|
|
163
171
|
id
|
|
@@ -186,14 +194,14 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
|
-
`,sn=
|
|
197
|
+
`,sn=S`
|
|
190
198
|
query GetPurchasingCustomerDiscountCodeCount {
|
|
191
199
|
purchasingCustomer {
|
|
192
200
|
id
|
|
193
201
|
orderPriceAdjustmentRuleCount
|
|
194
202
|
}
|
|
195
203
|
}
|
|
196
|
-
`,on=
|
|
204
|
+
`,on=S`
|
|
197
205
|
query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
|
|
198
206
|
purchasingCustomer {
|
|
199
207
|
id
|
|
@@ -228,6 +236,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
228
236
|
name
|
|
229
237
|
phone
|
|
230
238
|
mapURL
|
|
239
|
+
tags
|
|
231
240
|
address {
|
|
232
241
|
id
|
|
233
242
|
countryCode
|
|
@@ -252,7 +261,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
252
261
|
}
|
|
253
262
|
}
|
|
254
263
|
}
|
|
255
|
-
`,an=
|
|
264
|
+
`,an=S`
|
|
256
265
|
query GetPurchasingCustomerRank {
|
|
257
266
|
purchasingCustomer {
|
|
258
267
|
currentCustomerRank {
|
|
@@ -291,14 +300,14 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
|
-
`,un=
|
|
303
|
+
`,un=S`
|
|
295
304
|
query GetSharingPurchasingCustomerCount {
|
|
296
305
|
purchasingCustomer {
|
|
297
306
|
id
|
|
298
307
|
sharingPurchasingCustomerCount
|
|
299
308
|
}
|
|
300
309
|
}
|
|
301
|
-
`,cn=
|
|
310
|
+
`,cn=S`
|
|
302
311
|
query GetPurchasingCustomerSharing {
|
|
303
312
|
purchasingCustomer {
|
|
304
313
|
id
|
|
@@ -315,12 +324,13 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
315
324
|
}
|
|
316
325
|
}
|
|
317
326
|
}
|
|
318
|
-
`,ln=
|
|
327
|
+
`,ln=S`
|
|
319
328
|
query GetProduct($id: String!, $first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: ProductVariantSortKeys! = CREATED_AT) {
|
|
320
329
|
productByProductShopifyLegacyResourceID(productShopifyLegacyResourceID: $id) {
|
|
321
330
|
id
|
|
322
331
|
title
|
|
323
332
|
hasBackOrderProductVariants
|
|
333
|
+
isLocalPickupAvailable
|
|
324
334
|
productVariants(
|
|
325
335
|
first: $first
|
|
326
336
|
after: $after
|
|
@@ -335,6 +345,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
335
345
|
sku
|
|
336
346
|
}
|
|
337
347
|
isBackOrderEnable
|
|
348
|
+
isLocalPickupAvailable
|
|
338
349
|
}
|
|
339
350
|
pageInfo {
|
|
340
351
|
startCursor
|
|
@@ -345,7 +356,18 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
345
356
|
}
|
|
346
357
|
}
|
|
347
358
|
}
|
|
348
|
-
`,dn=
|
|
359
|
+
`,dn=S`
|
|
360
|
+
query GetPointCampaignOrderRuleTargetCustomerRank {
|
|
361
|
+
pointCampaignOrderRuleTargetCustomerRank {
|
|
362
|
+
pointCampaignOrderRule {
|
|
363
|
+
id
|
|
364
|
+
title
|
|
365
|
+
}
|
|
366
|
+
multiplier
|
|
367
|
+
fixedPoint
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
`,hn=S`
|
|
349
371
|
mutation PurchasingCustomerSendCustomerSharingActivationCode {
|
|
350
372
|
purchasingCustomerSendCustomerSharingActivationCode {
|
|
351
373
|
purchasingCustomer {
|
|
@@ -361,7 +383,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
361
383
|
}
|
|
362
384
|
}
|
|
363
385
|
}
|
|
364
|
-
`,
|
|
386
|
+
`,pn=S`
|
|
365
387
|
mutation PurchasingCustomerActivateCustomerSharing($email: String!, $activationCode: String!) {
|
|
366
388
|
purchasingCustomerActivateCustomerSharing(
|
|
367
389
|
input: {email: $email, activationCode: $activationCode}
|
|
@@ -376,4 +398,4 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
376
398
|
}
|
|
377
399
|
}
|
|
378
400
|
}
|
|
379
|
-
`,pn=(e,t,n,r)=>e();function fn(e,t=pn){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(an,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)},GetSharingPurchasingCustomerCount(n,r){return t(i=>e.request(un,n,{...r,...i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r){return t(i=>e.request(cn,n,{...r,...i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r){return t(i=>e.request(ln,n,{...r,...i}),"GetProduct","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r){return t(i=>e.request(dn,n,{...r,...i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r){return t(i=>e.request(hn,n,{...r,...i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)}}}class mn{constructor(t){Ge(this,"api");this.api=fn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,mapURL:o.location.mapURL,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:r.locationAvailability.location.id,name:r.locationAvailability.location.name,phone:r.locationAvailability.location.phone,mapURL:r.locationAvailability.location.mapURL,address:r.locationAvailability.location.address?{id:r.locationAvailability.location.address.id,countryCode:r.locationAvailability.location.address.countryCode,country:r.locationAvailability.location.address.country,postalCode:r.locationAvailability.location.address.postalCode,provinceCode:r.locationAvailability.location.address.provinceCode,province:r.locationAvailability.location.address.province,city:r.locationAvailability.location.address.city,address1:r.locationAvailability.location.address.address1,address2:r.locationAvailability.location.address.address2}:void 0},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name,phone:s.phone,mapURL:s.mapURL,address:s.address?{id:s.address.id,countryCode:s.address.countryCode,country:s.address.country,postalCode:s.address.postalCode,provinceCode:s.address.provinceCode,province:s.address.province,city:s.address.city,address1:s.address.address1,address2:s.address.address2}:void 0}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.orderPriceAdjustmentRules.nodes.map(s=>({id:s.id,title:s.title,status:s.status,description:s.description,code:s.code,customerApplicable:s.customerApplicable,shopifyStoreApplicable:s.shopifyStoreApplicable,applicableLocationCount:s.applicableLocationCount,hasApplicableLocations:s.hasApplicableLocations,startsAt:new Date(s.startsAt),endsAt:new Date(s.endsAt),createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.orderPriceAdjustmentRules.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),tenant:{id:o.pointChange.tenant.id,name:o.pointChange.tenant.name},createdAt:new Date(o.pointChange.createdAt)},retailLocation:o.retailLocation?{id:o.retailLocation.id,name:o.retailLocation.name,phone:o.retailLocation.phone,mapURL:o.retailLocation.mapURL,address:o.retailLocation.address?{id:o.retailLocation.address.id,countryCode:o.retailLocation.address.countryCode,country:o.retailLocation.address.country,postalCode:o.retailLocation.address.postalCode,provinceCode:o.retailLocation.address.provinceCode,province:o.retailLocation.address.province,city:o.retailLocation.address.city,address1:o.retailLocation.address.address1,address2:o.retailLocation.address.address2}:void 0}:void 0,tenant:{id:o.tenant.id,name:o.tenant.name}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}async getPurchasingCustomerDiscountCodeCount(){var n;return((n=(await this.api.GetPurchasingCustomerDiscountCodeCount()).purchasingCustomer)==null?void 0:n.orderPriceAdjustmentRuleCount)??0}async getSharingPurchasingCustomerCount(){var n;return((n=(await this.api.GetSharingPurchasingCustomerCount()).purchasingCustomer)==null?void 0:n.sharingPurchasingCustomerCount)??0}async getPurchasingCustomerSharing(){var n;const t=await this.api.GetPurchasingCustomerSharing();return(n=t.purchasingCustomer)!=null&&n.customerSharing?{id:t.purchasingCustomer.customerSharing.id,purchasingCustomers:t.purchasingCustomer.customerSharing.purchasingCustomers.map(r=>({id:r.id,sharingPurchasingCustomerCount:r.sharingPurchasingCustomerCount,tenant:{id:r.tenant.id,name:r.tenant.name}}))}:null}async getProduct(t,n,r,i,s){const o=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return o.productByProductShopifyLegacyResourceID?{id:o.productByProductShopifyLegacyResourceID.id,title:o.productByProductShopifyLegacyResourceID.title,hasBackOrderProductVariants:o.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,variants:{nodes:o.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,isBackOrderEnable:c.isBackOrderEnable,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku}})),pageInfo:o.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async purchasingCustomerSendCustomerSharingActivationCode(){const t=await this.api.PurchasingCustomerSendCustomerSharingActivationCode();return t.purchasingCustomerSendCustomerSharingActivationCode?{purchasingCustomer:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.id,sharingPurchasingCustomerCount:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.id,name:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.name}},customerSharingActivationCodeID:t.purchasingCustomerSendCustomerSharingActivationCode.customerSharingActivationCode.id}:null}async purchasingCustomerActivateCustomerSharing(t,n){if(n.length!==6)throw new Error(`Invalid activation code: ${n} is not 6 characters.`);const r=await this.api.PurchasingCustomerActivateCustomerSharing({email:t,activationCode:n});return r.purchasingCustomerActivateCustomerSharing?{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.id,sharingPurchasingCustomerCount:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.id,name:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.name}}:null}}_.SDK=mn,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
401
|
+
`,fn=(e,t,n,r)=>e();function mn(e,t=fn){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(an,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)},GetSharingPurchasingCustomerCount(n,r){return t(i=>e.request(un,n,{...r,...i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r){return t(i=>e.request(cn,n,{...r,...i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r){return t(i=>e.request(ln,n,{...r,...i}),"GetProduct","query",n)},GetPointCampaignOrderRuleTargetCustomerRank(n,r){return t(i=>e.request(dn,n,{...r,...i}),"GetPointCampaignOrderRuleTargetCustomerRank","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r){return t(i=>e.request(hn,n,{...r,...i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r){return t(i=>e.request(pn,n,{...r,...i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)}}}class gn{constructor(t){je(this,"api");this.api=mn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,mapURL:o.location.mapURL,tags:o.location.tags,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:r.locationAvailability.location.id,name:r.locationAvailability.location.name,phone:r.locationAvailability.location.phone,mapURL:r.locationAvailability.location.mapURL,tags:r.locationAvailability.location.tags,address:r.locationAvailability.location.address?{id:r.locationAvailability.location.address.id,countryCode:r.locationAvailability.location.address.countryCode,country:r.locationAvailability.location.address.country,postalCode:r.locationAvailability.location.address.postalCode,provinceCode:r.locationAvailability.location.address.provinceCode,province:r.locationAvailability.location.address.province,city:r.locationAvailability.location.address.city,address1:r.locationAvailability.location.address.address1,address2:r.locationAvailability.location.address.address2}:void 0},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r,i,s){const o=await this.api.GetLocations({tag:t,provinceCodes:n,first:r,after:i,isReverse:s});return{nodes:o.locations.nodes.map(c=>({id:c.id,name:c.name,phone:c.phone,mapURL:c.mapURL,tags:c.tags,address:c.address?{id:c.address.id,countryCode:c.address.countryCode,country:c.address.country,postalCode:c.address.postalCode,provinceCode:c.address.provinceCode,province:c.address.province,city:c.address.city,address1:c.address.address1,address2:c.address.address2}:void 0}))??[],pageInfo:o.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.orderPriceAdjustmentRules.nodes.map(s=>({id:s.id,title:s.title,status:s.status,description:s.description,code:s.code,customerApplicable:s.customerApplicable,shopifyStoreApplicable:s.shopifyStoreApplicable,applicableLocationCount:s.applicableLocationCount,hasApplicableLocations:s.hasApplicableLocations,startsAt:new Date(s.startsAt),endsAt:new Date(s.endsAt),createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.orderPriceAdjustmentRules.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),tenant:{id:o.pointChange.tenant.id,name:o.pointChange.tenant.name},createdAt:new Date(o.pointChange.createdAt)},retailLocation:o.retailLocation?{id:o.retailLocation.id,name:o.retailLocation.name,phone:o.retailLocation.phone,mapURL:o.retailLocation.mapURL,tags:o.retailLocation.tags,address:o.retailLocation.address?{id:o.retailLocation.address.id,countryCode:o.retailLocation.address.countryCode,country:o.retailLocation.address.country,postalCode:o.retailLocation.address.postalCode,provinceCode:o.retailLocation.address.provinceCode,province:o.retailLocation.address.province,city:o.retailLocation.address.city,address1:o.retailLocation.address.address1,address2:o.retailLocation.address.address2}:void 0}:void 0,tenant:{id:o.tenant.id,name:o.tenant.name}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}async getPurchasingCustomerDiscountCodeCount(){var n;return((n=(await this.api.GetPurchasingCustomerDiscountCodeCount()).purchasingCustomer)==null?void 0:n.orderPriceAdjustmentRuleCount)??0}async getSharingPurchasingCustomerCount(){var n;return((n=(await this.api.GetSharingPurchasingCustomerCount()).purchasingCustomer)==null?void 0:n.sharingPurchasingCustomerCount)??0}async getPurchasingCustomerSharing(){var n;const t=await this.api.GetPurchasingCustomerSharing();return(n=t.purchasingCustomer)!=null&&n.customerSharing?{id:t.purchasingCustomer.customerSharing.id,purchasingCustomers:t.purchasingCustomer.customerSharing.purchasingCustomers.map(r=>({id:r.id,sharingPurchasingCustomerCount:r.sharingPurchasingCustomerCount,tenant:{id:r.tenant.id,name:r.tenant.name}}))}:null}async getProduct(t,n,r,i,s){const o=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return o.productByProductShopifyLegacyResourceID?{id:o.productByProductShopifyLegacyResourceID.id,title:o.productByProductShopifyLegacyResourceID.title,hasBackOrderProductVariants:o.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,isLocalPickupAvailable:o.productByProductShopifyLegacyResourceID.isLocalPickupAvailable,variants:{nodes:o.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,isBackOrderEnable:c.isBackOrderEnable,isLocalPickupAvailable:c.isLocalPickupAvailable,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku}})),pageInfo:o.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async getPointCampaignOrderRuleTargetCustomerRank(){const t=await this.api.GetPointCampaignOrderRuleTargetCustomerRank();return t.pointCampaignOrderRuleTargetCustomerRank?{pointCampaignOrderRule:{id:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.id,title:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.title},multiplier:t.pointCampaignOrderRuleTargetCustomerRank.multiplier?t.pointCampaignOrderRuleTargetCustomerRank.multiplier:void 0,fixedPoint:t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint?t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint:void 0}:null}async purchasingCustomerSendCustomerSharingActivationCode(){const t=await this.api.PurchasingCustomerSendCustomerSharingActivationCode();return t.purchasingCustomerSendCustomerSharingActivationCode?{purchasingCustomer:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.id,sharingPurchasingCustomerCount:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.id,name:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.name}},customerSharingActivationCodeID:t.purchasingCustomerSendCustomerSharingActivationCode.customerSharingActivationCode.id}:null}async purchasingCustomerActivateCustomerSharing(t,n){if(n.length!==6)throw new Error(`Invalid activation code: ${n} is not 6 characters.`);const r=await this.api.PurchasingCustomerActivateCustomerSharing({email:t,activationCode:n});return r.purchasingCustomerActivateCustomerSharing?{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.id,sharingPurchasingCustomerCount:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.id,name:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.name}}:null}}P.SDK=gn,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|