@apollo/client 3.8.0-alpha.1 → 3.8.0-alpha.10

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 (343) hide show
  1. package/README.md +3 -1
  2. package/apollo-client.cjs +471 -291
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +54 -44
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/cache.cjs.native.js +54 -44
  8. package/cache/core/cache.d.ts +1 -1
  9. package/cache/core/cache.d.ts.map +1 -1
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/core/types/DataProxy.d.ts +3 -2
  12. package/cache/core/types/DataProxy.d.ts.map +1 -1
  13. package/cache/core/types/DataProxy.js.map +1 -1
  14. package/cache/core/types/common.d.ts +7 -7
  15. package/cache/core/types/common.d.ts.map +1 -1
  16. package/cache/inmemory/entityStore.d.ts +1 -1
  17. package/cache/inmemory/entityStore.d.ts.map +1 -1
  18. package/cache/inmemory/entityStore.js +1 -1
  19. package/cache/inmemory/helpers.d.ts +2 -2
  20. package/cache/inmemory/helpers.d.ts.map +1 -1
  21. package/cache/inmemory/helpers.js +2 -2
  22. package/cache/inmemory/helpers.js.map +1 -1
  23. package/cache/inmemory/inMemoryCache.d.ts +3 -2
  24. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  25. package/cache/inmemory/inMemoryCache.js +1 -1
  26. package/cache/inmemory/inMemoryCache.js.map +1 -1
  27. package/cache/inmemory/key-extractor.js +1 -1
  28. package/cache/inmemory/object-canon.d.ts +0 -1
  29. package/cache/inmemory/object-canon.d.ts.map +1 -1
  30. package/cache/inmemory/object-canon.js +1 -1
  31. package/cache/inmemory/object-canon.js.map +1 -1
  32. package/cache/inmemory/policies.d.ts +12 -12
  33. package/cache/inmemory/policies.d.ts.map +1 -1
  34. package/cache/inmemory/policies.js +15 -4
  35. package/cache/inmemory/policies.js.map +1 -1
  36. package/cache/inmemory/reactiveVars.d.ts +1 -1
  37. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  38. package/cache/inmemory/readFromStore.d.ts +2 -2
  39. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  40. package/cache/inmemory/readFromStore.js +1 -1
  41. package/cache/inmemory/readFromStore.js.map +1 -1
  42. package/cache/inmemory/types.d.ts +4 -4
  43. package/cache/inmemory/types.d.ts.map +1 -1
  44. package/cache/inmemory/writeToStore.d.ts +1 -1
  45. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  46. package/cache/inmemory/writeToStore.js +1 -1
  47. package/cache/inmemory/writeToStore.js.map +1 -1
  48. package/core/ApolloClient.d.ts +10 -9
  49. package/core/ApolloClient.d.ts.map +1 -1
  50. package/core/ApolloClient.js +11 -5
  51. package/core/ApolloClient.js.map +1 -1
  52. package/core/LocalState.d.ts +12 -7
  53. package/core/LocalState.d.ts.map +1 -1
  54. package/core/LocalState.js +71 -17
  55. package/core/LocalState.js.map +1 -1
  56. package/core/ObservableQuery.d.ts +5 -5
  57. package/core/ObservableQuery.d.ts.map +1 -1
  58. package/core/ObservableQuery.js +2 -2
  59. package/core/ObservableQuery.js.map +1 -1
  60. package/core/QueryInfo.d.ts +1 -1
  61. package/core/QueryInfo.d.ts.map +1 -1
  62. package/core/QueryInfo.js +1 -1
  63. package/core/QueryInfo.js.map +1 -1
  64. package/core/QueryManager.d.ts +7 -7
  65. package/core/QueryManager.d.ts.map +1 -1
  66. package/core/QueryManager.js +22 -12
  67. package/core/QueryManager.js.map +1 -1
  68. package/core/core.cjs +132 -69
  69. package/core/core.cjs.map +1 -1
  70. package/core/core.cjs.native.js +132 -69
  71. package/core/index.js +2 -2
  72. package/core/index.js.map +1 -1
  73. package/core/types.d.ts +21 -17
  74. package/core/types.d.ts.map +1 -1
  75. package/core/types.js +1 -0
  76. package/core/types.js.map +1 -1
  77. package/core/watchQueryOptions.d.ts +11 -11
  78. package/core/watchQueryOptions.d.ts.map +1 -1
  79. package/core/watchQueryOptions.js.map +1 -1
  80. package/errors/index.d.ts +2 -2
  81. package/errors/index.d.ts.map +1 -1
  82. package/invariantErrorCodes.js +36 -35
  83. package/link/batch/batch.cjs +5 -3
  84. package/link/batch/batch.cjs.map +1 -1
  85. package/link/batch/batch.cjs.native.js +5 -3
  86. package/link/batch/batching.d.ts +2 -2
  87. package/link/batch/batching.d.ts.map +1 -1
  88. package/link/batch/batching.js +5 -3
  89. package/link/batch/batching.js.map +1 -1
  90. package/link/batch-http/batch-http.cjs +12 -2
  91. package/link/batch-http/batch-http.cjs.map +1 -1
  92. package/link/batch-http/batch-http.cjs.native.js +12 -2
  93. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  94. package/link/batch-http/batchHttpLink.js +13 -3
  95. package/link/batch-http/batchHttpLink.js.map +1 -1
  96. package/link/context/index.d.ts +2 -1
  97. package/link/context/index.d.ts.map +1 -1
  98. package/link/context/index.js.map +1 -1
  99. package/link/core/ApolloLink.js +2 -2
  100. package/link/core/core.cjs +2 -2
  101. package/link/core/core.cjs.map +1 -1
  102. package/link/core/core.cjs.native.js +2 -2
  103. package/link/core/types.d.ts +15 -15
  104. package/link/core/types.d.ts.map +1 -1
  105. package/link/core/types.js.map +1 -1
  106. package/link/http/checkFetcher.js +2 -2
  107. package/link/http/createHttpLink.d.ts +0 -1
  108. package/link/http/createHttpLink.d.ts.map +1 -1
  109. package/link/http/createHttpLink.js +10 -2
  110. package/link/http/createHttpLink.js.map +1 -1
  111. package/link/http/http.cjs +20 -38
  112. package/link/http/http.cjs.map +1 -1
  113. package/link/http/http.cjs.native.js +20 -38
  114. package/link/http/iterators/async.js.map +1 -1
  115. package/link/http/iterators/nodeStream.js.map +1 -1
  116. package/link/http/iterators/promise.js.map +1 -1
  117. package/link/http/iterators/reader.js.map +1 -1
  118. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  119. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  120. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  121. package/link/http/responseIterator.js +1 -1
  122. package/link/http/responseIterator.js.map +1 -1
  123. package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
  124. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  125. package/link/http/selectHttpOptionsAndBody.js +3 -1
  126. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  127. package/link/http/serializeFetchParameter.d.ts +1 -1
  128. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  129. package/link/http/serializeFetchParameter.js +2 -2
  130. package/link/persisted-queries/index.d.ts +2 -2
  131. package/link/persisted-queries/index.d.ts.map +1 -1
  132. package/link/persisted-queries/index.js +3 -3
  133. package/link/persisted-queries/persisted-queries.cjs +3 -3
  134. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  135. package/link/persisted-queries/persisted-queries.cjs.native.js +3 -3
  136. package/link/utils/throwServerError.d.ts +1 -1
  137. package/link/utils/throwServerError.d.ts.map +1 -1
  138. package/link/utils/toPromise.js +1 -1
  139. package/link/utils/utils.cjs +2 -2
  140. package/link/utils/utils.cjs.map +1 -1
  141. package/link/utils/utils.cjs.native.js +2 -2
  142. package/link/utils/validateOperation.js +2 -2
  143. package/package.json +25 -23
  144. package/react/cache/SuspenseCache.d.ts +1 -1
  145. package/react/cache/SuspenseCache.d.ts.map +1 -1
  146. package/react/cache/SuspenseCache.js.map +1 -1
  147. package/react/components/Query.d.ts +2 -2
  148. package/react/components/Query.d.ts.map +1 -1
  149. package/react/components/Query.js.map +1 -1
  150. package/react/components/Subscription.d.ts +2 -2
  151. package/react/components/Subscription.d.ts.map +1 -1
  152. package/react/components/Subscription.js.map +1 -1
  153. package/react/components/types.d.ts +2 -2
  154. package/react/components/types.d.ts.map +1 -1
  155. package/react/components/types.js.map +1 -1
  156. package/react/context/ApolloConsumer.js +2 -2
  157. package/react/context/ApolloProvider.js +2 -2
  158. package/react/context/context.cjs +4 -4
  159. package/react/context/context.cjs.map +1 -1
  160. package/react/context/context.cjs.native.js +4 -4
  161. package/react/hoc/graphql.d.ts +2 -1
  162. package/react/hoc/graphql.d.ts.map +1 -1
  163. package/react/hoc/graphql.js.map +1 -1
  164. package/react/hoc/hoc-utils.d.ts +1 -1
  165. package/react/hoc/hoc-utils.d.ts.map +1 -1
  166. package/react/hoc/hoc-utils.js +2 -2
  167. package/react/hoc/hoc.cjs +4 -4
  168. package/react/hoc/hoc.cjs.map +1 -1
  169. package/react/hoc/hoc.cjs.native.js +4 -4
  170. package/react/hoc/mutation-hoc.d.ts +2 -2
  171. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  172. package/react/hoc/mutation-hoc.js.map +1 -1
  173. package/react/hoc/query-hoc.d.ts +1 -1
  174. package/react/hoc/query-hoc.d.ts.map +1 -1
  175. package/react/hoc/query-hoc.js.map +1 -1
  176. package/react/hoc/subscription-hoc.d.ts +1 -1
  177. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  178. package/react/hoc/subscription-hoc.js.map +1 -1
  179. package/react/hoc/types.d.ts +6 -6
  180. package/react/hoc/types.d.ts.map +1 -1
  181. package/react/hoc/types.js.map +1 -1
  182. package/react/hoc/withApollo.js +2 -2
  183. package/react/hooks/hooks.cjs +129 -69
  184. package/react/hooks/hooks.cjs.map +1 -1
  185. package/react/hooks/hooks.cjs.native.js +129 -69
  186. package/react/hooks/internal/index.d.ts +1 -0
  187. package/react/hooks/internal/index.d.ts.map +1 -1
  188. package/react/hooks/internal/index.js +1 -0
  189. package/react/hooks/internal/index.js.map +1 -1
  190. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +3 -0
  191. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -0
  192. package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -0
  193. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
  194. package/react/hooks/useApolloClient.js +2 -2
  195. package/react/hooks/useFragment.d.ts +4 -2
  196. package/react/hooks/useFragment.d.ts.map +1 -1
  197. package/react/hooks/useFragment.js +9 -8
  198. package/react/hooks/useFragment.js.map +1 -1
  199. package/react/hooks/useLazyQuery.d.ts +2 -2
  200. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  201. package/react/hooks/useLazyQuery.js +22 -8
  202. package/react/hooks/useLazyQuery.js.map +1 -1
  203. package/react/hooks/useMutation.d.ts +2 -2
  204. package/react/hooks/useMutation.d.ts.map +1 -1
  205. package/react/hooks/useMutation.js +9 -8
  206. package/react/hooks/useMutation.js.map +1 -1
  207. package/react/hooks/useQuery.d.ts +6 -5
  208. package/react/hooks/useQuery.d.ts.map +1 -1
  209. package/react/hooks/useQuery.js +21 -7
  210. package/react/hooks/useQuery.js.map +1 -1
  211. package/react/hooks/useSubscription.d.ts +2 -3
  212. package/react/hooks/useSubscription.d.ts.map +1 -1
  213. package/react/hooks/useSubscription.js +1 -2
  214. package/react/hooks/useSubscription.js.map +1 -1
  215. package/react/hooks/useSuspenseCache.d.ts +2 -1
  216. package/react/hooks/useSuspenseCache.d.ts.map +1 -1
  217. package/react/hooks/useSuspenseCache.js +7 -5
  218. package/react/hooks/useSuspenseCache.js.map +1 -1
  219. package/react/hooks/useSuspenseQuery.d.ts +11 -4
  220. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  221. package/react/hooks/useSuspenseQuery.js +54 -30
  222. package/react/hooks/useSuspenseQuery.js.map +1 -1
  223. package/react/hooks/useSyncExternalStore.d.ts +1 -1
  224. package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
  225. package/react/hooks/useSyncExternalStore.js +1 -1
  226. package/react/hooks/useSyncExternalStore.js.map +1 -1
  227. package/react/parser/index.js +6 -6
  228. package/react/parser/parser.cjs +10 -10
  229. package/react/parser/parser.cjs.map +1 -1
  230. package/react/parser/parser.cjs.native.js +10 -10
  231. package/react/ssr/RenderPromises.d.ts +4 -4
  232. package/react/ssr/RenderPromises.d.ts.map +1 -1
  233. package/react/ssr/RenderPromises.js.map +1 -1
  234. package/react/ssr/getDataFromTree.d.ts +1 -1
  235. package/react/ssr/getDataFromTree.d.ts.map +1 -1
  236. package/react/types/types.d.ts +26 -23
  237. package/react/types/types.d.ts.map +1 -1
  238. package/react/types/types.js.map +1 -1
  239. package/testing/core/core.cjs +30 -3
  240. package/testing/core/core.cjs.map +1 -1
  241. package/testing/core/core.cjs.native.js +30 -3
  242. package/testing/core/index.d.ts +2 -1
  243. package/testing/core/index.d.ts.map +1 -1
  244. package/testing/core/index.js +1 -0
  245. package/testing/core/index.js.map +1 -1
  246. package/testing/core/itAsync.js.map +1 -1
  247. package/testing/core/mocking/mockFetch.js.map +1 -1
  248. package/testing/core/mocking/mockLink.d.ts +8 -4
  249. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  250. package/testing/core/mocking/mockLink.js +14 -4
  251. package/testing/core/mocking/mockLink.js.map +1 -1
  252. package/testing/core/mocking/mockQueryManager.d.ts +1 -1
  253. package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
  254. package/testing/core/mocking/mockQueryManager.js +3 -3
  255. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  256. package/testing/core/mocking/mockWatchQuery.d.ts +1 -1
  257. package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
  258. package/testing/core/mocking/mockWatchQuery.js +4 -5
  259. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  260. package/testing/core/observableToPromise.d.ts +2 -2
  261. package/testing/core/observableToPromise.d.ts.map +1 -1
  262. package/testing/core/observableToPromise.js.map +1 -1
  263. package/testing/core/wait.d.ts +3 -0
  264. package/testing/core/wait.d.ts.map +1 -0
  265. package/testing/core/wait.js +16 -0
  266. package/testing/core/wait.js.map +1 -0
  267. package/testing/react/MockedProvider.d.ts +1 -0
  268. package/testing/react/MockedProvider.d.ts.map +1 -1
  269. package/testing/react/MockedProvider.js +2 -2
  270. package/testing/react/MockedProvider.js.map +1 -1
  271. package/testing/testing.cjs +2 -2
  272. package/testing/testing.cjs.map +1 -1
  273. package/testing/testing.cjs.native.js +2 -2
  274. package/utilities/common/arrays.d.ts +1 -0
  275. package/utilities/common/arrays.d.ts.map +1 -1
  276. package/utilities/common/arrays.js +1 -0
  277. package/utilities/common/arrays.js.map +1 -1
  278. package/utilities/common/cloneDeep.js.map +1 -1
  279. package/utilities/common/errorHandling.d.ts +2 -2
  280. package/utilities/common/errorHandling.d.ts.map +1 -1
  281. package/utilities/common/errorHandling.js.map +1 -1
  282. package/utilities/common/incrementalResult.d.ts +4 -4
  283. package/utilities/common/incrementalResult.d.ts.map +1 -1
  284. package/utilities/common/incrementalResult.js.map +1 -1
  285. package/utilities/common/maybeDeepFreeze.d.ts +0 -1
  286. package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
  287. package/utilities/common/maybeDeepFreeze.js +1 -1
  288. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  289. package/utilities/common/mergeDeep.d.ts +2 -2
  290. package/utilities/common/mergeDeep.d.ts.map +1 -1
  291. package/utilities/common/mergeOptions.d.ts +3 -3
  292. package/utilities/common/mergeOptions.d.ts.map +1 -1
  293. package/utilities/common/mergeOptions.js.map +1 -1
  294. package/utilities/globals/DEV.d.ts +1 -1
  295. package/utilities/globals/DEV.d.ts.map +1 -1
  296. package/utilities/globals/DEV.js +1 -17
  297. package/utilities/globals/DEV.js.map +1 -1
  298. package/utilities/globals/global.d.ts +5 -2
  299. package/utilities/globals/global.d.ts.map +1 -1
  300. package/utilities/globals/global.js.map +1 -1
  301. package/utilities/globals/globals.cjs +5 -22
  302. package/utilities/globals/globals.cjs.map +1 -1
  303. package/utilities/globals/globals.cjs.native.js +5 -22
  304. package/utilities/globals/index.d.ts +1 -1
  305. package/utilities/globals/index.d.ts.map +1 -1
  306. package/utilities/globals/index.js +1 -4
  307. package/utilities/globals/index.js.map +1 -1
  308. package/utilities/graphql/directives.d.ts +2 -2
  309. package/utilities/graphql/directives.d.ts.map +1 -1
  310. package/utilities/graphql/directives.js +1 -1
  311. package/utilities/graphql/directives.js.map +1 -1
  312. package/utilities/graphql/fragments.d.ts +1 -1
  313. package/utilities/graphql/fragments.d.ts.map +1 -1
  314. package/utilities/graphql/fragments.js +1 -1
  315. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  316. package/utilities/graphql/getFromAST.js +8 -4
  317. package/utilities/graphql/getFromAST.js.map +1 -1
  318. package/utilities/graphql/storeUtils.d.ts +3 -3
  319. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  320. package/utilities/graphql/storeUtils.js +1 -1
  321. package/utilities/graphql/storeUtils.js.map +1 -1
  322. package/utilities/graphql/transform.d.ts +9 -9
  323. package/utilities/graphql/transform.d.ts.map +1 -1
  324. package/utilities/graphql/transform.js +168 -91
  325. package/utilities/graphql/transform.js.map +1 -1
  326. package/utilities/index.d.ts +2 -0
  327. package/utilities/index.d.ts.map +1 -1
  328. package/utilities/index.js +2 -0
  329. package/utilities/index.js.map +1 -1
  330. package/utilities/observables/Concast.d.ts +5 -5
  331. package/utilities/observables/Concast.d.ts.map +1 -1
  332. package/utilities/observables/Concast.js +2 -2
  333. package/utilities/observables/Concast.js.map +1 -1
  334. package/utilities/observables/asyncMap.js.map +1 -1
  335. package/utilities/policies/pagination.d.ts +7 -7
  336. package/utilities/policies/pagination.d.ts.map +1 -1
  337. package/utilities/policies/pagination.js.map +1 -1
  338. package/utilities/types/IsStrictlyAny.d.ts +3 -3
  339. package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
  340. package/utilities/utilities.cjs +252 -124
  341. package/utilities/utilities.cjs.map +1 -1
  342. package/utilities/utilities.cjs.native.js +252 -124
  343. package/version.js +1 -1
