@apollo/client 3.5.2 → 3.5.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.
Files changed (200) hide show
  1. package/README.md +1 -1
  2. package/apollo-client.cjs +138 -129
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +15 -15
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/core/cache.js +2 -2
  8. package/cache/inmemory/entityStore.js +4 -4
  9. package/cache/inmemory/helpers.js +1 -1
  10. package/cache/inmemory/helpers.js.map +1 -1
  11. package/cache/inmemory/inMemoryCache.js +3 -3
  12. package/cache/inmemory/key-extractor.js +2 -2
  13. package/cache/inmemory/key-extractor.js.map +1 -1
  14. package/cache/inmemory/object-canon.js +2 -2
  15. package/cache/inmemory/policies.js +4 -4
  16. package/cache/inmemory/policies.js.map +1 -1
  17. package/cache/inmemory/reactiveVars.js +2 -2
  18. package/cache/inmemory/readFromStore.js +5 -5
  19. package/cache/inmemory/readFromStore.js.map +1 -1
  20. package/cache/inmemory/writeToStore.js +9 -9
  21. package/cache/inmemory/writeToStore.js.map +1 -1
  22. package/config/jest/setup.js +1 -1
  23. package/core/ApolloClient.d.ts +0 -1
  24. package/core/ApolloClient.d.ts.map +1 -1
  25. package/core/ApolloClient.js +2 -2
  26. package/core/ApolloClient.js.map +1 -1
  27. package/core/LocalState.js +3 -3
  28. package/core/LocalState.js.map +1 -1
  29. package/core/ObservableQuery.d.ts +0 -1
  30. package/core/ObservableQuery.d.ts.map +1 -1
  31. package/core/ObservableQuery.js +4 -4
  32. package/core/ObservableQuery.js.map +1 -1
  33. package/core/QueryInfo.d.ts +2 -2
  34. package/core/QueryInfo.d.ts.map +1 -1
  35. package/core/QueryInfo.js +2 -2
  36. package/core/QueryManager.d.ts +0 -1
  37. package/core/QueryManager.d.ts.map +1 -1
  38. package/core/QueryManager.js +3 -3
  39. package/core/QueryManager.js.map +1 -1
  40. package/core/core.cjs +10 -10
  41. package/core/core.cjs.map +1 -1
  42. package/core/index.js +2 -2
  43. package/errors/errors.cjs +2 -2
  44. package/errors/errors.cjs.map +1 -1
  45. package/errors/index.js +3 -3
  46. package/errors/index.js.map +1 -1
  47. package/invariantErrorCodes.js +25 -25
  48. package/link/batch/batch.cjs +1 -1
  49. package/link/batch/batch.cjs.map +1 -1
  50. package/link/batch/batchLink.d.ts +0 -1
  51. package/link/batch/batchLink.d.ts.map +1 -1
  52. package/link/batch/batchLink.js +1 -1
  53. package/link/batch/batching.d.ts +0 -1
  54. package/link/batch/batching.d.ts.map +1 -1
  55. package/link/batch/batching.js +2 -2
  56. package/link/batch/batching.js.map +1 -1
  57. package/link/batch-http/batch-http.cjs +1 -1
  58. package/link/batch-http/batch-http.cjs.map +1 -1
  59. package/link/batch-http/batchHttpLink.d.ts +0 -1
  60. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  61. package/link/batch-http/batchHttpLink.js +3 -3
  62. package/link/batch-http/batchHttpLink.js.map +1 -1
  63. package/link/context/index.js +1 -1
  64. package/link/core/ApolloLink.d.ts +0 -1
  65. package/link/core/ApolloLink.d.ts.map +1 -1
  66. package/link/core/ApolloLink.js +1 -1
  67. package/link/core/types.d.ts +0 -1
  68. package/link/core/types.d.ts.map +1 -1
  69. package/link/error/index.d.ts +0 -1
  70. package/link/error/index.d.ts.map +1 -1
  71. package/link/error/index.js +1 -1
  72. package/link/http/HttpLink.js +1 -1
  73. package/link/http/createHttpLink.js +4 -4
  74. package/link/http/createHttpLink.js.map +1 -1
  75. package/link/http/http.cjs +24 -13
  76. package/link/http/http.cjs.map +1 -1
  77. package/link/http/index.d.ts +1 -1
  78. package/link/http/index.d.ts.map +1 -1
  79. package/link/http/index.js +1 -1
  80. package/link/http/index.js.map +1 -1
  81. package/link/http/parseAndCheckHttpResponse.js +3 -3
  82. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  83. package/link/http/rewriteURIForGET.js +1 -1
  84. package/link/http/rewriteURIForGET.js.map +1 -1
  85. package/link/http/selectHttpOptionsAndBody.d.ts +5 -1
  86. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  87. package/link/http/selectHttpOptionsAndBody.js +20 -9
  88. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  89. package/link/http/serializeFetchParameter.js +1 -1
  90. package/link/http/serializeFetchParameter.js.map +1 -1
  91. package/link/persisted-queries/index.js +2 -2
  92. package/link/retry/retryLink.d.ts +0 -1
  93. package/link/retry/retryLink.d.ts.map +1 -1
  94. package/link/retry/retryLink.js +1 -1
  95. package/link/schema/index.d.ts +0 -1
  96. package/link/schema/index.d.ts.map +1 -1
  97. package/link/schema/index.js +2 -2
  98. package/link/utils/createOperation.js +1 -1
  99. package/link/utils/fromError.d.ts +0 -1
  100. package/link/utils/fromError.d.ts.map +1 -1
  101. package/link/utils/fromPromise.d.ts +0 -1
  102. package/link/utils/fromPromise.d.ts.map +1 -1
  103. package/link/utils/toPromise.d.ts +0 -1
  104. package/link/utils/toPromise.d.ts.map +1 -1
  105. package/link/utils/utils.cjs +1 -1
  106. package/link/utils/utils.cjs.map +1 -1
  107. package/link/utils/validateOperation.js +1 -1
  108. package/link/utils/validateOperation.js.map +1 -1
  109. package/link/ws/index.d.ts +0 -1
  110. package/link/ws/index.d.ts.map +1 -1
  111. package/link/ws/index.js +2 -2
  112. package/main.cjs +4 -4
  113. package/package.json +14 -14
  114. package/react/components/Mutation.js +1 -1
  115. package/react/components/Query.js +2 -2
  116. package/react/components/Subscription.js +1 -1
  117. package/react/components/components.cjs +3 -3
  118. package/react/context/ApolloConsumer.js +1 -1
  119. package/react/context/ApolloContext.js +1 -1
  120. package/react/context/ApolloProvider.js +1 -1
  121. package/react/context/context.cjs +3 -3
  122. package/react/hoc/hoc-utils.js +2 -2
  123. package/react/hoc/hoc.cjs +9 -9
  124. package/react/hoc/hoc.cjs.map +1 -1
  125. package/react/hoc/mutation-hoc.js +5 -5
  126. package/react/hoc/mutation-hoc.js.map +1 -1
  127. package/react/hoc/query-hoc.js +4 -4
  128. package/react/hoc/query-hoc.js.map +1 -1
  129. package/react/hoc/subscription-hoc.js +4 -4
  130. package/react/hoc/subscription-hoc.js.map +1 -1
  131. package/react/hoc/withApollo.js +4 -4
  132. package/react/hoc/withApollo.js.map +1 -1
  133. package/react/hooks/hooks.cjs +64 -66
  134. package/react/hooks/hooks.cjs.map +1 -1
  135. package/react/hooks/useApolloClient.js +1 -1
  136. package/react/hooks/useLazyQuery.js +2 -2
  137. package/react/hooks/useMutation.d.ts.map +1 -1
  138. package/react/hooks/useMutation.js +61 -67
  139. package/react/hooks/useMutation.js.map +1 -1
  140. package/react/hooks/useQuery.d.ts.map +1 -1
  141. package/react/hooks/useQuery.js +9 -5
  142. package/react/hooks/useQuery.js.map +1 -1
  143. package/react/hooks/useReactiveVar.js +1 -1
  144. package/react/hooks/useSubscription.js +2 -2
  145. package/react/parser/index.js +7 -7
  146. package/react/parser/index.js.map +1 -1
  147. package/react/parser/parser.cjs +7 -7
  148. package/react/parser/parser.cjs.map +1 -1
  149. package/react/react.cjs +2 -2
  150. package/react/ssr/getDataFromTree.js +2 -2
  151. package/react/ssr/ssr.cjs +3 -3
  152. package/react/types/types.d.ts +0 -1
  153. package/react/types/types.d.ts.map +1 -1
  154. package/testing/core/core.cjs +2 -2
  155. package/testing/core/core.cjs.map +1 -1
  156. package/testing/core/mocking/mockFetch.js +3 -3
  157. package/testing/core/mocking/mockFetch.js.map +1 -1
  158. package/testing/core/mocking/mockLink.d.ts +0 -1
  159. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  160. package/testing/core/mocking/mockLink.js +5 -5
  161. package/testing/core/mocking/mockLink.js.map +1 -1
  162. package/testing/core/mocking/mockSubscriptionLink.d.ts +0 -1
  163. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
  164. package/testing/core/mocking/mockSubscriptionLink.js +1 -1
  165. package/testing/core/mocking/mockWatchQuery.js +1 -1
  166. package/testing/core/observableToPromise.js +2 -2
  167. package/testing/core/observableToPromise.js.map +1 -1
  168. package/testing/react/MockedProvider.js +2 -2
  169. package/testing/testing.cjs +5 -5
  170. package/utilities/common/makeUniqueId.js +1 -1
  171. package/utilities/common/makeUniqueId.js.map +1 -1
  172. package/utilities/common/mergeDeep.js +1 -1
  173. package/utilities/globals/fix-graphql.js +1 -1
  174. package/utilities/globals/global.d.ts.map +1 -1
  175. package/utilities/globals/global.js +1 -1
  176. package/utilities/globals/global.js.map +1 -1
  177. package/utilities/globals/globals.cjs +1 -1
  178. package/utilities/globals/globals.cjs.map +1 -1
  179. package/utilities/globals/index.js +1 -1
  180. package/utilities/graphql/directives.js +5 -5
  181. package/utilities/graphql/directives.js.map +1 -1
  182. package/utilities/graphql/fragments.js +4 -4
  183. package/utilities/graphql/fragments.js.map +1 -1
  184. package/utilities/graphql/getFromAST.js +2 -2
  185. package/utilities/graphql/getFromAST.js.map +1 -1
  186. package/utilities/graphql/storeUtils.js +5 -5
  187. package/utilities/graphql/storeUtils.js.map +1 -1
  188. package/utilities/graphql/transform.js +2 -2
  189. package/utilities/observables/Concast.d.ts +0 -1
  190. package/utilities/observables/Concast.d.ts.map +1 -1
  191. package/utilities/observables/Concast.js +1 -1
  192. package/utilities/observables/Observable.js +2 -2
  193. package/utilities/observables/asyncMap.d.ts +0 -1
  194. package/utilities/observables/asyncMap.d.ts.map +1 -1
  195. package/utilities/observables/subclassing.d.ts +0 -1
  196. package/utilities/observables/subclassing.d.ts.map +1 -1
  197. package/utilities/policies/pagination.js +2 -2
  198. package/utilities/utilities.cjs +15 -15
  199. package/utilities/utilities.cjs.map +1 -1
  200. package/version.js +1 -1
