@apollo/client 3.14.0-rc.0 → 3.14.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 (134) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/apollo-client.cjs +85 -77
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +14 -41
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/cache.cjs.native.js +14 -41
  8. package/cache/core/cache.js +1 -1
  9. package/cache/core/cache.js.map +1 -1
  10. package/cache/inmemory/inMemoryCache.js +1 -1
  11. package/cache/inmemory/inMemoryCache.js.map +1 -1
  12. package/core/ApolloClient.js +1 -1
  13. package/core/ApolloClient.js.map +1 -1
  14. package/core/ObservableQuery.d.ts +1 -0
  15. package/core/ObservableQuery.js +10 -6
  16. package/core/ObservableQuery.js.map +1 -1
  17. package/core/QueryInfo.js +1 -1
  18. package/core/QueryInfo.js.map +1 -1
  19. package/core/QueryManager.js +1 -1
  20. package/core/QueryManager.js.map +1 -1
  21. package/core/core.cjs +38 -61
  22. package/core/core.cjs.map +1 -1
  23. package/core/core.cjs.native.js +38 -61
  24. package/dev/dev.cjs +49 -53
  25. package/dev/dev.cjs.map +1 -1
  26. package/dev/dev.cjs.native.js +49 -53
  27. package/invariantErrorCodes.js +48 -53
  28. package/link/core/ApolloLink.js +1 -1
  29. package/link/core/ApolloLink.js.map +1 -1
  30. package/link/core/core.cjs +1 -15
  31. package/link/core/core.cjs.map +1 -1
  32. package/link/core/core.cjs.native.js +1 -15
  33. package/package.json +1 -1
  34. package/react/components/components.cjs +2 -14
  35. package/react/components/components.cjs.map +1 -1
  36. package/react/components/components.cjs.native.js +2 -14
  37. package/react/hoc/graphql.js +1 -1
  38. package/react/hoc/graphql.js.map +1 -1
  39. package/react/hoc/hoc.cjs +12 -31
  40. package/react/hoc/hoc.cjs.map +1 -1
  41. package/react/hoc/hoc.cjs.native.js +12 -31
  42. package/react/hoc/mutation-hoc.js +1 -1
  43. package/react/hoc/mutation-hoc.js.map +1 -1
  44. package/react/hoc/query-hoc.js +1 -1
  45. package/react/hoc/query-hoc.js.map +1 -1
  46. package/react/hoc/subscription-hoc.js +1 -1
  47. package/react/hoc/subscription-hoc.js.map +1 -1
  48. package/react/hooks/hooks.cjs +26 -52
  49. package/react/hooks/hooks.cjs.map +1 -1
  50. package/react/hooks/hooks.cjs.native.js +26 -52
  51. package/react/hooks/internal/useWarnRemoved.d.ts +1 -1
  52. package/react/hooks/internal/useWarnRemoved.js +1 -1
  53. package/react/hooks/internal/useWarnRemoved.js.map +1 -1
  54. package/react/hooks/internal/useWarnRemovedOption.d.ts +2 -1
  55. package/react/hooks/internal/useWarnRemovedOption.js +7 -5
  56. package/react/hooks/internal/useWarnRemovedOption.js.map +1 -1
  57. package/react/hooks/useApolloClient.js +1 -1
  58. package/react/hooks/useBackgroundQuery.js +1 -1
  59. package/react/hooks/useBackgroundQuery.js.map +1 -1
  60. package/react/hooks/useFragment.js +1 -1
  61. package/react/hooks/useFragment.js.map +1 -1
  62. package/react/hooks/useLazyQuery.js +3 -3
  63. package/react/hooks/useLazyQuery.js.map +1 -1
  64. package/react/hooks/useLoadableQuery.js +3 -3
  65. package/react/hooks/useLoadableQuery.js.map +1 -1
  66. package/react/hooks/useQuery.js +3 -3
  67. package/react/hooks/useQuery.js.map +1 -1
  68. package/react/hooks/useSubscription.js +3 -3
  69. package/react/hooks/useSuspenseQuery.js +3 -3
  70. package/react/hooks/useSuspenseQuery.js.map +1 -1
  71. package/react/hooks/useSyncExternalStore.js +1 -1
  72. package/react/internal/cache/QueryReference.js +2 -2
  73. package/react/internal/cache/QueryReference.js.map +1 -1
  74. package/react/internal/internal.cjs +3 -14
  75. package/react/internal/internal.cjs.map +1 -1
  76. package/react/internal/internal.cjs.native.js +3 -14
  77. package/react/parser/index.js +7 -7
  78. package/react/parser/index.js.map +1 -1
  79. package/react/parser/parser.cjs +9 -29
  80. package/react/parser/parser.cjs.map +1 -1
  81. package/react/parser/parser.cjs.native.js +9 -29
  82. package/react/query-preloader/createQueryPreloader.js +1 -1
  83. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  84. package/react/react.cjs +4 -31
  85. package/react/react.cjs.map +1 -1
  86. package/react/react.cjs.native.js +4 -31
  87. package/testing/core/core.cjs +4 -4
  88. package/testing/core/core.cjs.map +1 -1
  89. package/testing/core/core.cjs.native.js +4 -4
  90. package/testing/core/mocking/mockLink.d.ts +13 -0
  91. package/testing/core/mocking/mockLink.js +4 -4
  92. package/testing/core/mocking/mockLink.js.map +1 -1
  93. package/testing/internal/disposables/index.d.ts +1 -0
  94. package/testing/internal/disposables/index.js +1 -0
  95. package/testing/internal/disposables/index.js.map +1 -1
  96. package/testing/internal/disposables/withMutedDeprecations.d.ts +4 -0
  97. package/testing/internal/disposables/withMutedDeprecations.js +13 -0
  98. package/testing/internal/disposables/withMutedDeprecations.js.map +1 -0
  99. package/testing/react/MockedProvider.js +1 -1
  100. package/testing/react/MockedProvider.js.map +1 -1
  101. package/testing/testing.cjs +5 -32
  102. package/testing/testing.cjs.map +1 -1
  103. package/testing/testing.cjs.native.js +5 -32
  104. package/utilities/deprecation/index.d.ts +0 -3
  105. package/utilities/deprecation/index.js +4 -12
  106. package/utilities/deprecation/index.js.map +1 -1
  107. package/utilities/globals/globals.cjs +1 -1
  108. package/utilities/globals/globals.cjs.map +1 -1
  109. package/utilities/globals/globals.cjs.native.js +1 -1
  110. package/utilities/graphql/DocumentTransform.js +1 -1
  111. package/utilities/graphql/directives.js +7 -7
  112. package/utilities/graphql/fragments.js +3 -3
  113. package/utilities/graphql/getFromAST.js +8 -8
  114. package/utilities/graphql/storeUtils.js +1 -1
  115. package/utilities/graphql/transform.js +2 -2
  116. package/utilities/index.d.ts +2 -0
  117. package/utilities/index.js +1 -0
  118. package/utilities/index.js.map +1 -1
  119. package/utilities/utilities.cjs +54 -22
  120. package/utilities/utilities.cjs.map +1 -1
  121. package/utilities/utilities.cjs.native.js +54 -22
  122. package/version.js +1 -1
  123. package/.changeset/breezy-lions-rule.md +0 -5
  124. package/.changeset/chilled-cameras-scream.md +0 -5
  125. package/.changeset/great-jobs-fetch.md +0 -5
  126. package/.changeset/great-suns-cover.md +0 -5
  127. package/.changeset/perfect-donuts-roll.md +0 -5
  128. package/.changeset/popular-waves-drop.md +0 -5
  129. package/.changeset/pre.json +0 -20
  130. package/.changeset/shy-boxes-exercise.md +0 -5
  131. package/.changeset/shy-dragons-tease.md +0 -5
  132. package/.changeset/smooth-countries-cough.md +0 -5
  133. package/.changeset/spotty-walls-repair.md +0 -5
  134. package/.changeset/tidy-bulldogs-exercise.md +0 -5
