@urql/core
Advanced tools
Comparing version 2.1.5 to 2.1.6
# @urql/core | ||
## 2.1.6 | ||
### Patch Changes | ||
- Warn for invalid operation passed to query/subscription/mutation, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#1829](https://github.com/FormidableLabs/urql/pull/1829)) | ||
## 2.1.5 | ||
@@ -4,0 +10,0 @@ |
@@ -14,1 +14,5 @@ import { TypedDocumentNode } from '@graphql-typed-document-node/core'; | ||
export declare const getOperationName: (query: DocumentNode) => string | undefined; | ||
/** | ||
* Finds the operation-type | ||
*/ | ||
export declare const getOperationType: (query: DocumentNode) => string | undefined; |
@@ -1,2 +0,2 @@ | ||
var e = require("./b4631212.js"); | ||
var e = require("./5458ef62.js"); | ||
@@ -3,0 +3,0 @@ exports.makeFetchBody = e.makeFetchBody; |
@@ -1,2 +0,2 @@ | ||
var e=require("./5f352e3e.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL; | ||
var e=require("./5e822557.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 r = require("./b4631212.js"); | ||
var r = require("./5458ef62.js"); | ||
@@ -467,4 +467,8 @@ var t = require("wonka"); | ||
}, | ||
createRequestOperation: function createRequestOperation(e, r, t) { | ||
return makeOperation(e, r, l.createOperationContext(t)); | ||
createRequestOperation: function createRequestOperation(e, t, n) { | ||
var a = r.getOperationType(t.query); | ||
if ("production" !== process.env.NODE_ENV && "teardown" !== e && a !== e) { | ||
throw new Error('Expected operation of type "' + e + '" but found "' + a + '"'); | ||
} | ||
return makeOperation(e, t, l.createOperationContext(n)); | ||
}, | ||
@@ -471,0 +475,0 @@ executeRequestOperation: function executeRequestOperation(e) { |
@@ -1,2 +0,2 @@ | ||
var e=require("graphql"),t=require("./5f352e3e.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"subscription"!==t&&"query"!==t}function k(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function m(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,h(i,e)),n}))(r.filter((function(e){return!k(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),h(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!k(e)&&!l(e)}))(a)),r.filter((function(e){return k(e)}))(a)])))));return r.merge([f,d])}}function h(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))}function x(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){n.delete(e.operation.key)}return function(e){var n=r.filter(o)(e);return r.tap(i)(t(n))}}function v(e){var n=e.forward;return function(e){var o=r.share(e),i=r.mergeMap((function(e){var n=e.key,i=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(o),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 g(e){return function(e){return r.filter((function(){return!1}))(r.tap((function(e){}))(e))}}var b=g();function q(e){return function(t){var r=t.client;return e.reduceRight((function(e,t){return t({client:r,forward:e,dispatchDebug:function(e){}})}),t.forward)}}var w=[x,m,v],E=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);if(x.maskTypename&&(n=r.map((function(e){return t._extends({},e,{data:c(e.data)})}))(n)),"mutation"===e.kind)return r.take(1)(r.onStart((function(){return k(e)}))(n));var a=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.onStart((function(){i.set(e.key,a)}))(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))))));return a}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,t,r){return f(e,t,x.createOperationContext(r))},executeRequestOperation:function(e){if("mutation"===e.kind)return m(e);var n=i.get(e.key)||m(e),u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return r.make((function(i){return r.subscribe(i.next)(r.onEnd(i.complete)(r.onStart((function(){var r=o.get(e.key);if("subscription"===e.kind)return k(e);u&&k(e),null!=r&&r===o.get(e.key)?i.next(u?t._extends({},r,{stale:!0}):r):u||k(e)}))(n))).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))}}),v=l,b=q(void 0!==n.exchanges?n.exchanges:w),E=r.share(b({client:x,dispatchDebug:v,forward:g()})(p));return r.publish(E),x},O=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=O,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=x,exports.defaultExchanges=w,exports.errorExchange=function(e){var t=e.onError;return function(e){var n=e.forward;return function(e){return r.tap((function(e){var r=e.error;r&&t(r,e.operation)}))(n(e))}}},exports.fallbackExchangeIO=b,exports.fetchExchange=v,exports.formatDocument=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={},o=[];function i(e){o.push(e.operation.key),1===o.length&&Promise.resolve().then((function(){for(var e;e=o.shift();)n[e]=null}))}function u(e){return!y(e)&&null!=n[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=r.share(o),p=c(r.filter((function(e){return!u(e)}))(f)),l=r.map((function(e){var r,o,i;return o=(r=n[e.key]).error,{operation:e,data:(i=r.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}}))(r.filter((function(e){return u(e)}))(f));return s?l=r.tap(i)(l):p=r.tap((function(e){var t=e.operation;if(!y(t)){var r=function(e){var t=e.data,r=e.error,n={};return void 0!==t&&(n.data=JSON.stringify(t)),r&&(n.error={graphQLErrors:r.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},r.networkError&&(n.error.networkError=""+r.networkError)),n}(e);n[t.key]=r}}))(p),r.merge([p,l])}};return a.restoreData=function(e){for(var t in e)null!==n[t]&&(n[t]=e[t])},a.extractData=function(){var e={};for(var t in n)null!=n[t]&&(e[t]=n[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("./5e822557.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"subscription"!==t&&"query"!==t}function k(e){var t=e.kind;return"mutation"!==t&&"query"!==t}function m(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,h(i,e)),n}))(r.filter((function(e){return!k(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),h(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!k(e)&&!l(e)}))(a)),r.filter((function(e){return k(e)}))(a)])))));return r.merge([f,d])}}function h(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))}function x(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){n.delete(e.operation.key)}return function(e){var n=r.filter(o)(e);return r.tap(i)(t(n))}}function v(e){var n=e.forward;return function(e){var o=r.share(e),i=r.mergeMap((function(e){var n=e.key,i=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(o),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 g(e){return function(e){return r.filter((function(){return!1}))(r.tap((function(e){}))(e))}}var q=g();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 w=[x,m,v],E=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);if(x.maskTypename&&(n=r.map((function(e){return t._extends({},e,{data:c(e.data)})}))(n)),"mutation"===e.kind)return r.take(1)(r.onStart((function(){return k(e)}))(n));var a=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.onStart((function(){i.set(e.key,a)}))(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))))));return a}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){if("mutation"===e.kind)return m(e);var n=i.get(e.key)||m(e),u="cache-and-network"===e.context.requestPolicy||"network-only"===e.context.requestPolicy;return r.make((function(i){return r.subscribe(i.next)(r.onEnd(i.complete)(r.onStart((function(){var r=o.get(e.key);if("subscription"===e.kind)return k(e);u&&k(e),null!=r&&r===o.get(e.key)?i.next(u?t._extends({},r,{stale:!0}):r):u||k(e)}))(n))).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))}}),v=l,q=b(void 0!==n.exchanges?n.exchanges:w),E=r.share(q({client:x,dispatchDebug:v,forward:g()})(p));return r.publish(E),x},O=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=b,exports.createClient=O,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=x,exports.defaultExchanges=w,exports.errorExchange=function(e){var t=e.onError;return function(e){var n=e.forward;return function(e){return r.tap((function(e){var r=e.error;r&&t(r,e.operation)}))(n(e))}}},exports.fallbackExchangeIO=q,exports.fetchExchange=v,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={},o=[];function i(e){o.push(e.operation.key),1===o.length&&Promise.resolve().then((function(){for(var e;e=o.shift();)n[e]=null}))}function u(e){return!y(e)&&null!=n[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=r.share(o),p=c(r.filter((function(e){return!u(e)}))(f)),l=r.map((function(e){var r,o,i;return o=(r=n[e.key]).error,{operation:e,data:(i=r.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}}))(r.filter((function(e){return u(e)}))(f));return s?l=r.tap(i)(l):p=r.tap((function(e){var t=e.operation;if(!y(t)){var r=function(e){var t=e.data,r=e.error,n={};return void 0!==t&&(n.data=JSON.stringify(t)),r&&(n.error={graphQLErrors:r.graphQLErrors.map((function(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}))},r.networkError&&(n.error.networkError=""+r.networkError)),n}(e);n[t.key]=r}}))(p),r.merge([p,l])}};return a.restoreData=function(e){for(var t in e)null!==n[t]&&(n[t]=e[t])},a.extractData=function(){var e={};for(var t in n)null!=n[t]&&(e[t]=n[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.1.5", | ||
"version": "2.1.6", | ||
"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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
365000
2595
26
5