@apollo/client 3.9.0-alpha.5 → 3.9.0-beta.1

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 (221) hide show
  1. package/.changeset/chatty-comics-yawn.md +8 -0
  2. package/.changeset/curvy-seas-hope.md +13 -0
  3. package/.changeset/dirty-tigers-matter.md +13 -0
  4. package/.changeset/late-rabbits-protect.md +7 -0
  5. package/.changeset/mighty-coats-check.md +47 -0
  6. package/.changeset/pre.json +15 -1
  7. package/.changeset/rare-snakes-melt.md +24 -0
  8. package/.changeset/smooth-plums-shout.md +5 -0
  9. package/.changeset/spicy-drinks-camp.md +5 -0
  10. package/.changeset/swift-zoos-collect.md +19 -0
  11. package/.changeset/thick-tips-cry.md +9 -0
  12. package/.changeset/tough-timers-begin.md +8 -0
  13. package/.changeset/unlucky-rats-decide.md +5 -0
  14. package/.changeset/wet-forks-rhyme.md +5 -0
  15. package/.changeset/wise-news-grab.md +7 -0
  16. package/CHANGELOG.md +151 -4
  17. package/apollo-client.cjs +337 -88
  18. package/apollo-client.cjs.map +1 -1
  19. package/apollo-client.min.cjs +1 -1
  20. package/cache/cache.cjs +78 -6
  21. package/cache/cache.cjs.map +1 -1
  22. package/cache/cache.cjs.native.js +78 -6
  23. package/cache/core/cache.d.ts +9 -0
  24. package/cache/core/cache.js +11 -2
  25. package/cache/core/cache.js.map +1 -1
  26. package/cache/core/types/Cache.d.ts +7 -0
  27. package/cache/core/types/Cache.js.map +1 -1
  28. package/cache/core/types/DataProxy.d.ts +12 -0
  29. package/cache/core/types/DataProxy.js.map +1 -1
  30. package/cache/core/types/common.d.ts +4 -0
  31. package/cache/core/types/common.js.map +1 -1
  32. package/cache/inmemory/fragmentRegistry.js +19 -3
  33. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  34. package/cache/inmemory/inMemoryCache.d.ts +9 -0
  35. package/cache/inmemory/inMemoryCache.js +8 -2
  36. package/cache/inmemory/inMemoryCache.js.map +1 -1
  37. package/cache/inmemory/readFromStore.js +7 -3
  38. package/cache/inmemory/readFromStore.js.map +1 -1
  39. package/cache/inmemory/types.d.ts +18 -0
  40. package/cache/inmemory/types.js.map +1 -1
  41. package/core/ApolloClient.d.ts +82 -0
  42. package/core/ApolloClient.js +4 -0
  43. package/core/ApolloClient.js.map +1 -1
  44. package/core/ObservableQuery.d.ts +2 -0
  45. package/core/ObservableQuery.js +15 -5
  46. package/core/ObservableQuery.js.map +1 -1
  47. package/core/QueryInfo.d.ts +1 -0
  48. package/core/QueryInfo.js +4 -0
  49. package/core/QueryInfo.js.map +1 -1
  50. package/core/QueryManager.d.ts +1 -1
  51. package/core/QueryManager.js +15 -10
  52. package/core/QueryManager.js.map +1 -1
  53. package/core/core.cjs +107 -16
  54. package/core/core.cjs.map +1 -1
  55. package/core/core.cjs.native.js +107 -16
  56. package/core/watchQueryOptions.d.ts +20 -1
  57. package/core/watchQueryOptions.js.map +1 -1
  58. package/dev/dev.cjs +1 -1
  59. package/dev/dev.cjs.map +1 -1
  60. package/dev/dev.cjs.native.js +1 -1
  61. package/link/core/ApolloLink.d.ts +15 -0
  62. package/link/core/ApolloLink.js +8 -4
  63. package/link/core/ApolloLink.js.map +1 -1
  64. package/link/core/core.cjs +8 -4
  65. package/link/core/core.cjs.map +1 -1
  66. package/link/core/core.cjs.native.js +8 -4
  67. package/link/persisted-queries/index.d.ts +11 -1
  68. package/link/persisted-queries/index.js +28 -3
  69. package/link/persisted-queries/index.js.map +1 -1
  70. package/link/persisted-queries/persisted-queries.cjs +26 -3
  71. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  72. package/link/persisted-queries/persisted-queries.cjs.native.js +26 -3
  73. package/link/remove-typename/remove-typename.cjs +18 -2
  74. package/link/remove-typename/remove-typename.cjs.map +1 -1
  75. package/link/remove-typename/remove-typename.cjs.native.js +18 -2
  76. package/link/remove-typename/removeTypenameFromVariables.d.ts +9 -1
  77. package/link/remove-typename/removeTypenameFromVariables.js +19 -3
  78. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  79. package/link/retry/retry.cjs +15 -74
  80. package/link/retry/retry.cjs.map +1 -1
  81. package/link/retry/retry.cjs.native.js +15 -74
  82. package/link/retry/retryLink.js +15 -93
  83. package/link/retry/retryLink.js.map +1 -1
  84. package/package.json +21 -21
  85. package/react/components/Mutation.d.ts +6 -0
  86. package/react/components/Mutation.js +6 -0
  87. package/react/components/Mutation.js.map +1 -1
  88. package/react/components/Query.d.ts +6 -0
  89. package/react/components/Query.js +6 -0
  90. package/react/components/Query.js.map +1 -1
  91. package/react/components/Subscription.d.ts +6 -0
  92. package/react/components/Subscription.js +6 -0
  93. package/react/components/Subscription.js.map +1 -1
  94. package/react/components/components.cjs.map +1 -1
  95. package/react/hoc/graphql.d.ts +5 -0
  96. package/react/hoc/graphql.js +5 -0
  97. package/react/hoc/graphql.js.map +1 -1
  98. package/react/hoc/hoc.cjs.map +1 -1
  99. package/react/hoc/mutation-hoc.d.ts +5 -0
  100. package/react/hoc/mutation-hoc.js +5 -0
  101. package/react/hoc/mutation-hoc.js.map +1 -1
  102. package/react/hoc/query-hoc.d.ts +5 -0
  103. package/react/hoc/query-hoc.js +5 -0
  104. package/react/hoc/query-hoc.js.map +1 -1
  105. package/react/hoc/subscription-hoc.d.ts +5 -0
  106. package/react/hoc/subscription-hoc.js +5 -0
  107. package/react/hoc/subscription-hoc.js.map +1 -1
  108. package/react/hoc/withApollo.d.ts +5 -0
  109. package/react/hoc/withApollo.js +5 -0
  110. package/react/hoc/withApollo.js.map +1 -1
  111. package/react/hooks/hooks.cjs +48 -257
  112. package/react/hooks/hooks.cjs.map +1 -1
  113. package/react/hooks/hooks.cjs.native.js +48 -257
  114. package/react/hooks/index.d.ts +2 -0
  115. package/react/hooks/index.js +1 -0
  116. package/react/hooks/index.js.map +1 -1
  117. package/react/hooks/useBackgroundQuery.d.ts +13 -10
  118. package/react/hooks/useBackgroundQuery.js +2 -4
  119. package/react/hooks/useBackgroundQuery.js.map +1 -1
  120. package/react/hooks/useLoadableQuery.d.ts +2 -2
  121. package/react/hooks/useLoadableQuery.js +2 -4
  122. package/react/hooks/useLoadableQuery.js.map +1 -1
  123. package/react/hooks/useQueryRefHandlers.d.ts +35 -0
  124. package/react/hooks/useQueryRefHandlers.js +48 -0
  125. package/react/hooks/useQueryRefHandlers.js.map +1 -0
  126. package/react/hooks/useReadQuery.d.ts +1 -1
  127. package/react/hooks/useReadQuery.js +8 -2
  128. package/react/hooks/useReadQuery.js.map +1 -1
  129. package/react/hooks/useSuspenseQuery.js +1 -1
  130. package/react/hooks/useSuspenseQuery.js.map +1 -1
  131. package/react/index.d.ts +2 -0
  132. package/react/index.js +1 -0
  133. package/react/index.js.map +1 -1
  134. package/react/{cache → internal/cache}/QueryReference.d.ts +13 -7
  135. package/react/{cache → internal/cache}/QueryReference.js +93 -57
  136. package/react/internal/cache/QueryReference.js.map +1 -0
  137. package/react/{cache → internal/cache}/SuspenseCache.d.ts +1 -1
  138. package/react/{cache → internal/cache}/SuspenseCache.js +1 -1
  139. package/react/internal/cache/SuspenseCache.js.map +1 -0
  140. package/react/{cache → internal/cache}/getSuspenseCache.d.ts +3 -3
  141. package/react/internal/cache/getSuspenseCache.js.map +1 -0
  142. package/react/internal/cache/types.js.map +1 -0
  143. package/react/internal/index.d.ts +6 -0
  144. package/react/internal/index.js +3 -0
  145. package/react/internal/index.js.map +1 -0
  146. package/react/internal/internal.cjs +283 -0
  147. package/react/internal/internal.cjs.map +1 -0
  148. package/react/internal/internal.cjs.native.js +283 -0
  149. package/react/internal/package.json +8 -0
  150. package/react/parser/index.js +6 -3
  151. package/react/parser/index.js.map +1 -1
  152. package/react/parser/parser.cjs +11 -3
  153. package/react/parser/parser.cjs.map +1 -1
  154. package/react/parser/parser.cjs.native.js +11 -3
  155. package/react/query-preloader/createQueryPreloader.d.ts +253 -0
  156. package/react/query-preloader/createQueryPreloader.js +29 -0
  157. package/react/query-preloader/createQueryPreloader.js.map +1 -0
  158. package/react/react.cjs +14 -2
  159. package/react/react.cjs.map +1 -1
  160. package/react/react.cjs.native.js +14 -2
  161. package/react/types/types.d.ts +7 -1
  162. package/react/types/types.js.map +1 -1
  163. package/testing/internal/ObservableStream.js +16 -8
  164. package/testing/internal/ObservableStream.js.map +1 -1
  165. package/testing/internal/index.d.ts +4 -0
  166. package/testing/internal/index.js +2 -0
  167. package/testing/internal/index.js.map +1 -1
  168. package/testing/internal/renderHelpers.d.ts +12 -0
  169. package/testing/internal/renderHelpers.js +22 -0
  170. package/testing/internal/renderHelpers.js.map +1 -0
  171. package/testing/internal/scenarios/index.d.ts +41 -0
  172. package/testing/internal/scenarios/index.js +48 -0
  173. package/testing/internal/scenarios/index.js.map +1 -0
  174. package/testing/matchers/index.js +2 -0
  175. package/testing/matchers/index.js.map +1 -1
  176. package/testing/matchers/toBeDisposed.d.ts +3 -0
  177. package/testing/matchers/toBeDisposed.js +26 -0
  178. package/testing/matchers/toBeDisposed.js.map +1 -0
  179. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +1 -1
  180. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
  181. package/utilities/caching/caches.d.ts +34 -0
  182. package/utilities/caching/caches.js +64 -0
  183. package/utilities/caching/caches.js.map +1 -0
  184. package/utilities/caching/getMemoryInternals.d.ts +76 -0
  185. package/utilities/caching/getMemoryInternals.js +112 -0
  186. package/utilities/caching/getMemoryInternals.js.map +1 -0
  187. package/utilities/caching/index.d.ts +4 -0
  188. package/utilities/caching/index.js +3 -0
  189. package/utilities/caching/index.js.map +1 -0
  190. package/utilities/caching/sizes.d.ts +311 -0
  191. package/utilities/caching/sizes.js +27 -0
  192. package/utilities/caching/sizes.js.map +1 -0
  193. package/utilities/common/canUse.js +1 -1
  194. package/utilities/common/canUse.js.map +1 -1
  195. package/utilities/common/canonicalStringify.js +8 -2
  196. package/utilities/common/canonicalStringify.js.map +1 -1
  197. package/utilities/globals/globals.cjs +1 -1
  198. package/utilities/globals/globals.cjs.map +1 -1
  199. package/utilities/globals/globals.cjs.native.js +1 -1
  200. package/utilities/graphql/DocumentTransform.d.ts +14 -1
  201. package/utilities/graphql/DocumentTransform.js +9 -5
  202. package/utilities/graphql/DocumentTransform.js.map +1 -1
  203. package/utilities/graphql/print.js +6 -2
  204. package/utilities/graphql/print.js.map +1 -1
  205. package/utilities/index.d.ts +2 -0
  206. package/utilities/index.js +1 -0
  207. package/utilities/index.js.map +1 -1
  208. package/utilities/utilities.cjs +57 -9
  209. package/utilities/utilities.cjs.map +1 -1
  210. package/utilities/utilities.cjs.native.js +57 -9
  211. package/version.js +1 -1
  212. package/react/cache/QueryReference.js.map +0 -1
  213. package/react/cache/SuspenseCache.js.map +0 -1
  214. package/react/cache/getSuspenseCache.js.map +0 -1
  215. package/react/cache/index.d.ts +0 -3
  216. package/react/cache/index.js +0 -2
  217. package/react/cache/index.js.map +0 -1
  218. package/react/cache/types.js.map +0 -1
  219. /package/react/{cache → internal/cache}/getSuspenseCache.js +0 -0
  220. /package/react/{cache → internal/cache}/types.d.ts +0 -0
  221. /package/react/{cache → internal/cache}/types.js +0 -0
