@apollo/client 3.4.8 → 3.4.9

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 (114) hide show
  1. package/apollo-client.cjs.js +58 -54
  2. package/apollo-client.cjs.js.map +1 -1
  3. package/apollo-core.cjs.js +49 -45
  4. package/apollo-core.cjs.js.map +1 -1
  5. package/apollo-core.cjs.min.js +1 -1
  6. package/cache/cache.cjs.js +10 -10
  7. package/cache/cache.cjs.js.map +1 -1
  8. package/cache/index.d.ts.map +1 -1
  9. package/cache/index.js +2 -3
  10. package/cache/index.js.map +1 -1
  11. package/cache/inmemory/entityStore.js +1 -1
  12. package/cache/inmemory/policies.js +3 -3
  13. package/cache/inmemory/readFromStore.js +3 -3
  14. package/cache/inmemory/writeToStore.js +1 -1
  15. package/core/ApolloClient.js +2 -2
  16. package/core/LocalState.js +1 -1
  17. package/core/ObservableQuery.js +1 -1
  18. package/core/QueryManager.d.ts.map +1 -1
  19. package/core/QueryManager.js +9 -9
  20. package/core/QueryManager.js.map +1 -1
  21. package/core/core.cjs.js +15 -14
  22. package/core/core.cjs.js.map +1 -1
  23. package/core/index.d.ts.map +1 -1
  24. package/core/index.js +2 -1
  25. package/core/index.js.map +1 -1
  26. package/errors/errors.cjs.js +1 -2
  27. package/errors/errors.cjs.js.map +1 -1
  28. package/errors/index.d.ts.map +1 -1
  29. package/errors/index.js +2 -3
  30. package/errors/index.js.map +1 -1
  31. package/invariantErrorCodes.js +56 -81
  32. package/link/core/ApolloLink.js +1 -1
  33. package/link/core/core.cjs.js +3 -3
  34. package/link/core/core.cjs.js.map +1 -1
  35. package/link/core/index.d.ts.map +1 -1
  36. package/link/core/index.js +2 -3
  37. package/link/core/index.js.map +1 -1
  38. package/link/http/checkFetcher.js +1 -1
  39. package/link/http/http.cjs.js +5 -3
  40. package/link/http/http.cjs.js.map +1 -1
  41. package/link/http/index.d.ts.map +1 -1
  42. package/link/http/index.js +2 -0
  43. package/link/http/index.js.map +1 -1
  44. package/link/http/serializeFetchParameter.js +1 -1
  45. package/link/persisted-queries/index.d.ts.map +1 -1
  46. package/link/persisted-queries/index.js +4 -2
  47. package/link/persisted-queries/index.js.map +1 -1
  48. package/link/persisted-queries/persisted-queries.cjs.js +4 -3
  49. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  50. package/link/utils/index.d.ts.map +1 -1
  51. package/link/utils/index.js +2 -0
  52. package/link/utils/index.js.map +1 -1
  53. package/link/utils/utils.cjs.js +3 -1
  54. package/link/utils/utils.cjs.js.map +1 -1
  55. package/link/utils/validateOperation.js +1 -1
  56. package/package.json +5 -5
  57. package/react/context/ApolloConsumer.js +1 -1
  58. package/react/context/ApolloProvider.js +1 -1
  59. package/react/context/context.cjs.js +5 -3
  60. package/react/context/context.cjs.js.map +1 -1
  61. package/react/context/index.d.ts.map +1 -1
  62. package/react/context/index.js +2 -0
  63. package/react/context/index.js.map +1 -1
  64. package/react/data/OperationData.js +2 -2
  65. package/react/data/data.cjs.js +5 -2
  66. package/react/data/data.cjs.js.map +1 -1
  67. package/react/data/index.d.ts.map +1 -1
  68. package/react/data/index.js +2 -0
  69. package/react/data/index.js.map +1 -1
  70. package/react/hoc/hoc-utils.js +1 -1
  71. package/react/hoc/hoc.cjs.js +5 -2
  72. package/react/hoc/hoc.cjs.js.map +1 -1
  73. package/react/hoc/index.d.ts.map +1 -1
  74. package/react/hoc/index.js +2 -0
  75. package/react/hoc/index.js.map +1 -1
  76. package/react/hoc/withApollo.js +1 -1
  77. package/react/hooks/hooks.cjs.js +4 -1
  78. package/react/hooks/hooks.cjs.js.map +1 -1
  79. package/react/hooks/index.d.ts.map +1 -1
  80. package/react/hooks/index.js +2 -0
  81. package/react/hooks/index.js.map +1 -1
  82. package/react/hooks/useApolloClient.js +1 -1
  83. package/react/index.d.ts.map +1 -1
  84. package/react/index.js +2 -3
  85. package/react/index.js.map +1 -1
  86. package/react/parser/index.d.ts.map +1 -1
  87. package/react/parser/index.js +6 -4
  88. package/react/parser/index.js.map +1 -1
  89. package/react/parser/parser.cjs.js +6 -4
  90. package/react/parser/parser.cjs.js.map +1 -1
  91. package/react/react.cjs.js +1 -2
  92. package/react/react.cjs.js.map +1 -1
  93. package/testing/index.js +2 -3
  94. package/testing/index.js.map +1 -1
  95. package/testing/testing.cjs.js +3 -3
  96. package/testing/testing.cjs.js.map +1 -1
  97. package/utilities/globals/index.d.ts +1 -0
  98. package/utilities/globals/index.d.ts.map +1 -1
  99. package/utilities/globals/index.js +4 -0
  100. package/utilities/globals/index.js.map +1 -1
  101. package/utilities/graphql/directives.js +4 -4
  102. package/utilities/graphql/fragments.js +3 -3
  103. package/utilities/graphql/getFromAST.js +8 -8
  104. package/utilities/graphql/storeUtils.js +1 -1
  105. package/utilities/index.d.ts +2 -2
  106. package/utilities/index.d.ts.map +1 -1
  107. package/utilities/index.js +3 -4
  108. package/utilities/index.js.map +1 -1
  109. package/utilities/observables/Concast.js +1 -1
  110. package/utilities/observables/Concast.js.map +1 -1
  111. package/utilities/testing/mocking/mockLink.js +1 -1
  112. package/utilities/utilities.cjs.js +22 -18
  113. package/utilities/utilities.cjs.js.map +1 -1
  114. package/version.js +1 -1
