@apollo/client 3.8.4 → 3.8.6
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 +168 -149
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +46 -11
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +46 -11
- package/cache/core/types/common.d.ts +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +35 -0
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.js +3 -3
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +10 -11
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +0 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +11 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +27 -30
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +27 -30
- package/dev/dev.cjs +124 -100
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +124 -100
- package/dev/loadErrorMessageHandler.js +2 -2
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/invariantErrorCodes.js +95 -80
- 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/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 +22 -22
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +7 -2
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/index.d.ts +0 -4
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +0 -14
- package/react/cache/index.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +3 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +3 -3
- 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 +15 -10
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +15 -10
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -1
- package/react/index.js.map +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/react/react.cjs +1 -218
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +1 -218
- package/react/types/types.d.ts +0 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- 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/testing/internal/ObservableStream.d.ts +26 -0
- package/testing/internal/ObservableStream.d.ts.map +1 -0
- package/testing/internal/ObservableStream.js +101 -0
- package/testing/internal/ObservableStream.js.map +1 -0
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.d.ts.map +1 -1
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -1
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -1
- package/utilities/globals/globals.cjs +29 -19
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +29 -19
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +28 -18
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts +5 -0
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +1 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +17 -34
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/utilities.cjs +36 -53
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +36 -53
- package/version.js +1 -1
package/core/core.cjs
CHANGED
|
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
|
|
20
20
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
21
21
|
|
|
22
|
-
var version = "3.8.
|
|
22
|
+
var version = "3.8.6";
|
|
23
23
|
|
|
24
24
|
function isNonNullObject(obj) {
|
|
25
25
|
return obj !== null && typeof obj === "object";
|
|
@@ -369,7 +369,7 @@ var ObservableQuery = (function (_super) {
|
|
|
369
369
|
var vars = queryDef.variableDefinitions;
|
|
370
370
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
371
371
|
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
372
|
-
|
|
372
|
+
20,
|
|
373
373
|
variables,
|
|
374
374
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
375
375
|
);
|
|
@@ -467,7 +467,7 @@ var ObservableQuery = (function (_super) {
|
|
|
467
467
|
options.onError(err);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
470
|
+
globalThis.__DEV__ !== false && globals.invariant.error(21, err);
|
|
471
471
|
},
|
|
472
472
|
});
|
|
473
473
|
this.subscriptions.add(subscription);
|
|
@@ -546,9 +546,9 @@ var ObservableQuery = (function (_super) {
|
|
|
546
546
|
}
|
|
547
547
|
return options.fetchPolicy;
|
|
548
548
|
};
|
|
549
|
-
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
549
|
+
ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {
|
|
550
550
|
this.queryManager.setObservableQuery(this);
|
|
551
|
-
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus);
|
|
551
|
+
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query);
|
|
552
552
|
};
|
|
553
553
|
ObservableQuery.prototype.updatePolling = function () {
|
|
554
554
|
var _this = this;
|
|
@@ -566,7 +566,7 @@ var ObservableQuery = (function (_super) {
|
|
|
566
566
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
567
567
|
return;
|
|
568
568
|
}
|
|
569
|
-
globals.invariant(pollInterval,
|
|
569
|
+
globals.invariant(pollInterval, 22);
|
|
570
570
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
571
571
|
info.interval = pollInterval;
|
|
572
572
|
var maybeFetch = function () {
|
|
@@ -630,15 +630,14 @@ var ObservableQuery = (function (_super) {
|
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
|
|
634
|
-
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(fetchOptions.fetchPolicy));
|
|
633
|
+
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
|
|
635
634
|
var finishWaitingForOwnResult = function () {
|
|
636
635
|
if (_this.concast === concast) {
|
|
637
636
|
_this.waitForOwnResult = false;
|
|
638
637
|
}
|
|
639
638
|
};
|
|
640
|
-
var variables =
|
|
641
|
-
var _a = this.fetch(
|
|
639
|
+
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
640
|
+
var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;
|
|
642
641
|
var observer = {
|
|
643
642
|
next: function (result) {
|
|
644
643
|
finishWaitingForOwnResult();
|
|
@@ -732,11 +731,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
732
731
|
return obsQuery.reobserve();
|
|
733
732
|
}
|
|
734
733
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
735
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
734
|
+
globalThis.__DEV__ !== false && globals.invariant.error(23, error.message, error.stack);
|
|
736
735
|
}
|
|
737
736
|
function logMissingFieldErrors(missing) {
|
|
738
737
|
if (globalThis.__DEV__ !== false && missing) {
|
|
739
|
-
globalThis.__DEV__ !== false && globals.invariant.debug(
|
|
738
|
+
globalThis.__DEV__ !== false && globals.invariant.debug(24, missing);
|
|
740
739
|
}
|
|
741
740
|
}
|
|
742
741
|
function skipCacheDataFor(fetchPolicy) {
|
|
@@ -921,7 +920,7 @@ var LocalState = (function () {
|
|
|
921
920
|
}
|
|
922
921
|
else {
|
|
923
922
|
fragment = fragmentMap[selection.name.value];
|
|
924
|
-
globals.invariant(fragment,
|
|
923
|
+
globals.invariant(fragment, 18, selection.name.value);
|
|
925
924
|
}
|
|
926
925
|
if (fragment && fragment.typeCondition) {
|
|
927
926
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -1034,7 +1033,7 @@ var LocalState = (function () {
|
|
|
1034
1033
|
},
|
|
1035
1034
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
1036
1035
|
var fragment = fragmentMap[spread.name.value];
|
|
1037
|
-
globals.invariant(fragment,
|
|
1036
|
+
globals.invariant(fragment, 19, spread.name.value);
|
|
1038
1037
|
var fragmentSelections = collectByDefinition(fragment);
|
|
1039
1038
|
if (fragmentSelections.size > 0) {
|
|
1040
1039
|
ancestors.forEach(function (node) {
|
|
@@ -1080,7 +1079,6 @@ var QueryInfo = (function () {
|
|
|
1080
1079
|
this.listeners = new Set();
|
|
1081
1080
|
this.document = null;
|
|
1082
1081
|
this.lastRequestId = 1;
|
|
1083
|
-
this.subscriptions = new Set();
|
|
1084
1082
|
this.stopped = false;
|
|
1085
1083
|
this.dirty = false;
|
|
1086
1084
|
this.observableQuery = null;
|
|
@@ -1215,7 +1213,6 @@ var QueryInfo = (function () {
|
|
|
1215
1213
|
this.reset();
|
|
1216
1214
|
this.cancel();
|
|
1217
1215
|
this.cancel = QueryInfo.prototype.cancel;
|
|
1218
|
-
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
1219
1216
|
var oq = this.observableQuery;
|
|
1220
1217
|
if (oq)
|
|
1221
1218
|
oq.stopPolling();
|
|
@@ -1366,7 +1363,7 @@ var QueryManager = (function () {
|
|
|
1366
1363
|
this.queries.forEach(function (_info, queryId) {
|
|
1367
1364
|
_this.stopQueryNoBroadcast(queryId);
|
|
1368
1365
|
});
|
|
1369
|
-
this.cancelPendingFetches(globals.newInvariantError(
|
|
1366
|
+
this.cancelPendingFetches(globals.newInvariantError(25));
|
|
1370
1367
|
};
|
|
1371
1368
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
1372
1369
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -1380,8 +1377,8 @@ var QueryManager = (function () {
|
|
|
1380
1377
|
return tslib.__generator(this, function (_h) {
|
|
1381
1378
|
switch (_h.label) {
|
|
1382
1379
|
case 0:
|
|
1383
|
-
globals.invariant(mutation,
|
|
1384
|
-
globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
1380
|
+
globals.invariant(mutation, 26);
|
|
1381
|
+
globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
|
|
1385
1382
|
mutationId = this.generateMutationId();
|
|
1386
1383
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
1387
1384
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -1702,10 +1699,10 @@ var QueryManager = (function () {
|
|
|
1702
1699
|
QueryManager.prototype.query = function (options, queryId) {
|
|
1703
1700
|
var _this = this;
|
|
1704
1701
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
1705
|
-
globals.invariant(options.query,
|
|
1706
|
-
globals.invariant(options.query.kind === "Document",
|
|
1707
|
-
globals.invariant(!options.returnPartialData,
|
|
1708
|
-
globals.invariant(!options.pollInterval,
|
|
1702
|
+
globals.invariant(options.query, 28);
|
|
1703
|
+
globals.invariant(options.query.kind === "Document", 29);
|
|
1704
|
+
globals.invariant(!options.returnPartialData, 30);
|
|
1705
|
+
globals.invariant(!options.pollInterval, 31);
|
|
1709
1706
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
1710
1707
|
};
|
|
1711
1708
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -1730,7 +1727,7 @@ var QueryManager = (function () {
|
|
|
1730
1727
|
if (options === void 0) { options = {
|
|
1731
1728
|
discardWatches: true,
|
|
1732
1729
|
}; }
|
|
1733
|
-
this.cancelPendingFetches(globals.newInvariantError(
|
|
1730
|
+
this.cancelPendingFetches(globals.newInvariantError(32));
|
|
1734
1731
|
this.queries.forEach(function (queryInfo) {
|
|
1735
1732
|
if (queryInfo.observableQuery) {
|
|
1736
1733
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -1806,7 +1803,7 @@ var QueryManager = (function () {
|
|
|
1806
1803
|
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
1807
1804
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
1808
1805
|
if (!included) {
|
|
1809
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ?
|
|
1806
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
|
|
1810
1807
|
}
|
|
1811
1808
|
});
|
|
1812
1809
|
}
|
|
@@ -1994,10 +1991,10 @@ var QueryManager = (function () {
|
|
|
1994
1991
|
throw error;
|
|
1995
1992
|
});
|
|
1996
1993
|
};
|
|
1997
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus) {
|
|
1994
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus, query) {
|
|
1998
1995
|
var _this = this;
|
|
1999
1996
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
2000
|
-
|
|
1997
|
+
if (query === void 0) { query = options.query; }
|
|
2001
1998
|
var variables = this.getVariables(query, options.variables);
|
|
2002
1999
|
var queryInfo = this.getQuery(queryId);
|
|
2003
2000
|
var defaults = this.defaultOptions.watchQuery;
|
|
@@ -2243,7 +2240,7 @@ var ApolloClient = (function () {
|
|
|
2243
2240
|
this.resetStoreCallbacks = [];
|
|
2244
2241
|
this.clearStoreCallbacks = [];
|
|
2245
2242
|
if (!options.cache) {
|
|
2246
|
-
throw globals.newInvariantError(
|
|
2243
|
+
throw globals.newInvariantError(15);
|
|
2247
2244
|
}
|
|
2248
2245
|
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
2249
2246
|
!window.__APOLLO_CLIENT__ &&
|
|
@@ -2368,7 +2365,7 @@ var ApolloClient = (function () {
|
|
|
2368
2365
|
if (this.defaultOptions.query) {
|
|
2369
2366
|
options = utilities.mergeOptions(this.defaultOptions.query, options);
|
|
2370
2367
|
}
|
|
2371
|
-
globals.invariant(options.fetchPolicy !== "cache-and-network",
|
|
2368
|
+
globals.invariant(options.fetchPolicy !== "cache-and-network", 16);
|
|
2372
2369
|
if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
|
|
2373
2370
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
2374
2371
|
}
|
|
@@ -2461,7 +2458,7 @@ var ApolloClient = (function () {
|
|
|
2461
2458
|
result.queries = queries;
|
|
2462
2459
|
result.results = results;
|
|
2463
2460
|
result.catch(function (error) {
|
|
2464
|
-
globalThis.__DEV__ !== false && globals.invariant.debug(
|
|
2461
|
+
globalThis.__DEV__ !== false && globals.invariant.debug(17, error);
|
|
2465
2462
|
});
|
|
2466
2463
|
return result;
|
|
2467
2464
|
};
|