@urql/core
Advanced tools
Comparing version 2.1.2 to 2.1.3
# @urql/core | ||
## 2.1.3 | ||
### Patch Changes | ||
- Treat empty variables the same as no variables in `@urql/core`'s `createRequest`, by [@kitten](https://github.com/kitten) (See [#1695](https://github.com/FormidableLabs/urql/pull/1695)) | ||
## 2.1.2 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e = require("./006e0cef.js"); | ||
var e = require("./b4631212.js"); | ||
@@ -3,0 +3,0 @@ exports.makeFetchBody = e.makeFetchBody; |
@@ -1,2 +0,2 @@ | ||
var e=require("./2dd3cb41.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL; | ||
var e=require("./5f352e3e.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("./006e0cef.js"); | ||
var t = require("./b4631212.js"); | ||
@@ -5,0 +5,0 @@ var r = require("wonka"); |
@@ -1,2 +0,2 @@ | ||
var e=require("graphql"),t=require("./2dd3cb41.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)(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.2", | ||
"version": "2.1.3", | ||
"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
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
356650
2541