@@ -18,7 +18,7 @@ function shouldInclude(_a, variables) {
18
18
  var evaledValue = false;
19
19
  if (ifArgument.value.kind === 'Variable') {
20
20
  evaledValue = variables && variables[ifArgument.value.name.value];
21
- __DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 41);
21
+ globals.__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 41);
22
22
  }
23
23
  else {
24
24
  evaledValue = ifArgument.value.value;
@@ -65,11 +65,11 @@ function getInclusionDirectives(directives) {
65
65
  return;
66
66
  var directiveArguments = directive.arguments;
67
67
  var directiveName = directive.name.value;
68
- __DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 42);
68
+ globals.__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 42);
69
69
  var ifArgument = directiveArguments[0];
70
- __DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
70
+ globals.__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
71
71
  var ifValue = ifArgument.value;
72
- __DEV__ ? globals.invariant(ifValue &&
72
+ globals.__DEV__ ? globals.invariant(ifValue &&
73
73
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : globals.invariant(ifValue &&
74
74
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
75
75
  result.push({ directive: directive, ifArgument: ifArgument });
@@ -83,7 +83,7 @@ function getFragmentQueryDocument(document, fragmentName) {
83
83
  var fragments = [];
84
84
  document.definitions.forEach(function (definition) {
85
85
  if (definition.kind === 'OperationDefinition') {
86
- throw __DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
86
+ throw globals.__DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
87
87
  'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(45);
88
88
  }
89
89
  if (definition.kind === 'FragmentDefinition') {
@@ -91,7 +91,7 @@ function getFragmentQueryDocument(document, fragmentName) {
91
91
  }
92
92
  });
93
93
  if (typeof actualFragmentName === 'undefined') {
94
- __DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 46);
94
+ globals.__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 46);
95
95
  actualFragmentName = fragments[0].name.value;
96
96
  }
97
97
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -132,7 +132,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
132
132
  return fragmentMap(fragmentName);
133
133
  }
134
134
  var fragment = fragmentMap && fragmentMap[fragmentName];
135
- __DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 47);
135
+ globals.__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 47);
136
136
  return fragment || null;
