@urql/core
Advanced tools
Comparing version 1.10.7 to 1.11.0-debug.0
import { Source } from 'wonka'; | ||
import { Exchange, GraphQLRequest, Operation, OperationContext, OperationResult, OperationType, RequestPolicy, PromisifiedSource } from './types'; | ||
import { DocumentNode } from 'graphql'; | ||
import { Target } from './utils/Target'; | ||
/** Options for configuring the URQL [client]{@link Client}. */ | ||
@@ -29,2 +30,3 @@ export interface ClientOptions { | ||
export declare class Client { | ||
debugTarget?: Target; | ||
url: string; | ||
@@ -31,0 +33,0 @@ fetch?: typeof fetch; |
@@ -8,3 +8,3 @@ import { Client } from '../client'; | ||
export declare const cacheExchange: Exchange; | ||
export declare const afterMutation: (resultCache: ResultCache, operationCache: OperationCache, client: Client) => (response: OperationResult<any>) => void; | ||
export declare const afterMutation: (resultCache: ResultCache, operationCache: OperationCache, client: Client, dispatchDebug: <T extends string>(t: import("../types").DebugEventArg<T>) => void) => (response: OperationResult<any>) => void; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
import { Exchange } from '../types'; | ||
import { Exchange, ExchangeInput } from '../types'; | ||
/** This composes an array of Exchanges into a single ExchangeIO function */ | ||
export declare const composeExchanges: (exchanges: Exchange[]) => Exchange; | ||
export declare const composeExchanges: (exchanges: Exchange[]) => ({ client, forward, }: Pick<ExchangeInput, "client" | "forward">) => import("../types").ExchangeIO; |
@@ -1,3 +0,3 @@ | ||
import { ExchangeIO } from '../types'; | ||
import { ExchangeIO, ExchangeInput } from '../types'; | ||
/** This is always the last exchange in the chain; No operation should ever reach it */ | ||
export declare const fallbackExchangeIO: ExchangeIO; | ||
export declare const fallbackExchange: (args: Omit<ExchangeInput, 'forward'>) => ExchangeIO; |
@@ -7,4 +7,4 @@ export { ssrExchange } from './ssr'; | ||
export { fetchExchange } from './fetch'; | ||
export { fallbackExchangeIO } from './fallback'; | ||
export { fallbackExchange } from './fallback'; | ||
export { composeExchanges } from './compose'; | ||
export declare const defaultExchanges: import("..").Exchange[]; |
@@ -6,4 +6,2 @@ import { DocumentNode } from 'graphql'; | ||
export { ExecutionResult } from 'graphql'; | ||
/** Utility type to Omit keys from an interface/object type */ | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
export declare type PromisifiedSource<T = any> = Source<T> & { | ||
@@ -64,4 +62,5 @@ toPromise: () => Promise<T>; | ||
export interface ExchangeInput { | ||
client: Client; | ||
forward: ExchangeIO; | ||
client: Client; | ||
dispatchDebug: <T extends keyof DebugEventTypes | string>(t: DebugEventArg<T>) => void; | ||
} | ||
@@ -72,1 +71,40 @@ /** Function responsible for listening for streamed [operations]{@link Operation}. */ | ||
export declare type ExchangeIO = (ops$: Source<Operation>) => Source<OperationResult>; | ||
/** Debug event types (interfaced for declaration merging). */ | ||
export interface DebugEventTypes { | ||
cacheHit: { | ||
value: any; | ||
}; | ||
cacheInvalidation: { | ||
typenames: string[]; | ||
response: OperationResult; | ||
}; | ||
fetchRequest: { | ||
url: string; | ||
fetchOptions: RequestInit; | ||
}; | ||
fetchSuccess: { | ||
url: string; | ||
fetchOptions: RequestInit; | ||
value: object; | ||
}; | ||
fetchError: { | ||
url: string; | ||
fetchOptions: RequestInit; | ||
value: Error; | ||
}; | ||
retryRetrying: { | ||
retryCount: number; | ||
}; | ||
} | ||
export declare type DebugEventArg<T extends keyof DebugEventTypes | string> = { | ||
type: T; | ||
message: string; | ||
operation: Operation; | ||
} & (T extends keyof DebugEventTypes ? { | ||
data: DebugEventTypes[T]; | ||
} : { | ||
data?: any; | ||
}); | ||
export declare type DebugEvent<T extends keyof DebugEventTypes | string> = DebugEventArg<T> & { | ||
source: string; | ||
}; |
@@ -9,2 +9,3 @@ export * from './error'; | ||
export * from './withPromise'; | ||
export * from './Target'; | ||
export declare const noop: () => void; |
@@ -192,3 +192,19 @@ "use strict"; | ||
var shouldSkip = function(a) { | ||
var Target = function() { | ||
var a = this; | ||
this.listeners = []; | ||
this.addEventListener = function(b) { | ||
a.listeners = a.listeners.concat([ b ]); | ||
}; | ||
this.removeEventListener = function(b) { | ||
a.listeners = a.listeners.filter((function(a) { | ||
return a !== b; | ||
})); | ||
}; | ||
this.dispatchEvent = function(b) { | ||
a.listeners.forEach((function(a) { | ||
a(b); | ||
})); | ||
}; | ||
}, noop = function() {}, shouldSkip = function(a) { | ||
return "subscription" !== (a = a.operationName) && "query" !== a; | ||
@@ -232,2 +248,11 @@ }; | ||
var b = h.get(a.key); | ||
"production" !== process.env.NODE_ENV && k(_extends({}, { | ||
operation: a | ||
}, b ? { | ||
type: "cacheHit", | ||
message: "The result was successfully retried from the cache" | ||
} : { | ||
type: "cacheMiss", | ||
message: "The result could not be retrieved from the cache" | ||
})); | ||
b = _extends({}, b, { | ||
@@ -242,13 +267,13 @@ operation: addMetadata(a, { | ||
function c(a) { | ||
return !shouldSkip$1(a) && n(a); | ||
return !shouldSkip$1(a) && p(a); | ||
} | ||
function d(a) { | ||
a.operation && "mutation" === a.operation.operationName ? l(a) : a.operation && "query" === a.operation.operationName && m(a); | ||
a.operation && "mutation" === a.operation.operationName ? l(a) : a.operation && "query" === a.operation.operationName && q(a); | ||
} | ||
function f(a) { | ||
return !shouldSkip$1(a) && !n(a); | ||
return !shouldSkip$1(a) && !p(a); | ||
} | ||
var g = a.forward, e = a.client, h = new Map; | ||
var g = a.forward, e = a.client, k = a.dispatchDebug, h = new Map; | ||
a = Object.create(null); | ||
var k = _ref$1, l = afterMutation(h, a, e), m = afterQuery(h, a), n = function(a) { | ||
var m = _ref$1, l = afterMutation(h, a, e, k), q = afterQuery(h, a), p = function(a) { | ||
var c = a.context.requestPolicy; | ||
@@ -260,3 +285,3 @@ return "query" === a.operationName && "network-only" !== c && ("cache-only" === c || h.has(a.key)); | ||
a = wonka.map(b)(wonka.filter(c)(e)); | ||
e = wonka.tap(d)(g(wonka.filter(_ref5)(wonka.map(_ref6)(wonka.merge([ wonka.map(k)(wonka.filter(f)(e)), wonka.filter(_ref8)(e) ]))))); | ||
e = wonka.tap(d)(g(wonka.filter(_ref5)(wonka.map(_ref6)(wonka.merge([ wonka.map(m)(wonka.filter(f)(e)), wonka.filter(_ref8)(e) ]))))); | ||
return wonka.merge([ a, e ]); | ||
@@ -270,8 +295,8 @@ }; | ||
})); | ||
}, afterMutation = function(a, b, c) { | ||
function d(b) { | ||
}, afterMutation = function(a, b, c, d) { | ||
function f(b) { | ||
if (a.has(b)) { | ||
var g = a.get(b).operation; | ||
var d = a.get(b).operation; | ||
a.delete(b); | ||
reexecuteOperation(c, g); | ||
reexecuteOperation(c, d); | ||
} | ||
@@ -281,10 +306,20 @@ } | ||
function c(a) { | ||
e.add(a); | ||
g.add(a); | ||
} | ||
var e = new Set, f = a.operation.context.additionalTypenames; | ||
collectTypesFromResponse(a.data).concat(f || []).forEach((function(a) { | ||
var g = new Set, h = a.operation.context.additionalTypenames; | ||
h = collectTypesFromResponse(a.data).concat(h || []); | ||
"production" !== process.env.NODE_ENV && d({ | ||
type: "cacheInvalidation", | ||
message: "The following typenames have been invalidated: " + h, | ||
operation: a.operation, | ||
data: { | ||
typenames: h, | ||
response: a | ||
} | ||
}); | ||
h.forEach((function(a) { | ||
(a = b[a] || (b[a] = new Set)).forEach(c); | ||
a.clear(); | ||
})); | ||
e.forEach(d); | ||
g.forEach(f); | ||
}; | ||
@@ -313,19 +348,24 @@ }, afterQuery = function(a, b) { | ||
var dedupExchange = function(a) { | ||
var b = a.forward, c = new Set, d = function(a) { | ||
var b = a.key; | ||
if ("teardown" === (a = a.operationName)) { | ||
return c.delete(b), !0; | ||
var b = a.forward, c = a.dispatchDebug, d = new Set, f = function(a) { | ||
var b = a.key, e = a.operationName; | ||
if ("teardown" === e) { | ||
return d.delete(b), !0; | ||
} | ||
if ("query" !== a && "subscription" !== a) { | ||
if ("query" !== e && "subscription" !== e) { | ||
return !0; | ||
} | ||
a = c.has(b); | ||
c.add(b); | ||
return !a; | ||
}, f = function(a) { | ||
c.delete(a.operation.key); | ||
e = d.has(b); | ||
d.add(b); | ||
e && "production" !== process.env.NODE_ENV && c({ | ||
type: "dedup", | ||
message: "An operation has been deduped.", | ||
operation: a | ||
}); | ||
return !e; | ||
}, g = function(a) { | ||
d.delete(a.operation.key); | ||
}; | ||
return function(a) { | ||
a = wonka.filter(d)(a); | ||
return wonka.tap(f)(b(a)); | ||
a = wonka.filter(f)(a); | ||
return wonka.tap(g)(b(a)); | ||
}; | ||
@@ -343,13 +383,13 @@ }; | ||
var fetchExchange = function(a) { | ||
var b = a.forward; | ||
var b = a.forward, c = a.dispatchDebug; | ||
return function(a) { | ||
var c = wonka.share(a); | ||
var d = wonka.share(a); | ||
a = wonka.mergeMap((function(a) { | ||
var b = a.key, d = wonka.filter((function(a) { | ||
var b = a.key, g = wonka.filter((function(a) { | ||
return "teardown" === a.operationName && a.key === b; | ||
}))(c); | ||
return wonka.takeUntil(d)(createFetchSource(a, "query" === a.operationName && !!a.context.preferGetMethod)); | ||
}))(wonka.filter(_ref$2)(c)); | ||
var f = b(wonka.filter(_ref2$2)(c)); | ||
return wonka.merge([ a, f ]); | ||
}))(d); | ||
return wonka.takeUntil(g)(createFetchSource(c, a, "query" === a.operationName && !!a.context.preferGetMethod)); | ||
}))(wonka.filter(_ref$2)(d)); | ||
var g = b(wonka.filter(_ref2$2)(d)); | ||
return wonka.merge([ a, g ]); | ||
}; | ||
@@ -362,50 +402,80 @@ }; | ||
var createFetchSource = function(a, b) { | ||
if ("production" !== process.env.NODE_ENV && "subscription" === a.operationName) { | ||
var createFetchSource = function(a, b, c) { | ||
if ("production" !== process.env.NODE_ENV && "subscription" === b.operationName) { | ||
throw Error("Received a subscription operation in the httpExchange. You are probably trying to create a subscription. Have you added a subscriptionExchange?"); | ||
} | ||
return wonka.make((function(c) { | ||
var d = c.next, f = c.complete, g = "undefined" != typeof AbortController ? new AbortController : void 0; | ||
c = "function" == typeof (c = a.context).fetchOptions ? c.fetchOptions() : c.fetchOptions || {}; | ||
var e = function(a) { | ||
return wonka.make((function(d) { | ||
var f = d.next, g = d.complete, e = "undefined" != typeof AbortController ? new AbortController : void 0; | ||
d = "function" == typeof (d = b.context).fetchOptions ? d.fetchOptions() : d.fetchOptions || {}; | ||
var k = function(a) { | ||
return (a = a.definitions.find(_ref3$2)) ? a.name.value : null; | ||
}(a.query), h = { | ||
query: graphql.print(a.query), | ||
variables: a.variables | ||
}(b.query), h = { | ||
query: graphql.print(b.query), | ||
variables: b.variables | ||
}; | ||
null !== e && (h.operationName = e); | ||
var k = _extends({}, c, { | ||
body: b ? void 0 : JSON.stringify(h), | ||
method: b ? "GET" : "POST", | ||
null !== k && (h.operationName = k); | ||
var m = _extends({}, d, { | ||
body: c ? void 0 : JSON.stringify(h), | ||
method: c ? "GET" : "POST", | ||
headers: _extends({}, { | ||
"content-type": "application/json" | ||
}, c.headers), | ||
signal: void 0 !== g ? g.signal : void 0 | ||
}, d.headers), | ||
signal: void 0 !== e ? e.signal : void 0 | ||
}); | ||
b && (a.context.url = convertToGet(a.context.url, h)); | ||
c && (b.context.url = convertToGet(b.context.url, h)); | ||
var l = !1; | ||
Promise.resolve().then((function() { | ||
return l ? void 0 : executeFetch(a, k); | ||
return l ? void 0 : executeFetch(a, b, m); | ||
})).then((function(a) { | ||
l || (l = !0, a && d(a), f()); | ||
l || (l = !0, a && f(a), g()); | ||
})); | ||
return function() { | ||
l = !0; | ||
void 0 !== g && g.abort(); | ||
void 0 !== e && e.abort(); | ||
}; | ||
})); | ||
}, executeFetch = function(a, b) { | ||
var d, c = a.context; | ||
return (c.fetch || fetch)(c.url, b).then((function(a) { | ||
var c = a.status; | ||
d = a; | ||
if (200 > c || c >= ("manual" === b.redirect ? 400 : 300)) { | ||
}, executeFetch = function(a, b, c) { | ||
var d = b.context, f = d.url; | ||
d = d.fetch; | ||
var g; | ||
"production" !== process.env.NODE_ENV && a({ | ||
type: "fetchRequest", | ||
message: "A fetch request is being executed.", | ||
operation: b, | ||
data: { | ||
url: f, | ||
fetchOptions: c | ||
} | ||
}); | ||
return (d || fetch)(f, c).then((function(a) { | ||
var b = a.status; | ||
g = a; | ||
if (200 > b || b >= ("manual" === c.redirect ? 400 : 300)) { | ||
throw Error(a.statusText); | ||
} | ||
return a.json(); | ||
})).then((function(b) { | ||
return makeResult(a, b, d); | ||
})).catch((function(b) { | ||
if ("AbortError" !== b.name) { | ||
return makeErrorResult(a, b, d); | ||
})).then((function(d) { | ||
"production" !== process.env.NODE_ENV && a({ | ||
type: "fetchSuccess", | ||
message: "A successful fetch response has been returned.", | ||
operation: b, | ||
data: { | ||
url: f, | ||
fetchOptions: c, | ||
value: d | ||
} | ||
}); | ||
return makeResult(b, d, g); | ||
})).catch((function(d) { | ||
if ("AbortError" !== d.name) { | ||
return "production" !== process.env.NODE_ENV && a({ | ||
type: "fetchError", | ||
message: d.name, | ||
operation: b, | ||
data: { | ||
url: f, | ||
fetchOptions: c, | ||
value: d | ||
} | ||
}), makeErrorResult(b, d, g); | ||
} | ||
@@ -423,14 +493,34 @@ })); | ||
function _ref2$3(a) { | ||
"teardown" !== (a = a.operationName) && "production" !== process.env.NODE_ENV && console.warn('No exchange has handled operations of type "' + a + "\". Check whether you've added an exchange responsible for these operations."); | ||
} | ||
var fallbackExchange = function(a) { | ||
function b(a) { | ||
if ("teardown" !== a.operationName && "production" !== process.env.NODE_ENV) { | ||
var b = 'No exchange has handled operations of type "' + a.operationName + "\". Check whether you've added an exchange responsible for these operations."; | ||
"production" !== process.env.NODE_ENV && c({ | ||
type: "fallbackCatch", | ||
message: b, | ||
operation: a | ||
}); | ||
console.warn(b); | ||
} | ||
} | ||
var c = a.dispatchDebug; | ||
return function(a) { | ||
return wonka.filter(_ref$3)(wonka.tap(b)(a)); | ||
}; | ||
}; | ||
var fallbackExchangeIO = function(a) { | ||
return wonka.filter(_ref$3)(wonka.tap(_ref2$3)(a)); | ||
}, composeExchanges = function(a) { | ||
return 1 === a.length ? a[0] : function(b) { | ||
return a.reduceRight((function(a, d) { | ||
return d({ | ||
client: b.client, | ||
forward: a | ||
function _ref$4() {} | ||
var composeExchanges = function(a) { | ||
return function(b) { | ||
var c = b.client; | ||
return a.reduceRight((function(a, b) { | ||
return b({ | ||
client: c, | ||
forward: a, | ||
dispatchDebug: "production" !== process.env.NODE_ENV ? function(a) { | ||
return c.debugTarget.dispatchEvent(_extends({}, a, { | ||
source: b.name | ||
})); | ||
} : _ref$4 | ||
}); | ||
@@ -480,2 +570,3 @@ }), b.forward); | ||
}; | ||
"production" !== process.env.NODE_ENV && (this.debugTarget = new Target); | ||
if ("production" !== process.env.NODE_ENV && !a.url) { | ||
@@ -508,3 +599,6 @@ throw Error("You are creating an urql-client without a url."); | ||
client: this, | ||
forward: fallbackExchangeIO | ||
forward: composeExchanges([ fallbackExchange ])({ | ||
client: this, | ||
forward: noop | ||
}) | ||
})(this.operations$)); | ||
@@ -527,3 +621,3 @@ wonka.publish(this.results$); | ||
function _ref2$4(a) { | ||
function _ref2$3(a) { | ||
a.data = maskTypename(a.data); | ||
@@ -537,3 +631,3 @@ return a; | ||
}))(this.results$); | ||
this.maskTypename && (g = wonka.map(_ref2$4)(g)); | ||
this.maskTypename && (g = wonka.map(_ref2$3)(g)); | ||
if ("mutation" === f) { | ||
@@ -613,3 +707,3 @@ return wonka.take(1)(wonka.onStart((function b() { | ||
exports.fallbackExchangeIO = fallbackExchangeIO; | ||
exports.fallbackExchange = fallbackExchange; | ||
@@ -628,3 +722,3 @@ exports.fetchExchange = fetchExchange; | ||
function b(a) { | ||
return !h(a); | ||
return !k(a); | ||
} | ||
@@ -646,3 +740,3 @@ function c(a) { | ||
function d(a) { | ||
return h(a); | ||
return k(a); | ||
} | ||
@@ -667,22 +761,22 @@ function f(a) { | ||
} | ||
var e = {}, h = function(a) { | ||
var e = {}, k = function(a) { | ||
return !shouldSkip(a) && void 0 !== e[a.key]; | ||
}, k = function(e) { | ||
}, h = function(e) { | ||
var h = e.client, k = e.forward; | ||
return function(e) { | ||
var p = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, m = wonka.share(e); | ||
e = k(wonka.filter(b)(m)); | ||
m = wonka.map(c)(wonka.filter(d)(m)); | ||
p ? m = wonka.tap(g)(m) : e = wonka.tap(f)(e); | ||
return wonka.merge([ e, m ]); | ||
var r = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, n = wonka.share(e); | ||
e = k(wonka.filter(b)(n)); | ||
n = wonka.map(c)(wonka.filter(d)(n)); | ||
r ? n = wonka.tap(g)(n) : e = wonka.tap(f)(e); | ||
return wonka.merge([ e, n ]); | ||
}; | ||
}; | ||
k.restoreData = function(a) { | ||
h.restoreData = function(a) { | ||
return _extends(e, a); | ||
}; | ||
k.extractData = function() { | ||
h.extractData = function() { | ||
return _extends({}, e); | ||
}; | ||
a && a.initialState && k.restoreData(a.initialState); | ||
return k; | ||
a && a.initialState && h.restoreData(a.initialState); | ||
return h; | ||
}; | ||
@@ -698,6 +792,6 @@ | ||
return function(a) { | ||
function g(a) { | ||
return !l(a); | ||
function d(a) { | ||
return !m(a); | ||
} | ||
var d = a.client, f = a.forward, k = function(a) { | ||
var e = a.client, f = a.forward, h = function(a) { | ||
var b = c({ | ||
@@ -710,18 +804,18 @@ key: a.key.toString(36), | ||
return wonka.make((function(c) { | ||
function g(b) { | ||
function d(b) { | ||
return h(makeResult(a, b)); | ||
} | ||
function e(b) { | ||
function g(b) { | ||
return h(makeErrorResult(a, b)); | ||
} | ||
function f() { | ||
m || (m = !0, "subscription" === a.operationName && d.reexecuteOperation(_extends({}, a, { | ||
l || (l = !0, "subscription" === a.operationName && e.reexecuteOperation(_extends({}, a, { | ||
operationName: "teardown" | ||
})), k()); | ||
} | ||
var l, h = c.next, k = c.complete, m = !1; | ||
var m, h = c.next, k = c.complete, l = !1; | ||
Promise.resolve().then((function() { | ||
m || (l = b.subscribe({ | ||
next: g, | ||
error: e, | ||
l || (m = b.subscribe({ | ||
next: d, | ||
error: g, | ||
complete: f | ||
@@ -731,16 +825,16 @@ })); | ||
return function() { | ||
m = !0; | ||
l && l.unsubscribe(); | ||
l = !0; | ||
m && m.unsubscribe(); | ||
}; | ||
})); | ||
}, l = b; | ||
}, m = b; | ||
return function(a) { | ||
var b = wonka.share(a); | ||
a = wonka.mergeMap((function(a) { | ||
var c = a.key, g = wonka.filter((function(a) { | ||
var c = a.key, d = wonka.filter((function(a) { | ||
return "teardown" === a.operationName && a.key === c; | ||
}))(b); | ||
return wonka.takeUntil(g)(k(a)); | ||
}))(wonka.filter(l)(b)); | ||
var c = f(wonka.filter(g)(b)); | ||
return wonka.takeUntil(d)(h(a)); | ||
}))(wonka.filter(m)(b)); | ||
var c = f(wonka.filter(d)(b)); | ||
return wonka.merge([ a, c ]); | ||
@@ -747,0 +841,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("wonka"),t=require("graphql");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n=function(e){return"string"==typeof e?new t.GraphQLError(e):"object"==typeof e&&e.message?new t.GraphQLError(e.message,e.nodes,e.source,e.positions,e.path,e,e.extensions||{}):e};function o(){return this.message}var i=function(e){function t(t){var r=t.networkError,o=t.response,i=function(e,t){var r="";return void 0!==e?r="[Network] "+e.message:(void 0!==t&&t.forEach((function(e){r+="[GraphQL] "+e.message+"\n"})),r.trim())}(r,t=(t.graphQLErrors||[]).map(n));e.call(this,i),this.name="CombinedError",this.message=i,this.graphQLErrors=t,this.networkError=r,this.response=o}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toString=o,t}(Error),a=function(e,t){e|=0;for(var r=0,n=0|t.length;r<n;r++)e=(e<<5)+e+t.charCodeAt(r);return e},u=new Set,c=new WeakMap,s=function(e){if(null===e||u.has(e))return"null";if("object"!=typeof e)return JSON.stringify(e)||"";if(e.toJSON)return e.toJSON();if(Array.isArray(e)){for(var t="[",r=0,n=e.length;r<n;r++){0<r&&(t+=",");var o=s(e[r]);t+=0<o.length?o:"null"}return t+"]"}if(!(t=Object.keys(e).sort()).length&&e.constructor&&e.constructor!==Object)return t=c.get(e)||Math.random().toString(36).slice(2),c.set(e,t),'{"__key":"'+t+'"}';for(u.add(e),r="{",n=0,o=t.length;n<o;n++){var i=t[n],a=s(e[i]);a&&(1<r.length&&(r+=","),r+=s(i)+":"+a)}return u.delete(e),r+"}"},f=function(e){return u.clear(),s(e)},p=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/[\s,]+/g," ").trim())},l=Object.create(null),h=function(e,r){if("string"==typeof e){var n=p(e);e=void 0!==l[n]?l[n]:t.parse(e)}else void 0!==e.__key?n=e.__key:(n=p(t.print(e)),e=void 0!==l[n]?l[n]:e);return l[n]=e,e.__key=n,{key:r?a(n,f(r))>>>0:n,query:e,variables:r||{}}},y=function(e,t){return r({},e,{context:r({},e.context,{meta:r({},e.context.meta,t)})})},d=function(e,t,r){return{operation:e,data:t.data,error:Array.isArray(t.errors)?new i({graphQLErrors:t.errors,response:r}):void 0,extensions:"object"==typeof t.extensions&&t.extensions||void 0}},v=function(e,t,r){return{operation:e,data:void 0,error:new i({networkError:t,response:r}),extensions:void 0}},m=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){m(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):m(e[r],t);return t};function x(e,t,r){return r.indexOf(e)===t}var g=function(e){return m(e).filter(x)};function k(e){return e.kind===t.Kind.FIELD&&"__typename"===e.name.value}var O=function(e){if(e.selectionSet&&!e.selectionSet.selections.some(k))return e.selectionSet.selections.push({kind:t.Kind.FIELD,name:{kind:t.Kind.NAME,value:"__typename"}}),e},b=function(e){return t.visit(e,{Field:O,InlineFragment:O})},E=function(e){return e&&"object"==typeof e?Object.keys(e).reduce((function(t,r){var n=e[r];return"__typename"===r?Object.defineProperty(t,"__typename",{enumerable:!1,value:n}):t[r]=Array.isArray(n)?n.map(E):n&&"object"==typeof n&&"__typename"in n?E(n):n,t}),{}):e};function q(t){return t.toPromise=function(){return e.toPromise(e.take(1)(t))},t}var w=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function N(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var S=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function _(e){return r({},e,{query:b(e.query)})}function j(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function P(e){return y(e,{cacheOutcome:"miss"})}function Q(e){return S(e)}var A=function(t){function n(e){var t=s.get(e.key);return t=r({},t,{operation:y(e,{cacheOutcome:t?"hit":"miss"})}),"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,R(c,e)),t}function o(e){return!S(e)&&h(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?p(e):e.operation&&"query"===e.operation.operationName&&l(e)}function a(e){return!S(e)&&!h(e)}var u=t.forward,c=t.client,s=new Map;t=Object.create(null);var f=_,p=L(s,t,c),l=M(s,t),h=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(t){var r=e.share(t);return t=e.map(n)(e.filter(o)(r)),r=e.tap(i)(u(e.filter(j)(e.map(P)(e.merge([e.map(f)(e.filter(a)(r)),e.filter(Q)(r)]))))),e.merge([t,r])}},R=function(e,t){return e.reexecuteOperation(r({},t,{context:r({},t.context,{requestPolicy:"network-only"})}))},L=function(e,t,r){function n(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),R(r,n)}}return function(e){function r(e){o.add(e)}var o=new Set,i=e.operation.context.additionalTypenames;g(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),o.forEach(n)}},M=function(e,t){return function(r){var n=r.operation,o=r.data,i=n.context.additionalTypenames;null!=o&&(e.set(n.key,{operation:n,data:o,error:r.error}),g(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},C=function(t){var r=t.forward,n=new Set,o=function(e){var t=e.key;return"teardown"===(e=e.operationName)?(n.delete(t),!0):"query"!==e&&"subscription"!==e||(e=n.has(t),n.add(t),!e)},i=function(e){n.delete(e.operation.key)};return function(t){return t=e.filter(o)(t),e.tap(i)(r(t))}};function I(e){return"query"===e.operationName||"mutation"===e.operationName}function T(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var G=function(t){var r=t.forward;return function(t){var n=e.share(t);t=e.mergeMap((function(t){var r=t.key,o=e.filter((function(e){return"teardown"===e.operationName&&e.key===r}))(n);return e.takeUntil(o)($(t,"query"===t.operationName&&!!t.context.preferGetMethod))}))(e.filter(I)(n));var o=r(e.filter(T)(n));return e.merge([t,o])}};function D(e){return e.kind===t.Kind.OPERATION_DEFINITION&&e.name}var $=function(n,o){return e.make((function(e){var i=e.next,a=e.complete,u="undefined"!=typeof AbortController?new AbortController:void 0;e="function"==typeof(e=n.context).fetchOptions?e.fetchOptions():e.fetchOptions||{};var c=function(e){return(e=e.definitions.find(D))?e.name.value:null}(n.query),s={query:t.print(n.query),variables:n.variables};null!==c&&(s.operationName=c);var f=r({},e,{body:o?void 0:JSON.stringify(s),method:o?"GET":"POST",headers:r({},{"content-type":"application/json"},e.headers),signal:void 0!==u?u.signal:void 0});o&&(n.context.url=J(n.context.url,s));var p=!1;return Promise.resolve().then((function(){return p?void 0:F(n,f)})).then((function(e){p||(p=!0,e&&i(e),a())})),function(){p=!0,void 0!==u&&u.abort()}}))},F=function(e,t){var r,n=e.context;return(n.fetch||fetch)(n.url,t).then((function(e){var n=e.status;if(r=e,200>n||n>=("manual"===t.redirect?400:300))throw Error(e.statusText);return e.json()})).then((function(t){return d(e,t,r)})).catch((function(t){if("AbortError"!==t.name)return v(e,t,r)}))},J=function(e,t){var r=["query="+encodeURIComponent(t.query)];return t.variables&&r.push("variables="+encodeURIComponent(JSON.stringify(t.variables))),e+"?"+r.join("&")};function U(){return!1}function K(e){}var V=function(t){return e.filter(U)(e.tap(K)(t))},W=function(e){return 1===e.length?e[0]:function(t){return e.reduceRight((function(e,r){return r({client:t.client,forward:e})}),t.forward)}},z=[C,A,G],B=function(t){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(e){return r({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},e,{requestPolicy:(e||{}).requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return{key:t.key,query:t.query,variables:t.variables,operationName:e,context:n.createOperationContext(r)}},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),n.dispatchOperation())},this.executeQuery=function(t,r){t=n.createRequestOperation("query",t,r);var o=n.executeRequestOperation(t);return(t=t.context.pollInterval)?e.switchMap((function(){return o}))(e.merge([e.fromValue(0),e.interval(t)])):o},this.executeSubscription=function(e,t){return e=n.createRequestOperation("subscription",e,t),n.executeRequestOperation(e)},this.executeMutation=function(e,t){return e=n.createRequestOperation("mutation",e,t),n.executeRequestOperation(e)},this.url=t.url,this.fetchOptions=t.fetchOptions,this.fetch=t.fetch,this.suspense=!!t.suspense,this.requestPolicy=t.requestPolicy||"cache-first",this.preferGetMethod=!!t.preferGetMethod,this.maskTypename=!!t.maskTypename;var o=e.makeSubject(),i=o.next;this.operations$=o.source;var a=!1;this.dispatchOperation=function(e){if(a)e&&i(e);else{for(a=!0,e&&i(e);e=n.queue.shift();)i(e);a=!1}},t=W(void 0!==t.exchanges?t.exchanges:z),this.results$=e.share(t({client:this,forward:V})(this.operations$)),e.publish(this.results$)};function H(e){return e.data=E(e.data),e}B.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},B.prototype.onOperationEnd=function(e){var t=e.key,n=this.activeOperations[t]||0;0>=(this.activeOperations[t]=0>=n?0:n-1)&&this.dispatchOperation(r({},e,{operationName:"teardown"}))},B.prototype.executeRequestOperation=function(t){var r=this,n=t.key,o=t.operationName,i=e.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=e.map(H)(i)),"mutation"===o)return e.take(1)(e.onStart((function(){return r.dispatchOperation(t)}))(i));var a=e.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=e.onEnd((function(){r.onOperationEnd(t)}))(e.onStart((function(){r.onOperationStart(t)}))(e.takeUntil(a)(i))),!1!==t.context.suspense&&this.suspense&&"query"===o?function(t){return function(r){var n=e.share(t),o=!1,i=!1;if(e.onPush((function(){return o=!0}))(e.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),e.toPromise(e.take(1)(n))}}(i):i},B.prototype.query=function(e,t,n){return n&&"boolean"==typeof n.suspense||(n=r({},n,{suspense:!1})),q(this.executeQuery(h(e,t),n))},B.prototype.readQuery=function(t,r,n){var o=null;return e.subscribe((function(e){o=e}))(this.executeQuery(h(t,r),n)).unsubscribe(),o},B.prototype.mutation=function(e,t,r){return q(this.executeMutation(h(e,t),r))},exports.Client=B,exports.CombinedError=i,exports.cacheExchange=A,exports.composeExchanges=W,exports.createClient=function(e){return new B(e)},exports.createRequest=h,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=C,exports.defaultExchanges=z,exports.fallbackExchangeIO=V,exports.fetchExchange=G,exports.formatDocument=b,exports.makeErrorResult=v,exports.makeResult=d,exports.maskTypename=E,exports.ssrExchange=function(t){function n(e){return!f(e)}function o(e){return function(e,t){var r=t.error;return{operation:e,data:t.data,extensions:void 0,error:r?new i({networkError:r.networkError?Error(r.networkError):void 0,graphQLErrors:r.graphQLErrors&&r.graphQLErrors.length?r.graphQLErrors:void 0}):void 0}}(e,s[e.key])}function a(e){return f(e)}function u(e){var t=e.operation;w(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(N),networkError:t.networkError?""+t.networkError:void 0}),e}(e),s[t.key]=e)}function c(e){delete s[e.operation.key]}var s={},f=function(e){return!w(e)&&void 0!==s[e.key]},p=function(r){var i=r.client,s=r.forward;return function(r){var f=t&&"boolean"==typeof t.isClient?!!t.isClient:!i.suspense,p=e.share(r);return r=s(e.filter(n)(p)),p=e.map(o)(e.filter(a)(p)),f?p=e.tap(c)(p):r=e.tap(u)(r),e.merge([r,p])}};return p.restoreData=function(e){return r(s,e)},p.extractData=function(){return r({},s)},t&&t.initialState&&p.restoreData(t.initialState),p},exports.stringifyVariables=f,exports.subscriptionExchange=function(n){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=n.forwardSubscription,a=n.enableAllOperations;return function(n){function a(e){return!f(e)}var u=n.client,c=n.forward,s=function(n){var o=i({key:n.key.toString(36),query:t.print(n.query),variables:n.variables,context:r({},n.context)});return e.make((function(e){function t(e){return s(d(n,e))}function i(e){return s(v(n,e))}function a(){p||(p=!0,"subscription"===n.operationName&&u.reexecuteOperation(r({},n,{operationName:"teardown"})),f())}var c,s=e.next,f=e.complete,p=!1;return Promise.resolve().then((function(){p||(c=o.subscribe({next:t,error:i,complete:a}))})),function(){p=!0,c&&c.unsubscribe()}}))},f=o;return function(t){var r=e.share(t);t=e.mergeMap((function(t){var n=t.key,o=e.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return e.takeUntil(o)(s(t))}))(e.filter(f)(r));var n=c(e.filter(a)(r));return e.merge([t,n])}}}; | ||
"use strict";var e=require("wonka"),t=require("graphql");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n=function(e){return"string"==typeof e?new t.GraphQLError(e):"object"==typeof e&&e.message?new t.GraphQLError(e.message,e.nodes,e.source,e.positions,e.path,e,e.extensions||{}):e};function o(){return this.message}var i=function(e){function t(t){var r=t.networkError,o=t.response,i=function(e,t){var r="";return void 0!==e?r="[Network] "+e.message:(void 0!==t&&t.forEach((function(e){r+="[GraphQL] "+e.message+"\n"})),r.trim())}(r,t=(t.graphQLErrors||[]).map(n));e.call(this,i),this.name="CombinedError",this.message=i,this.graphQLErrors=t,this.networkError=r,this.response=o}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toString=o,t}(Error),a=function(e,t){e|=0;for(var r=0,n=0|t.length;r<n;r++)e=(e<<5)+e+t.charCodeAt(r);return e},u=new Set,c=new WeakMap,s=function(e){if(null===e||u.has(e))return"null";if("object"!=typeof e)return JSON.stringify(e)||"";if(e.toJSON)return e.toJSON();if(Array.isArray(e)){for(var t="[",r=0,n=e.length;r<n;r++){0<r&&(t+=",");var o=s(e[r]);t+=0<o.length?o:"null"}return t+"]"}if(!(t=Object.keys(e).sort()).length&&e.constructor&&e.constructor!==Object)return t=c.get(e)||Math.random().toString(36).slice(2),c.set(e,t),'{"__key":"'+t+'"}';for(u.add(e),r="{",n=0,o=t.length;n<o;n++){var i=t[n],a=s(e[i]);a&&(1<r.length&&(r+=","),r+=s(i)+":"+a)}return u.delete(e),r+"}"},f=function(e){return u.clear(),s(e)},p=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/[\s,]+/g," ").trim())},l=Object.create(null),h=function(e,r){if("string"==typeof e){var n=p(e);e=void 0!==l[n]?l[n]:t.parse(e)}else void 0!==e.__key?n=e.__key:(n=p(t.print(e)),e=void 0!==l[n]?l[n]:e);return l[n]=e,e.__key=n,{key:r?a(n,f(r))>>>0:n,query:e,variables:r||{}}},y=function(e,t){return r({},e,{context:r({},e.context,{meta:r({},e.context.meta,t)})})},d=function(e,t,r){return{operation:e,data:t.data,error:Array.isArray(t.errors)?new i({graphQLErrors:t.errors,response:r}):void 0,extensions:"object"==typeof t.extensions&&t.extensions||void 0}},v=function(e,t,r){return{operation:e,data:void 0,error:new i({networkError:t,response:r}),extensions:void 0}},m=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){m(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):m(e[r],t);return t};function x(e,t,r){return r.indexOf(e)===t}var g=function(e){return m(e).filter(x)};function k(e){return e.kind===t.Kind.FIELD&&"__typename"===e.name.value}var b=function(e){if(e.selectionSet&&!e.selectionSet.selections.some(k))return e.selectionSet.selections.push({kind:t.Kind.FIELD,name:{kind:t.Kind.NAME,value:"__typename"}}),e},O=function(e){return t.visit(e,{Field:b,InlineFragment:b})},E=function(e){return e&&"object"==typeof e?Object.keys(e).reduce((function(t,r){var n=e[r];return"__typename"===r?Object.defineProperty(t,"__typename",{enumerable:!1,value:n}):t[r]=Array.isArray(n)?n.map(E):n&&"object"==typeof n&&"__typename"in n?E(n):n,t}),{}):e};function q(t){return t.toPromise=function(){return e.toPromise(e.take(1)(t))},t}var w=function(){},N=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function S(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var _=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function j(e){return r({},e,{query:O(e.query)})}function P(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function Q(e){return y(e,{cacheOutcome:"miss"})}function A(e){return _(e)}var R=function(t){function n(e){var t=s.get(e.key);return t=r({},t,{operation:y(e,{cacheOutcome:t?"hit":"miss"})}),"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,L(c,e)),t}function o(e){return!_(e)&&h(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?p(e):e.operation&&"query"===e.operation.operationName&&l(e)}function a(e){return!_(e)&&!h(e)}var u=t.forward,c=t.client,s=new Map;t=Object.create(null);var f=j,p=M(s,t,c),l=C(s,t),h=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(t){var r=e.share(t);return t=e.map(n)(e.filter(o)(r)),r=e.tap(i)(u(e.filter(P)(e.map(Q)(e.merge([e.map(f)(e.filter(a)(r)),e.filter(A)(r)]))))),e.merge([t,r])}},L=function(e,t){return e.reexecuteOperation(r({},t,{context:r({},t.context,{requestPolicy:"network-only"})}))},M=function(e,t,r,n){function o(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),L(r,n)}}return function(e){function r(e){n.add(e)}var n=new Set,i=e.operation.context.additionalTypenames;g(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),n.forEach(o)}},C=function(e,t){return function(r){var n=r.operation,o=r.data,i=n.context.additionalTypenames;null!=o&&(e.set(n.key,{operation:n,data:o,error:r.error}),g(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},T=function(t){var r=t.forward,n=new Set,o=function(e){var t=e.key;return"teardown"===(e=e.operationName)?(n.delete(t),!0):"query"!==e&&"subscription"!==e||(e=n.has(t),n.add(t),!e)},i=function(e){n.delete(e.operation.key)};return function(t){return t=e.filter(o)(t),e.tap(i)(r(t))}};function I(e){return"query"===e.operationName||"mutation"===e.operationName}function D(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var G=function(t){var r=t.forward,n=t.dispatchDebug;return function(t){var o=e.share(t);t=e.mergeMap((function(t){var r=t.key,i=e.filter((function(e){return"teardown"===e.operationName&&e.key===r}))(o);return e.takeUntil(i)(F(n,t,"query"===t.operationName&&!!t.context.preferGetMethod))}))(e.filter(I)(o));var i=r(e.filter(D)(o));return e.merge([t,i])}};function $(e){return e.kind===t.Kind.OPERATION_DEFINITION&&e.name}var F=function(n,o,i){return e.make((function(e){var a=e.next,u=e.complete,c="undefined"!=typeof AbortController?new AbortController:void 0;e="function"==typeof(e=o.context).fetchOptions?e.fetchOptions():e.fetchOptions||{};var s=function(e){return(e=e.definitions.find($))?e.name.value:null}(o.query),f={query:t.print(o.query),variables:o.variables};null!==s&&(f.operationName=s);var p=r({},e,{body:i?void 0:JSON.stringify(f),method:i?"GET":"POST",headers:r({},{"content-type":"application/json"},e.headers),signal:void 0!==c?c.signal:void 0});i&&(o.context.url=U(o.context.url,f));var l=!1;return Promise.resolve().then((function(){return l?void 0:J(n,o,p)})).then((function(e){l||(l=!0,e&&a(e),u())})),function(){l=!0,void 0!==c&&c.abort()}}))},J=function(e,t,r){var n;return((e=t.context).fetch||fetch)(e.url,r).then((function(e){var t=e.status;if(n=e,200>t||t>=("manual"===r.redirect?400:300))throw Error(e.statusText);return e.json()})).then((function(e){return d(t,e,n)})).catch((function(e){if("AbortError"!==e.name)return v(t,e,n)}))},U=function(e,t){var r=["query="+encodeURIComponent(t.query)];return t.variables&&r.push("variables="+encodeURIComponent(JSON.stringify(t.variables))),e+"?"+r.join("&")};function K(){return!1}var V=function(t){function r(e){}return function(t){return e.filter(K)(e.tap(r)(t))}};function W(){}var z=function(e){return function(t){var r=t.client;return e.reduceRight((function(e,t){return t({client:r,forward:e,dispatchDebug:W})}),t.forward)}},B=[T,R,G],H=function(t){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(e){return r({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},e,{requestPolicy:(e||{}).requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return{key:t.key,query:t.query,variables:t.variables,operationName:e,context:n.createOperationContext(r)}},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),n.dispatchOperation())},this.executeQuery=function(t,r){t=n.createRequestOperation("query",t,r);var o=n.executeRequestOperation(t);return(t=t.context.pollInterval)?e.switchMap((function(){return o}))(e.merge([e.fromValue(0),e.interval(t)])):o},this.executeSubscription=function(e,t){return e=n.createRequestOperation("subscription",e,t),n.executeRequestOperation(e)},this.executeMutation=function(e,t){return e=n.createRequestOperation("mutation",e,t),n.executeRequestOperation(e)},this.url=t.url,this.fetchOptions=t.fetchOptions,this.fetch=t.fetch,this.suspense=!!t.suspense,this.requestPolicy=t.requestPolicy||"cache-first",this.preferGetMethod=!!t.preferGetMethod,this.maskTypename=!!t.maskTypename;var o=e.makeSubject(),i=o.next;this.operations$=o.source;var a=!1;this.dispatchOperation=function(e){if(a)e&&i(e);else{for(a=!0,e&&i(e);e=n.queue.shift();)i(e);a=!1}},t=z(void 0!==t.exchanges?t.exchanges:B),this.results$=e.share(t({client:this,forward:z([V])({client:this,forward:w})})(this.operations$)),e.publish(this.results$)};function X(e){return e.data=E(e.data),e}H.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},H.prototype.onOperationEnd=function(e){var t=e.key,n=this.activeOperations[t]||0;0>=(this.activeOperations[t]=0>=n?0:n-1)&&this.dispatchOperation(r({},e,{operationName:"teardown"}))},H.prototype.executeRequestOperation=function(t){var r=this,n=t.key,o=t.operationName,i=e.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=e.map(X)(i)),"mutation"===o)return e.take(1)(e.onStart((function(){return r.dispatchOperation(t)}))(i));var a=e.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=e.onEnd((function(){r.onOperationEnd(t)}))(e.onStart((function(){r.onOperationStart(t)}))(e.takeUntil(a)(i))),!1!==t.context.suspense&&this.suspense&&"query"===o?function(t){return function(r){var n=e.share(t),o=!1,i=!1;if(e.onPush((function(){return o=!0}))(e.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),e.toPromise(e.take(1)(n))}}(i):i},H.prototype.query=function(e,t,n){return n&&"boolean"==typeof n.suspense||(n=r({},n,{suspense:!1})),q(this.executeQuery(h(e,t),n))},H.prototype.readQuery=function(t,r,n){var o=null;return e.subscribe((function(e){o=e}))(this.executeQuery(h(t,r),n)).unsubscribe(),o},H.prototype.mutation=function(e,t,r){return q(this.executeMutation(h(e,t),r))},exports.Client=H,exports.CombinedError=i,exports.cacheExchange=R,exports.composeExchanges=z,exports.createClient=function(e){return new H(e)},exports.createRequest=h,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=T,exports.defaultExchanges=B,exports.fallbackExchange=V,exports.fetchExchange=G,exports.formatDocument=O,exports.makeErrorResult=v,exports.makeResult=d,exports.maskTypename=E,exports.ssrExchange=function(t){function n(e){return!f(e)}function o(e){return function(e,t){var r=t.error;return{operation:e,data:t.data,extensions:void 0,error:r?new i({networkError:r.networkError?Error(r.networkError):void 0,graphQLErrors:r.graphQLErrors&&r.graphQLErrors.length?r.graphQLErrors:void 0}):void 0}}(e,s[e.key])}function a(e){return f(e)}function u(e){var t=e.operation;N(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(S),networkError:t.networkError?""+t.networkError:void 0}),e}(e),s[t.key]=e)}function c(e){delete s[e.operation.key]}var s={},f=function(e){return!N(e)&&void 0!==s[e.key]},p=function(r){var i=r.client,s=r.forward;return function(r){var f=t&&"boolean"==typeof t.isClient?!!t.isClient:!i.suspense,p=e.share(r);return r=s(e.filter(n)(p)),p=e.map(o)(e.filter(a)(p)),f?p=e.tap(c)(p):r=e.tap(u)(r),e.merge([r,p])}};return p.restoreData=function(e){return r(s,e)},p.extractData=function(){return r({},s)},t&&t.initialState&&p.restoreData(t.initialState),p},exports.stringifyVariables=f,exports.subscriptionExchange=function(n){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=n.forwardSubscription,a=n.enableAllOperations;return function(n){function a(e){return!f(e)}var u=n.client,c=n.forward,s=function(n){var o=i({key:n.key.toString(36),query:t.print(n.query),variables:n.variables,context:r({},n.context)});return e.make((function(e){function t(e){return s(d(n,e))}function i(e){return s(v(n,e))}function a(){p||(p=!0,"subscription"===n.operationName&&u.reexecuteOperation(r({},n,{operationName:"teardown"})),f())}var c,s=e.next,f=e.complete,p=!1;return Promise.resolve().then((function(){p||(c=o.subscribe({next:t,error:i,complete:a}))})),function(){p=!0,c&&c.unsubscribe()}}))},f=o;return function(t){var r=e.share(t);t=e.mergeMap((function(t){var n=t.key,o=e.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return e.takeUntil(o)(s(t))}))(e.filter(f)(r));var n=c(e.filter(a)(r));return e.merge([t,n])}}}; | ||
//# sourceMappingURL=urql-core.min.js.map |
{ | ||
"name": "@urql/core", | ||
"version": "1.10.7", | ||
"version": "1.11.0-debug.0", | ||
"description": "The shared core for the highly customizable and versatile GraphQL client", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
316607
35
1975
2
26