Socket
Socket
Sign inDemoInstall

@urql/core

Package Overview
Dependencies
Maintainers
29
Versions
259
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 1.16.0 to 1.16.1

dist/195f0a58.mjs

6

CHANGELOG.md
# @urql/core
## 1.16.1
### Patch Changes
- Add fragment deduplication to `gql` tag. Identical fragments can now be interpolated multiple times without a warning being triggered or them being duplicated in `gql`'s output, by [@kitten](https://github.com/kitten) (See [#1225](https://github.com/FormidableLabs/urql/pull/1225))
## 1.16.0

@@ -4,0 +10,0 @@

5

dist/types/utils/request.d.ts
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { DocumentNode } from 'graphql';
import { DefinitionNode, DocumentNode } from 'graphql';
import { GraphQLRequest } from '../types';

@@ -7,3 +7,4 @@ export interface KeyedDocumentNode extends DocumentNode {

}
export declare const keyDocument: (q: string | DocumentNode | TypedDocumentNode) => KeyedDocumentNode;
export declare const stringifyDocument: (node: string | DefinitionNode | DocumentNode) => string;
export declare const keyDocument: (q: string | DocumentNode) => KeyedDocumentNode;
export declare const createRequest: <Data = any, Variables = object>(q: string | DocumentNode | TypedDocumentNode<Data, Variables>, vars?: Variables | undefined) => GraphQLRequest<Data, Variables>;

