@apollo/client 3.9.0-alpha.0 → 3.9.0-alpha.2

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 (104) hide show
  1. package/apollo-client.cjs +116 -136
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +6 -29
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +6 -29
  7. package/cache/index.d.ts +1 -2
  8. package/cache/index.d.ts.map +1 -1
  9. package/cache/index.js +1 -2
  10. package/cache/index.js.map +1 -1
  11. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  12. package/cache/inmemory/inMemoryCache.js +1 -2
  13. package/cache/inmemory/inMemoryCache.js.map +1 -1
  14. package/cache/inmemory/object-canon.d.ts +0 -5
  15. package/cache/inmemory/object-canon.d.ts.map +1 -1
  16. package/cache/inmemory/object-canon.js +0 -22
  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 +0 -2
  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 +2 -2
  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 -2
  26. package/cache/inmemory/writeToStore.js.map +1 -1
  27. package/core/ObservableQuery.d.ts.map +1 -1
  28. package/core/ObservableQuery.js +5 -6
  29. package/core/ObservableQuery.js.map +1 -1
  30. package/core/QueryInfo.d.ts +0 -2
  31. package/core/QueryInfo.d.ts.map +1 -1
  32. package/core/QueryInfo.js +0 -2
  33. package/core/QueryInfo.js.map +1 -1
  34. package/core/QueryManager.js +2 -2
  35. package/core/QueryManager.js.map +1 -1
  36. package/core/core.cjs +8 -11
  37. package/core/core.cjs.map +1 -1
  38. package/core/core.cjs.native.js +8 -11
  39. package/dev/dev.cjs +52 -37
  40. package/dev/dev.cjs.map +1 -1
  41. package/dev/dev.cjs.native.js +52 -37
  42. package/dev/loadErrorMessageHandler.js +1 -1
  43. package/dev/loadErrorMessageHandler.js.map +1 -1
  44. package/invariantErrorCodes.js +24 -18
  45. package/package.json +7 -7
  46. package/react/cache/index.d.ts +0 -4
  47. package/react/cache/index.d.ts.map +1 -1
  48. package/react/cache/index.js +0 -14
  49. package/react/cache/index.js.map +1 -1
  50. package/react/index.d.ts +0 -1
  51. package/react/index.d.ts.map +1 -1
  52. package/react/index.js +0 -1
  53. package/react/index.js.map +1 -1
  54. package/react/react.cjs +1 -218
  55. package/react/react.cjs.map +1 -1
  56. package/react/react.cjs.native.js +1 -218
  57. package/react/types/types.d.ts +0 -3
  58. package/react/types/types.d.ts.map +1 -1
  59. package/react/types/types.js.map +1 -1
  60. package/testing/core/core.cjs +9 -1
  61. package/testing/core/core.cjs.map +1 -1
  62. package/testing/core/core.cjs.native.js +9 -1
  63. package/testing/core/mocking/mockLink.d.ts +1 -0
  64. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  65. package/testing/core/mocking/mockLink.js +9 -1
  66. package/testing/core/mocking/mockLink.js.map +1 -1
  67. package/testing/internal/ObservableStream.d.ts +26 -0
  68. package/testing/internal/ObservableStream.d.ts.map +1 -0
  69. package/testing/internal/ObservableStream.js +101 -0
  70. package/testing/internal/ObservableStream.js.map +1 -0
  71. package/testing/internal/index.d.ts +1 -0
  72. package/testing/internal/index.d.ts.map +1 -1
  73. package/testing/internal/index.js +1 -0
  74. package/testing/internal/index.js.map +1 -1
  75. package/utilities/common/canonicalStringify.d.ts +4 -0
  76. package/utilities/common/canonicalStringify.d.ts.map +1 -0
  77. package/utilities/common/canonicalStringify.js +37 -0
  78. package/utilities/common/canonicalStringify.js.map +1 -0
  79. package/utilities/globals/globals.cjs +29 -19
  80. package/utilities/globals/globals.cjs.map +1 -1
  81. package/utilities/globals/globals.cjs.native.js +29 -19
  82. package/utilities/globals/invariantWrappers.d.ts.map +1 -1
  83. package/utilities/globals/invariantWrappers.js +28 -18
  84. package/utilities/globals/invariantWrappers.js.map +1 -1
  85. package/utilities/graphql/DocumentTransform.js +1 -1
  86. package/utilities/graphql/directives.js +4 -4
  87. package/utilities/graphql/fragments.js +3 -3
  88. package/utilities/graphql/getFromAST.js +8 -8
  89. package/utilities/graphql/storeUtils.d.ts +2 -2
  90. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  91. package/utilities/graphql/storeUtils.js +8 -20
  92. package/utilities/graphql/storeUtils.js.map +1 -1
  93. package/utilities/graphql/transform.js +2 -2
  94. package/utilities/index.d.ts +1 -0
  95. package/utilities/index.d.ts.map +1 -1
  96. package/utilities/index.js +1 -0
  97. package/utilities/index.js.map +1 -1
  98. package/utilities/observables/asyncMap.d.ts.map +1 -1
  99. package/utilities/observables/asyncMap.js +17 -34
  100. package/utilities/observables/asyncMap.js.map +1 -1
  101. package/utilities/utilities.cjs +80 -72
  102. package/utilities/utilities.cjs.map +1 -1
  103. package/utilities/utilities.cjs.native.js +80 -72
  104. package/version.js +1 -1
