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

@urql/core

Package Overview
Dependencies
Maintainers
23
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/core - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3-canary-643f426a

4

dist/urql-core.js

@@ -593,3 +593,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

var isClient = params && typeof params.isClient === 'boolean' ? !!params.isClient : !client.suspense;
var forwardedOps$ = forward(wonka.map(mapTypeNames)(wonka.filter(operation => !data[operation.key] || !!data[operation.key].hasNext || operation.context.requestPolicy === 'network-only')(ops$)));
var forwardedOps$ = forward(wonka.map(mapTypeNames)(wonka.filter(operation => operation.kind === 'teardown' || !data[operation.key] || !!data[operation.key].hasNext || operation.context.requestPolicy === 'network-only')(ops$)));

@@ -613,3 +613,3 @@ // NOTE: Since below we might delete the cached entry after accessing

return result;
})(wonka.filter(operation => !!data[operation.key] && operation.context.requestPolicy !== 'network-only')(ops$));
})(wonka.filter(operation => operation.kind !== 'teardown' && !!data[operation.key] && operation.context.requestPolicy !== 'network-only')(ops$));
if (!isClient) {

@@ -616,0 +616,0 @@ // On the server we cache results in the cache as they're resolved

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

Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@0no-co/graphql.web"),r=require("./urql-core-chunk.min.js"),t=require("wonka"),n=(e,r)=>{if(Array.isArray(e))for(var t of e)n(t,r);else if("object"==typeof e&&null!==e)for(var a in e)"__typename"===a&&"string"==typeof e[a]?r.add(e[a]):n(e[a],r);return r},a=r=>{if("definitions"in r){var t=[];for(var n of r.definitions){var o=a(n);t.push(o)}return{...r,definitions:t}}if("directives"in r&&r.directives&&r.directives.length){var i=[],s={};for(var u of r.directives){var c=u.name.value;"_"!==c[0]?i.push(u):c=c.slice(1),s[c]=u}r={...r,directives:i,_directives:s}}if("selectionSet"in r){var p=[],l=r.kind===e.Kind.OPERATION_DEFINITION;if(r.selectionSet){for(var d of r.selectionSet.selections||[]){l=l||d.kind===e.Kind.FIELD&&"__typename"===d.name.value&&!d.alias;var f=a(d);p.push(f)}return l||p.push({kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"},_generated:!0}),{...r,selectionSet:{...r.selectionSet,selections:p}}}}return r},o=new Map,i=e=>{var t=r.keyDocument(e),n=o.get(t.__key);return n||(o.set(t.__key,n=a(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n},s=(e,r)=>{if(e&&"object"==typeof e){if(Array.isArray(e))return e.map((e=>s(e)));if(e&&"object"==typeof e&&(r||"__typename"in e)){var t={};for(var n in e)"__typename"===n?Object.defineProperty(t,"__typename",{enumerable:!1,value:e.__typename}):t[n]=s(e[n]);return t}return e}return e};function u(e,r,t){return{...r,kind:e,context:r.context?{...r.context,...t}:t||r.context}}var c=()=>{},p=({kind:e})=>"mutation"!==e&&"query"!==e,l=e=>{var r=i(e.query);if(r!==e.query){var t=u(e.kind,e);return t.query=r,t}return e},d=(e,r)=>e.reexecuteOperation(u(r.kind,r,{requestPolicy:"network-only"})),f=new Set,k=e=>({client:r,forward:n})=>e.reduceRight(((e,n)=>n({client:r,forward:r=>t.share(e(t.share(r))),dispatchDebug(e){}})),n),y=({onOperation:e,onResult:r,onError:n})=>({forward:a})=>o=>t.mergeMap((e=>{n&&e.error&&n(e.error,e.operation);var a=r&&r(e)||e;return"then"in a?t.fromPromise(a):t.fromValue(a)}))(a(t.mergeMap((r=>{var n=e&&e(r)||r;return"then"in n?t.fromPromise(n):t.fromValue(n)}))(o))),h=({})=>e=>t.filter((e=>!1))(e),m=function e(n){var a=0,o=new Map,i=new Map,p=new Set,l=[],d={url:n.url,fetchSubscriptions:n.fetchSubscriptions,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:!!n.preferGetMethod,requestPolicy:n.requestPolicy||"cache-first"},f=t.makeSubject();function y(e){"mutation"!==e.kind&&"teardown"!==e.kind&&p.has(e.key)||("teardown"===e.kind?p.delete(e.key):"mutation"!==e.kind&&p.add(e.key),f.next(e))}var m=!1;function v(e){if(e&&y(e),!m){for(m=!0;m&&(e=l.shift());)y(e);m=!1}}var x=e=>{var r=t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(f.source))(t.filter((r=>r.operation.kind===e.kind&&r.operation.key===e.key&&(!r.operation.context._instance||r.operation.context._instance===e.context._instance)))(E));return n.maskTypename&&(r=t.map((e=>({...e,data:s(e.data,!0)})))(r)),r="query"!==e.kind?t.takeWhile((e=>!!e.hasNext),!0)(r):t.switchMap((r=>{var n=t.fromValue(r);return r.stale||r.hasNext?n:t.merge([n,t.map((()=>(r.stale=!0,r)))(t.take(1)(t.filter((r=>r.key===e.key))(f.source)))])}))(r),r="mutation"!==e.kind?t.onEnd((()=>{p.delete(e.key),o.delete(e.key),i.delete(e.key),m=!1;for(var r=l.length-1;r>=0;r--)l[r].key===e.key&&l.splice(r,1);y(u("teardown",e,e.context))}))(t.onPush((r=>{if(r.stale){for(var t of l)if(t.key===r.operation.key){p.delete(t.key);break}}else r.hasNext||p.delete(e.key);o.set(e.key,r)}))(r)):t.onStart((()=>{y(e)}))(r),t.share(r)},g=this instanceof e?this:Object.create(e.prototype),b=Object.assign(g,{suspense:!!n.suspense,operations$:f.source,reexecuteOperation(e){if("teardown"===e.kind)v(e);else if("mutation"===e.kind||i.has(e.key)){for(var r=!1,t=0;t<l.length;t++)r=r||l[t].key===e.key;r||p.delete(e.key),l.push(e),Promise.resolve().then(v)}},createRequestOperation:(e,r,t)=>(t||(t={}),u(e,r,{_instance:"mutation"===e?a=a+1|0:void 0,...d,...t,requestPolicy:t.requestPolicy||d.requestPolicy,suspense:t.suspense||!1!==t.suspense&&b.suspense})),executeRequestOperation:e=>{return r="mutation"===e.kind?x(e):t.lazy((()=>{var r=i.get(e.key);r||i.set(e.key,r=x(e)),r=t.onStart((()=>{v(e)}))(r);var n=o.get(e.key);return"query"===e.kind&&n&&(n.stale||n.hasNext)?t.switchMap(t.fromValue)(t.merge([r,t.filter((r=>r===o.get(e.key)))(t.fromValue(n))])):r})),(n=e=>r(e)).toPromise=()=>t.toPromise(t.take(1)(t.filter((e=>!e.stale&&!e.hasNext))(n))),n.then=(e,r)=>n.toPromise().then(e,r),n.subscribe=e=>t.subscribe(e)(n),n;var r,n},executeQuery(e,r){var t=b.createRequestOperation("query",e,r);return b.executeRequestOperation(t)},executeSubscription(e,r){var t=b.createRequestOperation("subscription",e,r);return b.executeRequestOperation(t)},executeMutation(e,r){var t=b.createRequestOperation("mutation",e,r);return b.executeRequestOperation(t)},readQuery(e,r,n){var a=null;return t.subscribe((e=>{a=e}))(b.query(e,r,n)).unsubscribe(),a},query:(e,t,n)=>b.executeQuery(r.createRequest(e,t),n),subscription:(e,t,n)=>b.executeSubscription(r.createRequest(e,t),n),mutation:(e,t,n)=>b.executeMutation(r.createRequest(e,t),n)}),w=c,q=k(n.exchanges),E=t.share(q({client:b,dispatchDebug:w,forward:h({dispatchDebug:w})})(f.source));return t.publish(E),b},v=m;exports.CombinedError=r.CombinedError,exports.createRequest=r.createRequest,exports.makeErrorResult=r.makeErrorResult,exports.makeResult=r.makeResult,exports.mergeResultPatch=r.mergeResultPatch,exports.stringifyDocument=r.stringifyDocument,exports.stringifyVariables=r.stringifyVariables,exports.Client=m,exports.cacheExchange=({forward:e,client:r})=>{var a=new Map,o=new Map,i=e=>"query"===e.kind&&"network-only"!==e.context.requestPolicy&&("cache-only"===e.context.requestPolicy||a.has(e.key));return s=>{var u=t.map((e=>{var t=a.get(e.key);return"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,d(r,e)),t}))(t.filter((e=>!p(e)&&i(e)))(s)),c=t.tap((e=>{var{operation:t}=e;if(t){var i=t.context.additionalTypenames||[];if("subscription"!==e.operation.kind&&(i=(e=>[...n(e,new Set)])(e.data).concat(i)),"mutation"===e.operation.kind||"subscription"===e.operation.kind){for(var s=new Set,u=0;u<i.length;u++){var c=i[u],p=o.get(c);for(var l of(p||o.set(c,p=new Set),p.values()))s.add(l);p.clear()}for(var f of s.values())a.has(f)&&(t=a.get(f).operation,a.delete(f),d(r,t))}else if("query"===t.kind&&e.data){a.set(t.key,e);for(var k=0;k<i.length;k++){var y=i[k],h=o.get(y);h||o.set(y,h=new Set),h.add(t.key)}}}}))(e(t.filter((e=>"query"!==e.kind||"cache-only"!==e.context.requestPolicy))(t.map((e=>e))(t.merge([t.map(l)(t.filter((e=>!p(e)&&!i(e)))(s)),t.filter((e=>p(e)))(s)])))));return t.merge([u,c])}},exports.composeExchanges=k,exports.createClient=v,exports.debugExchange=({forward:e})=>r=>e(r),exports.dedupExchange=({forward:e})=>r=>e(r),exports.errorExchange=y,exports.fetchExchange=({forward:e})=>n=>{var a=t.mergeMap((e=>{var a=r.makeFetchBody(e),o=r.makeFetchURL(e,a),i=r.makeFetchOptions(e,a);return t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(n))(r.makeFetchSource(e,o,i))}))(t.filter((e=>"teardown"!==e.kind&&("subscription"!==e.kind||!!e.context.fetchSubscriptions)))(n)),o=e(t.filter((e=>"teardown"===e.kind||"subscription"===e.kind&&!e.context.fetchSubscriptions))(n));return t.merge([a,o])},exports.formatDocument=i,exports.gql=function(t){for(var n=new Map,a=[],o=[],i=Array.isArray(t)?t[0]:t||"",s=1;s<arguments.length;s++){var u=arguments[s];u&&u.definitions?o.push(u):i+=u,i+=arguments[0][s]}for(var c of(o.unshift(r.keyDocument(i)),o))for(var p of c.definitions)if(p.kind===e.Kind.FRAGMENT_DEFINITION){var l=p.name.value,d=r.stringifyDocument(p);n.has(l)||(n.set(l,d),a.push(p))}else a.push(p);return r.keyDocument({kind:e.Kind.DOCUMENT,definitions:a})},exports.makeOperation=u,exports.mapExchange=y,exports.maskTypename=s,exports.ssrExchange=(e={})=>{var n=!!e.staleWhileRevalidate,a=!!e.includeExtensions,o={},i=[],s=e=>{i.push(e.operation.key),1===i.length&&Promise.resolve().then((()=>{for(var e;e=i.shift();)o[e]=null}))},u=({client:i,forward:u})=>c=>{var p=e&&"boolean"==typeof e.isClient?!!e.isClient:!i.suspense,k=u(t.map(l)(t.filter((e=>!o[e.key]||!!o[e.key].hasNext||"network-only"===e.context.requestPolicy))(c))),y=t.map((e=>{var t=((e,t,n)=>({operation:e,data:t.data?JSON.parse(t.data):void 0,extensions:n&&t.extensions?JSON.parse(t.extensions):void 0,error:t.error?new r.CombinedError({networkError:t.error.networkError?new Error(t.error.networkError):void 0,graphQLErrors:t.error.graphQLErrors}):void 0,stale:!1,hasNext:!!t.hasNext}))(e,o[e.key],a);return n&&!f.has(e.key)&&(t.stale=!0,f.add(e.key),d(i,e)),{...t,operation:e}}))(t.filter((e=>!!o[e.key]&&"network-only"!==e.context.requestPolicy))(c));return p?y=t.tap(s)(y):k=t.tap((e=>{var{operation:r}=e;if("mutation"!==r.kind){var t=((e,r)=>{var t={data:JSON.stringify(e.data),hasNext:e.hasNext};return void 0!==e.data&&(t.data=JSON.stringify(e.data)),r&&void 0!==e.extensions&&(t.extensions=JSON.stringify(e.extensions)),e.error&&(t.error={graphQLErrors:e.error.graphQLErrors.map((e=>e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message))},e.error.networkError&&(t.error.networkError=""+e.error.networkError)),t})(e,a);o[r.key]=t}}))(k),t.merge([k,y])};return u.restoreData=e=>{for(var r in e)null!==o[r]&&(o[r]=e[r])},u.extractData=()=>{var e={};for(var r in o)null!=o[r]&&(e[r]=o[r]);return e},e&&e.initialState&&u.restoreData(e.initialState),u},exports.subscriptionExchange=({forwardSubscription:e,enableAllOperations:n,isSubscriptionOperation:a})=>({client:o,forward:i})=>{var s=a||(e=>"subscription"===e.kind||!!n&&("query"===e.kind||"mutation"===e.kind));return n=>{var a=t.mergeMap((a=>{var{key:i}=a,s=t.filter((e=>"teardown"===e.kind&&e.key===i))(n);return t.takeUntil(s)((n=>{var a=e(r.makeFetchBody(n),n);return t.make((e=>{var t,i,s=!1;function c(t){e.next(i=i?r.mergeResultPatch(i,t):r.makeResult(n,t))}return Promise.resolve().then((()=>{s||(t=a.subscribe({next:c,error(t){Array.isArray(t)?c({errors:t}):e.next(r.makeErrorResult(n,t)),e.complete()},complete(){s||(s=!0,"subscription"===n.kind&&o.reexecuteOperation(u("teardown",n,n.context)),i&&i.hasNext&&c({hasNext:!1}),e.complete())}}))})),()=>{s=!0,t&&t.unsubscribe()}}))})(a))}))(t.filter((e=>"teardown"!==e.kind&&s(e)))(n)),c=i(t.filter((e=>"teardown"===e.kind||!s(e)))(n));return t.merge([a,c])}};
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@0no-co/graphql.web"),r=require("./urql-core-chunk.min.js"),t=require("wonka"),n=(e,r)=>{if(Array.isArray(e))for(var t of e)n(t,r);else if("object"==typeof e&&null!==e)for(var a in e)"__typename"===a&&"string"==typeof e[a]?r.add(e[a]):n(e[a],r);return r},a=r=>{if("definitions"in r){var t=[];for(var n of r.definitions){var o=a(n);t.push(o)}return{...r,definitions:t}}if("directives"in r&&r.directives&&r.directives.length){var i=[],s={};for(var u of r.directives){var c=u.name.value;"_"!==c[0]?i.push(u):c=c.slice(1),s[c]=u}r={...r,directives:i,_directives:s}}if("selectionSet"in r){var p=[],l=r.kind===e.Kind.OPERATION_DEFINITION;if(r.selectionSet){for(var d of r.selectionSet.selections||[]){l=l||d.kind===e.Kind.FIELD&&"__typename"===d.name.value&&!d.alias;var f=a(d);p.push(f)}return l||p.push({kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"},_generated:!0}),{...r,selectionSet:{...r.selectionSet,selections:p}}}}return r},o=new Map,i=e=>{var t=r.keyDocument(e),n=o.get(t.__key);return n||(o.set(t.__key,n=a(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n},s=(e,r)=>{if(e&&"object"==typeof e){if(Array.isArray(e))return e.map((e=>s(e)));if(e&&"object"==typeof e&&(r||"__typename"in e)){var t={};for(var n in e)"__typename"===n?Object.defineProperty(t,"__typename",{enumerable:!1,value:e.__typename}):t[n]=s(e[n]);return t}return e}return e};function u(e,r,t){return{...r,kind:e,context:r.context?{...r.context,...t}:t||r.context}}var c=()=>{},p=({kind:e})=>"mutation"!==e&&"query"!==e,l=e=>{var r=i(e.query);if(r!==e.query){var t=u(e.kind,e);return t.query=r,t}return e},d=(e,r)=>e.reexecuteOperation(u(r.kind,r,{requestPolicy:"network-only"})),f=new Set,k=e=>({client:r,forward:n})=>e.reduceRight(((e,n)=>n({client:r,forward:r=>t.share(e(t.share(r))),dispatchDebug(e){}})),n),y=({onOperation:e,onResult:r,onError:n})=>({forward:a})=>o=>t.mergeMap((e=>{n&&e.error&&n(e.error,e.operation);var a=r&&r(e)||e;return"then"in a?t.fromPromise(a):t.fromValue(a)}))(a(t.mergeMap((r=>{var n=e&&e(r)||r;return"then"in n?t.fromPromise(n):t.fromValue(n)}))(o))),h=({})=>e=>t.filter((e=>!1))(e),m=function e(n){var a=0,o=new Map,i=new Map,p=new Set,l=[],d={url:n.url,fetchSubscriptions:n.fetchSubscriptions,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:!!n.preferGetMethod,requestPolicy:n.requestPolicy||"cache-first"},f=t.makeSubject();function y(e){"mutation"!==e.kind&&"teardown"!==e.kind&&p.has(e.key)||("teardown"===e.kind?p.delete(e.key):"mutation"!==e.kind&&p.add(e.key),f.next(e))}var m=!1;function v(e){if(e&&y(e),!m){for(m=!0;m&&(e=l.shift());)y(e);m=!1}}var x=e=>{var r=t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(f.source))(t.filter((r=>r.operation.kind===e.kind&&r.operation.key===e.key&&(!r.operation.context._instance||r.operation.context._instance===e.context._instance)))(E));return n.maskTypename&&(r=t.map((e=>({...e,data:s(e.data,!0)})))(r)),r="query"!==e.kind?t.takeWhile((e=>!!e.hasNext),!0)(r):t.switchMap((r=>{var n=t.fromValue(r);return r.stale||r.hasNext?n:t.merge([n,t.map((()=>(r.stale=!0,r)))(t.take(1)(t.filter((r=>r.key===e.key))(f.source)))])}))(r),r="mutation"!==e.kind?t.onEnd((()=>{p.delete(e.key),o.delete(e.key),i.delete(e.key),m=!1;for(var r=l.length-1;r>=0;r--)l[r].key===e.key&&l.splice(r,1);y(u("teardown",e,e.context))}))(t.onPush((r=>{if(r.stale){for(var t of l)if(t.key===r.operation.key){p.delete(t.key);break}}else r.hasNext||p.delete(e.key);o.set(e.key,r)}))(r)):t.onStart((()=>{y(e)}))(r),t.share(r)},g=this instanceof e?this:Object.create(e.prototype),b=Object.assign(g,{suspense:!!n.suspense,operations$:f.source,reexecuteOperation(e){if("teardown"===e.kind)v(e);else if("mutation"===e.kind||i.has(e.key)){for(var r=!1,t=0;t<l.length;t++)r=r||l[t].key===e.key;r||p.delete(e.key),l.push(e),Promise.resolve().then(v)}},createRequestOperation:(e,r,t)=>(t||(t={}),u(e,r,{_instance:"mutation"===e?a=a+1|0:void 0,...d,...t,requestPolicy:t.requestPolicy||d.requestPolicy,suspense:t.suspense||!1!==t.suspense&&b.suspense})),executeRequestOperation:e=>{return r="mutation"===e.kind?x(e):t.lazy((()=>{var r=i.get(e.key);r||i.set(e.key,r=x(e)),r=t.onStart((()=>{v(e)}))(r);var n=o.get(e.key);return"query"===e.kind&&n&&(n.stale||n.hasNext)?t.switchMap(t.fromValue)(t.merge([r,t.filter((r=>r===o.get(e.key)))(t.fromValue(n))])):r})),(n=e=>r(e)).toPromise=()=>t.toPromise(t.take(1)(t.filter((e=>!e.stale&&!e.hasNext))(n))),n.then=(e,r)=>n.toPromise().then(e,r),n.subscribe=e=>t.subscribe(e)(n),n;var r,n},executeQuery(e,r){var t=b.createRequestOperation("query",e,r);return b.executeRequestOperation(t)},executeSubscription(e,r){var t=b.createRequestOperation("subscription",e,r);return b.executeRequestOperation(t)},executeMutation(e,r){var t=b.createRequestOperation("mutation",e,r);return b.executeRequestOperation(t)},readQuery(e,r,n){var a=null;return t.subscribe((e=>{a=e}))(b.query(e,r,n)).unsubscribe(),a},query:(e,t,n)=>b.executeQuery(r.createRequest(e,t),n),subscription:(e,t,n)=>b.executeSubscription(r.createRequest(e,t),n),mutation:(e,t,n)=>b.executeMutation(r.createRequest(e,t),n)}),w=c,q=k(n.exchanges),E=t.share(q({client:b,dispatchDebug:w,forward:h({dispatchDebug:w})})(f.source));return t.publish(E),b},v=m;exports.CombinedError=r.CombinedError,exports.createRequest=r.createRequest,exports.makeErrorResult=r.makeErrorResult,exports.makeResult=r.makeResult,exports.mergeResultPatch=r.mergeResultPatch,exports.stringifyDocument=r.stringifyDocument,exports.stringifyVariables=r.stringifyVariables,exports.Client=m,exports.cacheExchange=({forward:e,client:r})=>{var a=new Map,o=new Map,i=e=>"query"===e.kind&&"network-only"!==e.context.requestPolicy&&("cache-only"===e.context.requestPolicy||a.has(e.key));return s=>{var u=t.map((e=>{var t=a.get(e.key);return"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,d(r,e)),t}))(t.filter((e=>!p(e)&&i(e)))(s)),c=t.tap((e=>{var{operation:t}=e;if(t){var i=t.context.additionalTypenames||[];if("subscription"!==e.operation.kind&&(i=(e=>[...n(e,new Set)])(e.data).concat(i)),"mutation"===e.operation.kind||"subscription"===e.operation.kind){for(var s=new Set,u=0;u<i.length;u++){var c=i[u],p=o.get(c);for(var l of(p||o.set(c,p=new Set),p.values()))s.add(l);p.clear()}for(var f of s.values())a.has(f)&&(t=a.get(f).operation,a.delete(f),d(r,t))}else if("query"===t.kind&&e.data){a.set(t.key,e);for(var k=0;k<i.length;k++){var y=i[k],h=o.get(y);h||o.set(y,h=new Set),h.add(t.key)}}}}))(e(t.filter((e=>"query"!==e.kind||"cache-only"!==e.context.requestPolicy))(t.map((e=>e))(t.merge([t.map(l)(t.filter((e=>!p(e)&&!i(e)))(s)),t.filter((e=>p(e)))(s)])))));return t.merge([u,c])}},exports.composeExchanges=k,exports.createClient=v,exports.debugExchange=({forward:e})=>r=>e(r),exports.dedupExchange=({forward:e})=>r=>e(r),exports.errorExchange=y,exports.fetchExchange=({forward:e})=>n=>{var a=t.mergeMap((e=>{var a=r.makeFetchBody(e),o=r.makeFetchURL(e,a),i=r.makeFetchOptions(e,a);return t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(n))(r.makeFetchSource(e,o,i))}))(t.filter((e=>"teardown"!==e.kind&&("subscription"!==e.kind||!!e.context.fetchSubscriptions)))(n)),o=e(t.filter((e=>"teardown"===e.kind||"subscription"===e.kind&&!e.context.fetchSubscriptions))(n));return t.merge([a,o])},exports.formatDocument=i,exports.gql=function(t){for(var n=new Map,a=[],o=[],i=Array.isArray(t)?t[0]:t||"",s=1;s<arguments.length;s++){var u=arguments[s];u&&u.definitions?o.push(u):i+=u,i+=arguments[0][s]}for(var c of(o.unshift(r.keyDocument(i)),o))for(var p of c.definitions)if(p.kind===e.Kind.FRAGMENT_DEFINITION){var l=p.name.value,d=r.stringifyDocument(p);n.has(l)||(n.set(l,d),a.push(p))}else a.push(p);return r.keyDocument({kind:e.Kind.DOCUMENT,definitions:a})},exports.makeOperation=u,exports.mapExchange=y,exports.maskTypename=s,exports.ssrExchange=(e={})=>{var n=!!e.staleWhileRevalidate,a=!!e.includeExtensions,o={},i=[],s=e=>{i.push(e.operation.key),1===i.length&&Promise.resolve().then((()=>{for(var e;e=i.shift();)o[e]=null}))},u=({client:i,forward:u})=>c=>{var p=e&&"boolean"==typeof e.isClient?!!e.isClient:!i.suspense,k=u(t.map(l)(t.filter((e=>"teardown"===e.kind||!o[e.key]||!!o[e.key].hasNext||"network-only"===e.context.requestPolicy))(c))),y=t.map((e=>{var t=((e,t,n)=>({operation:e,data:t.data?JSON.parse(t.data):void 0,extensions:n&&t.extensions?JSON.parse(t.extensions):void 0,error:t.error?new r.CombinedError({networkError:t.error.networkError?new Error(t.error.networkError):void 0,graphQLErrors:t.error.graphQLErrors}):void 0,stale:!1,hasNext:!!t.hasNext}))(e,o[e.key],a);return n&&!f.has(e.key)&&(t.stale=!0,f.add(e.key),d(i,e)),{...t,operation:e}}))(t.filter((e=>"teardown"!==e.kind&&!!o[e.key]&&"network-only"!==e.context.requestPolicy))(c));return p?y=t.tap(s)(y):k=t.tap((e=>{var{operation:r}=e;if("mutation"!==r.kind){var t=((e,r)=>{var t={data:JSON.stringify(e.data),hasNext:e.hasNext};return void 0!==e.data&&(t.data=JSON.stringify(e.data)),r&&void 0!==e.extensions&&(t.extensions=JSON.stringify(e.extensions)),e.error&&(t.error={graphQLErrors:e.error.graphQLErrors.map((e=>e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message))},e.error.networkError&&(t.error.networkError=""+e.error.networkError)),t})(e,a);o[r.key]=t}}))(k),t.merge([k,y])};return u.restoreData=e=>{for(var r in e)null!==o[r]&&(o[r]=e[r])},u.extractData=()=>{var e={};for(var r in o)null!=o[r]&&(e[r]=o[r]);return e},e&&e.initialState&&u.restoreData(e.initialState),u},exports.subscriptionExchange=({forwardSubscription:e,enableAllOperations:n,isSubscriptionOperation:a})=>({client:o,forward:i})=>{var s=a||(e=>"subscription"===e.kind||!!n&&("query"===e.kind||"mutation"===e.kind));return n=>{var a=t.mergeMap((a=>{var{key:i}=a,s=t.filter((e=>"teardown"===e.kind&&e.key===i))(n);return t.takeUntil(s)((n=>{var a=e(r.makeFetchBody(n),n);return t.make((e=>{var t,i,s=!1;function c(t){e.next(i=i?r.mergeResultPatch(i,t):r.makeResult(n,t))}return Promise.resolve().then((()=>{s||(t=a.subscribe({next:c,error(t){Array.isArray(t)?c({errors:t}):e.next(r.makeErrorResult(n,t)),e.complete()},complete(){s||(s=!0,"subscription"===n.kind&&o.reexecuteOperation(u("teardown",n,n.context)),i&&i.hasNext&&c({hasNext:!1}),e.complete())}}))})),()=>{s=!0,t&&t.unsubscribe()}}))})(a))}))(t.filter((e=>"teardown"!==e.kind&&s(e)))(n)),c=i(t.filter((e=>"teardown"===e.kind||!s(e)))(n));return t.merge([a,c])}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "4.1.2",
"version": "4.1.3-canary-643f426a",
"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