@apollo/client 3.8.5 → 3.8.7

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 (112) hide show
  1. package/apollo-client.cjs +114 -74
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +46 -11
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +46 -11
  7. package/cache/core/types/common.d.ts +2 -2
  8. package/cache/core/types/common.d.ts.map +1 -1
  9. package/cache/core/types/common.js.map +1 -1
  10. package/cache/inmemory/entityStore.d.ts.map +1 -1
  11. package/cache/inmemory/entityStore.js +35 -0
  12. package/cache/inmemory/entityStore.js.map +1 -1
  13. package/cache/inmemory/key-extractor.js +1 -1
  14. package/cache/inmemory/policies.js +4 -4
  15. package/cache/inmemory/readFromStore.js +2 -2
  16. package/cache/inmemory/writeToStore.js +4 -4
  17. package/core/ApolloClient.js +3 -3
  18. package/core/LocalState.js +2 -2
  19. package/core/ObservableQuery.js +5 -5
  20. package/core/QueryManager.js +9 -9
  21. package/core/core.cjs +20 -20
  22. package/core/core.cjs.map +1 -1
  23. package/core/core.cjs.native.js +20 -20
  24. package/dev/dev.cjs +97 -82
  25. package/dev/dev.cjs.map +1 -1
  26. package/dev/dev.cjs.native.js +97 -82
  27. package/dev/loadErrorMessageHandler.js +1 -1
  28. package/dev/loadErrorMessageHandler.js.map +1 -1
  29. package/invariantErrorCodes.js +95 -80
  30. package/link/core/ApolloLink.js +2 -2
  31. package/link/core/core.cjs +2 -2
  32. package/link/core/core.cjs.map +1 -1
  33. package/link/core/core.cjs.native.js +2 -2
  34. package/link/http/checkFetcher.js +1 -1
  35. package/link/http/createHttpLink.js +1 -1
  36. package/link/http/http.cjs +3 -3
  37. package/link/http/http.cjs.map +1 -1
  38. package/link/http/http.cjs.native.js +3 -3
  39. package/link/http/serializeFetchParameter.js +1 -1
  40. package/link/persisted-queries/index.js +2 -2
  41. package/link/persisted-queries/persisted-queries.cjs +2 -2
  42. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  43. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  44. package/link/utils/toPromise.js +1 -1
  45. package/link/utils/utils.cjs +2 -2
  46. package/link/utils/utils.cjs.map +1 -1
  47. package/link/utils/utils.cjs.native.js +2 -2
  48. package/link/utils/validateOperation.js +1 -1
  49. package/package.json +25 -25
  50. package/react/cache/QueryReference.d.ts.map +1 -1
  51. package/react/cache/QueryReference.js +7 -2
  52. package/react/cache/QueryReference.js.map +1 -1
  53. package/react/context/ApolloConsumer.js +1 -1
  54. package/react/context/ApolloContext.js +1 -1
  55. package/react/context/ApolloProvider.js +1 -1
  56. package/react/context/context.cjs +3 -3
  57. package/react/context/context.cjs.map +1 -1
  58. package/react/context/context.cjs.native.js +3 -3
  59. package/react/hoc/hoc-utils.js +1 -1
  60. package/react/hoc/hoc.cjs +2 -2
  61. package/react/hoc/hoc.cjs.map +1 -1
  62. package/react/hoc/hoc.cjs.native.js +2 -2
  63. package/react/hoc/withApollo.js +1 -1
  64. package/react/hooks/hooks.cjs +15 -10
  65. package/react/hooks/hooks.cjs.map +1 -1
  66. package/react/hooks/hooks.cjs.native.js +15 -10
  67. package/react/hooks/index.d.ts +1 -0
  68. package/react/hooks/index.d.ts.map +1 -1
  69. package/react/hooks/index.js.map +1 -1
  70. package/react/hooks/useApolloClient.js +1 -1
  71. package/react/hooks/useQuery.js +1 -1
  72. package/react/hooks/useReadQuery.d.ts +7 -4
  73. package/react/hooks/useReadQuery.d.ts.map +1 -1
  74. package/react/hooks/useReadQuery.js +1 -1
  75. package/react/hooks/useReadQuery.js.map +1 -1
  76. package/react/hooks/useSubscription.js +2 -2
  77. package/react/hooks/useSuspenseQuery.js +2 -2
  78. package/react/hooks/useSyncExternalStore.js +1 -1
  79. package/react/parser/index.js +5 -5
  80. package/react/parser/parser.cjs +5 -5
  81. package/react/parser/parser.cjs.map +1 -1
  82. package/react/parser/parser.cjs.native.js +5 -5
  83. package/testing/core/core.cjs +1 -1
  84. package/testing/core/core.cjs.map +1 -1
  85. package/testing/core/core.cjs.native.js +1 -1
  86. package/testing/core/mocking/mockLink.js +1 -1
  87. package/testing/react/MockedProvider.d.ts +1 -0
  88. package/testing/react/MockedProvider.d.ts.map +1 -1
  89. package/testing/react/MockedProvider.js +2 -1
  90. package/testing/react/MockedProvider.js.map +1 -1
  91. package/testing/testing.cjs +2 -1
  92. package/testing/testing.cjs.map +1 -1
  93. package/testing/testing.cjs.native.js +2 -1
  94. package/utilities/globals/globals.cjs +1 -1
  95. package/utilities/globals/globals.cjs.map +1 -1
  96. package/utilities/globals/globals.cjs.native.js +1 -1
  97. package/utilities/graphql/DocumentTransform.js +1 -1
  98. package/utilities/graphql/directives.js +4 -4
  99. package/utilities/graphql/fragments.js +3 -3
  100. package/utilities/graphql/getFromAST.js +8 -8
  101. package/utilities/graphql/storeUtils.d.ts +5 -0
  102. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  103. package/utilities/graphql/storeUtils.js +1 -1
  104. package/utilities/graphql/storeUtils.js.map +1 -1
  105. package/utilities/graphql/transform.js +2 -2
  106. package/utilities/index.d.ts +1 -1
  107. package/utilities/index.d.ts.map +1 -1
  108. package/utilities/index.js.map +1 -1
  109. package/utilities/utilities.cjs +19 -19
  110. package/utilities/utilities.cjs.map +1 -1
  111. package/utilities/utilities.cjs.native.js +19 -19
  112. package/version.js +1 -1
