@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.
Files changed (213) hide show
  1. package/apollo-client.cjs.js +24 -52
  2. package/apollo-client.cjs.js.map +1 -1
  3. package/apollo-core.cjs.js +22 -16
  4. package/apollo-core.cjs.js.map +1 -1
  5. package/apollo-core.cjs.min.js +1 -1
  6. package/cache/cache.cjs.js +20 -22
  7. package/cache/cache.cjs.js.map +1 -1
  8. package/cache/index.d.ts +1 -0
  9. package/cache/index.d.ts.map +1 -1
  10. package/cache/index.js +1 -2
  11. package/cache/index.js.map +1 -1
  12. package/cache/inmemory/entityStore.js +1 -1
  13. package/cache/inmemory/entityStore.js.map +1 -1
  14. package/cache/inmemory/object-canon.d.ts +1 -0
  15. package/cache/inmemory/object-canon.d.ts.map +1 -1
  16. package/cache/inmemory/object-canon.js +1 -0
  17. package/cache/inmemory/object-canon.js.map +1 -1
  18. package/cache/inmemory/policies.d.ts.map +1 -1
  19. package/cache/inmemory/policies.js +1 -1
  20. package/cache/inmemory/policies.js.map +1 -1
  21. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  22. package/cache/inmemory/readFromStore.js +1 -1
  23. package/cache/inmemory/readFromStore.js.map +1 -1
  24. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  25. package/cache/inmemory/writeToStore.js +1 -1
  26. package/cache/inmemory/writeToStore.js.map +1 -1
  27. package/core/ApolloClient.d.ts.map +1 -1
  28. package/core/ApolloClient.js +1 -1
  29. package/core/ApolloClient.js.map +1 -1
  30. package/core/LocalState.d.ts.map +1 -1
  31. package/core/LocalState.js +1 -1
  32. package/core/LocalState.js.map +1 -1
  33. package/core/ObservableQuery.d.ts.map +1 -1
  34. package/core/ObservableQuery.js +18 -5
  35. package/core/ObservableQuery.js.map +1 -1
  36. package/core/QueryManager.d.ts.map +1 -1
  37. package/core/QueryManager.js +1 -1
  38. package/core/QueryManager.js.map +1 -1
  39. package/core/core.cjs.js +47 -34
  40. package/core/core.cjs.js.map +1 -1
  41. package/core/index.d.ts.map +1 -1
  42. package/core/index.js +1 -2
  43. package/core/index.js.map +1 -1
  44. package/errors/errors.cjs.js +1 -1
  45. package/errors/errors.cjs.js.map +1 -1
  46. package/errors/index.d.ts +1 -0
  47. package/errors/index.d.ts.map +1 -1
  48. package/errors/index.js +1 -2
  49. package/errors/index.js.map +1 -1
  50. package/invariantErrorCodes.js +1 -1
  51. package/link/core/ApolloLink.js +1 -1
  52. package/link/core/ApolloLink.js.map +1 -1
  53. package/link/core/core.cjs.js +4 -6
  54. package/link/core/core.cjs.js.map +1 -1
  55. package/link/core/index.d.ts +1 -0
  56. package/link/core/index.d.ts.map +1 -1
  57. package/link/core/index.js +1 -2
  58. package/link/core/index.js.map +1 -1
  59. package/link/http/checkFetcher.js +1 -1
  60. package/link/http/checkFetcher.js.map +1 -1
  61. package/link/http/createHttpLink.d.ts +1 -0
  62. package/link/http/createHttpLink.d.ts.map +1 -1
  63. package/link/http/createHttpLink.js +1 -0
  64. package/link/http/createHttpLink.js.map +1 -1
  65. package/link/http/http.cjs.js +4 -6
  66. package/link/http/http.cjs.js.map +1 -1
  67. package/link/http/index.d.ts +1 -0
  68. package/link/http/index.d.ts.map +1 -1
  69. package/link/http/index.js +1 -2
  70. package/link/http/index.js.map +1 -1
  71. package/link/http/serializeFetchParameter.d.ts +1 -1
  72. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  73. package/link/http/serializeFetchParameter.js +1 -1
  74. package/link/http/serializeFetchParameter.js.map +1 -1
  75. package/link/persisted-queries/index.d.ts.map +1 -1
  76. package/link/persisted-queries/index.js +1 -3
  77. package/link/persisted-queries/index.js.map +1 -1
  78. package/link/persisted-queries/persisted-queries.cjs.js +5 -6
  79. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  80. package/link/utils/index.d.ts +1 -0
  81. package/link/utils/index.d.ts.map +1 -1
  82. package/link/utils/index.js +1 -2
  83. package/link/utils/index.js.map +1 -1
  84. package/link/utils/toPromise.d.ts.map +1 -1
  85. package/link/utils/toPromise.js +1 -1
  86. package/link/utils/toPromise.js.map +1 -1
  87. package/link/utils/utils.cjs.js +3 -5
  88. package/link/utils/utils.cjs.js.map +1 -1
  89. package/link/utils/validateOperation.d.ts.map +1 -1
  90. package/link/utils/validateOperation.js +1 -1
  91. package/link/utils/validateOperation.js.map +1 -1
  92. package/package.json +1 -1
  93. package/react/context/ApolloConsumer.d.ts.map +1 -1
  94. package/react/context/ApolloConsumer.js +1 -1
  95. package/react/context/ApolloConsumer.js.map +1 -1
  96. package/react/context/ApolloProvider.d.ts.map +1 -1
  97. package/react/context/ApolloProvider.js +1 -1
  98. package/react/context/ApolloProvider.js.map +1 -1
  99. package/react/context/context.cjs.js +6 -8
  100. package/react/context/context.cjs.js.map +1 -1
  101. package/react/context/index.d.ts +1 -0
  102. package/react/context/index.d.ts.map +1 -1
  103. package/react/context/index.js +1 -2
  104. package/react/context/index.js.map +1 -1
  105. package/react/data/OperationData.d.ts.map +1 -1
  106. package/react/data/OperationData.js +1 -1
  107. package/react/data/OperationData.js.map +1 -1
  108. package/react/data/QueryData.d.ts.map +1 -1
  109. package/react/data/QueryData.js +1 -3
  110. package/react/data/QueryData.js.map +1 -1
  111. package/react/data/data.cjs.js +6 -11
  112. package/react/data/data.cjs.js.map +1 -1
  113. package/react/data/index.d.ts +1 -0
  114. package/react/data/index.d.ts.map +1 -1
  115. package/react/data/index.js +1 -2
  116. package/react/data/index.js.map +1 -1
  117. package/react/hoc/hoc-utils.d.ts.map +1 -1
  118. package/react/hoc/hoc-utils.js +1 -1
  119. package/react/hoc/hoc-utils.js.map +1 -1
  120. package/react/hoc/hoc.cjs.js +5 -8
  121. package/react/hoc/hoc.cjs.js.map +1 -1
  122. package/react/hoc/index.d.ts +1 -0
  123. package/react/hoc/index.d.ts.map +1 -1
  124. package/react/hoc/index.js +1 -2
  125. package/react/hoc/index.js.map +1 -1
  126. package/react/hoc/withApollo.d.ts.map +1 -1
  127. package/react/hoc/withApollo.js +1 -1
  128. package/react/hoc/withApollo.js.map +1 -1
  129. package/react/hooks/hooks.cjs.js +3 -6
  130. package/react/hooks/hooks.cjs.js.map +1 -1
  131. package/react/hooks/index.d.ts +1 -0
  132. package/react/hooks/index.d.ts.map +1 -1
  133. package/react/hooks/index.js +1 -2
  134. package/react/hooks/index.js.map +1 -1
  135. package/react/hooks/useApolloClient.d.ts.map +1 -1
  136. package/react/hooks/useApolloClient.js +1 -1
  137. package/react/hooks/useApolloClient.js.map +1 -1
  138. package/react/hooks/useSubscription.d.ts +1 -0
  139. package/react/hooks/useSubscription.d.ts.map +1 -1
  140. package/react/hooks/useSubscription.js +1 -0
  141. package/react/hooks/useSubscription.js.map +1 -1
  142. package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
  143. package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
  144. package/react/hooks/utils/useAfterFastRefresh.js +1 -0
  145. package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
  146. package/react/hooks/utils/useBaseQuery.d.ts +1 -0
  147. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  148. package/react/hooks/utils/useBaseQuery.js +1 -0
  149. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  150. package/react/index.d.ts +1 -0
  151. package/react/index.d.ts.map +1 -1
  152. package/react/index.js +1 -2
  153. package/react/index.js.map +1 -1
  154. package/react/parser/index.d.ts.map +1 -1
  155. package/react/parser/index.js +1 -3
  156. package/react/parser/index.js.map +1 -1
  157. package/react/parser/parser.cjs.js +9 -11
  158. package/react/parser/parser.cjs.js.map +1 -1
  159. package/react/react.cjs.js +2 -2
  160. package/react/react.cjs.js.map +1 -1
  161. package/testing/index.d.ts +1 -0
  162. package/testing/index.d.ts.map +1 -1
  163. package/testing/index.js +1 -2
  164. package/testing/index.js.map +1 -1
  165. package/testing/testing.cjs.js +3 -5
  166. package/testing/testing.cjs.js.map +1 -1
  167. package/utilities/globals/DEV.js +2 -2
  168. package/utilities/globals/DEV.js.map +1 -1
  169. package/utilities/{common → globals}/global.d.ts +0 -0
  170. package/utilities/globals/global.d.ts.map +1 -0
  171. package/utilities/{common → globals}/global.js +0 -0
  172. package/utilities/globals/global.js.map +1 -0
  173. package/utilities/globals/globals.cjs.js +56 -0
  174. package/utilities/globals/globals.cjs.js.map +1 -0
  175. package/utilities/globals/index.d.ts +4 -2
  176. package/utilities/globals/index.d.ts.map +1 -1
  177. package/utilities/globals/index.js +4 -2
  178. package/utilities/globals/index.js.map +1 -1
  179. package/utilities/{common → globals}/maybe.d.ts +0 -0
  180. package/utilities/globals/maybe.d.ts.map +1 -0
  181. package/utilities/{common → globals}/maybe.js +0 -0
  182. package/utilities/globals/maybe.js.map +1 -0
  183. package/utilities/globals/package.json +7 -0
  184. package/utilities/graphql/directives.d.ts.map +1 -1
  185. package/utilities/graphql/directives.js +1 -1
  186. package/utilities/graphql/directives.js.map +1 -1
  187. package/utilities/graphql/fragments.d.ts.map +1 -1
  188. package/utilities/graphql/fragments.js +1 -1
  189. package/utilities/graphql/fragments.js.map +1 -1
  190. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  191. package/utilities/graphql/getFromAST.js +1 -1
  192. package/utilities/graphql/getFromAST.js.map +1 -1
  193. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  194. package/utilities/graphql/storeUtils.js +1 -1
  195. package/utilities/graphql/storeUtils.js.map +1 -1
  196. package/utilities/graphql/transform.d.ts.map +1 -1
  197. package/utilities/graphql/transform.js +1 -1
  198. package/utilities/graphql/transform.js.map +1 -1
  199. package/utilities/index.d.ts +1 -3
  200. package/utilities/index.d.ts.map +1 -1
  201. package/utilities/index.js +1 -4
  202. package/utilities/index.js.map +1 -1
  203. package/utilities/package.json +1 -3
  204. package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
  205. package/utilities/testing/mocking/mockLink.js +1 -1
  206. package/utilities/testing/mocking/mockLink.js.map +1 -1
  207. package/utilities/utilities.cjs.js +23 -68
  208. package/utilities/utilities.cjs.js.map +1 -1
  209. package/version.js +1 -1
  210. package/utilities/common/global.d.ts.map +0 -1
  211. package/utilities/common/global.js.map +0 -1
  212. package/utilities/common/maybe.d.ts.map +0 -1
  213. package/utilities/common/maybe.js.map +0 -1
