@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
@@ -2,50 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tsInvariant = require('ts-invariant');
6
- var process$1 = require('ts-invariant/process');
5
+ var globals = require('./globals');
7
6
  var graphql = require('graphql');
8
7
  var tslib = require('tslib');
9
8
  var zenObservableTs = require('zen-observable-ts');
10
9
  require('symbol-observable');
11
-
12
- function maybe(thunk) {
13
- try {
14
- return thunk();
15
- }
16
- catch (_a) { }
17
- }
18
-
19
- var global$1 = (maybe(function () { return globalThis; }) ||
20
- maybe(function () { return window; }) ||
21
- maybe(function () { return self; }) ||
22
- maybe(function () { return global; }) ||
23
- maybe(function () { return Function("return this")(); }));
24
-
25
- var __ = "__";
26
- var GLOBAL_KEY = [__, __].join("DEV");
27
- function getDEV() {
28
- try {
29
- return Boolean(__DEV__);
30
- }
31
- catch (_a) {
32
- Object.defineProperty(global$1, GLOBAL_KEY, {
33
- value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
34
- enumerable: false,
35
- configurable: true,
36
- writable: true,
37
- });
38
- return global$1[GLOBAL_KEY];
39
- }
40
- }
41
- var DEV = getDEV();
42
-
43
- function removeTemporaryGlobals() {
44
- graphql.isType(null);
45
- return process$1.remove();
46
- }
47
-
48
- removeTemporaryGlobals();
10
+ var __ = require('..');
49
11
 
50
12
  function shouldInclude(_a, variables) {
51
13
  var directives = _a.directives;
@@ -57,7 +19,7 @@ function shouldInclude(_a, variables) {
57
19
  var evaledValue = false;
58
20
  if (ifArgument.value.kind === 'Variable') {
59
21
  evaledValue = variables && variables[ifArgument.value.name.value];
60
- __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 43);
22
+ __DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : globals.invariant(evaledValue !== void 0, 39);
61
23
  }
62
24
  else {
63
25
  evaledValue = ifArgument.value.value;
@@ -94,13 +56,13 @@ function getInclusionDirectives(directives) {
94
56
  return;
95
57
  var directiveArguments = directive.arguments;
96
58
  var directiveName = directive.name.value;
97
- __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 44);
59
+ __DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : globals.invariant(directiveArguments && directiveArguments.length === 1, 40);
98
60
  var ifArgument = directiveArguments[0];
99
- __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 45);
61
+ __DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
100
62
  var ifValue = ifArgument.value;
101
- __DEV__ ? tsInvariant.invariant(ifValue &&
102
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : tsInvariant.invariant(ifValue &&
103
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 46);
63
+ __DEV__ ? globals.invariant(ifValue &&
64
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : globals.invariant(ifValue &&
65
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
104
66
  result.push({ directive: directive, ifArgument: ifArgument });
105
67
  });
106
68
  }
@@ -112,15 +74,15 @@ function getFragmentQueryDocument(document, fragmentName) {
112
74
  var fragments = [];
113
75
  document.definitions.forEach(function (definition) {
114
76
  if (definition.kind === 'OperationDefinition') {
115
- throw __DEV__ ? new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
116
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(47);
77
+ throw __DEV__ ? new globals.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
78
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(43);
117
79
  }
118
80
  if (definition.kind === 'FragmentDefinition') {
119
81
  fragments.push(definition);
120
82
  }
121
83
  });
122
84
  if (typeof actualFragmentName === 'undefined') {
123
- __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);
85
+ __DEV__ ? globals.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : globals.invariant(fragments.length === 1, 44);
124
86
  actualFragmentName = fragments[0].name.value;
125
87
  }
126
88
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -140,7 +102,7 @@ function getFragmentQueryDocument(document, fragmentName) {
140
102
  ],
141
103
  },
142
104
  }
143
- ], document.definitions) });
105
+ ], document.definitions, true) });
144
106
  return query;
145
107
  }