137
137
  }
138
138
  default:
@@ -214,7 +214,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
214
214
  argObj[name.value] = null;
215
215
  }
216
216
  else {
217
- throw __DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
217
+ throw globals.__DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
218
218
  'is not supported. Use variables instead of inline arguments to ' +
219
219
  'overcome this limitation.') : new globals.InvariantError(56);
220
220
  }
@@ -350,42 +350,46 @@ function isInlineFragment(selection) {
350
350
  }
351
351
 
352
352
  function checkDocument(doc) {
353
- __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', 48);
353
+ globals.__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', 48);
354
354
  var operations = doc.definitions
355
355
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
356
356
  .map(function (definition) {
357
357
  if (definition.kind !== 'OperationDefinition') {
358
- throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(49);
358
+ throw globals.__DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(49);
359
359
  }
360
360
  return definition;
361
361
  });
362
- __DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 50);
362
+ globals.__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 50);
363
363
  return doc;
364
364
  }
365
365
  function getOperationDefinition(doc) {
366
366
  checkDocument(doc);
367
- return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];
367
+ return doc.definitions.filter(function (definition) {
368
+ return definition.kind === 'OperationDefinition';
369
+ })[0];
368
370
  }
369
371
  function getOperationName(doc) {
370
372
  return (doc.definitions
371
373
  .filter(function (definition) {
372
- return definition.kind === 'OperationDefinition' && definition.name;
374
+ return definition.kind === 'OperationDefinition' && !!definition.name;
373
375
  })
374
376
  .map(function (x) { return x.name.value; })[0] || null);
375
377
  }
