Socket
Socket
Sign inDemoInstall

@urql/core

Package Overview
Dependencies
Maintainers
31
Versions
259
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.10.8 to 1.10.9

6

CHANGELOG.md
# @urql/core
## 1.10.9
### Patch Changes
- Pick modules from graphql package, instead of importing from graphql/index.mjs, by [@kitten](https://github.com/kitten) (See [#700](https://github.com/FormidableLabs/urql/pull/700))
## 1.10.8

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

22

dist/urql-core.js
"use strict";
var wonka = require("wonka"), graphql = require("graphql");
var wonka = require("wonka"), GraphQLError = require("graphql/error/GraphQLError"), parser = require("graphql/language/parser"), printer = require("graphql/language/printer"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor");

@@ -18,3 +18,3 @@ function _extends() {

var rehydrateGraphQlError = function(a) {
return "string" == typeof a ? new graphql.GraphQLError(a) : "object" == typeof a && a.message ? new graphql.GraphQLError(a.message, a.nodes, a.source, a.positions, a.path, a, a.extensions || {}) : a;
return "string" == typeof a ? new GraphQLError.GraphQLError(a) : "object" == typeof a && a.message ? new GraphQLError.GraphQLError(a.message, a.nodes, a.source, a.positions, a.path, a, a.extensions || {}) : a;
};

@@ -97,5 +97,5 @@

var c = hashQuery(a);
a = void 0 !== docs[c] ? docs[c] : graphql.parse(a);
a = void 0 !== docs[c] ? docs[c] : parser.parse(a);
} else {
void 0 !== a.__key ? c = a.__key : (c = hashQuery(graphql.print(a)), a = void 0 !== docs[c] ? docs[c] : a);
void 0 !== a.__key ? c = a.__key : (c = hashQuery(printer.print(a)), a = void 0 !== docs[c] ? docs[c] : a);
}

@@ -158,3 +158,3 @@ docs[c] = a;

function _ref3(a) {
return a.kind === graphql.Kind.FIELD && "__typename" === a.name.value;
return a.kind === kinds.Kind.FIELD && "__typename" === a.name.value;
}

@@ -165,5 +165,5 @@

return a.selectionSet.selections.push({
kind: graphql.Kind.FIELD,
kind: kinds.Kind.FIELD,
name: {
kind: graphql.Kind.NAME,
kind: kinds.Kind.NAME,
value: "__typename"

@@ -174,3 +174,3 @@ }

}, formatDocument = function(a) {
return graphql.visit(a, {
return visitor.visit(a, {
Field: formatNode,

@@ -356,3 +356,3 @@ InlineFragment: formatNode

function _ref3$2(a) {
return a.kind === graphql.Kind.OPERATION_DEFINITION && a.name;
return a.kind === kinds.Kind.OPERATION_DEFINITION && a.name;
}

@@ -370,3 +370,3 @@

}(a.query), h = {
query: graphql.print(a.query),
query: printer.print(a.query),
variables: a.variables

@@ -693,3 +693,3 @@ };

key: a.key.toString(36),
query: graphql.print(a.query),
query: printer.print(a.query),
variables: a.variables,

@@ -696,0 +696,0 @@ context: _extends({}, a.context)

@@ -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=C(s,t,c),l=L(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"})}))},C=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)}},L=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)})))}},M=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,o=!1;return(n.fetch||fetch)(n.url,t).then((function(e){return r=e,o=200>e.status||e.status>=("manual"===t.redirect?400:300),e.json()})).then((function(t){if(!("data"in t)&&!("errors"in t))throw Error("No Content");return d(e,t,r)})).catch((function(t){if("AbortError"!==t.name)return v(e,o?Error(r.statusText):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=[M,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=M,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/error/GraphQLError"),r=require("graphql/language/parser"),n=require("graphql/language/printer"),o=require("graphql/language/kinds"),i=require("graphql/language/visitor");function a(){return(a=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 u=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 s(){return this.message}var c=function(e){function t(t){var r=t.networkError,n=t.response,o=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(u));e.call(this,o),this.name="CombinedError",this.message=o,this.graphQLErrors=t,this.networkError=r,this.response=n}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toString=s,t}(Error),f=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},p=new Set,l=new WeakMap,h=function(e){if(null===e||p.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=h(e[r]);t+=0<o.length?o:"null"}return t+"]"}if(!(t=Object.keys(e).sort()).length&&e.constructor&&e.constructor!==Object)return t=l.get(e)||Math.random().toString(36).slice(2),l.set(e,t),'{"__key":"'+t+'"}';for(p.add(e),r="{",n=0,o=t.length;n<o;n++){var i=t[n],a=h(e[i]);a&&(1<r.length&&(r+=","),r+=h(i)+":"+a)}return p.delete(e),r+"}"},y=function(e){return p.clear(),h(e)},d=function(e){return function(e){return f(5381,e)>>>0}(e.replace(/[\s,]+/g," ").trim())},v=Object.create(null),m=function(e,t){if("string"==typeof e){var o=d(e);e=void 0!==v[o]?v[o]:r.parse(e)}else void 0!==e.__key?o=e.__key:(o=d(n.print(e)),e=void 0!==v[o]?v[o]:e);return v[o]=e,e.__key=o,{key:t?f(o,y(t))>>>0:o,query:e,variables:t||{}}},x=function(e,t){return a({},e,{context:a({},e.context,{meta:a({},e.context.meta,t)})})},g=function(e,t,r){return{operation:e,data:t.data,error:Array.isArray(t.errors)?new c({graphQLErrors:t.errors,response:r}):void 0,extensions:"object"==typeof t.extensions&&t.extensions||void 0}},k=function(e,t,r){return{operation:e,data:void 0,error:new c({networkError:t,response:r}),extensions:void 0}},O=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){O(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):O(e[r],t);return t};function b(e,t,r){return r.indexOf(e)===t}var q=function(e){return O(e).filter(b)};function E(e){return e.kind===o.Kind.FIELD&&"__typename"===e.name.value}var w=function(e){if(e.selectionSet&&!e.selectionSet.selections.some(E))return e.selectionSet.selections.push({kind:o.Kind.FIELD,name:{kind:o.Kind.NAME,value:"__typename"}}),e},N=function(e){return i.visit(e,{Field:w,InlineFragment:w})},S=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(S):n&&"object"==typeof n&&"__typename"in n?S(n):n,t}),{}):e};function _(t){return t.toPromise=function(){return e.toPromise(e.take(1)(t))},t}var j=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function P(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var Q=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function A(e){return a({},e,{query:N(e.query)})}function L(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function R(e){return x(e,{cacheOutcome:"miss"})}function C(e){return Q(e)}var M=function(t){function r(e){var t=c.get(e.key);return t=a({},t,{operation:x(e,{cacheOutcome:t?"hit":"miss"})}),"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,I(s,e)),t}function n(e){return!Q(e)&&h(e)}function o(e){e.operation&&"mutation"===e.operation.operationName?p(e):e.operation&&"query"===e.operation.operationName&&l(e)}function i(e){return!Q(e)&&!h(e)}var u=t.forward,s=t.client,c=new Map;t=Object.create(null);var f=A,p=T(c,t,s),l=G(c,t),h=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||c.has(e.key))};return function(t){var a=e.share(t);return t=e.map(r)(e.filter(n)(a)),a=e.tap(o)(u(e.filter(L)(e.map(R)(e.merge([e.map(f)(e.filter(i)(a)),e.filter(C)(a)]))))),e.merge([t,a])}},I=function(e,t){return e.reexecuteOperation(a({},t,{context:a({},t.context,{requestPolicy:"network-only"})}))},T=function(e,t,r){function n(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),I(r,n)}}return function(e){function r(e){o.add(e)}var o=new Set,i=e.operation.context.additionalTypenames;q(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),o.forEach(n)}},G=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}),q(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},D=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 $(e){return"query"===e.operationName||"mutation"===e.operationName}function F(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var J=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)(K(t,"query"===t.operationName&&!!t.context.preferGetMethod))}))(e.filter($)(n));var o=r(e.filter(F)(n));return e.merge([t,o])}};function U(e){return e.kind===o.Kind.OPERATION_DEFINITION&&e.name}var K=function(t,r){return e.make((function(e){var o=e.next,i=e.complete,u="undefined"!=typeof AbortController?new AbortController:void 0;e="function"==typeof(e=t.context).fetchOptions?e.fetchOptions():e.fetchOptions||{};var s=function(e){return(e=e.definitions.find(U))?e.name.value:null}(t.query),c={query:n.print(t.query),variables:t.variables};null!==s&&(c.operationName=s);var f=a({},e,{body:r?void 0:JSON.stringify(c),method:r?"GET":"POST",headers:a({},{"content-type":"application/json"},e.headers),signal:void 0!==u?u.signal:void 0});r&&(t.context.url=W(t.context.url,c));var p=!1;return Promise.resolve().then((function(){return p?void 0:V(t,f)})).then((function(e){p||(p=!0,e&&o(e),i())})),function(){p=!0,void 0!==u&&u.abort()}}))},V=function(e,t){var r,n=e.context,o=!1;return(n.fetch||fetch)(n.url,t).then((function(e){return r=e,o=200>e.status||e.status>=("manual"===t.redirect?400:300),e.json()})).then((function(t){if(!("data"in t)&&!("errors"in t))throw Error("No Content");return g(e,t,r)})).catch((function(t){if("AbortError"!==t.name)return k(e,o?Error(r.statusText):t,r)}))},W=function(e,t){var r=["query="+encodeURIComponent(t.query)];return t.variables&&r.push("variables="+encodeURIComponent(JSON.stringify(t.variables))),e+"?"+r.join("&")};function z(){return!1}function B(e){}var H=function(t){return e.filter(z)(e.tap(B)(t))},X=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)}},Y=[D,M,J],Z=function(t){var r=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(e){return a({},{url:r.url,fetchOptions:r.fetchOptions,fetch:r.fetch,preferGetMethod:r.preferGetMethod},e,{requestPolicy:(e||{}).requestPolicy||r.requestPolicy})},this.createRequestOperation=function(e,t,n){return{key:t.key,query:t.query,variables:t.variables,operationName:e,context:r.createOperationContext(n)}},this.reexecuteOperation=function(e){0<(r.activeOperations[e.key]||0)&&(r.queue.push(e),r.dispatchOperation())},this.executeQuery=function(t,n){t=r.createRequestOperation("query",t,n);var o=r.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=r.createRequestOperation("subscription",e,t),r.executeRequestOperation(e)},this.executeMutation=function(e,t){return e=r.createRequestOperation("mutation",e,t),r.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 n=e.makeSubject(),o=n.next;this.operations$=n.source;var i=!1;this.dispatchOperation=function(e){if(i)e&&o(e);else{for(i=!0,e&&o(e);e=r.queue.shift();)o(e);i=!1}},t=X(void 0!==t.exchanges?t.exchanges:Y),this.results$=e.share(t({client:this,forward:H})(this.operations$)),e.publish(this.results$)};function ee(e){return e.data=S(e.data),e}Z.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},Z.prototype.onOperationEnd=function(e){var t=e.key,r=this.activeOperations[t]||0;0>=(this.activeOperations[t]=0>=r?0:r-1)&&this.dispatchOperation(a({},e,{operationName:"teardown"}))},Z.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(ee)(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},Z.prototype.query=function(e,t,r){return r&&"boolean"==typeof r.suspense||(r=a({},r,{suspense:!1})),_(this.executeQuery(m(e,t),r))},Z.prototype.readQuery=function(t,r,n){var o=null;return e.subscribe((function(e){o=e}))(this.executeQuery(m(t,r),n)).unsubscribe(),o},Z.prototype.mutation=function(e,t,r){return _(this.executeMutation(m(e,t),r))},exports.Client=Z,exports.CombinedError=c,exports.cacheExchange=M,exports.composeExchanges=X,exports.createClient=function(e){return new Z(e)},exports.createRequest=m,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=D,exports.defaultExchanges=Y,exports.fallbackExchangeIO=H,exports.fetchExchange=J,exports.formatDocument=N,exports.makeErrorResult=k,exports.makeResult=g,exports.maskTypename=S,exports.ssrExchange=function(t){function r(e){return!f(e)}function n(e){return function(e,t){var r=t.error;return{operation:e,data:t.data,extensions:void 0,error:r?new c({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 o(e){return f(e)}function i(e){var t=e.operation;j(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(P),networkError:t.networkError?""+t.networkError:void 0}),e}(e),s[t.key]=e)}function u(e){delete s[e.operation.key]}var s={},f=function(e){return!j(e)&&void 0!==s[e.key]},p=function(a){var s=a.client,c=a.forward;return function(a){var f=t&&"boolean"==typeof t.isClient?!!t.isClient:!s.suspense,p=e.share(a);return a=c(e.filter(r)(p)),p=e.map(n)(e.filter(o)(p)),f?p=e.tap(u)(p):a=e.tap(i)(a),e.merge([a,p])}};return p.restoreData=function(e){return a(s,e)},p.extractData=function(){return a({},s)},t&&t.initialState&&p.restoreData(t.initialState),p},exports.stringifyVariables=y,exports.subscriptionExchange=function(t){function r(e){return"subscription"===(e=e.operationName)||!!i&&("query"===e||"mutation"===e)}var o=t.forwardSubscription,i=t.enableAllOperations;return function(t){function i(e){return!f(e)}var u=t.client,s=t.forward,c=function(t){var r=o({key:t.key.toString(36),query:n.print(t.query),variables:t.variables,context:a({},t.context)});return e.make((function(e){function n(e){return c(g(t,e))}function o(e){return c(k(t,e))}function i(){p||(p=!0,"subscription"===t.operationName&&u.reexecuteOperation(a({},t,{operationName:"teardown"})),f())}var s,c=e.next,f=e.complete,p=!1;return Promise.resolve().then((function(){p||(s=r.subscribe({next:n,error:o,complete:i}))})),function(){p=!0,s&&s.unsubscribe()}}))},f=r;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)(c(t))}))(e.filter(f)(r));var n=s(e.filter(i)(r));return e.merge([t,n])}}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "1.10.8",
"version": "1.10.9",
"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