@@ -10,0 +11,0 @@ /**

2

dist/urql-core-internal.js
"use strict";
var fetchSource = require("./2e89d385.js");
var fetchSource = require("./2cbb0ff5.js");

@@ -5,0 +5,0 @@ exports.makeFetchBody = fetchSource.makeFetchBody;

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

"use strict";var e=require("./4e272566.min.js");exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL;
"use strict";var e=require("./b3f27070.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

@@ -82,3 +82,3 @@ "use strict";

var graphql = require("graphql"), fetchSource = require("./2e89d385.js"), wonka = require("wonka"), collectTypes = function(a, b) {
var graphql = require("graphql"), fetchSource = require("./2cbb0ff5.js"), wonka = require("wonka"), collectTypes = function(a, b) {
if (Array.isArray(a)) {

@@ -138,3 +138,14 @@ for (var c = 0; c < a.length; c++) {

}));
}, noop = function() {}, shouldSkip = function(a) {
}, noop = function() {}, applyDefinitions = function(a, b, c) {
var d, e, f;
for (d = 0; d < c.length; d++) {
if (c[d].kind === graphql.Kind.FRAGMENT_DEFINITION) {
e = c[d].name.value, f = fetchSource.stringifyDocument(c[d]);
a.has(e) ? "production" !== process.env.NODE_ENV && a.get(e) !== f && console.warn("[WARNING: Duplicate Fragment] A fragment with name `" + e + "` already exists in this document.\nWhile fragment names may not be unique across your source, each name must be unique per document.") : (a.set(e, f),
b.push(c[d]));
} else {
b.push(c[d]);
}
}
}, shouldSkip = function(a) {
return "subscription" !== (a = a.kind) && "query" !== a;

@@ -163,3 +174,3 @@ }, serializeResult = function(a) {

function b() {
for (var a; a = k.shift(); ) {
for (var a; a = m.shift(); ) {
delete g[a];

@@ -169,3 +180,3 @@ }

function c(a) {
return !m(a);
return !k(a);
}

@@ -176,31 +187,31 @@ function d(a) {

function e(a) {
return m(a);
return k(a);
}
function n(a) {
function f(a) {
var c = a.operation;
shouldSkip(c) || (a = serializeResult(a), g[c.key] = a);
}
var g = {}, k = [], f = function(a) {
k.push(a.operation.key);
1 === k.length && Promise.resolve().then(b);
}, m = function(a) {
var g = {}, m = [], h = function(a) {
m.push(a.operation.key);
1 === m.length && Promise.resolve().then(b);
}, k = function(a) {
return !shouldSkip(a) && void 0 !== g[a.key];
}, h = function(b) {
var l = b.client, g = b.forward;
}, l = function(b) {
var q = b.client, g = b.forward;
return function(b) {
var h = a && "boolean" == typeof a.isClient ? !!a.isClient : !l.suspense, p = wonka.share(b);
b = g(wonka.filter(c)(p));
p = wonka.map(d)(wonka.filter(e)(p));
h ? p = wonka.tap(f)(p) : b = wonka.tap(n)(b);
return wonka.merge([ b, p ]);
var l = a && "boolean" == typeof a.isClient ? !!a.isClient : !q.suspense, n = wonka.share(b);
b = g(wonka.filter(c)(n));
n = wonka.map(d)(wonka.filter(e)(n));
l ? n = wonka.tap(h)(n) : b = wonka.tap(f)(b);
return wonka.merge([ b, n ]);
};
};
h.restoreData = function(a) {
l.restoreData = function(a) {
return fetchSource._extends(g, a);
};
h.extractData = function() {
l.extractData = function() {
return fetchSource._extends({}, g);
};
a && a.initialState && h.restoreData(a.initialState);
return h;
a && a.initialState && l.restoreData(a.initialState);
return l;
}, shouldSkip$1 = function(a) {

@@ -210,4 +221,4 @@ return "mutation" !== (a = a.kind) && "query" !== a;

function b(a) {
var b = f.get(a.key);
"production" !== process.env.NODE_ENV && k(fetchSource._extends({}, {
var b = h.get(a.key);
"production" !== process.env.NODE_ENV && m(fetchSource._extends({}, {
operation: a

@@ -230,14 +241,14 @@ }, b ? {

function c(a) {
return !shouldSkip$1(a) && q(a);
return !shouldSkip$1(a) && p(a);
}
function d(a) {
function b(a) {
h.add(a);
l.add(a);
}
var e, h, l, d = a.operation;
var e, l, f, d = a.operation;
if (d) {
e = collectTypesFromResponse(a.data).concat(d.context.additionalTypenames || []);
if ("mutation" === a.operation.kind) {
h = new Set;
"production" !== process.env.NODE_ENV && k({
l = new Set;
"production" !== process.env.NODE_ENV && m({
type: "cacheInvalidation",

@@ -253,11 +264,11 @@ message: "The following typenames have been invalidated: " + e,

for (a = 0; a < e.length; a++) {
(l = m[l = e[a]] || (m[l] = new Set)).forEach(b);
l.clear();
(f = k[f = e[a]] || (k[f] = new Set)).forEach(b);
f.clear();
}
h.forEach((function c(a) {
f.has(a) && (d = f.get(a).operation, f.delete(a), reexecuteOperation(g, d));
l.forEach((function c(a) {
h.has(a) && (d = h.get(a).operation, h.delete(a), reexecuteOperation(g, d));
}));
} else if ("query" === d.kind && a.data) {
for (f.set(d.key, a), a = 0; a < e.length; a++) {
(m[l = e[a]] || (m[l] = new Set)).add(d.key);
for (h.set(d.key, a), a = 0; a < e.length; a++) {
(k[f = e[a]] || (k[f] = new Set)).add(d.key);
}

@@ -268,13 +279,13 @@ }

function e(a) {
return !shouldSkip$1(a) && !q(a);
return !shouldSkip$1(a) && !p(a);
}
var n = a.forward, g = a.client, k = a.dispatchDebug, f = new Map, m = Object.create(null), h = _ref$2, q = function(a) {
var f = a.forward, g = a.client, m = a.dispatchDebug, h = new Map, k = Object.create(null), l = _ref$2, p = function(a) {
var c = a.context.requestPolicy;
return "query" === a.kind && "network-only" !== c && ("cache-only" === c || f.has(a.key));
return "query" === a.kind && "network-only" !== c && ("cache-only" === c || h.has(a.key));
};
return function(a) {
var f = wonka.share(a);
a = wonka.map(b)(wonka.filter(c)(f));
f = wonka.tap(d)(n(wonka.filter(_ref7)(wonka.map(_ref8)(wonka.merge([ wonka.map(h)(wonka.filter(e)(f)), wonka.filter(_ref10)(f) ])))));
return wonka.merge([ a, f ]);
var h = wonka.share(a);
a = wonka.map(b)(wonka.filter(c)(h));
h = wonka.tap(d)(f(wonka.filter(_ref7)(wonka.map(_ref8)(wonka.merge([ wonka.map(l)(wonka.filter(e)(h)), wonka.filter(_ref10)(h) ])))));
return wonka.merge([ a, h ]);
};

@@ -292,5 +303,5 @@ }, reexecuteOperation = function(a, b) {

function d(a) {
return !m(a);
return !k(a);
}
var e = a.client, k = a.forward, f = function(a) {
var e = a.client, m = a.forward, h = function(a) {
var b = c({

@@ -304,16 +315,16 @@ key: a.key.toString(36),

function d(b) {
return k(fetchSource.makeResult(a, b));
return f(fetchSource.makeResult(a, b));
}
function f(b) {
return k(fetchSource.makeErrorResult(a, b));
function h(b) {
return f(fetchSource.makeErrorResult(a, b));
}
function g() {
h || (h = !0, "subscription" === a.kind && e.reexecuteOperation(makeOperation("teardown", a, a.context)),
k || (k = !0, "subscription" === a.kind && e.reexecuteOperation(makeOperation("teardown", a, a.context)),
m());
}
var l, k = c.next, m = c.complete, h = !1;
var l, f = c.next, m = c.complete, k = !1;
Promise.resolve().then((function() {
h || (l = b.subscribe({
k || (l = b.subscribe({
next: d,
error: f,
error: h,
complete: g

@@ -323,7 +334,7 @@ }));

return function() {
h = !0;
k = !0;
l && l.unsubscribe();
};
}));
}, m = b;
}, k = b;
return function(a) {

@@ -335,5 +346,5 @@ var c, b = wonka.share(a);

}))(b);
return wonka.takeUntil(d)(f(a));
}))(wonka.filter(m)(b));
c = k(wonka.filter(d)(b));
return wonka.takeUntil(d)(h(a));
}))(wonka.filter(k)(b));
c = m(wonka.filter(d)(b));
return wonka.merge([ a, c ]);

@@ -351,12 +362,12 @@ };

var b = a.forward, c = a.dispatchDebug, d = new Set, e = function(a) {
var b = a.key, f = a.kind;
if ("teardown" === f) {
var b = a.key, h = a.kind;
if ("teardown" === h) {
return d.delete(b), !0;
}
if ("query" !== f && "subscription" !== f) {
if ("query" !== h && "subscription" !== h) {
return !0;
}
f = d.has(b);
h = d.has(b);
d.add(b);
f && "production" !== process.env.NODE_ENV && c({
h && "production" !== process.env.NODE_ENV && c({
type: "dedup",

@@ -367,4 +378,4 @@ message: "An operation has been deduped.",

});
return !f;
}, n = function(a) {
return !h;
}, f = function(a) {
d.delete(a.operation.key);

@@ -374,3 +385,3 @@ };

a = wonka.filter(e)(a);
return wonka.tap(n)(b(a));
return wonka.tap(f)(b(a));
};

@@ -380,7 +391,7 @@ }, fetchExchange = function(a) {

return function(a) {
var n, d = wonka.share(a);
var f, d = wonka.share(a);
a = wonka.mergeMap((function(a) {
var b = a.key, f = wonka.filter((function(a) {
var b = a.key, h = wonka.filter((function(a) {
return "teardown" === a.kind && a.key === b;
}))(d), e = fetchSource.makeFetchBody(a), h = fetchSource.makeFetchURL(a, e), g = fetchSource.makeFetchOptions(a, e);
}))(d), e = fetchSource.makeFetchBody(a), f = fetchSource.makeFetchURL(a, e), g = fetchSource.makeFetchOptions(a, e);
"production" !== process.env.NODE_ENV && c({

@@ -391,3 +402,3 @@ type: "fetchRequest",

data: {
url: h,
url: f,
fetchOptions: g

@@ -404,3 +415,3 @@ },

data: {
url: h,
url: f,
fetchOptions: g,

@@ -411,6 +422,6 @@ value: d || b

});
}))(wonka.takeUntil(f)(fetchSource.makeFetchSource(a, h, g)));
}))(wonka.takeUntil(h)(fetchSource.makeFetchSource(a, f, g)));
}))(wonka.filter(_ref$3)(d));
n = b(wonka.filter(_ref2$1)(d));
return wonka.merge([ a, n ]);
f = b(wonka.filter(_ref2$1)(d));
return wonka.merge([ a, f ]);
};

@@ -468,3 +479,3 @@ }, fallbackExchange = function(a) {

}, Client = function(a) {
var d, e, n, g, k, c = this;
var d, e, f, g, m, c = this;
this.activeOperations = Object.create(null);

@@ -504,5 +515,5 @@ this.queue = [];

if ("production" !== process.env.NODE_ENV) {
e = (d = wonka.makeSubject()).next, n = d.source;
e = (d = wonka.makeSubject()).next, f = d.source;
this.subscribeToDebugTarget = function b(a) {
return wonka.subscribe(a)(n);
return wonka.subscribe(a)(f);
};

@@ -521,13 +532,13 @@ d = e;

this.operations$ = e.source;
k = !1;
m = !1;
this.dispatchOperation = function(a) {
k = !0;
m = !0;
for (a && g(a); a = c.queue.shift(); ) {
g(a);
}
k = !1;
m = !1;
};
this.reexecuteOperation = function(a) {
if ("mutation" === a.kind || 0 < (c.activeOperations[a.key] || 0)) {
c.queue.push(a), k || Promise.resolve().then(c.dispatchOperation);
c.queue.push(a), m || Promise.resolve().then(c.dispatchOperation);
}

@@ -563,3 +574,3 @@ };

Client.prototype.executeRequestOperation = function(a) {
var n, g, d = this, e = wonka.filter((function(b) {
var f, g, d = this, e = wonka.filter((function(b) {
return b.operation.key === a.key;

@@ -573,3 +584,3 @@ }))(this.results$);

}
n = wonka.filter((function(b) {
f = wonka.filter((function(b) {
return "teardown" === b.kind && b.key === a.key;

@@ -580,3 +591,3 @@ }))(this.operations$), g = wonka.onEnd((function() {

d.onOperationStart(a);
}))(wonka.takeUntil(n)(e)));
}))(wonka.takeUntil(f)(e)));
return "query" === a.kind && a.context.pollInterval ? wonka.switchMap((function c() {

@@ -645,20 +656,14 @@ return g;

exports.gql = function gql() {
var a, b, c, d, e;
for (a = arguments, b = Array.isArray(arguments[0]) ? arguments[0][0] : arguments[0] || "",
c = 1; c < arguments.length; c++) {
b += (d = a[c]) && d.kind === graphql.Kind.DOCUMENT ? d.loc ? d.loc.source.body : graphql.print(d) : d;
b += a[0][c];
var a, b, c, d, e, f, g;
for (a = arguments, b = new Map, c = [], d = [], e = Array.isArray(arguments[0]) ? arguments[0][0] : arguments[0] || "",
f = 1; f < arguments.length; f++) {
(g = a[f]) && g.definitions ? d.push.apply(d, g.definitions) : e += g;
e += a[0][f];
}
a = fetchSource.keyDocument(b);
if ("production" !== process.env.NODE_ENV) {
for (c = new Set, d = 0; d < a.definitions.length; d++) {
(e = a.definitions[d]).kind === graphql.Kind.FRAGMENT_DEFINITION && (c.has(e = e.name.value) ? console.warn("[WARNING: Duplicate Fragment] A fragment with name `" + e + "` already exists in this document.\nWhile fragment names may not be unique across your source, each name must be unique per document.") : c.add(e));
}
}
a.loc = {
start: 0,
end: b.length,
source: new graphql.Source(b, "gql")
};
return a;
applyDefinitions(b, c, fetchSource.keyDocument(e).definitions);
applyDefinitions(b, c, d);
return fetchSource.keyDocument({
kind: graphql.Kind.DOCUMENT,
definitions: c
});
};

@@ -665,0 +670,0 @@

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

"use strict";var e=require("graphql"),t=require("./4e272566.min.js"),r=require("wonka"),n=function(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(r in e)"__typename"===r&&"string"==typeof e[r]?t[e[r]]=0:n(e[r],t);return t};function o(t){return t.kind===e.Kind.FIELD&&"__typename"===t.name.value&&!t.alias}var i=function(r){if(r.selectionSet&&!r.selectionSet.selections.some(o))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,a=function(r){r=t.keyDocument(r);var n=u.get(r.__key);return n||((n=e.visit(r,{Field:i,InlineFragment:i})).__key=r.__key,u.set(r.__key,n)),n},s=function(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(s):n&&"object"==typeof n&&"__typename"in n?s(n):n,t}),{}):e};function c(e){return e.toPromise=function(){return r.toPromise(r.take(1)(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,get operationName(){return this.kind}}}var p=function(e,r){return f(e.kind,e,t._extends({},e.context,{meta:t._extends({},e.context.meta,r)}))},l=function(){},h=function(e){return"subscription"!==(e=e.kind)&&"query"!==e};function d(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var y=function(e){return"mutation"!==(e=e.kind)&&"query"!==e};function k(e){var t=f(e.kind,e);return t.query=a(e.query),t}function m(e){return"query"!==e.kind||"cache-only"!==e.context.requestPolicy}function v(e){return p(e,{cacheOutcome:"miss"})}function x(e){return y(e)}var g=function(e){function o(e){var r=f.get(e.key);return r=t._extends({},r,{operation:p(e,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===e.context.requestPolicy&&(r.stale=!0,q(c,e)),r}function i(e){return!y(e)&&d(e)}function u(e){function t(e){i.add(e)}var r=e.operation;if(r){var o=function(e){return Object.keys(n(e,{}))}(e.data).concat(r.context.additionalTypenames||[]);if("mutation"===e.operation.kind){var i=new Set;for(e=0;e<o.length;e++){var u=o[e];(u=l[u]||(l[u]=new Set)).forEach(t),u.clear()}i.forEach((function(e){f.has(e)&&(r=f.get(e).operation,f.delete(e),q(c,r))}))}else if("query"===r.kind&&e.data)for(f.set(r.key,e),e=0;e<o.length;e++)(l[u=o[e]]||(l[u]=new Set)).add(r.key)}}function a(e){return!y(e)&&!d(e)}var s=e.forward,c=e.client,f=new Map,l=Object.create(null),h=k,d=function(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||f.has(e.key))};return function(e){var t=r.share(e);return e=r.map(o)(r.filter(i)(t)),t=r.tap(u)(s(r.filter(m)(r.map(v)(r.merge([r.map(h)(r.filter(a)(t)),r.filter(x)(t)]))))),r.merge([e,t])}},q=function(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))},O=function(e){var t=e.forward,n=new Set,o=function(e){var t=e.key;return"teardown"===(e=e.kind)?(n.delete(t),!0):"query"!==e&&"subscription"!==e||(e=n.has(t),n.add(t),!e)},i=function(e){n.delete(e.operation.key)};return function(e){return e=r.filter(o)(e),r.tap(i)(t(e))}};function b(e){return"query"===e.kind||"mutation"===e.kind}function E(e){return"query"!==e.kind&&"mutation"!==e.kind}var w=function(e){var n=e.forward;return function(e){var o=r.share(e);e=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);return u=t.makeFetchOptions(e,u),r.onPush((function(e){}))(r.takeUntil(i)(t.makeFetchSource(e,a,u)))}))(r.filter(b)(o));var i=n(r.filter(E)(o));return r.merge([e,i])}};function _(){return!1}var S=function(e){function t(e){}return function(e){return r.filter(_)(r.tap(t)(e))}},R=S(),P=function(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)}},M=[O,g,w],D=function(e){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(e){return e||(e={}),t._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&n.suspense,requestPolicy:e.requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return f(e,t,n.createOperationContext(r))},this.executeQuery=function(e,t){return e=n.createRequestOperation("query",e,t),n.executeRequestOperation(e)},this.executeSubscription=function(e,t){return e=n.createRequestOperation("subscription",e,t),n.executeRequestOperation(e)},this.executeMutation=function(e,t){return e=n.createRequestOperation("mutation",e,t),n.executeRequestOperation(e)};var o=l;this.url=e.url,this.fetchOptions=e.fetchOptions,this.fetch=e.fetch,this.suspense=!!e.suspense,this.requestPolicy=e.requestPolicy||"cache-first",this.preferGetMethod=!!e.preferGetMethod,this.maskTypename=!!e.maskTypename;var i=r.makeSubject(),u=i.next;this.operations$=i.source;var a=!1;this.dispatchOperation=function(e){for(a=!0,e&&u(e);e=n.queue.shift();)u(e);a=!1},this.reexecuteOperation=function(e){("mutation"===e.kind||0<(n.activeOperations[e.key]||0))&&(n.queue.push(e),a||Promise.resolve().then(n.dispatchOperation))},e=P(void 0!==e.exchanges?e.exchanges:M),this.results$=r.share(e({client:this,dispatchDebug:o,forward:S()})(this.operations$)),r.publish(this.results$)};function j(e){return e.data=s(e.data),e}D.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},D.prototype.onOperationEnd=function(e){var t=e.key,r=this.activeOperations[t]||0;if(0>=(this.activeOperations[t]=0>=r?0:r-1)){for(t=this.queue.length-1;0<=t;t--)this.queue[t].key===e.key&&this.queue.splice(t,1);this.dispatchOperation(f("teardown",e,e.context))}},D.prototype.executeRequestOperation=function(e){var t=this,n=r.filter((function(t){return t.operation.key===e.key}))(this.results$);if(this.maskTypename&&(n=r.map(j)(n)),"mutation"===e.kind)return r.take(1)(r.onStart((function(){return t.dispatchOperation(e)}))(n));var o=r.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(this.operations$),i=r.onEnd((function(){t.onOperationEnd(e)}))(r.onStart((function(){t.onOperationStart(e)}))(r.takeUntil(o)(n)));return"query"===e.kind&&e.context.pollInterval?r.switchMap((function(){return i}))(r.merge([r.fromValue(0),r.interval(e.context.pollInterval)])):i},D.prototype.query=function(e,r,n){return n&&"boolean"==typeof n.suspense||(n=t._extends({},n,{suspense:!1})),c(this.executeQuery(t.createRequest(e,r),n))},D.prototype.readQuery=function(e,n,o){var i=null;return r.subscribe((function(e){i=e}))(this.executeQuery(t.createRequest(e,n),o)).unsubscribe(),i},D.prototype.subscription=function(e,r,n){return this.executeSubscription(t.createRequest(e,r),n)},D.prototype.mutation=function(e,r,n){return c(this.executeMutation(t.createRequest(e,r),n))},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=D,exports.cacheExchange=g,exports.composeExchanges=P,exports.createClient=function(e){return new D(e)},exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=O,exports.defaultExchanges=M,exports.errorExchange=function(e){function t(e){var t=e.error;e=e.operation,t&&n(t,e)}var n=e.onError;return function(e){var n=e.forward;return function(e){return r.tap(t)(n(e))}}},exports.fallbackExchangeIO=R,exports.fetchExchange=w,exports.formatDocument=a,exports.gql=function(){for(var r=arguments,n=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",o=1;o<arguments.length;o++){var i=r[o];n+=i&&i.kind===e.Kind.DOCUMENT?i.loc?i.loc.source.body:e.print(i):i,n+=r[0][o]}return(r=t.keyDocument(n)).loc={start:0,end:n.length,source:new e.Source(n,"gql")},r},exports.makeOperation=f,exports.maskTypename=s,exports.ssrExchange=function(e){function n(){for(var e;e=c.shift();)delete s[e]}function o(e){return!p(e)}function i(e){return function(e,r){var n=r.error;return{operation:e,data:(r=r.data)?JSON.parse(r):void 0,extensions:void 0,error:n?new t.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(e,s[e.key])}function u(e){return p(e)}function a(e){var t=e.operation;h(t)||(e=function(e){var t=e.data;e=e.error;var r={};return void 0!==t&&(r.data=JSON.stringify(t)),e&&(r.error={graphQLErrors:e.graphQLErrors.map(d)},e.networkError&&(r.error.networkError=""+e.networkError)),r}(e),s[t.key]=e)}var s={},c=[],f=function(e){c.push(e.operation.key),1===c.length&&Promise.resolve().then(n)},p=function(e){return!h(e)&&void 0!==s[e.key]},l=function(t){var n=t.client,s=t.forward;return function(t){var c=e&&"boolean"==typeof e.isClient?!!e.isClient:!n.suspense,p=r.share(t);return t=s(r.filter(o)(p)),p=r.map(i)(r.filter(u)(p)),c?p=r.tap(f)(p):t=r.tap(a)(t),r.merge([t,p])}};return l.restoreData=function(e){return t._extends(s,e)},l.extractData=function(){return t._extends({},s)},e&&e.initialState&&l.restoreData(e.initialState),l},exports.subscriptionExchange=function(n){function o(e){return"subscription"===(e=e.kind)||!!u&&("query"===e||"mutation"===e)}var i=n.forwardSubscription,u=n.enableAllOperations;return function(n){function u(e){return!p(e)}var a=n.client,s=n.forward,c=function(n){var o=i({key:n.key.toString(36),query:e.print(n.query),variables:n.variables,context:t._extends({},n.context)});return r.make((function(e){function r(e){return c(t.makeResult(n,e))}function i(e){return c(t.makeErrorResult(n,e))}function u(){l||(l=!0,"subscription"===n.kind&&a.reexecuteOperation(f("teardown",n,n.context)),p())}var s,c=e.next,p=e.complete,l=!1;return Promise.resolve().then((function(){l||(s=o.subscribe({next:r,error:i,complete:u}))})),function(){l=!0,s&&s.unsubscribe()}}))},p=o;return function(e){var t=r.share(e);e=r.mergeMap((function(e){var n=e.key,o=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(t);return r.takeUntil(o)(c(e))}))(r.filter(p)(t));var n=s(r.filter(u)(t));return r.merge([e,n])}}};
"use strict";var e=require("graphql"),t=require("./b3f27070.min.js"),r=require("wonka"),n=function(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(r in e)"__typename"===r&&"string"==typeof e[r]?t[e[r]]=0:n(e[r],t);return t};function i(t){return t.kind===e.Kind.FIELD&&"__typename"===t.name.value&&!t.alias}var o=function(r){if(r.selectionSet&&!r.selectionSet.selections.some(i))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,a=function(r){r=t.keyDocument(r);var n=u.get(r.__key);return n||((n=e.visit(r,{Field:o,InlineFragment:o})).__key=r.__key,u.set(r.__key,n)),n},s=function(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(s):n&&"object"==typeof n&&"__typename"in n?s(n):n,t}),{}):e};function c(e){return e.toPromise=function(){return r.toPromise(r.take(1)(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,get operationName(){return this.kind}}}var p=function(e,r){return f(e.kind,e,t._extends({},e.context,{meta:t._extends({},e.context.meta,r)}))},l=function(){},h=function(r,n,i){for(var o=0;o<i.length;o++)if(i[o].kind===e.Kind.FRAGMENT_DEFINITION){var u=i[o].name.value,a=t.stringifyDocument(i[o]);r.has(u)||(r.set(u,a),n.push(i[o]))}else n.push(i[o])},d=function(e){return"subscription"!==(e=e.kind)&&"query"!==e};function y(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var k=function(e){return"mutation"!==(e=e.kind)&&"query"!==e};function m(e){var t=f(e.kind,e);return t.query=a(e.query),t}function v(e){return"query"!==e.kind||"cache-only"!==e.context.requestPolicy}function x(e){return p(e,{cacheOutcome:"miss"})}function g(e){return k(e)}var q=function(e){function i(e){var r=f.get(e.key);return r=t._extends({},r,{operation:p(e,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===e.context.requestPolicy&&(r.stale=!0,O(c,e)),r}function o(e){return!k(e)&&d(e)}function u(e){function t(e){o.add(e)}var r=e.operation;if(r){var i=function(e){return Object.keys(n(e,{}))}(e.data).concat(r.context.additionalTypenames||[]);if("mutation"===e.operation.kind){var o=new Set;for(e=0;e<i.length;e++){var u=i[e];(u=l[u]||(l[u]=new Set)).forEach(t),u.clear()}o.forEach((function(e){f.has(e)&&(r=f.get(e).operation,f.delete(e),O(c,r))}))}else if("query"===r.kind&&e.data)for(f.set(r.key,e),e=0;e<i.length;e++)(l[u=i[e]]||(l[u]=new Set)).add(r.key)}}function a(e){return!k(e)&&!d(e)}var s=e.forward,c=e.client,f=new Map,l=Object.create(null),h=m,d=function(e){var t=e.context.requestPolicy;return"query"===e.kind&&"network-only"!==t&&("cache-only"===t||f.has(e.key))};return function(e){var t=r.share(e);return e=r.map(i)(r.filter(o)(t)),t=r.tap(u)(s(r.filter(v)(r.map(x)(r.merge([r.map(h)(r.filter(a)(t)),r.filter(g)(t)]))))),r.merge([e,t])}},O=function(e,r){return e.reexecuteOperation(f(r.kind,r,t._extends({},r.context,{requestPolicy:"network-only"})))},b=function(e){var t=e.forward,n=new Set,i=function(e){var t=e.key;return"teardown"===(e=e.kind)?(n.delete(t),!0):"query"!==e&&"subscription"!==e||(e=n.has(t),n.add(t),!e)},o=function(e){n.delete(e.operation.key)};return function(e){return e=r.filter(i)(e),r.tap(o)(t(e))}};function E(e){return"query"===e.kind||"mutation"===e.kind}function w(e){return"query"!==e.kind&&"mutation"!==e.kind}var _=function(e){var n=e.forward;return function(e){var i=r.share(e);e=r.mergeMap((function(e){var n=e.key,o=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(i),u=t.makeFetchBody(e),a=t.makeFetchURL(e,u);return u=t.makeFetchOptions(e,u),r.onPush((function(e){}))(r.takeUntil(o)(t.makeFetchSource(e,a,u)))}))(r.filter(E)(i));var o=n(r.filter(w)(i));return r.merge([e,o])}};function R(){return!1}var S=function(e){function t(e){}return function(e){return r.filter(R)(r.tap(t)(e))}},P=S(),M=function(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)}},D=[b,q,_],j=function(e){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(e){return e||(e={}),t._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},e,{suspense:e.suspense||!1!==e.suspense&&n.suspense,requestPolicy:e.requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return f(e,t,n.createOperationContext(r))},this.executeQuery=function(e,t){return e=n.createRequestOperation("query",e,t),n.executeRequestOperation(e)},this.executeSubscription=function(e,t){return e=n.createRequestOperation("subscription",e,t),n.executeRequestOperation(e)},this.executeMutation=function(e,t){return e=n.createRequestOperation("mutation",e,t),n.executeRequestOperation(e)};var i=l;this.url=e.url,this.fetchOptions=e.fetchOptions,this.fetch=e.fetch,this.suspense=!!e.suspense,this.requestPolicy=e.requestPolicy||"cache-first",this.preferGetMethod=!!e.preferGetMethod,this.maskTypename=!!e.maskTypename;var o=r.makeSubject(),u=o.next;this.operations$=o.source;var a=!1;this.dispatchOperation=function(e){for(a=!0,e&&u(e);e=n.queue.shift();)u(e);a=!1},this.reexecuteOperation=function(e){("mutation"===e.kind||0<(n.activeOperations[e.key]||0))&&(n.queue.push(e),a||Promise.resolve().then(n.dispatchOperation))},e=M(void 0!==e.exchanges?e.exchanges:D),this.results$=r.share(e({client:this,dispatchDebug:i,forward:S()})(this.operations$)),r.publish(this.results$)};function C(e){return e.data=s(e.data),e}j.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},j.prototype.onOperationEnd=function(e){var t=e.key,r=this.activeOperations[t]||0;if(0>=(this.activeOperations[t]=0>=r?0:r-1)){for(t=this.queue.length-1;0<=t;t--)this.queue[t].key===e.key&&this.queue.splice(t,1);this.dispatchOperation(f("teardown",e,e.context))}},j.prototype.executeRequestOperation=function(e){var t=this,n=r.filter((function(t){return t.operation.key===e.key}))(this.results$);if(this.maskTypename&&(n=r.map(C)(n)),"mutation"===e.kind)return r.take(1)(r.onStart((function(){return t.dispatchOperation(e)}))(n));var i=r.filter((function(t){return"teardown"===t.kind&&t.key===e.key}))(this.operations$),o=r.onEnd((function(){t.onOperationEnd(e)}))(r.onStart((function(){t.onOperationStart(e)}))(r.takeUntil(i)(n)));return"query"===e.kind&&e.context.pollInterval?r.switchMap((function(){return o}))(r.merge([r.fromValue(0),r.interval(e.context.pollInterval)])):o},j.prototype.query=function(e,r,n){return n&&"boolean"==typeof n.suspense||(n=t._extends({},n,{suspense:!1})),c(this.executeQuery(t.createRequest(e,r),n))},j.prototype.readQuery=function(e,n,i){var o=null;return r.subscribe((function(e){o=e}))(this.executeQuery(t.createRequest(e,n),i)).unsubscribe(),o},j.prototype.subscription=function(e,r,n){return this.executeSubscription(t.createRequest(e,r),n)},j.prototype.mutation=function(e,r,n){return c(this.executeMutation(t.createRequest(e,r),n))},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=j,exports.cacheExchange=q,exports.composeExchanges=M,exports.createClient=function(e){return new j(e)},exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=b,exports.defaultExchanges=D,exports.errorExchange=function(e){function t(e){var t=e.error;e=e.operation,t&&n(t,e)}var n=e.onError;return function(e){var n=e.forward;return function(e){return r.tap(t)(n(e))}}},exports.fallbackExchangeIO=P,exports.fetchExchange=_,exports.formatDocument=a,exports.gql=function(){for(var r=arguments,n=new Map,i=[],o=[],u=Array.isArray(arguments[0])?arguments[0][0]:arguments[0]||"",a=1;a<arguments.length;a++){var s=r[a];s&&s.definitions?o.push.apply(o,s.definitions):u+=s,u+=r[0][a]}return h(n,i,t.keyDocument(u).definitions),h(n,i,o),t.keyDocument({kind:e.Kind.DOCUMENT,definitions:i})},exports.makeOperation=f,exports.maskTypename=s,exports.ssrExchange=function(e){function n(){for(var e;e=c.shift();)delete s[e]}function i(e){return!p(e)}function o(e){return function(e,r){var n=r.error;return{operation:e,data:(r=r.data)?JSON.parse(r):void 0,extensions:void 0,error:n?new t.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(e,s[e.key])}function u(e){return p(e)}function a(e){var t=e.operation;d(t)||(e=function(e){var t=e.data;e=e.error;var r={};return void 0!==t&&(r.data=JSON.stringify(t)),e&&(r.error={graphQLErrors:e.graphQLErrors.map(y)},e.networkError&&(r.error.networkError=""+e.networkError)),r}(e),s[t.key]=e)}var s={},c=[],f=function(e){c.push(e.operation.key),1===c.length&&Promise.resolve().then(n)},p=function(e){return!d(e)&&void 0!==s[e.key]},l=function(t){var n=t.client,s=t.forward;return function(t){var c=e&&"boolean"==typeof e.isClient?!!e.isClient:!n.suspense,p=r.share(t);return t=s(r.filter(i)(p)),p=r.map(o)(r.filter(u)(p)),c?p=r.tap(f)(p):t=r.tap(a)(t),r.merge([t,p])}};return l.restoreData=function(e){return t._extends(s,e)},l.extractData=function(){return t._extends({},s)},e&&e.initialState&&l.restoreData(e.initialState),l},exports.subscriptionExchange=function(n){function i(e){return"subscription"===(e=e.kind)||!!u&&("query"===e||"mutation"===e)}var o=n.forwardSubscription,u=n.enableAllOperations;return function(n){function u(e){return!p(e)}var a=n.client,s=n.forward,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){function r(e){return c(t.makeResult(n,e))}function o(e){return c(t.makeErrorResult(n,e))}function u(){l||(l=!0,"subscription"===n.kind&&a.reexecuteOperation(f("teardown",n,n.context)),p())}var s,c=e.next,p=e.complete,l=!1;return Promise.resolve().then((function(){l||(s=i.subscribe({next:r,error:o,complete:u}))})),function(){l=!0,s&&s.unsubscribe()}}))},p=i;return function(e){var t=r.share(e);e=r.mergeMap((function(e){var n=e.key,i=r.filter((function(e){return"teardown"===e.kind&&e.key===n}))(t);return r.takeUntil(i)(c(e))}))(r.filter(p)(t));var n=s(r.filter(u)(t));return r.merge([e,n])}}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "1.16.0",
"version": "1.16.1",
"description": "The shared core for the highly customizable and versatile GraphQL client",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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