@urql/core
Advanced tools
Comparing version 2.3.0 to 2.3.1
# @urql/core | ||
## 2.3.1 | ||
### Patch Changes | ||
- ⚠️ Fix mark `query.__key` as non-enumerable so `formatDocument` does not restore previous invocations when cloning the gql-ast, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#1870](https://github.com/FormidableLabs/urql/pull/1870)) | ||
- ⚠️ Fix: update toPromise to exclude `hasNext` results. This change ensures that | ||
when we call toPromise() on a query we wont serve an incomplete result, the | ||
user will expect to receive a non-stale full-result when using toPromise(), by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#1880](https://github.com/FormidableLabs/urql/pull/1880)) | ||
## 2.3.0 | ||
@@ -4,0 +13,0 @@ |
@@ -52,6 +52,10 @@ var e = require("graphql"); | ||
if (!o) { | ||
(o = e.visit(a, { | ||
o = e.visit(a, { | ||
Field: formatNode, | ||
InlineFragment: formatNode | ||
})).__key = a.__key; | ||
}); | ||
Object.defineProperty(o, "__key", { | ||
value: a.__key, | ||
enumerable: !1 | ||
}); | ||
n.set(a.__key, o); | ||
@@ -87,3 +91,3 @@ } | ||
return r.toPromise(r.take(1)(r.filter((function(e) { | ||
return !e.stale; | ||
return !e.stale && !e.hasNext; | ||
}))(e))); | ||
@@ -90,0 +94,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
var e=require("graphql"),t=require("./8ce379e1.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"}}])})})},u=new Map;function a(r){var n=t.keyDocument(r),o=u.get(n.__key);return o||((o=e.visit(n,{Field:i,InlineFragment:i})).__key=n.__key,u.set(n.__key,o)),o}function c(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(c):n&&"object"==typeof n&&"__typename"in n?c(n):n,t}),{}):e}function s(e){return e.toPromise=function(){return r.toPromise(r.take(1)(r.filter((function(e){return!e.stale}))(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 u=o[i].name.value,a=t.stringifyDocument(o[i]);r.has(u)||(r.set(u,a),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,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=r.share(e),f=r.map((function(e){var r=u.get(e.key),n=t._extends({},r,{operation:p(e,{cacheOutcome:r?"hit":"miss"})});return"cache-and-network"===e.context.requestPolicy&&(n.stale=!0,m(i,e)),n}))(r.filter((function(e){return!y(e)&&l(e)}))(a)),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,a=0;a<r.length;a++){var s=r[a],f=c[s]||(c[s]=new Set);f.forEach((function(e){n.add(e)})),f.clear()}n.forEach((function(e){u.has(e)&&(t=u.get(e).operation,u.delete(e),m(i,t))}))}else if("query"===t.kind&&e.data){u.set(t.key,e);for(var p=0;p<r.length;p++){var l=r[p];(c[l]||(c[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(s)(r.filter((function(e){return!y(e)&&!l(e)}))(a)),r.filter((function(e){return y(e)}))(a)])))));return r.merge([f,d])}}function m(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))}function h(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 x(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),u=t.makeFetchBody(e),a=t.makeFetchURL(e,u),c=t.makeFetchOptions(e,u);return r.onPush((function(e){}))(r.takeUntil(i)(t.makeFetchSource(e,a,c)))}))(r.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),u=n(r.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return r.merge([i,u])}}function v(e){return function(e){return r.filter((function(){return!1}))(r.tap((function(e){}))(e))}}var g=v();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 b=[h,k,x],w=function e(n){var o=new Map,i=new Map,u=[],a=r.makeSubject(),p=a.source,d=a.next,y=!1;function k(e){for(y=!0,e&&d(e);e=u.shift();)d(e);y=!1}function m(e){var n=r.filter((function(t){return t.operation.kind===e.kind&&t.operation.key===e.key}))(E);return x.maskTypename&&(n=r.map((function(e){return t._extends({},e,{data:c(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=u.length-1;t>=0;t--)u[t].key===e.key&&u.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),x=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))&&(u.push(e),y||Promise.resolve().then(k))},createOperationContext:function(e){return e||(e={}),t._extends({},{url:x.url,fetchOptions:x.fetchOptions,fetch:x.fetch,preferGetMethod:x.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&x.suspense,requestPolicy:e.requestPolicy||x.requestPolicy})},createRequestOperation:function(e,r,n){return t.getOperationType(r.query),f(e,r,x.createOperationContext(n))},executeRequestOperation:function(e){return"mutation"===e.kind?m(e):r.make((function(n){var u=i.get(e.key);u||i.set(e.key,u=m(e));var a="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);a&&k(e),null!=r&&r===o.get(e.key)?n.next(a?t._extends({},r,{stale:!0}):r):a||k(e)}))(u))).unsubscribe}))},executeQuery:function(e,t){var r=x.createRequestOperation("query",e,t);return x.executeRequestOperation(r)},executeSubscription:function(e,t){var r=x.createRequestOperation("subscription",e,t);return x.executeRequestOperation(r)},executeMutation:function(e,t){var r=x.createRequestOperation("mutation",e,t);return x.executeRequestOperation(r)},query:function(e,r,n){return n&&"boolean"==typeof n.suspense||(n=t._extends({},n,{suspense:!1})),s(x.executeQuery(t.createRequest(e,r),n))},readQuery:function(e,t,n){var o=null;return r.subscribe((function(e){o=e}))(x.query(e,t,n)).unsubscribe(),o},subscription:function(e,r,n){return x.executeSubscription(t.createRequest(e,r),n)},mutation:function(e,r,n){return s(x.executeMutation(t.createRequest(e,r),n))}}),g=l,w=q(void 0!==n.exchanges?n.exchanges:b),E=r.share(w({client:x,dispatchDebug:g,forward:v()})(p));return r.publish(E),x},E=w;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=w,exports.cacheExchange=k,exports.composeExchanges=q,exports.createClient=E,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=h,exports.defaultExchanges=b,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=g,exports.fetchExchange=x,exports.formatDocument=a,exports.gql=function(){for(var r=arguments,n=new Map,o=[],i=[],u=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",a=1;a<arguments.length;a++){var c=r[a];c&&c.definitions?i.push.apply(i,c.definitions):u+=c,u+=r[0][a]}return d(n,o,t.keyDocument(u).definitions),d(n,o,i),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:o})},exports.makeOperation=f,exports.maskTypename=c,exports.ssrExchange=function(e){var n=!(!e||!e.staleWhileRevalidate),o={},i=[];function u(e){i.push(e.operation.key),1===i.length&&Promise.resolve().then((function(){for(var e;e=i.shift();)o[e]=null}))}var a=function(i){var a=i.client,c=i.forward;return function(i){var s=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=r.share(i),p=c(r.filter((function(e){return!o[e.key]||!!o[e.key].hasNext}))(f)),l=r.map((function(e){var r=function(e,r){return{operation:e,data:r.data?JSON.parse(r.data):void 0,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,o[e.key]);return n&&(r.stale=!0,m(a,e)),r}))(r.filter((function(e){return!!o[e.key]}))(f));return s?l=r.tap(u)(l):p=r.tap((function(e){var t=e.operation;if("mutation"!==t.kind){var r=function(e){var t=e.hasNext,r=e.data,n=e.error,o={};return void 0!==r&&(o.data=JSON.stringify(r)),t&&(o.hasNext=!0),n&&(o.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&&(o.error.networkError=""+n.networkError)),o}(e);o[t.key]=r}}))(p),r.merge([p,l])}};return a.restoreData=function(e){for(var t in e)null!==o[t]&&(o[t]=e[t])},a.extractData=function(){var e={};for(var t in o)null!=o[t]&&(e[t]=o[t]);return e},e&&e.initialState&&a.restoreData(e.initialState),a},exports.subscriptionExchange=function(n){var o=n.forwardSubscription,i=n.enableAllOperations;return function(n){var u=n.client,a=n.forward;function c(e){var t=e.kind;return"subscription"===t||!!i&&("query"===t||"mutation"===t)}return function(n){var i=r.share(n),s=r.mergeMap((function(n){var a=n.key,c=r.filter((function(e){return"teardown"===e.kind&&e.key===a}))(i);return r.takeUntil(c)(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,a=e.complete,c=!1;return Promise.resolve().then((function(){c||(r=i.subscribe({next:function(e){return o(t.makeResult(n,e))},error:function(e){return o(t.makeErrorResult(n,e))},complete:function(){c||(c=!0,"subscription"===n.kind&&u.reexecuteOperation(f("teardown",n,n.context)),a())}}))})),function(){c=!0,r&&r.unsubscribe()}}))}(n))}))(r.filter(c)(i)),p=a(r.filter((function(e){return!c(e)}))(i));return r.merge([s,p])}}}; | ||
var e=require("graphql"),t=require("./8ce379e1.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"}}])})})},u=new Map;function a(r){var n=t.keyDocument(r),o=u.get(n.__key);return o||(o=e.visit(n,{Field:i,InlineFragment:i}),Object.defineProperty(o,"__key",{value:n.__key,enumerable:!1}),u.set(n.__key,o)),o}function c(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(c):n&&"object"==typeof n&&"__typename"in n?c(n):n,t}),{}):e}function s(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 u=o[i].name.value,a=t.stringifyDocument(o[i]);r.has(u)||(r.set(u,a),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,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=r.share(e),f=r.map((function(e){var r=u.get(e.key),n=t._extends({},r,{operation:p(e,{cacheOutcome:r?"hit":"miss"})});return"cache-and-network"===e.context.requestPolicy&&(n.stale=!0,m(i,e)),n}))(r.filter((function(e){return!y(e)&&l(e)}))(a)),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,a=0;a<r.length;a++){var s=r[a],f=c[s]||(c[s]=new Set);f.forEach((function(e){n.add(e)})),f.clear()}n.forEach((function(e){u.has(e)&&(t=u.get(e).operation,u.delete(e),m(i,t))}))}else if("query"===t.kind&&e.data){u.set(t.key,e);for(var p=0;p<r.length;p++){var l=r[p];(c[l]||(c[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(s)(r.filter((function(e){return!y(e)&&!l(e)}))(a)),r.filter((function(e){return y(e)}))(a)])))));return r.merge([f,d])}}function m(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))}function h(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 x(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),u=t.makeFetchBody(e),a=t.makeFetchURL(e,u),c=t.makeFetchOptions(e,u);return r.onPush((function(e){}))(r.takeUntil(i)(t.makeFetchSource(e,a,c)))}))(r.filter((function(e){return"query"===e.kind||"mutation"===e.kind}))(o)),u=n(r.filter((function(e){return"query"!==e.kind&&"mutation"!==e.kind}))(o));return r.merge([i,u])}}function v(e){return function(e){return r.filter((function(){return!1}))(r.tap((function(e){}))(e))}}var g=v();function b(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 q=[h,k,x],w=function e(n){var o=new Map,i=new Map,u=[],a=r.makeSubject(),p=a.source,d=a.next,y=!1;function k(e){for(y=!0,e&&d(e);e=u.shift();)d(e);y=!1}function m(e){var n=r.filter((function(t){return t.operation.kind===e.kind&&t.operation.key===e.key}))(E);return x.maskTypename&&(n=r.map((function(e){return t._extends({},e,{data:c(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=u.length-1;t>=0;t--)u[t].key===e.key&&u.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),x=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))&&(u.push(e),y||Promise.resolve().then(k))},createOperationContext:function(e){return e||(e={}),t._extends({},{url:x.url,fetchOptions:x.fetchOptions,fetch:x.fetch,preferGetMethod:x.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&x.suspense,requestPolicy:e.requestPolicy||x.requestPolicy})},createRequestOperation:function(e,r,n){return t.getOperationType(r.query),f(e,r,x.createOperationContext(n))},executeRequestOperation:function(e){return"mutation"===e.kind?m(e):r.make((function(n){var u=i.get(e.key);u||i.set(e.key,u=m(e));var a="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);a&&k(e),null!=r&&r===o.get(e.key)?n.next(a?t._extends({},r,{stale:!0}):r):a||k(e)}))(u))).unsubscribe}))},executeQuery:function(e,t){var r=x.createRequestOperation("query",e,t);return x.executeRequestOperation(r)},executeSubscription:function(e,t){var r=x.createRequestOperation("subscription",e,t);return x.executeRequestOperation(r)},executeMutation:function(e,t){var r=x.createRequestOperation("mutation",e,t);return x.executeRequestOperation(r)},query:function(e,r,n){return n&&"boolean"==typeof n.suspense||(n=t._extends({},n,{suspense:!1})),s(x.executeQuery(t.createRequest(e,r),n))},readQuery:function(e,t,n){var o=null;return r.subscribe((function(e){o=e}))(x.query(e,t,n)).unsubscribe(),o},subscription:function(e,r,n){return x.executeSubscription(t.createRequest(e,r),n)},mutation:function(e,r,n){return s(x.executeMutation(t.createRequest(e,r),n))}}),g=l,w=b(void 0!==n.exchanges?n.exchanges:q),E=r.share(w({client:x,dispatchDebug:g,forward:v()})(p));return r.publish(E),x},E=w;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=w,exports.cacheExchange=k,exports.composeExchanges=b,exports.createClient=E,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=h,exports.defaultExchanges=q,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=g,exports.fetchExchange=x,exports.formatDocument=a,exports.gql=function(){for(var r=arguments,n=new Map,o=[],i=[],u=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",a=1;a<arguments.length;a++){var c=r[a];c&&c.definitions?i.push.apply(i,c.definitions):u+=c,u+=r[0][a]}return d(n,o,t.keyDocument(u).definitions),d(n,o,i),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:o})},exports.makeOperation=f,exports.maskTypename=c,exports.ssrExchange=function(e){var n=!(!e||!e.staleWhileRevalidate),o={},i=[];function u(e){i.push(e.operation.key),1===i.length&&Promise.resolve().then((function(){for(var e;e=i.shift();)o[e]=null}))}var a=function(i){var a=i.client,c=i.forward;return function(i){var s=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=r.share(i),p=c(r.filter((function(e){return!o[e.key]||!!o[e.key].hasNext}))(f)),l=r.map((function(e){var r=function(e,r){return{operation:e,data:r.data?JSON.parse(r.data):void 0,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,o[e.key]);return n&&(r.stale=!0,m(a,e)),r}))(r.filter((function(e){return!!o[e.key]}))(f));return s?l=r.tap(u)(l):p=r.tap((function(e){var t=e.operation;if("mutation"!==t.kind){var r=function(e){var t=e.hasNext,r=e.data,n=e.error,o={};return void 0!==r&&(o.data=JSON.stringify(r)),t&&(o.hasNext=!0),n&&(o.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&&(o.error.networkError=""+n.networkError)),o}(e);o[t.key]=r}}))(p),r.merge([p,l])}};return a.restoreData=function(e){for(var t in e)null!==o[t]&&(o[t]=e[t])},a.extractData=function(){var e={};for(var t in o)null!=o[t]&&(e[t]=o[t]);return e},e&&e.initialState&&a.restoreData(e.initialState),a},exports.subscriptionExchange=function(n){var o=n.forwardSubscription,i=n.enableAllOperations;return function(n){var u=n.client,a=n.forward;function c(e){var t=e.kind;return"subscription"===t||!!i&&("query"===t||"mutation"===t)}return function(n){var i=r.share(n),s=r.mergeMap((function(n){var a=n.key,c=r.filter((function(e){return"teardown"===e.kind&&e.key===a}))(i);return r.takeUntil(c)(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,a=e.complete,c=!1;return Promise.resolve().then((function(){c||(r=i.subscribe({next:function(e){return o(t.makeResult(n,e))},error:function(e){return o(t.makeErrorResult(n,e))},complete:function(){c||(c=!0,"subscription"===n.kind&&u.reexecuteOperation(f("teardown",n,n.context)),a())}}))})),function(){c=!0,r&&r.unsubscribe()}}))}(n))}))(r.filter(c)(i)),p=a(r.filter((function(e){return!c(e)}))(i));return r.merge([s,p])}}}; | ||
//# sourceMappingURL=urql-core.min.js.map |
{ | ||
"name": "@urql/core", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "The shared core for the highly customizable and versatile GraphQL client", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
394733
2841