@apollo/client 3.4.9 → 3.4.10
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.js +24 -52
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-core.cjs.js +22 -16
- package/apollo-core.cjs.js.map +1 -1
- package/apollo-core.cjs.min.js +1 -1
- package/cache/cache.cjs.js +20 -22
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts +1 -0
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +1 -2
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +1 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -0
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +18 -5
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +47 -34
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -2
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -1
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs.js +4 -6
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts +1 -0
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +1 -2
- package/link/core/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -0
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs.js +4 -6
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts +1 -0
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -2
- package/link/http/index.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +1 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +5 -6
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -2
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/utils.cjs.js +3 -5
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs.js +6 -8
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.d.ts +1 -0
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -2
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.d.ts.map +1 -1
- package/react/data/OperationData.js +1 -1
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +1 -3
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +6 -11
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts +1 -0
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +1 -2
- package/react/data/index.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs.js +5 -8
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/index.d.ts +1 -0
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +1 -2
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs.js +3 -6
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -2
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -0
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.js +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.d.ts +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +1 -0
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -2
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +1 -3
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +9 -11
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -2
- package/react/react.cjs.js.map +1 -1
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +1 -2
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -5
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/globals/DEV.js +2 -2
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/{common → globals}/global.d.ts +0 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/{common → globals}/global.js +0 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs.js +56 -0
- package/utilities/globals/globals.cjs.js.map +1 -0
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +4 -2
- package/utilities/globals/index.js.map +1 -1
- package/utilities/{common → globals}/maybe.d.ts +0 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/{common → globals}/maybe.js +0 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +7 -0
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +1 -1
- package/utilities/graphql/getFromAST.js.map +1 -1
- 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.d.ts.map +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -3
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -4
- package/utilities/index.js.map +1 -1
- package/utilities/package.json +1 -3
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +1 -1
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/utilities.cjs.js +23 -68
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/utilities/common/global.d.ts.map +0 -1
- package/utilities/common/global.js.map +0 -1
- package/utilities/common/maybe.d.ts.map +0 -1
- package/utilities/common/maybe.js.map +0 -1
package/apollo-client.cjs.js
CHANGED
|
@@ -5,10 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var tsInvariant = require('ts-invariant');
|
|
7
7
|
var equality = require('@wry/equality');
|
|
8
|
-
var process$1 = require('ts-invariant/process');
|
|
9
|
-
var graphql = require('graphql');
|
|
10
8
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
9
|
require('symbol-observable');
|
|
10
|
+
var graphql = require('graphql');
|
|
12
11
|
var optimism = require('optimism');
|
|
13
12
|
var context = require('@wry/context');
|
|
14
13
|
var trie = require('@wry/trie');
|
|
@@ -36,40 +35,6 @@ function maybe(thunk) {
|
|
|
36
35
|
catch (_a) { }
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
40
|
-
maybe(function () { return window; }) ||
|
|
41
|
-
maybe(function () { return self; }) ||
|
|
42
|
-
maybe(function () { return global; }) ||
|
|
43
|
-
maybe(function () { return Function("return this")(); }));
|
|
44
|
-
|
|
45
|
-
var __ = "__";
|
|
46
|
-
var GLOBAL_KEY = [__, __].join("DEV");
|
|
47
|
-
function getDEV() {
|
|
48
|
-
try {
|
|
49
|
-
return Boolean(__DEV__);
|
|
50
|
-
}
|
|
51
|
-
catch (_a) {
|
|
52
|
-
Object.defineProperty(global$1, GLOBAL_KEY, {
|
|
53
|
-
value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
|
|
54
|
-
enumerable: false,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
});
|
|
58
|
-
return global$1[GLOBAL_KEY];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
var DEV = getDEV();
|
|
62
|
-
|
|
63
|
-
function removeTemporaryGlobals() {
|
|
64
|
-
graphql.isType(null);
|
|
65
|
-
return process$1.remove();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function checkDEV() {
|
|
69
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38);
|
|
70
|
-
}
|
|
71
|
-
removeTemporaryGlobals();
|
|
72
|
-
|
|
73
38
|
function shouldInclude(_a, variables) {
|
|
74
39
|
var directives = _a.directives;
|
|
75
40
|
if (!directives || !directives.length) {
|
|
@@ -738,7 +703,7 @@ function removeClientSetsFromDocument(document) {
|
|
|
738
703
|
return modifiedDoc;
|
|
739
704
|
}
|
|
740
705
|
|
|
741
|
-
var hasOwnProperty$
|
|
706
|
+
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
742
707
|
function mergeDeep() {
|
|
743
708
|
var sources = [];
|
|
744
709
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -775,7 +740,7 @@ var DeepMerger = (function () {
|
|
|
775
740
|
}
|
|
776
741
|
if (isNonNullObject(source) && isNonNullObject(target)) {
|
|
777
742
|
Object.keys(source).forEach(function (sourceKey) {
|
|
778
|
-
if (hasOwnProperty$
|
|
743
|
+
if (hasOwnProperty$3.call(target, sourceKey)) {
|
|
779
744
|
var targetValue = target[sourceKey];
|
|
780
745
|
if (source[sourceKey] !== targetValue) {
|
|
781
746
|
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
|
|
@@ -1104,8 +1069,6 @@ function stringifyForDisplay(value) {
|
|
|
1104
1069
|
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1105
1070
|
}
|
|
1106
1071
|
|
|
1107
|
-
checkDEV();
|
|
1108
|
-
|
|
1109
1072
|
function fromError(errorValue) {
|
|
1110
1073
|
return new zenObservableTs.Observable(function (observer) {
|
|
1111
1074
|
observer.error(errorValue);
|
|
@@ -1310,9 +1273,9 @@ var concat = ApolloLink.concat;
|
|
|
1310
1273
|
|
|
1311
1274
|
var execute = ApolloLink.execute;
|
|
1312
1275
|
|
|
1313
|
-
var version = '3.4.
|
|
1276
|
+
var version = '3.4.10';
|
|
1314
1277
|
|
|
1315
|
-
var hasOwnProperty$
|
|
1278
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1316
1279
|
function parseAndCheckHttpResponse(operations) {
|
|
1317
1280
|
return function (response) { return response
|
|
1318
1281
|
.text()
|
|
@@ -1334,8 +1297,8 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1334
1297
|
throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
|
1335
1298
|
}
|
|
1336
1299
|
if (!Array.isArray(result) &&
|
|
1337
|
-
!hasOwnProperty$
|
|
1338
|
-
!hasOwnProperty$
|
|
1300
|
+
!hasOwnProperty$2.call(result, 'data') &&
|
|
1301
|
+
!hasOwnProperty$2.call(result, 'errors')) {
|
|
1339
1302
|
throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
|
1340
1303
|
? operations.map(function (op) { return op.operationName; })
|
|
1341
1304
|
: operations.operationName) + "'.");
|
|
@@ -3690,7 +3653,6 @@ var InMemoryCache = (function (_super) {
|
|
|
3690
3653
|
return InMemoryCache;
|
|
3691
3654
|
}(ApolloCache));
|
|
3692
3655
|
|
|
3693
|
-
checkDEV();
|
|
3694
3656
|
function isApolloError(err) {
|
|
3695
3657
|
return err.hasOwnProperty('graphQLErrors');
|
|
3696
3658
|
}
|
|
@@ -3742,6 +3704,7 @@ function isNetworkRequestInFlight(networkStatus) {
|
|
|
3742
3704
|
return networkStatus ? networkStatus < 7 : false;
|
|
3743
3705
|
}
|
|
3744
3706
|
|
|
3707
|
+
var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
|
|
3745
3708
|
var warnedAboutUpdateQuery = false;
|
|
3746
3709
|
var ObservableQuery = (function (_super) {
|
|
3747
3710
|
tslib.__extends(ObservableQuery, _super);
|
|
@@ -3818,7 +3781,12 @@ var ObservableQuery = (function (_super) {
|
|
|
3818
3781
|
(lastResult && lastResult.networkStatus) ||
|
|
3819
3782
|
exports.NetworkStatus.ready;
|
|
3820
3783
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
3821
|
-
|
|
3784
|
+
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
3785
|
+
var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' &&
|
|
3786
|
+
fetchPolicy !== 'no-cache' &&
|
|
3787
|
+
fetchPolicy !== 'standby');
|
|
3788
|
+
if (shouldReturnCachedData &&
|
|
3789
|
+
!this.queryManager.transform(this.options.query).hasForcedResolvers) {
|
|
3822
3790
|
var diff = this.queryInfo.getDiff();
|
|
3823
3791
|
if (diff.complete || this.options.returnPartialData) {
|
|
3824
3792
|
result.data = diff.result;
|
|
@@ -3826,7 +3794,6 @@ var ObservableQuery = (function (_super) {
|
|
|
3826
3794
|
if (equality.equal(result.data, {})) {
|
|
3827
3795
|
result.data = void 0;
|
|
3828
3796
|
}
|
|
3829
|
-
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
3830
3797
|
if (diff.complete) {
|
|
3831
3798
|
if (result.networkStatus === exports.NetworkStatus.loading &&
|
|
3832
3799
|
(fetchPolicy === 'cache-first' ||
|
|
@@ -3878,6 +3845,7 @@ var ObservableQuery = (function (_super) {
|
|
|
3878
3845
|
this.queryManager.resetErrors(this.queryId);
|
|
3879
3846
|
};
|
|
3880
3847
|
ObservableQuery.prototype.refetch = function (variables) {
|
|
3848
|
+
var _a;
|
|
3881
3849
|
var reobserveOptions = {
|
|
3882
3850
|
pollInterval: 0,
|
|
3883
3851
|
};
|
|
@@ -3888,6 +3856,13 @@ var ObservableQuery = (function (_super) {
|
|
|
3888
3856
|
else if (fetchPolicy !== 'cache-and-network') {
|
|
3889
3857
|
reobserveOptions.fetchPolicy = 'network-only';
|
|
3890
3858
|
}
|
|
3859
|
+
if (__DEV__ && variables && hasOwnProperty$1.call(variables, "variables")) {
|
|
3860
|
+
var queryDef = getQueryDefinition(this.options.query);
|
|
3861
|
+
var vars = queryDef.variableDefinitions;
|
|
3862
|
+
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
3863
|
+
__DEV__ && tsInvariant.invariant.warn("Called refetch(" + JSON.stringify(variables) + ") for query " + (((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef)) + ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?");
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3891
3866
|
if (variables && !equality.equal(this.options.variables, variables)) {
|
|
3892
3867
|
reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables);
|
|
3893
3868
|
}
|
|
@@ -4075,7 +4050,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4075
4050
|
var oldVariables = this.options.variables;
|
|
4076
4051
|
var options = useDisposableConcast
|
|
4077
4052
|
? compact(this.options, newOptions)
|
|
4078
|
-
:
|
|
4053
|
+
: assign(this.options, compact(newOptions));
|
|
4079
4054
|
if (!useDisposableConcast) {
|
|
4080
4055
|
this.updatePolling();
|
|
4081
4056
|
if (newOptions &&
|
|
@@ -5782,7 +5757,6 @@ function useApolloClient() {
|
|
|
5782
5757
|
return client;
|
|
5783
5758
|
}
|
|
5784
5759
|
|
|
5785
|
-
checkDEV();
|
|
5786
5760
|
exports.DocumentType = void 0;
|
|
5787
5761
|
(function (DocumentType) {
|
|
5788
5762
|
DocumentType[DocumentType["Query"] = 0] = "Query";
|
|
@@ -6193,9 +6167,7 @@ var QueryData = (function (_super) {
|
|
|
6193
6167
|
var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c;
|
|
6194
6168
|
this.isMounted = true;
|
|
6195
6169
|
var options = this.getOptions();
|
|
6196
|
-
if (this.currentObservable &&
|
|
6197
|
-
!this.ssrInitiated() &&
|
|
6198
|
-
!this.client.disableNetworkFetches) {
|
|
6170
|
+
if (this.currentObservable && !this.ssrInitiated()) {
|
|
6199
6171
|
this.startQuerySubscription();
|
|
6200
6172
|
}
|
|
6201
6173
|
if (!lazy || this.runLazy) {
|