@@ -65,6 +65,9 @@ function removeTemporaryGlobals() {
65
65
  return process$1.remove();
66
66
  }
67
67
 
68
+ function checkDEV() {
69
+ __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38);
70
+ }
68
71
  removeTemporaryGlobals();
69
72
 
70
73
  function shouldInclude(_a, variables) {
@@ -77,7 +80,7 @@ function shouldInclude(_a, variables) {
77
80
  var evaledValue = false;
78
81
  if (ifArgument.value.kind === 'Variable') {
79
82
  evaledValue = variables && variables[ifArgument.value.name.value];
80
- __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 43);
83
+ __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 39);
81
84
  }
82
85
  else {
83
86
  evaledValue = ifArgument.value.value;
@@ -114,13 +117,13 @@ function getInclusionDirectives(directives) {
114
117
  return;
115
118
  var directiveArguments = directive.arguments;
116
119
  var directiveName = directive.name.value;
117
- __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 44);
120
+ __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
118
121
  var ifArgument = directiveArguments[0];
119
- __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 45);
122
+ __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
120
123
  var ifValue = ifArgument.value;
121
124
  __DEV__ ? tsInvariant.invariant(ifValue &&
122
125
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : tsInvariant.invariant(ifValue &&
123
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 46);
126
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
124
127
  result.push({ directive: directive, ifArgument: ifArgument });
125
128
  });
126
129
  }
@@ -133,14 +136,14 @@ function getFragmentQueryDocument(document, fragmentName) {
133
136
  document.definitions.forEach(function (definition) {
134
137
  if (definition.kind === 'OperationDefinition') {
135
138
  throw __DEV__ ? new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
136
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(47);
139
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
137
140
  }
138
141
  if (definition.kind === 'FragmentDefinition') {
139
142
  fragments.push(definition);
140
143
  }
141
144
  });
142
145
  if (typeof actualFragmentName === 'undefined') {
143
- __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1, 48);
146
+ __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1, 44);
144
147
  actualFragmentName = fragments[0].name.value;
145
148
  }