package/apollo-client.cjs CHANGED
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
31
31
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
32
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
33
 
34
- var version = "3.9.0-alpha.0";
34
+ var version = "3.9.0-alpha.2";
35
35
 
36
36
  function maybe(thunk) {
37
37
  try {
@@ -71,11 +71,14 @@ function wrap(fn) {
71
71
  args[_i - 1] = arguments[_i];
72
72
  }
73
73
  if (typeof message === "number") {
74
- fn(getErrorMsg(message, args));
75
- }
76
- else {
77
- fn.apply(void 0, tslib.__spreadArray([message], args, false));
74
+ var arg0 = message;
75
+ message = getHandledErrorMsg(arg0);
76
+ if (!message) {
77
+ message = getFallbackErrorMsg(arg0, args);
78
+ args = [];
79
+ }
78
80
  }
81
+ fn.apply(void 0, [message].concat(args));
79
82
  };
80
83
  }
81
84
  var invariant = Object.assign(function invariant(condition, message) {
@@ -84,7 +87,7 @@ var invariant = Object.assign(function invariant(condition, message) {
84
87
  args[_i - 2] = arguments[_i];
85
88
  }
86
89
  if (!condition) {
87
- tsInvariant.invariant(condition, getErrorMsg(message, args));
90
+ tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));
88
91
  }
89
92
  }, {
90
93
  debug: wrap(tsInvariant.invariant.debug),
@@ -97,23 +100,31 @@ function newInvariantError(message) {
97
100
  for (var _i = 1; _i < arguments.length; _i++) {
98
101
  optionalParams[_i - 1] = arguments[_i];
99
102
  }
100
- return new tsInvariant.InvariantError(getErrorMsg(message, optionalParams));
103
+ return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) ||
104
+ getFallbackErrorMsg(message, optionalParams));
101
105
  }
102
106
  var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version);