146
108
  function createFragmentMap(fragments) {
@@ -157,7 +119,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
157
119
  return selection;
158
120
  case 'FragmentSpread': {
159
121
  var fragment = fragmentMap && fragmentMap[selection.name.value];
160
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 49);
122
+ __DEV__ ? globals.invariant(fragment, "No fragment named " + selection.name.value + ".") : globals.invariant(fragment, 45);
161
123
  return fragment;
162
124
  }
163
125
  default:
@@ -239,9 +201,9 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
239
201
  argObj[name.value] = null;
240
202
  }
241
203
  else {
242
- throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
204
+ throw __DEV__ ? new globals.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
243
205
  'is not supported. Use variables instead of inline arguments to ' +
244
- 'overcome this limitation.') : new tsInvariant.InvariantError(58);
206
+ 'overcome this limitation.') : new globals.InvariantError(54);
245
207
  }
246
208
  }
247
209
  function storeKeyNameFromField(field, variables) {
@@ -375,16 +337,16 @@ function isInlineFragment(selection) {
375
337
  }
376
338
 
377
339
  function checkDocument(doc) {
378
- __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);
340
+ __DEV__ ? globals.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") : globals.invariant(doc && doc.kind === 'Document', 46);
379
341
  var operations = doc.definitions
380
342
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
381
343
  .map(function (definition) {
382
344
  if (definition.kind !== 'OperationDefinition') {
383
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(51);
345
+ throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new globals.InvariantError(47);
384
346
  }
385
347
  return definition;
386
348
  });
387
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 52);
349
+ __DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : globals.invariant(operations.length <= 1, 48);
388
350
  return doc;
389
351
  }
390
352
  function getOperationDefinition(doc) {
@@ -403,14 +365,14 @@ function getFragmentDefinitions(doc) {
403
365
  }
404
366
  function getQueryDefinition(doc) {
405
367
  var queryDef = getOperationDefinition(doc);
406
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
368
+ __DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 49);
407
369
  return queryDef;
408
370
  }
409
371
  function getFragmentDefinition(doc) {
410
- __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);
411
- __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 55);
372
+ __DEV__ ? globals.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") : globals.invariant(doc.kind === 'Document', 50);
373
+ __DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 51);
412
374
  var fragmentDef = doc.definitions[0];
413
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
375
+ __DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
414
376
  return fragmentDef;
415
377
  }
416
378
  function getMainDefinition(queryDoc) {
@@ -433,7 +395,7 @@ function getMainDefinition(queryDoc) {
433
395
  if (fragmentDefinition) {
434
396
  return fragmentDefinition;
435
397
  }
436
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
398
+ throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(53);
437
399
  }
438
400
  function getDefaultValues(definition) {
439
401
  var defaultValues = Object.create(null);
@@ -576,7 +538,7 @@ var addTypenameToDocument = Object.assign(function (doc) {
576
538
  field.directives.some(function (d) { return d.name.value === 'export'; })) {
577
539
  return;
578
540
  }
579
- return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections), [TYPENAME_FIELD]) });
541
+ return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
580
542
  },
581
543
  },
582
544
  });
@@ -591,7 +553,7 @@ var connectionRemoveConfig = {
591
553
  if (willRemove) {
592
554
  if (!directive.arguments ||
593
555
  !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
594
- __DEV__ && tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
556
+ __DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
595
557
  'You may want to use the key parameter to specify a store key.');
596
558
  }
597
559
  }