146
149
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -177,7 +180,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
177
180
  return selection;
178
181
  case 'FragmentSpread': {
179
182
  var fragment = fragmentMap && fragmentMap[selection.name.value];
180
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 49);
183
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 45);
181
184
  return fragment;
182
185
  }
183
186
  default:
@@ -261,7 +264,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
261
264
  else {
262
265
  throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
263
266
  'is not supported. Use variables instead of inline arguments to ' +
264
- 'overcome this limitation.') : new tsInvariant.InvariantError(58);
267
+ 'overcome this limitation.') : new tsInvariant.InvariantError(54);
265
268
  }
266
269
  }
267
270
  function storeKeyNameFromField(field, variables) {
@@ -395,16 +398,16 @@ function isInlineFragment(selection) {
395
398
  }
396
399
 
397
400
  function checkDocument(doc) {
398
- __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 50);
401
+ __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 46);
399
402
  var operations = doc.definitions
400
403
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
401
404
  .map(function (definition) {
402
405
  if (definition.kind !== 'OperationDefinition') {
403
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(51);
406
+ throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(47);
404
407
  }
405
408
  return definition;
406
409
  });
407
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 52);
410
+ __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 48);
408
411
  return doc;
409
412
  }
410
413
  function getOperationDefinition(doc) {
@@ -423,14 +426,14 @@ function getFragmentDefinitions(doc) {
423
426
  }
424
427
  function getQueryDefinition(doc) {
425
428
  var queryDef = getOperationDefinition(doc);
426
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
429
+ __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
427
430
  return queryDef;
428
431
  }
429
432
  function getFragmentDefinition(doc) {
430
- __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 54);
431
- __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 55);
433
+ __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 50);
434
+ __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
432
435
  var fragmentDef = doc.definitions[0];
433
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
436
+ __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
434
437
  return fragmentDef;
435
438
  }