103
- function getErrorMsg(message, messageArgs) {
107
+ function stringify(arg) {
108
+ return typeof arg == "string"
109
+ ? arg
110
+ : stringifyForDisplay(arg, 2).slice(0, 1000);
111
+ }
112
+ function getHandledErrorMsg(message, messageArgs) {
104
113
  if (messageArgs === void 0) { messageArgs = []; }
105
114
  if (!message)
106
115
  return;
107
- var args = messageArgs.map(function (arg) {
108
- return typeof arg == "string" ? arg : stringifyForDisplay(arg, 2).slice(0, 1000);
109
- });
110
- return ((global$1[ApolloErrorMessageHandler] &&
111
- global$1[ApolloErrorMessageHandler](message, args)) ||
112
- "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
113
- version: version,
114
- message: message,
115
- args: args,
116
- }))));
116
+ return (global$1[ApolloErrorMessageHandler] &&
117
+ global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));
118
+ }
119
+ function getFallbackErrorMsg(message, messageArgs) {
120
+ if (messageArgs === void 0) { messageArgs = []; }
121
+ if (!message)
122
+ return;
123
+ return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
124
+ version: version,
125
+ message: message,
126
+ args: messageArgs.map(stringify),
127
+ })));
117
128
  }
118
129
 
119
130
  function shouldInclude(_a, variables) {
@@ -127,7 +138,7 @@ function shouldInclude(_a, variables) {
127
138
  if (ifArgument.value.kind === "Variable") {
128
139
  evaledValue =
129
140
  variables && variables[ifArgument.value.name.value];
130
- invariant(evaledValue !== void 0, 64, directive.name.value);
141
+ invariant(evaledValue !== void 0, 65, directive.name.value);
131
142
  }
132
143
  else {
133
144
  evaledValue = ifArgument.value.value;
@@ -162,12 +173,12 @@ function getInclusionDirectives(directives) {
162
173
  return;
163
174
  var directiveArguments = directive.arguments;
164
175
  var directiveName = directive.name.value;
165
- invariant(directiveArguments && directiveArguments.length === 1, 65, directiveName);
176
+ invariant(directiveArguments && directiveArguments.length === 1, 66, directiveName);
166
177
  var ifArgument = directiveArguments[0];
167
- invariant(ifArgument.name && ifArgument.name.value === "if", 66, directiveName);
178
+ invariant(ifArgument.name && ifArgument.name.value === "if", 67, directiveName);
168
179
  var ifValue = ifArgument.value;
169
180
  invariant(ifValue &&
170
- (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 67, directiveName);
181
+ (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 68, directiveName);
171
182
  result.push({ directive: directive, ifArgument: ifArgument });
172
183
  });
173
184
  }
@@ -193,7 +204,7 @@ function getFragmentQueryDocument(document, fragmentName) {
193
204
  document.definitions.forEach(function (definition) {
194
205
  if (definition.kind === "OperationDefinition") {
195
206
  throw newInvariantError(
196
- 68,
207
+ 69,
197
208
  definition.operation,
198
209
  definition.name ? " named '".concat(definition.name.value, "'") : ""
199
210
  );
@@ -203,7 +214,7 @@ function getFragmentQueryDocument(document, fragmentName) {
203
214
  }
204
215
  });
205
216
  if (typeof actualFragmentName === "undefined") {
206
- invariant(fragments.length === 1, 69, fragments.length);
217
+ invariant(fragments.length === 1, 70, fragments.length);
207
218
  actualFragmentName = fragments[0].name.value;
208
219
  }
209
220
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -244,7 +255,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
244
255
  return fragmentMap(fragmentName);
245
256
  }
246
257
  var fragment = fragmentMap && fragmentMap[fragmentName];
247
- invariant(fragment, 70, fragmentName);
258
+ invariant(fragment, 71, fragmentName);
248
259
  return fragment || null;
249
260
  }
250
261
  default:
@@ -252,6 +263,43 @@ function getFragmentFromSelection(selection, fragmentMap) {
252
263
  }
253
264
  }
254
265
 
266
+ var canonicalStringify = Object.assign(function canonicalStringify(value) {
267
+ return JSON.stringify(value, stableObjectReplacer);
268
+ }, {
269
+ reset: function () {
270
+ sortingMap.clear();
271
+ },
272
+ });
273
+ var sortingMap = new Map();
274
+ function stableObjectReplacer(key, value) {
275
+ if (value && typeof value === "object") {
276
+ var proto = Object.getPrototypeOf(value);
277
+ if (proto === Object.prototype || proto === null) {
278
+ var keys = Object.keys(value);
279
+ if (keys.every(everyKeyInOrder))
280
+ return value;
281
+ var unsortedKey = JSON.stringify(keys);
282
+ var sortedKeys = sortingMap.get(unsortedKey);
283
+ if (!sortedKeys) {
284
+ keys.sort();
285
+ var sortedKey = JSON.stringify(keys);
286
+ sortedKeys = sortingMap.get(sortedKey) || keys;
287
+ sortingMap.set(unsortedKey, sortedKeys);
288
+ sortingMap.set(sortedKey, sortedKeys);
289
+ }
290
+ var sortedObject_1 = Object.create(proto);
291
+ sortedKeys.forEach(function (key) {
292
+ sortedObject_1[key] = value[key];
293
+ });
294
+ return sortedObject_1;
295
+ }
296
+ }
297
+ return value;
298
+ }
299
+ function everyKeyInOrder(key, i, keys) {
300
+ return i === 0 || keys[i - 1] <= key;
301
+ }
302
+
255
303
  function makeReference(id) {
256
304
  return { __ref: String(id) };
257
305
  }
@@ -322,7 +370,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
322
370
  argObj[name.value] = null;
323
371
  }
