Socket
Socket
Sign inDemoInstall

@nhost/apollo

Package Overview
Dependencies
62
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.5 to 6.0.6

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@apollo/client/core"),x=require("@apollo/client/link/context"),I=require("@apollo/client/link/subscriptions"),M=require("@apollo/client/utilities"),G=require("graphql-ws");function P(t){let c=!1,a=()=>{c=!0},d=!1,u,h;const y=G.createClient({...t,on:{...t.on,error:n=>{var e,l;console.error(n),(l=(e=t.on)==null?void 0:e.error)==null||l.call(e,n),a()},ping:n=>{n||(h=setTimeout(()=>{y.terminate(),a()},5e3))},pong:n=>{n&&clearTimeout(h)},opened:n=>{var e,l;u=n,(l=(e=t.on)==null?void 0:e.opened)==null||l.call(e,u),d=!0,a=()=>{u.readyState===WebSocket.OPEN?u.close(4205,"Client Restart"):c=!0},c&&(c=!1,a())},closed:n=>{var e,l;(l=(e=t==null?void 0:t.on)==null?void 0:e.closed)==null||l.call(e,n),d=!1}}});return{...y,restart:()=>a(),isOpen:()=>d}}const b=typeof window!="undefined",W=({nhost:t,graphqlUrl:c,headers:a={},publicRole:d="public",fetchPolicy:u,cache:h=new p.InMemoryCache,connectToDevTools:y=b&&process.env.NODE_ENV==="development",onError:n,link:e,generateLinks:l})=>{const k=c||(t==null?void 0:t.graphql.httpUrl);if(!k)throw Error("Can't initialize the Apollo Client: no backend Url has been provided");const w=k,N=t==null?void 0:t.auth.client.interpreter;let r=null;const q=()=>!!(r!=null&&r.value)&&!!(r!=null&&r.expiresAt)&&(r==null?void 0:r.expiresAt)>new Date,A=()=>!r||q(),E=()=>{if(!A())return new Promise(i=>{const o=setInterval(()=>{A()&&(clearInterval(o),i(!0))},100)})},C=async()=>{await E();const i={...a,"Sec-WebSocket-Protocol":"graphql-ws"};return r?i.authorization=`Bearer ${r.value}`:i.role=d,i},s=b?P({url:w.startsWith("https")?w.replace(/^https/,"wss"):w.replace(/^http/,"ws"),shouldRetry:()=>!0,retryAttempts:100,retryWait:async i=>new Promise(O=>setTimeout(O,1e3*Math.pow(2,i)+Math.floor(Math.random()*3e3))),connectionParams:async()=>({headers:{...a,...await C()}})}):null,D=s?new I.GraphQLWsLink(s):null,S=x.setContext(async(i,{headers:o})=>({headers:{...o,...await C()}})).concat(p.createHttpLink({uri:w})),T=D?p.split(({query:i})=>{const o=M.getMainDefinition(i),{kind:m}=o;let O;return"operation"in o&&(O=o.operation),m==="OperationDefinition"&&O==="subscription"},D,S):S,f=[];n&&f.push(n),e&&f.push(e),f.push(T);const v=p.from(l?l(f):f),g=new p.ApolloClient({cache:h||new p.InMemoryCache,ssrMode:!b,defaultOptions:{watchQuery:{fetchPolicy:u}},connectToDevTools:y,link:v});return N==null||N.onTransition(async(i,o)=>{if(["SIGNOUT","SIGNED_IN","TOKEN_CHANGED"].includes(o.type)){if(o.type==="SIGNOUT"||o.type==="TOKEN_CHANGED"&&i.context.accessToken.value===null){r=null;try{await g.resetStore()}catch(m){console.error("Error resetting Apollo client cache"),console.error(m)}return}if(r=i.context.accessToken,!b||!(s!=null&&s.isOpen()))return;s==null||s.restart()}}),g};exports.createApolloClient=W;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@apollo/client/core"),I=require("@apollo/client/link/context"),M=require("@apollo/client/link/subscriptions"),P=require("@apollo/client/utilities"),G=require("jwt-decode"),V=require("graphql-ws");function W(n){let c=!1,a=()=>{c=!0},p=!1,u,m;const w=V.createClient({...n,on:{...n.on,error:o=>{var t,l;console.error(o),(l=(t=n.on)==null?void 0:t.error)==null||l.call(t,o),a()},ping:o=>{o||(m=setTimeout(()=>{w.terminate(),a()},5e3))},pong:o=>{o&&clearTimeout(m)},opened:o=>{var t,l;u=o,(l=(t=n.on)==null?void 0:t.opened)==null||l.call(t,u),p=!0,a=()=>{u.readyState===WebSocket.OPEN?u.close(4205,"Client Restart"):c=!0},c&&(c=!1,a())},closed:o=>{var t,l;(l=(t=n==null?void 0:n.on)==null?void 0:t.closed)==null||l.call(t,o),p=!1}}});return{...w,restart:()=>a(),isOpen:()=>p}}const b=typeof window!="undefined",H=({nhost:n,graphqlUrl:c,headers:a={},publicRole:p="public",fetchPolicy:u,cache:m=new d.InMemoryCache,connectToDevTools:w=b&&process.env.NODE_ENV==="development",onError:o,link:t,generateLinks:l})=>{const N=c||(n==null?void 0:n.graphql.httpUrl);if(!N)throw Error("Can't initialize the Apollo Client: no backend Url has been provided");const y=N,k=n==null?void 0:n.auth.client.interpreter;let e=null;const q=()=>{if(!(e!=null&&e.value))return!1;const i=3*1e3;return G(e.value).exp*1e3>Date.now()-i},C=()=>!!(e!=null&&e.value)&&!!(e!=null&&e.expiresAt)&&(e==null?void 0:e.expiresAt)>new Date&&q(),g=()=>!e||C(),v=()=>{if(g())return Promise.resolve();const r=()=>g()?Promise.resolve(!0):new Promise(i=>{setTimeout(()=>r().then(i),100)});return r()},D=async()=>{await v();const r={...a,"Sec-WebSocket-Protocol":"graphql-ws"};return e?r.authorization=`Bearer ${e.value}`:r.role=p,r},s=b?W({url:y.startsWith("https")?y.replace(/^https/,"wss"):y.replace(/^http/,"ws"),shouldRetry:()=>!0,retryAttempts:100,retryWait:async r=>new Promise(O=>setTimeout(O,1e3*Math.pow(2,r)+Math.floor(Math.random()*3e3))),connectionParams:async()=>({headers:{...a,...await D()}})}):null,S=s?new M.GraphQLWsLink(s):null,A=I.setContext(async(r,{headers:i})=>({headers:{...i,...await D()}})).concat(d.createHttpLink({uri:y})),x=S?d.split(({query:r})=>{const i=P.getMainDefinition(r),{kind:h}=i;let O;return"operation"in i&&(O=i.operation),h==="OperationDefinition"&&O==="subscription"},S,A):A,f=[];o&&f.push(o),t&&f.push(t),f.push(x);const E=d.from(l?l(f):f),T=new d.ApolloClient({cache:m||new d.InMemoryCache,ssrMode:!b,defaultOptions:{watchQuery:{fetchPolicy:u}},connectToDevTools:w,link:E});return k==null||k.onTransition(async(r,i)=>{if(["SIGNOUT","SIGNED_IN","TOKEN_CHANGED"].includes(i.type)){if(i.type==="SIGNOUT"||i.type==="TOKEN_CHANGED"&&r.context.accessToken.value===null){e=null;try{await T.resetStore()}catch(h){console.error("Error resetting Apollo client cache"),console.error(h)}return}if(e=r.context.accessToken,!b||!(s!=null&&s.isOpen()))return;s==null||s.restart()}}),T};exports.createApolloClient=H;
//# sourceMappingURL=index.cjs.js.map