package/cache/cache.cjs CHANGED
@@ -117,7 +117,7 @@ function defaultDataIdFromObject(_a, context) {
117
117
  if (id === void 0)
118
118
  id = _id;
119
119
  if (id !== void 0) {
120
- return __typename + ":" + ((typeof id === "number" ||
120
+ return "".concat(__typename, ":").concat((typeof id === "number" ||
121
121
  typeof id === "string") ? id : JSON.stringify(id));
122
122
  }
123
123
  }
@@ -853,7 +853,7 @@ var StoreReader = (function () {
853
853
  !context.store.has(objectOrReference.__ref)) {
854
854
  return {
855
855
  result: this.canon.empty,
856
- missing: "Dangling reference to missing " + objectOrReference.__ref + " object",
856
+ missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"),
857
857
  };
858
858
  }
859
859
  var variables = context.variables, policies = context.policies, store = context.store;
@@ -888,7 +888,7 @@ var StoreReader = (function () {
888
888
  if (fieldValue === void 0) {
889
889
  if (!utilities.addTypenameToDocument.added(selection)) {
890
890
  missing = context.merge(missing, (_a = {},
891
- _a[resultName] = "Can't find field '" + selection.name.value + "' on " + (utilities.isReference(objectOrReference)
891
+ _a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
892
892
  ? objectOrReference.__ref + " object"
893
893
  : "object " + JSON.stringify(objectOrReference, null, 2)),
894
894
  _a));
@@ -998,7 +998,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
998
998
  var workSet_1 = new Set([fieldValue]);
999
999
  workSet_1.forEach(function (value) {
1000
1000
  if (utilities.isNonNullObject(value)) {
1001
- __DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : globals.invariant(!utilities.isReference(value), 5);
1001
+ __DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : globals.invariant(!utilities.isReference(value), 5);
1002
1002
  Object.values(value).forEach(workSet_1.add, workSet_1);
1003
1003
  }
1004
1004
  });
@@ -1085,10 +1085,10 @@ function keyFieldsFnFromSpecifier(specifier) {
1085
1085
  hasOwn.call(object, schemaKeyPath[0])) {
1086
1086
  extracted = extractKeyPath(object, schemaKeyPath, extractKey);
1087
1087
  }
1088
- __DEV__ ? globals.invariant(extracted !== void 0, "Missing field '" + schemaKeyPath.join('.') + "' while extracting keyFields from " + JSON.stringify(object)) : globals.invariant(extracted !== void 0, 2);
1088
+ __DEV__ ? globals.invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join('.'), "' while extracting keyFields from ").concat(JSON.stringify(object))) : globals.invariant(extracted !== void 0, 2);
1089
1089
  return extracted;
1090
1090
  });
1091
- return context.typename + ":" + JSON.stringify(keyObject);
1091
+ return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
1092
1092
  });
1093
1093
  }