324
372
  else {
325
- throw newInvariantError(79, name.value, value.kind);
373
+ throw newInvariantError(80, name.value, value.kind);
326
374
  }
327
375
  }
328
376
  function storeKeyNameFromField(field, variables) {
@@ -358,6 +406,7 @@ var KNOWN_DIRECTIVES = [
358
406
  "export",
359
407
  "nonreactive",
360
408
  ];
409
+ var storeKeyNameStringify = canonicalStringify;
361
410
  var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
362
411
  if (args &&
363
412
  directives &&
@@ -373,7 +422,7 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
373
422
  filterKeys.forEach(function (key) {
374
423
  filteredArgs_1[key] = args[key];
375
424
  });
376
- return "".concat(directives["connection"]["key"], "(").concat(stringify(filteredArgs_1), ")");
425
+ return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")");
377
426
  }
378
427
  else {
379
428
  return directives["connection"]["key"];
@@ -381,7 +430,7 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
381
430
  }
382
431
  var completeFieldName = fieldName;
383
432
  if (args) {
384
- var stringifiedArgs = stringify(args);
433
+ var stringifiedArgs = storeKeyNameStringify(args);
385
434
  completeFieldName += "(".concat(stringifiedArgs, ")");
386
435
  }
387
436
  if (directives) {
@@ -389,7 +438,7 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
389
438
  if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
390
439
  return;
391
440
  if (directives[key] && Object.keys(directives[key]).length) {
392
- completeFieldName += "@".concat(key, "(").concat(stringify(directives[key]), ")");
441
+ completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")");
393
442
  }
394
443
  else {
395
444
  completeFieldName += "@".concat(key);
@@ -399,25 +448,11 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
399
448
  return completeFieldName;
400
449
  }, {
401
450
  setStringify: function (s) {
402
- var previous = stringify;
403
- stringify = s;
451
+ var previous = storeKeyNameStringify;
452
+ storeKeyNameStringify = s;
404
453
  return previous;
405
454
  },
406
455
  });
407
- var stringify = function defaultStringify(value) {
408
- return JSON.stringify(value, stringifyReplacer);
409
- };
410
- function stringifyReplacer(_key, value) {
411
- if (isNonNullObject(value) && !Array.isArray(value)) {
412
- value = Object.keys(value)
413
- .sort()
414
- .reduce(function (copy, key) {
415
- copy[key] = value[key];
416
- return copy;
417
- }, {});
418
- }
419
- return value;
420
- }
421
456
  function argumentsObjectFromField(field, variables) {
422
457
  if (field.arguments && field.arguments.length) {
423
458
  var argObj_1 = {};
@@ -469,16 +504,16 @@ function isInlineFragment(selection) {
469
504
  }
470
505
 
471
506
  function checkDocument(doc) {
472
- invariant(doc && doc.kind === "Document", 71);
507
+ invariant(doc && doc.kind === "Document", 72);
473
508
  var operations = doc.definitions
474
509
  .filter(function (d) { return d.kind !== "FragmentDefinition"; })
475
510
  .map(function (definition) {
476
511
  if (definition.kind !== "OperationDefinition") {
477
- throw newInvariantError(72, definition.kind);
512
+ throw newInvariantError(73, definition.kind);
478
513
  }
479
514
  return definition;
480
515
  });
481
- invariant(operations.length <= 1, 73, operations.length);
516
+ invariant(operations.length <= 1, 74, operations.length);
482
517
  return doc;
483
518
  }
484
519
  function getOperationDefinition(doc) {
@@ -501,14 +536,14 @@ function getFragmentDefinitions(doc) {
501
536
  }
502
537
  function getQueryDefinition(doc) {
503
538
  var queryDef = getOperationDefinition(doc);
504
- invariant(queryDef && queryDef.operation === "query", 74);
539
+ invariant(queryDef && queryDef.operation === "query", 75);
505
540
  return queryDef;
506
541
  }
507
542
  function getFragmentDefinition(doc) {
508
- invariant(doc.kind === "Document", 75);
509
- invariant(doc.definitions.length <= 1, 76);
543
+ invariant(doc.kind === "Document", 76);
544
+ invariant(doc.definitions.length <= 1, 77);
510
545
  var fragmentDef = doc.definitions[0];
511
- invariant(fragmentDef.kind === "FragmentDefinition", 77);
546
+ invariant(fragmentDef.kind === "FragmentDefinition", 78);
512
547
  return fragmentDef;
513
548
  }
514
549
  function getMainDefinition(queryDoc) {
@@ -531,7 +566,7 @@ function getMainDefinition(queryDoc) {
531
566
  if (fragmentDefinition) {
532
567
  return fragmentDefinition;
533
568
  }
534
- throw newInvariantError(78);
569
+ throw newInvariantError(79);
535
570
  }
536
571
  function getDefaultValues(definition) {
537
572
  var defaultValues = Object.create(null);
@@ -603,7 +638,7 @@ var DocumentTransform = (function () {
603
638
  return;
604
639
  var cacheKeys = this.getCacheKey(document);
605
640
  if (cacheKeys) {
606
- invariant(Array.isArray(cacheKeys), 63);
641
+ invariant(Array.isArray(cacheKeys), 64);
607
642
  return this.stableCacheKeys.lookupArray(cacheKeys);
608
643
  }
609
644
  };
@@ -699,7 +734,7 @@ function removeDirectivesFromDocument(directives, doc) {
699
734
  return getInUseByFragmentName(ancestor.name.value);
700
735
  }
701
736
  }
702
- globalThis.__DEV__ !== false && invariant.error(80);
737
+ globalThis.__DEV__ !== false && invariant.error(81);
703
738
  return null;
704
739
  };
705
740
  var operationCount = 0;
@@ -1092,48 +1127,31 @@ function iterateObserversSafely(observers, method, argument) {
1092
1127
 
1093
1128
  function asyncMap(observable, mapFn, catchFn) {
1094
1129
  return new zenObservableTs.Observable(function (observer) {
1095
- var next = observer.next, error = observer.error, complete = observer.complete;
1096
- var activeCallbackCount = 0;
1097
- var completed = false;
1098
1130
  var promiseQueue = {
1099
1131
  then: function (callback) {
1100
1132
  return new Promise(function (resolve) { return resolve(callback()); });
1101
1133
  },
1102
1134
  };
1103
- function makeCallback(examiner, delegate) {
1104
- if (examiner) {
1105
- return function (arg) {
1106
- ++activeCallbackCount;
1107
- var both = function () { return examiner(arg); };
1108
- promiseQueue = promiseQueue
1109
- .then(both, both)
1110
- .then(function (result) {
1111
- --activeCallbackCount;
1112
- next && next.call(observer, result);
1113
- if (completed) {
1114
- handler.complete();
1115
- }
1116
- }, function (error) {
1117
- --activeCallbackCount;
1118
- throw error;
1119
- })
1120
- .catch(function (caught) {
1121
- error && error.call(observer, caught);
1122
- });
1123
- };
1124
- }
1125
- else {
1126
- return function (arg) { return delegate && delegate.call(observer, arg); };
1127
- }
1135
+ function makeCallback(examiner, key) {
1136
+ return function (arg) {
1137
+ if (examiner) {
1138
+ var both = function () {
1139
+ return observer.closed
1140
+ ? 0
1141
+ : examiner(arg);
1142
+ };
1143
+ promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
1144
+ }
1145
+ else {
1146
+ observer[key](arg);
1147
+ }
1148
+ };
1128
1149
  }
1129
1150
  var handler = {
1130
- next: makeCallback(mapFn, next),
1131
- error: makeCallback(catchFn, error),
1151
+ next: makeCallback(mapFn, "next"),
1152
+ error: makeCallback(catchFn, "error"),
1132
1153
  complete: function () {
1133
- completed = true;
1134
- if (!activeCallbackCount) {
1135
- complete && complete.call(observer);
1136
- }
1154
+ promiseQueue.then(function () { return observer.complete(); });
1137
1155
  },
1138
1156
  };
1139
1157
  var sub = observable.subscribe(handler);
@@ -2962,28 +2980,6 @@ var ObjectCanon = (function () {
2962
2980
  };
2963
2981
  return ObjectCanon;
2964
2982
  }());
2965
- var canonicalStringify = Object.assign(function (value) {
2966
- if (isNonNullObject(value)) {
2967
- if (stringifyCanon === void 0) {
2968
- resetCanonicalStringify();
2969
- }
2970
- var canonical = stringifyCanon.admit(value);
2971
- var json = stringifyCache.get(canonical);
2972
- if (json === void 0) {
2973
- stringifyCache.set(canonical, (json = JSON.stringify(canonical)));
2974
- }
2975
- return json;
2976
- }
2977
- return JSON.stringify(value);
2978
- }, {
2979
- reset: resetCanonicalStringify,
2980
- });
2981
- var stringifyCanon;
2982
- var stringifyCache;
2983
- function resetCanonicalStringify() {
2984
- stringifyCanon = new ObjectCanon();
2985
- stringifyCache = new (canUseWeakMap ? WeakMap : Map)();
2986
- }
2987
2983
 
2988
2984
  function execSelectionSetKeyArgs(options) {
2989
2985
  return [
@@ -3435,7 +3431,6 @@ function normalize(value) {
3435
3431
  return value;
3436
3432
  }
3437
3433
 
3438
- getStoreKeyName.setStringify(canonicalStringify);
3439
3434
  function argsFromFieldSpecifier(spec) {
3440
3435
  return spec.args !== void 0
3441
3436
  ? spec.args
@@ -5007,9 +5002,9 @@ var ObservableQuery = (function (_super) {
5007
5002
  }
5008
5003
  return options.fetchPolicy;
5009
5004
  };
5010
- ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
5005
+ ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {
5011
5006
  this.queryManager.setObservableQuery(this);
5012
- return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus);
5007
+ return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query);
5013
5008
  };
5014
5009
  ObservableQuery.prototype.updatePolling = function () {
5015
5010
  var _this = this;
@@ -5091,15 +5086,14 @@ var ObservableQuery = (function (_super) {
5091
5086
  }
5092
5087
  }
5093
5088
  }
5094
- var fetchOptions = query === options.query ? options : tslib.__assign(tslib.__assign({}, options), { query: query });
5095
- this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(fetchOptions.fetchPolicy));
5089
+ this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
5096
5090
  var finishWaitingForOwnResult = function () {
5097
5091
  if (_this.concast === concast) {
5098
5092
  _this.waitForOwnResult = false;
5099
5093
  }
5100
5094
  };
5101
- var variables = fetchOptions.variables && tslib.__assign({}, fetchOptions.variables);
5102
- var _a = this.fetch(fetchOptions, newNetworkStatus), concast = _a.concast, fromLink = _a.fromLink;
5095
+ var variables = options.variables && tslib.__assign({}, options.variables);
5096
+ var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;
5103
5097
  var observer = {
5104
5098
  next: function (result) {
5105
5099
  finishWaitingForOwnResult();
@@ -5541,7 +5535,6 @@ var QueryInfo = (function () {
5541
5535
  this.listeners = new Set();
5542
5536
  this.document = null;
5543
5537
  this.lastRequestId = 1;
5544
- this.subscriptions = new Set();
5545
5538
  this.stopped = false;
5546
5539
  this.dirty = false;
5547
5540
  this.observableQuery = null;
@@ -5676,7 +5669,6 @@ var QueryInfo = (function () {
5676
5669
  this.reset();
5677
5670
  this.cancel();
5678
5671
  this.cancel = QueryInfo.prototype.cancel;
5679
- this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
5680
5672
  var oq = this.observableQuery;
5681
5673
  if (oq)
5682
5674
  oq.stopPolling();
@@ -6455,10 +6447,10 @@ var QueryManager = (function () {
6455
6447
  throw error;
6456
6448
  });
6457
6449
  };
6458
- QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus) {
6450
+ QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus, query) {
6459
6451
  var _this = this;
6460
6452
  if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
6461
- var query = options.query;
6453
+ if (query === void 0) { query = options.query; }
6462
6454
  var variables = this.getVariables(query, options.variables);
6463
6455
  var queryInfo = this.getQuery(queryId);
6464
6456
  var defaults = this.defaultOptions.watchQuery;
@@ -7998,7 +7990,7 @@ var InternalQueryReference = (function () {
7998
7990
  return InternalQueryReference;
7999
7991
  }());
8000
7992
 
8001
- var SuspenseCache$1 = (function () {
7993
+ var SuspenseCache = (function () {
8002
7994
  function SuspenseCache(options) {
8003
7995
  if (options === void 0) { options = Object.create(null); }
8004
7996
  this.queryRefs = new trie.Trie(canUseWeakMap);
@@ -8024,22 +8016,11 @@ var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache");
8024
8016
  function getSuspenseCache(client) {
8025
8017
  var _a;
8026
8018
  if (!client[suspenseCacheSymbol]) {
8027
- client[suspenseCacheSymbol] = new SuspenseCache$1((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
8019
+ client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
8028
8020
  }
8029
8021
  return client[suspenseCacheSymbol];
8030
8022
  }
8031
8023
 
8032
- var SuspenseCache = (function (_super) {
8033
- tslib.__extends(SuspenseCache, _super);
8034
- function SuspenseCache() {
8035
- _super.call(this) || this;
8036
- throw new Error("It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.\n" +
8037
- "Please remove this code from your application. \n\n" +
8038
- "This export will be removed with the final 3.8 release.");
8039
- }
8040
- return SuspenseCache;
8041
- }(SuspenseCache$1));
8042
-
8043
8024
  var skipToken = Symbol.for("apollo.skipToken");
8044
8025
 
8045
8026
  function useSuspenseQuery(query, options) {
@@ -8247,7 +8228,6 @@ exports.HttpLink = HttpLink;
8247
8228
  exports.InMemoryCache = InMemoryCache;
8248
8229
  exports.MissingFieldError = MissingFieldError;
8249
8230
  exports.ObservableQuery = ObservableQuery;
8250
- exports.SuspenseCache = SuspenseCache;
8251
8231
  exports.checkFetcher = checkFetcher;
8252
8232
  exports.concat = concat;
8253
8233
  exports.createHttpLink = createHttpLink;