@@ -1,35 +0,36 @@

import { createHttpLink as g, split as G, from as M, ApolloClient as H, InMemoryCache as C } from "@apollo/client/core";
import { setContext as P } from "@apollo/client/link/context";
import { createHttpLink as M, split as P, from as G, ApolloClient as V, InMemoryCache as g } from "@apollo/client/core";
import { setContext as H } from "@apollo/client/link/context";
import { GraphQLWsLink as U } from "@apollo/client/link/subscriptions";
import { getMainDefinition as W } from "@apollo/client/utilities";
import { createClient as _ } from "graphql-ws";
function L(t) {
import _ from "jwt-decode";
import { createClient as L } from "graphql-ws";
function R(n) {
let c = !1, l = () => {
c = !0;
}, p = !1, u, d;
const m = _({
...t,
}, p = !1, u, m;
const w = L({
...n,
on: {
...t.on,
error: (n) => {
var e, a;
console.error(n), (a = (e = t.on) == null ? void 0 : e.error) == null || a.call(e, n), l();
...n.on,
error: (i) => {
var t, a;
console.error(i), (a = (t = n.on) == null ? void 0 : t.error) == null || a.call(t, i), l();
},
ping: (n) => {
n || (d = setTimeout(() => {
m.terminate(), l();
ping: (i) => {
i || (m = setTimeout(() => {
w.terminate(), l();
}, 5e3));
},
pong: (n) => {
n && clearTimeout(d);
pong: (i) => {
i && clearTimeout(m);
},
opened: (n) => {
var e, a;
u = n, (a = (e = t.on) == null ? void 0 : e.opened) == null || a.call(e, u), p = !0, l = () => {
opened: (i) => {
var t, a;
u = i, (a = (t = n.on) == null ? void 0 : t.opened) == null || a.call(t, u), p = !0, l = () => {
u.readyState === WebSocket.OPEN ? u.close(4205, "Client Restart") : c = !0;
}, c && (c = !1, l());
},
closed: (n) => {
var e, a;
(a = (e = t == null ? void 0 : t.on) == null ? void 0 : e.closed) == null || a.call(e, n), p = !1;
closed: (i) => {
var t, a;
(a = (t = n == null ? void 0 : n.on) == null ? void 0 : t.closed) == null || a.call(t, i), p = !1;
}

@@ -39,3 +40,3 @@ }

return {
...m,
...w,
restart: () => l(),

@@ -45,4 +46,4 @@ isOpen: () => p

}
const O = typeof window != "undefined", J = ({
nhost: t,
const O = typeof window != "undefined", j = ({
nhost: n,
graphqlUrl: c,

@@ -52,35 +53,40 @@ headers: l = {},

fetchPolicy: u,
cache: d = new C(),
connectToDevTools: m = O && process.env.NODE_ENV === "development",
onError: n,
link: e,
cache: m = new g(),
connectToDevTools: w = O && process.env.NODE_ENV === "development",
onError: i,
link: t,
generateLinks: a
}) => {
const k = c || (t == null ? void 0 : t.graphql.httpUrl);
if (!k)
const N = c || (n == null ? void 0 : n.graphql.httpUrl);
if (!N)
throw Error("Can't initialize the Apollo Client: no backend Url has been provided");
const h = k, N = t == null ? void 0 : t.auth.client.interpreter;
let r = null;
const S = () => !!(r != null && r.value) && !!(r != null && r.expiresAt) && (r == null ? void 0 : r.expiresAt) > /* @__PURE__ */ new Date(), b = () => !r || S(), T = () => {
if (!b())
return new Promise((i) => {
const o = setInterval(() => {
b() && (clearInterval(o), i(!0));
}, 100);
});
}, A = async () => {
await T();
const i = {
const h = N, k = n == null ? void 0 : n.auth.client.interpreter;
let e = null;
const x = () => {
if (!(e != null && e.value))
return !1;
const o = 3 * 1e3;
return _(e.value).exp * 1e3 > Date.now() - o;
}, E = () => !!(e != null && e.value) && !!(e != null && e.expiresAt) && (e == null ? void 0 : e.expiresAt) > /* @__PURE__ */ new Date() && x(), D = () => !e || E(), v = () => {
if (D())
return Promise.resolve();
const r = () => D() ? Promise.resolve(!0) : new Promise((o) => {
setTimeout(() => r().then(o), 100);
});
return r();
}, b = async () => {
await v();
const r = {
...l,
"Sec-WebSocket-Protocol": "graphql-ws"
};
return r ? i.authorization = `Bearer ${r.value}` : i.role = p, i;
}, s = O ? L({
return e ? r.authorization = `Bearer ${e.value}` : r.role = p, r;
}, s = O ? R({
url: h.startsWith("https") ? h.replace(/^https/, "wss") : h.replace(/^http/, "ws"),
shouldRetry: () => !0,
retryAttempts: 100,
retryWait: async (i) => new Promise(
retryWait: async (r) => new Promise(
(y) => setTimeout(
y,
1e3 * Math.pow(2, i) + Math.floor(Math.random() * 3e3)
1e3 * Math.pow(2, r) + Math.floor(Math.random() * 3e3)
)

@@ -91,22 +97,22 @@ ),

...l,
...await A()
...await b()
}
})
}) : null, D = s ? new U(s) : null, E = P(async (i, { headers: o }) => ({
}) : null, A = s ? new U(s) : null, S = H(async (r, { headers: o }) => ({
headers: {
...o,
...await A()
...await b()
}
})).concat(g({ uri: h })), v = D ? G(
({ query: i }) => {
const o = W(i), { kind: w } = o;
})).concat(M({ uri: h })), C = A ? P(
({ query: r }) => {
const o = W(r), { kind: f } = o;
let y;
return "operation" in o && (y = o.operation), w === "OperationDefinition" && y === "subscription";
return "operation" in o && (y = o.operation), f === "OperationDefinition" && y === "subscription";
},
D,
E
) : E, f = [];
n && f.push(n), e && f.push(e), f.push(v);
const I = M(a ? a(f) : f), x = new H({
cache: d || new C(),
A,
S
) : S, d = [];
i && d.push(i), t && d.push(t), d.push(C);
const I = G(a ? a(d) : d), T = new V({
cache: m || new g(),
ssrMode: !O,

@@ -118,25 +124,25 @@ defaultOptions: {

},
connectToDevTools: m,
connectToDevTools: w,
link: I
});
return N == null || N.onTransition(async (i, o) => {
return k == null || k.onTransition(async (r, o) => {
if (["SIGNOUT", "SIGNED_IN", "TOKEN_CHANGED"].includes(o.type)) {
if (o.type === "SIGNOUT" || o.type === "TOKEN_CHANGED" && i.context.accessToken.value === null) {
r = null;
if (o.type === "SIGNOUT" || o.type === "TOKEN_CHANGED" && r.context.accessToken.value === null) {
e = null;
try {
await x.resetStore();
} catch (w) {
console.error("Error resetting Apollo client cache"), console.error(w);
await T.resetStore();
} catch (f) {
console.error("Error resetting Apollo client cache"), console.error(f);
}
return;
}
if (r = i.context.accessToken, !O || !(s != null && s.isOpen()))
if (e = r.context.accessToken, !O || !(s != null && s.isOpen()))
return;
s == null || s.restart();
}
}), x;
}), T;
};
export {
J as createApolloClient
j as createApolloClient
};
//# sourceMappingURL=index.esm.js.map
{
"name": "@nhost/apollo",
"version": "6.0.5",
"version": "6.0.6",
"description": "Nhost Apollo Client library",

@@ -49,11 +49,12 @@ "license": "MIT",

"@apollo/client": "^3.7.10",
"@nhost/nhost-js": "3.0.5"
"@nhost/nhost-js": "3.0.6"
},
"dependencies": {
"graphql": "16.8.1",
"graphql-ws": "^5.14.3"
"graphql-ws": "^5.14.3",
"jwt-decode": "^3.1.2"
},
"devDependencies": {
"@apollo/client": "^3.9.4",
"@nhost/nhost-js": "3.0.5"
"@nhost/nhost-js": "3.0.6"
},

@@ -60,0 +61,0 @@ "scripts": {

@@ -1,2 +0,2 @@

(function(P,$){typeof exports=="object"&&typeof module!="undefined"?$(exports,require("@apollo/client/core"),require("@apollo/client/link/context"),require("@apollo/client/link/subscriptions"),require("@apollo/client/utilities")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@apollo/client/link/context","@apollo/client/link/subscriptions","@apollo/client/utilities"],$):(P=typeof globalThis!="undefined"?globalThis:P||self,$(P["@nhost/apollo"]={},P["@apollo/client/core"],P["@apollo/client/link/context"],P["@apollo/client/link/subscriptions"],P["@apollo/client/utilities"]))})(this,function(P,$,ne,re,oe){"use strict";function k(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function G(e){return k(e)==="object"}function ie(e){return Array.isArray(e)&&e.length>0&&e.every(p=>"message"in p)}function Z(e,p){return e.length<124?e:p}const se="graphql-transport-ws";var T;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(T||(T={}));var u;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(u||(u={}));function v(e){if(!G(e))throw new Error(`Message is expected to be an object, but got ${k(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${k(e.type)}`);switch(e.type){case u.ConnectionInit:case u.ConnectionAck:case u.Ping:case u.Pong:{if(e.payload!=null&&!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case u.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${k(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${k(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${k(e.payload.query)}`);if(e.payload.variables!=null&&!G(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${k(e.payload.variables)}`);if(e.payload.operationName!=null&&k(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${k(e.payload.operationName)}`);if(e.payload.extensions!=null&&!G(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${k(e.payload.extensions)}`);break}case u.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${k(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${k(e.payload)}`);break}case u.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${k(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!ie(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case u.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${k(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function ae(e,p){return v(typeof e=="string"?JSON.parse(e,p):e)}function F(e,p){return v(e),JSON.stringify(e,p)}var z=function(e){return this instanceof z?(this.v=e,this):new z(e)},ce=function(e,p,N){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var O=N.apply(e,p||[]),x,h=[];return x={},A("next"),A("throw"),A("return"),x[Symbol.asyncIterator]=function(){return this},x;function A(a){O[a]&&(x[a]=function(t){return new Promise(function(R,B){h.push([a,t,R,B])>1||d(a,t)})})}function d(a,t){try{l(O[a](t))}catch(R){q(h[0][3],R)}}function l(a){a.value instanceof z?Promise.resolve(a.value.v).then(b,j):q(h[0][2],a)}function b(a){d("next",a)}function j(a){d("throw",a)}function q(a,t){a(t),h.shift(),h.length&&d(h[0][0],h[0][1])}};function le(e){const{url:p,connectionParams:N,lazy:O=!0,onNonLazyError:x=console.error,lazyCloseTimeout:h=0,keepAlive:A=0,disablePong:d,connectionAckWaitTimeout:l=0,retryAttempts:b=5,retryWait:j=async function(c){let n=1e3;for(let o=0;o<c;o++)n*=2;await new Promise(o=>setTimeout(o,n+Math.floor(Math.random()*2700+300)))},shouldRetry:q=Q,isFatalConnectionProblem:a,on:t,webSocketImpl:R,generateID:B=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{const n=Math.random()*16|0;return(c=="x"?n:n&3|8).toString(16)})},jsonMessageReplacer:C,jsonMessageReviver:K}=e;let E;if(R){if(!pe(R))throw new Error("Invalid WebSocket implementation provided");E=R}else typeof WebSocket!="undefined"?E=WebSocket:typeof global!="undefined"?E=global.WebSocket||global.MozWebSocket:typeof window!="undefined"&&(E=window.WebSocket||window.MozWebSocket);if(!E)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const M=E,f=(()=>{const r=(()=>{const n={};return{on(o,s){return n[o]=s,()=>{delete n[o]}},emit(o){var s;"id"in o&&((s=n[o.id])===null||s===void 0||s.call(n,o))}}})(),c={connecting:t!=null&&t.connecting?[t.connecting]:[],opened:t!=null&&t.opened?[t.opened]:[],connected:t!=null&&t.connected?[t.connected]:[],ping:t!=null&&t.ping?[t.ping]:[],pong:t!=null&&t.pong?[t.pong]:[],message:t!=null&&t.message?[r.emit,t.message]:[r.emit],closed:t!=null&&t.closed?[t.closed]:[],error:t!=null&&t.error?[t.error]:[]};return{onMessage:r.on,on(n,o){const s=c[n];return s.push(o),()=>{s.splice(s.indexOf(o),1)}},emit(n,...o){for(const s of[...c[n]])s(...o)}}})();function X(r){const c=[f.on("error",n=>{c.forEach(o=>o()),r(n)}),f.on("closed",n=>{c.forEach(o=>o()),r(n)})]}let S,_=0,H,y=!1,m=0,D=!1;async function L(){clearTimeout(H);const[r,c]=await(S!=null?S:S=new Promise((s,I)=>(async()=>{if(y){if(await j(m),!_)return S=void 0,I({code:1e3,reason:"All Subscriptions Gone"});m++}f.emit("connecting");const i=new M(typeof p=="function"?await p():p,se);let W,J;function Y(){isFinite(A)&&A>0&&(clearTimeout(J),J=setTimeout(()=>{i.readyState===M.OPEN&&(i.send(F({type:u.Ping})),f.emit("ping",!1,void 0))},A))}X(g=>{S=void 0,clearTimeout(W),clearTimeout(J),I(g),Q(g)&&g.code===4499&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=g=>f.emit("error",g),i.onclose=g=>f.emit("closed",g),i.onopen=async()=>{try{f.emit("opened",i);const g=typeof N=="function"?await N():N;if(i.readyState!==M.OPEN)return;i.send(F(g?{type:u.ConnectionInit,payload:g}:{type:u.ConnectionInit},C)),isFinite(l)&&l>0&&(W=setTimeout(()=>{i.close(T.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),Y()}catch(g){f.emit("error",g),i.close(T.InternalClientError,Z(g instanceof Error?g.message:new Error(g).message,"Internal client error"))}};let U=!1;i.onmessage=({data:g})=>{try{const w=ae(g,K);if(f.emit("message",w),w.type==="ping"||w.type==="pong"){f.emit(w.type,!0,w.payload),w.type==="pong"?Y():d||(i.send(F(w.payload?{type:u.Pong,payload:w.payload}:{type:u.Pong})),f.emit("pong",!1,w.payload));return}if(U)return;if(w.type!==u.ConnectionAck)throw new Error(`First message cannot be of type ${w.type}`);clearTimeout(W),U=!0,f.emit("connected",i,w.payload),y=!1,m=0,s([i,new Promise((me,ye)=>X(ye))])}catch(w){i.onmessage=null,f.emit("error",w),i.close(T.BadResponse,Z(w instanceof Error?w.message:new Error(w).message,"Bad response"))}}})()));r.readyState===M.CLOSING&&await c;let n=()=>{};const o=new Promise(s=>n=s);return[r,n,Promise.race([o.then(()=>{if(!_){const s=()=>r.close(1e3,"Normal Closure");isFinite(h)&&h>0?H=setTimeout(()=>{r.readyState===M.OPEN&&s()},h):s()}}),c])]}function ee(r){if(Q(r)&&(ue(r.code)||[T.InternalServerError,T.InternalClientError,T.BadRequest,T.BadResponse,T.Unauthorized,T.SubprotocolNotAcceptable,T.SubscriberAlreadyExists,T.TooManyInitialisationRequests].includes(r.code)))throw r;if(D)return!1;if(Q(r)&&r.code===1e3)return _>0;if(!b||m>=b||!q(r)||a!=null&&a(r))throw r;return y=!0}O||(async()=>{for(_++;;)try{const[,,r]=await L();await r}catch(r){try{if(!ee(r))return}catch(c){return x==null?void 0:x(c)}}})();function te(r,c){const n=B(r);let o=!1,s=!1,I=()=>{_--,o=!0};return(async()=>{for(_++;;)try{const[i,W,J]=await L();if(o)return W();const Y=f.onMessage(n,U=>{switch(U.type){case u.Next:{c.next(U.payload);return}case u.Error:{s=!0,o=!0,c.error(U.payload),I();return}case u.Complete:{o=!0,I();return}}});i.send(F({id:n,type:u.Subscribe,payload:r},C)),I=()=>{!o&&i.readyState===M.OPEN&&i.send(F({id:n,type:u.Complete},C)),_--,o=!0,W()},await J.finally(Y);return}catch(i){if(!ee(i))return}})().then(()=>{s||c.complete()}).catch(i=>{c.error(i)}),()=>{o||I()}}return{on:f.on,subscribe:te,iterate(r){const c=[],n={done:!1,error:null,resolve:()=>{}},o=te(r,{next(I){c.push(I),n.resolve()},error(I){n.done=!0,n.error=I,n.resolve()},complete(){n.done=!0,n.resolve()}}),s=function(){return ce(this,arguments,function*(){for(;;){for(c.length||(yield z(new Promise(W=>n.resolve=W)));c.length;)yield yield z(c.shift());if(n.error)throw n.error;if(n.done)return yield z(void 0)}})}();return s.throw=async I=>(n.done||(n.done=!0,n.error=I,n.resolve()),{done:!0,value:void 0}),s.return=async()=>(o(),{done:!0,value:void 0}),s},async dispose(){if(D=!0,S){const[r]=await S;r.close(1e3,"Normal Closure")}},terminate(){S&&f.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Q(e){return G(e)&&"code"in e&&"reason"in e}function ue(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function pe(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}function de(e){let p=!1,N=()=>{p=!0},O=!1,x,h;const A=le({...e,on:{...e.on,error:d=>{var l,b;console.error(d),(b=(l=e.on)==null?void 0:l.error)==null||b.call(l,d),N()},ping:d=>{d||(h=setTimeout(()=>{A.terminate(),N()},5e3))},pong:d=>{d&&clearTimeout(h)},opened:d=>{var l,b;x=d,(b=(l=e.on)==null?void 0:l.opened)==null||b.call(l,x),O=!0,N=()=>{x.readyState===WebSocket.OPEN?x.close(4205,"Client Restart"):p=!0},p&&(p=!1,N())},closed:d=>{var l,b;(b=(l=e==null?void 0:e.on)==null?void 0:l.closed)==null||b.call(l,d),O=!1}}});return{...A,restart:()=>N(),isOpen:()=>O}}const V=typeof window!="undefined",fe=({nhost:e,graphqlUrl:p,headers:N={},publicRole:O="public",fetchPolicy:x,cache:h=new $.InMemoryCache,connectToDevTools:A=V&&process.env.NODE_ENV==="development",onError:d,link:l,generateLinks:b})=>{const j=p||(e==null?void 0:e.graphql.httpUrl);if(!j)throw Error("Can't initialize the Apollo Client: no backend Url has been provided");const q=j,a=e==null?void 0:e.auth.client.interpreter;let t=null;const R=()=>!!(t!=null&&t.value)&&!!(t!=null&&t.expiresAt)&&(t==null?void 0:t.expiresAt)>new Date,B=()=>!t||R(),C=()=>{if(!B())return new Promise(y=>{const m=setInterval(()=>{B()&&(clearInterval(m),y(!0))},100)})},K=async()=>{await C();const y={...N,"Sec-WebSocket-Protocol":"graphql-ws"};return t?y.authorization=`Bearer ${t.value}`:y.role=O,y},E=V?de({url:q.startsWith("https")?q.replace(/^https/,"wss"):q.replace(/^http/,"ws"),shouldRetry:()=>!0,retryAttempts:100,retryWait:async y=>new Promise(L=>setTimeout(L,1e3*Math.pow(2,y)+Math.floor(Math.random()*3e3))),connectionParams:async()=>({headers:{...N,...await K()}})}):null,M=E?new re.GraphQLWsLink(E):null,f=ne.setContext(async(y,{headers:m})=>({headers:{...m,...await K()}})).concat($.createHttpLink({uri:q})),X=M?$.split(({query:y})=>{const m=oe.getMainDefinition(y),{kind:D}=m;let L;return"operation"in m&&(L=m.operation),D==="OperationDefinition"&&L==="subscription"},M,f):f,S=[];d&&S.push(d),l&&S.push(l),S.push(X);const _=$.from(b?b(S):S),H=new $.ApolloClient({cache:h||new $.InMemoryCache,ssrMode:!V,defaultOptions:{watchQuery:{fetchPolicy:x}},connectToDevTools:A,link:_});return a==null||a.onTransition(async(y,m)=>{if(["SIGNOUT","SIGNED_IN","TOKEN_CHANGED"].includes(m.type)){if(m.type==="SIGNOUT"||m.type==="TOKEN_CHANGED"&&y.context.accessToken.value===null){t=null;try{await H.resetStore()}catch(D){console.error("Error resetting Apollo client cache"),console.error(D)}return}if(t=y.context.accessToken,!V||!(E!=null&&E.isOpen()))return;E==null||E.restart()}}),H};P.createApolloClient=fe,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
(function(O,R){typeof exports=="object"&&typeof module!="undefined"?R(exports,require("@apollo/client/core"),require("@apollo/client/link/context"),require("@apollo/client/link/subscriptions"),require("@apollo/client/utilities")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@apollo/client/link/context","@apollo/client/link/subscriptions","@apollo/client/utilities"],R):(O=typeof globalThis!="undefined"?globalThis:O||self,R(O["@nhost/apollo"]={},O["@apollo/client/core"],O["@apollo/client/link/context"],O["@apollo/client/link/subscriptions"],O["@apollo/client/utilities"]))})(this,function(O,R,ie,se,ae){"use strict";function Z(e){this.message=e}Z.prototype=new Error,Z.prototype.name="InvalidCharacterError";var te=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(e){var i=String(e).replace(/=+$/,"");if(i.length%4==1)throw new Z("'atob' failed: The string to be decoded is not correctly encoded.");for(var u,m,y=0,p=0,E="";m=i.charAt(p++);~m&&(u=y%4?64*u+m:m,y++%4)?E+=String.fromCharCode(255&u>>(-2*y&6)):0)m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(m);return E};function ce(e){var i=e.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!"}try{return function(u){return decodeURIComponent(te(u).replace(/(.)/g,function(m,y){var p=y.charCodeAt(0).toString(16).toUpperCase();return p.length<2&&(p="0"+p),"%"+p}))}(i)}catch{return te(i)}}function V(e){this.message=e}function le(e,i){if(typeof e!="string")throw new V("Invalid token specified");var u=(i=i||{}).header===!0?0:1;try{return JSON.parse(ce(e.split(".")[u]))}catch(m){throw new V("Invalid token specified: "+m.message)}}V.prototype=new Error,V.prototype.name="InvalidTokenError";function N(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function G(e){return N(e)==="object"}function ue(e){return Array.isArray(e)&&e.length>0&&e.every(i=>"message"in i)}function ne(e,i){return e.length<124?e:i}const pe="graphql-transport-ws";var A;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(A||(A={}));var f;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(f||(f={}));function re(e){if(!G(e))throw new Error(`Message is expected to be an object, but got ${N(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${N(e.type)}`);switch(e.type){case f.ConnectionInit:case f.ConnectionAck:case f.Ping:case f.Pong:{if(e.payload!=null&&!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case f.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${N(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${N(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${N(e.payload.query)}`);if(e.payload.variables!=null&&!G(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${N(e.payload.variables)}`);if(e.payload.operationName!=null&&N(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${N(e.payload.operationName)}`);if(e.payload.extensions!=null&&!G(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${N(e.payload.extensions)}`);break}case f.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${N(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!G(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${N(e.payload)}`);break}case f.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${N(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!ue(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case f.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${N(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function de(e,i){return re(typeof e=="string"?JSON.parse(e,i):e)}function F(e,i){return re(e),JSON.stringify(e,i)}var L=function(e){return this instanceof L?(this.v=e,this):new L(e)},fe=function(e,i,u){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=u.apply(e,i||[]),y,p=[];return y={},E("next"),E("throw"),E("return"),y[Symbol.asyncIterator]=function(){return this},y;function E(c){m[c]&&(y[c]=function(t){return new Promise(function(M,v){p.push([c,t,M,v])>1||w(c,t)})})}function w(c,t){try{d(m[c](t))}catch(M){q(p[0][3],M)}}function d(c){c.value instanceof L?Promise.resolve(c.value.v).then(S,z):q(p[0][2],c)}function S(c){w("next",c)}function z(c){w("throw",c)}function q(c,t){c(t),p.shift(),p.length&&w(p[0][0],p[0][1])}};function ye(e){const{url:i,connectionParams:u,lazy:m=!0,onNonLazyError:y=console.error,lazyCloseTimeout:p=0,keepAlive:E=0,disablePong:w,connectionAckWaitTimeout:d=0,retryAttempts:S=5,retryWait:z=async function(l){let n=1e3;for(let o=0;o<l;o++)n*=2;await new Promise(o=>setTimeout(o,n+Math.floor(Math.random()*2700+300)))},shouldRetry:q=Q,isFatalConnectionProblem:c,on:t,webSocketImpl:M,generateID:v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,l=>{const n=Math.random()*16|0;return(l=="x"?n:n&3|8).toString(16)})},jsonMessageReplacer:U,jsonMessageReviver:ee}=e;let _;if(M){if(!we(M))throw new Error("Invalid WebSocket implementation provided");_=M}else typeof WebSocket!="undefined"?_=WebSocket:typeof global!="undefined"?_=global.WebSocket||global.MozWebSocket:typeof window!="undefined"&&(_=window.WebSocket||window.MozWebSocket);if(!_)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const I=_,h=(()=>{const r=(()=>{const n={};return{on(o,a){return n[o]=a,()=>{delete n[o]}},emit(o){var a;"id"in o&&((a=n[o.id])===null||a===void 0||a.call(n,o))}}})(),l={connecting:t!=null&&t.connecting?[t.connecting]:[],opened:t!=null&&t.opened?[t.opened]:[],connected:t!=null&&t.connected?[t.connected]:[],ping:t!=null&&t.ping?[t.ping]:[],pong:t!=null&&t.pong?[t.pong]:[],message:t!=null&&t.message?[r.emit,t.message]:[r.emit],closed:t!=null&&t.closed?[t.closed]:[],error:t!=null&&t.error?[t.error]:[]};return{onMessage:r.on,on(n,o){const a=l[n];return a.push(o),()=>{a.splice(a.indexOf(o),1)}},emit(n,...o){for(const a of[...l[n]])a(...o)}}})();function J(r){const l=[h.on("error",n=>{l.forEach(o=>o()),r(n)}),h.on("closed",n=>{l.forEach(o=>o()),r(n)})]}let $,P=0,X,j=!1,g=0,b=!1;async function W(){clearTimeout(X);const[r,l]=await($!=null?$:$=new Promise((a,T)=>(async()=>{if(j){if(await z(g),!P)return $=void 0,T({code:1e3,reason:"All Subscriptions Gone"});g++}h.emit("connecting");const s=new I(typeof i=="function"?await i():i,pe);let D,H;function Y(){isFinite(E)&&E>0&&(clearTimeout(H),H=setTimeout(()=>{s.readyState===I.OPEN&&(s.send(F({type:f.Ping})),h.emit("ping",!1,void 0))},E))}J(x=>{$=void 0,clearTimeout(D),clearTimeout(H),T(x),Q(x)&&x.code===4499&&(s.close(4499,"Terminated"),s.onerror=null,s.onclose=null)}),s.onerror=x=>h.emit("error",x),s.onclose=x=>h.emit("closed",x),s.onopen=async()=>{try{h.emit("opened",s);const x=typeof u=="function"?await u():u;if(s.readyState!==I.OPEN)return;s.send(F(x?{type:f.ConnectionInit,payload:x}:{type:f.ConnectionInit},U)),isFinite(d)&&d>0&&(D=setTimeout(()=>{s.close(A.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},d)),Y()}catch(x){h.emit("error",x),s.close(A.InternalClientError,ne(x instanceof Error?x.message:new Error(x).message,"Internal client error"))}};let B=!1;s.onmessage=({data:x})=>{try{const k=de(x,ee);if(h.emit("message",k),k.type==="ping"||k.type==="pong"){h.emit(k.type,!0,k.payload),k.type==="pong"?Y():w||(s.send(F(k.payload?{type:f.Pong,payload:k.payload}:{type:f.Pong})),h.emit("pong",!1,k.payload));return}if(B)return;if(k.type!==f.ConnectionAck)throw new Error(`First message cannot be of type ${k.type}`);clearTimeout(D),B=!0,h.emit("connected",s,k.payload),j=!1,g=0,a([s,new Promise((xe,be)=>J(be))])}catch(k){s.onmessage=null,h.emit("error",k),s.close(A.BadResponse,ne(k instanceof Error?k.message:new Error(k).message,"Bad response"))}}})()));r.readyState===I.CLOSING&&await l;let n=()=>{};const o=new Promise(a=>n=a);return[r,n,Promise.race([o.then(()=>{if(!P){const a=()=>r.close(1e3,"Normal Closure");isFinite(p)&&p>0?X=setTimeout(()=>{r.readyState===I.OPEN&&a()},p):a()}}),l])]}function C(r){if(Q(r)&&(me(r.code)||[A.InternalServerError,A.InternalClientError,A.BadRequest,A.BadResponse,A.Unauthorized,A.SubprotocolNotAcceptable,A.SubscriberAlreadyExists,A.TooManyInitialisationRequests].includes(r.code)))throw r;if(b)return!1;if(Q(r)&&r.code===1e3)return P>0;if(!S||g>=S||!q(r)||c!=null&&c(r))throw r;return j=!0}m||(async()=>{for(P++;;)try{const[,,r]=await W();await r}catch(r){try{if(!C(r))return}catch(l){return y==null?void 0:y(l)}}})();function oe(r,l){const n=v(r);let o=!1,a=!1,T=()=>{P--,o=!0};return(async()=>{for(P++;;)try{const[s,D,H]=await W();if(o)return D();const Y=h.onMessage(n,B=>{switch(B.type){case f.Next:{l.next(B.payload);return}case f.Error:{a=!0,o=!0,l.error(B.payload),T();return}case f.Complete:{o=!0,T();return}}});s.send(F({id:n,type:f.Subscribe,payload:r},U)),T=()=>{!o&&s.readyState===I.OPEN&&s.send(F({id:n,type:f.Complete},U)),P--,o=!0,D()},await H.finally(Y);return}catch(s){if(!C(s))return}})().then(()=>{a||l.complete()}).catch(s=>{l.error(s)}),()=>{o||T()}}return{on:h.on,subscribe:oe,iterate(r){const l=[],n={done:!1,error:null,resolve:()=>{}},o=oe(r,{next(T){l.push(T),n.resolve()},error(T){n.done=!0,n.error=T,n.resolve()},complete(){n.done=!0,n.resolve()}}),a=function(){return fe(this,arguments,function*(){for(;;){for(l.length||(yield L(new Promise(D=>n.resolve=D)));l.length;)yield yield L(l.shift());if(n.error)throw n.error;if(n.done)return yield L(void 0)}})}();return a.throw=async T=>(n.done||(n.done=!0,n.error=T,n.resolve()),{done:!0,value:void 0}),a.return=async()=>(o(),{done:!0,value:void 0}),a},async dispose(){if(b=!0,$){const[r]=await $;r.close(1e3,"Normal Closure")}},terminate(){$&&h.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Q(e){return G(e)&&"code"in e&&"reason"in e}function me(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function we(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}function ge(e){let i=!1,u=()=>{i=!0},m=!1,y,p;const E=ye({...e,on:{...e.on,error:w=>{var d,S;console.error(w),(S=(d=e.on)==null?void 0:d.error)==null||S.call(d,w),u()},ping:w=>{w||(p=setTimeout(()=>{E.terminate(),u()},5e3))},pong:w=>{w&&clearTimeout(p)},opened:w=>{var d,S;y=w,(S=(d=e.on)==null?void 0:d.opened)==null||S.call(d,y),m=!0,u=()=>{y.readyState===WebSocket.OPEN?y.close(4205,"Client Restart"):i=!0},i&&(i=!1,u())},closed:w=>{var d,S;(S=(d=e==null?void 0:e.on)==null?void 0:d.closed)==null||S.call(d,w),m=!1}}});return{...E,restart:()=>u(),isOpen:()=>m}}const K=typeof window!="undefined",he=({nhost:e,graphqlUrl:i,headers:u={},publicRole:m="public",fetchPolicy:y,cache:p=new R.InMemoryCache,connectToDevTools:E=K&&process.env.NODE_ENV==="development",onError:w,link:d,generateLinks:S})=>{const z=i||(e==null?void 0:e.graphql.httpUrl);if(!z)throw Error("Can't initialize the Apollo Client: no backend Url has been provided");const q=z,c=e==null?void 0:e.auth.client.interpreter;let t=null;const M=()=>{if(!(t!=null&&t.value))return!1;const b=3*1e3;return le(t.value).exp*1e3>Date.now()-b},v=()=>!!(t!=null&&t.value)&&!!(t!=null&&t.expiresAt)&&(t==null?void 0:t.expiresAt)>new Date&&M(),U=()=>!t||v(),ee=()=>{if(U())return Promise.resolve();const g=()=>U()?Promise.resolve(!0):new Promise(b=>{setTimeout(()=>g().then(b),100)});return g()},_=async()=>{await ee();const g={...u,"Sec-WebSocket-Protocol":"graphql-ws"};return t?g.authorization=`Bearer ${t.value}`:g.role=m,g},I=K?ge({url:q.startsWith("https")?q.replace(/^https/,"wss"):q.replace(/^http/,"ws"),shouldRetry:()=>!0,retryAttempts:100,retryWait:async g=>new Promise(C=>setTimeout(C,1e3*Math.pow(2,g)+Math.floor(Math.random()*3e3))),connectionParams:async()=>({headers:{...u,...await _()}})}):null,h=I?new se.GraphQLWsLink(I):null,J=ie.setContext(async(g,{headers:b})=>({headers:{...b,...await _()}})).concat(R.createHttpLink({uri:q})),$=h?R.split(({query:g})=>{const b=ae.getMainDefinition(g),{kind:W}=b;let C;return"operation"in b&&(C=b.operation),W==="OperationDefinition"&&C==="subscription"},h,J):J,P=[];w&&P.push(w),d&&P.push(d),P.push($);const X=R.from(S?S(P):P),j=new R.ApolloClient({cache:p||new R.InMemoryCache,ssrMode:!K,defaultOptions:{watchQuery:{fetchPolicy:y}},connectToDevTools:E,link:X});return c==null||c.onTransition(async(g,b)=>{if(["SIGNOUT","SIGNED_IN","TOKEN_CHANGED"].includes(b.type)){if(b.type==="SIGNOUT"||b.type==="TOKEN_CHANGED"&&g.context.accessToken.value===null){t=null;try{await j.resetStore()}catch(W){console.error("Error resetting Apollo client cache"),console.error(W)}return}if(t=g.context.accessToken,!K||!(I!=null&&I.isOpen()))return;I==null||I.restart()}}),j};O.createApolloClient=he,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=apollo.umd.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc