@apollo/client 3.4.8 → 3.4.12

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 (240) hide show
  1. package/README.md +2 -2
  2. package/apollo-client.cjs.js +92 -107
  3. package/apollo-client.cjs.js.map +1 -1
  4. package/apollo-client.cjs.min.js +1 -0
  5. package/cache/cache.cjs.js +20 -22
  6. package/cache/cache.cjs.js.map +1 -1
  7. package/cache/index.d.ts +1 -0
  8. package/cache/index.d.ts.map +1 -1
  9. package/cache/index.js +1 -3
  10. package/cache/index.js.map +1 -1
  11. package/cache/inmemory/entityStore.js +2 -2
  12. package/cache/inmemory/entityStore.js.map +1 -1
  13. package/cache/inmemory/object-canon.d.ts +1 -0
  14. package/cache/inmemory/object-canon.d.ts.map +1 -1
  15. package/cache/inmemory/object-canon.js +1 -0
  16. package/cache/inmemory/object-canon.js.map +1 -1
  17. package/cache/inmemory/policies.d.ts.map +1 -1
  18. package/cache/inmemory/policies.js +4 -4
  19. package/cache/inmemory/policies.js.map +1 -1
  20. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  21. package/cache/inmemory/readFromStore.js +4 -4
  22. package/cache/inmemory/readFromStore.js.map +1 -1
  23. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  24. package/cache/inmemory/writeToStore.js +2 -2
  25. package/cache/inmemory/writeToStore.js.map +1 -1
  26. package/core/ApolloClient.d.ts.map +1 -1
  27. package/core/ApolloClient.js +3 -3
  28. package/core/ApolloClient.js.map +1 -1
  29. package/core/LocalState.d.ts.map +1 -1
  30. package/core/LocalState.js +2 -2
  31. package/core/LocalState.js.map +1 -1
  32. package/core/ObservableQuery.d.ts.map +1 -1
  33. package/core/ObservableQuery.js +19 -6
  34. package/core/ObservableQuery.js.map +1 -1
  35. package/core/QueryManager.d.ts.map +1 -1
  36. package/core/QueryManager.js +10 -10
  37. package/core/QueryManager.js.map +1 -1
  38. package/core/core.cjs.js +49 -35
  39. package/core/core.cjs.js.map +1 -1
  40. package/core/index.js +1 -1
  41. package/core/index.js.map +1 -1
  42. package/errors/errors.cjs.js +1 -2
  43. package/errors/errors.cjs.js.map +1 -1
  44. package/errors/index.d.ts +1 -0
  45. package/errors/index.d.ts.map +1 -1
  46. package/errors/index.js +1 -3
  47. package/errors/index.js.map +1 -1
  48. package/invariantErrorCodes.js +56 -81
  49. package/link/core/ApolloLink.js +2 -2
  50. package/link/core/ApolloLink.js.map +1 -1
  51. package/link/core/core.cjs.js +4 -6
  52. package/link/core/core.cjs.js.map +1 -1
  53. package/link/core/index.d.ts +1 -0
  54. package/link/core/index.d.ts.map +1 -1
  55. package/link/core/index.js +1 -3
  56. package/link/core/index.js.map +1 -1
  57. package/link/http/checkFetcher.js +2 -2
  58. package/link/http/checkFetcher.js.map +1 -1
  59. package/link/http/createHttpLink.d.ts +1 -0
  60. package/link/http/createHttpLink.d.ts.map +1 -1
  61. package/link/http/createHttpLink.js +1 -0
  62. package/link/http/createHttpLink.js.map +1 -1
  63. package/link/http/http.cjs.js +3 -3
  64. package/link/http/http.cjs.js.map +1 -1
  65. package/link/http/index.d.ts +1 -0
  66. package/link/http/index.d.ts.map +1 -1
  67. package/link/http/index.js +1 -0
  68. package/link/http/index.js.map +1 -1
  69. package/link/http/serializeFetchParameter.d.ts +1 -1
  70. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  71. package/link/http/serializeFetchParameter.js +2 -2
  72. package/link/http/serializeFetchParameter.js.map +1 -1
  73. package/link/persisted-queries/index.d.ts +1 -1
  74. package/link/persisted-queries/index.d.ts.map +1 -1
  75. package/link/persisted-queries/index.js +4 -4
  76. package/link/persisted-queries/index.js.map +1 -1
  77. package/link/persisted-queries/persisted-queries.cjs.js +8 -5
  78. package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
  79. package/link/utils/index.d.ts +1 -0
  80. package/link/utils/index.d.ts.map +1 -1
  81. package/link/utils/index.js +1 -0
  82. package/link/utils/index.js.map +1 -1
  83. package/link/utils/toPromise.d.ts.map +1 -1
  84. package/link/utils/toPromise.js +1 -1
  85. package/link/utils/toPromise.js.map +1 -1
  86. package/link/utils/utils.cjs.js +3 -3
  87. package/link/utils/utils.cjs.js.map +1 -1
  88. package/link/utils/validateOperation.d.ts.map +1 -1
  89. package/link/utils/validateOperation.js +2 -2
  90. package/link/utils/validateOperation.js.map +1 -1
  91. package/package.json +11 -11
  92. package/react/context/ApolloConsumer.d.ts.map +1 -1
  93. package/react/context/ApolloConsumer.js +2 -2
  94. package/react/context/ApolloConsumer.js.map +1 -1
  95. package/react/context/ApolloContext.d.ts +2 -1
  96. package/react/context/ApolloContext.d.ts.map +1 -1
  97. package/react/context/ApolloContext.js +11 -5
  98. package/react/context/ApolloContext.js.map +1 -1
  99. package/react/context/ApolloProvider.d.ts.map +1 -1
  100. package/react/context/ApolloProvider.js +2 -2
  101. package/react/context/ApolloProvider.js.map +1 -1
  102. package/react/context/context.cjs.js +15 -9
  103. package/react/context/context.cjs.js.map +1 -1
  104. package/react/context/index.d.ts +1 -0
  105. package/react/context/index.d.ts.map +1 -1
  106. package/react/context/index.js +1 -0
  107. package/react/context/index.js.map +1 -1
  108. package/react/data/OperationData.d.ts.map +1 -1
  109. package/react/data/OperationData.js +3 -3
  110. package/react/data/OperationData.js.map +1 -1
  111. package/react/data/QueryData.d.ts.map +1 -1
  112. package/react/data/QueryData.js +1 -3
  113. package/react/data/QueryData.js.map +1 -1
  114. package/react/data/data.cjs.js +6 -8
  115. package/react/data/data.cjs.js.map +1 -1
  116. package/react/data/index.d.ts +1 -0
  117. package/react/data/index.d.ts.map +1 -1
  118. package/react/data/index.js +1 -0
  119. package/react/data/index.js.map +1 -1
  120. package/react/hoc/hoc-utils.d.ts.map +1 -1
  121. package/react/hoc/hoc-utils.js +2 -2
  122. package/react/hoc/hoc-utils.js.map +1 -1
  123. package/react/hoc/hoc.cjs.js +5 -5
  124. package/react/hoc/hoc.cjs.js.map +1 -1
  125. package/react/hoc/index.d.ts +1 -0
  126. package/react/hoc/index.d.ts.map +1 -1
  127. package/react/hoc/index.js +1 -0
  128. package/react/hoc/index.js.map +1 -1
  129. package/react/hoc/withApollo.d.ts.map +1 -1
  130. package/react/hoc/withApollo.js +2 -2
  131. package/react/hoc/withApollo.js.map +1 -1
  132. package/react/hooks/hooks.cjs.js +3 -3
  133. package/react/hooks/hooks.cjs.js.map +1 -1
  134. package/react/hooks/index.d.ts +1 -0
  135. package/react/hooks/index.d.ts.map +1 -1
  136. package/react/hooks/index.js +1 -0
  137. package/react/hooks/index.js.map +1 -1
  138. package/react/hooks/useApolloClient.d.ts.map +1 -1
  139. package/react/hooks/useApolloClient.js +2 -2
  140. package/react/hooks/useApolloClient.js.map +1 -1
  141. package/react/hooks/useSubscription.d.ts +1 -0
  142. package/react/hooks/useSubscription.d.ts.map +1 -1
  143. package/react/hooks/useSubscription.js +1 -0
  144. package/react/hooks/useSubscription.js.map +1 -1
  145. package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
  146. package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
  147. package/react/hooks/utils/useAfterFastRefresh.js +1 -0
  148. package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
  149. package/react/hooks/utils/useBaseQuery.d.ts +1 -0
  150. package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
  151. package/react/hooks/utils/useBaseQuery.js +1 -0
  152. package/react/hooks/utils/useBaseQuery.js.map +1 -1
  153. package/react/index.d.ts +1 -0
  154. package/react/index.d.ts.map +1 -1
  155. package/react/index.js +1 -3
  156. package/react/index.js.map +1 -1
  157. package/react/parser/index.d.ts.map +1 -1
  158. package/react/parser/index.js +5 -5
  159. package/react/parser/index.js.map +1 -1
  160. package/react/parser/parser.cjs.js +10 -10
  161. package/react/parser/parser.cjs.js.map +1 -1
  162. package/react/react.cjs.js +2 -3
  163. package/react/react.cjs.js.map +1 -1
  164. package/testing/index.d.ts +1 -0
  165. package/testing/index.d.ts.map +1 -1
  166. package/testing/index.js +1 -3
  167. package/testing/index.js.map +1 -1
  168. package/testing/testing.cjs.js +3 -5
  169. package/testing/testing.cjs.js.map +1 -1
  170. package/utilities/common/canUse.d.ts +1 -0
  171. package/utilities/common/canUse.d.ts.map +1 -1
  172. package/utilities/common/canUse.js +2 -0
  173. package/utilities/common/canUse.js.map +1 -1
  174. package/utilities/common/mergeDeep.js +1 -1
  175. package/utilities/common/mergeDeep.js.map +1 -1
  176. package/utilities/globals/DEV.js +2 -2
  177. package/utilities/globals/DEV.js.map +1 -1
  178. package/utilities/{common → globals}/global.d.ts +0 -0
  179. package/utilities/globals/global.d.ts.map +1 -0
  180. package/utilities/{common → globals}/global.js +0 -0
  181. package/utilities/globals/global.js.map +1 -0
  182. package/utilities/globals/globals.cjs.js +57 -0
  183. package/utilities/globals/globals.cjs.js.map +1 -0
  184. package/utilities/globals/index.d.ts +5 -2
  185. package/utilities/globals/index.d.ts.map +1 -1
  186. package/utilities/globals/index.js +8 -1
  187. package/utilities/globals/index.js.map +1 -1
  188. package/utilities/{common → globals}/maybe.d.ts +0 -0
  189. package/utilities/globals/maybe.d.ts.map +1 -0
  190. package/utilities/{common → globals}/maybe.js +0 -0
  191. package/utilities/globals/maybe.js.map +1 -0
  192. package/utilities/globals/package.json +7 -0
  193. package/utilities/graphql/directives.d.ts.map +1 -1
  194. package/utilities/graphql/directives.js +5 -5
  195. package/utilities/graphql/directives.js.map +1 -1
  196. package/utilities/graphql/fragments.d.ts.map +1 -1
  197. package/utilities/graphql/fragments.js +5 -5
  198. package/utilities/graphql/fragments.js.map +1 -1
  199. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  200. package/utilities/graphql/getFromAST.js +9 -9
  201. package/utilities/graphql/getFromAST.js.map +1 -1
  202. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  203. package/utilities/graphql/storeUtils.js +2 -2
  204. package/utilities/graphql/storeUtils.js.map +1 -1
  205. package/utilities/graphql/transform.d.ts.map +1 -1
  206. package/utilities/graphql/transform.js +2 -2
  207. package/utilities/graphql/transform.js.map +1 -1
  208. package/utilities/index.d.ts +1 -3
  209. package/utilities/index.d.ts.map +1 -1
  210. package/utilities/index.js +1 -5
  211. package/utilities/index.js.map +1 -1
  212. package/utilities/observables/Concast.js +1 -1
  213. package/utilities/observables/Concast.js.map +1 -1
  214. package/utilities/observables/subclassing.d.ts.map +1 -1
  215. package/utilities/observables/subclassing.js +2 -1
  216. package/utilities/observables/subclassing.js.map +1 -1
  217. package/utilities/package.json +1 -3
  218. package/utilities/policies/pagination.d.ts +1 -1
  219. package/utilities/policies/pagination.d.ts.map +1 -1
  220. package/utilities/policies/pagination.js +9 -4
  221. package/utilities/policies/pagination.js.map +1 -1
  222. package/utilities/testing/mocking/mockFetch.js +1 -1
  223. package/utilities/testing/mocking/mockFetch.js.map +1 -1
  224. package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
  225. package/utilities/testing/mocking/mockLink.js +2 -2
  226. package/utilities/testing/mocking/mockLink.js.map +1 -1
  227. package/utilities/testing/mocking/mockWatchQuery.js +1 -1
  228. package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
  229. package/utilities/testing/observableToPromise.js +1 -1
  230. package/utilities/testing/observableToPromise.js.map +1 -1
  231. package/utilities/utilities.cjs.js +42 -74
  232. package/utilities/utilities.cjs.js.map +1 -1
  233. package/version.js +1 -1
  234. package/apollo-core.cjs.js +0 -5768
  235. package/apollo-core.cjs.js.map +0 -1
  236. package/apollo-core.cjs.min.js +0 -1
  237. package/utilities/common/global.d.ts.map +0 -1
  238. package/utilities/common/global.js.map +0 -1
  239. package/utilities/common/maybe.d.ts.map +0 -1
  240. package/utilities/common/maybe.js.map +0 -1
