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

@urql/core

Package Overview
Dependencies
Maintainers
30
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 2.1.3 to 2.1.4

6

CHANGELOG.md
# @urql/core
## 2.1.4
### Patch Changes
- Prevent stale results from being emitted by promisified query sources, e.g. `client.query(...).toPromise()` yielding a partial result with `stale: true` set. Instead, `.toPromise()` will now filter out stale results, by [@kitten](https://github.com/kitten) (See [#1709](https://github.com/FormidableLabs/urql/pull/1709))
## 2.1.3

@@ -4,0 +10,0 @@

4

dist/types/utils/streamUtils.d.ts
import { Source } from 'wonka';
import { PromisifiedSource } from '../types';
export declare function withPromise<T>(source$: Source<T>): PromisifiedSource<T>;
import { OperationResult, PromisifiedSource } from '../types';
export declare function withPromise<T extends OperationResult>(source$: Source<T>): PromisifiedSource<T>;

@@ -85,3 +85,5 @@ var e = require("graphql");

e.toPromise = function() {
return r.toPromise(r.take(1)(e));
return r.toPromise(r.take(1)(r.filter((function(e) {
return !e.stale;
}))(e)));
};

@@ -216,4 +218,4 @@ return e;

for (var f = 0; f < r.length; f++) {
var d = r[f];
(u[d] || (u[d] = new Set)).add(t.key);
var l = r[f];
(u[l] || (u[l] = new Set)).add(t.key);
}

@@ -394,3 +396,3 @@ }

}))(y);
if (d.maskTypename) {
if (l.maskTypename) {
o = r.map((function(e) {

@@ -437,3 +439,3 @@ return t._extends({}, e, {

var f = this instanceof Client ? this : Object.create(Client.prototype);
var d = t._extends(f, {
var l = t._extends(f, {
url: e.url,

@@ -460,13 +462,13 @@ fetchOptions: e.fetchOptions,

return t._extends({}, {
url: d.url,
fetchOptions: d.fetchOptions,
fetch: d.fetch,
preferGetMethod: d.preferGetMethod
url: l.url,
fetchOptions: l.fetchOptions,
fetch: l.fetch,
preferGetMethod: l.preferGetMethod
}, e, {
suspense: e.suspense || !1 !== e.suspense && d.suspense,
requestPolicy: e.requestPolicy || d.requestPolicy
suspense: e.suspense || !1 !== e.suspense && l.suspense,
requestPolicy: e.requestPolicy || l.requestPolicy
});
},
createRequestOperation: function createRequestOperation(e, t, r) {
return makeOperation(e, t, d.createOperationContext(r));
return makeOperation(e, t, l.createOperationContext(r));
},

@@ -498,12 +500,12 @@ executeRequestOperation: function executeRequestOperation(e) {

executeQuery: function executeQuery(e, t) {
var r = d.createRequestOperation("query", e, t);
return d.executeRequestOperation(r);
var r = l.createRequestOperation("query", e, t);
return l.executeRequestOperation(r);
},
executeSubscription: function executeSubscription(e, t) {
var r = d.createRequestOperation("subscription", e, t);
return d.executeRequestOperation(r);
var r = l.createRequestOperation("subscription", e, t);
return l.executeRequestOperation(r);
},
executeMutation: function executeMutation(e, t) {
var r = d.createRequestOperation("mutation", e, t);
return d.executeRequestOperation(r);
var r = l.createRequestOperation("mutation", e, t);
return l.executeRequestOperation(r);
},

@@ -516,3 +518,3 @@ query: function query(e, r, n) {

}
return withPromise(d.executeQuery(t.createRequest(e, r), n));
return withPromise(l.executeQuery(t.createRequest(e, r), n));
},

@@ -523,13 +525,13 @@ readQuery: function readQuery(e, t, n) {

a = e;
}))(d.query(e, t, n)).unsubscribe();
}))(l.query(e, t, n)).unsubscribe();
return a;
},
subscription: function subscription(e, r, n) {
return d.executeSubscription(t.createRequest(e, r), n);
return l.executeSubscription(t.createRequest(e, r), n);
},
mutation: function mutation(e, r, n) {
return withPromise(d.executeMutation(t.createRequest(e, r), n));
return withPromise(l.executeMutation(t.createRequest(e, r), n));
}
});
var l = noop;
var d = noop;
if ("production" !== process.env.NODE_ENV) {

@@ -539,17 +541,17 @@ var h = r.makeSubject();

var m = h.source;
d.subscribeToDebugTarget = function(e) {
l.subscribeToDebugTarget = function(e) {
return r.subscribe(e)(m);
};
l = v;
d = v;
}
var k = composeExchanges(void 0 !== e.exchanges ? e.exchanges : o);
var y = r.share(k({
client: d,
dispatchDebug: l,
client: l,
dispatchDebug: d,
forward: fallbackExchange({
dispatchDebug: l
dispatchDebug: d
})
})(c));
r.publish(y);
return d;
return l;
};

@@ -556,0 +558,0 @@

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

var e=require("graphql"),t=require("./5f352e3e.min.js"),n=require("wonka");function r(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)r(e[n],t);else if("object"==typeof e&&null!==e)for(var o in e)"__typename"===o&&"string"==typeof e[o]?t[e[o]]=0:r(e[o],t);return t}function o(e){return Object.keys(r(e,{}))}var i=function(n){if(n.selectionSet&&!n.selectionSet.selections.some((function(t){return t.kind===e.Kind.FIELD&&"__typename"===t.name.value&&!t.alias})))return t._extends({},n,{selectionSet:t._extends({},n.selectionSet,{selections:n.selectionSet.selections.concat([{kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"}}])})})},u=new Map;function a(n){var r=t.keyDocument(n),o=u.get(r.__key);return o||((o=e.visit(r,{Field:i,InlineFragment:i})).__key=r.__key,u.set(r.__key,o)),o}function c(e){return e&&"object"==typeof e?Object.keys(e).reduce((function(t,n){var r=e[n];return"__typename"===n?Object.defineProperty(t,"__typename",{enumerable:!1,value:r}):t[n]=Array.isArray(r)?r.map(c):r&&"object"==typeof r&&"__typename"in r?c(r):r,t}),{}):e}function s(e){return e.toPromise=function(){return n.toPromise(n.take(1)(e))},e}function f(e,t,n){return n||(n=t.context),{key:t.key,query:t.query,variables:t.variables,kind:e,context:n}}function p(e,n){return f(e.kind,e,t._extends({},e.context,{meta:t._extends({},e.context.meta,n)}))}function l(){}function d(n,r,o){for(var i=0;i<o.length;i++)if(o[i].kind===e.Kind.FRAGMENT_DEFINITION){var u=o[i].name.value,a=t.stringifyDocument(o[i]);n.has(u)||(n.set(u,a),r.push(o[i]))}else r.push(o[i])}function k(e){var t=e.kind;return"subscription"!==t&&"query"!==t}function y(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function m(e){var r=e.forward,i=e.client,u=new Map,c=Object.create(null);function s(e){var t=f(e.kind,e);return t.query=a(e.query),t}function l(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||u.has(e.key))}return function(e){var a=n.share(e),f=n.map((function(e){var n=u.get(e.key),r=t._extends({},n,{operation:p(e,{cacheOutcome:n?"hit":"miss"})});return"cache-and-network"===e.context.requestPolicy&&(r.stale=!0,x(i,e)),r}))(n.filter((function(e){return!y(e)&&l(e)}))(a)),d=n.tap((function(e){var t=e.operation;if(t){var n=o(e.data).concat(t.context.additionalTypenames||[]);if("mutation"===e.operation.kind){for(var r=new Set,a=0;a<n.length;a++){var s=n[a],f=c[s]||(c[s]=new Set);f.forEach((function(e){r.add(e)})),f.clear()}r.forEach((function(e){u.has(e)&&(t=u.get(e).operation,u.delete(e),x(i,t))}))}else if("query"===t.kind&&e.data){u.set(t.key,e);for(var p=0;p<n.length;p++){var l=n[p];(c[l]||(c[l]=new Set)).add(t.key)}}}}))(r(n.filter((function(e){return"query"!==e.kind||"cache-only"!==e.context.requestPolicy}))(n.map((function(e){return p(e,{cacheOutcome:"miss"})}))(n.merge([n.map(s)(n.filter((function(e){return!y(e)&&!l(e)}))(a)),n.filter((function(e){return y(e)}))(a)])))));return n.merge([f,d])}}function x(e,n){return e.reexecuteOperation(f(n.kind,n,t._extends({},n.context,{requestPolicy:"network-only"})))}function h(e){var t=e.forward,r=new Set;function o(e){var t=e.key,n=e.kind;if("teardown"===n)return r.delete(t),!0;if("query"!==n&&"subscription"!==n)return!0;var o=r.has(t);return r.add(t),!o}function i(e){r.delete(e.operation.key)}return function(e){var r=n.filter(o)(e);return n.tap(i)(t(r))}}function v(e){var r=e.forward;return function(e){var o=n.share(e),i=n.mergeMap((function(e){var r=e.key,i=n.filter((function(e){return"teardown"===e.kind&&e.key===r}))(o),u=t.makeFetchBody(e),a=t.makeFetchURL(e,u),c=t.makeFetchOptions(e,u);return n.onPush((function(e){}))(n.takeUntil(i)(t.makeFetchSource(e,a,c)))}))(n.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),u=r(n.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return n.merge([i,u])}}function g(e){return function(e){return n.filter((function(){return!1}))(n.tap((function(e){}))(e))}}var b=g();function q(e){return function(t){var n=t.client;return e.reduceRight((function(e,t){return t({client:n,forward:e,dispatchDebug:function(e){}})}),t.forward)}}var w=[h,m,v],E=function e(r){var o=new Map,i=new Map,u=[],a=n.makeSubject(),p=a.source,d=a.next,k=!1;function y(e){for(k=!0,e&&d(e);e=u.shift();)d(e);k=!1}function m(e){var r=n.filter((function(t){return t.operation.kind===e.kind&&t.operation.key===e.key}))(E);if(h.maskTypename&&(r=n.map((function(e){return t._extends({},e,{data:c(e.data)})}))(r)),"mutation"===e.kind)return n.take(1)(n.onStart((function(){return y(e)}))(r));var a=n.share(n.onEnd((function(){o.delete(e.key),i.delete(e.key);for(var t=u.length-1;t>=0;t--)u[t].key===e.key&&u.splice(t,1);y(f("teardown",e,e.context))}))(n.onStart((function(){i.set(e.key,a)}))(n.onPush((function(t){o.set(e.key,t)}))(n.switchMap((function(r){return r.stale?n.fromValue(r):n.merge([n.fromValue(r),n.map((function(){return t._extends({},r,{stale:!0})}))(n.take(1)(n.filter((function(t){return t.kind===e.kind&&t.key===e.key&&("network-only"===t.context.requestPolicy||"cache-and-network"===t.context.requestPolicy)}))(p)))])}))(n.takeUntil(n.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(p))(r))))));return a}var x=this instanceof e?this:Object.create(e.prototype),h=t._extends(x,{url:r.url,fetchOptions:r.fetchOptions,fetch:r.fetch,suspense:!!r.suspense,requestPolicy:r.requestPolicy||"cache-first",preferGetMethod:!!r.preferGetMethod,maskTypename:!!r.maskTypename,operations$:p,reexecuteOperation:function(e){("mutation"===e.kind||i.has(e.key))&&(u.push(e),k||Promise.resolve().then(y))},createOperationContext:function(e){return e||(e={}),t._extends({},{url:h.url,fetchOptions:h.fetchOptions,fetch:h.fetch,preferGetMethod:h.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&h.suspense,requestPolicy:e.requestPolicy||h.requestPolicy})},createRequestOperation:function(e,t,n){return f(e,t,h.createOperationContext(n))},executeRequestOperation:function(e){if("mutation"===e.kind)return m(e);var r=i.get(e.key)||m(e),u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return n.make((function(i){return n.subscribe(i.next)(n.onEnd(i.complete)(n.onStart((function(){var n=o.get(e.key);if("subscription"===e.kind)return y(e);u&&y(e),null!=n&&n===o.get(e.key)?i.next(u?t._extends({},n,{stale:!0}):n):u||y(e)}))(r))).unsubscribe}))},executeQuery:function(e,t){var n=h.createRequestOperation("query",e,t);return h.executeRequestOperation(n)},executeSubscription:function(e,t){var n=h.createRequestOperation("subscription",e,t);return h.executeRequestOperation(n)},executeMutation:function(e,t){var n=h.createRequestOperation("mutation",e,t);return h.executeRequestOperation(n)},query:function(e,n,r){return r&&"boolean"==typeof r.suspense||(r=t._extends({},r,{suspense:!1})),s(h.executeQuery(t.createRequest(e,n),r))},readQuery:function(e,t,r){var o=null;return n.subscribe((function(e){o=e}))(h.query(e,t,r)).unsubscribe(),o},subscription:function(e,n,r){return h.executeSubscription(t.createRequest(e,n),r)},mutation:function(e,n,r){return s(h.executeMutation(t.createRequest(e,n),r))}}),v=l,b=q(void 0!==r.exchanges?r.exchanges:w),E=n.share(b({client:h,dispatchDebug:v,forward:g()})(p));return n.publish(E),h},_=E;exports.CombinedError=t.CombinedError,exports.createRequest=t.createRequest,exports.getOperationName=t.getOperationName,exports.makeErrorResult=t.makeErrorResult,exports.makeResult=t.makeResult,exports.stringifyVariables=t.stringifyVariables,exports.Client=E,exports.cacheExchange=m,exports.composeExchanges=q,exports.createClient=_,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=h,exports.defaultExchanges=w,exports.errorExchange=function(e){var t=e.onError;return function(e){var r=e.forward;return function(e){return n.tap((function(e){var n=e.error;n&&t(n,e.operation)}))(r(e))}}},exports.fallbackExchangeIO=b,exports.fetchExchange=v,exports.formatDocument=a,exports.gql=function(){for(var n=arguments,r=new Map,o=[],i=[],u=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",a=1;a<arguments.length;a++){var c=n[a];c&&c.definitions?i.push.apply(i,c.definitions):u+=c,u+=n[0][a]}return d(r,o,t.keyDocument(u).definitions),d(r,o,i),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:o})},exports.makeOperation=f,exports.maskTypename=c,exports.ssrExchange=function(e){var r={},o=[];function i(e){o.push(e.operation.key),1===o.length&&Promise.resolve().then((function(){for(var e;e=o.shift();)delete r[e]}))}function u(e){return!k(e)&&void 0!==r[e.key]}var a=function(o){var a=o.client,c=o.forward;return function(o){var s=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=n.share(o),p=c(n.filter((function(e){return!u(e)}))(f)),l=n.map((function(e){var n,o,i;return o=(n=r[e.key]).error,{operation:e,data:(i=n.data)?JSON.parse(i):void 0,extensions:void 0,error:o?new t.CombinedError({networkError:o.networkError?new Error(o.networkError):void 0,graphQLErrors:o.graphQLErrors&&o.graphQLErrors.length?o.graphQLErrors:void 0}):void 0}}))(n.filter((function(e){return u(e)}))(f));return s?l=n.tap(i)(l):p=n.tap((function(e){var t=e.operation;if(!k(t)){var n=function(e){var t=e.data,n=e.error,r={};return void 0!==t&&(r.data=JSON.stringify(t)),n&&(r.error={graphQLErrors:n.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},n.networkError&&(r.error.networkError=""+n.networkError)),r}(e);r[t.key]=n}}))(p),n.merge([p,l])}};return a.restoreData=function(e){return t._extends(r,e)},a.extractData=function(){return t._extends({},r)},e&&e.initialState&&a.restoreData(e.initialState),a},exports.subscriptionExchange=function(r){var o=r.forwardSubscription,i=r.enableAllOperations;return function(r){var u=r.client,a=r.forward;function c(e){var t=e.kind;return"subscription"===t||!!i&&("query"===t||"mutation"===t)}return function(r){var i=n.share(r),s=n.mergeMap((function(r){var a=r.key,c=n.filter((function(e){return"teardown"===e.kind&&e.key===a}))(i);return n.takeUntil(c)(function(r){var i=o({key:r.key.toString(36),query:e.print(r.query),variables:r.variables,context:t._extends({},r.context)});return n.make((function(e){var n,o=e.next,a=e.complete,c=!1;return Promise.resolve().then((function(){c||(n=i.subscribe({next:function(e){return o(t.makeResult(r,e))},error:function(e){return o(t.makeErrorResult(r,e))},complete:function(){c||(c=!0,"subscription"===r.kind&&u.reexecuteOperation(f("teardown",r,r.context)),a())}}))})),function(){c=!0,n&&n.unsubscribe()}}))}(r))}))(n.filter(c)(i)),p=a(n.filter((function(e){return!c(e)}))(i));return n.merge([s,p])}}};
var e=require("graphql"),t=require("./5f352e3e.min.js"),n=require("wonka");function r(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)r(e[n],t);else if("object"==typeof e&&null!==e)for(var o in e)"__typename"===o&&"string"==typeof e[o]?t[e[o]]=0:r(e[o],t);return t}function o(e){return Object.keys(r(e,{}))}var i=function(n){if(n.selectionSet&&!n.selectionSet.selections.some((function(t){return t.kind===e.Kind.FIELD&&"__typename"===t.name.value&&!t.alias})))return t._extends({},n,{selectionSet:t._extends({},n.selectionSet,{selections:n.selectionSet.selections.concat([{kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"}}])})})},u=new Map;function a(n){var r=t.keyDocument(n),o=u.get(r.__key);return o||((o=e.visit(r,{Field:i,InlineFragment:i})).__key=r.__key,u.set(r.__key,o)),o}function c(e){return e&&"object"==typeof e?Object.keys(e).reduce((function(t,n){var r=e[n];return"__typename"===n?Object.defineProperty(t,"__typename",{enumerable:!1,value:r}):t[n]=Array.isArray(r)?r.map(c):r&&"object"==typeof r&&"__typename"in r?c(r):r,t}),{}):e}function s(e){return e.toPromise=function(){return n.toPromise(n.take(1)(n.filter((function(e){return!e.stale}))(e)))},e}function f(e,t,n){return n||(n=t.context),{key:t.key,query:t.query,variables:t.variables,kind:e,context:n}}function p(e,n){return f(e.kind,e,t._extends({},e.context,{meta:t._extends({},e.context.meta,n)}))}function l(){}function d(n,r,o){for(var i=0;i<o.length;i++)if(o[i].kind===e.Kind.FRAGMENT_DEFINITION){var u=o[i].name.value,a=t.stringifyDocument(o[i]);n.has(u)||(n.set(u,a),r.push(o[i]))}else r.push(o[i])}function k(e){var t=e.kind;return"subscription"!==t&&"query"!==t}function y(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function m(e){var r=e.forward,i=e.client,u=new Map,c=Object.create(null);function s(e){var t=f(e.kind,e);return t.query=a(e.query),t}function l(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||u.has(e.key))}return function(e){var a=n.share(e),f=n.map((function(e){var n=u.get(e.key),r=t._extends({},n,{operation:p(e,{cacheOutcome:n?"hit":"miss"})});return"cache-and-network"===e.context.requestPolicy&&(r.stale=!0,x(i,e)),r}))(n.filter((function(e){return!y(e)&&l(e)}))(a)),d=n.tap((function(e){var t=e.operation;if(t){var n=o(e.data).concat(t.context.additionalTypenames||[]);if("mutation"===e.operation.kind){for(var r=new Set,a=0;a<n.length;a++){var s=n[a],f=c[s]||(c[s]=new Set);f.forEach((function(e){r.add(e)})),f.clear()}r.forEach((function(e){u.has(e)&&(t=u.get(e).operation,u.delete(e),x(i,t))}))}else if("query"===t.kind&&e.data){u.set(t.key,e);for(var p=0;p<n.length;p++){var l=n[p];(c[l]||(c[l]=new Set)).add(t.key)}}}}))(r(n.filter((function(e){return"query"!==e.kind||"cache-only"!==e.context.requestPolicy}))(n.map((function(e){return p(e,{cacheOutcome:"miss"})}))(n.merge([n.map(s)(n.filter((function(e){return!y(e)&&!l(e)}))(a)),n.filter((function(e){return y(e)}))(a)])))));return n.merge([f,d])}}function x(e,n){return e.reexecuteOperation(f(n.kind,n,t._extends({},n.context,{requestPolicy:"network-only"})))}function h(e){var t=e.forward,r=new Set;function o(e){var t=e.key,n=e.kind;if("teardown"===n)return r.delete(t),!0;if("query"!==n&&"subscription"!==n)return!0;var o=r.has(t);return r.add(t),!o}function i(e){r.delete(e.operation.key)}return function(e){var r=n.filter(o)(e);return n.tap(i)(t(r))}}function v(e){var r=e.forward;return function(e){var o=n.share(e),i=n.mergeMap((function(e){var r=e.key,i=n.filter((function(e){return"teardown"===e.kind&&e.key===r}))(o),u=t.makeFetchBody(e),a=t.makeFetchURL(e,u),c=t.makeFetchOptions(e,u);return n.onPush((function(e){}))(n.takeUntil(i)(t.makeFetchSource(e,a,c)))}))(n.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),u=r(n.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return n.merge([i,u])}}function g(e){return function(e){return n.filter((function(){return!1}))(n.tap((function(e){}))(e))}}var b=g();function q(e){return function(t){var n=t.client;return e.reduceRight((function(e,t){return t({client:n,forward:e,dispatchDebug:function(e){}})}),t.forward)}}var w=[h,m,v],E=function e(r){var o=new Map,i=new Map,u=[],a=n.makeSubject(),p=a.source,d=a.next,k=!1;function y(e){for(k=!0,e&&d(e);e=u.shift();)d(e);k=!1}function m(e){var r=n.filter((function(t){return t.operation.kind===e.kind&&t.operation.key===e.key}))(E);if(h.maskTypename&&(r=n.map((function(e){return t._extends({},e,{data:c(e.data)})}))(r)),"mutation"===e.kind)return n.take(1)(n.onStart((function(){return y(e)}))(r));var a=n.share(n.onEnd((function(){o.delete(e.key),i.delete(e.key);for(var t=u.length-1;t>=0;t--)u[t].key===e.key&&u.splice(t,1);y(f("teardown",e,e.context))}))(n.onStart((function(){i.set(e.key,a)}))(n.onPush((function(t){o.set(e.key,t)}))(n.switchMap((function(r){return r.stale?n.fromValue(r):n.merge([n.fromValue(r),n.map((function(){return t._extends({},r,{stale:!0})}))(n.take(1)(n.filter((function(t){return t.kind===e.kind&&t.key===e.key&&("network-only"===t.context.requestPolicy||"cache-and-network"===t.context.requestPolicy)}))(p)))])}))(n.takeUntil(n.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(p))(r))))));return a}var x=this instanceof e?this:Object.create(e.prototype),h=t._extends(x,{url:r.url,fetchOptions:r.fetchOptions,fetch:r.fetch,suspense:!!r.suspense,requestPolicy:r.requestPolicy||"cache-first",preferGetMethod:!!r.preferGetMethod,maskTypename:!!r.maskTypename,operations$:p,reexecuteOperation:function(e){("mutation"===e.kind||i.has(e.key))&&(u.push(e),k||Promise.resolve().then(y))},createOperationContext:function(e){return e||(e={}),t._extends({},{url:h.url,fetchOptions:h.fetchOptions,fetch:h.fetch,preferGetMethod:h.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&h.suspense,requestPolicy:e.requestPolicy||h.requestPolicy})},createRequestOperation:function(e,t,n){return f(e,t,h.createOperationContext(n))},executeRequestOperation:function(e){if("mutation"===e.kind)return m(e);var r=i.get(e.key)||m(e),u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return n.make((function(i){return n.subscribe(i.next)(n.onEnd(i.complete)(n.onStart((function(){var n=o.get(e.key);if("subscription"===e.kind)return y(e);u&&y(e),null!=n&&n===o.get(e.key)?i.next(u?t._extends({},n,{stale:!0}):n):u||y(e)}))(r))).unsubscribe}))},executeQuery:function(e,t){var n=h.createRequestOperation("query",e,t);return h.executeRequestOperation(n)},executeSubscription:function(e,t){var n=h.createRequestOperation("subscription",e,t);return h.executeRequestOperation(n)},executeMutation:function(e,t){var n=h.createRequestOperation("mutation",e,t);return h.executeRequestOperation(n)},query:function(e,n,r){return r&&"boolean"==typeof r.suspense||(r=t._extends({},r,{suspense:!1})),s(h.executeQuery(t.createRequest(e,n),r))},readQuery:function(e,t,r){var o=null;return n.subscribe((function(e){o=e}))(h.query(e,t,r)).unsubscribe(),o},subscription:function(e,n,r){return h.executeSubscription(t.createRequest(e,n),r)},mutation:function(e,n,r){return s(h.executeMutation(t.createRequest(e,n),r))}}),v=l,b=q(void 0!==r.exchanges?r.exchanges:w),E=n.share(b({client:h,dispatchDebug:v,forward:g()})(p));return n.publish(E),h},_=E;exports.CombinedError=t.CombinedError,exports.createRequest=t.createRequest,exports.getOperationName=t.getOperationName,exports.makeErrorResult=t.makeErrorResult,exports.makeResult=t.makeResult,exports.stringifyVariables=t.stringifyVariables,exports.Client=E,exports.cacheExchange=m,exports.composeExchanges=q,exports.createClient=_,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=h,exports.defaultExchanges=w,exports.errorExchange=function(e){var t=e.onError;return function(e){var r=e.forward;return function(e){return n.tap((function(e){var n=e.error;n&&t(n,e.operation)}))(r(e))}}},exports.fallbackExchangeIO=b,exports.fetchExchange=v,exports.formatDocument=a,exports.gql=function(){for(var n=arguments,r=new Map,o=[],i=[],u=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",a=1;a<arguments.length;a++){var c=n[a];c&&c.definitions?i.push.apply(i,c.definitions):u+=c,u+=n[0][a]}return d(r,o,t.keyDocument(u).definitions),d(r,o,i),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:o})},exports.makeOperation=f,exports.maskTypename=c,exports.ssrExchange=function(e){var r={},o=[];function i(e){o.push(e.operation.key),1===o.length&&Promise.resolve().then((function(){for(var e;e=o.shift();)delete r[e]}))}function u(e){return!k(e)&&void 0!==r[e.key]}var a=function(o){var a=o.client,c=o.forward;return function(o){var s=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=n.share(o),p=c(n.filter((function(e){return!u(e)}))(f)),l=n.map((function(e){var n,o,i;return o=(n=r[e.key]).error,{operation:e,data:(i=n.data)?JSON.parse(i):void 0,extensions:void 0,error:o?new t.CombinedError({networkError:o.networkError?new Error(o.networkError):void 0,graphQLErrors:o.graphQLErrors&&o.graphQLErrors.length?o.graphQLErrors:void 0}):void 0}}))(n.filter((function(e){return u(e)}))(f));return s?l=n.tap(i)(l):p=n.tap((function(e){var t=e.operation;if(!k(t)){var n=function(e){var t=e.data,n=e.error,r={};return void 0!==t&&(r.data=JSON.stringify(t)),n&&(r.error={graphQLErrors:n.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},n.networkError&&(r.error.networkError=""+n.networkError)),r}(e);r[t.key]=n}}))(p),n.merge([p,l])}};return a.restoreData=function(e){return t._extends(r,e)},a.extractData=function(){return t._extends({},r)},e&&e.initialState&&a.restoreData(e.initialState),a},exports.subscriptionExchange=function(r){var o=r.forwardSubscription,i=r.enableAllOperations;return function(r){var u=r.client,a=r.forward;function c(e){var t=e.kind;return"subscription"===t||!!i&&("query"===t||"mutation"===t)}return function(r){var i=n.share(r),s=n.mergeMap((function(r){var a=r.key,c=n.filter((function(e){return"teardown"===e.kind&&e.key===a}))(i);return n.takeUntil(c)(function(r){var i=o({key:r.key.toString(36),query:e.print(r.query),variables:r.variables,context:t._extends({},r.context)});return n.make((function(e){var n,o=e.next,a=e.complete,c=!1;return Promise.resolve().then((function(){c||(n=i.subscribe({next:function(e){return o(t.makeResult(r,e))},error:function(e){return o(t.makeErrorResult(r,e))},complete:function(){c||(c=!0,"subscription"===r.kind&&u.reexecuteOperation(f("teardown",r,r.context)),a())}}))})),function(){c=!0,n&&n.unsubscribe()}}))}(r))}))(n.filter(c)(i)),p=a(n.filter((function(e){return!c(e)}))(i));return n.merge([s,p])}}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "2.1.3",
"version": "2.1.4",
"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

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