376
378
  function getFragmentDefinitions(doc) {
377
- return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });
379
+ return doc.definitions.filter(function (definition) {
380
+ return definition.kind === 'FragmentDefinition';
381
+ });
378
382
  }
379
383
  function getQueryDefinition(doc) {
380
384
  var queryDef = getOperationDefinition(doc);
381
- __DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 51);
385
+ globals.__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 51);
382
386
  return queryDef;
383
387
  }
384
388
  function getFragmentDefinition(doc) {
385
- __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', 52);
386
- __DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
389
+ globals.__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', 52);
390
+ globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
387
391
  var fragmentDef = doc.definitions[0];
388
- __DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
392
+ globals.__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
389
393
  return fragmentDef;
390
394
  }
391
395
  function getMainDefinition(queryDoc) {
@@ -408,7 +412,7 @@ function getMainDefinition(queryDoc) {
408
412
  if (fragmentDefinition) {
409
413
  return fragmentDefinition;
410
414
  }
411
- throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(55);
415
+ throw globals.__DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(55);
412
416
  }
413
417
  function getDefaultValues(definition) {
414
418
  var defaultValues = Object.create(null);
@@ -423,26 +427,20 @@ function getDefaultValues(definition) {
423
427
  return defaultValues;
424
428
  }
425
429
 
426
- function filterInPlace(array, test, context) {
427
- var target = 0;
428
- array.forEach(function (elem, i) {
429
- if (test.call(this, elem, i, array)) {
430
- array[target++] = elem;
431
- }
432
- }, context);
433
- array.length = target;
434
- return array;
430
+ var isArray = Array.isArray;
431
+ function isNonEmptyArray(value) {
432
+ return Array.isArray(value) && value.length > 0;
435
433
  }
436
434
 
437
435
  var TYPENAME_FIELD = {
438
- kind: 'Field',
436
+ kind: graphql.Kind.FIELD,
439
437
  name: {
440
- kind: 'Name',
438
+ kind: graphql.Kind.NAME,
441
439
  value: '__typename',
442
440
  },
443
441
  };
444
442
  function isEmpty(op, fragmentMap) {
445
- return !op || op.selectionSet.selections.every(function (selection) { return selection.kind === 'FragmentSpread' &&
443
+ return !op || op.selectionSet.selections.every(function (selection) { return selection.kind === graphql.Kind.FRAGMENT_SPREAD &&
446
444
  isEmpty(fragmentMap[selection.name.value], fragmentMap); });
447
445
  }
448
446
  function nullIfDocIsEmpty(doc) {
@@ -451,84 +449,190 @@ function nullIfDocIsEmpty(doc) {
451
449
  : doc;
452
450
  }
453
451
  function getDirectiveMatcher(directives) {
454
- return function directiveMatcher(directive) {
455
- return directives.some(function (dir) {
456
- return (dir.name && dir.name === directive.name.value) ||
457
- (dir.test && dir.test(directive));
458
- });
452
+ var nameSet = new Set();
453
+ var tests = [];
454
+ directives.forEach(function (directive) {
455
+ if (directive.name) {
456
+ nameSet.add(directive.name);
457
+ }
458
+ else if (directive.test) {
459
+ tests.push(directive.test);
460
+ }
461
+ });
462
+ return function (directive) { return (nameSet.has(directive.name.value) ||
463
+ tests.some(function (test) { return test(directive); })); };
464
+ }
465
+ function makeInUseGetterFunction(defaultKey) {
466
+ var map = new Map();
467
+ return function inUseGetterFunction(key) {
468
+ if (key === void 0) { key = defaultKey; }
469
+ var inUse = map.get(key);
470
+ if (!inUse) {
471
+ map.set(key, inUse = {
472
+ variables: new Set,
473
+ fragmentSpreads: new Set,
474
+ });
475
+ }
476
+ return inUse;
459
477
  };
460
478
  }
461
479
  function removeDirectivesFromDocument(directives, doc) {
462
- var variablesInUse = Object.create(null);
463
- var variablesToRemove = [];
464
- var fragmentSpreadsInUse = Object.create(null);
465
- var fragmentSpreadsToRemove = [];
466
- var modifiedDoc = nullIfDocIsEmpty(graphql.visit(doc, {
480
+ var getInUseByOperationName = makeInUseGetterFunction("");
481
+ var getInUseByFragmentName = makeInUseGetterFunction("");
482
+ var getInUse = function (ancestors) {
483
+ for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {
484
+ if (isArray(ancestor))
485
+ continue;
486
+ if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) {
487
+ return getInUseByOperationName(ancestor.name && ancestor.name.value);
488
+ }
489
+ if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) {
490
+ return getInUseByFragmentName(ancestor.name.value);
491
+ }
492
+ }
493
+ globals.__DEV__ && globals.invariant.error("Could not find operation or fragment");
494
+ return null;
495
+ };
496
+ var operationCount = 0;
497
+ for (var i = doc.definitions.length - 1; i >= 0; --i) {
498
+ if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) {
499
+ ++operationCount;
500
+ }
501
+ }
502
+ var directiveMatcher = getDirectiveMatcher(directives);
503
+ var hasRemoveDirective = directives.some(function (directive) { return directive.remove; });
504
+ var shouldRemoveField = function (nodeDirectives) { return (hasRemoveDirective &&
505
+ nodeDirectives &&
506
+ nodeDirectives.some(directiveMatcher)); };
507
+ var originalFragmentDefsByPath = new Map();
508
+ var firstVisitMadeChanges = false;
509
+ var fieldOrInlineFragmentVisitor = {
510
+ enter: function (node) {
511
+ if (shouldRemoveField(node.directives)) {
512
+ firstVisitMadeChanges = true;
513
+ return null;
514
+ }
515
+ },
516
+ };
517
+ var docWithoutDirectiveSubtrees = graphql.visit(doc, {
518
+ Field: fieldOrInlineFragmentVisitor,
519
+ InlineFragment: fieldOrInlineFragmentVisitor,
520
+ VariableDefinition: {
521
+ enter: function () {
522
+ return false;
523
+ },
524
+ },
467
525
  Variable: {
468
- enter: function (node, _key, parent) {
469
- if (parent.kind !== 'VariableDefinition') {
470
- variablesInUse[node.name.value] = true;
526
+ enter: function (node, _key, _parent, _path, ancestors) {
527
+ var inUse = getInUse(ancestors);
528
+ if (inUse) {
529
+ inUse.variables.add(node.name.value);
471
530
  }
472
531
  },
473
532
  },
474
- Field: {
475
- enter: function (node) {
476
- if (directives && node.directives) {
477
- var shouldRemoveField = directives.some(function (directive) { return directive.remove; });
478
- if (shouldRemoveField &&
479
- node.directives &&
480
- node.directives.some(getDirectiveMatcher(directives))) {
481
- if (node.arguments) {
482
- node.arguments.forEach(function (arg) {
483
- if (arg.value.kind === 'Variable') {
484
- variablesToRemove.push({
485
- name: arg.value.name.value,
486
- });
487
- }
488
- });
489
- }
490
- if (node.selectionSet) {
491
- getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
492
- fragmentSpreadsToRemove.push({
493
- name: frag.name.value,
494
- });
495
- });
496
- }
497
- return null;
498
- }
533
+ FragmentSpread: {
534
+ enter: function (node, _key, _parent, _path, ancestors) {
535
+ if (shouldRemoveField(node.directives)) {
536
+ firstVisitMadeChanges = true;
537
+ return null;
538
+ }
539
+ var inUse = getInUse(ancestors);
540
+ if (inUse) {
541
+ inUse.fragmentSpreads.add(node.name.value);
499
542
  }
500
543
  },
501
544
  },
502
- FragmentSpread: {
503
- enter: function (node) {
504
- fragmentSpreadsInUse[node.name.value] = true;
545
+ FragmentDefinition: {
546
+ enter: function (node, _key, _parent, path) {
547
+ originalFragmentDefsByPath.set(JSON.stringify(path), node);
548
+ },
549
+ leave: function (node, _key, _parent, path) {
550
+ var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));
551
+ if (node === originalNode) {
552
+ return node;
553
+ }
554
+ if (operationCount > 0 &&
555
+ node.selectionSet.selections.every(function (selection) { return (selection.kind === graphql.Kind.FIELD &&
556
+ selection.name.value === '__typename'); })) {
557
+ getInUseByFragmentName(node.name.value).removed = true;
558
+ firstVisitMadeChanges = true;
559
+ return null;
560
+ }
505
561
  },
506
562
  },
507
563
  Directive: {
508
- enter: function (node) {
509
- if (getDirectiveMatcher(directives)(node)) {
564
+ leave: function (node) {
565
+ if (directiveMatcher(node)) {
566
+ firstVisitMadeChanges = true;
510
567
  return null;
511
568
  }
512
569
  },
513
570
  },
514
- }));
515
- if (modifiedDoc &&
516
- filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) {
517
- modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
518
- }
519
- if (modifiedDoc &&
520
- filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; })
521
- .length) {
522
- modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
571
+ });
572
+ if (!firstVisitMadeChanges) {
573
+ return doc;
523
574
  }
524
- return modifiedDoc;
575
+ var populateTransitiveVars = function (inUse) {
576
+ if (!inUse.transitiveVars) {
577
+ inUse.transitiveVars = new Set(inUse.variables);
578
+ if (!inUse.removed) {
579
+ inUse.fragmentSpreads.forEach(function (childFragmentName) {
580
+ populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {
581
+ inUse.transitiveVars.add(varName);
582
+ });
583
+ });
584
+ }
585
+ }
586
+ return inUse;
587
+ };
588
+ var allFragmentNamesUsed = new Set();
589
+ docWithoutDirectiveSubtrees.definitions.forEach(function (def) {
590
+ if (def.kind === graphql.Kind.OPERATION_DEFINITION) {
591
+ populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {
592
+ allFragmentNamesUsed.add(childFragmentName);
593
+ });
594
+ }
595
+ else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION &&
596
+ operationCount === 0 &&
597
+ !getInUseByFragmentName(def.name.value).removed) {
598
+ allFragmentNamesUsed.add(def.name.value);
599
+ }
600
+ });
601
+ allFragmentNamesUsed.forEach(function (fragmentName) {
602
+ populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {
603
+ allFragmentNamesUsed.add(childFragmentName);
604
+ });
605
+ });
606
+ var fragmentWillBeRemoved = function (fragmentName) { return !!(!allFragmentNamesUsed.has(fragmentName) ||
607
+ getInUseByFragmentName(fragmentName).removed); };
608
+ var enterVisitor = {
609
+ enter: function (node) {
610
+ if (fragmentWillBeRemoved(node.name.value)) {
611
+ return null;
612
+ }
613
+ },
614
+ };
615
+ return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, {
616
+ FragmentSpread: enterVisitor,
617
+ FragmentDefinition: enterVisitor,
618
+ OperationDefinition: {
619
+ leave: function (node) {
620
+ if (node.variableDefinitions) {
621
+ var usedVariableNames_1 = populateTransitiveVars(getInUseByOperationName(node.name && node.name.value)).transitiveVars;
622
+ if (usedVariableNames_1.size < node.variableDefinitions.length) {
623
+ return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { return usedVariableNames_1.has(varDef.variable.name.value); }) });
624
+ }
625
+ }
626
+ },
627
+ },
628
+ }));
525
629
  }
