@noxickon/onyx 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/Button-BV4_pmoH.js +11054 -0
- package/dist/chunks/Button-CU-zvMVL.js +20 -0
- package/dist/chunks/Input-BraK4lDE.js +138 -0
- package/dist/chunks/Input-C5dK8VSu.js +1 -0
- package/dist/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +1 -0
- package/dist/chunks/constants-B1_n9ezb.js +1 -0
- package/dist/chunks/constants-CDXq37n6.js +4 -0
- package/dist/chunks/index-DGjVEo0G.js +22 -0
- package/dist/chunks/index-Dgwp7JKP.js +601 -0
- package/dist/chunks/index-DnVdNmco.js +2129 -0
- package/dist/chunks/index-rUH_mzKt.js +2 -0
- package/dist/chunks/isObject-BDHKUJKN.js +1 -0
- package/dist/chunks/isObject-vmP43YLW.js +6 -0
- package/dist/chunks/jsx-runtime--oOP9f8K.js +284 -0
- package/dist/chunks/jsx-runtime-CITbqOLs.js +22 -0
- package/dist/chunks/useAuth-BwjRd05B.js +10 -0
- package/dist/chunks/useAuth-CR3bAGqp.js +61 -0
- package/dist/chunks/useForm-BAbY8X4X.js +3085 -0
- package/dist/chunks/useForm-cxgyAiOs.js +26 -0
- package/dist/chunks/useQuery--6GP2-dN.js +2 -0
- package/dist/chunks/useQuery-mFRa2XuW.js +1481 -0
- package/dist/context/context.cjs.js +1 -0
- package/dist/context/context.es.js +6 -0
- package/dist/context.d.ts +44 -0
- package/dist/hooks/hooks.cjs.js +6 -0
- package/dist/hooks/hooks.es.js +1917 -0
- package/dist/hooks.d.ts +130 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +144 -110
- package/dist/layout/layout.cjs.js +1 -0
- package/dist/layout/layout.es.js +264 -0
- package/dist/layout.d.ts +89 -0
- package/dist/onyx.cjs.js +1 -0
- package/dist/onyx.es.js +1219 -9485
- package/dist/pages/pages.cjs.js +7 -0
- package/dist/pages/pages.es.js +93 -0
- package/dist/pages.d.ts +14 -0
- package/dist/shared.css +104 -0
- package/package.json +40 -16
- package/dist/onyx.umd.js +0 -42
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime--oOP9f8K.js";
|
|
2
|
+
import { useId as S, useState as q, useEffect as C } from "react";
|
|
3
|
+
import { t as x, a as p } from "./Button-BV4_pmoH.js";
|
|
4
|
+
import { i as G } from "./isObject-vmP43YLW.js";
|
|
5
|
+
const H = ({
|
|
6
|
+
children: r,
|
|
7
|
+
className: l,
|
|
8
|
+
disabled: s = !1,
|
|
9
|
+
htmlFor: t,
|
|
10
|
+
required: a = !1
|
|
11
|
+
}) => /* @__PURE__ */ e.jsxs(
|
|
12
|
+
"label",
|
|
13
|
+
{
|
|
14
|
+
id: `${t}-label`,
|
|
15
|
+
className: x(
|
|
16
|
+
"block text-sm font-medium text-neutral-300",
|
|
17
|
+
s && "cursor-not-allowed text-neutral-500",
|
|
18
|
+
l
|
|
19
|
+
),
|
|
20
|
+
htmlFor: t,
|
|
21
|
+
children: [
|
|
22
|
+
r,
|
|
23
|
+
a && /* @__PURE__ */ e.jsx("span", { className: "ml-1 text-rose-400", children: "*" })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
), J = ({
|
|
27
|
+
children: r,
|
|
28
|
+
className: l,
|
|
29
|
+
disabled: s = !1,
|
|
30
|
+
id: t
|
|
31
|
+
}) => /* @__PURE__ */ e.jsx(
|
|
32
|
+
"p",
|
|
33
|
+
{
|
|
34
|
+
id: t,
|
|
35
|
+
className: x("text-xs text-neutral-400", s && "text-neutral-500", l),
|
|
36
|
+
children: r
|
|
37
|
+
}
|
|
38
|
+
), I = ({
|
|
39
|
+
children: r,
|
|
40
|
+
className: l,
|
|
41
|
+
icon: s = "mdiAlertCircleOutline",
|
|
42
|
+
id: t
|
|
43
|
+
}) => r ? /* @__PURE__ */ e.jsxs(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
id: t,
|
|
47
|
+
className: x("flex max-w-full items-center gap-1 text-xs text-rose-400", l),
|
|
48
|
+
role: "alert",
|
|
49
|
+
children: [
|
|
50
|
+
s ? /* @__PURE__ */ e.jsx(p, { className: "flex-shrink-0", icon: s, size: 0.8 }) : null,
|
|
51
|
+
/* @__PURE__ */ e.jsx("p", { className: "min-w-0 break-words", children: r })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
) : null, U = ({
|
|
55
|
+
children: r,
|
|
56
|
+
className: l,
|
|
57
|
+
fullWidth: s = !1,
|
|
58
|
+
noValidate: t = !0,
|
|
59
|
+
...a
|
|
60
|
+
}) => /* @__PURE__ */ e.jsx("form", { className: x(s && "w-full", l), noValidate: t, ...a, children: r }), V = ({
|
|
61
|
+
className: r,
|
|
62
|
+
description: l,
|
|
63
|
+
disabled: s = !1,
|
|
64
|
+
error: t = !1,
|
|
65
|
+
errorMessage: a,
|
|
66
|
+
icon: i = "",
|
|
67
|
+
iconPosition: u = "left",
|
|
68
|
+
id: v,
|
|
69
|
+
label: h,
|
|
70
|
+
name: E,
|
|
71
|
+
onChange: o,
|
|
72
|
+
placeholder: L = "Input placeholder...",
|
|
73
|
+
readOnly: $ = !1,
|
|
74
|
+
required: j = !1,
|
|
75
|
+
showMaxLength: k = !1,
|
|
76
|
+
type: z = "text",
|
|
77
|
+
value: n,
|
|
78
|
+
...g
|
|
79
|
+
}) => {
|
|
80
|
+
const A = S(), [B, b] = q(
|
|
81
|
+
typeof n == "string" ? n.length : 0
|
|
82
|
+
), f = v || A, N = `${f}-input`, w = `${f}-description`, m = `${f}-error`, y = g.maxLength, O = t && typeof a == "string", D = t && G(a);
|
|
83
|
+
C(() => {
|
|
84
|
+
typeof n == "string" && b(n.length);
|
|
85
|
+
}, [n]);
|
|
86
|
+
const F = (c) => {
|
|
87
|
+
const d = c.target.value.length;
|
|
88
|
+
b(d), o == null || o(c);
|
|
89
|
+
}, R = /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full items-center", children: [
|
|
90
|
+
i !== "" && u === "left" ? /* @__PURE__ */ e.jsx("div", { className: "absolute left-3 flex items-center", children: /* @__PURE__ */ e.jsx(p, { icon: i, size: 0.8 }) }) : null,
|
|
91
|
+
/* @__PURE__ */ e.jsx(
|
|
92
|
+
"input",
|
|
93
|
+
{
|
|
94
|
+
id: N,
|
|
95
|
+
"aria-describedby": [l ? w : "", O ? m : ""].filter(Boolean).join(" ") || void 0,
|
|
96
|
+
"aria-invalid": t,
|
|
97
|
+
"aria-required": j,
|
|
98
|
+
className: x(
|
|
99
|
+
"flex h-10 w-full rounded-lg bg-transparent px-2 py-2 text-sm text-white",
|
|
100
|
+
"default-outset-focus",
|
|
101
|
+
"placeholder:text-muted-foreground placeholder:text-neutral-500",
|
|
102
|
+
"default-disabled",
|
|
103
|
+
i && (u === "left" ? "pl-10" : "pr-10"),
|
|
104
|
+
t ? "default-error-border" : "default-border",
|
|
105
|
+
r
|
|
106
|
+
),
|
|
107
|
+
disabled: s,
|
|
108
|
+
name: E,
|
|
109
|
+
placeholder: L,
|
|
110
|
+
readOnly: $,
|
|
111
|
+
type: z,
|
|
112
|
+
value: n,
|
|
113
|
+
onChange: F,
|
|
114
|
+
...g
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
i !== "" && u === "right" ? /* @__PURE__ */ e.jsx("div", { className: "absolute right-3 flex items-center", children: /* @__PURE__ */ e.jsx(p, { icon: i, size: 0.8 }) }) : null
|
|
118
|
+
] });
|
|
119
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex w-full flex-col gap-1", children: [
|
|
120
|
+
h ? /* @__PURE__ */ e.jsx(H, { disabled: s, htmlFor: N, required: j, children: h }) : null,
|
|
121
|
+
R,
|
|
122
|
+
k && typeof y == "number" ? /* @__PURE__ */ e.jsxs("div", { className: "pointer-events-none mt-1 text-right text-xs text-neutral-400", children: [
|
|
123
|
+
B,
|
|
124
|
+
"/",
|
|
125
|
+
y
|
|
126
|
+
] }) : null,
|
|
127
|
+
l ? /* @__PURE__ */ e.jsx(J, { id: w, disabled: s, children: l }) : null,
|
|
128
|
+
O ? /* @__PURE__ */ e.jsx(I, { id: m, children: a }) : null,
|
|
129
|
+
D && Array.isArray(a) ? /* @__PURE__ */ e.jsx("div", { className: "mt-1 space-y-1", children: a.map((c, d) => /* @__PURE__ */ e.jsx(I, { id: `${m}-${d}`, children: c }, d)) }) : null
|
|
130
|
+
] });
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
U as O,
|
|
134
|
+
V as a,
|
|
135
|
+
I as b,
|
|
136
|
+
H as c,
|
|
137
|
+
J as d
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-CITbqOLs.js"),f=require("react"),x=require("./Button-CU-zvMVL.js"),S=require("./isObject-BDHKUJKN.js"),I=({children:l,className:r,disabled:s=!1,htmlFor:t,required:n=!1})=>e.jsxRuntimeExports.jsxs("label",{id:`${t}-label`,className:x.twMerge("block text-sm font-medium text-neutral-300",s&&"cursor-not-allowed text-neutral-500",r),htmlFor:t,children:[l,n&&e.jsxRuntimeExports.jsx("span",{className:"ml-1 text-rose-400",children:"*"})]}),y=({children:l,className:r,disabled:s=!1,id:t})=>e.jsxRuntimeExports.jsx("p",{id:t,className:x.twMerge("text-xs text-neutral-400",s&&"text-neutral-500",r),children:l}),j=({children:l,className:r,icon:s="mdiAlertCircleOutline",id:t})=>l?e.jsxRuntimeExports.jsxs("div",{id:t,className:x.twMerge("flex max-w-full items-center gap-1 text-xs text-rose-400",r),role:"alert",children:[s?e.jsxRuntimeExports.jsx(x.OxIcon,{className:"flex-shrink-0",icon:s,size:.8}):null,e.jsxRuntimeExports.jsx("p",{className:"min-w-0 break-words",children:l})]}):null,C=({children:l,className:r,fullWidth:s=!1,noValidate:t=!0,...n})=>e.jsxRuntimeExports.jsx("form",{className:x.twMerge(s&&"w-full",r),noValidate:t,...n,children:l}),G=({className:l,description:r,disabled:s=!1,error:t=!1,errorMessage:n,icon:a="",iconPosition:c="left",id:L,label:h,name:v,onChange:m,placeholder:$="Input placeholder...",readOnly:M=!1,required:E=!1,showMaxLength:k=!1,type:q="text",value:i,...g})=>{const z=f.useId(),[A,R]=f.useState(typeof i=="string"?i.length:0),d=L||z,w=`${d}-input`,O=`${d}-description`,p=`${d}-error`,b=g.maxLength,N=t&&typeof n=="string",B=t&&S.isObject(n);f.useEffect(()=>{typeof i=="string"&&R(i.length)},[i]);const D=u=>{const o=u.target.value.length;R(o),m==null||m(u)},F=e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full items-center",children:[a!==""&&c==="left"?e.jsxRuntimeExports.jsx("div",{className:"absolute left-3 flex items-center",children:e.jsxRuntimeExports.jsx(x.OxIcon,{icon:a,size:.8})}):null,e.jsxRuntimeExports.jsx("input",{id:w,"aria-describedby":[r?O:"",N?p:""].filter(Boolean).join(" ")||void 0,"aria-invalid":t,"aria-required":E,className:x.twMerge("flex h-10 w-full rounded-lg bg-transparent px-2 py-2 text-sm text-white","default-outset-focus","placeholder:text-muted-foreground placeholder:text-neutral-500","default-disabled",a&&(c==="left"?"pl-10":"pr-10"),t?"default-error-border":"default-border",l),disabled:s,name:v,placeholder:$,readOnly:M,type:q,value:i,onChange:D,...g}),a!==""&&c==="right"?e.jsxRuntimeExports.jsx("div",{className:"absolute right-3 flex items-center",children:e.jsxRuntimeExports.jsx(x.OxIcon,{icon:a,size:.8})}):null]});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[h?e.jsxRuntimeExports.jsx(I,{disabled:s,htmlFor:w,required:E,children:h}):null,F,k&&typeof b=="number"?e.jsxRuntimeExports.jsxs("div",{className:"pointer-events-none mt-1 text-right text-xs text-neutral-400",children:[A,"/",b]}):null,r?e.jsxRuntimeExports.jsx(y,{id:O,disabled:s,children:r}):null,N?e.jsxRuntimeExports.jsx(j,{id:p,children:n}):null,B&&Array.isArray(n)?e.jsxRuntimeExports.jsx("div",{className:"mt-1 space-y-1",children:n.map((u,o)=>e.jsxRuntimeExports.jsx(j,{id:`${p}-${o}`,children:u},o))}):null]})};exports.OxDescription=y;exports.OxErrorMessage=j;exports.OxForm=C;exports.OxInput=G;exports.OxLabel=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}exports.getDefaultExportFromCjs=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.MOBILE_BREAKPOINT=768;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";const U=require("./index-rUH_mzKt.js");function L(e,t){if(!!!e)throw new Error(t)}function ee(e){return typeof e=="object"&&e!==null}function te(e,t){if(!!!e)throw new Error("Unexpected invariant triggered.")}const ne=/\r\n|[\n\r]/g;function F(e,t){let n=0,s=1;for(const i of e.body.matchAll(ne)){if(typeof i.index=="number"||te(!1),i.index>=t)break;n=i.index+i[0].length,s+=1}return{line:s,column:t+1-n}}function ie(e){return G(e.source,F(e.source,e.start))}function G(e,t){const n=e.locationOffset.column-1,s="".padStart(n)+e.body,i=t.line-1,r=e.locationOffset.line-1,a=t.line+r,u=t.line===1?n:0,l=t.column+u,E=`${e.name}:${a}:${l}
|
|
2
|
+
`,p=s.split(/\r\n|[\n\r]/g),N=p[i];if(N.length>120){const m=Math.floor(l/80),b=l%80,f=[];for(let I=0;I<N.length;I+=80)f.push(N.slice(I,I+80));return E+V([[`${a} |`,f[0]],...f.slice(1,m+1).map(I=>["|",I]),["|","^".padStart(b)],["|",f[m+1]]])}return E+V([[`${a-1} |`,p[i-1]],[`${a} |`,N],["|","^".padStart(l)],[`${a+1} |`,p[i+1]]])}function V(e){const t=e.filter(([s,i])=>i!==void 0),n=Math.max(...t.map(([s])=>s.length));return t.map(([s,i])=>s.padStart(n)+(i?" "+i:"")).join(`
|
|
3
|
+
`)}function se(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 M extends Error{constructor(t,...n){var s,i,r;const{nodes:a,source:u,positions:l,path:E,originalError:p,extensions:N}=se(n);super(t),this.name="GraphQLError",this.path=E??void 0,this.originalError=p??void 0,this.nodes=B(Array.isArray(a)?a:a?[a]:void 0);const m=B((s=this.nodes)===null||s===void 0?void 0:s.map(f=>f.loc).filter(f=>f!=null));this.source=u??(m==null||(i=m[0])===null||i===void 0?void 0:i.source),this.positions=l??(m==null?void 0:m.map(f=>f.start)),this.locations=l&&u?l.map(f=>F(u,f)):m==null?void 0:m.map(f=>F(f.source,f.start));const b=ee(p==null?void 0:p.extensions)?p==null?void 0:p.extensions:void 0;this.extensions=(r=N??b)!==null&&r!==void 0?r: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}}),p!=null&&p.stack?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,M):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
|
+
|
|
5
|
+
`+ie(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
|
|
6
|
+
|
|
7
|
+
`+G(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 B(e){return e===void 0||e.length===0?void 0:e}function d(e,t,n){return new M(`Syntax Error: ${n}`,{source:e,positions:[t]})}class re{constructor(t,n,s){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=s}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Y{constructor(t,n,s,i,r,a){this.kind=t,this.start=n,this.end=s,this.line=i,this.column=r,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 oe={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};new Set(Object.keys(oe));var x;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(x||(x={}));var w;(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"})(w||(w={}));var c;(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"})(c||(c={}));function ae(e){return e===9||e===32}function D(e){return e>=48&&e<=57}function $(e){return e>=97&&e<=122||e>=65&&e<=90}function J(e){return $(e)||e===95}function ce(e){return $(e)||D(e)||e===95}function ue(e){var t;let n=Number.MAX_SAFE_INTEGER,s=null,i=-1;for(let a=0;a<e.length;++a){var r;const u=e[a],l=le(u);l!==u.length&&(s=(r=s)!==null&&r!==void 0?r:a,i=a,a!==0&&l<n&&(n=l))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=s)!==null&&t!==void 0?t:0,i+1)}function le(e){let t=0;for(;t<e.length&&ae(e.charCodeAt(t));)++t;return t}var o;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(o||(o={}));class he{constructor(t){const n=new Y(o.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!==o.EOF)do if(t.next)t=t.next;else{const n=de(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}}function pe(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function _(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function C(e,t){return q(e.charCodeAt(t))&&X(e.charCodeAt(t+1))}function q(e){return e>=55296&&e<=56319}function X(e){return e>=56320&&e<=57343}function T(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){const s=String.fromCodePoint(n);return s==='"'?`'"'`:`"${s}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function h(e,t,n,s,i){const r=e.line,a=1+n-e.lineStart;return new Y(t,n,s,r,a,i)}function de(e,t){const n=e.source.body,s=n.length;let i=t;for(;i<s;){const r=n.charCodeAt(i);switch(r){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 fe(e,i);case 33:return h(e,o.BANG,i,i+1);case 36:return h(e,o.DOLLAR,i,i+1);case 38:return h(e,o.AMP,i,i+1);case 40:return h(e,o.PAREN_L,i,i+1);case 41:return h(e,o.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return h(e,o.SPREAD,i,i+3);break;case 58:return h(e,o.COLON,i,i+1);case 61:return h(e,o.EQUALS,i,i+1);case 64:return h(e,o.AT,i,i+1);case 91:return h(e,o.BRACKET_L,i,i+1);case 93:return h(e,o.BRACKET_R,i,i+1);case 123:return h(e,o.BRACE_L,i,i+1);case 124:return h(e,o.PIPE,i,i+1);case 125:return h(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?xe(e,i):me(e,i)}if(D(r)||r===45)return Ee(e,i,r);if(J(r))return Oe(e,i);throw d(e.source,i,r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:_(r)||C(n,i)?`Unexpected character: ${T(e,i)}.`:`Invalid character: ${T(e,i)}.`)}return h(e,o.EOF,s,s)}function fe(e,t){const n=e.source.body,s=n.length;let i=t+1;for(;i<s;){const r=n.charCodeAt(i);if(r===10||r===13)break;if(_(r))++i;else if(C(n,i))i+=2;else break}return h(e,o.COMMENT,t,i,n.slice(t+1,i))}function Ee(e,t,n){const s=e.source.body;let i=t,r=n,a=!1;if(r===45&&(r=s.charCodeAt(++i)),r===48){if(r=s.charCodeAt(++i),D(r))throw d(e.source,i,`Invalid number, unexpected digit after 0: ${T(e,i)}.`)}else i=R(e,i,r),r=s.charCodeAt(i);if(r===46&&(a=!0,r=s.charCodeAt(++i),i=R(e,i,r),r=s.charCodeAt(i)),(r===69||r===101)&&(a=!0,r=s.charCodeAt(++i),(r===43||r===45)&&(r=s.charCodeAt(++i)),i=R(e,i,r),r=s.charCodeAt(i)),r===46||J(r))throw d(e.source,i,`Invalid number, expected digit but got: ${T(e,i)}.`);return h(e,a?o.FLOAT:o.INT,t,i,s.slice(t,i))}function R(e,t,n){if(!D(n))throw d(e.source,t,`Invalid number, expected digit but got: ${T(e,t)}.`);const s=e.source.body;let i=t+1;for(;D(s.charCodeAt(i));)++i;return i}function me(e,t){const n=e.source.body,s=n.length;let i=t+1,r=i,a="";for(;i<s;){const u=n.charCodeAt(i);if(u===34)return a+=n.slice(r,i),h(e,o.STRING,t,i+1,a);if(u===92){a+=n.slice(r,i);const l=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Ne(e,i):Te(e,i):Ie(e,i);a+=l.value,i+=l.size,r=i;continue}if(u===10||u===13)break;if(_(u))++i;else if(C(n,i))i+=2;else throw d(e.source,i,`Invalid character within String: ${T(e,i)}.`)}throw d(e.source,i,"Unterminated string.")}function Ne(e,t){const n=e.source.body;let s=0,i=3;for(;i<12;){const r=n.charCodeAt(t+i++);if(r===125){if(i<5||!_(s))break;return{value:String.fromCodePoint(s),size:i}}if(s=s<<4|y(r),s<0)break}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Te(e,t){const n=e.source.body,s=j(n,t+2);if(_(s))return{value:String.fromCodePoint(s),size:6};if(q(s)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=j(n,t+8);if(X(i))return{value:String.fromCodePoint(s,i),size:12}}throw d(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function j(e,t){return y(e.charCodeAt(t))<<12|y(e.charCodeAt(t+1))<<8|y(e.charCodeAt(t+2))<<4|y(e.charCodeAt(t+3))}function y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ie(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:`
|
|
8
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw d(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function xe(e,t){const n=e.source.body,s=n.length;let i=e.lineStart,r=t+3,a=r,u="";const l=[];for(;r<s;){const E=n.charCodeAt(r);if(E===34&&n.charCodeAt(r+1)===34&&n.charCodeAt(r+2)===34){u+=n.slice(a,r),l.push(u);const p=h(e,o.BLOCK_STRING,t,r+3,ue(l).join(`
|
|
9
|
+
`));return e.line+=l.length-1,e.lineStart=i,p}if(E===92&&n.charCodeAt(r+1)===34&&n.charCodeAt(r+2)===34&&n.charCodeAt(r+3)===34){u+=n.slice(a,r),a=r+1,r+=4;continue}if(E===10||E===13){u+=n.slice(a,r),l.push(u),E===13&&n.charCodeAt(r+1)===10?r+=2:++r,u="",a=r,i=r;continue}if(_(E))++r;else if(C(n,r))r+=2;else throw d(e.source,r,`Invalid character within String: ${T(e,r)}.`)}throw d(e.source,r,"Unterminated string.")}function Oe(e,t){const n=e.source.body,s=n.length;let i=t+1;for(;i<s;){const r=n.charCodeAt(i);if(ce(r))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}const _e=10,Q=2;function z(e){return S(e,[])}function S(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Ae(e,t);default:return String(e)}}function Ae(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(ye(e)){const s=e.toJSON();if(s!==e)return typeof s=="string"?s:S(s,n)}else if(Array.isArray(e))return ge(e,n);return De(e,n)}function ye(e){return typeof e.toJSON=="function"}function De(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Q?"["+ve(e)+"]":"{ "+n.map(([i,r])=>i+": "+S(r,t)).join(", ")+" }"}function ge(e,t){if(e.length===0)return"[]";if(t.length>Q)return"[Array]";const n=Math.min(_e,e.length),s=e.length-n,i=[];for(let r=0;r<n;++r)i.push(S(e[r],t));return s===1?i.push("... 1 more item"):s>1&&i.push(`... ${s} more items`),"["+i.join(", ")+"]"}function ve(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 ke=globalThis.process&&process.env.NODE_ENV==="production",Ce=ke?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var s;const i=n.prototype[Symbol.toStringTag],r=Symbol.toStringTag in t?t[Symbol.toStringTag]:(s=t.constructor)===null||s===void 0?void 0:s.name;if(i===r){const a=z(t);throw new Error(`Cannot use ${i} "${a}" from another module or realm.
|
|
10
|
+
|
|
11
|
+
Ensure that there is only one instance of "graphql" in the node_modules
|
|
12
|
+
directory. If different versions of "graphql" are the dependencies of other
|
|
13
|
+
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
14
|
+
|
|
15
|
+
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
16
|
+
|
|
17
|
+
Duplicate "graphql" modules cannot be used at the same time since different
|
|
18
|
+
versions may have different capabilities and behavior. The data from one
|
|
19
|
+
version used in the function from another could produce confusing and
|
|
20
|
+
spurious results.`)}}return!1};class H{constructor(t,n="GraphQL request",s={line:1,column:1}){typeof t=="string"||L(!1,`Body must be a string. Received: ${z(t)}.`),this.body=t,this.name=n,this.locationOffset=s,this.locationOffset.line>0||L(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||L(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Se(e){return Ce(e,H)}function be(e,t){const n=new Le(e,t),s=n.parseDocument();return Object.defineProperty(s,"tokenCount",{enumerable:!1,value:n.tokenCount}),s}class Le{constructor(t,n={}){const s=Se(t)?t:new H(t);this._lexer=new he(s),this._options=n,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:x.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let s;return this.peek(o.NAME)&&(s=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:s,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(o.NAME);switch(t.value){case"query":return x.QUERY;case"mutation":return x.MUTATION;case"subscription":return x.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let s,i;return this.expectOptionalToken(o.COLON)?(s=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:s,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,s=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:s,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(o.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){const n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){const s=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${s}" 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:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,s=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:s,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(o.BRACKET_L)){const s=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:s})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const s=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:s,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);const s=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:s})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const s=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:s,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const s=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:r,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);const r=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:s,arguments:i,type:r,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseName();this.expectToken(o.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(o.EQUALS)&&(r=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:s,type:i,defaultValue:r,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const s=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:r,fields:a})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const s=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:s,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const s=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:s,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:s,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${g(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 s=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:s,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===o.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(),s=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:s})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),s=this.parseConstDirectives();if(s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:s})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:s,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:s,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:s,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);const s=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:s,arguments:i,repeatable:r,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(w,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new re(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 d(this._lexer.source,n.start,`Expected ${W(t)}, found ${g(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${g(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${g(n)}.`)}any(t,n,s){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(s);)i.push(n.call(this));return i}optionalMany(t,n,s){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}return[]}many(t,n,s){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}delimitedMany(t,n){this.expectOptionalToken(t);const s=[];do s.push(n.call(this));while(this.expectOptionalToken(t));return s}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function g(e){const t=e.value;return W(e.kind)+(t!=null?` "${t}"`:"")}function W(e){return pe(e)?`"${e}"`:e}var v=new Map,P=new Map,Z=!0,k=!1;function K(e){return e.replace(/[\s,]+/g," ").trim()}function Re(e){return K(e.source.body.substring(e.start,e.end))}function Fe(e){var t=new Set,n=[];return e.definitions.forEach(function(s){if(s.kind==="FragmentDefinition"){var i=s.name.value,r=Re(s.loc),a=P.get(i);a&&!a.has(r)?Z&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
21
|
+
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
22
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||P.set(i,a=new Set),a.add(r),t.has(r)||(t.add(r),n.push(s))}else n.push(s)}),U.__assign(U.__assign({},e),{definitions:n})}function we(e){var t=new Set(e.definitions);t.forEach(function(s){s.loc&&delete s.loc,Object.keys(s).forEach(function(i){var r=s[i];r&&typeof r=="object"&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function Pe(e){var t=K(e);if(!v.has(t)){var n=be(e,{experimentalFragmentVariables:k,allowLegacyFragmentVariables:k});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");v.set(t,we(Fe(n)))}return v.get(t)}function O(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var s=e[0];return t.forEach(function(i,r){i&&i.kind==="Document"?s+=i.loc.source.body:s+=i,s+=e[r+1]}),Pe(s)}function Me(){v.clear(),P.clear()}function Ue(){Z=!1}function Ve(){k=!0}function Be(){k=!1}var A={gql:O,resetCaches:Me,disableFragmentWarnings:Ue,enableExperimentalFragmentVariables:Ve,disableExperimentalFragmentVariables:Be};(function(e){e.gql=A.gql,e.resetCaches=A.resetCaches,e.disableFragmentWarnings=A.disableFragmentWarnings,e.enableExperimentalFragmentVariables=A.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=A.disableExperimentalFragmentVariables})(O||(O={}));O.default=O;exports.gql=O;
|