1094
1094
  function keyArgsFnFromSpecifier(specifier) {
@@ -1314,7 +1314,7 @@ var Policies = (function () {
1314
1314
  var rootId = "ROOT_" + which.toUpperCase();
1315
1315
  var old = this.rootTypenamesById[rootId];
1316
1316
  if (typename !== old) {
1317
- __DEV__ ? globals.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : globals.invariant(!old || old === which, 3);
1317
+ __DEV__ ? globals.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : globals.invariant(!old || old === which, 3);
1318
1318
  if (old)
1319
1319
  delete this.rootIdsByTypename[old];
1320
1320
  this.rootIdsByTypename[typename] = rootId;
@@ -1398,7 +1398,7 @@ var Policies = (function () {
1398
1398
  if (supertypeSet.has(supertype)) {
1399
1399
  if (!typenameSupertypeSet.has(supertype)) {
1400
1400
  if (checkingFuzzySubtypes) {
1401
- __DEV__ && globals.invariant.warn("Inferring subtype " + typename + " of supertype " + supertype);
1401
+ __DEV__ && globals.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
1402
1402
  }
1403
1403
  typenameSupertypeSet.add(supertype);
1404
1404
  }
@@ -1552,7 +1552,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
1552
1552
  }
1553
1553
  }
1554
1554
  if (__DEV__ && options.from === void 0) {
1555
- __DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments " + utilities.stringifyForDisplay(Array.from(readFieldArgs)));
1555
+ __DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(utilities.stringifyForDisplay(Array.from(readFieldArgs))));
1556
1556
  }
1557
1557
  if (void 0 === options.variables) {
1558
1558
  options.variables = variables;
@@ -1592,7 +1592,7 @@ function makeMergeObjectsFunction(store) {
1592
1592
  }
1593
1593
 
1594
1594
  function getContextFlavor(context, clientOnly, deferred) {
1595
- var key = "" + clientOnly + deferred;
1595
+ var key = "".concat(clientOnly).concat(deferred);
1596
1596
  var flavored = context.flavors.get(key);
1597
1597
  if (!flavored) {
1598
1598
  context.flavors.set(key, flavored = (context.clientOnly === clientOnly &&
@@ -1634,7 +1634,7 @@ var StoreWriter = (function () {
1634
1634
  context: context,
1635
1635
  });
1636
1636
  if (!utilities.isReference(ref)) {
1637
- throw __DEV__ ? new globals.InvariantError("Could not identify object " + JSON.stringify(result)) : new globals.InvariantError(6);
1637
+ throw __DEV__ ? new globals.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new globals.InvariantError(6);
1638
1638
  }
1639
1639
  context.incomingById.forEach(function (_a, dataId) {
1640
1640
  var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
@@ -1739,7 +1739,7 @@ var StoreWriter = (function () {
1739
1739
  !context.deferred &&
1740
1740
  !utilities.addTypenameToDocument.added(field) &&
1741
1741
  !policies.getReadFunction(typename, field.name.value)) {
1742
- __DEV__ && globals.invariant.error(("Missing field '" + utilities.resultKeyNameFromField(field) + "' while writing result " + JSON.stringify(result, null, 2)).substring(0, 1000));
1742
+ __DEV__ && globals.invariant.error("Missing field '".concat(utilities.resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
1743
1743
  }
1744
1744
  });
1745
1745
  try {
@@ -1961,7 +1961,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
1961
1961
  var parentType = store.getFieldValue(existingRef, "__typename") ||
1962
1962
  store.getFieldValue(incomingObj, "__typename");
1963
1963
  var fieldName = fieldNameFromStoreName(storeFieldName);
1964
- var typeDotName = parentType + "." + fieldName;
1964
+ var typeDotName = "".concat(parentType, ".").concat(fieldName);
1965
1965
  if (warnings.has(typeDotName))
1966
1966
  return;
1967
1967
  warnings.add(typeDotName);
@@ -1976,10 +1976,10 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
1976
1976
  }
1977
1977
  });
1978
1978
  }
1979
- __DEV__ && globals.invariant.warn("Cache data may be lost when replacing the " + fieldName + " field of a " + parentType + " object.\n\nTo address this problem (which is not a bug in Apollo Client), " + (childTypenames.length
1979
+ __DEV__ && globals.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
1980
1980
  ? "either ensure all objects of type " +
1981
1981
  childTypenames.join(" and ") + " have an ID or a custom merge function, or "
1982
- : "") + "define a custom merge function for the " + typeDotName + " field, so InMemoryCache can safely merge these objects:\n\n existing: " + JSON.stringify(existing).slice(0, 1000) + "\n incoming: " + JSON.stringify(incoming).slice(0, 1000) + "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n");
1982
+ : "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
1983
1983
  }
1984
1984
 
1985
1985
  var InMemoryCache = (function (_super) {