@apollo/client 3.8.0-beta.0 → 3.8.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +122 -131
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -2
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -2
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -2
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.d.ts +1 -2
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +5 -5
- package/core/QueryManager.d.ts +1 -2
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +19 -84
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +19 -84
- package/core/index.d.ts +1 -2
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -2
- package/core/index.js.map +1 -1
- package/dev/dev.cjs +54 -54
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +54 -54
- package/invariantErrorCodes.js +53 -53
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/remove-typename/remove-typename.cjs +5 -6
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +5 -6
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js +5 -6
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/package.json +11 -11
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.d.ts +2 -1
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +3 -12
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +5 -14
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +5 -14
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +9 -9
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +9 -9
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useBackgroundQuery.js +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/hooks/useSuspenseCache.js +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.d.ts.map +1 -0
- package/{core → utilities/graphql}/DocumentTransform.js +4 -3
- package/utilities/graphql/DocumentTransform.js.map +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/utilities.cjs +86 -20
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +86 -20
- package/version.js +1 -1
- package/core/DocumentTransform.d.ts.map +0 -1
- package/core/DocumentTransform.js.map +0 -1
- /package/{core → utilities/graphql}/DocumentTransform.d.ts +0 -0
package/apollo-client.cjs
CHANGED
|
@@ -9,9 +9,9 @@ var equal = require('@wry/equality');
|
|
|
9
9
|
var tsInvariant = require('ts-invariant');
|
|
10
10
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
11
|
require('symbol-observable');
|
|
12
|
-
var trie = require('@wry/trie');
|
|
13
12
|
var optimism = require('optimism');
|
|
14
13
|
var context = require('@wry/context');
|
|
14
|
+
var trie = require('@wry/trie');
|
|
15
15
|
var graphqlTag = require('graphql-tag');
|
|
16
16
|
var React = require('react');
|
|
17
17
|
|
|
@@ -33,7 +33,7 @@ var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
35
|
|
|
36
|
-
var version = '3.8.0-beta.
|
|
36
|
+
var version = '3.8.0-beta.2';
|
|
37
37
|
|
|
38
38
|
function maybe(thunk) {
|
|
39
39
|
try {
|
|
@@ -179,6 +179,20 @@ function getInclusionDirectives(directives) {
|
|
|
179
179
|
return result;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
var canUseWeakMap = typeof WeakMap === 'function' &&
|
|
183
|
+
maybe(function () { return navigator.product; }) !== 'ReactNative';
|
|
184
|
+
var canUseWeakSet = typeof WeakSet === 'function';
|
|
185
|
+
var canUseSymbol = typeof Symbol === 'function' &&
|
|
186
|
+
typeof Symbol.for === 'function';
|
|
187
|
+
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
188
|
+
var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function";
|
|
189
|
+
var usingJSDOM = maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
190
|
+
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
191
|
+
|
|
192
|
+
function isNonNullObject(obj) {
|
|
193
|
+
return obj !== null && typeof obj === 'object';
|
|
194
|
+
}
|
|
195
|
+
|
|
182
196
|
function getFragmentQueryDocument(document, fragmentName) {
|
|
183
197
|
var actualFragmentName = fragmentName;
|
|
184
198
|
var fragments = [];
|
|
@@ -244,10 +258,6 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
244
258
|
}
|
|
245
259
|
}
|
|
246
260
|
|
|
247
|
-
function isNonNullObject(obj) {
|
|
248
|
-
return obj !== null && typeof obj === 'object';
|
|
249
|
-
}
|
|
250
|
-
|
|
251
261
|
function makeReference(id) {
|
|
252
262
|
return { __ref: String(id) };
|
|
253
263
|
}
|
|
@@ -540,6 +550,70 @@ function getDefaultValues(definition) {
|
|
|
540
550
|
return defaultValues;
|
|
541
551
|
}
|
|
542
552
|
|
|
553
|
+
function identity(document) {
|
|
554
|
+
return document;
|
|
555
|
+
}
|
|
556
|
+
var DocumentTransform = (function () {
|
|
557
|
+
function DocumentTransform(transform, options) {
|
|
558
|
+
if (options === void 0) { options = Object.create(null); }
|
|
559
|
+
this.resultCache = canUseWeakSet
|
|
560
|
+
? new WeakSet()
|
|
561
|
+
: new Set();
|
|
562
|
+
this.transform = transform;
|
|
563
|
+
if (options.getCacheKey) {
|
|
564
|
+
this.getCacheKey = options.getCacheKey;
|
|
565
|
+
}
|
|
566
|
+
if (options.cache !== false) {
|
|
567
|
+
this.stableCacheKeys = new trie.Trie(canUseWeakMap, function (key) { return ({ key: key }); });
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
DocumentTransform.prototype.getCacheKey = function (document) {
|
|
571
|
+
return [document];
|
|
572
|
+
};
|
|
573
|
+
DocumentTransform.identity = function () {
|
|
574
|
+
return new DocumentTransform(identity, { cache: false });
|
|
575
|
+
};
|
|
576
|
+
DocumentTransform.split = function (predicate, left, right) {
|
|
577
|
+
if (right === void 0) { right = DocumentTransform.identity(); }
|
|
578
|
+
return new DocumentTransform(function (document) {
|
|
579
|
+
var documentTransform = predicate(document) ? left : right;
|
|
580
|
+
return documentTransform.transformDocument(document);
|
|
581
|
+
}, { cache: false });
|
|
582
|
+
};
|
|
583
|
+
DocumentTransform.prototype.transformDocument = function (document) {
|
|
584
|
+
if (this.resultCache.has(document)) {
|
|
585
|
+
return document;
|
|
586
|
+
}
|
|
587
|
+
var cacheEntry = this.getStableCacheEntry(document);
|
|
588
|
+
if (cacheEntry && cacheEntry.value) {
|
|
589
|
+
return cacheEntry.value;
|
|
590
|
+
}
|
|
591
|
+
checkDocument(document);
|
|
592
|
+
var transformedDocument = this.transform(document);
|
|
593
|
+
this.resultCache.add(transformedDocument);
|
|
594
|
+
if (cacheEntry) {
|
|
595
|
+
cacheEntry.value = transformedDocument;
|
|
596
|
+
}
|
|
597
|
+
return transformedDocument;
|
|
598
|
+
};
|
|
599
|
+
DocumentTransform.prototype.concat = function (otherTransform) {
|
|
600
|
+
var _this = this;
|
|
601
|
+
return new DocumentTransform(function (document) {
|
|
602
|
+
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
603
|
+
}, { cache: false });
|
|
604
|
+
};
|
|
605
|
+
DocumentTransform.prototype.getStableCacheEntry = function (document) {
|
|
606
|
+
if (!this.stableCacheKeys)
|
|
607
|
+
return;
|
|
608
|
+
var cacheKeys = this.getCacheKey(document);
|
|
609
|
+
if (cacheKeys) {
|
|
610
|
+
invariant(Array.isArray(cacheKeys), 65);
|
|
611
|
+
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
return DocumentTransform;
|
|
615
|
+
}());
|
|
616
|
+
|
|
543
617
|
var isArray = Array.isArray;
|
|
544
618
|
function isNonEmptyArray(value) {
|
|
545
619
|
return Array.isArray(value) && value.length > 0;
|
|
@@ -1040,16 +1114,6 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1040
1114
|
});
|
|
1041
1115
|
}
|
|
1042
1116
|
|
|
1043
|
-
var canUseWeakMap = typeof WeakMap === 'function' &&
|
|
1044
|
-
maybe(function () { return navigator.product; }) !== 'ReactNative';
|
|
1045
|
-
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1046
|
-
var canUseSymbol = typeof Symbol === 'function' &&
|
|
1047
|
-
typeof Symbol.for === 'function';
|
|
1048
|
-
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
1049
|
-
var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function";
|
|
1050
|
-
var usingJSDOM = maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
1051
|
-
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
1052
|
-
|
|
1053
1117
|
function fixObservableSubclass(subclass) {
|
|
1054
1118
|
function set(key) {
|
|
1055
1119
|
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
|
@@ -1302,7 +1366,7 @@ function toPromise(observable) {
|
|
|
1302
1366
|
observable.subscribe({
|
|
1303
1367
|
next: function (data) {
|
|
1304
1368
|
if (completed) {
|
|
1305
|
-
__DEV__ && invariant.warn(
|
|
1369
|
+
__DEV__ && invariant.warn(41);
|
|
1306
1370
|
}
|
|
1307
1371
|
else {
|
|
1308
1372
|
completed = true;
|
|
@@ -1345,7 +1409,7 @@ function validateOperation(operation) {
|
|
|
1345
1409
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1346
1410
|
var key = _a[_i];
|
|
1347
1411
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1348
|
-
throw newInvariantError(
|
|
1412
|
+
throw newInvariantError(42, key);
|
|
1349
1413
|
}
|
|
1350
1414
|
}
|
|
1351
1415
|
return operation;
|
|
@@ -1451,7 +1515,7 @@ var ApolloLink = (function () {
|
|
|
1451
1515
|
ApolloLink.concat = function (first, second) {
|
|
1452
1516
|
var firstLink = toLink(first);
|
|
1453
1517
|
if (isTerminating(firstLink)) {
|
|
1454
|
-
__DEV__ && invariant.warn(
|
|
1518
|
+
__DEV__ && invariant.warn(34, firstLink);
|
|
1455
1519
|
return firstLink;
|
|
1456
1520
|
}
|
|
1457
1521
|
var nextLink = toLink(second);
|
|
@@ -1475,7 +1539,7 @@ var ApolloLink = (function () {
|
|
|
1475
1539
|
return ApolloLink.concat(this, next);
|
|
1476
1540
|
};
|
|
1477
1541
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1478
|
-
throw newInvariantError(
|
|
1542
|
+
throw newInvariantError(35);
|
|
1479
1543
|
};
|
|
1480
1544
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1481
1545
|
if (observer && observer.error) {
|
|
@@ -1850,7 +1914,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1850
1914
|
serialized = JSON.stringify(p);
|
|
1851
1915
|
}
|
|
1852
1916
|
catch (e) {
|
|
1853
|
-
var parseError = newInvariantError(
|
|
1917
|
+
var parseError = newInvariantError(38, label, e.message);
|
|
1854
1918
|
parseError.parseError = e;
|
|
1855
1919
|
throw parseError;
|
|
1856
1920
|
}
|
|
@@ -1933,7 +1997,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
1933
1997
|
|
|
1934
1998
|
var checkFetcher = function (fetcher) {
|
|
1935
1999
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1936
|
-
throw newInvariantError(
|
|
2000
|
+
throw newInvariantError(36);
|
|
1937
2001
|
}
|
|
1938
2002
|
};
|
|
1939
2003
|
|
|
@@ -2068,7 +2132,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2068
2132
|
options.headers = options.headers || {};
|
|
2069
2133
|
var acceptHeader = "multipart/mixed;";
|
|
2070
2134
|
if (isSubscription && hasDefer) {
|
|
2071
|
-
__DEV__ && invariant.warn(
|
|
2135
|
+
__DEV__ && invariant.warn(37);
|
|
2072
2136
|
}
|
|
2073
2137
|
if (isSubscription) {
|
|
2074
2138
|
acceptHeader += 'boundary=graphql;subscriptionSpec=1.0,application/json';
|
|
@@ -4686,7 +4750,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4686
4750
|
var vars = queryDef.variableDefinitions;
|
|
4687
4751
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4688
4752
|
__DEV__ && invariant.warn(
|
|
4689
|
-
|
|
4753
|
+
19,
|
|
4690
4754
|
variables,
|
|
4691
4755
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
4692
4756
|
);
|
|
@@ -4777,7 +4841,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4777
4841
|
options.onError(err);
|
|
4778
4842
|
return;
|
|
4779
4843
|
}
|
|
4780
|
-
__DEV__ && invariant.error(
|
|
4844
|
+
__DEV__ && invariant.error(20, err);
|
|
4781
4845
|
},
|
|
4782
4846
|
});
|
|
4783
4847
|
this.subscriptions.add(subscription);
|
|
@@ -4875,7 +4939,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4875
4939
|
pollingInfo.interval === pollInterval) {
|
|
4876
4940
|
return;
|
|
4877
4941
|
}
|
|
4878
|
-
invariant(pollInterval,
|
|
4942
|
+
invariant(pollInterval, 21);
|
|
4879
4943
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4880
4944
|
info.interval = pollInterval;
|
|
4881
4945
|
var maybeFetch = function () {
|
|
@@ -5020,78 +5084,14 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5020
5084
|
return obsQuery.reobserve();
|
|
5021
5085
|
}
|
|
5022
5086
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5023
|
-
__DEV__ && invariant.error(
|
|
5087
|
+
__DEV__ && invariant.error(22, error.message, error.stack);
|
|
5024
5088
|
}
|
|
5025
5089
|
function logMissingFieldErrors(missing) {
|
|
5026
5090
|
if (__DEV__ && missing) {
|
|
5027
|
-
__DEV__ && invariant.debug(
|
|
5091
|
+
__DEV__ && invariant.debug(23, missing);
|
|
5028
5092
|
}
|
|
5029
5093
|
}
|
|
5030
5094
|
|
|
5031
|
-
function identity(document) {
|
|
5032
|
-
return document;
|
|
5033
|
-
}
|
|
5034
|
-
var DocumentTransform = (function () {
|
|
5035
|
-
function DocumentTransform(transform, options) {
|
|
5036
|
-
if (options === void 0) { options = Object.create(null); }
|
|
5037
|
-
this.resultCache = canUseWeakSet
|
|
5038
|
-
? new WeakSet()
|
|
5039
|
-
: new Set();
|
|
5040
|
-
this.transform = transform;
|
|
5041
|
-
if (options.getCacheKey) {
|
|
5042
|
-
this.getCacheKey = options.getCacheKey;
|
|
5043
|
-
}
|
|
5044
|
-
if (options.cache !== false) {
|
|
5045
|
-
this.stableCacheKeys = new trie.Trie(canUseWeakMap, function (key) { return ({ key: key }); });
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
DocumentTransform.prototype.getCacheKey = function (document) {
|
|
5049
|
-
return [document];
|
|
5050
|
-
};
|
|
5051
|
-
DocumentTransform.identity = function () {
|
|
5052
|
-
return new DocumentTransform(identity, { cache: false });
|
|
5053
|
-
};
|
|
5054
|
-
DocumentTransform.split = function (predicate, left, right) {
|
|
5055
|
-
if (right === void 0) { right = DocumentTransform.identity(); }
|
|
5056
|
-
return new DocumentTransform(function (document) {
|
|
5057
|
-
var documentTransform = predicate(document) ? left : right;
|
|
5058
|
-
return documentTransform.transformDocument(document);
|
|
5059
|
-
}, { cache: false });
|
|
5060
|
-
};
|
|
5061
|
-
DocumentTransform.prototype.transformDocument = function (document) {
|
|
5062
|
-
if (this.resultCache.has(document)) {
|
|
5063
|
-
return document;
|
|
5064
|
-
}
|
|
5065
|
-
var cacheEntry = this.getStableCacheEntry(document);
|
|
5066
|
-
if (cacheEntry && cacheEntry.value) {
|
|
5067
|
-
return cacheEntry.value;
|
|
5068
|
-
}
|
|
5069
|
-
checkDocument(document);
|
|
5070
|
-
var transformedDocument = this.transform(document);
|
|
5071
|
-
this.resultCache.add(transformedDocument);
|
|
5072
|
-
if (cacheEntry) {
|
|
5073
|
-
cacheEntry.value = transformedDocument;
|
|
5074
|
-
}
|
|
5075
|
-
return transformedDocument;
|
|
5076
|
-
};
|
|
5077
|
-
DocumentTransform.prototype.concat = function (otherTransform) {
|
|
5078
|
-
var _this = this;
|
|
5079
|
-
return new DocumentTransform(function (document) {
|
|
5080
|
-
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
5081
|
-
}, { cache: false });
|
|
5082
|
-
};
|
|
5083
|
-
DocumentTransform.prototype.getStableCacheEntry = function (document) {
|
|
5084
|
-
if (!this.stableCacheKeys)
|
|
5085
|
-
return;
|
|
5086
|
-
var cacheKeys = this.getCacheKey(document);
|
|
5087
|
-
if (cacheKeys) {
|
|
5088
|
-
invariant(Array.isArray(cacheKeys), 17);
|
|
5089
|
-
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
5090
|
-
}
|
|
5091
|
-
};
|
|
5092
|
-
return DocumentTransform;
|
|
5093
|
-
}());
|
|
5094
|
-
|
|
5095
5095
|
var LocalState = (function () {
|
|
5096
5096
|
function LocalState(_a) {
|
|
5097
5097
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
@@ -5267,7 +5267,7 @@ var LocalState = (function () {
|
|
|
5267
5267
|
}
|
|
5268
5268
|
else {
|
|
5269
5269
|
fragment = fragmentMap[selection.name.value];
|
|
5270
|
-
invariant(fragment,
|
|
5270
|
+
invariant(fragment, 17, selection.name.value);
|
|
5271
5271
|
}
|
|
5272
5272
|
if (fragment && fragment.typeCondition) {
|
|
5273
5273
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5380,7 +5380,7 @@ var LocalState = (function () {
|
|
|
5380
5380
|
},
|
|
5381
5381
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5382
5382
|
var fragment = fragmentMap[spread.name.value];
|
|
5383
|
-
invariant(fragment,
|
|
5383
|
+
invariant(fragment, 18, spread.name.value);
|
|
5384
5384
|
var fragmentSelections = collectByDefinition(fragment);
|
|
5385
5385
|
if (fragmentSelections.size > 0) {
|
|
5386
5386
|
ancestors.forEach(function (node) {
|
|
@@ -5717,7 +5717,7 @@ var QueryManager = (function () {
|
|
|
5717
5717
|
this.queries.forEach(function (_info, queryId) {
|
|
5718
5718
|
_this.stopQueryNoBroadcast(queryId);
|
|
5719
5719
|
});
|
|
5720
|
-
this.cancelPendingFetches(newInvariantError(
|
|
5720
|
+
this.cancelPendingFetches(newInvariantError(24));
|
|
5721
5721
|
};
|
|
5722
5722
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5723
5723
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5731,9 +5731,9 @@ var QueryManager = (function () {
|
|
|
5731
5731
|
return tslib.__generator(this, function (_h) {
|
|
5732
5732
|
switch (_h.label) {
|
|
5733
5733
|
case 0:
|
|
5734
|
-
invariant(mutation,
|
|
5734
|
+
invariant(mutation, 25);
|
|
5735
5735
|
invariant(fetchPolicy === 'network-only' ||
|
|
5736
|
-
fetchPolicy === 'no-cache',
|
|
5736
|
+
fetchPolicy === 'no-cache', 26);
|
|
5737
5737
|
mutationId = this.generateMutationId();
|
|
5738
5738
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5739
5739
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6051,10 +6051,10 @@ var QueryManager = (function () {
|
|
|
6051
6051
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6052
6052
|
var _this = this;
|
|
6053
6053
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6054
|
-
invariant(options.query,
|
|
6055
|
-
invariant(options.query.kind === 'Document',
|
|
6056
|
-
invariant(!options.returnPartialData,
|
|
6057
|
-
invariant(!options.pollInterval,
|
|
6054
|
+
invariant(options.query, 27);
|
|
6055
|
+
invariant(options.query.kind === 'Document', 28);
|
|
6056
|
+
invariant(!options.returnPartialData, 29);
|
|
6057
|
+
invariant(!options.pollInterval, 30);
|
|
6058
6058
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
6059
6059
|
};
|
|
6060
6060
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -6079,7 +6079,7 @@ var QueryManager = (function () {
|
|
|
6079
6079
|
if (options === void 0) { options = {
|
|
6080
6080
|
discardWatches: true,
|
|
6081
6081
|
}; }
|
|
6082
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6082
|
+
this.cancelPendingFetches(newInvariantError(31));
|
|
6083
6083
|
this.queries.forEach(function (queryInfo) {
|
|
6084
6084
|
if (queryInfo.observableQuery) {
|
|
6085
6085
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6155,7 +6155,7 @@ var QueryManager = (function () {
|
|
|
6155
6155
|
if (__DEV__ && queryNamesAndDocs.size) {
|
|
6156
6156
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6157
6157
|
if (!included) {
|
|
6158
|
-
__DEV__ && invariant.warn(typeof nameOrDoc === "string" ?
|
|
6158
|
+
__DEV__ && invariant.warn(typeof nameOrDoc === "string" ? 32 : 33, nameOrDoc);
|
|
6159
6159
|
}
|
|
6160
6160
|
});
|
|
6161
6161
|
}
|
|
@@ -6804,25 +6804,16 @@ var contextKey = canUseSymbol
|
|
|
6804
6804
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
6805
6805
|
: '__APOLLO_CONTEXT__';
|
|
6806
6806
|
function getApolloContext() {
|
|
6807
|
-
invariant('createContext' in React__namespace,
|
|
6808
|
-
var contextStorage = global$1[contextKey];
|
|
6809
|
-
|
|
6810
|
-
contextStorage = global$1[contextKey] = new Map();
|
|
6811
|
-
}
|
|
6812
|
-
var context = contextStorage.get(React__namespace);
|
|
6813
|
-
if (!context) {
|
|
6814
|
-
context = React__namespace.createContext({});
|
|
6815
|
-
context.displayName = 'ApolloContext';
|
|
6816
|
-
contextStorage.set(React__namespace, context);
|
|
6817
|
-
}
|
|
6818
|
-
return context;
|
|
6807
|
+
invariant('createContext' in React__namespace, 44);
|
|
6808
|
+
var contextStorage = global$1[contextKey] || (global$1[contextKey] = Object.create(null));
|
|
6809
|
+
return contextStorage[React__namespace.version] || (contextStorage[React__namespace.version] = Object.assign(React__namespace.createContext({}), { displayName: 'ApolloContext' }));
|
|
6819
6810
|
}
|
|
6820
6811
|
var resetApolloContext = getApolloContext;
|
|
6821
6812
|
|
|
6822
6813
|
var ApolloConsumer = function (props) {
|
|
6823
6814
|
var ApolloContext = getApolloContext();
|
|
6824
6815
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6825
|
-
invariant(context && context.client,
|
|
6816
|
+
invariant(context && context.client, 43);
|
|
6826
6817
|
return props.children(context.client);
|
|
6827
6818
|
}));
|
|
6828
6819
|
};
|
|
@@ -6834,14 +6825,14 @@ var ApolloProvider = function (_a) {
|
|
|
6834
6825
|
var context = React__namespace.useMemo(function () {
|
|
6835
6826
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
6836
6827
|
}, [parentContext, client, suspenseCache]);
|
|
6837
|
-
invariant(context.client,
|
|
6828
|
+
invariant(context.client, 45);
|
|
6838
6829
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6839
6830
|
};
|
|
6840
6831
|
|
|
6841
6832
|
function useApolloClient(override) {
|
|
6842
6833
|
var context = React.useContext(getApolloContext());
|
|
6843
6834
|
var client = override || context.client;
|
|
6844
|
-
invariant(!!client,
|
|
6835
|
+
invariant(!!client, 48);
|
|
6845
6836
|
return client;
|
|
6846
6837
|
}
|
|
6847
6838
|
|
|
@@ -6854,7 +6845,7 @@ var useSyncExternalStore = realHook$1 || (function (subscribe, getSnapshot, getS
|
|
|
6854
6845
|
!didWarnUncachedGetSnapshot &&
|
|
6855
6846
|
value !== getSnapshot()) {
|
|
6856
6847
|
didWarnUncachedGetSnapshot = true;
|
|
6857
|
-
__DEV__ && invariant.error(
|
|
6848
|
+
__DEV__ && invariant.error(58);
|
|
6858
6849
|
}
|
|
6859
6850
|
var _a = React__namespace.useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _a[0].inst, forceUpdate = _a[1];
|
|
6860
6851
|
if (canUseLayoutEffect) {
|
|
@@ -6917,7 +6908,7 @@ function parser(document) {
|
|
|
6917
6908
|
if (cached)
|
|
6918
6909
|
return cached;
|
|
6919
6910
|
var variables, type, name;
|
|
6920
|
-
invariant(!!document && !!document.kind,
|
|
6911
|
+
invariant(!!document && !!document.kind, 59, document);
|
|
6921
6912
|
var fragments = [];
|
|
6922
6913
|
var queries = [];
|
|
6923
6914
|
var mutations = [];
|
|
@@ -6943,10 +6934,10 @@ function parser(document) {
|
|
|
6943
6934
|
}
|
|
6944
6935
|
}
|
|
6945
6936
|
invariant(!fragments.length ||
|
|
6946
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6937
|
+
(queries.length || mutations.length || subscriptions.length), 60);
|
|
6947
6938
|
invariant(
|
|
6948
6939
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
6949
|
-
|
|
6940
|
+
61,
|
|
6950
6941
|
document,
|
|
6951
6942
|
queries.length,
|
|
6952
6943
|
subscriptions.length,
|
|
@@ -6960,7 +6951,7 @@ function parser(document) {
|
|
|
6960
6951
|
: mutations.length
|
|
6961
6952
|
? mutations
|
|
6962
6953
|
: subscriptions;
|
|
6963
|
-
invariant(definitions.length === 1,
|
|
6954
|
+
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
6964
6955
|
var definition = definitions[0];
|
|
6965
6956
|
variables = definition.variableDefinitions || [];
|
|
6966
6957
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6979,7 +6970,7 @@ function verifyDocumentType(document, type) {
|
|
|
6979
6970
|
var usedOperationName = operationName(operation.type);
|
|
6980
6971
|
invariant(
|
|
6981
6972
|
operation.type === type,
|
|
6982
|
-
|
|
6973
|
+
63,
|
|
6983
6974
|
requiredOperationName,
|
|
6984
6975
|
requiredOperationName,
|
|
6985
6976
|
usedOperationName
|
|
@@ -7030,7 +7021,7 @@ var InternalState = (function () {
|
|
|
7030
7021
|
}
|
|
7031
7022
|
}
|
|
7032
7023
|
InternalState.prototype.forceUpdate = function () {
|
|
7033
|
-
__DEV__ && invariant.warn(
|
|
7024
|
+
__DEV__ && invariant.warn(50);
|
|
7034
7025
|
};
|
|
7035
7026
|
InternalState.prototype.executeQuery = function (options) {
|
|
7036
7027
|
var _this = this;
|
|
@@ -7441,10 +7432,10 @@ function useSubscription(subscription, options) {
|
|
|
7441
7432
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7442
7433
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7443
7434
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7444
|
-
__DEV__ && invariant.warn(options.onData ?
|
|
7435
|
+
__DEV__ && invariant.warn(options.onData ? 51 : 52);
|
|
7445
7436
|
}
|
|
7446
7437
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7447
|
-
__DEV__ && invariant.warn(options.onComplete ?
|
|
7438
|
+
__DEV__ && invariant.warn(options.onComplete ? 53 : 54);
|
|
7448
7439
|
}
|
|
7449
7440
|
}
|
|
7450
7441
|
var _b = React.useState(function () {
|
|
@@ -7655,7 +7646,7 @@ var __use = realHook ||
|
|
|
7655
7646
|
function useSuspenseCache(override) {
|
|
7656
7647
|
var context = React.useContext(getApolloContext());
|
|
7657
7648
|
var suspenseCache = override || context.suspenseCache;
|
|
7658
|
-
invariant(suspenseCache,
|
|
7649
|
+
invariant(suspenseCache, 55);
|
|
7659
7650
|
return suspenseCache;
|
|
7660
7651
|
}
|
|
7661
7652
|
|
|
@@ -7726,11 +7717,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
7726
7717
|
'no-cache',
|
|
7727
7718
|
'cache-and-network',
|
|
7728
7719
|
];
|
|
7729
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
7720
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);
|
|
7730
7721
|
}
|
|
7731
7722
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
7732
7723
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
7733
|
-
__DEV__ && invariant.warn(
|
|
7724
|
+
__DEV__ && invariant.warn(57);
|
|
7734
7725
|
}
|
|
7735
7726
|
}
|
|
7736
7727
|
function toApolloError(result) {
|
|
@@ -7794,7 +7785,7 @@ function useBackgroundQuery(query, options) {
|
|
|
7794
7785
|
}
|
|
7795
7786
|
function useReadQuery(queryRef) {
|
|
7796
7787
|
var _a = React.useState(0), forceUpdate = _a[1];
|
|
7797
|
-
invariant(queryRef.promiseCache,
|
|
7788
|
+
invariant(queryRef.promiseCache, 49);
|
|
7798
7789
|
var promise = queryRef.promiseCache.get(queryRef.key);
|
|
7799
7790
|
if (!promise) {
|
|
7800
7791
|
promise = queryRef.promise;
|