436
439
  function getMainDefinition(queryDoc) {
@@ -453,7 +456,7 @@ function getMainDefinition(queryDoc) {
453
456
  if (fragmentDefinition) {
454
457
  return fragmentDefinition;
455
458
  }
456
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
459
+ throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
457
460
  }
458
461
  function getDefaultValues(definition) {
459
462
  var defaultValues = Object.create(null);
@@ -952,7 +955,7 @@ var Concast = (function (_super) {
952
955
  var sub = _this.sub;
953
956
  if (sub !== null) {
954
957
  if (sub)
955
- Promise.resolve().then(function () { return sub.unsubscribe(); });
958
+ setTimeout(function () { return sub.unsubscribe(); });
956
959
  _this.sub = null;
957
960
  _this.latest = ["error", error];
958
961
  _this.reject(error);
@@ -1101,7 +1104,7 @@ function stringifyForDisplay(value) {
1101
1104
  }).split(JSON.stringify(undefId)).join("<undefined>");
1102
1105
  }
1103
1106
 
1104
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 59);
1107
+ checkDEV();
1105
1108
 
1106
1109
  function fromError(errorValue) {
1107
1110
  return new zenObservableTs.Observable(function (observer) {
@@ -1158,7 +1161,7 @@ function validateOperation(operation) {
1158
1161
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
1159
1162
  var key = _a[_i];
1160
1163
  if (OPERATION_FIELDS.indexOf(key) < 0) {
1161
- throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(29);
1164
+ throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(26);
1162
1165
  }
1163
1166
  }
1164
1167
  return operation;
@@ -1281,7 +1284,7 @@ var ApolloLink = (function () {
1281
1284
  return ApolloLink.concat(this, next);
1282
1285
  };
1283
1286
  ApolloLink.prototype.request = function (operation, forward) {
1284
- throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(23);
1287
+ throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(21);
1285
1288
  };
1286
1289
  ApolloLink.prototype.onError = function (error, observer) {
1287
1290
  if (observer && observer.error) {
@@ -1307,7 +1310,7 @@ var concat = ApolloLink.concat;
1307
1310
 
1308
1311
  var execute = ApolloLink.execute;
1309
1312
 
1310
- var version = '3.4.8';
1313
+ var version = '3.4.9';
1311
1314
 
1312
1315
  var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1313
1316
  function parseAndCheckHttpResponse(operations) {
@@ -1347,7 +1350,7 @@ var serializeFetchParameter = function (p, label) {
1347
1350
  serialized = JSON.stringify(p);
1348
1351
  }
1349
1352
  catch (e) {
1350
- var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(26);
1353
+ var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(23);
1351
1354
  parseError.parseError = e;
1352
1355
  throw parseError;
1353
1356
  }
@@ -1407,7 +1410,7 @@ function headersToLowerCase(headers) {
1407
1410
 
1408
1411
  var checkFetcher = function (fetcher) {
1409
1412
  if (!fetcher && typeof fetch === 'undefined') {
1410
- throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(25);
1413
+ throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(22);
1411
1414
  }
1412
1415
  };
1413
1416
 
@@ -1787,7 +1790,7 @@ var EntityStore = (function () {
1787
1790
  : newer;
1788
1791
  if (!incoming)
1789
1792
  return;
1790
- __DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 2);
1793
+ __DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 1);
1791
1794
  var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
1792
1795
  this.data[dataId] = merged;
1793
1796
  if (merged !== existing) {
@@ -2378,7 +2381,7 @@ var StoreReader = (function () {
2378
2381
  !context.store.has(objectOrReference.__ref)) {
2379
2382
  return {
2380
2383
  result: this.canon.empty,
2381
- missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(6), context)],
2384
+ missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(5), context)],
2382
2385
  };
2383
2386
  }
2384
2387
  var variables = context.variables, policies = context.policies, store = context.store;
@@ -2417,7 +2420,7 @@ var StoreReader = (function () {
2417
2420
  if (!addTypenameToDocument.added(selection)) {
2418
2421
  getMissing().push(missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
2419
2422
  ? objectOrReference.__ref + " object"
2420
- : "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(7), context));
2423
+ : "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(6), context));
2421
2424
  }
2422
2425
  }
2423
2426
  else if (Array.isArray(fieldValue)) {
@@ -2514,7 +2517,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
2514
2517
  var workSet_1 = new Set([fieldValue]);
2515
2518
  workSet_1.forEach(function (value) {
2516
2519
  if (isNonNullObject(value)) {
2517
- __DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value), 8);
2520
+ __DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value), 7);
2518
2521
  Object.values(value).forEach(workSet_1.add, workSet_1);
2519
2522
  }
2520
2523
  });
@@ -2553,7 +2556,7 @@ var StoreWriter = (function () {
2553
2556
  context: context,
2554
2557
  });
2555
2558
  if (!isReference(ref)) {
2556
- throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(9);
2559
+ throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(8);
2557
2560
  }
2558
2561
  context.incomingById.forEach(function (_a, dataId) {
2559
2562
  var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections;
@@ -3050,7 +3053,7 @@ var Policies = (function () {
3050
3053
  var rootId = "ROOT_" + which.toUpperCase();
3051
3054
  var old = this.rootTypenamesById[rootId];
3052
3055
  if (typename !== old) {
3053
- __DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 3);
3056
+ __DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 2);
3054
3057
  if (old)
3055
3058
  delete this.rootIdsByTypename[old];
3056
3059
  this.rootIdsByTypename[typename] = rootId;
@@ -3294,7 +3297,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
3294
3297
  function makeMergeObjectsFunction(store) {
3295
3298
  return function mergeObjects(existing, incoming) {
3296
3299
  if (Array.isArray(existing) || Array.isArray(incoming)) {
3297
- throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(4);
3300
+ throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(3);
3298
3301
  }
3299
3302
  if (isNonNullObject(existing) &&
3300
3303
  isNonNullObject(incoming)) {
@@ -3394,7 +3397,7 @@ function computeKeyObject(response, specifier, strict, aliasMap) {
3394
3397
  keyObj[lastActualKey = s] = response[lastResponseKey = responseName];
3395
3398
  }
3396
3399
  else {
3397
- __DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 5);
3400
+ __DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 4);
3398
3401
  lastResponseKey = lastActualKey = void 0;
3399
3402
  }
3400
3403
  }
@@ -3687,7 +3690,7 @@ var InMemoryCache = (function (_super) {
3687
3690
  return InMemoryCache;
3688
3691
  }(ApolloCache));
3689
3692
 
3690
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 22);
3693
+ checkDEV();
3691
3694
  function isApolloError(err) {
3692
3695
  return err.hasOwnProperty('graphQLErrors');
3693
3696
  }
@@ -4029,7 +4032,7 @@ var ObservableQuery = (function (_super) {
4029
4032
  pollingInfo.interval === pollInterval) {
4030
4033
  return;
4031
4034
  }
4032
- __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
4035
+ __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 12);
4033
4036
  var info = pollingInfo || (this.pollingInfo = {});
4034
4037
  info.interval = pollInterval;
4035
4038
  var maybeFetch = function () {
@@ -4326,7 +4329,7 @@ var LocalState = (function () {
4326
4329
  }
4327
4330
  else {
4328
4331
  fragment = fragmentMap[selection.name.value];
4329
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 12);
4332
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 11);
4330
4333
  }
4331
4334
  if (fragment && fragment.typeCondition) {
4332
4335
  typeCondition = fragment.typeCondition.name.value;
@@ -4712,7 +4715,7 @@ var QueryManager = (function () {
4712
4715
  this.queries.forEach(function (_info, queryId) {
4713
4716
  _this.stopQueryNoBroadcast(queryId);
4714
4717
  });
4715
- this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
4718
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(13));
4716
4719
  };
4717
4720
  QueryManager.prototype.cancelPendingFetches = function (error) {
4718
4721
  this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
@@ -4725,10 +4728,10 @@ var QueryManager = (function () {
4725
4728
  return tslib.__generator(this, function (_f) {
4726
4729
  switch (_f.label) {
4727
4730
  case 0:
4728
- __DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 15);
4731
+ __DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 14);
4729
4732
  __DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
4730
4733
  fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : tsInvariant.invariant(fetchPolicy === 'network-only' ||
4731
- fetchPolicy === 'no-cache', 16);
4734
+ fetchPolicy === 'no-cache', 15);
4732
4735
  mutationId = this.generateMutationId();
4733
4736
  mutation = this.transform(mutation).document;
4734
4737
  variables = this.getVariables(mutation, variables);
@@ -5013,10 +5016,10 @@ var QueryManager = (function () {
5013
5016
  var _this = this;
5014
5017
  if (queryId === void 0) { queryId = this.generateQueryId(); }
5015
5018
  __DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
5016
- 'in the query option.') : tsInvariant.invariant(options.query, 17);
5017
- __DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 18);
5018
- __DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 19);
5019
- __DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 20);
5019
+ 'in the query option.') : tsInvariant.invariant(options.query, 16);
5020
+ __DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 17);
5021
+ __DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 18);
5022
+ __DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 19);
5020
5023
  return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
5021
5024
  };
5022
5025
  QueryManager.prototype.generateQueryId = function () {
@@ -5038,7 +5041,7 @@ var QueryManager = (function () {
5038
5041
  queryInfo.stop();
5039
5042
  };
5040
5043
  QueryManager.prototype.clearStore = function () {
5041
- this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(21));
5044
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(20));
5042
5045
  this.queries.forEach(function (queryInfo) {
5043
5046
  if (queryInfo.observableQuery) {
5044
5047
  queryInfo.networkStatus = exports.NetworkStatus.loading;
@@ -5313,7 +5316,7 @@ var QueryManager = (function () {
5313
5316
  return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
5314
5317
  };
5315
5318
  this.fetchCancelFns.set(queryId, function (reason) {
5316
- Promise.resolve().then(function () { return concast.cancel(reason); });
5319
+ setTimeout(function () { return concast.cancel(reason); });
5317
5320
  });
5318
5321
  var concast = new Concast(this.transform(normalized.query).hasClientExports
5319
5322
  ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
@@ -5531,7 +5534,7 @@ var ApolloClient = (function () {
5531
5534
  if (!cache) {
5532
5535
  throw __DEV__ ? new tsInvariant.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
5533
5536
  "in the options object. \n" +
5534
- "For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(10);
5537
+ "For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(9);
5535
5538
  }
5536
5539
  this.link = link;
5537
5540
  this.cache = cache;
@@ -5627,7 +5630,7 @@ var ApolloClient = (function () {
5627
5630
  __DEV__ ? tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +
5628
5631
  'client.query can only return a single result. Please use client.watchQuery ' +
5629
5632
  'to receive multiple results from the cache and the network, or consider ' +
5630
- 'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 11);
5633
+ 'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 10);
5631
5634
  if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
5632
5635
  options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' });
5633
5636
  }
@@ -5753,7 +5756,7 @@ var ApolloConsumer = function (props) {
5753
5756
  var ApolloContext = getApolloContext();
5754
5757
  return React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
5755
5758
  __DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
5756
- 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 30);
5759
+ 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 27);
5757
5760
  return props.children(context.client);
5758
5761
  });
5759
5762
  };
@@ -5767,7 +5770,7 @@ var ApolloProvider = function (_a) {
5767
5770
  context = Object.assign({}, context, { client: client });
5768
5771
  }
5769
5772
  __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
5770
- 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 31);
5773
+ 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 28);
5771
5774
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
5772
5775
  });
5773
5776
  };
@@ -5775,10 +5778,11 @@ var ApolloProvider = function (_a) {
5775
5778
  function useApolloClient() {
5776
5779
  var client = React__namespace.useContext(getApolloContext()).client;
5777
5780
  __DEV__ ? tsInvariant.invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +
5778
- 'have called `ApolloProvider` higher up in your tree.') : tsInvariant.invariant(client, 36);
5781
+ 'have called `ApolloProvider` higher up in your tree.') : tsInvariant.invariant(client, 33);
5779
5782
  return client;
5780
5783
  }
5781
5784
 
5785
+ checkDEV();
5782
5786
  exports.DocumentType = void 0;
5783
5787
  (function (DocumentType) {
5784
5788
  DocumentType[DocumentType["Query"] = 0] = "Query";
@@ -5808,7 +5812,7 @@ function parser(document) {
5808
5812
  var variables, type, name;
5809
5813
  __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
5810
5814
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
5811
- "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 38);
5815
+ "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 34);
5812
5816
  var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });
5813
5817
  var queries = document.definitions.filter(function (x) {
5814
5818
  return x.kind === 'OperationDefinition' && x.operation === 'query';
@@ -5822,11 +5826,11 @@ function parser(document) {
5822
5826
  __DEV__ ? tsInvariant.invariant(!fragments.length ||
5823
5827
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
5824
5828
  "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
5825
- (queries.length || mutations.length || subscriptions.length), 39);
5829
+ (queries.length || mutations.length || subscriptions.length), 35);
5826
5830
  __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
5827
5831
  (document + " had " + queries.length + " queries, " + subscriptions.length + " ") +
5828
5832
  ("subscriptions and " + mutations.length + " mutations. ") +
5829
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 40);
5833
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);
5830
5834
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
5831
5835
  if (!queries.length && !mutations.length)
5832
5836
  type = exports.DocumentType.Subscription;
@@ -5837,7 +5841,7 @@ function parser(document) {
5837
5841
  : subscriptions;
5838
5842
  __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
5839
5843
  (definitions.length + " definitions. ") +
5840
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 41);
5844
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 37);
5841
5845
  var definition = definitions[0];
5842
5846
  variables = definition.variableDefinitions || [];
5843
5847
  if (definition.name && definition.name.kind === 'Name') {
@@ -5878,7 +5882,7 @@ var OperationData = (function () {
5878
5882
  (this.context && this.context.client);
5879
5883
  __DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
5880
5884
  'Wrap the root component in an <ApolloProvider>, or pass an ' +
5881
- 'ApolloClient instance in via options.') : tsInvariant.invariant(!!client, 32);
5885
+ 'ApolloClient instance in via options.') : tsInvariant.invariant(!!client, 29);
5882
5886
  var isNew = false;
5883
5887
  if (client !== this.client) {
5884
5888
  isNew = true;
@@ -5895,7 +5899,7 @@ var OperationData = (function () {
5895
5899
  var requiredOperationName = operationName(type);
5896
5900
  var usedOperationName = operationName(operation.type);
5897
5901
  __DEV__ ? tsInvariant.invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
5898
- (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : tsInvariant.invariant(operation.type === type, 33);
5902
+ (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : tsInvariant.invariant(operation.type === type, 30);
5899
5903
  };
5900
5904
  return OperationData;
5901
5905
  }());