@@ -50,9 +50,6 @@ function removeTemporaryGlobals() {
50
50
  return process$1.remove();
51
51
  }
52
52
 
53
- function checkDEV() {
54
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38);
55
- }
56
53
  removeTemporaryGlobals();
57
54
 
58
55
  function shouldInclude(_a, variables) {
@@ -723,7 +720,7 @@ function removeClientSetsFromDocument(document) {
723
720
  return modifiedDoc;
724
721
  }
725
722
 
726
- var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
723
+ var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
727
724
  function mergeDeep() {
728
725
  var sources = [];
729
726
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -760,7 +757,7 @@ var DeepMerger = (function () {
760
757
  }
761
758
  if (isNonNullObject(source) && isNonNullObject(target)) {
762
759
  Object.keys(source).forEach(function (sourceKey) {
763
- if (hasOwnProperty$2.call(target, sourceKey)) {
760
+ if (hasOwnProperty$3.call(target, sourceKey)) {
764
761
  var targetValue = target[sourceKey];
765
762
  if (source[sourceKey] !== targetValue) {
766
763
  var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
@@ -1089,8 +1086,6 @@ function stringifyForDisplay(value) {
1089
1086
  }).split(JSON.stringify(undefId)).join("<undefined>");
1090
1087
  }
1091
1088
 
1092
- checkDEV();
1093
-
1094
1089
  function fromError(errorValue) {
1095
1090
  return new zenObservableTs.Observable(function (observer) {
1096
1091
  observer.error(errorValue);
@@ -1295,9 +1290,9 @@ var concat = ApolloLink.concat;
1295
1290
 
1296
1291
  var execute = ApolloLink.execute;
1297
1292
 
1298
- var version = '3.4.9';
1293
+ var version = '3.4.10';
1299
1294
 
1300
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1295
+ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1301
1296
  function parseAndCheckHttpResponse(operations) {
1302
1297
  return function (response) { return response
1303
1298
  .text()
@@ -1319,8 +1314,8 @@ function parseAndCheckHttpResponse(operations) {
1319
1314
  throwServerError(response, result, "Response not successful: Received status code " + response.status);
1320
1315
  }
1321
1316
  if (!Array.isArray(result) &&
1322
- !hasOwnProperty$1.call(result, 'data') &&
1323
- !hasOwnProperty$1.call(result, 'errors')) {
1317
+ !hasOwnProperty$2.call(result, 'data') &&
1318
+ !hasOwnProperty$2.call(result, 'errors')) {
1324
1319
  throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
1325
1320
  ? operations.map(function (op) { return op.operationName; })
1326
1321
  : operations.operationName) + "'.");
@@ -3675,7 +3670,6 @@ var InMemoryCache = (function (_super) {
3675
3670
  return InMemoryCache;
3676
3671
  }(ApolloCache));
3677
3672
 
3678
- checkDEV();
3679
3673
  function isApolloError(err) {
3680
3674
  return err.hasOwnProperty('graphQLErrors');
3681
3675
  }
@@ -3727,6 +3721,7 @@ function isNetworkRequestInFlight(networkStatus) {
3727
3721
  return networkStatus ? networkStatus < 7 : false;
3728
3722
  }
3729
3723
 
3724
+ var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
3730
3725
  var warnedAboutUpdateQuery = false;
3731
3726
  var ObservableQuery = (function (_super) {
3732
3727
  tslib.__extends(ObservableQuery, _super);
@@ -3803,7 +3798,12 @@ var ObservableQuery = (function (_super) {
3803
3798
  (lastResult && lastResult.networkStatus) ||
3804
3799
  exports.NetworkStatus.ready;
3805
3800
  var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
3806
- if (!this.queryManager.transform(this.options.query).hasForcedResolvers) {
3801
+ var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
3802
+ var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' &&
3803
+ fetchPolicy !== 'no-cache' &&
3804
+ fetchPolicy !== 'standby');
3805
+ if (shouldReturnCachedData &&
3806
+ !this.queryManager.transform(this.options.query).hasForcedResolvers) {
3807
3807
  var diff = this.queryInfo.getDiff();
3808
3808
  if (diff.complete || this.options.returnPartialData) {
3809
3809
  result.data = diff.result;
@@ -3811,7 +3811,6 @@ var ObservableQuery = (function (_super) {
3811
3811
  if (equality.equal(result.data, {})) {
3812
3812
  result.data = void 0;
3813
3813
  }
3814
- var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
3815
3814
  if (diff.complete) {
3816
3815
  if (result.networkStatus === exports.NetworkStatus.loading &&
3817
3816
  (fetchPolicy === 'cache-first' ||
@@ -3863,6 +3862,7 @@ var ObservableQuery = (function (_super) {
3863
3862
  this.queryManager.resetErrors(this.queryId);
3864
3863
  };
3865
3864
  ObservableQuery.prototype.refetch = function (variables) {
3865
+ var _a;
3866
3866
  var reobserveOptions = {
3867
3867
  pollInterval: 0,
3868
3868
  };
@@ -3873,6 +3873,13 @@ var ObservableQuery = (function (_super) {
3873
3873
  else if (fetchPolicy !== 'cache-and-network') {
3874
3874
  reobserveOptions.fetchPolicy = 'network-only';
3875
3875
  }
3876
+ if (__DEV__ && variables && hasOwnProperty$1.call(variables, "variables")) {
3877
+ var queryDef = getQueryDefinition(this.options.query);
3878
+ var vars = queryDef.variableDefinitions;
3879
+ if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
3880
+ __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 })?");
3881
+ }
3882
+ }
3876
3883
  if (variables && !equality.equal(this.options.variables, variables)) {
3877
3884
  reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables);
3878
3885
  }
@@ -4060,7 +4067,7 @@ var ObservableQuery = (function (_super) {
4060
4067
  var oldVariables = this.options.variables;
4061
4068
  var options = useDisposableConcast
4062
4069
  ? compact(this.options, newOptions)
4063
- : Object.assign(this.options, compact(newOptions));
4070
+ : assign(this.options, compact(newOptions));
4064
4071
  if (!useDisposableConcast) {
4065
4072
  this.updatePolling();
4066
4073
  if (newOptions &&
@@ -5726,7 +5733,6 @@ var ApolloClient = (function () {
5726
5733
  return ApolloClient;
5727
5734
  }());
5728
5735
 
5729
- checkDEV();
5730
5736
  tsInvariant.setVerbosity(DEV ? "log" : "silent");
5731
5737
 
5732
5738
  exports.setLogVerbosity = tsInvariant.setVerbosity;