package/README.md CHANGED
@@ -22,9 +22,9 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
22
22
  ## Maintainers
23
23
 
24
24
  - [@benjamn](https://github.com/benjamn) (Apollo)
25
- - [@hwillson](https://github.com/hwillson) (Apollo)
26
- - [@jcreighton](https://github.com/jcreighton) (Apollo)
27
25
  - [@brainkim](https://github.com/brainkim) (Apollo)
26
+ - [@jcreighton](https://github.com/jcreighton) (Netflix)
27
+ - [@hwillson](https://github.com/hwillson) (Apollo)
28
28
 
29
29
  ## Who is Apollo?
30
30
 
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib = require('tslib');
6
6
  var tsInvariant = require('ts-invariant');
7
7
  var equality = require('@wry/equality');
8
- var process$1 = require('ts-invariant/process');
9
- var graphql = require('graphql');
10
8
  var zenObservableTs = require('zen-observable-ts');
11
9
  require('symbol-observable');
10
+ var __ = require('..');
11
+ var graphql = require('graphql');
12
12
  var optimism = require('optimism');
13
13
  var context = require('@wry/context');
14
14
  var trie = require('@wry/trie');
@@ -36,37 +36,6 @@ function maybe(thunk) {
36
36
  catch (_a) { }
37
37
  }
38
38
 
39
- var global$1 = (maybe(function () { return globalThis; }) ||
40
- maybe(function () { return window; }) ||
41
- maybe(function () { return self; }) ||
42
- maybe(function () { return global; }) ||
43
- maybe(function () { return Function("return this")(); }));
44
-
45
- var __ = "__";
46
- var GLOBAL_KEY = [__, __].join("DEV");
47
- function getDEV() {
48
- try {
49
- return Boolean(__DEV__);
50
- }
51
- catch (_a) {
52
- Object.defineProperty(global$1, GLOBAL_KEY, {
53
- value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
54
- enumerable: false,
55
- configurable: true,
56
- writable: true,
57
- });
58
- return global$1[GLOBAL_KEY];
59
- }
60
- }
61
- var DEV = getDEV();
62
-
63
- function removeTemporaryGlobals() {
64
- graphql.isType(null);
65
- return process$1.remove();
66
- }
67
-
68
- removeTemporaryGlobals();
69
-
70
39
  function shouldInclude(_a, variables) {
71
40
  var directives = _a.directives;
72
41
  if (!directives || !directives.length) {
@@ -77,7 +46,7 @@ function shouldInclude(_a, variables) {
77
46
  var evaledValue = false;
78
47
  if (ifArgument.value.kind === 'Variable') {
79
48
  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);
49
+ __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 39);
81
50
  }
82
51
  else {
83
52
  evaledValue = ifArgument.value.value;
@@ -114,13 +83,13 @@ function getInclusionDirectives(directives) {
114
83
  return;
115
84
  var directiveArguments = directive.arguments;
116
85
  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);
86
+ __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
118
87
  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);
88
+ __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
89
  var ifValue = ifArgument.value;
121
90
  __DEV__ ? tsInvariant.invariant(ifValue &&
122
91
  (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);
92
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
124
93
  result.push({ directive: directive, ifArgument: ifArgument });
125
94
  });
126
95
  }
@@ -133,14 +102,14 @@ function getFragmentQueryDocument(document, fragmentName) {
133
102
  document.definitions.forEach(function (definition) {
134
103
  if (definition.kind === 'OperationDefinition') {
135
104
  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);
105
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
137
106
  }
138
107
  if (definition.kind === 'FragmentDefinition') {
139
108
  fragments.push(definition);
140
109
  }
141
110
  });
142
111
  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);
112
+ __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
113
  actualFragmentName = fragments[0].name.value;
145
114
  }
146
115
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -160,7 +129,7 @@ function getFragmentQueryDocument(document, fragmentName) {
160
129
  ],
161
130
  },
162
131
  }
163
- ], document.definitions) });
132
+ ], document.definitions, true) });
164
133
  return query;
165
134
  }
166
135
  function createFragmentMap(fragments) {
@@ -177,7 +146,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
177
146
  return selection;
178
147
  case 'FragmentSpread': {
179
148
  var fragment = fragmentMap && fragmentMap[selection.name.value];
180
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 49);
149
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 45);
181
150
  return fragment;
182
151
  }
183
152
  default:
@@ -261,7 +230,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
261
230
  else {
262
231
  throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
263
232
  'is not supported. Use variables instead of inline arguments to ' +
264
- 'overcome this limitation.') : new tsInvariant.InvariantError(58);
233
+ 'overcome this limitation.') : new tsInvariant.InvariantError(54);
265
234
  }
266
235
  }
267
236
  function storeKeyNameFromField(field, variables) {
@@ -395,16 +364,16 @@ function isInlineFragment(selection) {
395
364
  }
396
365
 
397
366
  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);
367
+ __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
368
  var operations = doc.definitions
400
369
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
401
370
  .map(function (definition) {
402
371
  if (definition.kind !== 'OperationDefinition') {
403
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(51);
372
+ throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(47);
404
373
  }
405
374
  return definition;
406
375
  });
407
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 52);
376
+ __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 48);
408
377
  return doc;
409
378
  }
410
379
  function getOperationDefinition(doc) {
@@ -423,14 +392,14 @@ function getFragmentDefinitions(doc) {
423
392
  }
424
393
  function getQueryDefinition(doc) {
425
394
  var queryDef = getOperationDefinition(doc);
426
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
395
+ __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
427
396
  return queryDef;
428
397
  }
429
398
  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);
