Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@urql/core

Package Overview
Dependencies
Maintainers
35
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/core - npm Package Compare versions

Comparing version 1.12.3 to 1.13.0

dist/2a3ec8aa.min.mjs

16

CHANGELOG.md
# @urql/core
## 1.13.0
Please note that this release changes the data structure of the `ssrExchange`'s
output. We don't treat this as a breaking change, since this data is considered
a private structure, but if your tests or other code relies on this, please check
the type changes and update it.
### Minor Changes
- Adds an error exchange to urql-core. This allows tapping into all graphql errors within the urql client. Useful for logging, debugging, handling authentication errors etc, by [@kadikraman](https://github.com/kadikraman) (See [#947](https://github.com/FormidableLabs/urql/pull/947))
### Patch Changes
- ⚠️ Fix condition where mutated result data would be picked up by the `ssrExchange`, for instance as a result of mutations by Graphcache. Instead the `ssrExchange` now serializes data early, by [@kitten](https://github.com/kitten) (See [#962](https://github.com/FormidableLabs/urql/pull/962))
- Omit the `Content-Type: application/json` HTTP header when using GET in the `fetchExchange`, `persistedFetchExchange`, or `multipartFetchExchange`, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#957](https://github.com/FormidableLabs/urql/pull/957))
## 1.12.3

@@ -4,0 +20,0 @@

1

dist/types/exchanges/index.d.ts

@@ -9,2 +9,3 @@ export { ssrExchange } from './ssr';

export { composeExchanges } from './compose';
export { errorExchange } from './error';
export declare const defaultExchanges: import("..").Exchange[];

2

dist/types/exchanges/ssr.d.ts
import { GraphQLError } from 'graphql';
import { Exchange } from '../types';
export interface SerializedResult {
data?: any;
data?: string | undefined;
error?: {

@@ -6,0 +6,0 @@ graphQLErrors: Array<Partial<GraphQLError> | string>;

"use strict";
var fetchSource = require("./2cc5ffbc.js");
var fetchSource = require("./e624b925.js");

@@ -5,0 +5,0 @@ exports.makeFetchBody = fetchSource.makeFetchBody;

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

"use strict";var e=require("./f33764e8.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL;
"use strict";var e=require("./d07b2549.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL;
//# sourceMappingURL=urql-core-internal.min.js.map

@@ -71,3 +71,3 @@ "use strict";

var fetchSource = require("./2cc5ffbc.js"), wonka = require("wonka"), parser = require("graphql/language/parser"), printer = require("graphql/language/printer"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor"), phash = function(a, b) {
var fetchSource = require("./e624b925.js"), wonka = require("wonka"), parser = require("graphql/language/parser"), printer = require("graphql/language/printer"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor"), phash = function(a, b) {
a |= 0;

@@ -141,10 +141,10 @@ for (var c = 0, d = 0 | b.length; c < d; c++) {

return function(b) {
var c = wonka.share(a), d = !1, f = !1;
var c = wonka.share(a), d = !1, g = !1;
wonka.onPush((function() {
return d = !0;
}))(wonka.takeWhile((function() {
return !f;
return !g;
}))(c))(b);
if (!d) {
throw f = !0, b(0), wonka.toPromise(wonka.take(1)(c));
throw g = !0, b(0), wonka.toPromise(wonka.take(1)(c));
}

@@ -166,3 +166,3 @@ };

a = {
data: a.data,
data: JSON.stringify(a.data),
error: void 0

@@ -179,3 +179,3 @@ };

operation: a,
data: b.data,
data: (b = b.data) ? JSON.parse(b) : void 0,
extensions: void 0,

@@ -189,3 +189,3 @@ error: c ? new fetchSource.CombinedError({

function b() {
for (var a; a = l.shift(); ) {
for (var a; a = k.shift(); ) {
delete h[a];

@@ -195,3 +195,3 @@ }

function c(a) {
return !k(a);
return !l(a);
}

@@ -201,13 +201,13 @@ function d(a) {

}
function g(a) {
return l(a);
}
function f(a) {
return k(a);
}
function g(a) {
var c = a.operation;
shouldSkip(c) || (a = serializeResult(a), h[c.key] = a);
}
var h = {}, l = [], e = function(a) {
l.push(a.operation.key);
1 === l.length && Promise.resolve().then(b);
}, k = function(a) {
var h = {}, k = [], e = function(a) {
k.push(a.operation.key);
1 === k.length && Promise.resolve().then(b);
}, l = function(a) {
return !shouldSkip(a) && void 0 !== h[a.key];

@@ -217,7 +217,7 @@ }, m = function(b) {

return function(b) {
var m = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, k = wonka.share(b);
b = q(wonka.filter(c)(k));
k = wonka.map(d)(wonka.filter(f)(k));
m ? k = wonka.tap(e)(k) : b = wonka.tap(g)(b);
return wonka.merge([ b, k ]);
var m = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, l = wonka.share(b);
b = q(wonka.filter(c)(l));
l = wonka.map(d)(wonka.filter(g)(l));
m ? l = wonka.tap(e)(l) : b = wonka.tap(f)(b);
return wonka.merge([ b, l ]);
};

@@ -238,3 +238,3 @@ };

var c = e.get(a.key);
"production" !== process.env.NODE_ENV && l(fetchSource._extends({}, {
"production" !== process.env.NODE_ENV && k(fetchSource._extends({}, {
operation: a

@@ -262,8 +262,8 @@ }, c ? {

}
function f(a) {
function g(a) {
return !shouldSkip$1(a) && !n(a);
}
var k, m, p, n, g = a.forward, h = a.client, l = a.dispatchDebug, e = new Map;
var l, m, p, n, f = a.forward, h = a.client, k = a.dispatchDebug, e = new Map;
a = Object.create(null);
k = _ref$1, m = afterMutation(e, a, h, l), p = afterQuery(e, a), n = function(a) {
l = _ref$1, m = afterMutation(e, a, h, k), p = afterQuery(e, a), n = function(a) {
var b = a.context.requestPolicy;

@@ -275,3 +275,3 @@ return "query" === a.operationName && "network-only" !== b && ("cache-only" === b || e.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)(f(wonka.filter(_ref5)(wonka.map(_ref6)(wonka.merge([ wonka.map(l)(wonka.filter(g)(e)), wonka.filter(_ref8)(e) ])))));
return wonka.merge([ a, e ]);

@@ -286,3 +286,3 @@ };

}, afterMutation = function(a, b, c, d) {
function f(b) {
function g(b) {
if (a.has(b)) {

@@ -296,5 +296,5 @@ var d = a.get(b).operation;

function c(a) {
l.add(a);
f.add(a);
}
var l = new Set, e = a.operation.context.additionalTypenames;
var f = new Set, e = a.operation.context.additionalTypenames;
e = collectTypesFromResponse(a.data).concat(e || []);

@@ -315,12 +315,12 @@ "production" !== process.env.NODE_ENV && d({

}));
l.forEach(f);
f.forEach(g);
};
}, afterQuery = function(a, b) {
return function(c) {
var d = c.operation, f = c.data, g = d.context.additionalTypenames;
null != f && (a.set(d.key, {
var d = c.operation, g = c.data, f = d.context.additionalTypenames;
null != g && (a.set(d.key, {
operation: d,
data: f,
data: g,
error: c.error
}), collectTypesFromResponse(c.data).concat(g || []).forEach((function(a) {
}), collectTypesFromResponse(c.data).concat(f || []).forEach((function(a) {
(b[a] || (b[a] = new Set)).add(d.key);

@@ -336,5 +336,5 @@ })));

function d(a) {
return !k(a);
return !l(a);
}
var h = a.client, f = a.forward, e = function(a) {
var g = a.client, k = a.forward, e = function(a) {
var b = c({

@@ -348,26 +348,26 @@ key: a.key.toString(36),

function d(c) {
return k(fetchSource.makeResult(a, c));
return l(fetchSource.makeResult(a, c));
}
function e(c) {
return k(fetchSource.makeErrorResult(a, c));
return l(fetchSource.makeErrorResult(a, c));
}
function f() {
g || (g = !0, "subscription" === a.operationName && h.reexecuteOperation(fetchSource._extends({}, a, {
function h() {
k || (k = !0, "subscription" === a.operationName && g.reexecuteOperation(fetchSource._extends({}, a, {
operationName: "teardown"
})), l());
})), f());
}
var m, k = c.next, l = c.complete, g = !1;
var m, l = c.next, f = c.complete, k = !1;
Promise.resolve().then((function() {
g || (m = b.subscribe({
k || (m = b.subscribe({
next: d,
error: e,
complete: f
complete: h
}));
}));
return function() {
g = !0;
k = !0;
m && m.unsubscribe();
};
}));
}, k = b;
}, l = b;
return function(a) {

@@ -380,4 +380,4 @@ var b, c = wonka.share(a);

return wonka.takeUntil(d)(e(a));
}))(wonka.filter(k)(c));
b = f(wonka.filter(d)(c));
}))(wonka.filter(l)(c));
b = k(wonka.filter(d)(c));
return wonka.merge([ a, b ]);

@@ -394,3 +394,3 @@ };

}, dedupExchange = function(a) {
var b = a.forward, c = a.dispatchDebug, d = new Set, f = function(a) {
var b = a.forward, c = a.dispatchDebug, d = new Set, g = function(a) {
var b = a.key, e = a.operationName;

@@ -412,8 +412,8 @@ if ("teardown" === e) {

return !e;
}, g = function(a) {
}, f = function(a) {
d.delete(a.operation.key);
};
return function(a) {
a = wonka.filter(f)(a);
return wonka.tap(g)(b(a));
a = wonka.filter(g)(a);
return wonka.tap(f)(b(a));
};

@@ -423,7 +423,7 @@ }, fetchExchange = function(a) {

return function(a) {
var g, d = wonka.share(a);
var f, d = wonka.share(a);
a = wonka.mergeMap((function(a) {
var b = a.key, e = wonka.filter((function(a) {
return "teardown" === a.operationName && a.key === b;
}))(d), f = fetchSource.makeFetchBody(a), g = fetchSource.makeFetchURL(a, f), h = fetchSource.makeFetchOptions(a, f);
}))(d), g = fetchSource.makeFetchBody(a), f = fetchSource.makeFetchURL(a, g), h = fetchSource.makeFetchOptions(a, g);
"production" !== process.env.NODE_ENV && c({

@@ -434,3 +434,3 @@ type: "fetchRequest",

data: {
url: g,
url: f,
fetchOptions: h

@@ -447,3 +447,3 @@ },

data: {
url: g,
url: f,
fetchOptions: h,

@@ -454,6 +454,6 @@ value: d || b

});
}))(wonka.takeUntil(e)(fetchSource.makeFetchSource(a, g, h)));
}))(wonka.takeUntil(e)(fetchSource.makeFetchSource(a, f, h)));
}))(wonka.filter(_ref$2)(d));
g = b(wonka.filter(_ref2$2)(d));
return wonka.merge([ a, g ]);
f = b(wonka.filter(_ref2$2)(d));
return wonka.merge([ a, f ]);
};

@@ -495,6 +495,19 @@ }, fallbackExchange = function(a) {

};
}, errorExchange = function(a) {
function b(a) {
var b = a.error;
a = a.operation;
b && c(b, a);
}
var c = a.onError;
return function(a) {
var c = a.forward;
return function(a) {
return wonka.tap(b)(c(a));
};
};
}, defaultExchanges = [ dedupExchange, cacheExchange, fetchExchange ], createClient = function(a) {
return new Client(a);
}, Client = function(a) {
var d, f, g, h, l, c = this;
var d, g, f, h, k, c = this;
this.activeOperations = Object.create(null);

@@ -541,7 +554,7 @@ this.queue = [];

if ("production" !== process.env.NODE_ENV) {
f = (d = wonka.makeSubject()).next, g = d.source;
g = (d = wonka.makeSubject()).next, f = d.source;
this.subscribeToDebugTarget = function b(a) {
return wonka.subscribe(a)(g);
return wonka.subscribe(a)(f);
};
d = f;
d = g;
}

@@ -555,15 +568,15 @@ this.url = a.url;

this.maskTypename = !!a.maskTypename;
f = wonka.makeSubject();
h = f.next;
this.operations$ = f.source;
l = !1;
g = wonka.makeSubject();
h = g.next;
this.operations$ = g.source;
k = !1;
this.dispatchOperation = function(a) {
l = !0;
k = !0;
for (a && h(a); a = c.queue.shift(); ) {
h(a);
}
l = !1;
k = !1;
};
this.reexecuteOperation = function(a) {
0 < (c.activeOperations[a.key] || 0) && (c.queue.push(a), l || Promise.resolve().then(c.dispatchOperation));
0 < (c.activeOperations[a.key] || 0) && (c.queue.push(a), k || Promise.resolve().then(c.dispatchOperation));
};

@@ -595,10 +608,10 @@ a = composeExchanges(void 0 !== a.exchanges ? a.exchanges : defaultExchanges);

Client.prototype.executeRequestOperation = function(a) {
var h, c = this, d = a.key, f = a.operationName, g = wonka.filter((function(a) {
var h, c = this, d = a.key, g = a.operationName, f = wonka.filter((function(a) {
return a.operation.key === d;
}))(this.results$);
this.maskTypename && (g = wonka.map(_ref3$2)(g));
if ("mutation" === f) {
this.maskTypename && (f = wonka.map(_ref3$2)(f));
if ("mutation" === g) {
return wonka.take(1)(wonka.onStart((function b() {
return c.dispatchOperation(a);
}))(g));
}))(f));
}

@@ -608,8 +621,8 @@ h = wonka.filter((function(a) {

}))(this.operations$);
g = wonka.onEnd((function() {
f = wonka.onEnd((function() {
c.onOperationEnd(a);
}))(wonka.onStart((function() {
c.onOperationStart(a);
}))(wonka.takeUntil(h)(g)));
return !1 !== a.context.suspense && this.suspense && "query" === f ? toSuspenseSource(g) : g;
}))(wonka.takeUntil(h)(f)));
return !1 !== a.context.suspense && this.suspense && "query" === g ? toSuspenseSource(f) : f;
};

@@ -664,2 +677,4 @@

exports.errorExchange = errorExchange;
exports.fallbackExchangeIO = fallbackExchangeIO;

@@ -666,0 +681,0 @@

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

"use strict";var e=require("./f33764e8.min.js"),t=require("wonka"),r=require("graphql/language/parser"),n=require("graphql/language/printer"),o=require("graphql/language/kinds"),i=require("graphql/language/visitor"),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=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim())},c=Object.create(null),s=function(t,o){if("string"==typeof t){var i=u(t);t=void 0!==c[i]?c[i]:r.parse(t,{noLocation:!0})}else void 0!==t.__key?i=t.__key:(i=u(n.print(t)),t=void 0!==c[i]?c[i]:t);return c[i]=t,t.__key=i,{key:o?a(i,e.stringifyVariables(o))>>>0:i,query:t,variables:o||{}}},p=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,r)})})},f=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){f(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):f(e[r],t);return t};function l(e,t,r){return r.indexOf(e)===t}var h=function(e){return f(e).filter(l)};function d(e){return e.kind===o.Kind.FIELD&&"__typename"===e.name.value}var m=function(t){if(t.selectionSet&&!t.selectionSet.selections.some(d))return e._extends({},t,{selectionSet:e._extends({},t.selectionSet,{selections:t.selectionSet.selections.concat([{kind:o.Kind.FIELD,name:{kind:o.Kind.NAME,value:"__typename"}}])})})},y=function(e){var t=i.visit(e,{Field:m,InlineFragment:m});return t.__key=e.__key,t},v=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(v):n&&"object"==typeof n&&"__typename"in n?v(n):n,t}),{}):e};function x(e){return e.toPromise=function(){return t.toPromise(t.take(1)(e))},e}var k=function(){},g=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function q(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var b=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function O(t){return e._extends({},t,{query:y(t.query)})}function E(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function _(e){return p(e,{cacheOutcome:"miss"})}function w(e){return b(e)}var N=function(r){function n(t){var r=s.get(t.key);return r=e._extends({},r,{operation:p(t,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===t.context.requestPolicy&&(r.stale=!0,S(c,t)),r}function o(e){return!b(e)&&d(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?l(e):e.operation&&"query"===e.operation.operationName&&h(e)}function a(e){return!b(e)&&!d(e)}var u=r.forward,c=r.client,s=new Map;r=Object.create(null);var f=O,l=P(s,r,c),h=R(s,r),d=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(e){var r=t.share(e);return e=t.map(n)(t.filter(o)(r)),r=t.tap(i)(u(t.filter(E)(t.map(_)(t.merge([t.map(f)(t.filter(a)(r)),t.filter(w)(r)]))))),t.merge([e,r])}},S=function(t,r){return t.reexecuteOperation(e._extends({},r,{context:e._extends({},r.context,{requestPolicy:"network-only"})}))},P=function(e,t,r,n){function o(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),S(r,n)}}return function(e){function r(e){n.add(e)}var n=new Set,i=e.operation.context.additionalTypenames;h(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),n.forEach(o)}},R=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}),h(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},M=function(e){var r=e.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(e){return e=t.filter(o)(e),t.tap(i)(r(e))}};function j(e){return"query"===e.operationName||"mutation"===e.operationName}function C(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var L=function(r){var n=r.forward;return function(r){var o=t.share(r);r=t.mergeMap((function(r){var n=r.key,i=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(o),a=e.makeFetchBody(r),u=e.makeFetchURL(r,a);return a=e.makeFetchOptions(r,a),t.onPush((function(e){}))(t.takeUntil(i)(e.makeFetchSource(r,u,a)))}))(t.filter(j)(o));var i=n(t.filter(C)(o));return t.merge([r,i])}};function Q(){return!1}var D=function(e){function r(e){}return function(e){return t.filter(Q)(t.tap(r)(e))}},F=D(),A=function(e){return function(t){var r=t.client;return e.reduceRight((function(e,t){return t({client:r,forward:e,dispatchDebug:function(e){}})}),t.forward)}},T=[M,N,L],$=function(r){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(t){return e._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},t,{requestPolicy:(t||{}).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.executeQuery=function(e,r){e=n.createRequestOperation("query",e,r);var o=n.executeRequestOperation(e);return(e=e.context.pollInterval)?t.switchMap((function(){return o}))(t.merge([t.fromValue(0),t.interval(e)])):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)};var o=k;this.url=r.url,this.fetchOptions=r.fetchOptions,this.fetch=r.fetch,this.suspense=!!r.suspense,this.requestPolicy=r.requestPolicy||"cache-first",this.preferGetMethod=!!r.preferGetMethod,this.maskTypename=!!r.maskTypename;var i=t.makeSubject(),a=i.next;this.operations$=i.source;var u=!1;this.dispatchOperation=function(e){for(u=!0,e&&a(e);e=n.queue.shift();)a(e);u=!1},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),u||Promise.resolve().then(n.dispatchOperation))},r=A(void 0!==r.exchanges?r.exchanges:T),this.results$=t.share(r({client:this,dispatchDebug:o,forward:D()})(this.operations$)),t.publish(this.results$)};function I(e){return e.data=v(e.data),e}$.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},$.prototype.onOperationEnd=function(t){var r=t.key,n=this.activeOperations[r]||0;0>=(this.activeOperations[r]=0>=n?0:n-1)&&this.dispatchOperation(e._extends({},t,{operationName:"teardown"}))},$.prototype.executeRequestOperation=function(e){var r=this,n=e.key,o=e.operationName,i=t.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=t.map(I)(i)),"mutation"===o)return t.take(1)(t.onStart((function(){return r.dispatchOperation(e)}))(i));var a=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=t.onEnd((function(){r.onOperationEnd(e)}))(t.onStart((function(){r.onOperationStart(e)}))(t.takeUntil(a)(i))),!1!==e.context.suspense&&this.suspense&&"query"===o?function(e){return function(r){var n=t.share(e),o=!1,i=!1;if(t.onPush((function(){return o=!0}))(t.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),t.toPromise(t.take(1)(n))}}(i):i},$.prototype.query=function(t,r,n){return n&&"boolean"==typeof n.suspense||(n=e._extends({},n,{suspense:!1})),x(this.executeQuery(s(t,r),n))},$.prototype.readQuery=function(e,r,n){var o=null;return t.subscribe((function(e){o=e}))(this.executeQuery(s(e,r),n)).unsubscribe(),o},$.prototype.subscription=function(e,t,r){return this.executeSubscription(s(e,t),r)},$.prototype.mutation=function(e,t,r){return x(this.executeMutation(s(e,t),r))},exports.CombinedError=e.CombinedError,exports.makeErrorResult=e.makeErrorResult,exports.makeResult=e.makeResult,exports.stringifyVariables=e.stringifyVariables,exports.Client=$,exports.cacheExchange=N,exports.composeExchanges=A,exports.createClient=function(e){return new $(e)},exports.createRequest=s,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=M,exports.defaultExchanges=T,exports.fallbackExchangeIO=F,exports.fetchExchange=L,exports.formatDocument=y,exports.maskTypename=v,exports.ssrExchange=function(r){function n(){for(var e;e=s.shift();)delete c[e]}function o(e){return!f(e)}function i(t){return function(t,r){var n=r.error;return{operation:t,data:r.data,extensions:void 0,error:n?new e.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(t,c[t.key])}function a(e){return f(e)}function u(e){var t=e.operation;g(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(q),networkError:t.networkError?""+t.networkError:void 0}),e}(e),c[t.key]=e)}var c={},s=[],p=function(e){s.push(e.operation.key),1===s.length&&Promise.resolve().then(n)},f=function(e){return!g(e)&&void 0!==c[e.key]},l=function(e){var n=e.client,c=e.forward;return function(e){var s=r&&"boolean"==typeof r.isClient?!!r.isClient:!n.suspense,f=t.share(e);return e=c(t.filter(o)(f)),f=t.map(i)(t.filter(a)(f)),s?f=t.tap(p)(f):e=t.tap(u)(e),t.merge([e,f])}};return l.restoreData=function(t){return e._extends(c,t)},l.extractData=function(){return e._extends({},c)},r&&r.initialState&&l.restoreData(r.initialState),l},exports.subscriptionExchange=function(r){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=r.forwardSubscription,a=r.enableAllOperations;return function(r){function a(e){return!p(e)}var u=r.client,c=r.forward,s=function(r){var o=i({key:r.key.toString(36),query:n.print(r.query),variables:r.variables,context:e._extends({},r.context)});return t.make((function(t){function n(t){return s(e.makeResult(r,t))}function i(t){return s(e.makeErrorResult(r,t))}function a(){f||(f=!0,"subscription"===r.operationName&&u.reexecuteOperation(e._extends({},r,{operationName:"teardown"})),p())}var c,s=t.next,p=t.complete,f=!1;return Promise.resolve().then((function(){f||(c=o.subscribe({next:n,error:i,complete:a}))})),function(){f=!0,c&&c.unsubscribe()}}))},p=o;return function(e){var r=t.share(e);e=t.mergeMap((function(e){var n=e.key,o=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return t.takeUntil(o)(s(e))}))(t.filter(p)(r));var n=c(t.filter(a)(r));return t.merge([e,n])}}};
"use strict";var e=require("./d07b2549.min.js"),t=require("wonka"),r=require("graphql/language/parser"),n=require("graphql/language/printer"),o=require("graphql/language/kinds"),i=require("graphql/language/visitor"),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=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim())},c=Object.create(null),s=function(t,o){if("string"==typeof t){var i=u(t);t=void 0!==c[i]?c[i]:r.parse(t,{noLocation:!0})}else void 0!==t.__key?i=t.__key:(i=u(n.print(t)),t=void 0!==c[i]?c[i]:t);return c[i]=t,t.__key=i,{key:o?a(i,e.stringifyVariables(o))>>>0:i,query:t,variables:o||{}}},p=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,r)})})},f=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){f(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):f(e[r],t);return t};function l(e,t,r){return r.indexOf(e)===t}var h=function(e){return f(e).filter(l)};function d(e){return e.kind===o.Kind.FIELD&&"__typename"===e.name.value}var y=function(t){if(t.selectionSet&&!t.selectionSet.selections.some(d))return e._extends({},t,{selectionSet:e._extends({},t.selectionSet,{selections:t.selectionSet.selections.concat([{kind:o.Kind.FIELD,name:{kind:o.Kind.NAME,value:"__typename"}}])})})},m=function(e){var t=i.visit(e,{Field:y,InlineFragment:y});return t.__key=e.__key,t},v=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(v):n&&"object"==typeof n&&"__typename"in n?v(n):n,t}),{}):e};function x(e){return e.toPromise=function(){return t.toPromise(t.take(1)(e))},e}var k=function(){},g=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function q(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var b=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function O(t){return e._extends({},t,{query:m(t.query)})}function E(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function _(e){return p(e,{cacheOutcome:"miss"})}function w(e){return b(e)}var N=function(r){function n(t){var r=s.get(t.key);return r=e._extends({},r,{operation:p(t,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===t.context.requestPolicy&&(r.stale=!0,S(c,t)),r}function o(e){return!b(e)&&d(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?l(e):e.operation&&"query"===e.operation.operationName&&h(e)}function a(e){return!b(e)&&!d(e)}var u=r.forward,c=r.client,s=new Map;r=Object.create(null);var f=O,l=P(s,r,c),h=R(s,r),d=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(e){var r=t.share(e);return e=t.map(n)(t.filter(o)(r)),r=t.tap(i)(u(t.filter(E)(t.map(_)(t.merge([t.map(f)(t.filter(a)(r)),t.filter(w)(r)]))))),t.merge([e,r])}},S=function(t,r){return t.reexecuteOperation(e._extends({},r,{context:e._extends({},r.context,{requestPolicy:"network-only"})}))},P=function(e,t,r,n){function o(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),S(r,n)}}return function(e){function r(e){n.add(e)}var n=new Set,i=e.operation.context.additionalTypenames;h(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),n.forEach(o)}},R=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}),h(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},M=function(e){var r=e.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(e){return e=t.filter(o)(e),t.tap(i)(r(e))}};function j(e){return"query"===e.operationName||"mutation"===e.operationName}function C(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var L=function(r){var n=r.forward;return function(r){var o=t.share(r);r=t.mergeMap((function(r){var n=r.key,i=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(o),a=e.makeFetchBody(r),u=e.makeFetchURL(r,a);return a=e.makeFetchOptions(r,a),t.onPush((function(e){}))(t.takeUntil(i)(e.makeFetchSource(r,u,a)))}))(t.filter(j)(o));var i=n(t.filter(C)(o));return t.merge([r,i])}};function Q(){return!1}var D=function(e){function r(e){}return function(e){return t.filter(Q)(t.tap(r)(e))}},F=D(),A=function(e){return function(t){var r=t.client;return e.reduceRight((function(e,t){return t({client:r,forward:e,dispatchDebug:function(e){}})}),t.forward)}},T=[M,N,L],$=function(r){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(t){return e._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},t,{requestPolicy:(t||{}).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.executeQuery=function(e,r){e=n.createRequestOperation("query",e,r);var o=n.executeRequestOperation(e);return(e=e.context.pollInterval)?t.switchMap((function(){return o}))(t.merge([t.fromValue(0),t.interval(e)])):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)};var o=k;this.url=r.url,this.fetchOptions=r.fetchOptions,this.fetch=r.fetch,this.suspense=!!r.suspense,this.requestPolicy=r.requestPolicy||"cache-first",this.preferGetMethod=!!r.preferGetMethod,this.maskTypename=!!r.maskTypename;var i=t.makeSubject(),a=i.next;this.operations$=i.source;var u=!1;this.dispatchOperation=function(e){for(u=!0,e&&a(e);e=n.queue.shift();)a(e);u=!1},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),u||Promise.resolve().then(n.dispatchOperation))},r=A(void 0!==r.exchanges?r.exchanges:T),this.results$=t.share(r({client:this,dispatchDebug:o,forward:D()})(this.operations$)),t.publish(this.results$)};function I(e){return e.data=v(e.data),e}$.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},$.prototype.onOperationEnd=function(t){var r=t.key,n=this.activeOperations[r]||0;0>=(this.activeOperations[r]=0>=n?0:n-1)&&this.dispatchOperation(e._extends({},t,{operationName:"teardown"}))},$.prototype.executeRequestOperation=function(e){var r=this,n=e.key,o=e.operationName,i=t.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=t.map(I)(i)),"mutation"===o)return t.take(1)(t.onStart((function(){return r.dispatchOperation(e)}))(i));var a=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=t.onEnd((function(){r.onOperationEnd(e)}))(t.onStart((function(){r.onOperationStart(e)}))(t.takeUntil(a)(i))),!1!==e.context.suspense&&this.suspense&&"query"===o?function(e){return function(r){var n=t.share(e),o=!1,i=!1;if(t.onPush((function(){return o=!0}))(t.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),t.toPromise(t.take(1)(n))}}(i):i},$.prototype.query=function(t,r,n){return n&&"boolean"==typeof n.suspense||(n=e._extends({},n,{suspense:!1})),x(this.executeQuery(s(t,r),n))},$.prototype.readQuery=function(e,r,n){var o=null;return t.subscribe((function(e){o=e}))(this.executeQuery(s(e,r),n)).unsubscribe(),o},$.prototype.subscription=function(e,t,r){return this.executeSubscription(s(e,t),r)},$.prototype.mutation=function(e,t,r){return x(this.executeMutation(s(e,t),r))},exports.CombinedError=e.CombinedError,exports.makeErrorResult=e.makeErrorResult,exports.makeResult=e.makeResult,exports.stringifyVariables=e.stringifyVariables,exports.Client=$,exports.cacheExchange=N,exports.composeExchanges=A,exports.createClient=function(e){return new $(e)},exports.createRequest=s,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=M,exports.defaultExchanges=T,exports.errorExchange=function(e){function r(e){var t=e.error;e=e.operation,t&&n(t,e)}var n=e.onError;return function(e){var n=e.forward;return function(e){return t.tap(r)(n(e))}}},exports.fallbackExchangeIO=F,exports.fetchExchange=L,exports.formatDocument=m,exports.maskTypename=v,exports.ssrExchange=function(r){function n(){for(var e;e=s.shift();)delete c[e]}function o(e){return!f(e)}function i(t){return function(t,r){var n=r.error;return{operation:t,data:(r=r.data)?JSON.parse(r):void 0,extensions:void 0,error:n?new e.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(t,c[t.key])}function a(e){return f(e)}function u(e){var t=e.operation;g(t)||(e=function(e){var t=e.error;return e={data:JSON.stringify(e.data),error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(q),networkError:t.networkError?""+t.networkError:void 0}),e}(e),c[t.key]=e)}var c={},s=[],p=function(e){s.push(e.operation.key),1===s.length&&Promise.resolve().then(n)},f=function(e){return!g(e)&&void 0!==c[e.key]},l=function(e){var n=e.client,c=e.forward;return function(e){var s=r&&"boolean"==typeof r.isClient?!!r.isClient:!n.suspense,f=t.share(e);return e=c(t.filter(o)(f)),f=t.map(i)(t.filter(a)(f)),s?f=t.tap(p)(f):e=t.tap(u)(e),t.merge([e,f])}};return l.restoreData=function(t){return e._extends(c,t)},l.extractData=function(){return e._extends({},c)},r&&r.initialState&&l.restoreData(r.initialState),l},exports.subscriptionExchange=function(r){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=r.forwardSubscription,a=r.enableAllOperations;return function(r){function a(e){return!p(e)}var u=r.client,c=r.forward,s=function(r){var o=i({key:r.key.toString(36),query:n.print(r.query),variables:r.variables,context:e._extends({},r.context)});return t.make((function(t){function n(t){return s(e.makeResult(r,t))}function i(t){return s(e.makeErrorResult(r,t))}function a(){f||(f=!0,"subscription"===r.operationName&&u.reexecuteOperation(e._extends({},r,{operationName:"teardown"})),p())}var c,s=t.next,p=t.complete,f=!1;return Promise.resolve().then((function(){f||(c=o.subscribe({next:n,error:i,complete:a}))})),function(){f=!0,c&&c.unsubscribe()}}))},p=o;return function(e){var r=t.share(e);e=t.mergeMap((function(e){var n=e.key,o=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return t.takeUntil(o)(s(e))}))(t.filter(p)(r));var n=c(t.filter(a)(r));return t.merge([e,n])}}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "1.12.3",
"version": "1.13.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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc