@clicktap/ui 1.2.1 → 2.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/components/Accordion/Accordion.d.ts +76 -2
- package/components/Accordion/Accordion.js +1 -1
- package/components/Accordion/index.d.ts +2 -3
- package/components/Accordion/index.js +1 -1
- package/components/Badge/Badge.js +1 -1
- package/components/Badge/Badge.types.d.ts +27 -2
- package/components/Badge/index.js +1 -1
- package/components/Collapsible/Collapsible.js +1 -1
- package/components/Collection/CollectionFilters/CollectionFilters.js +1 -1
- package/components/Collection/CollectionFilters/index.js +1 -1
- package/components/Collection/index.js +1 -1
- package/components/ContextMenu/ContextMenu.js +1 -1
- package/components/DialogTrigger/DialogTrigger.d.ts +18 -10
- package/components/DialogTrigger/DialogTrigger.js +1 -1
- package/components/DialogTrigger/index.js +1 -1
- package/components/Drawer/Drawer.js +1 -1
- package/components/Menu/Menu.js +1 -1
- package/components/Meter/Meter.js +1 -1
- package/components/NumberTicker/DigitResolver.js +1 -1
- package/components/NumberTicker/NumberTicker.js +1 -1
- package/components/Pagination/Pagination.d.ts +27 -2
- package/components/Pagination/Pagination.js +1 -1
- package/components/Pagination/index.js +1 -1
- package/components/Progressbar/LinearProgressbar.js +1 -1
- package/components/Tabs/Tab.js +1 -1
- package/components/Tooltip/Tooltip.d.ts +9 -1
- package/components/Tooltip/Tooltip.js +1 -1
- package/components/Tooltip/Tooltip.types.d.ts +21 -2
- package/components/Tooltip/index.js +1 -1
- package/components/UploadImage/UploadImage.js +1 -1
- package/docs/migrations/2026/08/ui-2026-08-21-graphql-client-string-documents.md +45 -0
- package/docs/migrations/2026/08/ui-2026-08-21-graphql-peer-covered.md +26 -0
- package/docs/migrations/2026/08/ui-2026-08-21-heroui-removed.md +54 -0
- package/docs/migrations/2026/08/ui-2026-08-21-lazymotion-m-components.md +54 -0
- package/docs/migrations/2026/08/ui-2026-08-21-modal-triggers-wired-explicitly.md +43 -0
- package/docs/migrations/2026/08/ui-2026-08-21-next-image-fallback-keeps-fill.md +38 -0
- package/docs/migrations/2026/08/ui-2026-08-22-accordion-divider-between-items.md +30 -0
- package/docs/migrations/2026/08/ui-2026-08-22-accordion-divider-class-ownership.md +14 -0
- package/docs/migrations/2026/08/ui-2026-08-22-react-aria-moves-as-one-version-set.md +46 -0
- package/docs/migrations/index.json +91 -0
- package/next/Image.js +1 -1
- package/package.json +10 -38
- package/utils/createAuthAwareGraphqlClient.d.ts +104 -16
- package/utils/createAuthAwareGraphqlClient.js +1 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clicktap/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Clicktap",
|
|
6
6
|
"description": "A library of React UI components and low-level hooks.",
|
|
@@ -104,10 +104,6 @@
|
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@floating-ui/react": "0.27.20",
|
|
106
106
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
107
|
-
"@heroui/accordion": "^2.2.0",
|
|
108
|
-
"@heroui/badge": "^2.2.0",
|
|
109
|
-
"@heroui/pagination": "^2.2.0",
|
|
110
|
-
"@heroui/tooltip": "^2.2.0",
|
|
111
107
|
"@nx/react": "20.5.0",
|
|
112
108
|
"@nx/vite": "20.5.0",
|
|
113
109
|
"@storybook/addon-actions": "^8.0.6",
|
|
@@ -117,15 +113,15 @@
|
|
|
117
113
|
"@vitejs/plugin-react": "4.5.2",
|
|
118
114
|
"framer-motion": "^11.18.0",
|
|
119
115
|
"glob": "^11.0.0",
|
|
120
|
-
"graphql
|
|
116
|
+
"graphql": "16.12.0",
|
|
121
117
|
"next": "14.2.35",
|
|
122
118
|
"react": "18.3.1",
|
|
123
|
-
"react-aria": "3.
|
|
124
|
-
"react-aria-components": "1.
|
|
119
|
+
"react-aria": "3.48.0",
|
|
120
|
+
"react-aria-components": "1.17.0",
|
|
125
121
|
"react-dom": "18.3.1",
|
|
126
122
|
"react-hook-form": "^7.71.1",
|
|
127
123
|
"react-international-phone": "^4.7.0",
|
|
128
|
-
"react-stately": "3.
|
|
124
|
+
"react-stately": "3.46.0",
|
|
129
125
|
"rollup-preserve-directives": "^1.1.3",
|
|
130
126
|
"tailwindcss": "^4.3.3",
|
|
131
127
|
"vite": "^7.3.1",
|
|
@@ -136,23 +132,17 @@
|
|
|
136
132
|
"peerDependencies": {
|
|
137
133
|
"@floating-ui/react": "^0.27.0",
|
|
138
134
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
139
|
-
"@heroui/accordion": "^2.2.0",
|
|
140
|
-
"@heroui/badge": "^2.2.0",
|
|
141
|
-
"@heroui/pagination": "^2.2.0",
|
|
142
|
-
"@heroui/system": "^2.4.18",
|
|
143
|
-
"@heroui/theme": "^2.4.24",
|
|
144
|
-
"@heroui/tooltip": "^2.2.0",
|
|
145
135
|
"@types/react": "^18.0.0",
|
|
146
136
|
"framer-motion": "^11.18.0",
|
|
147
|
-
"graphql
|
|
137
|
+
"graphql": "^16.6.0",
|
|
148
138
|
"next": "^14.0.0",
|
|
149
139
|
"react": "^18.0.0",
|
|
150
|
-
"react-aria": "^3.
|
|
151
|
-
"react-aria-components": "^1.
|
|
140
|
+
"react-aria": "^3.48.0",
|
|
141
|
+
"react-aria-components": "^1.17.0",
|
|
152
142
|
"react-dom": "^18.0.0",
|
|
153
143
|
"react-hook-form": "^7.71.1",
|
|
154
144
|
"react-international-phone": "^4.3.0",
|
|
155
|
-
"react-stately": "^3.
|
|
145
|
+
"react-stately": "^3.46.0"
|
|
156
146
|
},
|
|
157
147
|
"peerDependenciesMeta": {
|
|
158
148
|
"@floating-ui/react": {
|
|
@@ -161,28 +151,10 @@
|
|
|
161
151
|
"@graphql-typed-document-node/core": {
|
|
162
152
|
"optional": true
|
|
163
153
|
},
|
|
164
|
-
"@heroui/accordion": {
|
|
165
|
-
"optional": true
|
|
166
|
-
},
|
|
167
|
-
"@heroui/badge": {
|
|
168
|
-
"optional": true
|
|
169
|
-
},
|
|
170
|
-
"@heroui/pagination": {
|
|
171
|
-
"optional": true
|
|
172
|
-
},
|
|
173
|
-
"@heroui/system": {
|
|
174
|
-
"optional": true
|
|
175
|
-
},
|
|
176
|
-
"@heroui/theme": {
|
|
177
|
-
"optional": true
|
|
178
|
-
},
|
|
179
|
-
"@heroui/tooltip": {
|
|
180
|
-
"optional": true
|
|
181
|
-
},
|
|
182
154
|
"framer-motion": {
|
|
183
155
|
"optional": true
|
|
184
156
|
},
|
|
185
|
-
"graphql
|
|
157
|
+
"graphql": {
|
|
186
158
|
"optional": true
|
|
187
159
|
},
|
|
188
160
|
"next": {
|
|
@@ -1,11 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Auth-aware GraphQL client over plain `fetch` and string documents.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes four behaviors that consumer apps would otherwise re-implement
|
|
5
|
+
* in every actor / mutation handler:
|
|
6
|
+
*
|
|
7
|
+
* 1. **401 → dispatch expired-session event.** Lets the app's auth machine
|
|
8
|
+
* log the user out, toast "session expired", and redirect to login.
|
|
9
|
+
* 2. **403 → dispatch permission-denied event.**
|
|
10
|
+
* 3. **5xx → dispatch server-error event.**
|
|
11
|
+
* 4. **Partial responses (HTTP 200 with both `data` and `errors`).** The
|
|
12
|
+
* `graphqlRequest()` form returns the partial `data` rather than
|
|
13
|
+
* throwing — single field errors don't tear down the whole UI.
|
|
14
|
+
*
|
|
15
|
+
* CTAP-1383: this used to wrap `graphql-request`, whose static imports put
|
|
16
|
+
* the whole `graphql` package (parser, printer, AST) plus `cross-fetch` in
|
|
17
|
+
* every page's initial JS. Documents are codegen'd as `TypedDocumentString`
|
|
18
|
+
* now (`documentMode: 'string'`), so executing a request is one JSON POST —
|
|
19
|
+
* no GraphQL runtime needed. `ClientError` is our own class with the same
|
|
20
|
+
* shape `graphql-request` threw (`response.data/errors/status`,
|
|
21
|
+
* `request.query/variables`), so downstream handling — including the
|
|
22
|
+
* identity-agnostic `getRequestErrorStatus` from `@clicktap/ui/utils/error`
|
|
23
|
+
* — is unchanged. Owning the class also ends the dual-package hazard the
|
|
24
|
+
* old re-export existed to paper over.
|
|
25
|
+
*
|
|
26
|
+
* Decoupled from app runtime context (xstate actors, routers, toast systems)
|
|
27
|
+
* via an event bus. The wrappers dispatch typed events on the bus; the app
|
|
28
|
+
* subscribes from a Provider component where actors and router are in scope.
|
|
29
|
+
*
|
|
30
|
+
* Two entry points:
|
|
31
|
+
*
|
|
32
|
+
* - `createAuthAwareGraphqlClient()` — returns a `request(url, doc, …)`
|
|
33
|
+
* callable. Drop-in for SSR or simple call sites that just need
|
|
34
|
+
* "fetch with the right headers and bail on errors".
|
|
35
|
+
*
|
|
36
|
+
* - `createAuthAwareFetch()` — returns a `fetch` function that dispatches
|
|
37
|
+
* events on 401/403/5xx. For callers that manage their own request
|
|
38
|
+
* shape (form-data uploads, per-call cors/credentials config). The
|
|
39
|
+
* wrapper sees the raw HTTP response, so it catches all status codes
|
|
40
|
+
* regardless of how the request was built.
|
|
41
|
+
*
|
|
42
|
+
* Subscribe to events via the shared bus:
|
|
43
|
+
*
|
|
44
|
+
* import { authAwareEvents } from '@clicktap/ui/utils/createAuthAwareGraphqlClient';
|
|
45
|
+
* const unsub = authAwareEvents.subscribe('unauthenticated', ({ status }) => { … });
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* A GraphQL document as executable text. Structurally matches codegen's
|
|
49
|
+
* `TypedDocumentString` (`documentMode: 'string'`): a `String` subclass
|
|
50
|
+
* carrying the result/variables types, so response typing flows through
|
|
51
|
+
* call sites exactly as it did with `TypedDocumentNode`. Plain strings are
|
|
52
|
+
* accepted for untyped/ad-hoc calls.
|
|
53
|
+
*
|
|
54
|
+
* Method syntax on the marker on purpose: method members compare
|
|
55
|
+
* bivariantly under `strictFunctionTypes`, so a document typed with
|
|
56
|
+
* specific variables (`TypedDocumentString<Q, Exact<{…}>>`) stays
|
|
57
|
+
* assignable at call sites that name only the result generic and let
|
|
58
|
+
* `TVariables` default.
|
|
59
|
+
*/
|
|
60
|
+
interface DocumentTypeMarker<TData, TVariables> {
|
|
61
|
+
__apiType?(variables: TVariables): TData;
|
|
62
|
+
}
|
|
63
|
+
export type GraphqlDocument<TData, TVariables> = (DocumentTypeMarker<TData, TVariables> & {
|
|
64
|
+
toString(): string;
|
|
65
|
+
}) | string;
|
|
66
|
+
export type GraphqlVariables = Record<string, unknown>;
|
|
67
|
+
export interface GraphqlErrorItem {
|
|
68
|
+
message: string;
|
|
69
|
+
path?: Array<string | number>;
|
|
70
|
+
locations?: Array<{
|
|
71
|
+
line: number;
|
|
72
|
+
column: number;
|
|
73
|
+
}>;
|
|
74
|
+
extensions?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Error thrown for HTTP failures and error-only GraphQL responses. Same
|
|
78
|
+
* shape as `graphql-request`'s `ClientError` (which this replaces): the
|
|
79
|
+
* status lives at `response.status`, so structural consumers like
|
|
80
|
+
* `getRequestErrorStatus` keep working unchanged.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ClientError extends Error {
|
|
83
|
+
readonly response: {
|
|
84
|
+
status: number;
|
|
85
|
+
data?: any;
|
|
86
|
+
errors?: GraphqlErrorItem[];
|
|
87
|
+
};
|
|
88
|
+
readonly request: {
|
|
89
|
+
query: string;
|
|
90
|
+
variables?: GraphqlVariables;
|
|
91
|
+
};
|
|
92
|
+
constructor(response: ClientError['response'], request: ClientError['request']);
|
|
93
|
+
}
|
|
5
94
|
export type AuthAwareEventName = 'unauthenticated' | 'permissionDenied' | 'serverError';
|
|
6
95
|
export interface AuthAwareEventDetail {
|
|
7
96
|
status: number;
|
|
8
|
-
/** Present when the trigger came from a
|
|
97
|
+
/** Present when the trigger came from a GraphQL request error. */
|
|
9
98
|
error?: ClientError;
|
|
10
99
|
/** Present when the trigger came from the fetch wrapper. */
|
|
11
100
|
response?: Response;
|
|
@@ -22,12 +111,12 @@ declare class AuthAwareEventBus {
|
|
|
22
111
|
* listen, regardless of which call triggered the event).
|
|
23
112
|
*/
|
|
24
113
|
export declare const authAwareEvents: AuthAwareEventBus;
|
|
25
|
-
export type AuthAwareGraphqlRequest = <TData, TVariables extends
|
|
26
|
-
export type AuthAwareGraphqlRequestWithOptions = <TData, TVariables extends
|
|
114
|
+
export type AuthAwareGraphqlRequest = <TData, TVariables extends GraphqlVariables = GraphqlVariables>(url: string, document: GraphqlDocument<TData, TVariables>, variables?: TVariables, requestHeaders?: HeadersInit) => Promise<TData>;
|
|
115
|
+
export type AuthAwareGraphqlRequestWithOptions = <TData, TVariables extends GraphqlVariables = GraphqlVariables>(options: {
|
|
27
116
|
url: string;
|
|
28
|
-
document:
|
|
117
|
+
document: GraphqlDocument<TData, TVariables>;
|
|
29
118
|
variables?: TVariables;
|
|
30
|
-
requestHeaders?:
|
|
119
|
+
requestHeaders?: HeadersInit;
|
|
31
120
|
signal?: AbortSignal;
|
|
32
121
|
}) => Promise<TData>;
|
|
33
122
|
export type AuthAwareGraphqlClient = AuthAwareGraphqlRequest & {
|
|
@@ -36,14 +125,13 @@ export type AuthAwareGraphqlClient = AuthAwareGraphqlRequest & {
|
|
|
36
125
|
export declare function createAuthAwareGraphqlClient(): AuthAwareGraphqlClient;
|
|
37
126
|
/**
|
|
38
127
|
* Returns a `fetch` function that delegates to the global `fetch` and
|
|
39
|
-
* dispatches `authAwareEvents` on 401/403/5xx responses.
|
|
40
|
-
*
|
|
41
|
-
* actor that needs custom client config.
|
|
128
|
+
* dispatches `authAwareEvents` on 401/403/5xx responses. For callers that
|
|
129
|
+
* build their own request (form-data uploads, per-call cors/credentials).
|
|
42
130
|
*
|
|
43
131
|
* The wrapped fetch returns the original Response untouched on success
|
|
44
|
-
* AND on error —
|
|
45
|
-
*
|
|
46
|
-
* to
|
|
47
|
-
* toast actors.
|
|
132
|
+
* AND on error — the caller still parses, throws, etc. exactly as it
|
|
133
|
+
* would have. The event dispatch is a side channel for the app to react
|
|
134
|
+
* to the auth state without coupling caller code to router / toast actors.
|
|
48
135
|
*/
|
|
49
136
|
export declare function createAuthAwareFetch(): typeof fetch;
|
|
137
|
+
export {};
|
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`,y=r.split(/\r\n|[\n\r]/g),v=y[i];if(v.length>120){const m=Math.floor(h/80),O=h%80,x=[];for(let T=0;T<v.length;T+=80)x.push(v.slice(T,T+80));return d+Ne([[`${c} |`,x[0]],...x.slice(1,m+1).map(T=>["|",T]),["|","^".padStart(O)],["|",x[m+1]]])}return d+Ne([[`${c-1} |`,y[i-1]],[`${c} |`,v],["|","^".padStart(h)],[`${c+1} |`,y[i+1]]])}function Ne(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 Ke(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 Ee extends Error{constructor(t,...n){var r,i,s;const{nodes:c,source:u,positions:h,path:d,originalError:y,extensions:v}=Ke(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=y??void 0,this.nodes=ve(Array.isArray(c)?c:c?[c]:void 0);const m=ve((r=this.nodes)===null||r===void 0?void 0:r.map(x=>x.loc).filter(x=>x!=null));this.source=u??(m==null||(i=m[0])===null||i===void 0?void 0:i.source),this.positions=h??m?.map(x=>x.start),this.locations=h&&u?h.map(x=>he(u,x)):m?.map(x=>he(x.source,x.start));const O=Qe(y?.extensions)?y?.extensions:void 0;this.extensions=(s=v??O)!==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}}),y!=null&&y.stack?Object.defineProperty(this,"stack",{value:y.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Ee):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
|
-
`+Ze(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
|
|
6
|
-
|
|
7
|
-
`+Ce(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 ve(e){return e===void 0||e.length===0?void 0:e}function b(e,t,n){return new Ee(`Syntax Error: ${n}`,{source:e,positions:[t]})}class et{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class we{constructor(t,n,r,i,s,c){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=c,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 Se={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","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],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"]},tt=new Set(Object.keys(Se));function Ae(e){const t=e?.kind;return typeof t=="string"&&tt.has(t)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(q||(q={}));var fe;(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",e.DIRECTIVE_DEFINITION="DIRECTIVE_DEFINITION"})(fe||(fe={}));var p;(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.DIRECTIVE_EXTENSION="DirectiveExtension",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"})(p||(p={}));function pe(e){return e===9||e===32}function H(e){return e>=48&&e<=57}function Re(e){return e>=97&&e<=122||e>=65&&e<=90}function ke(e){return Re(e)||e===95}function nt(e){return Re(e)||H(e)||e===95}function it(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let c=0;c<e.length;++c){var s;const u=e[c],h=rt(u);h!==u.length&&(r=(s=r)!==null&&s!==void 0?s:c,i=c,c!==0&&h<n&&(n=h))}return e.map((c,u)=>u===0?c:c.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function rt(e){let t=0;for(;t<e.length&&pe(e.charCodeAt(t));)++t;return t}function st(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(O=>O.length===0||pe(O.charCodeAt(0))),c=n.endsWith('\\"""'),u=e.endsWith('"')&&!c,h=e.endsWith("\\"),d=u||h,y=!i||e.length>70||d||s||c;let v="";const m=i&&pe(e.charCodeAt(0));return(y&&!m||s)&&(v+=`
|
|
8
|
-
`),v+=n,(y||d)&&(v+=`
|
|
9
|
-
`),'"""'+v+'"""'}var a;(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"})(a||(a={}));class ot{constructor(t){const n=new we(a.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!==a.EOF)do if(t.next)t=t.next;else{const n=ct(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===a.COMMENT);return t}}function at(e){return e===a.BANG||e===a.DOLLAR||e===a.AMP||e===a.PAREN_L||e===a.PAREN_R||e===a.DOT||e===a.SPREAD||e===a.COLON||e===a.EQUALS||e===a.AT||e===a.BRACKET_L||e===a.BRACKET_R||e===a.BRACE_L||e===a.PIPE||e===a.BRACE_R}function j(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function te(e,t){return Le(e.charCodeAt(t))&&Fe(e.charCodeAt(t+1))}function Le(e){return e>=55296&&e<=56319}function Fe(e){return e>=56320&&e<=57343}function M(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return a.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function g(e,t,n,r,i){const s=e.line,c=1+n-e.lineStart;return new we(t,n,r,s,c,i)}function ct(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 ut(e,i);case 33:return g(e,a.BANG,i,i+1);case 36:return g(e,a.DOLLAR,i,i+1);case 38:return g(e,a.AMP,i,i+1);case 40:return g(e,a.PAREN_L,i,i+1);case 41:return g(e,a.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return g(e,a.SPREAD,i,i+3);break;case 58:return g(e,a.COLON,i,i+1);case 61:return g(e,a.EQUALS,i,i+1);case 64:return g(e,a.AT,i,i+1);case 91:return g(e,a.BRACKET_L,i,i+1);case 93:return g(e,a.BRACKET_R,i,i+1);case 123:return g(e,a.BRACE_L,i,i+1);case 124:return g(e,a.PIPE,i,i+1);case 125:return g(e,a.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?yt(e,i):ht(e,i)}if(H(s)||s===45)return lt(e,i,s);if(ke(s))return Et(e,i);throw b(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:j(s)||te(n,i)?`Unexpected character: ${M(e,i)}.`:`Invalid character: ${M(e,i)}.`)}return g(e,a.EOF,r,r)}function ut(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(j(s))++i;else if(te(n,i))i+=2;else break}return g(e,a.COMMENT,t,i,n.slice(t+1,i))}function lt(e,t,n){const r=e.source.body;let i=t,s=n,c=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),H(s))throw b(e.source,i,`Invalid number, unexpected digit after 0: ${M(e,i)}.`)}else i=se(e,i,s),s=r.charCodeAt(i);if(s===46&&(c=!0,s=r.charCodeAt(++i),i=se(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(c=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=se(e,i,s),s=r.charCodeAt(i)),s===46||ke(s))throw b(e.source,i,`Invalid number, expected digit but got: ${M(e,i)}.`);return g(e,c?a.FLOAT:a.INT,t,i,r.slice(t,i))}function se(e,t,n){if(!H(n))throw b(e.source,t,`Invalid number, expected digit but got: ${M(e,t)}.`);const r=e.source.body;let i=t+1;for(;H(r.charCodeAt(i));)++i;return i}function ht(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,c="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return c+=n.slice(s,i),g(e,a.STRING,t,i+1,c);if(u===92){c+=n.slice(s,i);const h=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ft(e,i):pt(e,i):dt(e,i);c+=h.value,i+=h.size,s=i;continue}if(u===10||u===13)break;if(j(u))++i;else if(te(n,i))i+=2;else throw b(e.source,i,`Invalid character within String: ${M(e,i)}.`)}throw b(e.source,i,"Unterminated string.")}function ft(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||!j(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|G(s),r<0)break}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function pt(e,t){const n=e.source.body,r=xe(n,t+2);if(j(r))return{value:String.fromCodePoint(r),size:6};if(Le(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=xe(n,t+8);if(Fe(i))return{value:String.fromCodePoint(r,i),size:12}}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function xe(e,t){return G(e.charCodeAt(t))<<12|G(e.charCodeAt(t+1))<<8|G(e.charCodeAt(t+2))<<4|G(e.charCodeAt(t+3))}function G(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function dt(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
|
-
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw b(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function yt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,c=s,u="";const h=[];for(;s<r;){const d=n.charCodeAt(s);if(d===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(c,s),h.push(u);const y=g(e,a.BLOCK_STRING,t,s+3,it(h).join(`
|
|
11
|
-
`));return e.line+=h.length-1,e.lineStart=i,y}if(d===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(c,s),c=s+1,s+=4;continue}if(d===10||d===13){u+=n.slice(c,s),h.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",c=s,i=s;continue}if(j(d))++s;else if(te(n,s))s+=2;else throw b(e.source,s,`Invalid character within String: ${M(e,s)}.`)}throw b(e.source,s,"Unterminated string.")}function Et(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(nt(s))++i;else break}return g(e,a.NAME,t,i,n.slice(t,i))}const mt=10,Pe=2;function me(e){return ne(e,[])}function ne(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Tt(e,t);default:return String(e)}}function Tt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Nt(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:ne(r,n)}else if(Array.isArray(e))return At(e,n);return vt(e,n)}function Nt(e){return typeof e.toJSON=="function"}function vt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Pe?"["+xt(e)+"]":"{ "+n.map(([i,s])=>i+": "+ne(s,t)).join(", ")+" }"}function At(e,t){if(e.length===0)return"[]";if(t.length>Pe)return"[Array]";const n=Math.min(mt,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(ne(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function xt(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 It=globalThis.process&&process.env.NODE_ENV==="production",Ot=It?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 c=me(t);throw new Error(`Cannot use ${i} "${c}" from another module or realm.
|
|
12
|
-
|
|
13
|
-
Ensure that there is only one instance of "graphql" in the node_modules
|
|
14
|
-
directory. If different versions of "graphql" are the dependencies of other
|
|
15
|
-
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
16
|
-
|
|
17
|
-
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
18
|
-
|
|
19
|
-
Duplicate "graphql" modules cannot be used at the same time since different
|
|
20
|
-
versions may have different capabilities and behavior. The data from one
|
|
21
|
-
version used in the function from another could produce confusing and
|
|
22
|
-
spurious results.`)}}return!1};class Be{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function _t(e){return Ot(e,Be)}function gt(e,t){const n=new bt(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}class bt{constructor(t,n={}){const{lexer:r,...i}=n;if(r)this._lexer=r;else{const s=_t(t)?t:new Be(t);this._lexer=new ot(s)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(a.NAME);return this.node(t,{kind:p.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:p.DOCUMENT,definitions:this.many(a.SOF,this.parseDefinition,a.EOF)})}parseDefinition(){if(this.peek(a.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===a.BRACE_L)throw b(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===a.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 b(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(a.BRACE_L))return this.node(t,{kind:p.OPERATION_DEFINITION,operation:q.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseDescription(),r=this.parseOperationType();let i;return this.peek(a.NAME)&&(i=this.parseName()),this.node(t,{kind:p.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(a.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(a.PAREN_L,this.parseVariableDefinition,a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:p.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(a.DOLLAR),this.node(t,{kind:p.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:p.SELECTION_SET,selections:this.many(a.BRACE_L,this.parseSelection,a.BRACE_R)})}parseSelection(){return this.peek(a.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(a.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:p.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(a.PAREN_L,n,a.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:p.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(a.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(a.NAME)?this.node(t,{kind:p.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:p.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:p.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:p.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 a.BRACKET_L:return this.parseList(t);case a.BRACE_L:return this.parseObject(t);case a.INT:return this.advanceLexer(),this.node(n,{kind:p.INT,value:n.value});case a.FLOAT:return this.advanceLexer(),this.node(n,{kind:p.FLOAT,value:n.value});case a.STRING:case a.BLOCK_STRING:return this.parseStringLiteral();case a.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:p.BOOLEAN,value:!0});case"false":return this.node(n,{kind:p.BOOLEAN,value:!1});case"null":return this.node(n,{kind:p.NULL});default:return this.node(n,{kind:p.ENUM,value:n.value})}case a.DOLLAR:if(t)if(this.expectToken(a.DOLLAR),this._lexer.token.kind===a.NAME){const r=this._lexer.token.value;throw b(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:p.STRING,value:t.value,block:t.kind===a.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:p.LIST,values:this.any(a.BRACKET_L,n,a.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:p.OBJECT,fields:this.any(a.BRACE_L,n,a.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(a.COLON),this.node(n,{kind:p.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(a.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(a.AT),this.node(n,{kind:p.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(a.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(a.BRACKET_R),n=this.node(t,{kind:p.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(a.BANG)?this.node(t,{kind:p.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:p.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(a.STRING)||this.peek(a.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(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);return this.node(t,{kind:p.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(a.COLON);const r=this.parseNamedType();return this.node(t,{kind:p.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:p.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(),c=this.parseFieldsDefinition();return this.node(t,{kind:p.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseFieldDefinition,a.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(a.COLON);const s=this.parseTypeReference(),c=this.parseConstDirectives();return this.node(t,{kind:p.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:c})}parseArgumentDefs(){return this.optionalMany(a.PAREN_L,this.parseInputValueDef,a.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(a.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(a.EQUALS)&&(s=this.parseConstValueLiteral());const c=this.parseConstDirectives();return this.node(t,{kind:p.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:c})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),c=this.parseFieldsDefinition();return this.node(t,{kind:p.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:c})}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:p.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(a.EQUALS)?this.delimitedMany(a.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:p.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(a.BRACE_L,this.parseEnumValueDefinition,a.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:p.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw b(this._lexer.source,this._lexer.token.start,`${Q(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:p.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(a.BRACE_L,this.parseInputValueDef,a.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===a.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();case"directive":if(this._options.experimentalDirectivesOnDirectiveDefinitions)return this.parseDirectiveDefinitionExtension();break}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(a.BRACE_L,this.parseOperationTypeDefinition,a.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:p.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:p.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:p.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:p.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:p.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:p.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:p.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinitionExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(a.AT);const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:p.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(a.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this._options.experimentalDirectivesOnDirectiveDefinitions?this.parseConstDirectives():[],c=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(t,{kind:p.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:c,locations:u})}parseDirectiveLocations(){return this.delimitedMany(a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(fe,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){const t=this._lexer.token,n=this.expectOptionalToken(a.AT),r=this.parseName();let i;!n&&this.expectOptionalToken(a.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(a.PAREN_L)&&(s=this.parseName(),this.expectToken(a.COLON),this.expectToken(a.PAREN_R)),n?s?this.node(t,{kind:p.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:p.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:p.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:p.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:p.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new et(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw b(this._lexer.source,n.start,`Expected ${Me(t)}, found ${Q(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===a.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${Q(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===a.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${Q(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!==a.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function Q(e){const t=e.value;return Me(e.kind)+(t!=null?` "${t}"`:"")}function Me(e){return at(e)?`"${e}"`:e}function Dt(e){return`"${e.replace(Ct,wt)}"`}const Ct=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function wt(e){return St[e.charCodeAt(0)]}const St=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Rt=Object.freeze({});function kt(e,t,n=Se){const r=new Map;for(const w of Object.values(p))r.set(w,Lt(t,w));let i,s=Array.isArray(e),c=[e],u=-1,h=[],d=e,y,v;const m=[],O=[];do{u++;const w=u===c.length,Y=w&&h.length!==0;if(w){if(y=O.length===0?void 0:m[m.length-1],d=v,v=O.pop(),Y)if(s){d=d.slice();let L=0;for(const[U,$]of h){const z=U-L;$===null?(d.splice(z,1),L++):d[z]=$}}else{d={...d};for(const[L,U]of h)d[L]=U}u=i.index,c=i.keys,h=i.edits,s=i.inArray,i=i.prev}else if(v){if(y=s?u:c[u],d=v[y],d==null)continue;m.push(y)}let k;if(!Array.isArray(d)){var x,T;Ae(d)||Z(!1,`Invalid AST Node: ${me(d)}.`);const L=w?(x=r.get(d.kind))===null||x===void 0?void 0:x.leave:(T=r.get(d.kind))===null||T===void 0?void 0:T.enter;if(k=L?.call(t,d,y,v,m,O),k===Rt)break;if(k===!1){if(!w){m.pop();continue}}else if(k!==void 0&&(h.push([y,k]),!w))if(Ae(k))d=k;else{m.pop();continue}}if(k===void 0&&Y&&h.push([y,d]),w)m.pop();else{var C;i={inArray:s,index:u,keys:c,edits:h,prev:i},s=Array.isArray(d),c=s?d:(C=n[d.kind])!==null&&C!==void 0?C:[],u=-1,h=[],v&&O.push(v),v=d}}while(i!==void 0);return h.length!==0?h[h.length-1][1]:e}function Lt(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 kt(e,Bt)}const Pt=80,Bt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>f(e.definitions,`
|
|
23
|
-
|
|
24
|
-
`)},OperationDefinition:{leave(e){const t=oe(e.variableDefinitions)?E(`(
|
|
25
|
-
`,f(e.variableDefinitions,`
|
|
26
|
-
`),`
|
|
27
|
-
)`):E("(",f(e.variableDefinitions,", "),")"),n=E("",e.description,`
|
|
28
|
-
`)+f([e.operation,f([e.name,t]),f(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>E("",i,`
|
|
29
|
-
`)+e+": "+t+E(" = ",n)+E(" ",f(r," "))},SelectionSet:{leave:({selections:e})=>R(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=E("",e,": ")+t;let c=s+E("(",f(n,", "),")");return c.length>Pt&&(c=s+E(`(
|
|
30
|
-
`,K(f(n,`
|
|
31
|
-
`)),`
|
|
32
|
-
)`)),f([c,f(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+E(" ",f(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>f(["...",E("on ",e),f(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:s})=>E("",s,`
|
|
33
|
-
`)+`fragment ${e}${E("(",f(n,", "),")")} on ${t} ${E("",f(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?st(e):Dt(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+f(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+f(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+E("(",f(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>E("",e,`
|
|
34
|
-
`)+f(["schema",f(t," "),R(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>E("",e,`
|
|
35
|
-
`)+f(["scalar",t,f(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>E("",e,`
|
|
36
|
-
`)+f(["type",t,E("implements ",f(n," & ")),f(r," "),R(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>E("",e,`
|
|
37
|
-
`)+t+(oe(n)?E(`(
|
|
38
|
-
`,K(f(n,`
|
|
39
|
-
`)),`
|
|
40
|
-
)`):E("(",f(n,", "),")"))+": "+r+E(" ",f(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>E("",e,`
|
|
41
|
-
`)+f([t+": "+n,E("= ",r),f(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>E("",e,`
|
|
42
|
-
`)+f(["interface",t,E("implements ",f(n," & ")),f(r," "),R(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>E("",e,`
|
|
43
|
-
`)+f(["union",t,f(n," "),E("= ",f(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>E("",e,`
|
|
44
|
-
`)+f(["enum",t,f(n," "),R(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>E("",e,`
|
|
45
|
-
`)+f([t,f(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>E("",e,`
|
|
46
|
-
`)+f(["input",t,f(n," "),R(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,directives:r,repeatable:i,locations:s})=>E("",e,`
|
|
47
|
-
`)+"directive @"+t+(oe(n)?E(`(
|
|
48
|
-
`,K(f(n,`
|
|
49
|
-
`)),`
|
|
50
|
-
)`):E("(",f(n,", "),")"))+E(" ",f(r," "))+(i?" repeatable":"")+" on "+f(s," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>f(["extend schema",f(e," "),R(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>f(["extend scalar",e,f(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>f(["extend type",e,E("implements ",f(t," & ")),f(n," "),R(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>f(["extend interface",e,E("implements ",f(t," & ")),f(n," "),R(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>f(["extend union",e,f(t," "),E("= ",f(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>f(["extend enum",e,f(t," "),R(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>f(["extend input",e,f(t," "),R(n)]," ")},DirectiveExtension:{leave:({name:e,directives:t})=>f(["extend directive @"+e,f(t," ")]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>f([e,E(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>f([e,E(".",t),E("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>f(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>f(["@",e,E("(",t,":)")])}};function f(e,t=""){var n;return(n=e?.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function R(e){return E(`{
|
|
51
|
-
`,K(f(e,`
|
|
52
|
-
`)),`
|
|
53
|
-
}`)}function E(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function K(e){return E(" ",e.replace(/\n/g,`
|
|
54
|
-
`))}function oe(e){var t;return(t=e?.some(n=>n.includes(`
|
|
55
|
-
`)))!==null&&t!==void 0?t:!1}const Ie=e=>{let t;const n=e.definitions.filter(r=>r.kind==="OperationDefinition");return n.length===1&&(t=n[0]?.name?.value),t},ae=e=>{if(typeof e=="string"){let n;try{const r=gt(e);n=Ie(r)}catch{}return{query:e,operationName:n}}const t=Ie(e);return{query:Ft(e),operationName:t}};class B extends Error{constructor(t,n){const r=`${B.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,B.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,B)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${t.status})`}}var X=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}},Oe;function Ut(){return Oe||(Oe=1,(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof X<"u"&&X,r=(function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s})();(function(s){(function(c){var u=typeof s<"u"&&s||typeof self<"u"&&self||typeof X<"u"&&X||{},h={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function d(o){return o&&DataView.prototype.isPrototypeOf(o)}if(h.arrayBuffer)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=ArrayBuffer.isView||function(o){return o&&y.indexOf(Object.prototype.toString.call(o))>-1};function m(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 O(o){return typeof o!="string"&&(o=String(o)),o}function x(o){var l={next:function(){var N=o.shift();return{done:N===void 0,value:N}}};return h.iterable&&(l[Symbol.iterator]=function(){return l}),l}function T(o){this.map={},o instanceof T?o.forEach(function(l,N){this.append(N,l)},this):Array.isArray(o)?o.forEach(function(l){if(l.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+l.length);this.append(l[0],l[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(l){this.append(l,o[l])},this)}T.prototype.append=function(o,l){o=m(o),l=O(l);var N=this.map[o];this.map[o]=N?N+", "+l:l},T.prototype.delete=function(o){delete this.map[m(o)]},T.prototype.get=function(o){return o=m(o),this.has(o)?this.map[o]:null},T.prototype.has=function(o){return this.map.hasOwnProperty(m(o))},T.prototype.set=function(o,l){this.map[m(o)]=O(l)},T.prototype.forEach=function(o,l){for(var N in this.map)this.map.hasOwnProperty(N)&&o.call(l,this.map[N],N,this)},T.prototype.keys=function(){var o=[];return this.forEach(function(l,N){o.push(N)}),x(o)},T.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),x(o)},T.prototype.entries=function(){var o=[];return this.forEach(function(l,N){o.push([N,l])}),x(o)},h.iterable&&(T.prototype[Symbol.iterator]=T.prototype.entries);function C(o){if(!o._noBody){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}}function w(o){return new Promise(function(l,N){o.onload=function(){l(o.result)},o.onerror=function(){N(o.error)}})}function Y(o){var l=new FileReader,N=w(l);return l.readAsArrayBuffer(o),N}function k(o){var l=new FileReader,N=w(l),I=/charset=([A-Za-z0-9_-]+)/.exec(o.type),_=I?I[1]:"utf-8";return l.readAsText(o,_),N}function L(o){for(var l=new Uint8Array(o),N=new Array(l.length),I=0;I<l.length;I++)N[I]=String.fromCharCode(l[I]);return N.join("")}function U(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(o){this.bodyUsed=this.bodyUsed,this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:h.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:h.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:h.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():h.arrayBuffer&&h.blob&&d(o)?(this._bodyArrayBuffer=U(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):h.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||v(o))?this._bodyArrayBuffer=U(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):h.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},h.blob&&(this.blob=function(){var o=C(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=C(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(h.blob)return this.blob().then(Y);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var o=C(this);if(o)return o;if(this._bodyBlob)return k(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then(qe)}),this.json=function(){return this.text().then(JSON.parse)},this}var z=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Ve(o){var l=o.toUpperCase();return z.indexOf(l)>-1?l:o}function F(o,l){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');l=l||{};var N=l.body;if(o instanceof F){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,l.headers||(this.headers=new T(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!N&&o._bodyInit!=null&&(N=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new T(l.headers)),this.method=Ve(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal||(function(){if("AbortController"in u){var A=new AbortController;return A.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&N)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(N),(this.method==="GET"||this.method==="HEAD")&&(l.cache==="no-store"||l.cache==="no-cache")){var I=/([?&])_=[^&]*/;if(I.test(this.url))this.url=this.url.replace(I,"$1_="+new Date().getTime());else{var _=/\?/;this.url+=(_.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})};function qe(o){var l=new FormData;return o.trim().split("&").forEach(function(N){if(N){var I=N.split("="),_=I.shift().replace(/\+/g," "),A=I.join("=").replace(/\+/g," ");l.append(decodeURIComponent(_),decodeURIComponent(A))}}),l}function je(o){var l=new T,N=o.replace(/\r?\n[\t ]+/g," ");return N.split("\r").map(function(I){return I.indexOf(`
|
|
56
|
-
`)===0?I.substr(1,I.length):I}).forEach(function(I){var _=I.split(":"),A=_.shift().trim();if(A){var J=_.join(":").trim();try{l.append(A,J)}catch(re){console.warn("Response "+re.message)}}}),l}$.call(F.prototype);function S(o,l){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(l||(l={}),this.type="default",this.status=l.status===void 0?200:l.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=l.statusText===void 0?"":""+l.statusText,this.headers=new T(l.headers),this.url=l.url||"",this._initBody(o)}$.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new T(this.headers),url:this.url})},S.error=function(){var o=new S(null,{status:200,statusText:""});return o.ok=!1,o.status=0,o.type="error",o};var $e=[301,302,303,307,308];S.redirect=function(o,l){if($e.indexOf(l)===-1)throw new RangeError("Invalid status code");return new S(null,{status:l,headers:{location:o}})},c.DOMException=u.DOMException;try{new c.DOMException}catch{c.DOMException=function(l,N){this.message=l,this.name=N;var I=Error(l);this.stack=I.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function ie(o,l){return new Promise(function(N,I){var _=new F(o,l);if(_.signal&&_.signal.aborted)return I(new c.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function J(){A.abort()}A.onload=function(){var D={statusText:A.statusText,headers:je(A.getAllResponseHeaders()||"")};_.url.indexOf("file://")===0&&(A.status<200||A.status>599)?D.status=200:D.status=A.status,D.url="responseURL"in A?A.responseURL:D.headers.get("X-Request-URL");var P="response"in A?A.response:A.responseText;setTimeout(function(){N(new S(P,D))},0)},A.onerror=function(){setTimeout(function(){I(new TypeError("Network request failed"))},0)},A.ontimeout=function(){setTimeout(function(){I(new TypeError("Network request timed out"))},0)},A.onabort=function(){setTimeout(function(){I(new c.DOMException("Aborted","AbortError"))},0)};function re(D){try{return D===""&&u.location.href?u.location.href:D}catch{return D}}if(A.open(_.method,re(_.url),!0),_.credentials==="include"?A.withCredentials=!0:_.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&(h.blob?A.responseType="blob":h.arrayBuffer&&(A.responseType="arraybuffer")),l&&typeof l.headers=="object"&&!(l.headers instanceof T||u.Headers&&l.headers instanceof u.Headers)){var Te=[];Object.getOwnPropertyNames(l.headers).forEach(function(D){Te.push(m(D)),A.setRequestHeader(D,O(l.headers[D]))}),_.headers.forEach(function(D,P){Te.indexOf(P)===-1&&A.setRequestHeader(P,D)})}else _.headers.forEach(function(D,P){A.setRequestHeader(P,D)});_.signal&&(_.signal.addEventListener("abort",J),A.onreadystatechange=function(){A.readyState===4&&_.signal.removeEventListener("abort",J)}),A.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return ie.polyfill=!0,u.fetch||(u.fetch=ie,u.Headers=T,u.Request=F,u.Response=S),c.Headers=T,c.Request=F,c.Response=S,c.fetch=ie,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(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})(W,W.exports)),W.exports}var de=Ut();const ee=Mt(de),Vt=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"})),V=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Vt&&de.Headers&&e instanceof de.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},_e=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),qt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(_e(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:_e(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},jt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:c,fetchOptions:u,middleware:h}=t,d={...t.headers};let y="",v;e==="POST"?(v=$t(r,i,s,u.jsonSerializer),typeof v=="string"&&(d["Content-Type"]="application/json")):y=qt({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??ye});const m={method:e,headers:d,body:v,...u};let O=n,x=m;if(h){const T=await Promise.resolve(h({...m,url:n,operationName:s,variables:i})),{url:C,...w}=T;O=C,x=w}return y&&(O=`${O}?${y}`),await c(O,x)};class ge{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,c]=r,u=ze(i,s,c),{headers:h,fetch:d=ee,method:y="POST",requestMiddleware:v,responseMiddleware:m,...O}=this.requestConfig,{url:x}=this;u.signal!==void 0&&(O.signal=u.signal);const{operationName:T}=ae(u.query);return ce({url:x,query:u.query,variables:u.variables,headers:{...V(ue(h)),...V(u.requestHeaders)},operationName:T,fetch:d,method:y,fetchOptions:O,middleware:v}).then(C=>(m&&m(C),C)).catch(C=>{throw m&&m(C),C})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:c,fetch:u=ee,method:h="POST",requestMiddleware:d,responseMiddleware:y,...v}=this.requestConfig,{url:m}=this;s.signal!==void 0&&(v.signal=s.signal);const{query:O,operationName:x}=ae(s.document);return ce({url:m,query:O,variables:s.variables,headers:{...V(ue(c)),...V(s.requestHeaders)},operationName:x,fetch:u,method:h,fetchOptions:v,middleware:d}).then(T=>(y&&y(T),T.data)).catch(T=>{throw y&&y(T),T})}batchRequests(t,n){const r=Je(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const c=r.documents.map(({document:h})=>ae(h).query),u=r.documents.map(({variables:h})=>h);return ce({url:this.url,query:c,variables:u,headers:{...V(ue(i)),...V(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ee,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(h=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h.data)).catch(h=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(h),h})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const ce=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=jt(Ge(e.method??"post")),s=Array.isArray(e.query),c=await i(e),u=await Gt(c,r.jsonSerializer??ye),h=Array.isArray(u)?!u.some(({data:y})=>!y):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(c.ok&&d&&h){const{errors:y,...v}=(Array.isArray(u),u),m=r.errorPolicy==="ignore"?v:u;return{...s?{data:m}:m,headers:c.headers,status:c.status}}else{const y=typeof u=="string"?{error:u}:u;throw new B({...y,status:c.status,headers:c.headers},{query:t,variables:n})}},$t=(e,t,n,r)=>{const i=r??ye;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((c,u,h)=>(c.push({query:u,variables:t?t[h]:void 0}),c),[]);return i.stringify(s)},Gt=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},ue=e=>typeof e=="function"?e():e;class Ht{constructor(){this.listeners=new Map}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{this.listeners.get(t)?.delete(n)}}dispatch(t,n){this.listeners.get(t)?.forEach(r=>r(n))}}const le=new Ht;function Ue(e,t){e===401?le.dispatch("unauthenticated",t):e===403?le.dispatch("permissionDenied",t):e>=500&&le.dispatch("serverError",t)}function be(e){if(!(e instanceof B))return;const t=e.response?.status;typeof t=="number"&&Ue(t,{status:t,error:e})}function De(e){if(e instanceof B&&e.response?.data){const{data:t,errors:n}=e.response;if(t){if(process.env.NODE_ENV==="development"&&n?.length){const{query:r,variables:i}=e.request??{},s=r?.match(/^\s*(?:query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/)?.[1];for(const c of n)console.error(`[GraphQL] ${s??"operation"} — field error at ${c.path?.join(".")??"unknown"}: ${c.message}`,{error:c,request:{operationName:s,variables:i,query:r}})}return t}}throw e}function Yt(){const e=async(r,i,s,c)=>{const u=new ge(r,{headers:c});try{return await u.request({document:i,variables:s})}catch(h){return be(h),De(h)}},t=async r=>{const i=new ge(r.url,{headers:r.requestHeaders,signal:r.signal});try{return await i.request({document:r.document,variables:r.variables})}catch(s){return be(s),De(s)}},n=e;return n.withOptions=t,n}function zt(){return async function(t,n){const r=await fetch(t,n);return(r.status===401||r.status===403||r.status>=500)&&Ue(r.status,{status:r.status,response:r.clone()}),r}}export{B as ClientError,ge as GraphQLClient,le as authAwareEvents,zt as createAuthAwareFetch,Yt as createAuthAwareGraphqlClient};
|
|
1
|
+
class l extends Error{constructor(e,s){const t=e.errors?.[0]?.message;super(`GraphQL request failed: ${t??`HTTP ${e.status}`}`),this.name="ClientError",this.response=e,this.request=s}}class f{constructor(){this.listeners=new Map}subscribe(e,s){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s),()=>{this.listeners.get(e)?.delete(s)}}dispatch(e,s){this.listeners.get(e)?.forEach(t=>t(s))}}const u=new f;function p(r,e){r===401?u.dispatch("unauthenticated",e):r===403?u.dispatch("permissionDenied",e):r>=500&&u.dispatch("serverError",e)}function w(r,e,s){if(process.env.NODE_ENV!=="development"||!s.length)return;const t=r.match(/^\s*(?:query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/)?.[1];for(const n of s)console.error(`[GraphQL] ${t??"operation"} — field error at ${n.path?.join(".")??"unknown"}: ${n.message}`,{error:n,request:{operationName:t,variables:e,query:r}})}async function d(r){const{url:e,query:s,variables:t,requestHeaders:n,signal:c}=r,i=new Headers(n);i.set("Content-Type","application/json"),i.has("Accept")||i.set("Accept","application/json");const o=await fetch(e,{method:"POST",headers:i,body:JSON.stringify({query:s,variables:t}),signal:c});let a;try{a=await o.json()}catch{a=void 0}if(!o.ok){const h=new l({status:o.status,data:a?.data,errors:a?.errors},{query:s,variables:t});throw p(o.status,{status:o.status,error:h}),h}if(a?.data)return a.errors?.length&&w(s,t,a.errors),a.data;throw new l({status:o.status,errors:a?.errors},{query:s,variables:t})}function g(){const r=async(t,n,c,i)=>d({url:t,query:String(n),variables:c,requestHeaders:i}),e=async t=>d({url:t.url,query:String(t.document),variables:t.variables,requestHeaders:t.requestHeaders,signal:t.signal}),s=r;return s.withOptions=e,s}function y(){return async function(e,s){const t=await fetch(e,s);return(t.status===401||t.status===403||t.status>=500)&&p(t.status,{status:t.status,response:t.clone()}),t}}export{l as ClientError,u as authAwareEvents,y as createAuthAwareFetch,g as createAuthAwareGraphqlClient};
|