@urql/core
Advanced tools
Comparing version 2.3.6 to 2.4.0
# @urql/core | ||
## 2.4.0 | ||
### Minor Changes | ||
- Allow for repeated mutations that have similar inputs which results in the same key, this is for instance the case with file uploads, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#2189](https://github.com/FormidableLabs/urql/pull/2189)) | ||
### Patch Changes | ||
- Bump `@graphql-typed-document-node/core` to 3.1.1 for `graphql@16` support, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#2153](https://github.com/FormidableLabs/urql/pull/2153)) | ||
- ⚠️ Fix error bubbling, when an error happened in the exchange-pipeline we would treat it as a GraphQL-error, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#2210](https://github.com/FormidableLabs/urql/pull/2210)) | ||
- Filter `network-only` requests from the `ssrExchange`, this is to enable `staleWhileRevalidated` queries to successfully dispatch their queries, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#2198](https://github.com/FormidableLabs/urql/pull/2198)) | ||
## 2.3.6 | ||
@@ -4,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e = require("./878a8849.js"); | ||
var e = require("./4f228e75.js"); | ||
@@ -3,0 +3,0 @@ exports.makeFetchBody = e.makeFetchBody; |
@@ -1,2 +0,2 @@ | ||
var e=require("./d354e5b3.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL; | ||
var e=require("./7d0a46dc.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 |
var e = require("graphql"); | ||
var t = require("./878a8849.js"); | ||
var t = require("./4f228e75.js"); | ||
@@ -395,3 +395,7 @@ var r = require("wonka"); | ||
var i = r.filter((function(t) { | ||
return t.operation.kind === e.kind && t.operation.key === e.key; | ||
if ("mutation" === t.operation.kind) { | ||
return t.operation === e; | ||
} else { | ||
return t.operation.kind === e.kind && t.operation.key === e.key; | ||
} | ||
}))(k); | ||
@@ -696,3 +700,3 @@ if (l.maskTypename) { | ||
}))(r.filter((function(e) { | ||
return !!i[e.key]; | ||
return !!i[e.key] && "network-only" !== e.context.requestPolicy; | ||
}))(f)); | ||
@@ -699,0 +703,0 @@ if (!p) { |
@@ -1,2 +0,2 @@ | ||
var e=require("graphql"),t=require("./d354e5b3.min.js"),r=require("wonka");function n(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)n(e[r],t);else if("object"==typeof e&&null!==e)for(var o in e)"__typename"===o&&"string"==typeof e[o]?t[e[o]]=0:n(e[o],t);return t}function o(e){return Object.keys(n(e,{}))}var i=function(r){if(r.selectionSet&&!r.selectionSet.selections.some((function(t){return t.kind===e.Kind.FIELD&&"__typename"===t.name.value&&!t.alias})))return t._extends({},r,{selectionSet:t._extends({},r.selectionSet,{selections:r.selectionSet.selections.concat([{kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"}}])})})},a=new Map;function u(r){var n=t.keyDocument(r),o=a.get(n.__key);return o||(o=e.visit(n,{Field:i,InlineFragment:i}),Object.defineProperty(o,"__key",{value:n.__key,enumerable:!1}),a.set(n.__key,o)),o}function s(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}),Array.isArray(e)?[]:{}):e}function c(e){return e.toPromise=function(){return r.toPromise(r.take(1)(r.filter((function(e){return!e.stale&&!e.hasNext}))(e)))},e}function f(e,t,r){return r||(r=t.context),{key:t.key,query:t.query,variables:t.variables,kind:e,context:r}}function p(e,r){return f(e.kind,e,t._extends({},e.context,{meta:t._extends({},e.context.meta,r)}))}function l(){}function d(r,n,o){for(var i=0;i<o.length;i++)if(o[i].kind===e.Kind.FRAGMENT_DEFINITION){var a=o[i].name.value,u=t.stringifyDocument(o[i]);r.has(a)||(r.set(a,u),n.push(o[i]))}else n.push(o[i])}function y(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function k(e){var n=e.forward,i=e.client,a=new Map,s=Object.create(null);function c(e){var t=f(e.kind,e);return t.query=u(e.query),t}function l(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||a.has(e.key))}return function(e){var u=r.share(e),f=r.map((function(e){var r=a.get(e.key),n=t._extends({},r,{operation:p(e,{cacheOutcome:r?"hit":"miss"})});return"cache-and-network"===e.context.requestPolicy&&(n.stale=!0,x(i,e)),n}))(r.filter((function(e){return!y(e)&&l(e)}))(u)),d=r.tap((function(e){var t=e.operation;if(t){var r=o(e.data).concat(t.context.additionalTypenames||[]);if("mutation"===e.operation.kind){for(var n=new Set,u=0;u<r.length;u++){var c=r[u],f=s[c]||(s[c]=new Set);f.forEach((function(e){n.add(e)})),f.clear()}n.forEach((function(e){a.has(e)&&(t=a.get(e).operation,a.delete(e),x(i,t))}))}else if("query"===t.kind&&e.data){a.set(t.key,e);for(var p=0;p<r.length;p++){var l=r[p];(s[l]||(s[l]=new Set)).add(t.key)}}}}))(n(r.filter((function(e){return"query"!==e.kind||"cache-only"!==e.context.requestPolicy}))(r.map((function(e){return p(e,{cacheOutcome:"miss"})}))(r.merge([r.map(c)(r.filter((function(e){return!y(e)&&!l(e)}))(u)),r.filter((function(e){return y(e)}))(u)])))));return r.merge([f,d])}}function x(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))}var h=new Set;function m(e){var t=e.forward,n=new Set;function o(e){var t=e.key,r=e.kind;if("teardown"===r)return n.delete(t),!0;if("query"!==r&&"subscription"!==r)return!0;var o=n.has(t);return n.add(t),!o}function i(e){e.hasNext||n.delete(e.operation.key)}return function(e){var n=r.filter(o)(e);return r.tap(i)(t(n))}}function v(e){var n=e.forward;return function(e){var o=r.share(e),i=r.mergeMap((function(e){var n=e.key,i=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(o),a=t.makeFetchBody(e),u=t.makeFetchURL(e,a),s=t.makeFetchOptions(e,a);return r.onPush((function(e){}))(r.takeUntil(i)(t.makeFetchSource(e,u,s)))}))(r.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),a=n(r.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return r.merge([i,a])}}function g(e){return function(e){return r.filter((function(){return!1}))(r.tap((function(e){}))(e))}}var b=g();function q(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)}}var w=[m,k,v],E=function e(n){var o=new Map,i=new Map,a=[],u=r.makeSubject(),p=u.source,d=u.next,y=!1;function k(e){for(y=!0,e&&d(e);e=a.shift();)d(e);y=!1}function x(e){var n=r.filter((function(t){return t.operation.kind===e.kind&&t.operation.key===e.key}))(E);return m.maskTypename&&(n=r.map((function(e){return t._extends({},e,{data:s(e.data)})}))(n)),"mutation"===e.kind?r.take(1)(r.onStart((function(){return k(e)}))(n)):r.share(r.onEnd((function(){o.delete(e.key),i.delete(e.key);for(var t=a.length-1;t>=0;t--)a[t].key===e.key&&a.splice(t,1);k(f("teardown",e,e.context))}))(r.onPush((function(t){o.set(e.key,t)}))(r.switchMap((function(n){return"query"!==e.kind||n.stale?r.fromValue(n):r.merge([r.fromValue(n),r.map((function(){return t._extends({},n,{stale:!0})}))(r.take(1)(r.filter((function(t){return"query"===t.kind&&t.key===e.key&&"cache-only"!==t.context.requestPolicy}))(p)))])}))(r.takeUntil(r.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(p))(n)))))}var h=this instanceof e?this:Object.create(e.prototype),m=t._extends(h,{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,suspense:!!n.suspense,requestPolicy:n.requestPolicy||"cache-first",preferGetMethod:!!n.preferGetMethod,maskTypename:!!n.maskTypename,operations$:p,reexecuteOperation:function(e){("mutation"===e.kind||i.has(e.key))&&(a.push(e),y||Promise.resolve().then(k))},createOperationContext:function(e){return e||(e={}),t._extends({},{url:m.url,fetchOptions:m.fetchOptions,fetch:m.fetch,preferGetMethod:m.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&m.suspense,requestPolicy:e.requestPolicy||m.requestPolicy})},createRequestOperation:function(e,r,n){return t.getOperationType(r.query),f(e,r,m.createOperationContext(n))},executeRequestOperation:function(e){return"mutation"===e.kind?x(e):r.make((function(n){var a=i.get(e.key);a||i.set(e.key,a=x(e));var u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return r.subscribe(n.next)(r.onEnd(n.complete)(r.onStart((function(){var r=o.get(e.key);if("subscription"===e.kind)return k(e);u&&k(e),null!=r&&r===o.get(e.key)?n.next(u?t._extends({},r,{stale:!0}):r):u||k(e)}))(a))).unsubscribe}))},executeQuery:function(e,t){var r=m.createRequestOperation("query",e,t);return m.executeRequestOperation(r)},executeSubscription:function(e,t){var r=m.createRequestOperation("subscription",e,t);return m.executeRequestOperation(r)},executeMutation:function(e,t){var r=m.createRequestOperation("mutation",e,t);return m.executeRequestOperation(r)},query:function(e,r,n){return n&&"boolean"==typeof n.suspense||(n=t._extends({},n,{suspense:!1})),c(m.executeQuery(t.createRequest(e,r),n))},readQuery:function(e,t,n){var o=null;return r.subscribe((function(e){o=e}))(m.query(e,t,n)).unsubscribe(),o},subscription:function(e,r,n){return m.executeSubscription(t.createRequest(e,r),n)},mutation:function(e,r,n){return c(m.executeMutation(t.createRequest(e,r),n))}}),v=l,b=q(void 0!==n.exchanges?n.exchanges:w),E=r.share(b({client:m,dispatchDebug:v,forward:g()})(p));return r.publish(E),m},O=E;exports.CombinedError=t.CombinedError,exports.createRequest=t.createRequest,exports.getOperationName=t.getOperationName,exports.makeErrorResult=t.makeErrorResult,exports.makeResult=t.makeResult,exports.mergeResultPatch=t.mergeResultPatch,exports.stringifyVariables=t.stringifyVariables,exports.Client=E,exports.cacheExchange=k,exports.composeExchanges=q,exports.createClient=O,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=m,exports.defaultExchanges=w,exports.errorExchange=function(e){var t=e.onError;return function(e){var n=e.forward;return function(e){return r.tap((function(e){var r=e.error;r&&t(r,e.operation)}))(n(e))}}},exports.fallbackExchangeIO=b,exports.fetchExchange=v,exports.formatDocument=u,exports.gql=function(){for(var r=arguments,n=new Map,o=[],i=[],a=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",u=1;u<arguments.length;u++){var s=r[u];s&&s.definitions?i.push.apply(i,s.definitions):a+=s,a+=r[0][u]}return d(n,o,t.keyDocument(a).definitions),d(n,o,i),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:o})},exports.makeOperation=f,exports.maskTypename=s,exports.ssrExchange=function(e){var n=!(!e||!e.staleWhileRevalidate),o=!(!e||!e.includeExtensions),i={},a=[];function u(e){a.push(e.operation.key),1===a.length&&Promise.resolve().then((function(){for(var e;e=a.shift();)i[e]=null}))}var s=function(a){var s=a.client,c=a.forward;return function(a){var f=e&&"boolean"==typeof e.isClient?!!e.isClient:!s.suspense,p=r.share(a),l=c(r.filter((function(e){return!i[e.key]||!!i[e.key].hasNext}))(p)),d=r.map((function(e){var r=function(e,r,n){return{operation:e,data:r.data?JSON.parse(r.data):void 0,extensions:n&&r.extensions?JSON.parse(r.extensions):void 0,error:r.error?new t.CombinedError({networkError:r.error.networkError?new Error(r.error.networkError):void 0,graphQLErrors:r.error.graphQLErrors}):void 0,hasNext:r.hasNext}}(e,i[e.key],o);return n&&!h.has(e.key)&&(r.stale=!0,h.add(e.key),x(s,e)),r}))(r.filter((function(e){return!!i[e.key]}))(p));return f?d=r.tap(u)(d):l=r.tap((function(e){var t=e.operation;if("mutation"!==t.kind){var r=function(e,t){var r=e.hasNext,n=e.data,o=e.extensions,i=e.error,a={};return void 0!==n&&(a.data=JSON.stringify(n)),t&&void 0!==o&&(a.extensions=JSON.stringify(o)),r&&(a.hasNext=!0),i&&(a.error={graphQLErrors:i.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},i.networkError&&(a.error.networkError=""+i.networkError)),a}(e,o);i[t.key]=r}}))(l),r.merge([l,d])}};return s.restoreData=function(e){for(var t in e)null!==i[t]&&(i[t]=e[t])},s.extractData=function(){var e={};for(var t in i)null!=i[t]&&(e[t]=i[t]);return e},e&&e.initialState&&s.restoreData(e.initialState),s},exports.subscriptionExchange=function(n){var o=n.forwardSubscription,i=n.enableAllOperations;return function(n){var a=n.client,u=n.forward;function s(e){var t=e.kind;return"subscription"===t||!!i&&("query"===t||"mutation"===t)}return function(n){var i=r.share(n),c=r.mergeMap((function(n){var u=n.key,s=r.filter((function(e){return"teardown"===e.kind&&e.key===u}))(i);return r.takeUntil(s)(function(n){var i=o({key:n.key.toString(36),query:e.print(n.query),variables:n.variables,context:t._extends({},n.context)});return r.make((function(e){var r,o=e.next,u=e.complete,s=!1;return Promise.resolve().then((function(){s||(r=i.subscribe({next:function(e){return o(t.makeResult(n,e))},error:function(e){return o(t.makeErrorResult(n,e))},complete:function(){s||(s=!0,"subscription"===n.kind&&a.reexecuteOperation(f("teardown",n,n.context)),u())}}))})),function(){s=!0,r&&r.unsubscribe()}}))}(n))}))(r.filter(s)(i)),p=u(r.filter((function(e){return!s(e)}))(i));return r.merge([c,p])}}}; | ||
var e=require("graphql"),t=require("./7d0a46dc.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"}}])})})},a=new Map;function u(n){var r=t.keyDocument(n),o=a.get(r.__key);return o||(o=e.visit(r,{Field:i,InlineFragment:i}),Object.defineProperty(o,"__key",{value:r.__key,enumerable:!1}),a.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}),Array.isArray(e)?[]:{}):e}function s(e){return e.toPromise=function(){return n.toPromise(n.take(1)(n.filter((function(e){return!e.stale&&!e.hasNext}))(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 a=o[i].name.value,u=t.stringifyDocument(o[i]);n.has(a)||(n.set(a,u),r.push(o[i]))}else r.push(o[i])}function y(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function k(e){var r=e.forward,i=e.client,a=new Map,c=Object.create(null);function s(e){var t=f(e.kind,e);return t.query=u(e.query),t}function l(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||a.has(e.key))}return function(e){var u=n.share(e),f=n.map((function(e){var n=a.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)}))(u)),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,u=0;u<n.length;u++){var s=n[u],f=c[s]||(c[s]=new Set);f.forEach((function(e){r.add(e)})),f.clear()}r.forEach((function(e){a.has(e)&&(t=a.get(e).operation,a.delete(e),x(i,t))}))}else if("query"===t.kind&&e.data){a.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)}))(u)),n.filter((function(e){return y(e)}))(u)])))));return n.merge([f,d])}}function x(e,n){return e.reexecuteOperation(f(n.kind,n,t._extends({},n.context,{requestPolicy:"network-only"})))}var m=new Set;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){e.hasNext||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),a=t.makeFetchBody(e),u=t.makeFetchURL(e,a),c=t.makeFetchOptions(e,a);return n.onPush((function(e){}))(n.takeUntil(i)(t.makeFetchSource(e,u,c)))}))(n.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),a=r(n.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return n.merge([i,a])}}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,k,v],E=function e(r){var o=new Map,i=new Map,a=[],u=n.makeSubject(),p=u.source,d=u.next,y=!1;function k(e){for(y=!0,e&&d(e);e=a.shift();)d(e);y=!1}function x(e){var r=n.filter((function(t){return"mutation"===t.operation.kind?t.operation===e:t.operation.kind===e.kind&&t.operation.key===e.key}))(E);return h.maskTypename&&(r=n.map((function(e){return t._extends({},e,{data:c(e.data)})}))(r)),"mutation"===e.kind?n.take(1)(n.onStart((function(){return k(e)}))(r)):n.share(n.onEnd((function(){o.delete(e.key),i.delete(e.key);for(var t=a.length-1;t>=0;t--)a[t].key===e.key&&a.splice(t,1);k(f("teardown",e,e.context))}))(n.onPush((function(t){o.set(e.key,t)}))(n.switchMap((function(r){return"query"!==e.kind||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"query"===t.kind&&t.key===e.key&&"cache-only"!==t.context.requestPolicy}))(p)))])}))(n.takeUntil(n.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(p))(r)))))}var m=this instanceof e?this:Object.create(e.prototype),h=t._extends(m,{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))&&(a.push(e),y||Promise.resolve().then(k))},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,n,r){return t.getOperationType(n.query),f(e,n,h.createOperationContext(r))},executeRequestOperation:function(e){return"mutation"===e.kind?x(e):n.make((function(r){var a=i.get(e.key);a||i.set(e.key,a=x(e));var u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return n.subscribe(r.next)(n.onEnd(r.complete)(n.onStart((function(){var n=o.get(e.key);if("subscription"===e.kind)return k(e);u&&k(e),null!=n&&n===o.get(e.key)?r.next(u?t._extends({},n,{stale:!0}):n):u||k(e)}))(a))).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},O=E;exports.CombinedError=t.CombinedError,exports.createRequest=t.createRequest,exports.getOperationName=t.getOperationName,exports.makeErrorResult=t.makeErrorResult,exports.makeResult=t.makeResult,exports.mergeResultPatch=t.mergeResultPatch,exports.stringifyVariables=t.stringifyVariables,exports.Client=E,exports.cacheExchange=k,exports.composeExchanges=q,exports.createClient=O,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=u,exports.gql=function(){for(var n=arguments,r=new Map,o=[],i=[],a=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",u=1;u<arguments.length;u++){var c=n[u];c&&c.definitions?i.push.apply(i,c.definitions):a+=c,a+=n[0][u]}return d(r,o,t.keyDocument(a).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=!(!e||!e.staleWhileRevalidate),o=!(!e||!e.includeExtensions),i={},a=[];function u(e){a.push(e.operation.key),1===a.length&&Promise.resolve().then((function(){for(var e;e=a.shift();)i[e]=null}))}var c=function(a){var c=a.client,s=a.forward;return function(a){var f=e&&"boolean"==typeof e.isClient?!!e.isClient:!c.suspense,p=n.share(a),l=s(n.filter((function(e){return!i[e.key]||!!i[e.key].hasNext}))(p)),d=n.map((function(e){var n=function(e,n,r){return{operation:e,data:n.data?JSON.parse(n.data):void 0,extensions:r&&n.extensions?JSON.parse(n.extensions):void 0,error:n.error?new t.CombinedError({networkError:n.error.networkError?new Error(n.error.networkError):void 0,graphQLErrors:n.error.graphQLErrors}):void 0,hasNext:n.hasNext}}(e,i[e.key],o);return r&&!m.has(e.key)&&(n.stale=!0,m.add(e.key),x(c,e)),n}))(n.filter((function(e){return!!i[e.key]&&"network-only"!==e.context.requestPolicy}))(p));return f?d=n.tap(u)(d):l=n.tap((function(e){var t=e.operation;if("mutation"!==t.kind){var n=function(e,t){var n=e.hasNext,r=e.data,o=e.extensions,i=e.error,a={};return void 0!==r&&(a.data=JSON.stringify(r)),t&&void 0!==o&&(a.extensions=JSON.stringify(o)),n&&(a.hasNext=!0),i&&(a.error={graphQLErrors:i.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},i.networkError&&(a.error.networkError=""+i.networkError)),a}(e,o);i[t.key]=n}}))(l),n.merge([l,d])}};return c.restoreData=function(e){for(var t in e)null!==i[t]&&(i[t]=e[t])},c.extractData=function(){var e={};for(var t in i)null!=i[t]&&(e[t]=i[t]);return e},e&&e.initialState&&c.restoreData(e.initialState),c},exports.subscriptionExchange=function(r){var o=r.forwardSubscription,i=r.enableAllOperations;return function(r){var a=r.client,u=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 u=r.key,c=n.filter((function(e){return"teardown"===e.kind&&e.key===u}))(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,u=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&&a.reexecuteOperation(f("teardown",r,r.context)),u())}}))})),function(){c=!0,n&&n.unsubscribe()}}))}(r))}))(n.filter(c)(i)),p=u(n.filter((function(e){return!c(e)}))(i));return n.merge([s,p])}}}; | ||
//# sourceMappingURL=urql-core.min.js.map |
{ | ||
"name": "@urql/core", | ||
"version": "2.3.6", | ||
"version": "2.4.0", | ||
"description": "The shared core for the highly customizable and versatile GraphQL client", | ||
@@ -65,3 +65,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-typed-document-node/core": "^3.1.0", | ||
"@graphql-typed-document-node/core": "^3.1.1", | ||
"wonka": "^4.0.14" | ||
@@ -68,0 +68,0 @@ }, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
405339
2880