@builtbystack/sq-shopify-theme-sdk 0.0.36 → 0.0.37
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 +40 -0
- package/dist/sq-shopify-theme-sdk.d.ts +15 -0
- package/dist/sq-shopify-theme-sdk.js +98 -78
- package/dist/sq-shopify-theme-sdk.umd.js +45 -38
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(b,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(b=typeof globalThis<"u"?globalThis:b||self,_(b.SQ={}))})(this,(function(b){"use strict";var
|
|
2
|
-
`,f=r.split(/\r\n|[\n\r]/g),A=f[i];if(A.length>120){const C=Math.floor(l/80),
|
|
3
|
-
`)}function it(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 he extends Error{constructor(t,...n){var r,i,s;const{nodes:a,source:c,positions:l,path:m,originalError:f,extensions:A}=it(n);super(t),this.name="GraphQLError",this.path=m??void 0,this.originalError=f??void 0,this.nodes=Re(Array.isArray(a)?a:a?[a]:void 0);const C=Re((r=this.nodes)===null||r===void 0?void 0:r.map(I=>I.loc).filter(I=>I!=null));this.source=c??(C==null||(i=C[0])===null||i===void 0?void 0:i.source),this.positions=l??(C==null?void 0:C.map(I=>I.start)),this.locations=l&&c?l.map(I=>pe(c,I)):C==null?void 0:C.map(I=>pe(I.source,I.start));const
|
|
1
|
+
(function(b,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(b=typeof globalThis<"u"?globalThis:b||self,_(b.SQ={}))})(this,(function(b){"use strict";var Gn=Object.defineProperty;var Un=(b,_,F)=>_ in b?Gn(b,_,{enumerable:!0,configurable:!0,writable:!0,value:F}):b[_]=F;var ze=(b,_,F)=>Un(b,typeof _!="symbol"?_+"":_,F);function _(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 F=JSON,Je=e=>e.toUpperCase(),Xe=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ke=(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},We=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function K(e,t){if(!!!e)throw new Error(t)}function et(e){return typeof e=="object"&&e!==null}function tt(e,t){if(!!!e)throw new Error("Unexpected invariant triggered.")}const nt=/\r\n|[\n\r]/g;function pe(e,t){let n=0,r=1;for(const i of e.body.matchAll(nt)){if(typeof i.index=="number"||tt(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function rt(e){return Se(e.source,pe(e.source,e.start))}function Se(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,c=t.line===1?n:0,l=t.column+c,m=`${e.name}:${a}:${l}
|
|
2
|
+
`,f=r.split(/\r\n|[\n\r]/g),A=f[i];if(A.length>120){const C=Math.floor(l/80),S=l%80,I=[];for(let y=0;y<A.length;y+=80)I.push(A.slice(y,y+80));return m+Oe([[`${a} |`,I[0]],...I.slice(1,C+1).map(y=>["|",y]),["|","^".padStart(S)],["|",I[C+1]]])}return m+Oe([[`${a-1} |`,f[i-1]],[`${a} |`,A],["|","^".padStart(l)],[`${a+1} |`,f[i+1]]])}function Oe(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
|
+
`)}function it(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 he extends Error{constructor(t,...n){var r,i,s;const{nodes:a,source:c,positions:l,path:m,originalError:f,extensions:A}=it(n);super(t),this.name="GraphQLError",this.path=m??void 0,this.originalError=f??void 0,this.nodes=Re(Array.isArray(a)?a:a?[a]:void 0);const C=Re((r=this.nodes)===null||r===void 0?void 0:r.map(I=>I.loc).filter(I=>I!=null));this.source=c??(C==null||(i=C[0])===null||i===void 0?void 0:i.source),this.positions=l??(C==null?void 0:C.map(I=>I.start)),this.locations=l&&c?l.map(I=>pe(c,I)):C==null?void 0:C.map(I=>pe(I.source,I.start));const S=et(f==null?void 0:f.extensions)?f==null?void 0:f.extensions:void 0;this.extensions=(s=A??S)!==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}}),f!=null&&f.stack?Object.defineProperty(this,"stack",{value:f.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,he):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(t+=`
|
|
4
4
|
|
|
5
5
|
`+rt(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
|
|
6
6
|
|
|
7
|
-
`+
|
|
7
|
+
`+Se(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 Re(e){return e===void 0||e.length===0?void 0:e}function x(e,t,n){return new he(`Syntax Error: ${n}`,{source:e,positions:[t]})}class st{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,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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 De={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},at=new Set(Object.keys(De));function Ne(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&at.has(t)}var V;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(V||(V={}));var me;(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"})(me||(me={}));var h;(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",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(h||(h={}));function fe(e){return e===9||e===32}function Y(e){return e>=48&&e<=57}function be(e){return e>=97&&e<=122||e>=65&&e<=90}function ke(e){return be(e)||e===95}function ot(e){return be(e)||Y(e)||e===95}function ut(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;const c=e[a],l=ct(c);l!==c.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,c)=>c===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function ct(e){let t=0;for(;t<e.length&&fe(e.charCodeAt(t));)++t;return t}function dt(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(S=>S.length===0||fe(S.charCodeAt(0))),a=n.endsWith('\\"""'),c=e.endsWith('"')&&!a,l=e.endsWith("\\"),m=c||l,f=!i||e.length>70||m||s||a;let A="";const C=i&&fe(e.charCodeAt(0));return(f&&!C||s)&&(A+=`
|
|
8
8
|
`),A+=n,(f||m)&&(A+=`
|
|
9
|
-
`),'"""'+A+'"""'}var u;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",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 lt{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=ht(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===u.COMMENT);return t}}function pt(e){return e===u.BANG||e===u.DOLLAR||e===u.AMP||e===u.PAREN_L||e===u.PAREN_R||e===u.DOT||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 $(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Z(e,t){return _e(e.charCodeAt(t))&&Le(e.charCodeAt(t+1))}function _e(e){return e>=55296&&e<=56319}function Le(e){return e>=56320&&e<=57343}function
|
|
9
|
+
`),'"""'+A+'"""'}var u;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",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 lt{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=ht(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===u.COMMENT);return t}}function pt(e){return e===u.BANG||e===u.DOLLAR||e===u.AMP||e===u.PAREN_L||e===u.PAREN_R||e===u.DOT||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 $(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Z(e,t){return _e(e.charCodeAt(t))&&Le(e.charCodeAt(t+1))}function _e(e){return e>=55296&&e<=56319}function Le(e){return e>=56320&&e<=57343}function G(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 R(e,t,n,r,i){const s=e.line,a=1+n-e.lineStart;return new xe(t,n,r,s,a,i)}function ht(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 mt(e,i);case 33:return R(e,u.BANG,i,i+1);case 36:return R(e,u.DOLLAR,i,i+1);case 38:return R(e,u.AMP,i,i+1);case 40:return R(e,u.PAREN_L,i,i+1);case 41:return R(e,u.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return R(e,u.SPREAD,i,i+3);break;case 58:return R(e,u.COLON,i,i+1);case 61:return R(e,u.EQUALS,i,i+1);case 64:return R(e,u.AT,i,i+1);case 91:return R(e,u.BRACKET_L,i,i+1);case 93:return R(e,u.BRACKET_R,i,i+1);case 123:return R(e,u.BRACE_L,i,i+1);case 124:return R(e,u.PIPE,i,i+1);case 125:return R(e,u.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?At(e,i):gt(e,i)}if(Y(s)||s===45)return ft(e,i,s);if(ke(s))return vt(e,i);throw x(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:$(s)||Z(n,i)?`Unexpected character: ${G(e,i)}.`:`Invalid character: ${G(e,i)}.`)}return R(e,u.EOF,r,r)}function mt(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($(s))++i;else if(Z(n,i))i+=2;else break}return R(e,u.COMMENT,t,i,n.slice(t+1,i))}function ft(e,t,n){const r=e.source.body;let i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),Y(s))throw x(e.source,i,`Invalid number, unexpected digit after 0: ${G(e,i)}.`)}else i=ge(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=ge(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=ge(e,i,s),s=r.charCodeAt(i)),s===46||ke(s))throw x(e.source,i,`Invalid number, expected digit but got: ${G(e,i)}.`);return R(e,a?u.FLOAT:u.INT,t,i,r.slice(t,i))}function ge(e,t,n){if(!Y(n))throw x(e.source,t,`Invalid number, expected digit but got: ${G(e,t)}.`);const r=e.source.body;let i=t+1;for(;Y(r.charCodeAt(i));)++i;return i}function gt(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,a="";for(;i<r;){const c=n.charCodeAt(i);if(c===34)return a+=n.slice(s,i),R(e,u.STRING,t,i+1,a);if(c===92){a+=n.slice(s,i);const l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Ct(e,i):yt(e,i):Et(e,i);a+=l.value,i+=l.size,s=i;continue}if(c===10||c===13)break;if($(c))++i;else if(Z(n,i))i+=2;else throw x(e.source,i,`Invalid character within String: ${G(e,i)}.`)}throw x(e.source,i,"Unterminated string.")}function Ct(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||!$(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Q(s),r<0)break}throw x(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function yt(e,t){const n=e.source.body,r=we(n,t+2);if($(r))return{value:String.fromCodePoint(r),size:6};if(_e(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=we(n,t+8);if(Le(i))return{value:String.fromCodePoint(r,i),size:12}}throw x(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function we(e,t){return Q(e.charCodeAt(t))<<12|Q(e.charCodeAt(t+1))<<8|Q(e.charCodeAt(t+2))<<4|Q(e.charCodeAt(t+3))}function Q(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Et(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 x(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function At(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,a=s,c="";const l=[];for(;s<r;){const m=n.charCodeAt(s);if(m===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){c+=n.slice(a,s),l.push(c);const f=R(e,u.BLOCK_STRING,t,s+3,ut(l).join(`
|
|
11
|
-
`));return e.line+=l.length-1,e.lineStart=i,f}if(m===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){c+=n.slice(a,s),a=s+1,s+=4;continue}if(m===10||m===13){c+=n.slice(a,s),l.push(c),m===13&&n.charCodeAt(s+1)===10?s+=2:++s,c="",a=s,i=s;continue}if($(m))++s;else if(Z(n,s))s+=2;else throw x(e.source,s,`Invalid character within String: ${
|
|
11
|
+
`));return e.line+=l.length-1,e.lineStart=i,f}if(m===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){c+=n.slice(a,s),a=s+1,s+=4;continue}if(m===10||m===13){c+=n.slice(a,s),l.push(c),m===13&&n.charCodeAt(s+1)===10?s+=2:++s,c="",a=s,i=s;continue}if($(m))++s;else if(Z(n,s))s+=2;else throw x(e.source,s,`Invalid character within String: ${G(e,s)}.`)}throw x(e.source,s,"Unterminated string.")}function vt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(ot(s))++i;else break}return R(e,u.NAME,t,i,n.slice(t,i))}const Tt=10,Me=2;function Ce(e){return W(e,[])}function W(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return It(e,t);default:return String(e)}}function It(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Pt(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:W(r,n)}else if(Array.isArray(e))return Ot(e,n);return St(e,n)}function Pt(e){return typeof e.toJSON=="function"}function St(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Me?"["+Rt(e)+"]":"{ "+n.map(([i,s])=>i+": "+W(s,t)).join(", ")+" }"}function Ot(e,t){if(e.length===0)return"[]";if(t.length>Me)return"[Array]";const n=Math.min(Tt,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(W(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Rt(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 xt=globalThis.process&&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 a=Ce(t);throw new Error(`Cannot use ${i} "${a}" from another module or realm.
|
|
12
12
|
|
|
13
13
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
14
14
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -19,7 +19,7 @@ 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 qe{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||K(!1,`Body must be a string. Received: ${Ce(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||K(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||K(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Dt(e){return xt(e,qe)}function Fe(e,t){const n=new Nt(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}class Nt{constructor(t,n={}){const{lexer:r,...i}=n;if(r)this._lexer=r;else{const s=Dt(t)?t:new qe(t);this._lexer=new lt(s)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(u.NAME);return this.node(t,{kind:h.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:h.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(t&&n.kind===u.BRACE_L)throw x(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");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()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw x(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(n.value){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:h.OPERATION_DEFINITION,operation:G.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseDescription(),r=this.parseOperationType();let i;return this.peek(u.NAME)&&(i=this.parseName()),this.node(t,{kind:h.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(u.NAME);switch(t.value){case"query":return G.QUERY;case"mutation":return G.MUTATION;case"subscription":return G.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:h.VARIABLE_DEFINITION,description:this.parseDescription(),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:h.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:h.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:h.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:h.FRAGMENT_DEFINITION,description:n,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:h.INT,value:n.value});case u.FLOAT:return this.advanceLexer(),this.node(n,{kind:h.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:h.BOOLEAN,value:!0});case"false":return this.node(n,{kind:h.BOOLEAN,value:!1});case"null":return this.node(n,{kind:h.NULL});default:return this.node(n,{kind:h.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 x(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:h.STRING,value:t.value,block:t.kind===u.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.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:h.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(u.BANG)?this.node(t,{kind:h.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.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(),a=this.parseFieldsDefinition();return this.node(t,{kind:h.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}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(),a=this.parseConstDirectives();return this.node(t,{kind:h.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}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 a=this.parseConstDirectives();return this.node(t,{kind:h.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:h.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}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:h.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:h.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:h.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 x(this._lexer.source,this._lexer.token.start,`${ee(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:h.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:h.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:h.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:h.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:h.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:h.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:h.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:h.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 a=this.parseDirectiveLocations();return this.node(t,{kind:h.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(u.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(me,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){const t=this._lexer.token,n=this.expectOptionalToken(u.AT),r=this.parseName();let i;!n&&this.expectOptionalToken(u.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(u.PAREN_L)&&(s=this.parseName(),this.expectToken(u.COLON),this.expectToken(u.PAREN_R)),n?s?this.node(t,{kind:h.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:h.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:h.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:h.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:h.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new st(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 x(this._lexer.source,n.start,`Expected ${Be(t)}, found ${ee(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 x(this._lexer.source,n.start,`Expected "${t}", found ${ee(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 x(this._lexer.source,n.start,`Unexpected ${ee(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(n.kind!==u.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw x(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function ee(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return pt(e)?`"${e}"`:e}function bt(e){return`"${e.replace(kt,_t)}"`}const kt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function _t(e){return Lt[e.charCodeAt(0)]}const Lt=["\\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"],wt=Object.freeze({});function Mt(e,t,n=De){const r=new Map;for(const k of Object.values(h))r.set(k,qt(t,k));let i,s=Array.isArray(e),a=[e],c=-1,l=[],m=e,f,A;const C=[],P=[];do{c++;const k=c===a.length,ce=k&&l.length!==0;if(k){if(f=P.length===0?void 0:C[C.length-1],m=A,A=P.pop(),ce)if(s){m=m.slice();let q=0;for(const[H,X]of l){const de=H-q;X===null?(m.splice(de,1),q++):m[de]=X}}else{m={...m};for(const[q,H]of l)m[q]=H}c=i.index,a=i.keys,l=i.edits,s=i.inArray,i=i.prev}else if(A){if(f=s?c:a[c],m=A[f],m==null)continue;C.push(f)}let M;if(!Array.isArray(m)){var I,y;Ne(m)||K(!1,`Invalid AST Node: ${Ce(m)}.`);const q=k?(I=r.get(m.kind))===null||I===void 0?void 0:I.leave:(y=r.get(m.kind))===null||y===void 0?void 0:y.enter;if(M=q==null?void 0:q.call(t,m,f,A,C,P),M===wt)break;if(M===!1){if(!k){C.pop();continue}}else if(M!==void 0&&(l.push([f,M]),!k))if(Ne(M))m=M;else{C.pop();continue}}if(M===void 0&&ce&&l.push([f,m]),k)C.pop();else{var N;i={inArray:s,index:c,keys:a,edits:l,prev:i},s=Array.isArray(m),a=s?m:(N=n[m.kind])!==null&&N!==void 0?N:[],c=-1,l=[],A&&P.push(A),A=m}}while(i!==void 0);return l.length!==0?l[l.length-1][1]:e}function qt(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 Ft(e){return Mt(e,Ut)}const Bt=80,Ut={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>p(e.definitions,`
|
|
22
|
+
spurious results.`)}}return!1};class qe{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||K(!1,`Body must be a string. Received: ${Ce(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||K(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||K(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Dt(e){return xt(e,qe)}function Fe(e,t){const n=new Nt(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}class Nt{constructor(t,n={}){const{lexer:r,...i}=n;if(r)this._lexer=r;else{const s=Dt(t)?t:new qe(t);this._lexer=new lt(s)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(u.NAME);return this.node(t,{kind:h.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:h.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(t&&n.kind===u.BRACE_L)throw x(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");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()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw x(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(n.value){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:h.OPERATION_DEFINITION,operation:V.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseDescription(),r=this.parseOperationType();let i;return this.peek(u.NAME)&&(i=this.parseName()),this.node(t,{kind:h.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(u.NAME);switch(t.value){case"query":return V.QUERY;case"mutation":return V.MUTATION;case"subscription":return V.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:h.VARIABLE_DEFINITION,description:this.parseDescription(),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:h.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:h.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:h.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:h.FRAGMENT_DEFINITION,description:n,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:h.INT,value:n.value});case u.FLOAT:return this.advanceLexer(),this.node(n,{kind:h.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:h.BOOLEAN,value:!0});case"false":return this.node(n,{kind:h.BOOLEAN,value:!1});case"null":return this.node(n,{kind:h.NULL});default:return this.node(n,{kind:h.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 x(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:h.STRING,value:t.value,block:t.kind===u.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.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:h.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(u.BANG)?this.node(t,{kind:h.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:h.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:h.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:h.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:h.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(),a=this.parseFieldsDefinition();return this.node(t,{kind:h.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}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(),a=this.parseConstDirectives();return this.node(t,{kind:h.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}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 a=this.parseConstDirectives();return this.node(t,{kind:h.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:h.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}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:h.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:h.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:h.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 x(this._lexer.source,this._lexer.token.start,`${ee(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:h.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:h.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:h.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:h.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:h.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:h.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:h.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:h.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 a=this.parseDirectiveLocations();return this.node(t,{kind:h.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(u.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(me,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){const t=this._lexer.token,n=this.expectOptionalToken(u.AT),r=this.parseName();let i;!n&&this.expectOptionalToken(u.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(u.PAREN_L)&&(s=this.parseName(),this.expectToken(u.COLON),this.expectToken(u.PAREN_R)),n?s?this.node(t,{kind:h.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:h.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:h.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:h.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:h.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new st(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 x(this._lexer.source,n.start,`Expected ${Be(t)}, found ${ee(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 x(this._lexer.source,n.start,`Expected "${t}", found ${ee(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 x(this._lexer.source,n.start,`Unexpected ${ee(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(n.kind!==u.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw x(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function ee(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return pt(e)?`"${e}"`:e}function bt(e){return`"${e.replace(kt,_t)}"`}const kt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function _t(e){return Lt[e.charCodeAt(0)]}const Lt=["\\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"],wt=Object.freeze({});function Mt(e,t,n=De){const r=new Map;for(const k of Object.values(h))r.set(k,qt(t,k));let i,s=Array.isArray(e),a=[e],c=-1,l=[],m=e,f,A;const C=[],S=[];do{c++;const k=c===a.length,ce=k&&l.length!==0;if(k){if(f=S.length===0?void 0:C[C.length-1],m=A,A=S.pop(),ce)if(s){m=m.slice();let q=0;for(const[H,X]of l){const de=H-q;X===null?(m.splice(de,1),q++):m[de]=X}}else{m={...m};for(const[q,H]of l)m[q]=H}c=i.index,a=i.keys,l=i.edits,s=i.inArray,i=i.prev}else if(A){if(f=s?c:a[c],m=A[f],m==null)continue;C.push(f)}let M;if(!Array.isArray(m)){var I,y;Ne(m)||K(!1,`Invalid AST Node: ${Ce(m)}.`);const q=k?(I=r.get(m.kind))===null||I===void 0?void 0:I.leave:(y=r.get(m.kind))===null||y===void 0?void 0:y.enter;if(M=q==null?void 0:q.call(t,m,f,A,C,S),M===wt)break;if(M===!1){if(!k){C.pop();continue}}else if(M!==void 0&&(l.push([f,M]),!k))if(Ne(M))m=M;else{C.pop();continue}}if(M===void 0&&ce&&l.push([f,m]),k)C.pop();else{var N;i={inArray:s,index:c,keys:a,edits:l,prev:i},s=Array.isArray(m),a=s?m:(N=n[m.kind])!==null&&N!==void 0?N:[],c=-1,l=[],A&&S.push(A),A=m}}while(i!==void 0);return l.length!==0?l[l.length-1][1]:e}function qt(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 Ft(e){return Mt(e,Gt)}const Bt=80,Gt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>p(e.definitions,`
|
|
23
23
|
|
|
24
24
|
`)},OperationDefinition:{leave(e){const t=ye(e.variableDefinitions)?g(`(
|
|
25
25
|
`,p(e.variableDefinitions,`
|
|
@@ -52,10 +52,10 @@ spurious results.`)}}return!1};class qe{constructor(t,n="GraphQL request",r={lin
|
|
|
52
52
|
`)),`
|
|
53
53
|
}`)}function g(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function te(e){return g(" ",e.replace(/\n/g,`
|
|
54
54
|
`))}function ye(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
|
|
55
|
-
`)))!==null&&t!==void 0?t:!1}const
|
|
56
|
-
`)===0?
|
|
55
|
+
`)))!==null&&t!==void 0?t:!1}const Ge=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},Ee=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Ge(r)}catch{}return{query:e,operationName:n}}const t=Ge(e);return{query:Ft(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 ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ut(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}},Ue;function Vt(){return Ue||(Ue=1,(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof ne<"u"&&ne,r=(function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s})();(function(s){(function(a){var c=typeof s<"u"&&s||typeof self<"u"&&self||typeof ne<"u"&&ne||{},l={searchParams:"URLSearchParams"in c,iterable:"Symbol"in c&&"iterator"in Symbol,blob:"FileReader"in c&&"Blob"in c&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in c,arrayBuffer:"ArrayBuffer"in c};function m(o){return o&&DataView.prototype.isPrototypeOf(o)}if(l.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(o){return o&&f.indexOf(Object.prototype.toString.call(o))>-1};function C(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(o)||o==="")throw new TypeError('Invalid character in header field name: "'+o+'"');return o.toLowerCase()}function S(o){return typeof o!="string"&&(o=String(o)),o}function I(o){var d={next:function(){var E=o.shift();return{done:E===void 0,value:E}}};return l.iterable&&(d[Symbol.iterator]=function(){return d}),d}function y(o){this.map={},o instanceof y?o.forEach(function(d,E){this.append(E,d)},this):Array.isArray(o)?o.forEach(function(d){if(d.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+d.length);this.append(d[0],d[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(d){this.append(d,o[d])},this)}y.prototype.append=function(o,d){o=C(o),d=S(d);var E=this.map[o];this.map[o]=E?E+", "+d:d},y.prototype.delete=function(o){delete this.map[C(o)]},y.prototype.get=function(o){return o=C(o),this.has(o)?this.map[o]:null},y.prototype.has=function(o){return this.map.hasOwnProperty(C(o))},y.prototype.set=function(o,d){this.map[C(o)]=S(d)},y.prototype.forEach=function(o,d){for(var E in this.map)this.map.hasOwnProperty(E)&&o.call(d,this.map[E],E,this)},y.prototype.keys=function(){var o=[];return this.forEach(function(d,E){o.push(E)}),I(o)},y.prototype.values=function(){var o=[];return this.forEach(function(d){o.push(d)}),I(o)},y.prototype.entries=function(){var o=[];return this.forEach(function(d,E){o.push([E,d])}),I(o)},l.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function N(o){if(!o._noBody){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}}function k(o){return new Promise(function(d,E){o.onload=function(){d(o.result)},o.onerror=function(){E(o.error)}})}function ce(o){var d=new FileReader,E=k(d);return d.readAsArrayBuffer(o),E}function M(o){var d=new FileReader,E=k(d),P=/charset=([A-Za-z0-9_-]+)/.exec(o.type),O=P?P[1]:"utf-8";return d.readAsText(o,O),E}function q(o){for(var d=new Uint8Array(o),E=new Array(d.length),P=0;P<d.length;P++)E[P]=String.fromCharCode(d[P]);return E.join("")}function H(o){if(o.slice)return o.slice(0);var d=new Uint8Array(o.byteLength);return d.set(new Uint8Array(o)),d.buffer}function X(){return this.bodyUsed=!1,this._initBody=function(o){this.bodyUsed=this.bodyUsed,this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:l.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:l.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():l.arrayBuffer&&l.blob&&m(o)?(this._bodyArrayBuffer=H(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||A(o))?this._bodyArrayBuffer=H(o):this._bodyText=o=Object.prototype.toString.call(o):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var o=N(this);if(o)return o;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(){if(this._bodyArrayBuffer){var o=N(this);return o||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(l.blob)return this.blob().then(ce);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var o=N(this);if(o)return o;if(this._bodyBlob)return M(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(q(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(qn)}),this.json=function(){return this.text().then(JSON.parse)},this}var de=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Mn(o){var d=o.toUpperCase();return de.indexOf(d)>-1?d:o}function B(o,d){if(!(this instanceof B))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');d=d||{};var E=d.body;if(o instanceof B){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,d.headers||(this.headers=new y(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!E&&o._bodyInit!=null&&(E=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new y(d.headers)),this.method=Mn(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal||(function(){if("AbortController"in c){var T=new AbortController;return T.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(E),(this.method==="GET"||this.method==="HEAD")&&(d.cache==="no-store"||d.cache==="no-cache")){var P=/([?&])_=[^&]*/;if(P.test(this.url))this.url=this.url.replace(P,"$1_="+new Date().getTime());else{var O=/\?/;this.url+=(O.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}B.prototype.clone=function(){return new B(this,{body:this._bodyInit})};function qn(o){var d=new FormData;return o.trim().split("&").forEach(function(E){if(E){var P=E.split("="),O=P.shift().replace(/\+/g," "),T=P.join("=").replace(/\+/g," ");d.append(decodeURIComponent(O),decodeURIComponent(T))}}),d}function Fn(o){var d=new y,E=o.replace(/\r?\n[\t ]+/g," ");return E.split("\r").map(function(P){return P.indexOf(`
|
|
56
|
+
`)===0?P.substr(1,P.length):P}).forEach(function(P){var O=P.split(":"),T=O.shift().trim();if(T){var le=O.join(":").trim();try{d.append(T,le)}catch(Pe){console.warn("Response "+Pe.message)}}}),d}X.call(B.prototype);function w(o,d){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=d.statusText===void 0?"":""+d.statusText,this.headers=new y(d.headers),this.url=d.url||"",this._initBody(o)}X.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},w.error=function(){var o=new w(null,{status:200,statusText:""});return o.ok=!1,o.status=0,o.type="error",o};var Bn=[301,302,303,307,308];w.redirect=function(o,d){if(Bn.indexOf(d)===-1)throw new RangeError("Invalid status code");return new w(null,{status:d,headers:{location:o}})},a.DOMException=c.DOMException;try{new a.DOMException}catch{a.DOMException=function(d,E){this.message=d,this.name=E;var P=Error(d);this.stack=P.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function Ie(o,d){return new Promise(function(E,P){var O=new B(o,d);if(O.signal&&O.signal.aborted)return P(new a.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function le(){T.abort()}T.onload=function(){var D={statusText:T.statusText,headers:Fn(T.getAllResponseHeaders()||"")};O.url.indexOf("file://")===0&&(T.status<200||T.status>599)?D.status=200:D.status=T.status,D.url="responseURL"in T?T.responseURL:D.headers.get("X-Request-URL");var U="response"in T?T.response:T.responseText;setTimeout(function(){E(new w(U,D))},0)},T.onerror=function(){setTimeout(function(){P(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){P(new TypeError("Network request timed out"))},0)},T.onabort=function(){setTimeout(function(){P(new a.DOMException("Aborted","AbortError"))},0)};function Pe(D){try{return D===""&&c.location.href?c.location.href:D}catch{return D}}if(T.open(O.method,Pe(O.url),!0),O.credentials==="include"?T.withCredentials=!0:O.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(l.blob?T.responseType="blob":l.arrayBuffer&&(T.responseType="arraybuffer")),d&&typeof d.headers=="object"&&!(d.headers instanceof y||c.Headers&&d.headers instanceof c.Headers)){var Qe=[];Object.getOwnPropertyNames(d.headers).forEach(function(D){Qe.push(C(D)),T.setRequestHeader(D,S(d.headers[D]))}),O.headers.forEach(function(D,U){Qe.indexOf(U)===-1&&T.setRequestHeader(U,D)})}else O.headers.forEach(function(D,U){T.setRequestHeader(U,D)});O.signal&&(O.signal.addEventListener("abort",le),T.onreadystatechange=function(){T.readyState===4&&O.signal.removeEventListener("abort",le)}),T.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return Ie.polyfill=!0,c.fetch||(c.fetch=Ie,c.Headers=y,c.Request=B,c.Response=w),a.Headers=y,a.Request=B,a.Response=w,a.fetch=Ie,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n: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})(re,re.exports)),re.exports}var ie=Vt();const se=Ut(ie),$t=_({__proto__:null,default:se},[ie]),j=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||$t&&ie.Headers&&e instanceof ie.Headers?t=Xe(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},Ve=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),jt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(Ve(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:Ve(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},Ht=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:a,fetchOptions:c,middleware:l}=t,m={...t.headers};let f="",A;e==="POST"?(A=Qt(r,i,s,c.jsonSerializer),typeof A=="string"&&(m["Content-Type"]="application/json")):f=jt({query:r,variables:i,operationName:s,jsonSerializer:c.jsonSerializer??F});const C={method:e,headers:m,body:A,...c};let S=n,I=C;if(l){const y=await Promise.resolve(l({...C,url:n,operationName:s,variables:i})),{url:N,...k}=y;S=N,I=k}return f&&(S=`${S}?${f}`),await a(S,I)};class Yt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,a]=r,c=Ze(i,s,a),{headers:l,fetch:m=se,method:f="POST",requestMiddleware:A,responseMiddleware:C,...S}=this.requestConfig,{url:I}=this;c.signal!==void 0&&(S.signal=c.signal);const{operationName:y}=Ee(c.query);return Ae({url:I,query:c.query,variables:c.variables,headers:{...j(ve(l)),...j(c.requestHeaders)},operationName:y,fetch:m,method:f,fetchOptions:S,middleware:A}).then(N=>(C&&C(N),N)).catch(N=>{throw C&&C(N),N})}}async request(t,...n){const[r,i]=n,s=Ke(t,r,i),{headers:a,fetch:c=se,method:l="POST",requestMiddleware:m,responseMiddleware:f,...A}=this.requestConfig,{url:C}=this;s.signal!==void 0&&(A.signal=s.signal);const{query:S,operationName:I}=Ee(s.document);return Ae({url:C,query:S,variables:s.variables,headers:{...j(ve(a)),...j(s.requestHeaders)},operationName:I,fetch:c,method:l,fetchOptions:A,middleware:m}).then(y=>(f&&f(y),y.data)).catch(y=>{throw f&&f(y),y})}batchRequests(t,n){const r=We(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const a=r.documents.map(({document:l})=>Ee(l).query),c=r.documents.map(({variables:l})=>l);return Ae({url:this.url,query:a,variables:c,headers:{...j(ve(i)),...j(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??se,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(l=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(l),l.data)).catch(l=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(l),l})}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 Ae=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=Ht(Je(e.method??"post")),s=Array.isArray(e.query),a=await i(e),c=await zt(a,r.jsonSerializer??F),l=Array.isArray(c)?!c.some(({data:f})=>!f):!!c.data,m=Array.isArray(c)||!c.errors||Array.isArray(c.errors)&&!c.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(a.ok&&m&&l){const{errors:f,...A}=(Array.isArray(c),c),C=r.errorPolicy==="ignore"?A:c;return{...s?{data:C}:C,headers:a.headers,status:a.status}}else{const f=typeof c=="string"?{error:c}:c;throw new z({...f,status:a.status,headers:a.headers},{query:t,variables:n})}},Qt=(e,t,n,r)=>{const i=r??F;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((a,c,l)=>(a.push({query:c,variables:t?t[l]:void 0}),a),[]);return i.stringify(s)},zt=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()},ve=e=>typeof e=="function"?e():e;var ae=function(){return ae=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},ae.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var oe=new Map,Te=new Map,$e=!0,ue=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function Jt(e){return je(e.source.body.substring(e.start,e.end))}function Xt(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=Jt(r.loc),a=Te.get(i);a&&!a.has(s)?$e&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
57
57
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
58
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||Te.set(i,a=new Set),a.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ae(ae({},e),{definitions:n})}function Kt(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=je(e);if(!oe.has(t)){var n=Fe(e,{experimentalFragmentVariables:ue,allowLegacyFragmentVariables:ue});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");oe.set(t,Kt(Xt(n)))}return oe.get(t)}function
|
|
58
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||Te.set(i,a=new Set),a.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ae(ae({},e),{definitions:n})}function Kt(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=je(e);if(!oe.has(t)){var n=Fe(e,{experimentalFragmentVariables:ue,allowLegacyFragmentVariables:ue});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");oe.set(t,Kt(Xt(n)))}return oe.get(t)}function v(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 Wt(){oe.clear(),Te.clear()}function en(){$e=!1}function tn(){ue=!0}function nn(){ue=!1}var J={gql:v,resetCaches:Wt,disableFragmentWarnings:en,enableExperimentalFragmentVariables:tn,disableExperimentalFragmentVariables:nn};(function(e){e.gql=J.gql,e.resetCaches=J.resetCaches,e.disableFragmentWarnings=J.disableFragmentWarnings,e.enableExperimentalFragmentVariables=J.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=J.disableExperimentalFragmentVariables})(v||(v={})),v.default=v;const rn=v`
|
|
59
59
|
query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
60
60
|
locationAvailabilities(
|
|
61
61
|
sku: $sku
|
|
@@ -94,7 +94,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
`,sn=
|
|
97
|
+
`,sn=v`
|
|
98
98
|
query GetLocationAvailability($sku: String!, $locationID: ID!) {
|
|
99
99
|
locationAvailability(sku: $sku, locationID: $locationID) {
|
|
100
100
|
location {
|
|
@@ -120,7 +120,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
120
120
|
inventoryQuantity
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
`,an=
|
|
123
|
+
`,an=v`
|
|
124
124
|
query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
|
|
125
125
|
purchasingCustomerMetafield(namespace: $namespace, key: $key) {
|
|
126
126
|
id
|
|
@@ -129,7 +129,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
129
129
|
value
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
`,on=
|
|
132
|
+
`,on=v`
|
|
133
133
|
query GetPoints {
|
|
134
134
|
purchasingCustomer {
|
|
135
135
|
pointsApproved
|
|
@@ -141,7 +141,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
`,un=
|
|
144
|
+
`,un=v`
|
|
145
145
|
query GetLocations($first: Int, $after: String, $filter: LocationFilter, $isReverse: Boolean! = false) {
|
|
146
146
|
locations(first: $first, after: $after, filter: $filter, isReverse: $isReverse) {
|
|
147
147
|
nodes {
|
|
@@ -172,7 +172,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
`,cn=
|
|
175
|
+
`,cn=v`
|
|
176
176
|
query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
177
177
|
purchasingCustomer {
|
|
178
178
|
id
|
|
@@ -201,14 +201,14 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
`,dn=
|
|
204
|
+
`,dn=v`
|
|
205
205
|
query GetPurchasingCustomerDiscountCodeCount {
|
|
206
206
|
purchasingCustomer {
|
|
207
207
|
id
|
|
208
208
|
orderPriceAdjustmentRuleCount
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
`,ln=
|
|
211
|
+
`,ln=v`
|
|
212
212
|
query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
|
|
213
213
|
purchasingCustomer {
|
|
214
214
|
id
|
|
@@ -268,7 +268,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
`,pn=
|
|
271
|
+
`,pn=v`
|
|
272
272
|
query GetPurchasingCustomerRank {
|
|
273
273
|
purchasingCustomer {
|
|
274
274
|
currentCustomerRank {
|
|
@@ -309,14 +309,21 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
`,hn=
|
|
312
|
+
`,hn=v`
|
|
313
|
+
query GetPurchasingCustomerBarcode {
|
|
314
|
+
purchasingCustomer {
|
|
315
|
+
id
|
|
316
|
+
barcode
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
`,mn=v`
|
|
313
320
|
query GetSharingPurchasingCustomerCount {
|
|
314
321
|
purchasingCustomer {
|
|
315
322
|
id
|
|
316
323
|
sharingPurchasingCustomerCount
|
|
317
324
|
}
|
|
318
325
|
}
|
|
319
|
-
`,
|
|
326
|
+
`,fn=v`
|
|
320
327
|
query GetPurchasingCustomerSharing {
|
|
321
328
|
purchasingCustomer {
|
|
322
329
|
id
|
|
@@ -333,7 +340,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
333
340
|
}
|
|
334
341
|
}
|
|
335
342
|
}
|
|
336
|
-
`,
|
|
343
|
+
`,gn=v`
|
|
337
344
|
query GetProduct($id: String!, $first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: ProductVariantSortKeys! = CREATED_AT) {
|
|
338
345
|
productByProductShopifyLegacyResourceID(productShopifyLegacyResourceID: $id) {
|
|
339
346
|
id
|
|
@@ -365,14 +372,14 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
365
372
|
}
|
|
366
373
|
}
|
|
367
374
|
}
|
|
368
|
-
`,
|
|
375
|
+
`,Cn=v`
|
|
369
376
|
query GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID($id: String!) {
|
|
370
377
|
productByProductShopifyLegacyResourceID(productShopifyLegacyResourceID: $id) {
|
|
371
378
|
id
|
|
372
379
|
hasBackOrderProductVariants
|
|
373
380
|
}
|
|
374
381
|
}
|
|
375
|
-
`,
|
|
382
|
+
`,yn=v`
|
|
376
383
|
query GetPointCampaignOrderRuleTargetCustomerRank {
|
|
377
384
|
pointCampaignOrderRuleTargetCustomerRank {
|
|
378
385
|
pointCampaignOrderRule {
|
|
@@ -385,7 +392,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
385
392
|
fixedPoint
|
|
386
393
|
}
|
|
387
394
|
}
|
|
388
|
-
`,
|
|
395
|
+
`,En=v`
|
|
389
396
|
query GetEstimatedShopifyCartPoint($input: EstimatedShopifyCartPointInput!) {
|
|
390
397
|
estimatedShopifyCartPoint(input: $input) {
|
|
391
398
|
pointsEarning
|
|
@@ -401,7 +408,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
401
408
|
}
|
|
402
409
|
}
|
|
403
410
|
}
|
|
404
|
-
`,
|
|
411
|
+
`,An=v`
|
|
405
412
|
query GetEstimatedShopifyCartLineItemPoint($input: EstimatedShopifyCartLineItemPointInput!) {
|
|
406
413
|
estimatedShopifyCartLineItemPoint(input: $input) {
|
|
407
414
|
pointsEarning
|
|
@@ -417,7 +424,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
417
424
|
}
|
|
418
425
|
}
|
|
419
426
|
}
|
|
420
|
-
`,
|
|
427
|
+
`,vn=v`
|
|
421
428
|
query GetPurchasingCustomerSMS {
|
|
422
429
|
purchasingCustomer {
|
|
423
430
|
id
|
|
@@ -425,7 +432,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
425
432
|
smsVerifiedPhone
|
|
426
433
|
}
|
|
427
434
|
}
|
|
428
|
-
`,
|
|
435
|
+
`,Tn=v`
|
|
429
436
|
mutation PurchasingCustomerSendCustomerSharingActivationCode {
|
|
430
437
|
purchasingCustomerSendCustomerSharingActivationCode {
|
|
431
438
|
purchasingCustomer {
|
|
@@ -441,7 +448,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
441
448
|
}
|
|
442
449
|
}
|
|
443
450
|
}
|
|
444
|
-
`,
|
|
451
|
+
`,In=v`
|
|
445
452
|
mutation PurchasingCustomerActivateCustomerSharing($email: String!, $activationCode: String!) {
|
|
446
453
|
purchasingCustomerActivateCustomerSharing(
|
|
447
454
|
input: {email: $email, activationCode: $activationCode}
|
|
@@ -456,13 +463,13 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
456
463
|
}
|
|
457
464
|
}
|
|
458
465
|
}
|
|
459
|
-
`,
|
|
466
|
+
`,Pn=v`
|
|
460
467
|
query GetMiles {
|
|
461
468
|
purchasingCustomer {
|
|
462
469
|
miles
|
|
463
470
|
}
|
|
464
471
|
}
|
|
465
|
-
`,Sn=
|
|
472
|
+
`,Sn=v`
|
|
466
473
|
query GetPurchasingCustomerMileChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: MileChangeActivitySortKey! = CREATED_AT) {
|
|
467
474
|
purchasingCustomer {
|
|
468
475
|
id
|
|
@@ -491,7 +498,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
491
498
|
}
|
|
492
499
|
}
|
|
493
500
|
}
|
|
494
|
-
`,
|
|
501
|
+
`,On=v`
|
|
495
502
|
query GetMileItems($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: ShopifyMileItemSortKey! = CREATED_AT) {
|
|
496
503
|
mileItems(
|
|
497
504
|
first: $first
|
|
@@ -519,7 +526,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
519
526
|
}
|
|
520
527
|
}
|
|
521
528
|
}
|
|
522
|
-
`,
|
|
529
|
+
`,Rn=v`
|
|
523
530
|
query GetMileOrders($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: MileOrderSortKey! = CREATED_AT) {
|
|
524
531
|
purchasingCustomer {
|
|
525
532
|
id
|
|
@@ -556,7 +563,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
556
563
|
}
|
|
557
564
|
}
|
|
558
565
|
}
|
|
559
|
-
`,
|
|
566
|
+
`,xn=v`
|
|
560
567
|
query GetPurchasingCustomerRetailOrders($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: RetailOrderSortKey! = CREATED_AT) {
|
|
561
568
|
purchasingCustomer {
|
|
562
569
|
retailOrders(
|
|
@@ -626,7 +633,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
626
633
|
}
|
|
627
634
|
}
|
|
628
635
|
}
|
|
629
|
-
`,
|
|
636
|
+
`,Dn=v`
|
|
630
637
|
mutation MileItemExchange($mileItemID: ID!) {
|
|
631
638
|
mileItemExchange(input: {mileItemID: $mileItemID}) {
|
|
632
639
|
mileOrder {
|
|
@@ -649,7 +656,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
649
656
|
}
|
|
650
657
|
}
|
|
651
658
|
}
|
|
652
|
-
`,
|
|
659
|
+
`,Nn=v`
|
|
653
660
|
mutation PurchasingCustomerSendSMSVerificationCode($phone: String!) {
|
|
654
661
|
purchasingCustomerSendSMSVerificationCode(input: {phone: $phone}) {
|
|
655
662
|
purchasingCustomer {
|
|
@@ -659,7 +666,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
659
666
|
}
|
|
660
667
|
}
|
|
661
668
|
}
|
|
662
|
-
`,
|
|
669
|
+
`,bn=v`
|
|
663
670
|
mutation PurchasingCustomerVerifySMS($phone: String!, $verificationCode: String!) {
|
|
664
671
|
purchasingCustomerVerifySMS(
|
|
665
672
|
input: {phone: $phone, verificationCode: $verificationCode}
|
|
@@ -671,7 +678,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
671
678
|
}
|
|
672
679
|
}
|
|
673
680
|
}
|
|
674
|
-
`,
|
|
681
|
+
`,kn=v`
|
|
675
682
|
mutation DiscountUsageCreate($orderPriceAdjustmentRuleID: ID!) {
|
|
676
683
|
shopifyOrderPriceAdjustmentUsageCreate(
|
|
677
684
|
input: {orderPriceAdjustmentRuleID: $orderPriceAdjustmentRuleID}
|
|
@@ -681,4 +688,4 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
681
688
|
}
|
|
682
689
|
}
|
|
683
690
|
}
|
|
684
|
-
`,kn=(e,t,n,r)=>e();function _n(e,t=kn){return{GetLocationAvailabilities(n,r,i){return t(s=>e.request({document:rn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r,i){return t(s=>e.request({document:sn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r,i){return t(s=>e.request({document:an,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r,i){return t(s=>e.request({document:on,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPoints","query",n)},GetLocations(n,r,i){return t(s=>e.request({document:un,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r,i){return t(s=>e.request({document:cn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r,i){return t(s=>e.request({document:dn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r,i){return t(s=>e.request({document:ln,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r,i){return t(s=>e.request({document:pn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerRank","query",n)},GetSharingPurchasingCustomerCount(n,r,i){return t(s=>e.request({document:hn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r,i){return t(s=>e.request({document:mn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r,i){return t(s=>e.request({document:fn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetProduct","query",n)},GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID(n,r,i){return t(s=>e.request({document:gn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID","query",n)},GetPointCampaignOrderRuleTargetCustomerRank(n,r,i){return t(s=>e.request({document:Cn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPointCampaignOrderRuleTargetCustomerRank","query",n)},GetEstimatedShopifyCartPoint(n,r,i){return t(s=>e.request({document:yn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetEstimatedShopifyCartPoint","query",n)},GetEstimatedShopifyCartLineItemPoint(n,r,i){return t(s=>e.request({document:En,variables:n,requestHeaders:{...r,...s},signal:i}),"GetEstimatedShopifyCartLineItemPoint","query",n)},GetPurchasingCustomerSMS(n,r,i){return t(s=>e.request({document:An,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerSMS","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r,i){return t(s=>e.request({document:vn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r,i){return t(s=>e.request({document:Tn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)},GetMiles(n,r,i){return t(s=>e.request({document:In,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMiles","query",n)},GetPurchasingCustomerMileChangeActivities(n,r,i){return t(s=>e.request({document:Sn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerMileChangeActivities","query",n)},GetMileItems(n,r,i){return t(s=>e.request({document:Pn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMileItems","query",n)},GetMileOrders(n,r,i){return t(s=>e.request({document:On,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMileOrders","query",n)},GetPurchasingCustomerRetailOrders(n,r,i){return t(s=>e.request({document:Rn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerRetailOrders","query",n)},MileItemExchange(n,r,i){return t(s=>e.request({document:xn,variables:n,requestHeaders:{...r,...s},signal:i}),"MileItemExchange","mutation",n)},PurchasingCustomerSendSMSVerificationCode(n,r,i){return t(s=>e.request({document:Dn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerSendSMSVerificationCode","mutation",n)},PurchasingCustomerVerifySMS(n,r,i){return t(s=>e.request({document:Nn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerVerifySMS","mutation",n)},DiscountUsageCreate(n,r,i){return t(s=>e.request({document:bn,variables:n,requestHeaders:{...r,...s},signal:i}),"DiscountUsageCreate","mutation",n)}}}var He=(e=>(e.Eur="EUR",e.Jpy="JPY",e.Usd="USD",e))(He||{}),Ye=(e=>(e.Retail="RETAIL",e.Warehouse="WAREHOUSE",e))(Ye||{});class Ln{constructor(t){ze(this,"api");this.api=_n(new Yt(`${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(a=>({location:{id:a.location.id,name:a.location.name,phone:a.location.phone,mapURL:a.location.mapURL,tags:a.location.tags,address:a.location.address?{id:a.location.address.id,countryCode:a.location.address.countryCode,country:a.location.address.country,postalCode:a.location.address.postalCode,provinceCode:a.location.address.provinceCode,province:a.location.address.province,city:a.location.address.city,address1:a.location.address.address1,address2:a.location.address.address2}:void 0},inventoryQuantity:a.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,pointsExpiringSoon:t.purchasingCustomer.pointsExpiringSoon?{points:t.purchasingCustomer.pointsExpiringSoon.points,expiresDate:new Date(t.purchasingCustomer.pointsExpiringSoon.expiresDate),availableUntil:new Date(t.purchasingCustomer.pointsExpiringSoon.availableUntil)}:void 0}:null}async getLocations(t,n,r,i){const s=await this.api.GetLocations({first:t,after:n,filter:r,isReverse:i});return{nodes:s.locations.nodes.map(a=>({id:a.id,name:a.name,phone:a.phone,mapURL:a.mapURL,tags:a.tags,address:a.address?{id:a.address.id,countryCode:a.address.countryCode,country:a.address.country,postalCode:a.address.postalCode,provinceCode:a.address.provinceCode,province:a.address.province,city:a.address.city,address1:a.address.address1,address2:a.address.address2}:void 0}))??[],pageInfo:s.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(a=>({id:a.id,title:a.title,tenant:{id:a.tenant.id,name:a.tenant.name},pointChange:{id:a.pointChange.id,delta:a.pointChange.delta,availableAt:a.pointChange.availableAt?new Date(a.pointChange.availableAt):void 0,expiresDate:a.pointChange.expiresDate?new Date(a.pointChange.expiresDate):void 0,availableUntil:a.pointChange.availableUntil?new Date(a.pointChange.availableUntil):void 0,pointChangeCreatedAt:new Date(a.pointChange.pointChangeCreatedAt),tenant:{id:a.pointChange.tenant.id,name:a.pointChange.tenant.name},createdAt:new Date(a.pointChange.createdAt)},retailLocation:a.retailLocation?{id:a.retailLocation.id,name:a.retailLocation.name,phone:a.retailLocation.phone,mapURL:a.retailLocation.mapURL,tags:a.retailLocation.tags,address:a.retailLocation.address?{id:a.retailLocation.address.id,countryCode:a.retailLocation.address.countryCode,country:a.retailLocation.address.country,postalCode:a.retailLocation.address.postalCode,provinceCode:a.retailLocation.address.provinceCode,province:a.retailLocation.address.province,city:a.retailLocation.address.city,address1:a.retailLocation.address.address1,address2:a.retailLocation.address.address2}:void 0}:void 0})),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,threshold:t.purchasingCustomer.currentCustomerRank.threshold,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,earnedPoint:t.purchasingCustomer.currentCustomerRank.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.purchasePrice,earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,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},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 a=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return a.productByProductShopifyLegacyResourceID?{id:a.productByProductShopifyLegacyResourceID.id,title:a.productByProductShopifyLegacyResourceID.title,hasBackOrderProductVariants:a.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,isLocalPickupAvailable:a.productByProductShopifyLegacyResourceID.isLocalPickupAvailable,variants:{nodes:a.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku},isBackOrderEnable:c.isBackOrderEnable,isLocalPickupAvailable:c.isLocalPickupAvailable})),pageInfo:a.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async getHasBackOrderProductVariants(t){const n=await this.api.GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID({id:t});return n.productByProductShopifyLegacyResourceID?n.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants:null}async getPointCampaignOrderRuleTargetCustomerRank(){const t=await this.api.GetPointCampaignOrderRuleTargetCustomerRank();return t.pointCampaignOrderRuleTargetCustomerRank?{pointCampaignOrderRule:{id:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.id,title:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.title,pointMethod:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.pointMethod,targetType:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.targetType},multiplier:t.pointCampaignOrderRuleTargetCustomerRank.multiplier?t.pointCampaignOrderRuleTargetCustomerRank.multiplier:void 0,fixedPoint:t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint?t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint:void 0}:null}async getEstimatedShopifyCartPoint(t,n,r){const i=await this.api.GetEstimatedShopifyCartPoint({input:{currencyCode:t,taxesIncluded:n,lineItems:r}});return i.estimatedShopifyCartPoint?{pointsEarning:i.estimatedShopifyCartPoint.pointsEarning,totalPointsEarning:i.estimatedShopifyCartPoint.totalPointsEarning,pointCampaign:i.estimatedShopifyCartPoint.pointCampaign?{pointsEarning:i.estimatedShopifyCartPoint.pointCampaign.pointsEarning,pointCampaignOrderRule:{id:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.id,title:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.title,pointMethod:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.pointMethod,targetType:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.targetType}}:void 0}:null}async getEstimatedShopifyCartLineItemPoint(t,n,r,i,s){const a=await this.api.GetEstimatedShopifyCartLineItemPoint({input:{currencyCode:t,taxesIncluded:n,sku:r,quantity:i,unitPrice:s}});return a.estimatedShopifyCartLineItemPoint?{pointsEarning:a.estimatedShopifyCartLineItemPoint.pointsEarning,totalPointsEarning:a.estimatedShopifyCartLineItemPoint.totalPointsEarning,pointCampaign:a.estimatedShopifyCartLineItemPoint.pointCampaign?{pointsEarning:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointsEarning,pointCampaignOrderRule:{id:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.id,title:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.title,pointMethod:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.pointMethod,targetType:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.targetType}}: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}async getMiles(){const t=await this.api.GetMiles();return t.purchasingCustomer?{miles:t.purchasingCustomer.miles}:null}async getMileChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerMileChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.mileChangeActivities.nodes.map(a=>({id:a.id,title:a.title,mileChange:{id:a.mileChange.id,delta:a.mileChange.delta,mileChangeCreatedAt:new Date(a.mileChange.mileChangeCreatedAt),createdAt:new Date(a.mileChange.createdAt)}})),pageInfo:s.purchasingCustomer.mileChangeActivities.pageInfo}:null}async getMileItems(t,n,r,i){const s=await this.api.GetMileItems({first:t,after:n,isReverse:r,sortKeys:i});return s.mileItems?{nodes:s.mileItems.nodes.map(a=>({id:a.id,title:a.title,description:a.description,miles:a.miles,sku:a.sku,isActive:a.isActive,isScheduled:a.isScheduled,customerExchangeable:a.customerExchangeable,startsAt:new Date(a.startsAt),endsAt:a.endsAt?new Date(a.endsAt):void 0})),pageInfo:s.mileItems.pageInfo}:null}async getMileOrders(t,n,r,i){const s=await this.api.GetMileOrders({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.mileOrders.nodes.map(a=>({id:a.id,mileItem:{id:a.mileItem.id,title:a.mileItem.title,description:a.mileItem.description,miles:a.mileItem.miles,sku:a.mileItem.sku,isActive:a.mileItem.isActive,isScheduled:a.mileItem.isScheduled,customerExchangeable:a.mileItem.customerExchangeable,startsAt:new Date(a.mileItem.startsAt),endsAt:a.mileItem.endsAt?new Date(a.mileItem.endsAt):void 0},miles:a.miles,exchangedAt:new Date(a.exchangedAt),isCancelled:a.isCancelled})),pageInfo:s.purchasingCustomer.mileOrders.pageInfo}:null}async getPurchasingCustomerSMS(){const t=await this.api.GetPurchasingCustomerSMS();return t.purchasingCustomer?{id:t.purchasingCustomer.id,smsVerifiedPhone:t.purchasingCustomer.smsVerifiedPhone,smsVerified:t.purchasingCustomer.smsVerified}:null}async getPurchasingCustomerRetailOrders(t,n,r,i){const s=await this.api.GetPurchasingCustomerRetailOrders({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.retailOrders.nodes.map(a=>({id:a.id,managementCode:a.managementCode,source:a.source,purchasedAt:new Date(a.purchasedAt),fulfilledAt:a.fulfilledAt?new Date(a.fulfilledAt):null,isCancelled:a.isCancelled,cancelledAt:a.cancelledAt?new Date(a.cancelledAt):null,tags:a.tags,paymentStatus:a.paymentStatus,retailLocation:{id:a.retailLocation.id,name:a.retailLocation.name,displayName:a.retailLocation.displayName},totalQuantity:a.totalQuantity,currentTotalQuantity:a.currentTotalQuantity,pointApplicationPrice:{amount:parseFloat(a.pointApplicationPrice.amount),currencyCode:a.pointApplicationPrice.currencyCode},currentPointApplicationPrice:{amount:parseFloat(a.currentPointApplicationPrice.amount),currencyCode:a.currentPointApplicationPrice.currencyCode},totalOrderDiscountPrice:{amount:parseFloat(a.totalOrderDiscountPrice.amount),currencyCode:a.totalOrderDiscountPrice.currencyCode},subtotalPrice:{amount:parseFloat(a.subtotalPrice.amount),currencyCode:a.subtotalPrice.currencyCode},totalTaxPrice:{amount:parseFloat(a.totalTaxPrice.amount),currencyCode:a.totalTaxPrice.currencyCode},currentTotalTaxPrice:{amount:parseFloat(a.currentTotalTaxPrice.amount),currencyCode:a.currentTotalTaxPrice.currencyCode},currentSubtotalPrice:{amount:parseFloat(a.currentSubtotalPrice.amount),currencyCode:a.currentSubtotalPrice.currencyCode},totalPrice:{amount:parseFloat(a.totalPrice.amount),currencyCode:a.totalPrice.currencyCode},createdAt:new Date(a.createdAt),updatedAt:new Date(a.updatedAt)})),pageInfo:s.purchasingCustomer.retailOrders.pageInfo}:null}async mileItemExchange(t){const n=await this.api.MileItemExchange({mileItemID:t});return n.mileItemExchange?{id:n.mileItemExchange.mileOrder.id,mileItem:{id:n.mileItemExchange.mileOrder.mileItem.id,title:n.mileItemExchange.mileOrder.mileItem.title,description:n.mileItemExchange.mileOrder.mileItem.description,miles:n.mileItemExchange.mileOrder.mileItem.miles,sku:n.mileItemExchange.mileOrder.mileItem.sku,isActive:n.mileItemExchange.mileOrder.mileItem.isActive,isScheduled:n.mileItemExchange.mileOrder.mileItem.isScheduled,customerExchangeable:n.mileItemExchange.mileOrder.mileItem.customerExchangeable,startsAt:new Date(n.mileItemExchange.mileOrder.mileItem.startsAt),endsAt:n.mileItemExchange.mileOrder.mileItem.endsAt?new Date(n.mileItemExchange.mileOrder.mileItem.endsAt):void 0},miles:n.mileItemExchange.mileOrder.miles,exchangedAt:new Date(n.mileItemExchange.mileOrder.exchangedAt),isCancelled:n.mileItemExchange.mileOrder.isCancelled}:null}async purchasingCustomerSendSMSVerificationCode(t){var i;const r=(i=(await this.api.PurchasingCustomerSendSMSVerificationCode({phone:t})).purchasingCustomerSendSMSVerificationCode)==null?void 0:i.purchasingCustomer;return r?{id:r.id,smsVerifiedPhone:r.smsVerifiedPhone,smsVerified:r.smsVerified}:null}async purchasingCustomerVerifySMS(t,n){var s;const i=(s=(await this.api.PurchasingCustomerVerifySMS({phone:t,verificationCode:n})).purchasingCustomerVerifySMS)==null?void 0:s.purchasingCustomer;return i?{id:i.id,smsVerifiedPhone:i.smsVerifiedPhone,smsVerified:i.smsVerified}:null}async DiscountUsageCreate(t){var r;const n=await this.api.DiscountUsageCreate({orderPriceAdjustmentRuleID:t});return(r=n==null?void 0:n.shopifyOrderPriceAdjustmentUsageCreate)!=null&&r.orderPriceAdjustmentRule?n.shopifyOrderPriceAdjustmentUsageCreate.orderPriceAdjustmentRule:null}}b.CurrencyCode=He,b.LocationType=Ye,b.SDK=Ln,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
|
|
691
|
+
`,_n=(e,t,n,r)=>e();function Ln(e,t=_n){return{GetLocationAvailabilities(n,r,i){return t(s=>e.request({document:rn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r,i){return t(s=>e.request({document:sn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r,i){return t(s=>e.request({document:an,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r,i){return t(s=>e.request({document:on,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPoints","query",n)},GetLocations(n,r,i){return t(s=>e.request({document:un,variables:n,requestHeaders:{...r,...s},signal:i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r,i){return t(s=>e.request({document:cn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r,i){return t(s=>e.request({document:dn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r,i){return t(s=>e.request({document:ln,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r,i){return t(s=>e.request({document:pn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerRank","query",n)},GetPurchasingCustomerBarcode(n,r,i){return t(s=>e.request({document:hn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerBarcode","query",n)},GetSharingPurchasingCustomerCount(n,r,i){return t(s=>e.request({document:mn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r,i){return t(s=>e.request({document:fn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r,i){return t(s=>e.request({document:gn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetProduct","query",n)},GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID(n,r,i){return t(s=>e.request({document:Cn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID","query",n)},GetPointCampaignOrderRuleTargetCustomerRank(n,r,i){return t(s=>e.request({document:yn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPointCampaignOrderRuleTargetCustomerRank","query",n)},GetEstimatedShopifyCartPoint(n,r,i){return t(s=>e.request({document:En,variables:n,requestHeaders:{...r,...s},signal:i}),"GetEstimatedShopifyCartPoint","query",n)},GetEstimatedShopifyCartLineItemPoint(n,r,i){return t(s=>e.request({document:An,variables:n,requestHeaders:{...r,...s},signal:i}),"GetEstimatedShopifyCartLineItemPoint","query",n)},GetPurchasingCustomerSMS(n,r,i){return t(s=>e.request({document:vn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerSMS","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r,i){return t(s=>e.request({document:Tn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r,i){return t(s=>e.request({document:In,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)},GetMiles(n,r,i){return t(s=>e.request({document:Pn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMiles","query",n)},GetPurchasingCustomerMileChangeActivities(n,r,i){return t(s=>e.request({document:Sn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerMileChangeActivities","query",n)},GetMileItems(n,r,i){return t(s=>e.request({document:On,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMileItems","query",n)},GetMileOrders(n,r,i){return t(s=>e.request({document:Rn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetMileOrders","query",n)},GetPurchasingCustomerRetailOrders(n,r,i){return t(s=>e.request({document:xn,variables:n,requestHeaders:{...r,...s},signal:i}),"GetPurchasingCustomerRetailOrders","query",n)},MileItemExchange(n,r,i){return t(s=>e.request({document:Dn,variables:n,requestHeaders:{...r,...s},signal:i}),"MileItemExchange","mutation",n)},PurchasingCustomerSendSMSVerificationCode(n,r,i){return t(s=>e.request({document:Nn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerSendSMSVerificationCode","mutation",n)},PurchasingCustomerVerifySMS(n,r,i){return t(s=>e.request({document:bn,variables:n,requestHeaders:{...r,...s},signal:i}),"PurchasingCustomerVerifySMS","mutation",n)},DiscountUsageCreate(n,r,i){return t(s=>e.request({document:kn,variables:n,requestHeaders:{...r,...s},signal:i}),"DiscountUsageCreate","mutation",n)}}}var He=(e=>(e.Eur="EUR",e.Jpy="JPY",e.Usd="USD",e))(He||{}),Ye=(e=>(e.Retail="RETAIL",e.Warehouse="WAREHOUSE",e))(Ye||{});class wn{constructor(t){ze(this,"api");this.api=Ln(new Yt(`${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(a=>({location:{id:a.location.id,name:a.location.name,phone:a.location.phone,mapURL:a.location.mapURL,tags:a.location.tags,address:a.location.address?{id:a.location.address.id,countryCode:a.location.address.countryCode,country:a.location.address.country,postalCode:a.location.address.postalCode,provinceCode:a.location.address.provinceCode,province:a.location.address.province,city:a.location.address.city,address1:a.location.address.address1,address2:a.location.address.address2}:void 0},inventoryQuantity:a.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,pointsExpiringSoon:t.purchasingCustomer.pointsExpiringSoon?{points:t.purchasingCustomer.pointsExpiringSoon.points,expiresDate:new Date(t.purchasingCustomer.pointsExpiringSoon.expiresDate),availableUntil:new Date(t.purchasingCustomer.pointsExpiringSoon.availableUntil)}:void 0}:null}async getLocations(t,n,r,i){const s=await this.api.GetLocations({first:t,after:n,filter:r,isReverse:i});return{nodes:s.locations.nodes.map(a=>({id:a.id,name:a.name,phone:a.phone,mapURL:a.mapURL,tags:a.tags,address:a.address?{id:a.address.id,countryCode:a.address.countryCode,country:a.address.country,postalCode:a.address.postalCode,provinceCode:a.address.provinceCode,province:a.address.province,city:a.address.city,address1:a.address.address1,address2:a.address.address2}:void 0}))??[],pageInfo:s.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(a=>({id:a.id,title:a.title,tenant:{id:a.tenant.id,name:a.tenant.name},pointChange:{id:a.pointChange.id,delta:a.pointChange.delta,availableAt:a.pointChange.availableAt?new Date(a.pointChange.availableAt):void 0,expiresDate:a.pointChange.expiresDate?new Date(a.pointChange.expiresDate):void 0,availableUntil:a.pointChange.availableUntil?new Date(a.pointChange.availableUntil):void 0,pointChangeCreatedAt:new Date(a.pointChange.pointChangeCreatedAt),tenant:{id:a.pointChange.tenant.id,name:a.pointChange.tenant.name},createdAt:new Date(a.pointChange.createdAt)},retailLocation:a.retailLocation?{id:a.retailLocation.id,name:a.retailLocation.name,phone:a.retailLocation.phone,mapURL:a.retailLocation.mapURL,tags:a.retailLocation.tags,address:a.retailLocation.address?{id:a.retailLocation.address.id,countryCode:a.retailLocation.address.countryCode,country:a.retailLocation.address.country,postalCode:a.retailLocation.address.postalCode,provinceCode:a.retailLocation.address.provinceCode,province:a.retailLocation.address.province,city:a.retailLocation.address.city,address1:a.retailLocation.address.address1,address2:a.retailLocation.address.address2}:void 0}:void 0})),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,threshold:t.purchasingCustomer.currentCustomerRank.threshold,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,earnedPoint:t.purchasingCustomer.currentCustomerRank.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.purchasePrice,earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,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},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 a=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return a.productByProductShopifyLegacyResourceID?{id:a.productByProductShopifyLegacyResourceID.id,title:a.productByProductShopifyLegacyResourceID.title,hasBackOrderProductVariants:a.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,isLocalPickupAvailable:a.productByProductShopifyLegacyResourceID.isLocalPickupAvailable,variants:{nodes:a.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku},isBackOrderEnable:c.isBackOrderEnable,isLocalPickupAvailable:c.isLocalPickupAvailable})),pageInfo:a.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async getHasBackOrderProductVariants(t){const n=await this.api.GetHasBackOrderProductVariantsByProductShopifyLegacyResourceID({id:t});return n.productByProductShopifyLegacyResourceID?n.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants:null}async getPointCampaignOrderRuleTargetCustomerRank(){const t=await this.api.GetPointCampaignOrderRuleTargetCustomerRank();return t.pointCampaignOrderRuleTargetCustomerRank?{pointCampaignOrderRule:{id:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.id,title:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.title,pointMethod:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.pointMethod,targetType:t.pointCampaignOrderRuleTargetCustomerRank.pointCampaignOrderRule.targetType},multiplier:t.pointCampaignOrderRuleTargetCustomerRank.multiplier?t.pointCampaignOrderRuleTargetCustomerRank.multiplier:void 0,fixedPoint:t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint?t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint:void 0}:null}async getEstimatedShopifyCartPoint(t,n,r){const i=await this.api.GetEstimatedShopifyCartPoint({input:{currencyCode:t,taxesIncluded:n,lineItems:r}});return i.estimatedShopifyCartPoint?{pointsEarning:i.estimatedShopifyCartPoint.pointsEarning,totalPointsEarning:i.estimatedShopifyCartPoint.totalPointsEarning,pointCampaign:i.estimatedShopifyCartPoint.pointCampaign?{pointsEarning:i.estimatedShopifyCartPoint.pointCampaign.pointsEarning,pointCampaignOrderRule:{id:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.id,title:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.title,pointMethod:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.pointMethod,targetType:i.estimatedShopifyCartPoint.pointCampaign.pointCampaignOrderRule.targetType}}:void 0}:null}async getEstimatedShopifyCartLineItemPoint(t,n,r,i,s){const a=await this.api.GetEstimatedShopifyCartLineItemPoint({input:{currencyCode:t,taxesIncluded:n,sku:r,quantity:i,unitPrice:s}});return a.estimatedShopifyCartLineItemPoint?{pointsEarning:a.estimatedShopifyCartLineItemPoint.pointsEarning,totalPointsEarning:a.estimatedShopifyCartLineItemPoint.totalPointsEarning,pointCampaign:a.estimatedShopifyCartLineItemPoint.pointCampaign?{pointsEarning:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointsEarning,pointCampaignOrderRule:{id:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.id,title:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.title,pointMethod:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.pointMethod,targetType:a.estimatedShopifyCartLineItemPoint.pointCampaign.pointCampaignOrderRule.targetType}}: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}async getMiles(){const t=await this.api.GetMiles();return t.purchasingCustomer?{miles:t.purchasingCustomer.miles}:null}async getMileChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerMileChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.mileChangeActivities.nodes.map(a=>({id:a.id,title:a.title,mileChange:{id:a.mileChange.id,delta:a.mileChange.delta,mileChangeCreatedAt:new Date(a.mileChange.mileChangeCreatedAt),createdAt:new Date(a.mileChange.createdAt)}})),pageInfo:s.purchasingCustomer.mileChangeActivities.pageInfo}:null}async getMileItems(t,n,r,i){const s=await this.api.GetMileItems({first:t,after:n,isReverse:r,sortKeys:i});return s.mileItems?{nodes:s.mileItems.nodes.map(a=>({id:a.id,title:a.title,description:a.description,miles:a.miles,sku:a.sku,isActive:a.isActive,isScheduled:a.isScheduled,customerExchangeable:a.customerExchangeable,startsAt:new Date(a.startsAt),endsAt:a.endsAt?new Date(a.endsAt):void 0})),pageInfo:s.mileItems.pageInfo}:null}async getMileOrders(t,n,r,i){const s=await this.api.GetMileOrders({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.mileOrders.nodes.map(a=>({id:a.id,mileItem:{id:a.mileItem.id,title:a.mileItem.title,description:a.mileItem.description,miles:a.mileItem.miles,sku:a.mileItem.sku,isActive:a.mileItem.isActive,isScheduled:a.mileItem.isScheduled,customerExchangeable:a.mileItem.customerExchangeable,startsAt:new Date(a.mileItem.startsAt),endsAt:a.mileItem.endsAt?new Date(a.mileItem.endsAt):void 0},miles:a.miles,exchangedAt:new Date(a.exchangedAt),isCancelled:a.isCancelled})),pageInfo:s.purchasingCustomer.mileOrders.pageInfo}:null}async getPurchasingCustomerSMS(){const t=await this.api.GetPurchasingCustomerSMS();return t.purchasingCustomer?{id:t.purchasingCustomer.id,smsVerifiedPhone:t.purchasingCustomer.smsVerifiedPhone,smsVerified:t.purchasingCustomer.smsVerified}:null}async getPurchasingCustomerBarcode(){const t=await this.api.GetPurchasingCustomerBarcode();return t.purchasingCustomer?{id:t.purchasingCustomer.id,barcode:t.purchasingCustomer.barcode}:null}async getPurchasingCustomerRetailOrders(t,n,r,i){const s=await this.api.GetPurchasingCustomerRetailOrders({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.retailOrders.nodes.map(a=>({id:a.id,managementCode:a.managementCode,source:a.source,purchasedAt:new Date(a.purchasedAt),fulfilledAt:a.fulfilledAt?new Date(a.fulfilledAt):null,isCancelled:a.isCancelled,cancelledAt:a.cancelledAt?new Date(a.cancelledAt):null,tags:a.tags,paymentStatus:a.paymentStatus,retailLocation:{id:a.retailLocation.id,name:a.retailLocation.name,displayName:a.retailLocation.displayName},totalQuantity:a.totalQuantity,currentTotalQuantity:a.currentTotalQuantity,pointApplicationPrice:{amount:parseFloat(a.pointApplicationPrice.amount),currencyCode:a.pointApplicationPrice.currencyCode},currentPointApplicationPrice:{amount:parseFloat(a.currentPointApplicationPrice.amount),currencyCode:a.currentPointApplicationPrice.currencyCode},totalOrderDiscountPrice:{amount:parseFloat(a.totalOrderDiscountPrice.amount),currencyCode:a.totalOrderDiscountPrice.currencyCode},subtotalPrice:{amount:parseFloat(a.subtotalPrice.amount),currencyCode:a.subtotalPrice.currencyCode},totalTaxPrice:{amount:parseFloat(a.totalTaxPrice.amount),currencyCode:a.totalTaxPrice.currencyCode},currentTotalTaxPrice:{amount:parseFloat(a.currentTotalTaxPrice.amount),currencyCode:a.currentTotalTaxPrice.currencyCode},currentSubtotalPrice:{amount:parseFloat(a.currentSubtotalPrice.amount),currencyCode:a.currentSubtotalPrice.currencyCode},totalPrice:{amount:parseFloat(a.totalPrice.amount),currencyCode:a.totalPrice.currencyCode},createdAt:new Date(a.createdAt),updatedAt:new Date(a.updatedAt)})),pageInfo:s.purchasingCustomer.retailOrders.pageInfo}:null}async mileItemExchange(t){const n=await this.api.MileItemExchange({mileItemID:t});return n.mileItemExchange?{id:n.mileItemExchange.mileOrder.id,mileItem:{id:n.mileItemExchange.mileOrder.mileItem.id,title:n.mileItemExchange.mileOrder.mileItem.title,description:n.mileItemExchange.mileOrder.mileItem.description,miles:n.mileItemExchange.mileOrder.mileItem.miles,sku:n.mileItemExchange.mileOrder.mileItem.sku,isActive:n.mileItemExchange.mileOrder.mileItem.isActive,isScheduled:n.mileItemExchange.mileOrder.mileItem.isScheduled,customerExchangeable:n.mileItemExchange.mileOrder.mileItem.customerExchangeable,startsAt:new Date(n.mileItemExchange.mileOrder.mileItem.startsAt),endsAt:n.mileItemExchange.mileOrder.mileItem.endsAt?new Date(n.mileItemExchange.mileOrder.mileItem.endsAt):void 0},miles:n.mileItemExchange.mileOrder.miles,exchangedAt:new Date(n.mileItemExchange.mileOrder.exchangedAt),isCancelled:n.mileItemExchange.mileOrder.isCancelled}:null}async purchasingCustomerSendSMSVerificationCode(t){var i;const r=(i=(await this.api.PurchasingCustomerSendSMSVerificationCode({phone:t})).purchasingCustomerSendSMSVerificationCode)==null?void 0:i.purchasingCustomer;return r?{id:r.id,smsVerifiedPhone:r.smsVerifiedPhone,smsVerified:r.smsVerified}:null}async purchasingCustomerVerifySMS(t,n){var s;const i=(s=(await this.api.PurchasingCustomerVerifySMS({phone:t,verificationCode:n})).purchasingCustomerVerifySMS)==null?void 0:s.purchasingCustomer;return i?{id:i.id,smsVerifiedPhone:i.smsVerifiedPhone,smsVerified:i.smsVerified}:null}async DiscountUsageCreate(t){var r;const n=await this.api.DiscountUsageCreate({orderPriceAdjustmentRuleID:t});return(r=n==null?void 0:n.shopifyOrderPriceAdjustmentUsageCreate)!=null&&r.orderPriceAdjustmentRule?n.shopifyOrderPriceAdjustmentUsageCreate.orderPriceAdjustmentRule:null}}b.CurrencyCode=He,b.LocationType=Ye,b.SDK=wn,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
|