package/cache/cache.cjs CHANGED
@@ -127,33 +127,6 @@ function directiveIsNonreactive(dir) {
127
127
  return dir.name.value === "nonreactive";
128
128
  }
129
129
 
130
- var muteAllDeprecations = Symbol.for("apollo.deprecations");
131
- var global = globals.global;
132
- var slot = new optimism.Slot();
133
- function isMuted(name) {
134
- return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
135
- }
136
- function muteDeprecations(name) {
137
- var args = [];
138
- for (var _i = 1; _i < arguments.length; _i++) {
139
- args[_i - 1] = arguments[_i];
140
- }
141
- return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
142
- }
143
- function warnRemovedOption(options, name, callSite, recommendation) {
144
- if (recommendation === void 0) { recommendation = "Please remove this option."; }
145
- warnDeprecated(name, function () {
146
- if (name in options) {
147
- globalThis.__DEV__ !== false && globals.invariant.warn(104, callSite, name, recommendation);
148
- }
149
- });
150
- }
151
- function warnDeprecated(name, cb) {
152
- if (!isMuted(name)) {
153
- cb();
154
- }
155
- }
156
-
157
130
  var ApolloCache = (function () {
158
131
  function ApolloCache() {
159
132
  this.assumeImmutableResults = false;
@@ -197,9 +170,9 @@ var ApolloCache = (function () {
197
170
  var _this = this;
198
171
  if (optimistic === void 0) { optimistic = !!options.optimistic; }
199
172
  if (globalThis.__DEV__ !== false) {
200
- warnRemovedOption(options, "canonizeResults", "cache.readQuery");
173
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.readQuery");
201
174
  }
202
- return muteDeprecations("canonizeResults", function () {
175
+ return utilities.muteDeprecations("canonizeResults", function () {
203
176
  return _this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic }));
204
177
  });
205
178
  };
@@ -246,9 +219,9 @@ var ApolloCache = (function () {
246
219
  var _this = this;
247
220
  if (optimistic === void 0) { optimistic = !!options.optimistic; }
248
221
  if (globalThis.__DEV__ !== false) {
249
- warnRemovedOption(options, "canonizeResults", "cache.readFragment");
222
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.readFragment");
250
223
  }
251
- return muteDeprecations("canonizeResults", function () {
224
+ return utilities.muteDeprecations("canonizeResults", function () {
252
225
  return _this.read(tslib.__assign(tslib.__assign({}, options), { query: _this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));
253
226
  });
254
227
  };
@@ -269,11 +242,11 @@ var ApolloCache = (function () {
269
242
  };
270
243
  ApolloCache.prototype.updateQuery = function (options, update) {
271
244
  if (globalThis.__DEV__ !== false) {
272
- warnRemovedOption(options, "canonizeResults", "cache.updateQuery");
245
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.updateQuery");
273
246
  }
274
247
  return this.batch({
275
248
  update: function (cache) {
276
- var value = muteDeprecations("canonizeResults", function () {
249
+ var value = utilities.muteDeprecations("canonizeResults", function () {
277
250
  return cache.readQuery(options);
278
251
  });
279
252
  var data = update(value);
@@ -286,11 +259,11 @@ var ApolloCache = (function () {
286
259
  };
287
260
  ApolloCache.prototype.updateFragment = function (options, update) {
288
261
  if (globalThis.__DEV__ !== false) {
289
- warnRemovedOption(options, "canonizeResults", "cache.updateFragment");
262
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.updateFragment");
290
263
  }
291
264
  return this.batch({
292
265
  update: function (cache) {
293
- var value = muteDeprecations("canonizeResults", function () {
266
+ var value = utilities.muteDeprecations("canonizeResults", function () {
294
267
  return cache.readFragment(options);
295
268
  });
296
269
  var data = update(value);
@@ -2306,8 +2279,8 @@ var InMemoryCache = (function (_super) {
2306
2279
  _this.makeVar = makeVar;
2307
2280
  _this.txCount = 0;
2308
2281
  if (globalThis.__DEV__ !== false) {
2309
- warnRemovedOption(config, "addTypename", "InMemoryCache", "Please remove the `addTypename` option when initializing `InMemoryCache`.");
2310
- warnRemovedOption(config, "canonizeResults", "InMemoryCache", "Please remove the `canonizeResults` option when initializing `InMemoryCache`.");
2282
+ utilities.warnRemovedOption(config, "addTypename", "InMemoryCache", "Please remove the `addTypename` option when initializing `InMemoryCache`.");
2283
+ utilities.warnRemovedOption(config, "canonizeResults", "InMemoryCache", "Please remove the `canonizeResults` option when initializing `InMemoryCache`.");
2311
2284
  }
2312
2285
  _this.config = normalizeConfig(config);
2313
2286
  _this.addTypename = !!_this.config.addTypename;
@@ -2373,7 +2346,7 @@ var InMemoryCache = (function (_super) {
2373
2346
  };
2374
2347
  InMemoryCache.prototype.read = function (options) {
2375
2348
  if (globalThis.__DEV__ !== false) {
2376
- warnRemovedOption(options, "canonizeResults", "cache.read");
2349
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.read");
2377
2350
  }
2378
2351
  var
2379
2352
  _a = options.returnPartialData,
@@ -2419,7 +2392,7 @@ var InMemoryCache = (function (_super) {
2419
2392
  };
2420
2393
  InMemoryCache.prototype.diff = function (options) {
2421
2394
  if (globalThis.__DEV__ !== false) {
2422
- warnRemovedOption(options, "canonizeResults", "cache.diff");
2395
+ utilities.warnRemovedOption(options, "canonizeResults", "cache.diff");
2423
2396
  }
2424
2397
  return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config }));
2425
2398
  };
@@ -2441,7 +2414,7 @@ var InMemoryCache = (function (_super) {
2441
2414
  };
2442
2415
  InMemoryCache.prototype.gc = function (options) {
2443
2416
  if (globalThis.__DEV__ !== false) {
2444
- warnRemovedOption(options || {}, "resetResultIdentities", "cache.gc", "First ensure all usages of `canonizeResults` are removed, then remove this option.");
2417
+ utilities.warnRemovedOption(options || {}, "resetResultIdentities", "cache.gc", "First ensure all usages of `canonizeResults` are removed, then remove this option.");
2445
2418
  }
2446
2419
  utilities.canonicalStringify.reset();
2447
2420
  utilities.print.reset();
@@ -2600,7 +2573,7 @@ var InMemoryCache = (function (_super) {
2600
2573
  InMemoryCache.prototype.broadcastWatch = function (c, options) {
2601
2574
  var _this = this;
2602
2575
  var lastDiff = c.lastDiff;
2603
- var diff = muteDeprecations("canonizeResults", function () { return _this.diff(c); });
2576
+ var diff = utilities.muteDeprecations("canonizeResults", function () { return _this.diff(c); });
2604
2577
  if (options) {
2605
2578
  if (c.optimistic && typeof options.optimistic === "string") {
2606
2579
  diff.fromOptimisticTransaction = true;