Socket
Socket
Sign inDemoInstall

@urql/core

Package Overview
Dependencies
Maintainers
31
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.11.4 to 1.11.5

dist/017092dd.min.mjs

7

CHANGELOG.md
# @urql/core
## 1.11.5
### Patch Changes
- Hoist variables in unminified build output for Metro Bundler builds which otherwise fails for `process.env.NODE_ENV` if-clauses, by [@kitten](https://github.com/kitten) (See [#737](https://github.com/FormidableLabs/urql/pull/737))
- Add a babel-plugin that removes empty imports from the final build output, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#735](https://github.com/FormidableLabs/urql/pull/735))
## 1.11.4

@@ -4,0 +11,0 @@

2

dist/types/internal/fetchOptions.d.ts
import { DocumentNode } from 'graphql';
import { Operation } from '../types';
export interface FetchBody {
query: string;
query?: string;
operationName: string | undefined;

@@ -6,0 +6,0 @@ variables: undefined | Record<string, any>;

"use strict";
var fetchSource = require("./86289ea0.js");
var fetchSource = require("./0b438a63.js");
require("wonka");
require("graphql/error/GraphQLError");
require("graphql/language/printer");
require("graphql/language/kinds");
exports.makeFetchBody = fetchSource.makeFetchBody;

@@ -14,0 +6,0 @@

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

"use strict";var e=require("./40364ab3.min.js");require("wonka"),require("graphql/error/GraphQLError"),require("graphql/language/printer"),require("graphql/language/kinds"),exports.makeFetchBody=e.makeFetchBody,exports.makeFetchOptions=e.makeFetchOptions,exports.makeFetchSource=e.makeFetchSource,exports.makeFetchURL=e.makeFetchURL;
"use strict";var e=require("./6fe6883a.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
"use strict";
var fetchSource = require("./86289ea0.js"), wonka = require("wonka");
function _ref2(a, c, b) {
return b.indexOf(a) === c;
}
require("graphql/error/GraphQLError");
function _ref3(a) {
return a.kind === kinds.Kind.FIELD && "__typename" === a.name.value;
}
var parser = require("graphql/language/parser"), printer = require("graphql/language/printer"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor"), phash = function(a, c) {
function withPromise(a) {
a.toPromise = function() {
return wonka.toPromise(wonka.take(1)(a));
};
return a;
}
function _ref(a) {
return a.path || a.extensions ? {
message: a.message,
path: a.path,
extensions: a.extensions
} : a.message;
}
function _ref$1(a) {
return fetchSource._extends({}, a, {
query: formatDocument(a.query)
});
}
function _ref5(a) {
return "query" !== a.operationName || "cache-only" !== a.context.requestPolicy;
}
function _ref6(a) {
return addMetadata(a, {
cacheOutcome: "miss"
});
}
function _ref8(a) {
return shouldSkip$1(a);
}
function _ref2$1(a) {
return console.log("[Exchange debug]: Completed operation: ", a);
}
function _ref3$1(a) {
return console.log("[Exchange debug]: Incoming operation: ", a);
}
function _ref$2(a) {
return "query" === a.operationName || "mutation" === a.operationName;
}
function _ref2$2(a) {
return "query" !== a.operationName && "mutation" !== a.operationName;
}
function _ref$3() {
return !1;
}
function _ref3$2(a) {
a.data = maskTypename(a.data);
return a;
}
var fetchSource = require("./0b438a63.js"), wonka = require("wonka"), parser = require("graphql/language/parser"), printer = require("graphql/language/printer"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor"), phash = function(a, c) {
a |= 0;

@@ -13,7 +77,7 @@ for (var b = 0, d = 0 | c.length; b < d; b++) {

return a;
}, hash = function(a) {
return phash(5381, a) >>> 0;
}, hashQuery = function(a) {
return function(a) {
return phash(5381, a) >>> 0;
}(a.replace(/[\s,]+/g, " ").trim());
}, docs = Object.create(null), createRequest = function(a, c) {
return hash(a.replace(/[\s,]+/g, " ").trim());
}, docs = Object.create(null), keyProp = "__key", createRequest = function(a, c) {
if ("string" == typeof a) {

@@ -23,6 +87,6 @@ var b = hashQuery(a);

} else {
void 0 !== a.__key ? b = a.__key : (b = hashQuery(printer.print(a)), a = void 0 !== docs[b] ? docs[b] : a);
void 0 !== a[keyProp] ? b = a[keyProp] : (b = hashQuery(printer.print(a)), a = void 0 !== docs[b] ? docs[b] : a);
}
docs[b] = a;
a.__key = b;
a[keyProp] = b;
return {

@@ -51,17 +115,5 @@ key: c ? phash(b, fetchSource.stringifyVariables(c)) >>> 0 : b,

return c;
};
function _ref2(a, c, b) {
return b.indexOf(a) === c;
}
var collectTypesFromResponse = function(a) {
}, collectTypesFromResponse = function(a) {
return collectTypes(a).filter(_ref2);
};
function _ref3(a) {
return a.kind === kinds.Kind.FIELD && "__typename" === a.name.value;
}
var formatNode = function(a) {
}, formatNode = function(a) {
if (a.selectionSet && !a.selectionSet.selections.some(_ref3)) {

@@ -81,2 +133,14 @@ return a.selectionSet.selections.push({

});
}, toSuspenseSource = function(a) {
return function(c) {
var b = wonka.share(a), d = !1, f = !1;
wonka.onPush((function() {
return d = !0;
}))(wonka.takeWhile((function() {
return !f;
}))(b))(c);
if (!d) {
throw f = !0, c(0), wonka.toPromise(wonka.take(1)(b));
}
};
}, maskTypename = function(a) {

@@ -91,48 +155,66 @@ return a && "object" == typeof a ? Object.keys(a).reduce((function(c, b) {

}), {}) : a;
};
function withPromise(a) {
a.toPromise = function() {
return wonka.toPromise(wonka.take(1)(a));
}, noop = function() {}, shouldSkip = function(a) {
return "subscription" !== (a = a.operationName) && "query" !== a;
}, serializeResult = function(a) {
var c = a.error;
a = {
data: a.data,
error: void 0
};
c && (a.error = {
graphQLErrors: c.graphQLErrors.map(_ref),
networkError: c.networkError ? "" + c.networkError : void 0
});
return a;
}
var noop = function() {}, shouldSkip = function(a) {
return "subscription" !== (a = a.operationName) && "query" !== a;
};
function _ref(a) {
return a.path || a.extensions ? {
message: a.message,
path: a.path,
extensions: a.extensions
} : a.message;
}
var shouldSkip$1 = function(a) {
}, deserializeResult = function(a, c) {
var b = c.error;
return {
operation: a,
data: c.data,
extensions: void 0,
error: b ? new fetchSource.CombinedError({
networkError: b.networkError ? Error(b.networkError) : void 0,
graphQLErrors: b.graphQLErrors && b.graphQLErrors.length ? b.graphQLErrors : void 0
}) : void 0
};
}, ssrExchange = function(a) {
function c(a) {
return !k(a);
}
function b(a) {
return deserializeResult(a, h[a.key]);
}
function d(a) {
return k(a);
}
function f(a) {
var b = a.operation;
shouldSkip(b) || (a = serializeResult(a), h[b.key] = a);
}
function g(a) {
delete h[a.operation.key];
}
var h = {}, k = function(a) {
return !shouldSkip(a) && void 0 !== h[a.key];
}, e = function(e) {
var h = e.client, l = e.forward;
return function(e) {
var q = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, k = wonka.share(e);
e = l(wonka.filter(c)(k));
k = wonka.map(b)(wonka.filter(d)(k));
q ? k = wonka.tap(g)(k) : e = wonka.tap(f)(e);
return wonka.merge([ e, k ]);
};
};
e.restoreData = function(a) {
return fetchSource._extends(h, a);
};
e.extractData = function() {
return fetchSource._extends({}, h);
};
a && a.initialState && e.restoreData(a.initialState);
return e;
}, shouldSkip$1 = function(a) {
return "mutation" !== (a = a.operationName) && "query" !== a;
};
function _ref$1(a) {
return fetchSource._extends({}, a, {
query: formatDocument(a.query)
});
}
function _ref5(a) {
return "query" !== a.operationName || "cache-only" !== a.context.requestPolicy;
}
function _ref6(a) {
return addMetadata(a, {
cacheOutcome: "miss"
});
}
function _ref8(a) {
return shouldSkip$1(a);
}
var cacheExchange = function(a) {
}, cacheExchange = function(a) {
function c(a) {

@@ -166,5 +248,5 @@ var b = e.get(a.key);

}
var g = a.forward, h = a.client, k = a.dispatchDebug, e = new Map;
var l, m, p, n, g = a.forward, h = a.client, k = a.dispatchDebug, e = new Map;
a = Object.create(null);
var l = _ref$1, m = afterMutation(e, a, h, k), p = afterQuery(e, a), n = function(a) {
l = _ref$1, m = afterMutation(e, a, h, k), p = afterQuery(e, a), n = function(a) {
var c = a.context.requestPolicy;

@@ -225,13 +307,64 @@ return "query" === a.operationName && "network-only" !== c && ("cache-only" === c || e.has(a.key));

};
};
function _ref2$1(a) {
return console.log("[Exchange debug]: Completed operation: ", a);
}
function _ref3$1(a) {
return console.log("[Exchange debug]: Incoming operation: ", a);
}
var dedupExchange = function(a) {
}, subscriptionExchange = function(a) {
function c(a) {
return "subscription" === (a = a.operationName) || !!d && ("query" === a || "mutation" === a);
}
var b = a.forwardSubscription, d = a.enableAllOperations;
return function(a) {
function d(a) {
return !l(a);
}
var h = a.client, f = a.forward, e = function(a) {
var c = b({
key: a.key.toString(36),
query: printer.print(a.query),
variables: a.variables,
context: fetchSource._extends({}, a.context)
});
return wonka.make((function(b) {
function e(b) {
return k(fetchSource.makeResult(a, b));
}
function d(b) {
return k(fetchSource.makeErrorResult(a, b));
}
function f() {
l || (l = !0, "subscription" === a.operationName && h.reexecuteOperation(fetchSource._extends({}, a, {
operationName: "teardown"
})), g());
}
var m, k = b.next, g = b.complete, l = !1;
Promise.resolve().then((function() {
l || (m = c.subscribe({
next: e,
error: d,
complete: f
}));
}));
return function() {
l = !0;
m && m.unsubscribe();
};
}));
}, l = c;
return function(a) {
var c, b = wonka.share(a);
a = wonka.mergeMap((function(a) {
var c = a.key, d = wonka.filter((function(a) {
return "teardown" === a.operationName && a.key === c;
}))(b);
return wonka.takeUntil(d)(e(a));
}))(wonka.filter(l)(b));
c = f(wonka.filter(d)(b));
return wonka.merge([ a, c ]);
};
};
}, debugExchange = function(a) {
var d = a.forward;
return "production" === process.env.NODE_ENV ? function c(a) {
return d(a);
} : function b(a) {
return wonka.tap(_ref2$1)(d(wonka.tap(_ref3$1)(a)));
};
}, dedupExchange = function(a) {
var c = a.forward, b = a.dispatchDebug, d = new Set, f = function(a) {

@@ -260,16 +393,6 @@ var c = a.key, e = a.operationName;

};
};
function _ref$2(a) {
return "query" === a.operationName || "mutation" === a.operationName;
}
function _ref2$2(a) {
return "query" !== a.operationName && "mutation" !== a.operationName;
}
var fetchExchange = function(a) {
}, fetchExchange = function(a) {
var c = a.forward, b = a.dispatchDebug;
return function(a) {
var d = wonka.share(a);
var g, d = wonka.share(a);
a = wonka.mergeMap((function(a) {

@@ -302,12 +425,6 @@ var c = a.key, e = wonka.filter((function(a) {

}))(wonka.filter(_ref$2)(d));
var g = c(wonka.filter(_ref2$2)(d));
g = c(wonka.filter(_ref2$2)(d));
return wonka.merge([ a, g ]);
};
};
function _ref$3() {
return !1;
}
var fallbackExchange = function(a) {
}, fallbackExchange = function(a) {
function c(a) {

@@ -346,4 +463,6 @@ if ("teardown" !== a.operationName && "production" !== process.env.NODE_ENV) {

};
}, defaultExchanges = [ dedupExchange, cacheExchange, fetchExchange ], Client = function(a) {
var b = this;
}, defaultExchanges = [ dedupExchange, cacheExchange, fetchExchange ], createClient = function(a) {
return new Client(a);
}, Client = function(a) {
var d, f, g, h, k, b = this;
this.activeOperations = Object.create(null);

@@ -391,5 +510,5 @@ this.queue = [];

}
var d = noop;
d = noop;
if ("production" !== process.env.NODE_ENV) {
var f = (d = wonka.makeSubject()).next, g = d.source;
f = (d = wonka.makeSubject()).next, g = d.source;
this.subscribeToDebugTarget = function c(a) {

@@ -407,5 +526,6 @@ return wonka.subscribe(a)(g);

this.maskTypename = !!a.maskTypename;
var h = (f = wonka.makeSubject()).next;
f = wonka.makeSubject();
h = f.next;
this.operations$ = f.source;
var k = !1;
k = !1;
this.dispatchOperation = function(a) {

@@ -446,9 +566,4 @@ if (k) {

function _ref3$2(a) {
a.data = maskTypename(a.data);
return a;
}
Client.prototype.executeRequestOperation = function(a) {
var b = this, d = a.key, f = a.operationName, g = wonka.filter((function(a) {
var h, b = this, d = a.key, f = a.operationName, g = wonka.filter((function(a) {
return a.operation.key === d;

@@ -462,3 +577,3 @@ }))(this.results$);

}
var h = wonka.filter((function(a) {
h = wonka.filter((function(a) {
return "teardown" === a.operationName && a.key === d;

@@ -471,15 +586,3 @@ }))(this.operations$);

}))(wonka.takeUntil(h)(g)));
return !1 !== a.context.suspense && this.suspense && "query" === f ? function(a) {
return function(c) {
var b = wonka.share(a), d = !1, f = !1;
wonka.onPush((function() {
return d = !0;
}))(wonka.takeWhile((function() {
return !f;
}))(b))(c);
if (!d) {
throw f = !0, c(0), wonka.toPromise(wonka.take(1)(b));
}
};
}(g) : g;
return !1 !== a.context.suspense && this.suspense && "query" === f ? toSuspenseSource(g) : g;
};

@@ -520,16 +623,7 @@

exports.createClient = function(a) {
return new Client(a);
};
exports.createClient = createClient;
exports.createRequest = createRequest;
exports.debugExchange = function(a) {
var d = a.forward;
return "production" === process.env.NODE_ENV ? function c(a) {
return d(a);
} : function b(a) {
return wonka.tap(_ref2$1)(d(wonka.tap(_ref3$1)(a)));
};
};
exports.debugExchange = debugExchange;

@@ -548,118 +642,5 @@ exports.dedupExchange = dedupExchange;

exports.ssrExchange = function(a) {
function c(a) {
return !k(a);
}
function b(a) {
return function(a, c) {
var b = c.error;
return {
operation: a,
data: c.data,
extensions: void 0,
error: b ? new fetchSource.CombinedError({
networkError: b.networkError ? Error(b.networkError) : void 0,
graphQLErrors: b.graphQLErrors && b.graphQLErrors.length ? b.graphQLErrors : void 0
}) : void 0
};
}(a, h[a.key]);
}
function d(a) {
return k(a);
}
function f(a) {
var b = a.operation;
shouldSkip(b) || (a = function(a) {
var c = a.error;
a = {
data: a.data,
error: void 0
};
c && (a.error = {
graphQLErrors: c.graphQLErrors.map(_ref),
networkError: c.networkError ? "" + c.networkError : void 0
});
return a;
}(a), h[b.key] = a);
}
function g(a) {
delete h[a.operation.key];
}
var h = {}, k = function(a) {
return !shouldSkip(a) && void 0 !== h[a.key];
}, e = function(e) {
var h = e.client, l = e.forward;
return function(e) {
var q = a && "boolean" == typeof a.isClient ? !!a.isClient : !h.suspense, k = wonka.share(e);
e = l(wonka.filter(c)(k));
k = wonka.map(b)(wonka.filter(d)(k));
q ? k = wonka.tap(g)(k) : e = wonka.tap(f)(e);
return wonka.merge([ e, k ]);
};
};
e.restoreData = function(a) {
return fetchSource._extends(h, a);
};
e.extractData = function() {
return fetchSource._extends({}, h);
};
a && a.initialState && e.restoreData(a.initialState);
return e;
};
exports.ssrExchange = ssrExchange;
exports.subscriptionExchange = function(a) {
function c(a) {
return "subscription" === (a = a.operationName) || !!d && ("query" === a || "mutation" === a);
}
var b = a.forwardSubscription, d = a.enableAllOperations;
return function(a) {
function d(a) {
return !l(a);
}
var h = a.client, f = a.forward, e = function(a) {
var c = b({
key: a.key.toString(36),
query: printer.print(a.query),
variables: a.variables,
context: fetchSource._extends({}, a.context)
});
return wonka.make((function(b) {
function e(b) {
return k(fetchSource.makeResult(a, b));
}
function d(b) {
return k(fetchSource.makeErrorResult(a, b));
}
function f() {
l || (l = !0, "subscription" === a.operationName && h.reexecuteOperation(fetchSource._extends({}, a, {
operationName: "teardown"
})), g());
}
var m, k = b.next, g = b.complete, l = !1;
Promise.resolve().then((function() {
l || (m = c.subscribe({
next: e,
error: d,
complete: f
}));
}));
return function() {
l = !0;
m && m.unsubscribe();
};
}));
}, l = c;
return function(a) {
var b = wonka.share(a);
a = wonka.mergeMap((function(a) {
var c = a.key, d = wonka.filter((function(a) {
return "teardown" === a.operationName && a.key === c;
}))(b);
return wonka.takeUntil(d)(e(a));
}))(wonka.filter(l)(b));
var c = f(wonka.filter(d)(b));
return wonka.merge([ a, c ]);
};
};
};
exports.subscriptionExchange = subscriptionExchange;
//# sourceMappingURL=urql-core.js.map

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

"use strict";var e=require("./40364ab3.min.js"),t=require("wonka");require("graphql/error/GraphQLError");var r=require("graphql/language/parser"),n=require("graphql/language/printer"),o=require("graphql/language/kinds"),i=require("graphql/language/visitor"),a=function(e,t){e|=0;for(var r=0,n=0|t.length;r<n;r++)e=(e<<5)+e+t.charCodeAt(r);return e},u=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/[\s,]+/g," ").trim())},c=Object.create(null),s=function(t,o){if("string"==typeof t){var i=u(t);t=void 0!==c[i]?c[i]:r.parse(t)}else void 0!==t.__key?i=t.__key:(i=u(n.print(t)),t=void 0!==c[i]?c[i]:t);return c[i]=t,t.__key=i,{key:o?a(i,e.stringifyVariables(o))>>>0:i,query:t,variables:o||{}}},p=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,r)})})},f=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){f(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):f(e[r],t);return t};function l(e,t,r){return r.indexOf(e)===t}var h=function(e){return f(e).filter(l)};function d(e){return e.kind===o.Kind.FIELD&&"__typename"===e.name.value}var m=function(e){if(e.selectionSet&&!e.selectionSet.selections.some(d))return e.selectionSet.selections.push({kind:o.Kind.FIELD,name:{kind:o.Kind.NAME,value:"__typename"}}),e},y=function(e){return i.visit(e,{Field:m,InlineFragment:m})},v=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(v):n&&"object"==typeof n&&"__typename"in n?v(n):n,t}),{}):e};function x(e){return e.toPromise=function(){return t.toPromise(t.take(1)(e))},e}var k=function(){},g=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function q(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var b=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function O(t){return e._extends({},t,{query:y(t.query)})}function E(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function w(e){return p(e,{cacheOutcome:"miss"})}function _(e){return b(e)}var N=function(r){function n(t){var r=s.get(t.key);return r=e._extends({},r,{operation:p(t,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===t.context.requestPolicy&&(r.stale=!0,S(c,t)),r}function o(e){return!b(e)&&d(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?l(e):e.operation&&"query"===e.operation.operationName&&h(e)}function a(e){return!b(e)&&!d(e)}var u=r.forward,c=r.client,s=new Map;r=Object.create(null);var f=O,l=R(s,r,c),h=P(s,r),d=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(e){var r=t.share(e);return e=t.map(n)(t.filter(o)(r)),r=t.tap(i)(u(t.filter(E)(t.map(w)(t.merge([t.map(f)(t.filter(a)(r)),t.filter(_)(r)]))))),t.merge([e,r])}},S=function(t,r){return t.reexecuteOperation(e._extends({},r,{context:e._extends({},r.context,{requestPolicy:"network-only"})}))},R=function(e,t,r,n){function o(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),S(r,n)}}return function(e){function r(e){n.add(e)}var n=new Set,i=e.operation.context.additionalTypenames;h(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),n.forEach(o)}},P=function(e,t){return function(r){var n=r.operation,o=r.data,i=n.context.additionalTypenames;null!=o&&(e.set(n.key,{operation:n,data:o,error:r.error}),h(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},M=function(e){var r=e.forward,n=new Set,o=function(e){var t=e.key;return"teardown"===(e=e.operationName)?(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=t.filter(o)(e),t.tap(i)(r(e))}};function Q(e){return"query"===e.operationName||"mutation"===e.operationName}function j(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var C=function(r){var n=r.forward;return function(r){var o=t.share(r);r=t.mergeMap((function(r){var n=r.key,i=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(o),a=e.makeFetchBody(r),u=e.makeFetchURL(r,a);return a=e.makeFetchOptions(r,a),t.onPush((function(e){}))(t.takeUntil(i)(e.makeFetchSource(r,u,a)))}))(t.filter(Q)(o));var i=n(t.filter(j)(o));return t.merge([r,i])}};function L(){return!1}var D=function(e){function r(e){}return function(e){return t.filter(L)(t.tap(r)(e))}},F=D(),A=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)}},T=[M,N,C],$=function(r){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(t){return e._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},t,{requestPolicy:(t||{}).requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return{key:t.key,query:t.query,variables:t.variables,operationName:e,context:n.createOperationContext(r)}},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),n.dispatchOperation())},this.executeQuery=function(e,r){e=n.createRequestOperation("query",e,r);var o=n.executeRequestOperation(e);return(e=e.context.pollInterval)?t.switchMap((function(){return o}))(t.merge([t.fromValue(0),t.interval(e)])):o},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=k;this.url=r.url,this.fetchOptions=r.fetchOptions,this.fetch=r.fetch,this.suspense=!!r.suspense,this.requestPolicy=r.requestPolicy||"cache-first",this.preferGetMethod=!!r.preferGetMethod,this.maskTypename=!!r.maskTypename;var i=t.makeSubject(),a=i.next;this.operations$=i.source;var u=!1;this.dispatchOperation=function(e){if(u)e&&a(e);else{for(u=!0,e&&a(e);e=n.queue.shift();)a(e);u=!1}},r=A(void 0!==r.exchanges?r.exchanges:T),this.results$=t.share(r({client:this,dispatchDebug:o,forward:D()})(this.operations$)),t.publish(this.results$)};function G(e){return e.data=v(e.data),e}$.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},$.prototype.onOperationEnd=function(t){var r=t.key,n=this.activeOperations[r]||0;0>=(this.activeOperations[r]=0>=n?0:n-1)&&this.dispatchOperation(e._extends({},t,{operationName:"teardown"}))},$.prototype.executeRequestOperation=function(e){var r=this,n=e.key,o=e.operationName,i=t.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=t.map(G)(i)),"mutation"===o)return t.take(1)(t.onStart((function(){return r.dispatchOperation(e)}))(i));var a=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=t.onEnd((function(){r.onOperationEnd(e)}))(t.onStart((function(){r.onOperationStart(e)}))(t.takeUntil(a)(i))),!1!==e.context.suspense&&this.suspense&&"query"===o?function(e){return function(r){var n=t.share(e),o=!1,i=!1;if(t.onPush((function(){return o=!0}))(t.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),t.toPromise(t.take(1)(n))}}(i):i},$.prototype.query=function(t,r,n){return n&&"boolean"==typeof n.suspense||(n=e._extends({},n,{suspense:!1})),x(this.executeQuery(s(t,r),n))},$.prototype.readQuery=function(e,r,n){var o=null;return t.subscribe((function(e){o=e}))(this.executeQuery(s(e,r),n)).unsubscribe(),o},$.prototype.mutation=function(e,t,r){return x(this.executeMutation(s(e,t),r))},exports.CombinedError=e.CombinedError,exports.makeErrorResult=e.makeErrorResult,exports.makeResult=e.makeResult,exports.stringifyVariables=e.stringifyVariables,exports.Client=$,exports.cacheExchange=N,exports.composeExchanges=A,exports.createClient=function(e){return new $(e)},exports.createRequest=s,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=M,exports.defaultExchanges=T,exports.fallbackExchangeIO=F,exports.fetchExchange=C,exports.formatDocument=y,exports.maskTypename=v,exports.ssrExchange=function(r){function n(e){return!s(e)}function o(t){return function(t,r){var n=r.error;return{operation:t,data:r.data,extensions:void 0,error:n?new e.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(t,c[t.key])}function i(e){return s(e)}function a(e){var t=e.operation;g(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(q),networkError:t.networkError?""+t.networkError:void 0}),e}(e),c[t.key]=e)}function u(e){delete c[e.operation.key]}var c={},s=function(e){return!g(e)&&void 0!==c[e.key]},p=function(e){var c=e.client,s=e.forward;return function(e){var p=r&&"boolean"==typeof r.isClient?!!r.isClient:!c.suspense,f=t.share(e);return e=s(t.filter(n)(f)),f=t.map(o)(t.filter(i)(f)),p?f=t.tap(u)(f):e=t.tap(a)(e),t.merge([e,f])}};return p.restoreData=function(t){return e._extends(c,t)},p.extractData=function(){return e._extends({},c)},r&&r.initialState&&p.restoreData(r.initialState),p},exports.subscriptionExchange=function(r){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=r.forwardSubscription,a=r.enableAllOperations;return function(r){function a(e){return!p(e)}var u=r.client,c=r.forward,s=function(r){var o=i({key:r.key.toString(36),query:n.print(r.query),variables:r.variables,context:e._extends({},r.context)});return t.make((function(t){function n(t){return s(e.makeResult(r,t))}function i(t){return s(e.makeErrorResult(r,t))}function a(){f||(f=!0,"subscription"===r.operationName&&u.reexecuteOperation(e._extends({},r,{operationName:"teardown"})),p())}var c,s=t.next,p=t.complete,f=!1;return Promise.resolve().then((function(){f||(c=o.subscribe({next:n,error:i,complete:a}))})),function(){f=!0,c&&c.unsubscribe()}}))},p=o;return function(e){var r=t.share(e);e=t.mergeMap((function(e){var n=e.key,o=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return t.takeUntil(o)(s(e))}))(t.filter(p)(r));var n=c(t.filter(a)(r));return t.merge([e,n])}}};
"use strict";var e=require("./6fe6883a.min.js"),t=require("wonka"),r=require("graphql/language/parser"),n=require("graphql/language/printer"),o=require("graphql/language/kinds"),i=require("graphql/language/visitor"),a=function(e,t){e|=0;for(var r=0,n=0|t.length;r<n;r++)e=(e<<5)+e+t.charCodeAt(r);return e},u=function(e){return function(e){return a(5381,e)>>>0}(e.replace(/[\s,]+/g," ").trim())},c=Object.create(null),s=function(t,o){if("string"==typeof t){var i=u(t);t=void 0!==c[i]?c[i]:r.parse(t)}else void 0!==t.__key?i=t.__key:(i=u(n.print(t)),t=void 0!==c[i]?c[i]:t);return c[i]=t,t.__key=i,{key:o?a(i,e.stringifyVariables(o))>>>0:i,query:t,variables:o||{}}},p=function(t,r){return e._extends({},t,{context:e._extends({},t.context,{meta:e._extends({},t.context.meta,r)})})},f=function(e,t){if(void 0===t&&(t=[]),Array.isArray(e))e.forEach((function(e){f(e,t)}));else if("object"==typeof e&&null!==e)for(var r in e)"__typename"===r&&"string"==typeof e[r]?t.push(e[r]):f(e[r],t);return t};function l(e,t,r){return r.indexOf(e)===t}var h=function(e){return f(e).filter(l)};function d(e){return e.kind===o.Kind.FIELD&&"__typename"===e.name.value}var m=function(e){if(e.selectionSet&&!e.selectionSet.selections.some(d))return e.selectionSet.selections.push({kind:o.Kind.FIELD,name:{kind:o.Kind.NAME,value:"__typename"}}),e},y=function(e){return i.visit(e,{Field:m,InlineFragment:m})},v=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(v):n&&"object"==typeof n&&"__typename"in n?v(n):n,t}),{}):e};function x(e){return e.toPromise=function(){return t.toPromise(t.take(1)(e))},e}var k=function(){},g=function(e){return"subscription"!==(e=e.operationName)&&"query"!==e};function q(e){return e.path||e.extensions?{message:e.message,path:e.path,extensions:e.extensions}:e.message}var b=function(e){return"mutation"!==(e=e.operationName)&&"query"!==e};function O(t){return e._extends({},t,{query:y(t.query)})}function E(e){return"query"!==e.operationName||"cache-only"!==e.context.requestPolicy}function w(e){return p(e,{cacheOutcome:"miss"})}function _(e){return b(e)}var N=function(r){function n(t){var r=s.get(t.key);return r=e._extends({},r,{operation:p(t,{cacheOutcome:r?"hit":"miss"})}),"cache-and-network"===t.context.requestPolicy&&(r.stale=!0,S(c,t)),r}function o(e){return!b(e)&&d(e)}function i(e){e.operation&&"mutation"===e.operation.operationName?l(e):e.operation&&"query"===e.operation.operationName&&h(e)}function a(e){return!b(e)&&!d(e)}var u=r.forward,c=r.client,s=new Map;r=Object.create(null);var f=O,l=R(s,r,c),h=P(s,r),d=function(e){var t=e.context.requestPolicy;return"query"===e.operationName&&"network-only"!==t&&("cache-only"===t||s.has(e.key))};return function(e){var r=t.share(e);return e=t.map(n)(t.filter(o)(r)),r=t.tap(i)(u(t.filter(E)(t.map(w)(t.merge([t.map(f)(t.filter(a)(r)),t.filter(_)(r)]))))),t.merge([e,r])}},S=function(t,r){return t.reexecuteOperation(e._extends({},r,{context:e._extends({},r.context,{requestPolicy:"network-only"})}))},R=function(e,t,r,n){function o(t){if(e.has(t)){var n=e.get(t).operation;e.delete(t),S(r,n)}}return function(e){function r(e){n.add(e)}var n=new Set,i=e.operation.context.additionalTypenames;h(e.data).concat(i||[]).forEach((function(e){(e=t[e]||(t[e]=new Set)).forEach(r),e.clear()})),n.forEach(o)}},P=function(e,t){return function(r){var n=r.operation,o=r.data,i=n.context.additionalTypenames;null!=o&&(e.set(n.key,{operation:n,data:o,error:r.error}),h(r.data).concat(i||[]).forEach((function(e){(t[e]||(t[e]=new Set)).add(n.key)})))}},M=function(e){var r=e.forward,n=new Set,o=function(e){var t=e.key;return"teardown"===(e=e.operationName)?(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=t.filter(o)(e),t.tap(i)(r(e))}};function j(e){return"query"===e.operationName||"mutation"===e.operationName}function C(e){return"query"!==e.operationName&&"mutation"!==e.operationName}var Q=function(r){var n=r.forward;return function(r){var o=t.share(r);r=t.mergeMap((function(r){var n=r.key,i=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(o),a=e.makeFetchBody(r),u=e.makeFetchURL(r,a);return a=e.makeFetchOptions(r,a),t.onPush((function(e){}))(t.takeUntil(i)(e.makeFetchSource(r,u,a)))}))(t.filter(j)(o));var i=n(t.filter(C)(o));return t.merge([r,i])}};function L(){return!1}var D=function(e){function r(e){}return function(e){return t.filter(L)(t.tap(r)(e))}},F=D(),A=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)}},T=[M,N,Q],$=function(r){var n=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(t){return e._extends({},{url:n.url,fetchOptions:n.fetchOptions,fetch:n.fetch,preferGetMethod:n.preferGetMethod},t,{requestPolicy:(t||{}).requestPolicy||n.requestPolicy})},this.createRequestOperation=function(e,t,r){return{key:t.key,query:t.query,variables:t.variables,operationName:e,context:n.createOperationContext(r)}},this.reexecuteOperation=function(e){0<(n.activeOperations[e.key]||0)&&(n.queue.push(e),n.dispatchOperation())},this.executeQuery=function(e,r){e=n.createRequestOperation("query",e,r);var o=n.executeRequestOperation(e);return(e=e.context.pollInterval)?t.switchMap((function(){return o}))(t.merge([t.fromValue(0),t.interval(e)])):o},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=k;this.url=r.url,this.fetchOptions=r.fetchOptions,this.fetch=r.fetch,this.suspense=!!r.suspense,this.requestPolicy=r.requestPolicy||"cache-first",this.preferGetMethod=!!r.preferGetMethod,this.maskTypename=!!r.maskTypename;var i=t.makeSubject(),a=i.next;this.operations$=i.source;var u=!1;this.dispatchOperation=function(e){if(u)e&&a(e);else{for(u=!0,e&&a(e);e=n.queue.shift();)a(e);u=!1}},r=A(void 0!==r.exchanges?r.exchanges:T),this.results$=t.share(r({client:this,dispatchDebug:o,forward:D()})(this.operations$)),t.publish(this.results$)};function I(e){return e.data=v(e.data),e}$.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)},$.prototype.onOperationEnd=function(t){var r=t.key,n=this.activeOperations[r]||0;0>=(this.activeOperations[r]=0>=n?0:n-1)&&this.dispatchOperation(e._extends({},t,{operationName:"teardown"}))},$.prototype.executeRequestOperation=function(e){var r=this,n=e.key,o=e.operationName,i=t.filter((function(e){return e.operation.key===n}))(this.results$);if(this.maskTypename&&(i=t.map(I)(i)),"mutation"===o)return t.take(1)(t.onStart((function(){return r.dispatchOperation(e)}))(i));var a=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(this.operations$);return i=t.onEnd((function(){r.onOperationEnd(e)}))(t.onStart((function(){r.onOperationStart(e)}))(t.takeUntil(a)(i))),!1!==e.context.suspense&&this.suspense&&"query"===o?function(e){return function(r){var n=t.share(e),o=!1,i=!1;if(t.onPush((function(){return o=!0}))(t.takeWhile((function(){return!i}))(n))(r),!o)throw i=!0,r(0),t.toPromise(t.take(1)(n))}}(i):i},$.prototype.query=function(t,r,n){return n&&"boolean"==typeof n.suspense||(n=e._extends({},n,{suspense:!1})),x(this.executeQuery(s(t,r),n))},$.prototype.readQuery=function(e,r,n){var o=null;return t.subscribe((function(e){o=e}))(this.executeQuery(s(e,r),n)).unsubscribe(),o},$.prototype.mutation=function(e,t,r){return x(this.executeMutation(s(e,t),r))},exports.CombinedError=e.CombinedError,exports.makeErrorResult=e.makeErrorResult,exports.makeResult=e.makeResult,exports.stringifyVariables=e.stringifyVariables,exports.Client=$,exports.cacheExchange=N,exports.composeExchanges=A,exports.createClient=function(e){return new $(e)},exports.createRequest=s,exports.debugExchange=function(e){var t=e.forward;return function(e){return t(e)}},exports.dedupExchange=M,exports.defaultExchanges=T,exports.fallbackExchangeIO=F,exports.fetchExchange=Q,exports.formatDocument=y,exports.maskTypename=v,exports.ssrExchange=function(r){function n(e){return!s(e)}function o(t){return function(t,r){var n=r.error;return{operation:t,data:r.data,extensions:void 0,error:n?new e.CombinedError({networkError:n.networkError?Error(n.networkError):void 0,graphQLErrors:n.graphQLErrors&&n.graphQLErrors.length?n.graphQLErrors:void 0}):void 0}}(t,c[t.key])}function i(e){return s(e)}function a(e){var t=e.operation;g(t)||(e=function(e){var t=e.error;return e={data:e.data,error:void 0},t&&(e.error={graphQLErrors:t.graphQLErrors.map(q),networkError:t.networkError?""+t.networkError:void 0}),e}(e),c[t.key]=e)}function u(e){delete c[e.operation.key]}var c={},s=function(e){return!g(e)&&void 0!==c[e.key]},p=function(e){var c=e.client,s=e.forward;return function(e){var p=r&&"boolean"==typeof r.isClient?!!r.isClient:!c.suspense,f=t.share(e);return e=s(t.filter(n)(f)),f=t.map(o)(t.filter(i)(f)),p?f=t.tap(u)(f):e=t.tap(a)(e),t.merge([e,f])}};return p.restoreData=function(t){return e._extends(c,t)},p.extractData=function(){return e._extends({},c)},r&&r.initialState&&p.restoreData(r.initialState),p},exports.subscriptionExchange=function(r){function o(e){return"subscription"===(e=e.operationName)||!!a&&("query"===e||"mutation"===e)}var i=r.forwardSubscription,a=r.enableAllOperations;return function(r){function a(e){return!p(e)}var u=r.client,c=r.forward,s=function(r){var o=i({key:r.key.toString(36),query:n.print(r.query),variables:r.variables,context:e._extends({},r.context)});return t.make((function(t){function n(t){return s(e.makeResult(r,t))}function i(t){return s(e.makeErrorResult(r,t))}function a(){f||(f=!0,"subscription"===r.operationName&&u.reexecuteOperation(e._extends({},r,{operationName:"teardown"})),p())}var c,s=t.next,p=t.complete,f=!1;return Promise.resolve().then((function(){f||(c=o.subscribe({next:n,error:i,complete:a}))})),function(){f=!0,c&&c.unsubscribe()}}))},p=o;return function(e){var r=t.share(e);e=t.mergeMap((function(e){var n=e.key,o=t.filter((function(e){return"teardown"===e.operationName&&e.key===n}))(r);return t.takeUntil(o)(s(e))}))(t.filter(p)(r));var n=c(t.filter(a)(r));return t.merge([e,n])}}};
//# sourceMappingURL=urql-core.min.js.map
{
"name": "@urql/core",
"version": "1.11.4",
"version": "1.11.5",
"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

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