399
+ __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);
400
+ __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
432
401
  var fragmentDef = doc.definitions[0];
433
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
402
+ __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
434
403
  return fragmentDef;
435
404
  }
436
405
  function getMainDefinition(queryDoc) {
@@ -453,7 +422,7 @@ function getMainDefinition(queryDoc) {
453
422
  if (fragmentDefinition) {
454
423
  return fragmentDefinition;
455
424
  }
456
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
425
+ throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
457
426
  }
458
427
  function getDefaultValues(definition) {
459
428
  var defaultValues = Object.create(null);
@@ -596,7 +565,7 @@ var addTypenameToDocument = Object.assign(function (doc) {
596
565
  field.directives.some(function (d) { return d.name.value === 'export'; })) {
597
566
  return;
598
567
  }
599
- return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections), [TYPENAME_FIELD]) });
568
+ return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
600
569
  },
601
570
  },
602
571
  });
@@ -735,7 +704,7 @@ function removeClientSetsFromDocument(document) {
735
704
  return modifiedDoc;
736
705
  }
737
706
 
738
- var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
707
+ var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
739
708
  function mergeDeep() {
740
709
  var sources = [];
741
710
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -772,10 +741,10 @@ var DeepMerger = (function () {
772
741
  }
773
742
  if (isNonNullObject(source) && isNonNullObject(target)) {
774
743
  Object.keys(source).forEach(function (sourceKey) {
775
- if (hasOwnProperty$2.call(target, sourceKey)) {
744
+ if (hasOwnProperty$3.call(target, sourceKey)) {
776
745
  var targetValue = target[sourceKey];
777
746
  if (source[sourceKey] !== targetValue) {
778
- var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
747
+ var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
779
748
  if (result !== targetValue) {
780
749
  target = _this.shallowCopyForMerge(target);
781
750
  target[sourceKey] = result;
@@ -918,7 +887,7 @@ function fixObservableSubclass(subclass) {
918
887
  function set(key) {
919
888
  Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
920
889
  }
921
- if (typeof Symbol === "function" && Symbol.species) {
890
+ if (__.canUseSymbol && Symbol.species) {
922
891
  set(Symbol.species);
923
892
  }
924
893
  set("@@species");
@@ -952,7 +921,7 @@ var Concast = (function (_super) {
952
921
  var sub = _this.sub;
953
922
  if (sub !== null) {
954
923
  if (sub)
955
- Promise.resolve().then(function () { return sub.unsubscribe(); });
924
+ setTimeout(function () { return sub.unsubscribe(); });
956
925
  _this.sub = null;
957
926
  _this.latest = ["error", error];
958
927
  _this.reject(error);
@@ -1067,6 +1036,8 @@ function graphQLResultHasError(result) {
1067
1036
  var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
1068
1037
  navigator.product === 'ReactNative');
1069
1038
  var canUseWeakSet = typeof WeakSet === 'function';
1039
+ var canUseSymbol = typeof Symbol === 'function' &&
1040
+ typeof Symbol.for === 'function';
1070
1041
 
1071
1042
  function compact() {
1072
1043
  var objects = [];
@@ -1101,8 +1072,6 @@ function stringifyForDisplay(value) {
1101
1072
  }).split(JSON.stringify(undefId)).join("<undefined>");
1102
1073
  }
1103
1074
 
1104
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 59);
1105
-
1106
1075
  function fromError(errorValue) {
1107
1076
  return new zenObservableTs.Observable(function (observer) {
1108
1077
  observer.error(errorValue);
@@ -1158,7 +1127,7 @@ function validateOperation(operation) {
1158
1127
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
1159
1128
  var key = _a[_i];
1160
1129
  if (OPERATION_FIELDS.indexOf(key) < 0) {
1161
- throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(29);
1130
+ throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(26);
1162
1131
  }
1163
1132
  }
1164
1133
  return operation;
@@ -1281,7 +1250,7 @@ var ApolloLink = (function () {
1281
1250
  return ApolloLink.concat(this, next);
1282
1251
  };
1283
1252
  ApolloLink.prototype.request = function (operation, forward) {
1284
- throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(23);
1253
+ throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(21);
1285
1254
  };
1286
1255
  ApolloLink.prototype.onError = function (error, observer) {
1287
1256
  if (observer && observer.error) {
@@ -1307,9 +1276,9 @@ var concat = ApolloLink.concat;
1307
1276
 
1308
1277
  var execute = ApolloLink.execute;
1309
1278
 
1310
- var version = '3.4.8';
1279
+ var version = '3.4.12';
1311
1280
 
1312
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1281
+ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1313
1282
  function parseAndCheckHttpResponse(operations) {
1314
1283
  return function (response) { return response
1315
1284
  .text()
@@ -1331,8 +1300,8 @@ function parseAndCheckHttpResponse(operations) {
1331
1300
  throwServerError(response, result, "Response not successful: Received status code " + response.status);
1332
1301
  }
1333
1302
  if (!Array.isArray(result) &&
1334
- !hasOwnProperty$1.call(result, 'data') &&
1335
- !hasOwnProperty$1.call(result, 'errors')) {
1303
+ !hasOwnProperty$2.call(result, 'data') &&
1304
+ !hasOwnProperty$2.call(result, 'errors')) {
1336
1305
  throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
1337
1306
  ? operations.map(function (op) { return op.operationName; })
1338
1307
  : operations.operationName) + "'.");
@@ -1347,7 +1316,7 @@ var serializeFetchParameter = function (p, label) {
1347
1316
  serialized = JSON.stringify(p);
1348
1317
  }
1349
1318
  catch (e) {
1350
- var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(26);
1319
+ var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(23);
1351
1320
  parseError.parseError = e;
1352
1321
  throw parseError;
1353
1322
  }
@@ -1407,7 +1376,7 @@ function headersToLowerCase(headers) {
1407
1376
 
1408
1377
  var checkFetcher = function (fetcher) {
1409
1378
  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);
1379
+ 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
1380
  }
1412
1381
  };
1413
1382
 
@@ -1787,7 +1756,7 @@ var EntityStore = (function () {
1787
1756
  : newer;
1788
1757
  if (!incoming)
1789
1758
  return;
1790
- __DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 2);
1759
+ __DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 1);
1791
1760
  var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
1792
1761
  this.data[dataId] = merged;
1793
1762
  if (merged !== existing) {
@@ -2378,7 +2347,7 @@ var StoreReader = (function () {
2378
2347
  !context.store.has(objectOrReference.__ref)) {
2379
2348
  return {
2380
2349
  result: this.canon.empty,
2381
- missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(6), context)],
2350
+ missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(5), context)],
2382
2351
  };
2383
2352
  }
2384
2353
  var variables = context.variables, policies = context.policies, store = context.store;
@@ -2417,7 +2386,7 @@ var StoreReader = (function () {
2417
2386
  if (!addTypenameToDocument.added(selection)) {
2418
2387
  getMissing().push(missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
2419
2388
  ? objectOrReference.__ref + " object"
2420
- : "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(7), context));
2389
+ : "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(6), context));
2421
2390
  }
2422
2391
  }
2423
2392
  else if (Array.isArray(fieldValue)) {
@@ -2514,7 +2483,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
2514
2483
  var workSet_1 = new Set([fieldValue]);
2515
2484
  workSet_1.forEach(function (value) {
2516
2485
  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);
2486
+ __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
2487
  Object.values(value).forEach(workSet_1.add, workSet_1);
2519
2488
  }
2520
2489
  });
@@ -2553,7 +2522,7 @@ var StoreWriter = (function () {
2553
2522
  context: context,
2554
2523
  });
2555
2524
  if (!isReference(ref)) {
2556
- throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(9);
2525
+ throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(8);
2557
2526
  }
2558
2527
  context.incomingById.forEach(function (_a, dataId) {
2559
2528
  var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections;
@@ -3050,7 +3019,7 @@ var Policies = (function () {
3050
3019
  var rootId = "ROOT_" + which.toUpperCase();
3051
3020
  var old = this.rootTypenamesById[rootId];
3052
3021
  if (typename !== old) {
3053
- __DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 3);
3022
+ __DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 2);
3054
3023
  if (old)
3055
3024
  delete this.rootIdsByTypename[old];
3056
3025
  this.rootIdsByTypename[typename] = rootId;
@@ -3294,7 +3263,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
3294
3263
  function makeMergeObjectsFunction(store) {
3295
3264
  return function mergeObjects(existing, incoming) {
3296
3265
  if (Array.isArray(existing) || Array.isArray(incoming)) {
3297
- throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(4);
3266
+ throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(3);
3298
3267
  }
3299
3268
  if (isNonNullObject(existing) &&
3300
3269
  isNonNullObject(incoming)) {
@@ -3394,7 +3363,7 @@ function computeKeyObject(response, specifier, strict, aliasMap) {
3394
3363
  keyObj[lastActualKey = s] = response[lastResponseKey = responseName];
3395
3364
  }
3396
3365
  else {
3397
- __DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 5);
3366
+ __DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 4);
3398
3367
  lastResponseKey = lastActualKey = void 0;
3399
3368
  }
3400
3369
  }
@@ -3687,7 +3656,6 @@ var InMemoryCache = (function (_super) {
3687
3656
  return InMemoryCache;
3688
3657
  }(ApolloCache));
3689
3658
 
3690
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 22);
3691
3659
  function isApolloError(err) {
3692
3660
  return err.hasOwnProperty('graphQLErrors');
3693
3661
  }
@@ -3739,6 +3707,7 @@ function isNetworkRequestInFlight(networkStatus) {
3739
3707
  return networkStatus ? networkStatus < 7 : false;
3740
3708
  }
3741
3709
 
3710
+ var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
3742
3711
  var warnedAboutUpdateQuery = false;
3743
3712
  var ObservableQuery = (function (_super) {
3744
3713
  tslib.__extends(ObservableQuery, _super);
@@ -3815,7 +3784,12 @@ var ObservableQuery = (function (_super) {
3815
3784
  (lastResult && lastResult.networkStatus) ||
3816
3785
  exports.NetworkStatus.ready;
3817
3786
  var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
3818
- if (!this.queryManager.transform(this.options.query).hasForcedResolvers) {
3787
+ var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
3788
+ var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' &&
3789
+ fetchPolicy !== 'no-cache' &&
3790
+ fetchPolicy !== 'standby');
3791
+ if (shouldReturnCachedData &&
3792
+ !this.queryManager.transform(this.options.query).hasForcedResolvers) {
3819
3793
  var diff = this.queryInfo.getDiff();
3820
3794
  if (diff.complete || this.options.returnPartialData) {
3821
3795
  result.data = diff.result;
@@ -3823,7 +3797,6 @@ var ObservableQuery = (function (_super) {
3823
3797
  if (equality.equal(result.data, {})) {
3824
3798
  result.data = void 0;
3825
3799
  }
3826
- var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
3827
3800
  if (diff.complete) {
3828
3801
  if (result.networkStatus === exports.NetworkStatus.loading &&
3829
3802
  (fetchPolicy === 'cache-first' ||
@@ -3875,6 +3848,7 @@ var ObservableQuery = (function (_super) {
3875
3848
  this.queryManager.resetErrors(this.queryId);
3876
3849
  };
3877
3850
  ObservableQuery.prototype.refetch = function (variables) {
3851
+ var _a;
3878
3852
  var reobserveOptions = {
3879
3853
  pollInterval: 0,
3880
3854
  };
@@ -3885,6 +3859,13 @@ var ObservableQuery = (function (_super) {
3885
3859
  else if (fetchPolicy !== 'cache-and-network') {
3886
3860
  reobserveOptions.fetchPolicy = 'network-only';
3887
3861
  }
3862
+ if (__DEV__ && variables && hasOwnProperty$1.call(variables, "variables")) {
3863
+ var queryDef = getQueryDefinition(this.options.query);
3864
+ var vars = queryDef.variableDefinitions;
3865
+ if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
3866
+ __DEV__ && tsInvariant.invariant.warn("Called refetch(" + JSON.stringify(variables) + ") for query " + (((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef)) + ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?");
3867
+ }
3868
+ }
3888
3869
  if (variables && !equality.equal(this.options.variables, variables)) {
3889
3870
  reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables);
3890
3871
  }
@@ -4029,7 +4010,7 @@ var ObservableQuery = (function (_super) {
4029
4010
  pollingInfo.interval === pollInterval) {
4030
4011
  return;
4031
4012
  }
4032
- __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
4013
+ __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 12);
4033
4014
  var info = pollingInfo || (this.pollingInfo = {});
4034
4015
  info.interval = pollInterval;
4035
4016
  var maybeFetch = function () {
@@ -4072,7 +4053,7 @@ var ObservableQuery = (function (_super) {
4072
4053
  var oldVariables = this.options.variables;
4073
4054
  var options = useDisposableConcast
4074
4055
  ? compact(this.options, newOptions)
4075
- : Object.assign(this.options, compact(newOptions));
4056
+ : assign(this.options, compact(newOptions));
4076
4057
  if (!useDisposableConcast) {
4077
4058
  this.updatePolling();
4078
4059
  if (newOptions &&
@@ -4326,7 +4307,7 @@ var LocalState = (function () {
4326
4307
  }
4327
4308
  else {
4328
4309
  fragment = fragmentMap[selection.name.value];
4329
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 12);
4310
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 11);
4330
4311
  }
4331
4312
  if (fragment && fragment.typeCondition) {
4332
4313
  typeCondition = fragment.typeCondition.name.value;
@@ -4712,7 +4693,7 @@ var QueryManager = (function () {
4712
4693
  this.queries.forEach(function (_info, queryId) {
4713
4694
  _this.stopQueryNoBroadcast(queryId);
4714
4695
  });
4715
- this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
4696
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(13));
4716
4697
  };
4717
4698
  QueryManager.prototype.cancelPendingFetches = function (error) {
4718
4699
  this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
@@ -4725,10 +4706,10 @@ var QueryManager = (function () {
4725
4706
  return tslib.__generator(this, function (_f) {
4726
4707
  switch (_f.label) {
4727
4708
  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);
4709
+ __DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 14);
4729
4710
  __DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
4730
4711
  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);
4712
+ fetchPolicy === 'no-cache', 15);
4732
4713
  mutationId = this.generateMutationId();
4733
4714
  mutation = this.transform(mutation).document;
4734
4715
  variables = this.getVariables(mutation, variables);
@@ -5013,10 +4994,10 @@ var QueryManager = (function () {
5013
4994
  var _this = this;
5014
4995
  if (queryId === void 0) { queryId = this.generateQueryId(); }
5015
4996
  __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);
4997
+ 'in the query option.') : tsInvariant.invariant(options.query, 16);
4998
+ __DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 17);
4999
+ __DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 18);
5000
+ __DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 19);
5020
5001
  return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
5021
5002
  };
5022
5003
  QueryManager.prototype.generateQueryId = function () {
@@ -5038,7 +5019,7 @@ var QueryManager = (function () {
5038
5019
  queryInfo.stop();
5039
5020
  };
5040
5021
  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));
5022
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(20));
5042
5023
  this.queries.forEach(function (queryInfo) {
5043
5024
  if (queryInfo.observableQuery) {
5044
5025
  queryInfo.networkStatus = exports.NetworkStatus.loading;
@@ -5313,7 +5294,7 @@ var QueryManager = (function () {
5313
5294
  return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
5314
5295
  };
5315
5296
  this.fetchCancelFns.set(queryId, function (reason) {
5316
- Promise.resolve().then(function () { return concast.cancel(reason); });
5297
+ setTimeout(function () { return concast.cancel(reason); });
5317
5298
  });
5318
5299
  var concast = new Concast(this.transform(normalized.query).hasClientExports
5319
5300
  ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
@@ -5531,7 +5512,7 @@ var ApolloClient = (function () {
5531
5512
  if (!cache) {
5532
5513
  throw __DEV__ ? new tsInvariant.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
5533
5514
  "in the options object. \n" +
5534
- "For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(10);
5515
+ "For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(9);
5535
5516
  }
5536
5517
  this.link = link;
5537
5518
  this.cache = cache;
@@ -5627,7 +5608,7 @@ var ApolloClient = (function () {
5627
5608
  __DEV__ ? tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +
5628
5609
  'client.query can only return a single result. Please use client.watchQuery ' +
5629
5610
  '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);
5611
+ 'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 10);
5631
5612
  if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
5632
5613
  options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' });
5633
5614
  }
@@ -5738,13 +5719,19 @@ var ApolloClient = (function () {
5738
5719
  return ApolloClient;
5739
5720
  }());
5740
5721
 
5741
- var cache$1 = new (canUseWeakMap ? WeakMap : Map)();
5722
+ var contextKey = canUseSymbol
5723
+ ? Symbol.for('__APOLLO_CONTEXT__')
5724
+ : '__APOLLO_CONTEXT__';
5742
5725
  function getApolloContext() {
5743
- var context = cache$1.get(React__namespace.createContext);
5726
+ var context = React__namespace.createContext[contextKey];
5744
5727
  if (!context) {
5745
- context = React__namespace.createContext({});
5728
+ Object.defineProperty(React__namespace.createContext, contextKey, {
5729
+ value: context = React__namespace.createContext({}),
5730
+ enumerable: false,
5731
+ writable: false,
5732
+ configurable: true,
5733
+ });
5746
5734
  context.displayName = 'ApolloContext';
5747
- cache$1.set(React__namespace.createContext, context);
5748
5735
  }
5749
5736
  return context;
5750
5737
  }
@@ -5753,7 +5740,7 @@ var ApolloConsumer = function (props) {
5753
5740
  var ApolloContext = getApolloContext();
5754
5741
  return React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
5755
5742
  __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);
5743
+ 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 27);
5757
5744
  return props.children(context.client);
5758
5745
  });
5759
5746
  };
@@ -5767,7 +5754,7 @@ var ApolloProvider = function (_a) {
5767
5754
  context = Object.assign({}, context, { client: client });
5768
5755
  }
5769
5756
  __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);
5757
+ 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 28);
5771
5758
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
5772
5759
  });
5773
5760
  };
@@ -5775,7 +5762,7 @@ var ApolloProvider = function (_a) {
5775
5762
  function useApolloClient() {
5776
5763
  var client = React__namespace.useContext(getApolloContext()).client;
5777
5764
  __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);
5765
+ 'have called `ApolloProvider` higher up in your tree.') : tsInvariant.invariant(client, 33);
5779
5766
  return client;
5780
5767
  }
5781
5768
 
@@ -5808,7 +5795,7 @@ function parser(document) {
5808
5795
  var variables, type, name;
5809
5796
  __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
5810
5797
  "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);
5798
+ "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 34);
5812
5799
  var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });
5813
5800
  var queries = document.definitions.filter(function (x) {
5814
5801
  return x.kind === 'OperationDefinition' && x.operation === 'query';
@@ -5822,11 +5809,11 @@ function parser(document) {
5822
5809
  __DEV__ ? tsInvariant.invariant(!fragments.length ||
5823
5810
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
5824
5811
  "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
5825
- (queries.length || mutations.length || subscriptions.length), 39);
5812
+ (queries.length || mutations.length || subscriptions.length), 35);
5826
5813
  __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
5827
5814
  (document + " had " + queries.length + " queries, " + subscriptions.length + " ") +
5828
5815
  ("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);
5816
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 36);
5830
5817
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
5831
5818
  if (!queries.length && !mutations.length)
5832
5819
  type = exports.DocumentType.Subscription;
@@ -5837,7 +5824,7 @@ function parser(document) {
5837
5824
  : subscriptions;
5838
5825
  __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
5839
5826
  (definitions.length + " definitions. ") +
5840
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 41);
5827
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 37);
5841
5828
  var definition = definitions[0];
5842
5829
  variables = definition.variableDefinitions || [];
5843
5830
  if (definition.name && definition.name.kind === 'Name') {
@@ -5878,7 +5865,7 @@ var OperationData = (function () {
5878
5865
  (this.context && this.context.client);
5879
5866
  __DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
5880
5867
  'Wrap the root component in an <ApolloProvider>, or pass an ' +
5881
- 'ApolloClient instance in via options.') : tsInvariant.invariant(!!client, 32);
5868
+ 'ApolloClient instance in via options.') : tsInvariant.invariant(!!client, 29);
5882
5869
  var isNew = false;
5883
5870
  if (client !== this.client) {
5884
5871
  isNew = true;
@@ -5895,7 +5882,7 @@ var OperationData = (function () {
5895
5882
  var requiredOperationName = operationName(type);
5896
5883
  var usedOperationName = operationName(operation.type);
5897
5884
  __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);
5885
+ (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : tsInvariant.invariant(operation.type === type, 30);
5899
5886
  };
5900
5887
  return OperationData;
5901
5888
  }());
@@ -6189,9 +6176,7 @@ var QueryData = (function (_super) {
6189
6176
  var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c;
6190
6177
  this.isMounted = true;
6191
6178
  var options = this.getOptions();
6192
- if (this.currentObservable &&
6193
- !this.ssrInitiated() &&
6194
- !this.client.disableNetworkFetches) {
6179
+ if (this.currentObservable && !this.ssrInitiated()) {
6195
6180
  this.startQuerySubscription();
6196
6181
  }
6197
6182
  if (!lazy || this.runLazy) {