@@ -755,7 +717,7 @@ var DeepMerger = (function () {
755
717
  if (hasOwnProperty.call(target, sourceKey)) {
756
718
  var targetValue = target[sourceKey];
757
719
  if (source[sourceKey] !== targetValue) {
758
- var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
720
+ var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
759
721
  if (result !== targetValue) {
760
722
  target = _this.shallowCopyForMerge(target);
761
723
  target[sourceKey] = result;
@@ -791,7 +753,7 @@ function concatPagination(keyArgs) {
791
753
  return {
792
754
  keyArgs: keyArgs,
793
755
  merge: function (existing, incoming) {
794
- return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing), incoming) : incoming;
756
+ return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming;
795
757
  },
796
758
  };
797
759
  }
@@ -822,7 +784,7 @@ function relayStylePagination(keyArgs) {
822
784
  read: function (existing, _a) {
823
785
  var canRead = _a.canRead, readField = _a.readField;
824
786
  if (!existing)
825
- return;
787
+ return existing;
826
788
  var edges = [];
827
789
  var firstEdgeCursor = "";
828
790
  var lastEdgeCursor = "";
@@ -839,8 +801,13 @@ function relayStylePagination(keyArgs) {
839
801
  return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
840
802
  },
841
803
  merge: function (existing, incoming, _a) {
842
- if (existing === void 0) { existing = makeEmptyData(); }
843
804
  var args = _a.args, isReference = _a.isReference, readField = _a.readField;
805
+ if (!existing) {
806
+ existing = makeEmptyData();
807
+ }
808
+ if (!incoming) {
809
+ return existing;
810
+ }
844
811
  var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) {
845
812
  if (isReference(edge = tslib.__assign({}, edge))) {
846
813
  edge.cursor = readField("cursor", edge);
@@ -891,7 +858,7 @@ function relayStylePagination(keyArgs) {
891
858
  else if (incoming.edges) {
892
859
  prefix = [];
893
860
  }
894
- var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix), incomingEdges), suffix);
861
+ var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true);
895
862
  var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo);
896
863
  if (incoming.pageInfo) {
897
864
  var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]);
@@ -1039,7 +1006,7 @@ function fixObservableSubclass(subclass) {
1039
1006
  function set(key) {
1040
1007
  Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
1041
1008
  }
1042
- if (typeof Symbol === "function" && Symbol.species) {
1009
+ if (__.canUseSymbol && Symbol.species) {
1043
1010
  set(Symbol.species);
1044
1011
  }
1045
1012
  set("@@species");
@@ -1073,7 +1040,7 @@ var Concast = (function (_super) {
1073
1040
  var sub = _this.sub;
1074
1041
  if (sub !== null) {
1075
1042
  if (sub)
1076
- Promise.resolve().then(function () { return sub.unsubscribe(); });
1043
+ setTimeout(function () { return sub.unsubscribe(); });
1077
1044
  _this.sub = null;
1078
1045
  _this.latest = ["error", error];
1079
1046
  _this.reject(error);
@@ -1188,6 +1155,8 @@ function graphQLResultHasError(result) {
1188
1155
  var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
1189
1156
  navigator.product === 'ReactNative');
1190
1157
  var canUseWeakSet = typeof WeakSet === 'function';
1158
+ var canUseSymbol = typeof Symbol === 'function' &&
1159
+ typeof Symbol.for === 'function';
1191
1160
 
1192
1161
  function compact() {
1193
1162
  var objects = [];
@@ -1222,16 +1191,16 @@ function stringifyForDisplay(value) {
1222
1191
  }).split(JSON.stringify(undefId)).join("<undefined>");
1223
1192
  }
1224
1193
 
1225
- __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 59);
1226
-
1194
+ exports.DEV = globals.DEV;
1195
+ exports.maybe = globals.maybe;
1227
1196
  exports.Observable = zenObservableTs.Observable;
1228
1197
  exports.Concast = Concast;
1229
- exports.DEV = DEV;
1230
1198
  exports.DeepMerger = DeepMerger;
1231
1199
  exports.addTypenameToDocument = addTypenameToDocument;
1232
1200
  exports.argumentsObjectFromField = argumentsObjectFromField;
1233
1201
  exports.asyncMap = asyncMap;
1234
1202
  exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
1203
+ exports.canUseSymbol = canUseSymbol;
1235
1204
  exports.canUseWeakMap = canUseWeakMap;
1236
1205
  exports.canUseWeakSet = canUseWeakSet;
1237
1206
  exports.checkDocument = checkDocument;
@@ -1265,7 +1234,6 @@ exports.isReference = isReference;
1265
1234
  exports.iterateObserversSafely = iterateObserversSafely;
1266
1235
  exports.makeReference = makeReference;
1267
1236
  exports.makeUniqueId = makeUniqueId;
1268
- exports.maybe = maybe;
1269
1237
  exports.maybeDeepFreeze = maybeDeepFreeze;
1270
1238
  exports.mergeDeep = mergeDeep;
1271
1239
  exports.mergeDeepArray = mergeDeepArray;