526
630
  var addTypenameToDocument = Object.assign(function (doc) {
527
631
  return graphql.visit(doc, {
528
632
  SelectionSet: {
529
633
  enter: function (node, _key, parent) {
530
634
  if (parent &&
531
- parent.kind === 'OperationDefinition') {
635
+ parent.kind === graphql.Kind.OPERATION_DEFINITION) {
532
636
  return;
533
637
  }
534
638
  var selections = node.selections;
@@ -564,7 +668,7 @@ var connectionRemoveConfig = {
564
668
  if (willRemove) {
565
669
  if (!directive.arguments ||
566
670
  !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
567
- __DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
671
+ globals.__DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
568
672
  'You may want to use the key parameter to specify a store key.');
569
673
  }
570
674
  }
@@ -578,7 +682,7 @@ function getArgumentMatcher(config) {
578
682
  return function argumentMatcher(argument) {
579
683
  return config.some(function (aConfig) {
580
684
  return argument.value &&
581
- argument.value.kind === 'Variable' &&
685
+ argument.value.kind === graphql.Kind.VARIABLE &&
582
686
  argument.value.name &&
583
687
  (aConfig.name === argument.value.name.value ||
584
688
  (aConfig.test && aConfig.test(argument)));
@@ -633,19 +737,6 @@ function removeFragmentSpreadFromDocument(config, doc) {
633
737
  FragmentDefinition: { enter: enter },
634
738
  }));
635
739
  }
636
- function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
637
- var allFragments = [];
638
- selectionSet.selections.forEach(function (selection) {
639
- if ((isField(selection) || isInlineFragment(selection)) &&
640
- selection.selectionSet) {
641
- getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
642
- }
643
- else if (selection.kind === 'FragmentSpread') {
644
- allFragments.push(selection);
645
- }
646
- });
647
- return allFragments;
648
- }
649
740
  function buildQueryFromSelectionSet(document) {
650
741
  var definition = getMainDefinition(document);
651
742
  var definitionOperation = definition.operation;
@@ -669,22 +760,6 @@ function removeClientSetsFromDocument(document) {
669
760
  remove: true,
670
761
  },
671
762
  ], document);
672
- if (modifiedDoc) {
673
- modifiedDoc = graphql.visit(modifiedDoc, {
674
- FragmentDefinition: {
675
- enter: function (node) {
676
- if (node.selectionSet) {
677
- var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
678
- return isField(selection) && selection.name.value === '__typename';
679
- });
680
- if (isTypenameOnly) {
681
- return null;
682
- }
683
- }
684
- },
685
- },
686
- });
687
- }
688
763
  return modifiedDoc;
689
764
  }
690
765
 
@@ -955,7 +1030,7 @@ function deepFreeze(value) {
955
1030
  return value;
956
1031
  }
957
1032
  function shallowFreeze(obj) {
958
- if (__DEV__ && !Object.isFrozen(obj)) {
1033
+ if (globals.__DEV__ && !Object.isFrozen(obj)) {
959
1034
  try {
960
1035
  Object.freeze(obj);
961
1036
  }
@@ -968,7 +1043,7 @@ function shallowFreeze(obj) {
968
1043
  return obj;
969
1044
  }
970
1045
  function maybeDeepFreeze(obj) {
971
- if (__DEV__) {
1046
+ if (globals.__DEV__) {
972
1047
  deepFreeze(obj);
973
1048
  }
974
1049
  return obj;
@@ -1085,9 +1160,9 @@ var Concast = (function (_super) {
1085
1160
  }
1086
1161
  },
1087
1162
  complete: function () {
1088
- var sub = _this.sub;
1163
+ var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;
1089
1164
  if (sub !== null) {
1090
- var value = _this.sources.shift();
1165
+ var value = sources.shift();
1091
1166
  if (!value) {
1092
1167
  if (sub)
1093
1168
  setTimeout(function () { return sub.unsubscribe(); });
@@ -1181,13 +1256,35 @@ var Concast = (function (_super) {
1181
1256
  }(zenObservableTs.Observable));
1182
1257
  fixObservableSubclass(Concast);
1183
1258
 
1184
- function isNonEmptyArray(value) {
1185
- return Array.isArray(value) && value.length > 0;
1186
- }
1187
-
1188
1259
  function isExecutionPatchIncrementalResult(value) {
1189
1260
  return "incremental" in value;
1190
1261
  }
1262
+ function isExecutionPatchInitialResult(value) {
1263
+ return "hasNext" in value && "data" in value;
1264
+ }
1265
+ function isExecutionPatchResult(value) {
1266
+ return (isExecutionPatchIncrementalResult(value) ||
1267
+ isExecutionPatchInitialResult(value));
1268
+ }
1269
+ function mergeIncrementalData(prevResult, result) {
1270
+ var mergedData = prevResult;
1271
+ var merger = new DeepMerger();
1272
+ if (isExecutionPatchIncrementalResult(result) &&
1273
+ isNonEmptyArray(result.incremental)) {
1274
+ result.incremental.forEach(function (_a) {
1275
+ var data = _a.data, path = _a.path;
1276
+ for (var i = path.length - 1; i >= 0; --i) {
1277
+ var key = path[i];
1278
+ var isNumericKey = !isNaN(+key);
1279
+ var parent_1 = isNumericKey ? [] : {};
1280
+ parent_1[key] = data;
1281
+ data = parent_1;
1282
+ }
1283
+ mergedData = merger.merge(mergedData, data);
1284
+ });
1285
+ }
1286
+ return mergedData;
1287
+ }
1191
1288
 
1192
1289
  function graphQLResultHasError(result) {
1193
1290
  var errors = getGraphQLErrorsFromResult(result);
@@ -1247,6 +1344,26 @@ function mergeOptions(defaults, options) {
1247
1344
  });
1248
1345
  }
1249
1346
 
1347
+ function isNodeResponse(value) {
1348
+ return !!value.body;
1349
+ }
1350
+ function isReadableStream(value) {
1351
+ return !!value.getReader;
1352
+ }
1353
+ function isAsyncIterableIterator(value) {
1354
+ return !!(canUseAsyncIteratorSymbol &&
1355
+ value[Symbol.asyncIterator]);
1356
+ }
1357
+ function isStreamableBlob(value) {
1358
+ return !!value.stream;
1359
+ }
1360
+ function isBlob(value) {
1361
+ return !!value.arrayBuffer;
1362
+ }
1363
+ function isNodeReadableStream(value) {
1364
+ return !!value.pipe;
1365
+ }
1366
+
1250
1367
  exports.DEV = globals.DEV;
1251
1368
  exports.maybe = globals.maybe;
1252
1369
  exports.Observable = zenObservableTs.Observable;
@@ -1287,18 +1404,29 @@ exports.hasAllDirectives = hasAllDirectives;
1287
1404
  exports.hasAnyDirectives = hasAnyDirectives;
1288
1405
  exports.hasClientExports = hasClientExports;
1289
1406
  exports.hasDirectives = hasDirectives;
1407
+ exports.isArray = isArray;
1408
+ exports.isAsyncIterableIterator = isAsyncIterableIterator;
1409
+ exports.isBlob = isBlob;
1290
1410
  exports.isDocumentNode = isDocumentNode;
1411
+ exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult;
1412
+ exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult;
1413
+ exports.isExecutionPatchResult = isExecutionPatchResult;
1291
1414
  exports.isField = isField;
1292
1415
  exports.isInlineFragment = isInlineFragment;
1416
+ exports.isNodeReadableStream = isNodeReadableStream;
1417
+ exports.isNodeResponse = isNodeResponse;
1293
1418
  exports.isNonEmptyArray = isNonEmptyArray;
1294
1419
  exports.isNonNullObject = isNonNullObject;
1420
+ exports.isReadableStream = isReadableStream;
1295
1421
  exports.isReference = isReference;
1422
+ exports.isStreamableBlob = isStreamableBlob;
1296
1423
  exports.iterateObserversSafely = iterateObserversSafely;
1297
1424
  exports.makeReference = makeReference;
1298
1425
  exports.makeUniqueId = makeUniqueId;
1299
1426
  exports.maybeDeepFreeze = maybeDeepFreeze;
1300
1427
  exports.mergeDeep = mergeDeep;
1301
1428
  exports.mergeDeepArray = mergeDeepArray;
1429
+ exports.mergeIncrementalData = mergeIncrementalData;
1302
1430
  exports.mergeOptions = mergeOptions;
1303
1431
  exports.offsetLimitPagination = offsetLimitPagination;
1304
1432
  exports.relayStylePagination = relayStylePagination;