@@ -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.5";
22
+ var version = "3.8.7";
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
- 18,
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(19, err);
470
+ globalThis.__DEV__ !== false && globals.invariant.error(21, err);
471
471
  },
472
472
  });
473
473
  this.subscriptions.add(subscription);
@@ -566,7 +566,7 @@ var ObservableQuery = (function (_super) {
566
566
  if (pollingInfo && pollingInfo.interval === pollInterval) {
567
567
  return;
568
568
  }
569
- globals.invariant(pollInterval, 20);
569
+ globals.invariant(pollInterval, 22);
570
570
  var info = pollingInfo || (this.pollingInfo = {});
571
571
  info.interval = pollInterval;
572
572
  var maybeFetch = function () {
@@ -731,11 +731,11 @@ function reobserveCacheFirst(obsQuery) {
731
731
  return obsQuery.reobserve();
732
732
  }
733
733
  function defaultSubscriptionObserverErrorCallback(error) {
734
- globalThis.__DEV__ !== false && globals.invariant.error(21, error.message, error.stack);
734
+ globalThis.__DEV__ !== false && globals.invariant.error(23, error.message, error.stack);
735
735
  }
736
736
  function logMissingFieldErrors(missing) {
737
737
  if (globalThis.__DEV__ !== false && missing) {
738
- globalThis.__DEV__ !== false && globals.invariant.debug(22, missing);
738
+ globalThis.__DEV__ !== false && globals.invariant.debug(24, missing);
739
739
  }
740
740
  }
741
741
  function skipCacheDataFor(fetchPolicy) {
@@ -920,7 +920,7 @@ var LocalState = (function () {
920
920
  }
921
921
  else {
922
922
  fragment = fragmentMap[selection.name.value];
923
- globals.invariant(fragment, 16, selection.name.value);
923
+ globals.invariant(fragment, 18, selection.name.value);
924
924
  }
925
925
  if (fragment && fragment.typeCondition) {
926
926
  typeCondition = fragment.typeCondition.name.value;
@@ -1033,7 +1033,7 @@ var LocalState = (function () {
1033
1033
  },
1034
1034
  FragmentSpread: function (spread, _, __, ___, ancestors) {
1035
1035
  var fragment = fragmentMap[spread.name.value];
1036
- globals.invariant(fragment, 17, spread.name.value);
1036
+ globals.invariant(fragment, 19, spread.name.value);
1037
1037
  var fragmentSelections = collectByDefinition(fragment);
1038
1038
  if (fragmentSelections.size > 0) {
1039
1039
  ancestors.forEach(function (node) {
@@ -1363,7 +1363,7 @@ var QueryManager = (function () {
1363
1363
  this.queries.forEach(function (_info, queryId) {
1364
1364
  _this.stopQueryNoBroadcast(queryId);
1365
1365
  });
1366
- this.cancelPendingFetches(globals.newInvariantError(23));
1366
+ this.cancelPendingFetches(globals.newInvariantError(25));
1367
1367
  };
1368
1368
  QueryManager.prototype.cancelPendingFetches = function (error) {
1369
1369
  this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
@@ -1377,8 +1377,8 @@ var QueryManager = (function () {
1377
1377
  return tslib.__generator(this, function (_h) {
1378
1378
  switch (_h.label) {
1379
1379
  case 0:
1380
- globals.invariant(mutation, 24);
1381
- globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 25);
1380
+ globals.invariant(mutation, 26);
1381
+ globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
1382
1382
  mutationId = this.generateMutationId();
1383
1383
  mutation = this.cache.transformForLink(this.transform(mutation));
1384
1384
  hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
@@ -1699,10 +1699,10 @@ var QueryManager = (function () {
1699
1699
  QueryManager.prototype.query = function (options, queryId) {
1700
1700
  var _this = this;
1701
1701
  if (queryId === void 0) { queryId = this.generateQueryId(); }
1702
- globals.invariant(options.query, 26);
1703
- globals.invariant(options.query.kind === "Document", 27);
1704
- globals.invariant(!options.returnPartialData, 28);
1705
- globals.invariant(!options.pollInterval, 29);
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);
1706
1706
  return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
1707
1707
  };
1708
1708
  QueryManager.prototype.generateQueryId = function () {
@@ -1727,7 +1727,7 @@ var QueryManager = (function () {
1727
1727
  if (options === void 0) { options = {
1728
1728
  discardWatches: true,
1729
1729
  }; }
1730
- this.cancelPendingFetches(globals.newInvariantError(30));
1730
+ this.cancelPendingFetches(globals.newInvariantError(32));
1731
1731
  this.queries.forEach(function (queryInfo) {
1732
1732
  if (queryInfo.observableQuery) {
1733
1733
  queryInfo.networkStatus = exports.NetworkStatus.loading;
@@ -1803,7 +1803,7 @@ var QueryManager = (function () {
1803
1803
  if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
1804
1804
  queryNamesAndDocs.forEach(function (included, nameOrDoc) {
1805
1805
  if (!included) {
1806
- globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ? 31 : 32, nameOrDoc);
1806
+ globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
1807
1807
  }
1808
1808
  });
1809
1809
  }
@@ -2240,7 +2240,7 @@ var ApolloClient = (function () {
2240
2240
  this.resetStoreCallbacks = [];
2241
2241
  this.clearStoreCallbacks = [];
2242
2242
  if (!options.cache) {
2243
- throw globals.newInvariantError(13);
2243
+ throw globals.newInvariantError(15);
2244
2244
  }
2245
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" &&
2246
2246
  !window.__APOLLO_CLIENT__ &&
@@ -2365,7 +2365,7 @@ var ApolloClient = (function () {
2365
2365
  if (this.defaultOptions.query) {
2366
2366
  options = utilities.mergeOptions(this.defaultOptions.query, options);
2367
2367
  }
2368
- globals.invariant(options.fetchPolicy !== "cache-and-network", 14);
2368
+ globals.invariant(options.fetchPolicy !== "cache-and-network", 16);
2369
2369
  if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
2370
2370
  options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
2371
2371
  }
@@ -2458,7 +2458,7 @@ var ApolloClient = (function () {
2458
2458
  result.queries = queries;
2459
2459
  result.results = results;
2460
2460
  result.catch(function (error) {
2461
- globalThis.__DEV__ !== false && globals.invariant.debug(15, error);
2461
+ globalThis.__DEV__ !== false && globals.invariant.debug(17, error);
2462
2462
  });
2463
2463
  return result;
2464
2464
  };