package/core/core.cjs CHANGED
@@ -7,7 +7,6 @@ var globals = require('../utilities/globals');
7
7
  var core = require('../link/core');
8
8
  var http = require('../link/http');
9
9
  var equal = require('@wry/equality');
10
- var caches = require('@wry/caches');
11
10
  var utilities = require('../utilities');
12
11
  var cache = require('../cache');
13
12
  var errors = require('../errors');
@@ -21,7 +20,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
20
 
22
21
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
23
22
 
24
- var version = "3.9.0-alpha.5";
23
+ var version = "3.9.0-beta.1";
25
24
 
26
25
  function isNonNullObject(obj) {
27
26
  return obj !== null && typeof obj === "object";
@@ -276,6 +275,9 @@ var ObservableQuery = (function (_super) {
276
275
  var subscription = _this.subscribe(observer);
277
276
  });
278
277
  };
278
+ ObservableQuery.prototype.resetDiff = function () {
279
+ this.queryInfo.resetDiff();
280
+ };
279
281
  ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {
280
282
  if (saveAsLastResult === void 0) { saveAsLastResult = true; }
281
283
  var lastResult = this.getLastResult(true);
@@ -576,8 +578,10 @@ var ObservableQuery = (function (_super) {
576
578
  var info = pollingInfo || (this.pollingInfo = {});
577
579
  info.interval = pollInterval;
578
580
  var maybeFetch = function () {
581
+ var _a, _b;
579
582
  if (_this.pollingInfo) {
580
- if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
583
+ if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) &&
584
+ !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) {
581
585
  _this.reobserve({
582
586
  fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ?
583
587
  "no-cache"
@@ -646,12 +650,16 @@ var ObservableQuery = (function (_super) {
646
650
  var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;
647
651
  var observer = {
648
652
  next: function (result) {
649
- finishWaitingForOwnResult();
650
- _this.reportResult(result, variables);
653
+ if (equal.equal(_this.variables, variables)) {
654
+ finishWaitingForOwnResult();
655
+ _this.reportResult(result, variables);
656
+ }
651
657
  },
652
658
  error: function (error) {
653
- finishWaitingForOwnResult();
654
- _this.reportError(error, variables);
659
+ if (equal.equal(_this.variables, variables)) {
660
+ finishWaitingForOwnResult();
661
+ _this.reportError(error, variables);
662
+ }
655
663
  },
656
664
  };
657
665
  if (!useDisposableConcast && (fromLink || !this.concast)) {
@@ -1130,6 +1138,9 @@ var QueryInfo = (function () {
1130
1138
  cancelNotifyTimeout(this);
1131
1139
  this.dirty = false;
1132
1140
  };
1141
+ QueryInfo.prototype.resetDiff = function () {
1142
+ this.lastDiff = void 0;
1143
+ };
1133
1144
  QueryInfo.prototype.getDiff = function () {
1134
1145
  var options = this.getDiffOptions();
1135
1146
  if (this.lastDiff && equal.equal(options, this.lastDiff.options)) {
@@ -1338,6 +1349,7 @@ function shouldWriteResult(result, errorPolicy) {
1338
1349
  }
1339
1350
 
1340
1351
  var hasOwnProperty = Object.prototype.hasOwnProperty;
1352
+ var IGNORE = Object.create(null);
1341
1353
  var QueryManager = (function () {
1342
1354
  function QueryManager(_a) {
1343
1355
  var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext;
@@ -1345,7 +1357,8 @@ var QueryManager = (function () {
1345
1357
  this.clientAwareness = {};
1346
1358
  this.queries = new Map();
1347
1359
  this.fetchCancelFns = new Map();
1348
- this.transformCache = new caches.WeakCache( );
1360
+ this.transformCache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes["queryManager.getDocumentInfo"] ||
1361
+ 2000 );
1349
1362
  this.queryIdCounter = 1;
1350
1363
  this.requestIdCounter = 1;
1351
1364
  this.mutationIdCounter = 1;
@@ -1391,7 +1404,7 @@ var QueryManager = (function () {
1391
1404
  var _b, _c;
1392
1405
  var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context;
1393
1406
  return tslib.__awaiter(this, void 0, void 0, function () {
1394
- var mutationId, hasClientExports, mutationStoreValue, self;
1407
+ var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self;
1395
1408
  return tslib.__generator(this, function (_h) {
1396
1409
  switch (_h.label) {
1397
1410
  case 0:
@@ -1414,7 +1427,7 @@ var QueryManager = (function () {
1414
1427
  loading: true,
1415
1428
  error: null,
1416
1429
  });
1417
- if (optimisticResponse) {
1430
+ isOptimistic = optimisticResponse &&
1418
1431
  this.markMutationOptimistic(optimisticResponse, {
1419
1432
  mutationId: mutationId,
1420
1433
  document: mutation,
@@ -1426,11 +1439,10 @@ var QueryManager = (function () {
1426
1439
  update: updateWithProxyFn,
1427
1440
  keepRootFields: keepRootFields,
1428
1441
  });
1429
- }
1430
1442
  this.broadcastQueries();
1431
1443
  self = this;
1432
1444
  return [2 , new Promise(function (resolve, reject) {
1433
- return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
1445
+ return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) {
1434
1446
  if (utilities.graphQLResultHasError(result) && errorPolicy === "none") {
1435
1447
  throw new errors.ApolloError({
1436
1448
  graphQLErrors: utilities.getGraphQLErrorsFromResult(result),
@@ -1459,7 +1471,7 @@ var QueryManager = (function () {
1459
1471
  updateQueries: updateQueries,
1460
1472
  awaitRefetchQueries: awaitRefetchQueries,
1461
1473
  refetchQueries: refetchQueries,
1462
- removeOptimistic: optimisticResponse ? mutationId : void 0,
1474
+ removeOptimistic: isOptimistic ? mutationId : void 0,
1463
1475
  onQueryUpdated: onQueryUpdated,
1464
1476
  keepRootFields: keepRootFields,
1465
1477
  });
@@ -1475,7 +1487,7 @@ var QueryManager = (function () {
1475
1487
  mutationStoreValue.loading = false;
1476
1488
  mutationStoreValue.error = err;
1477
1489
  }
1478
- if (optimisticResponse) {
1490
+ if (isOptimistic) {
1479
1491
  self.cache.removeOptimistic(mutationId);
1480
1492
  }
1481
1493
  self.broadcastQueries();
@@ -1625,9 +1637,12 @@ var QueryManager = (function () {
1625
1637
  QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
1626
1638
  var _this = this;
1627
1639
  var data = typeof optimisticResponse === "function" ?
1628
- optimisticResponse(mutation.variables)
1640
+ optimisticResponse(mutation.variables, { IGNORE: IGNORE })
1629
1641
  : optimisticResponse;
1630
- return this.cache.recordOptimisticTransaction(function (cache) {
1642
+ if (data === IGNORE) {
1643
+ return false;
1644
+ }
1645
+ this.cache.recordOptimisticTransaction(function (cache) {
1631
1646
  try {
1632
1647
  _this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache);
1633
1648
  }
@@ -1635,6 +1650,7 @@ var QueryManager = (function () {
1635
1650
  globalThis.__DEV__ !== false && globals.invariant.error(error);
1636
1651
  }
1637
1652
  }, mutation.mutationId);
1653
+ return true;
1638
1654
  };
1639
1655
  QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {
1640
1656
  return this.fetchConcastWithInfo(queryId, options, networkStatus).concast
@@ -2246,6 +2262,78 @@ var QueryManager = (function () {
2246
2262
  return QueryManager;
2247
2263
  }());
2248
2264
 
2265
+ var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
2266
+ var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]);
2267
+
2268
+ var globalCaches = {};
2269
+ var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?
2270
+ _getApolloClientMemoryInternals
2271
+ : undefined;
2272
+ function getCurrentCacheSizes() {
2273
+ var defaults = {
2274
+ parser: 1000 ,
2275
+ canonicalStringify: 1000 ,
2276
+ print: 2000 ,
2277
+ "documentTransform.cache": 2000 ,
2278
+ "queryManager.getDocumentInfo": 2000 ,
2279
+ "PersistedQueryLink.persistedQueryHashes": 2000 ,
2280
+ "fragmentRegistry.transform": 2000 ,
2281
+ "fragmentRegistry.lookup": 1000 ,
2282
+ "fragmentRegistry.findFragmentSpreads": 4000 ,
2283
+ "cache.fragmentQueryDocuments": 1000 ,
2284
+ "removeTypenameFromVariables.getVariableDefinitions": 2000 ,
2285
+ "inMemoryCache.maybeBroadcastWatch": 5000 ,
2286
+ "inMemoryCache.executeSelectionSet": 10000 ,
2287
+ "inMemoryCache.executeSubSelectedArray": 5000 ,
2288
+ };
2289
+ return Object.fromEntries(Object.entries(defaults).map(function (_a) {
2290
+ var k = _a[0], v = _a[1];
2291
+ return [
2292
+ k,
2293
+ cacheSizes[k] || v,
2294
+ ];
2295
+ }));
2296
+ }
2297
+ function _getApolloClientMemoryInternals() {
2298
+ var _a, _b, _c, _d, _e;
2299
+ if (!(globalThis.__DEV__ !== false))
2300
+ throw new Error("only supported in development mode");
2301
+ return {
2302
+ limits: getCurrentCacheSizes(),
2303
+ sizes: tslib.__assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {
2304
+ getDocumentInfo: this["queryManager"]["transformCache"].size,
2305
+ documentTransforms: transformInfo(this["queryManager"].documentTransform),
2306
+ } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),
2307
+ };
2308
+ }
2309
+ function isWrapper(f) {
2310
+ return !!f && "dirtyKey" in f;
2311
+ }
2312
+ function getWrapperInformation(f) {
2313
+ return isWrapper(f) ? f.size : undefined;
2314
+ }
2315
+ function isDefined(value) {
2316
+ return value != null;
2317
+ }
2318
+ function transformInfo(transform) {
2319
+ return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });
2320
+ }
2321
+ function recurseTransformInfo(transform) {
2322
+ return transform ?
2323
+ tslib.__spreadArray(tslib.__spreadArray([
2324
+ getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"])
2325
+ ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined)
2326
+ : [];
2327
+ }
2328
+ function linkInfo(link) {
2329
+ var _a;
2330
+ return link ?
2331
+ tslib.__spreadArray(tslib.__spreadArray([
2332
+ (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)
2333
+ ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)
2334
+ : [];
2335
+ }
2336
+
2249
2337
  var hasSuggestedDevtools = false;
2250
2338
  var ApolloClient = (function () {
2251
2339
  function ApolloClient(options) {
@@ -2511,6 +2599,9 @@ var ApolloClient = (function () {
2511
2599
  });
2512
2600
  return ApolloClient;
2513
2601
  }());
2602
+ if (globalThis.__DEV__ !== false) {
2603
+ ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;
2604
+ }
2514
2605
 
2515
2606
  tsInvariant.setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
2516
2607