@urql/core
Advanced tools
Comparing version 5.0.8 to 5.1.0-canary-07397cf11b4b6a64bf8fff9a8ea2e23b81d83067
@@ -357,5 +357,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
...result, | ||
operation: process.env.NODE_ENV !== 'production' ? addMetadata(operation, { | ||
operation: addMetadata(operation, { | ||
cacheOutcome: cachedResult ? 'hit' : 'miss' | ||
}) : operation | ||
}) | ||
}; | ||
@@ -419,5 +419,5 @@ if (operation.context.requestPolicy === 'cache-and-network') { | ||
} | ||
})(forward(wonka.filter(op => op.kind !== 'query' || op.context.requestPolicy !== 'cache-only')(wonka.map(op => process.env.NODE_ENV !== 'production' ? addMetadata(op, { | ||
})(forward(wonka.filter(op => op.kind !== 'query' || op.context.requestPolicy !== 'cache-only')(wonka.map(op => addMetadata(op, { | ||
cacheOutcome: 'miss' | ||
}) : op)(wonka.merge([wonka.map(mapTypeNames)(wonka.filter(op => !shouldSkip(op) && !isOperationCached(op))(ops$)), wonka.filter(op => shouldSkip(op))(ops$)]))))); | ||
}))(wonka.merge([wonka.map(mapTypeNames)(wonka.filter(op => !shouldSkip(op) && !isOperationCached(op))(ops$)), wonka.filter(op => shouldSkip(op))(ops$)]))))); | ||
return wonka.merge([cachedOps$, forwardedOps$]); | ||
@@ -576,5 +576,5 @@ }; | ||
...cachedResult, | ||
operation: process.env.NODE_ENV !== 'production' ? addMetadata(op, { | ||
operation: addMetadata(op, { | ||
cacheOutcome: 'hit' | ||
}) : op | ||
}) | ||
}; | ||
@@ -581,0 +581,0 @@ return result; |
@@ -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=0,i=e.length;t<i;t++)n(e[t],r);else if("object"==typeof e&&null!==e)for(var o in e)"__typename"===o&&"string"==typeof e[o]?r.add(e[o]):n(e[o],r);return r},i=r=>{if("definitions"in r){for(var t=[],n=0,o=r.definitions.length;n<o;n++){var a=i(r.definitions[n]);t.push(a)}return{...r,definitions:t}}if("directives"in r&&r.directives&&r.directives.length){for(var s=[],u={},c=0,l=r.directives.length;c<l;c++){var d=r.directives[c],p=d.name.value;"_"!==p[0]?s.push(d):p=p.slice(1),u[p]=d}r={...r,directives:s,_directives:u}}if("selectionSet"in r){var k=[],f=r.kind===e.Kind.OPERATION_DEFINITION;if(r.selectionSet){for(var h=0,y=r.selectionSet.selections.length;h<y;h++){var v=r.selectionSet.selections[h];f=f||v.kind===e.Kind.FIELD&&"__typename"===v.name.value&&!v.alias;var m=i(v);k.push(m)}return f||k.push({kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"},_generated:!0}),{...r,selectionSet:{...r.selectionSet,selections:k}}}}return r},o=new Map,a=e=>{var t=r.keyDocument(e),n=o.get(t.__key);return n||(o.set(t.__key,n=i(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n};function s(e,r,t){return{...r,kind:e,context:r.context?{...r.context,...t}:t||r.context}}var u=()=>{},c=({kind:e})=>"mutation"!==e&&"query"!==e,l=e=>{var r=a(e.query);if(r!==e.query){var t=s(e.kind,e);return t.query=r,t}return e},d=(e,r)=>e.reexecuteOperation(s(r.kind,r,{requestPolicy:"network-only"})),p=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),f=({onOperation:e,onResult:r,onError:n})=>({forward:i})=>o=>t.mergeMap((e=>{n&&e.error&&n(e.error,e.operation);var i=r&&r(e)||e;return"then"in i?t.fromPromise(i):t.fromValue(i)}))(i(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),y=function e(n){var i=0,o=new Map,a=new Map,c=new Set,l=[],d={url:n.url,fetchSubscriptions:n.fetchSubscriptions,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod,requestPolicy:n.requestPolicy||"cache-first"},p=t.makeSubject();function f(e){"mutation"!==e.kind&&"teardown"!==e.kind&&c.has(e.key)||("teardown"===e.kind?c.delete(e.key):"mutation"!==e.kind&&c.add(e.key),p.next(e))}var y=!1;function v(e){if(e&&f(e),!y){for(y=!0;y&&(e=l.shift());)f(e);y=!1}}var m=e=>{var r=t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(p.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)))(q));return 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))(p.source)))])}))(r),r="mutation"!==e.kind?t.onEnd((()=>{c.delete(e.key),o.delete(e.key),a.delete(e.key),y=!1;for(var r=l.length-1;r>=0;r--)l[r].key===e.key&&l.splice(r,1);f(s("teardown",e,e.context))}))(t.onPush((r=>{if(r.stale)if(r.hasNext)for(var t=0;t<l.length;t++){var n=l[t];if(n.key===r.operation.key){c.delete(n.key);break}}else c.delete(e.key);else r.hasNext||c.delete(e.key);o.set(e.key,r)}))(r)):t.onStart((()=>{f(e)}))(r),t.share(r)},x=this instanceof e?this:Object.create(e.prototype),g=Object.assign(x,{suspense:!!n.suspense,operations$:p.source,reexecuteOperation(e){if("teardown"===e.kind)v(e);else if("mutation"===e.kind)l.push(e),Promise.resolve().then(v);else if(a.has(e.key)){for(var r=!1,t=0;t<l.length;t++)l[t].key===e.key&&(l[t]=e,r=!0);r||c.has(e.key)&&"network-only"!==e.context.requestPolicy?(c.delete(e.key),Promise.resolve().then(v)):(l.push(e),Promise.resolve().then(v))}},createRequestOperation:(e,r,t)=>(t||(t={}),s(e,r,{_instance:"mutation"===e?i=i+1|0:void 0,...d,...t,requestPolicy:t.requestPolicy||d.requestPolicy,suspense:t.suspense||!1!==t.suspense&&g.suspense})),executeRequestOperation:e=>{return r="mutation"===e.kind?m(e):t.lazy((()=>{var r=a.get(e.key);r||a.set(e.key,r=m(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=g.createRequestOperation("query",e,r);return g.executeRequestOperation(t)},executeSubscription(e,r){var t=g.createRequestOperation("subscription",e,r);return g.executeRequestOperation(t)},executeMutation(e,r){var t=g.createRequestOperation("mutation",e,r);return g.executeRequestOperation(t)},readQuery(e,r,n){var i=null;return t.subscribe((e=>{i=e}))(g.query(e,r,n)).unsubscribe(),i},query:(e,t,n)=>g.executeQuery(r.createRequest(e,t),n),subscription:(e,t,n)=>g.executeSubscription(r.createRequest(e,t),n),mutation:(e,t,n)=>g.executeMutation(r.createRequest(e,t),n)}),w=u,b=k(n.exchanges),q=t.share(b({client:g,dispatchDebug:w,forward:h({dispatchDebug:w})})(p.source));return t.publish(q),g},v=y;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=y,exports.cacheExchange=({forward:e,client:i})=>{var o=new Map,a=new Map,s=e=>"query"===e.kind&&"network-only"!==e.context.requestPolicy&&("cache-only"===e.context.requestPolicy||o.has(e.key));return u=>{var p=t.map((e=>{var t=o.get(e.key)||r.makeResult(e,{data:null});return t={...t,operation:e},"cache-and-network"===e.context.requestPolicy&&(t.stale=!0,d(i,e)),t}))(t.filter((e=>!c(e)&&s(e)))(u)),k=t.tap((e=>{var{operation:r}=e;if(r){var t=r.context.additionalTypenames||[];if("subscription"!==e.operation.kind&&(t=(e=>[...n(e,new Set)])(e.data).concat(t)),"mutation"===e.operation.kind||"subscription"===e.operation.kind){for(var s=new Set,u=0;u<t.length;u++){var c=t[u],l=a.get(c);for(var p of(l||a.set(c,l=new Set),l.values()))s.add(p);l.clear()}for(var k of s.values())o.has(k)&&(r=o.get(k).operation,o.delete(k),d(i,r))}else if("query"===r.kind&&e.data){o.set(r.key,e);for(var f=0;f<t.length;f++){var h=t[f],y=a.get(h);y||a.set(h,y=new Set),y.add(r.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=>!c(e)&&!s(e)))(u)),t.filter((e=>c(e)))(u)])))));return t.merge([p,k])}},exports.composeExchanges=k,exports.createClient=v,exports.debugExchange=({forward:e})=>r=>e(r),exports.errorExchange=f,exports.fetchExchange=({forward:e})=>n=>{var i=t.mergeMap((e=>{var i=r.makeFetchBody(e),o=r.makeFetchURL(e,i),a=r.makeFetchOptions(e,i);return t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(n))(r.makeFetchSource(e,o,a))}))(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([i,o])},exports.formatDocument=a,exports.gql=function(t){for(var n=new Map,i=[],o=[],a=Array.isArray(t)?t[0]:t||"",s=1;s<arguments.length;s++){var u=arguments[s];u&&u.definitions?o.push(u):a+=u,a+=arguments[0][s]}o.unshift(r.keyDocument(a));for(var c=0;c<o.length;c++)for(var l=0;l<o[c].definitions.length;l++){var d=o[c].definitions[l];if(d.kind===e.Kind.FRAGMENT_DEFINITION){var p=d.name.value,k=r.stringifyDocument(d);n.has(p)||(n.set(p,k),i.push(d))}else i.push(d)}return r.keyDocument({kind:e.Kind.DOCUMENT,definitions:i})},exports.makeOperation=s,exports.mapExchange=f,exports.ssrExchange=(e={})=>{var n=!!e.staleWhileRevalidate,i=!!e.includeExtensions,o={},a=[],s=e=>{a.push(e.operation.key),1===a.length&&Promise.resolve().then((()=>{for(var e;e=a.shift();)o[e]=null}))},u=({client:a,forward:u})=>c=>{var k=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=u(t.map(l)(t.filter((e=>"teardown"===e.kind||!o[e.key]||!!o[e.key].hasNext||"network-only"===e.context.requestPolicy))(c))),h=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],i);return n&&!p.has(e.key)&&(t.stale=!0,p.add(e.key),d(a,e)),{...t,operation:e}}))(t.filter((e=>"teardown"!==e.kind&&!!o[e.key]&&"network-only"!==e.context.requestPolicy))(c));return k?h=t.tap(s)(h):f=t.tap((e=>{var{operation:r}=e;if("mutation"!==r.kind){var t=((e,r)=>{var t={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,i);o[r.key]=t}}))(f),t.merge([f,h])};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:i})=>({client:o,forward:a})=>{var u=i||(e=>"subscription"===e.kind||!!n&&("query"===e.kind||"mutation"===e.kind));return n=>{var i=t.mergeMap((i=>{var{key:a}=i,u=t.filter((e=>"teardown"===e.kind&&e.key===a))(n);return t.takeUntil(u)((n=>{var i=e(r.makeFetchBody(n),n);return t.make((e=>{var t,a,u=!1;function c(t){e.next(a=a?r.mergeResultPatch(a,t):r.makeResult(n,t))}return Promise.resolve().then((()=>{u||(t=i.subscribe({next:c,error(t){Array.isArray(t)?c({errors:t}):e.next(r.makeErrorResult(n,t)),e.complete()},complete(){u||(u=!0,"subscription"===n.kind&&o.reexecuteOperation(s("teardown",n,n.context)),a&&a.hasNext&&c({hasNext:!1}),e.complete())}}))})),()=>{u=!0,t&&t.unsubscribe()}}))})(i))}))(t.filter((e=>"teardown"!==e.kind&&u(e)))(n)),c=a(t.filter((e=>"teardown"===e.kind||!u(e)))(n));return t.merge([i,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=0,i=e.length;t<i;t++)n(e[t],r);else if("object"==typeof e&&null!==e)for(var o in e)"__typename"===o&&"string"==typeof e[o]?r.add(e[o]):n(e[o],r);return r},i=r=>{if("definitions"in r){for(var t=[],n=0,o=r.definitions.length;n<o;n++){var a=i(r.definitions[n]);t.push(a)}return{...r,definitions:t}}if("directives"in r&&r.directives&&r.directives.length){for(var s=[],u={},c=0,l=r.directives.length;c<l;c++){var d=r.directives[c],p=d.name.value;"_"!==p[0]?s.push(d):p=p.slice(1),u[p]=d}r={...r,directives:s,_directives:u}}if("selectionSet"in r){var k=[],h=r.kind===e.Kind.OPERATION_DEFINITION;if(r.selectionSet){for(var f=0,y=r.selectionSet.selections.length;f<y;f++){var m=r.selectionSet.selections[f];h=h||m.kind===e.Kind.FIELD&&"__typename"===m.name.value&&!m.alias;var v=i(m);k.push(v)}return h||k.push({kind:e.Kind.FIELD,name:{kind:e.Kind.NAME,value:"__typename"},_generated:!0}),{...r,selectionSet:{...r.selectionSet,selections:k}}}}return r},o=new Map,a=e=>{var t=r.keyDocument(e),n=o.get(t.__key);return n||(o.set(t.__key,n=i(t)),Object.defineProperty(n,"__key",{value:t.__key,enumerable:!1})),n};function s(e,r,t){return{...r,kind:e,context:r.context?{...r.context,...t}:t||r.context}}var u=(e,r)=>s(e.kind,e,{meta:{...e.context.meta,...r}}),c=()=>{},l=({kind:e})=>"mutation"!==e&&"query"!==e,d=e=>{var r=a(e.query);if(r!==e.query){var t=s(e.kind,e);return t.query=r,t}return e},p=(e,r)=>e.reexecuteOperation(s(r.kind,r,{requestPolicy:"network-only"})),k=new Set,h=e=>({client:r,forward:n})=>e.reduceRight(((e,n)=>n({client:r,forward:r=>t.share(e(t.share(r))),dispatchDebug(e){}})),n),f=({onOperation:e,onResult:r,onError:n})=>({forward:i})=>o=>t.mergeMap((e=>{n&&e.error&&n(e.error,e.operation);var i=r&&r(e)||e;return"then"in i?t.fromPromise(i):t.fromValue(i)}))(i(t.mergeMap((r=>{var n=e&&e(r)||r;return"then"in n?t.fromPromise(n):t.fromValue(n)}))(o))),y=({})=>e=>t.filter((e=>!1))(e),m=function e(n){var i=0,o=new Map,a=new Map,u=new Set,l=[],d={url:n.url,fetchSubscriptions:n.fetchSubscriptions,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod,requestPolicy:n.requestPolicy||"cache-first"},p=t.makeSubject();function k(e){"mutation"!==e.kind&&"teardown"!==e.kind&&u.has(e.key)||("teardown"===e.kind?u.delete(e.key):"mutation"!==e.kind&&u.add(e.key),p.next(e))}var f=!1;function m(e){if(e&&k(e),!f){for(f=!0;f&&(e=l.shift());)k(e);f=!1}}var v=e=>{var r=t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(p.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)))(q));return 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))(p.source)))])}))(r),r="mutation"!==e.kind?t.onEnd((()=>{u.delete(e.key),o.delete(e.key),a.delete(e.key),f=!1;for(var r=l.length-1;r>=0;r--)l[r].key===e.key&&l.splice(r,1);k(s("teardown",e,e.context))}))(t.onPush((r=>{if(r.stale)if(r.hasNext)for(var t=0;t<l.length;t++){var n=l[t];if(n.key===r.operation.key){u.delete(n.key);break}}else u.delete(e.key);else r.hasNext||u.delete(e.key);o.set(e.key,r)}))(r)):t.onStart((()=>{k(e)}))(r),t.share(r)},x=this instanceof e?this:Object.create(e.prototype),g=Object.assign(x,{suspense:!!n.suspense,operations$:p.source,reexecuteOperation(e){if("teardown"===e.kind)m(e);else if("mutation"===e.kind)l.push(e),Promise.resolve().then(m);else if(a.has(e.key)){for(var r=!1,t=0;t<l.length;t++)l[t].key===e.key&&(l[t]=e,r=!0);r||u.has(e.key)&&"network-only"!==e.context.requestPolicy?(u.delete(e.key),Promise.resolve().then(m)):(l.push(e),Promise.resolve().then(m))}},createRequestOperation:(e,r,t)=>(t||(t={}),s(e,r,{_instance:"mutation"===e?i=i+1|0:void 0,...d,...t,requestPolicy:t.requestPolicy||d.requestPolicy,suspense:t.suspense||!1!==t.suspense&&g.suspense})),executeRequestOperation:e=>{return r="mutation"===e.kind?v(e):t.lazy((()=>{var r=a.get(e.key);r||a.set(e.key,r=v(e)),r=t.onStart((()=>{m(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=g.createRequestOperation("query",e,r);return g.executeRequestOperation(t)},executeSubscription(e,r){var t=g.createRequestOperation("subscription",e,r);return g.executeRequestOperation(t)},executeMutation(e,r){var t=g.createRequestOperation("mutation",e,r);return g.executeRequestOperation(t)},readQuery(e,r,n){var i=null;return t.subscribe((e=>{i=e}))(g.query(e,r,n)).unsubscribe(),i},query:(e,t,n)=>g.executeQuery(r.createRequest(e,t),n),subscription:(e,t,n)=>g.executeSubscription(r.createRequest(e,t),n),mutation:(e,t,n)=>g.executeMutation(r.createRequest(e,t),n)}),w=c,b=h(n.exchanges),q=t.share(b({client:g,dispatchDebug:w,forward:y({dispatchDebug:w})})(p.source));return t.publish(q),g},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:i})=>{var o=new Map,a=new Map,s=e=>"query"===e.kind&&"network-only"!==e.context.requestPolicy&&("cache-only"===e.context.requestPolicy||o.has(e.key));return c=>{var k=t.map((e=>{var t=o.get(e.key),n=t||r.makeResult(e,{data:null});return n={...n,operation:u(e,{cacheOutcome:t?"hit":"miss"})},"cache-and-network"===e.context.requestPolicy&&(n.stale=!0,p(i,e)),n}))(t.filter((e=>!l(e)&&s(e)))(c)),h=t.tap((e=>{var{operation:r}=e;if(r){var t=r.context.additionalTypenames||[];if("subscription"!==e.operation.kind&&(t=(e=>[...n(e,new Set)])(e.data).concat(t)),"mutation"===e.operation.kind||"subscription"===e.operation.kind){for(var s=new Set,u=0;u<t.length;u++){var c=t[u],l=a.get(c);for(var d of(l||a.set(c,l=new Set),l.values()))s.add(d);l.clear()}for(var k of s.values())o.has(k)&&(r=o.get(k).operation,o.delete(k),p(i,r))}else if("query"===r.kind&&e.data){o.set(r.key,e);for(var h=0;h<t.length;h++){var f=t[h],y=a.get(f);y||a.set(f,y=new Set),y.add(r.key)}}}}))(e(t.filter((e=>"query"!==e.kind||"cache-only"!==e.context.requestPolicy))(t.map((e=>u(e,{cacheOutcome:"miss"})))(t.merge([t.map(d)(t.filter((e=>!l(e)&&!s(e)))(c)),t.filter((e=>l(e)))(c)])))));return t.merge([k,h])}},exports.composeExchanges=h,exports.createClient=v,exports.debugExchange=({forward:e})=>r=>e(r),exports.errorExchange=f,exports.fetchExchange=({forward:e})=>n=>{var i=t.mergeMap((e=>{var i=r.makeFetchBody(e),o=r.makeFetchURL(e,i),a=r.makeFetchOptions(e,i);return t.takeUntil(t.filter((r=>"teardown"===r.kind&&r.key===e.key))(n))(r.makeFetchSource(e,o,a))}))(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([i,o])},exports.formatDocument=a,exports.gql=function(t){for(var n=new Map,i=[],o=[],a=Array.isArray(t)?t[0]:t||"",s=1;s<arguments.length;s++){var u=arguments[s];u&&u.definitions?o.push(u):a+=u,a+=arguments[0][s]}o.unshift(r.keyDocument(a));for(var c=0;c<o.length;c++)for(var l=0;l<o[c].definitions.length;l++){var d=o[c].definitions[l];if(d.kind===e.Kind.FRAGMENT_DEFINITION){var p=d.name.value,k=r.stringifyDocument(d);n.has(p)||(n.set(p,k),i.push(d))}else i.push(d)}return r.keyDocument({kind:e.Kind.DOCUMENT,definitions:i})},exports.makeOperation=s,exports.mapExchange=f,exports.ssrExchange=(e={})=>{var n=!!e.staleWhileRevalidate,i=!!e.includeExtensions,o={},a=[],s=e=>{a.push(e.operation.key),1===a.length&&Promise.resolve().then((()=>{for(var e;e=a.shift();)o[e]=null}))},c=({client:a,forward:c})=>l=>{var h=e&&"boolean"==typeof e.isClient?!!e.isClient:!a.suspense,f=c(t.map(d)(t.filter((e=>"teardown"===e.kind||!o[e.key]||!!o[e.key].hasNext||"network-only"===e.context.requestPolicy))(l))),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],i);return n&&!k.has(e.key)&&(t.stale=!0,k.add(e.key),p(a,e)),{...t,operation:u(e,{cacheOutcome:"hit"})}}))(t.filter((e=>"teardown"!==e.kind&&!!o[e.key]&&"network-only"!==e.context.requestPolicy))(l));return h?y=t.tap(s)(y):f=t.tap((e=>{var{operation:r}=e;if("mutation"!==r.kind){var t=((e,r)=>{var t={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,i);o[r.key]=t}}))(f),t.merge([f,y])};return c.restoreData=e=>{for(var r in e)null!==o[r]&&(o[r]=e[r])},c.extractData=()=>{var e={};for(var r in o)null!=o[r]&&(e[r]=o[r]);return e},e&&e.initialState&&c.restoreData(e.initialState),c},exports.subscriptionExchange=({forwardSubscription:e,enableAllOperations:n,isSubscriptionOperation:i})=>({client:o,forward:a})=>{var u=i||(e=>"subscription"===e.kind||!!n&&("query"===e.kind||"mutation"===e.kind));return n=>{var i=t.mergeMap((i=>{var{key:a}=i,u=t.filter((e=>"teardown"===e.kind&&e.key===a))(n);return t.takeUntil(u)((n=>{var i=e(r.makeFetchBody(n),n);return t.make((e=>{var t,a,u=!1;function c(t){e.next(a=a?r.mergeResultPatch(a,t):r.makeResult(n,t))}return Promise.resolve().then((()=>{u||(t=i.subscribe({next:c,error(t){Array.isArray(t)?c({errors:t}):e.next(r.makeErrorResult(n,t)),e.complete()},complete(){u||(u=!0,"subscription"===n.kind&&o.reexecuteOperation(s("teardown",n,n.context)),a&&a.hasNext&&c({hasNext:!1}),e.complete())}}))})),()=>{u=!0,t&&t.unsubscribe()}}))})(i))}))(t.filter((e=>"teardown"!==e.kind&&u(e)))(n)),c=a(t.filter((e=>"teardown"===e.kind||!u(e)))(n));return t.merge([i,c])}}; | ||
//# sourceMappingURL=urql-core.min.js.map |
{ | ||
"name": "@urql/core", | ||
"version": "5.0.8", | ||
"version": "5.1.0-canary-07397cf11b4b6a64bf8fff9a8ea2e23b81d83067", | ||
"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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
930121
32
3