@apollo/client 3.8.0-alpha.0 → 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 (345) hide show
  1. package/README.md +10 -8
  2. package/apollo-client.cjs +595 -339
  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 +7 -6
  57. package/core/ObservableQuery.d.ts.map +1 -1
  58. package/core/ObservableQuery.js +7 -4
  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 +3 -16
  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 +72 -37
  67. package/core/QueryManager.js.map +1 -1
  68. package/core/core.cjs +265 -100
  69. package/core/core.cjs.map +1 -1
  70. package/core/core.cjs.native.js +265 -100
  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 +29 -27
  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 +154 -72
  184. package/react/hooks/hooks.cjs.map +1 -1
  185. package/react/hooks/hooks.cjs.native.js +154 -72
  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 +80 -34
  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 +3 -2
  280. package/utilities/common/errorHandling.d.ts.map +1 -1
  281. package/utilities/common/errorHandling.js +18 -1
  282. package/utilities/common/errorHandling.js.map +1 -1
  283. package/utilities/common/incrementalResult.d.ts +5 -2
  284. package/utilities/common/incrementalResult.d.ts.map +1 -1
  285. package/utilities/common/incrementalResult.js +29 -1
  286. package/utilities/common/incrementalResult.js.map +1 -1
  287. package/utilities/common/maybeDeepFreeze.d.ts +0 -1
  288. package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
  289. package/utilities/common/maybeDeepFreeze.js +1 -1
  290. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  291. package/utilities/common/mergeDeep.d.ts +2 -2
  292. package/utilities/common/mergeDeep.d.ts.map +1 -1
  293. package/utilities/common/mergeOptions.d.ts +3 -3
  294. package/utilities/common/mergeOptions.d.ts.map +1 -1
  295. package/utilities/common/mergeOptions.js.map +1 -1
  296. package/utilities/globals/DEV.d.ts +1 -1
  297. package/utilities/globals/DEV.d.ts.map +1 -1
  298. package/utilities/globals/DEV.js +1 -17
  299. package/utilities/globals/DEV.js.map +1 -1
  300. package/utilities/globals/global.d.ts +5 -2
  301. package/utilities/globals/global.d.ts.map +1 -1
  302. package/utilities/globals/global.js.map +1 -1
  303. package/utilities/globals/globals.cjs +5 -22
  304. package/utilities/globals/globals.cjs.map +1 -1
  305. package/utilities/globals/globals.cjs.native.js +5 -22
  306. package/utilities/globals/index.d.ts +1 -1
  307. package/utilities/globals/index.d.ts.map +1 -1
  308. package/utilities/globals/index.js +1 -4
  309. package/utilities/globals/index.js.map +1 -1
  310. package/utilities/graphql/directives.d.ts +2 -2
  311. package/utilities/graphql/directives.d.ts.map +1 -1
  312. package/utilities/graphql/directives.js +1 -1
  313. package/utilities/graphql/directives.js.map +1 -1
  314. package/utilities/graphql/fragments.d.ts +1 -1
  315. package/utilities/graphql/fragments.d.ts.map +1 -1
  316. package/utilities/graphql/fragments.js +1 -1
  317. package/utilities/graphql/getFromAST.d.ts.map +1 -1
  318. package/utilities/graphql/getFromAST.js +8 -4
  319. package/utilities/graphql/getFromAST.js.map +1 -1
  320. package/utilities/graphql/storeUtils.d.ts +3 -3
  321. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  322. package/utilities/graphql/storeUtils.js +1 -1
  323. package/utilities/graphql/storeUtils.js.map +1 -1
  324. package/utilities/graphql/transform.d.ts +9 -9
  325. package/utilities/graphql/transform.d.ts.map +1 -1
  326. package/utilities/graphql/transform.js +168 -91
  327. package/utilities/graphql/transform.js.map +1 -1
  328. package/utilities/index.d.ts +2 -0
  329. package/utilities/index.d.ts.map +1 -1
  330. package/utilities/index.js +2 -0
  331. package/utilities/index.js.map +1 -1
  332. package/utilities/observables/Concast.d.ts +5 -5
  333. package/utilities/observables/Concast.d.ts.map +1 -1
  334. package/utilities/observables/Concast.js +2 -2
  335. package/utilities/observables/Concast.js.map +1 -1
  336. package/utilities/observables/asyncMap.js.map +1 -1
  337. package/utilities/policies/pagination.d.ts +7 -7
  338. package/utilities/policies/pagination.d.ts.map +1 -1
  339. package/utilities/policies/pagination.js.map +1 -1
  340. package/utilities/types/IsStrictlyAny.d.ts +3 -3
  341. package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
  342. package/utilities/utilities.cjs +271 -123
  343. package/utilities/utilities.cjs.map +1 -1
  344. package/utilities/utilities.cjs.native.js +271 -123
  345. package/version.js +1 -1
package/core/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEV } from "../utilities/globals/index.js";
1
+ import { __DEV__ } from "../utilities/globals/index.js";
2
2
  export { ApolloClient, mergeOptions, } from "./ApolloClient.js";
3
3
  export { ObservableQuery, } from "./ObservableQuery.js";
4
4
  export { NetworkStatus } from "./networkStatus.js";
@@ -12,6 +12,6 @@ export { fromError, toPromise, fromPromise, throwServerError, } from "../link/ut
12
12
  export { Observable, isReference, makeReference, } from "../utilities/index.js";
13
13
  import { setVerbosity } from "ts-invariant";
14
14
  export { setVerbosity as setLogVerbosity };
15
- setVerbosity(DEV ? "log" : "silent");
15
+ setVerbosity(__DEV__ ? "log" : "silent");
16
16
  export { gql, resetCaches, disableFragmentWarnings, enableExperimentalFragmentVariables, disableExperimentalFragmentVariables, } from 'graphql-tag';
17
17
  //# sourceMappingURL=index.js.map
package/core/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EACL,YAAY,EAGZ,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,GAGhB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,SAAS,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIvD,OAAO,EAGL,KAAK,EACL,WAAW,EAGX,aAAa,EAEb,iBAAiB,EACjB,uBAAuB,EAEvB,OAAO,GAQR,MAAM,UAAU,CAAC;AAElB,cAAc,yBAAyB,CAAC;AAIxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EAEX,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,UAAU,EAIV,WAAW,EACX,aAAa,GAEd,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,CAAA;AAC1C,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAcrC,OAAO,EACL,GAAG,EACH,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,aAAa,CAAC","sourcesContent":["/* Core */\n\nimport { DEV } from '../utilities/globals';\n\nexport {\n ApolloClient,\n ApolloClientOptions,\n DefaultOptions,\n mergeOptions,\n} from './ApolloClient';\nexport {\n ObservableQuery,\n FetchMoreOptions,\n UpdateQueryOptions,\n} from './ObservableQuery';\nexport {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n FetchPolicy,\n WatchQueryFetchPolicy,\n ErrorPolicy,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n} from './watchQueryOptions';\nexport { NetworkStatus } from './networkStatus';\nexport * from './types';\nexport {\n Resolver,\n FragmentMatcher,\n} from './LocalState';\nexport { isApolloError, ApolloError } from '../errors';\n\n/* Cache */\n\nexport {\n // All the exports (types and values) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Cache,\n ApolloCache,\n Transaction,\n DataProxy,\n InMemoryCache,\n InMemoryCacheConfig,\n MissingFieldError,\n defaultDataIdFromObject,\n ReactiveVar,\n makeVar,\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n} from '../cache';\n\nexport * from '../cache/inmemory/types';\n\n/* Link */\n\nexport * from '../link/core';\nexport * from '../link/http';\nexport {\n fromError,\n toPromise,\n fromPromise,\n ServerError,\n throwServerError,\n} from '../link/utils';\n\n/* Utilities */\n\nexport {\n Observable,\n Observer,\n ObservableSubscription,\n Reference,\n isReference,\n makeReference,\n StoreObject,\n} from '../utilities';\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// (for anyone using the same ts-invariant package) by passing \"log\",\n// \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nimport { setVerbosity } from \"ts-invariant\";\nexport { setVerbosity as setLogVerbosity }\nsetVerbosity(DEV ? \"log\" : \"silent\");\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n} from 'graphql-tag';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EACL,YAAY,EAGZ,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,GAGhB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,SAAS,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIvD,OAAO,EAGL,KAAK,EACL,WAAW,EAGX,aAAa,EAEb,iBAAiB,EACjB,uBAAuB,EAEvB,OAAO,GAQR,MAAM,UAAU,CAAC;AAElB,cAAc,yBAAyB,CAAC;AAIxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EAEX,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,UAAU,EAIV,WAAW,EACX,aAAa,GAEd,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,CAAA;AAC1C,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAczC,OAAO,EACL,GAAG,EACH,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,aAAa,CAAC","sourcesContent":["/* Core */\n\nimport { __DEV__ } from '../utilities/globals';\n\nexport {\n ApolloClient,\n ApolloClientOptions,\n DefaultOptions,\n mergeOptions,\n} from './ApolloClient';\nexport {\n ObservableQuery,\n FetchMoreOptions,\n UpdateQueryOptions,\n} from './ObservableQuery';\nexport {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n FetchPolicy,\n WatchQueryFetchPolicy,\n ErrorPolicy,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n} from './watchQueryOptions';\nexport { NetworkStatus } from './networkStatus';\nexport * from './types';\nexport {\n Resolver,\n FragmentMatcher,\n} from './LocalState';\nexport { isApolloError, ApolloError } from '../errors';\n\n/* Cache */\n\nexport {\n // All the exports (types and values) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Cache,\n ApolloCache,\n Transaction,\n DataProxy,\n InMemoryCache,\n InMemoryCacheConfig,\n MissingFieldError,\n defaultDataIdFromObject,\n ReactiveVar,\n makeVar,\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n} from '../cache';\n\nexport * from '../cache/inmemory/types';\n\n/* Link */\n\nexport * from '../link/core';\nexport * from '../link/http';\nexport {\n fromError,\n toPromise,\n fromPromise,\n ServerError,\n throwServerError,\n} from '../link/utils';\n\n/* Utilities */\n\nexport {\n Observable,\n Observer,\n ObservableSubscription,\n Reference,\n isReference,\n makeReference,\n StoreObject,\n} from '../utilities';\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// (for anyone using the same ts-invariant package) by passing \"log\",\n// \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nimport { setVerbosity } from \"ts-invariant\";\nexport { setVerbosity as setLogVerbosity }\nsetVerbosity(__DEV__ ? \"log\" : \"silent\");\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n} from 'graphql-tag';\n"]}
package/core/types.d.ts CHANGED
@@ -10,21 +10,22 @@ import { QueryOptions } from './watchQueryOptions';
10
10
  import { Cache } from '../cache';
11
11
  import { IsStrictlyAny } from '../utilities';
12
12
  export { TypedDocumentNode } from '@graphql-typed-document-node/core';
13
- export declare type DefaultContext = Record<string, any>;
14
- export declare type QueryListener = (queryInfo: QueryInfo) => void;
15
- export declare type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache.DiffResult<any>, lastDiff: Cache.DiffResult<any> | undefined) => boolean | TResult;
16
- export declare type RefetchQueryDescriptor = string | DocumentNode;
17
- export declare type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions;
18
- declare type RefetchQueriesIncludeShorthand = "all" | "active";
19
- export declare type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
20
- export declare type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
13
+ export interface DefaultContext extends Record<string, any> {
14
+ }
15
+ export type QueryListener = (queryInfo: QueryInfo) => void;
16
+ export type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache.DiffResult<any>, lastDiff: Cache.DiffResult<any> | undefined) => boolean | TResult;
17
+ export type RefetchQueryDescriptor = string | DocumentNode;
18
+ export type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions;
19
+ type RefetchQueriesIncludeShorthand = "all" | "active";
20
+ export type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
21
+ export type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
21
22
  export interface RefetchQueriesOptions<TCache extends ApolloCache<any>, TResult> {
22
23
  updateCache?: (cache: TCache) => void;
23
24
  include?: RefetchQueriesInclude;
24
25
  optimistic?: boolean;
25
26
  onQueryUpdated?: OnQueryUpdated<TResult> | null;
26
27
  }
27
- export declare type RefetchQueriesPromiseResults<TResult> = IsStrictlyAny<TResult> extends true ? any[] : TResult extends boolean ? ApolloQueryResult<any>[] : TResult extends PromiseLike<infer U> ? U[] : TResult[];
28
+ export type RefetchQueriesPromiseResults<TResult> = IsStrictlyAny<TResult> extends true ? any[] : TResult extends boolean ? ApolloQueryResult<any>[] : TResult extends PromiseLike<infer U> ? U[] : TResult[];
28
29
  export interface RefetchQueriesResult<TResult> extends Promise<RefetchQueriesPromiseResults<TResult>> {
29
30
  queries: ObservableQuery<any>[];
30
31
  results: InternalRefetchQueriesResult<TResult>[];
@@ -33,11 +34,11 @@ export interface InternalRefetchQueriesOptions<TCache extends ApolloCache<any>,
33
34
  include?: InternalRefetchQueriesInclude;
34
35
  removeOptimistic?: string;
35
36
  }
36
- export declare type InternalRefetchQueriesResult<TResult> = TResult extends boolean ? Promise<ApolloQueryResult<any>> : TResult;
37
- export declare type InternalRefetchQueriesMap<TResult> = Map<ObservableQuery<any>, InternalRefetchQueriesResult<TResult>>;
37
+ export type InternalRefetchQueriesResult<TResult> = TResult extends boolean ? Promise<ApolloQueryResult<any>> : TResult;
38
+ export type InternalRefetchQueriesMap<TResult> = Map<ObservableQuery<any>, InternalRefetchQueriesResult<TResult>>;
38
39
  export type { QueryOptions as PureQueryOptions };
39
- export declare type OperationVariables = Record<string, any>;
40
- export declare type ApolloQueryResult<T> = {
40
+ export type OperationVariables = Record<string, any>;
41
+ export type ApolloQueryResult<T> = {
41
42
  data: T;
42
43
  errors?: ReadonlyArray<GraphQLError>;
43
44
  error?: ApolloError;
@@ -45,20 +46,20 @@ export declare type ApolloQueryResult<T> = {
45
46
  networkStatus: NetworkStatus;
46
47
  partial?: boolean;
47
48
  };
48
- export declare type MutationQueryReducer<T> = (previousResult: Record<string, any>, options: {
49
+ export type MutationQueryReducer<T> = (previousResult: Record<string, any>, options: {
49
50
  mutationResult: FetchResult<T>;
50
51
  queryName: string | undefined;
51
52
  queryVariables: Record<string, any>;
52
53
  }) => Record<string, any>;
53
- export declare type MutationQueryReducersMap<T = {
54
+ export type MutationQueryReducersMap<T = {
54
55
  [key: string]: any;
55
56
  }> = {
56
57
  [queryName: string]: MutationQueryReducer<T>;
57
58
  };
58
- export declare type MutationUpdaterFn<T = {
59
+ export type MutationUpdaterFn<T = {
59
60
  [key: string]: any;
60
61
  }> = (cache: ApolloCache<T>, mutationResult: FetchResult<T>) => void;
61
- export declare type MutationUpdaterFunction<TData, TVariables, TContext, TCache extends ApolloCache<any>> = (cache: TCache, result: Omit<FetchResult<TData>, 'context'>, options: {
62
+ export type MutationUpdaterFunction<TData, TVariables, TContext, TCache extends ApolloCache<any>> = (cache: TCache, result: Omit<FetchResult<TData>, 'context'>, options: {
62
63
  context?: TContext;
63
64
  variables?: TVariables;
64
65
  }) => void;
@@ -67,4 +68,7 @@ export interface Resolvers {
67
68
  [field: string]: Resolver;
68
69
  };
69
70
  }
71
+ export interface TransformQueryOptions {
72
+ removeClientFields?: boolean;
73
+ }
70
74
  //# source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SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC,KACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEzB,MAAM,MAAM,wBAAwB,CAAC,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI;IACjE,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAC9C,CAAC;AAGF,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI,CAI1D,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,KAC3B,IAAI,CAAC;AAEV,MAAM,MAAM,uBAAuB,CACjC,KAAK,EACL,UAAU,EACV,QAAQ,EACR,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,IAC7B,CACF,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,EAC3C,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,KACE,IAAI,CAAC;AACV,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,CAAE,KAAK,EAAE,MAAM,GAAI,QAAQ,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IAKpC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B"}
package/core/types.js CHANGED
@@ -1,2 +1,3 @@
1
+ ;
1
2
  export {};
2
3
  //# sourceMappingURL=types.js.map
package/core/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode, GraphQLError } from 'graphql';\n\nimport { ApolloCache } from '../cache';\nimport { FetchResult } from '../link/core';\nimport { ApolloError } from '../errors';\nimport { QueryInfo } from './QueryInfo';\nimport { NetworkStatus } from './networkStatus';\nimport { Resolver } from './LocalState';\nimport { ObservableQuery } from './ObservableQuery';\nimport { QueryOptions } from './watchQueryOptions';\nimport { Cache } from '../cache';\nimport { IsStrictlyAny } from '../utilities';\n\nexport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nexport type DefaultContext = Record<string, any>;\n\nexport type QueryListener = (queryInfo: QueryInfo) => void;\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined,\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// Used by ApolloClient[\"refetchQueries\"]\n// TODO Improve documentation comments for this public type.\nexport interface RefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> {\n updateCache?: (cache: TCache) => void;\n // The client.refetchQueries method discourages passing QueryOptions, by\n // restricting the public type of options.include to exclude QueryOptions as\n // an available array element type (see InternalRefetchQueriesInclude for a\n // version of RefetchQueriesInclude that allows legacy QueryOptions objects).\n include?: RefetchQueriesInclude;\n optimistic?: boolean;\n // If no onQueryUpdated function is provided, any queries affected by the\n // updateCache function or included in the options.include array will be\n // refetched by default. Passing null instead of undefined disables this\n // default refetching behavior for affected queries, though included queries\n // will still be refetched.\n onQueryUpdated?: OnQueryUpdated<TResult> | null;\n}\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsStrictlyAny<TResult> extends true ? any[] :\n // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloQueryResult<any>[] :\n // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[] :\n // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// The result of client.refetchQueries is thenable/awaitable, if you just want\n// an array of fully resolved results, but you can also access the raw results\n// immediately by examining the additional { queries, results } properties of\n// the RefetchQueriesResult<TResult> object.\nexport interface RefetchQueriesResult<TResult>\nextends Promise<RefetchQueriesPromiseResults<TResult>> {\n // An array of ObservableQuery objects corresponding 1:1 to TResult values\n // in the results arrays (both the TResult[] array below, and the results\n // array resolved by the Promise above).\n queries: ObservableQuery<any>[];\n // These are the raw TResult values returned by any onQueryUpdated functions\n // that were invoked by client.refetchQueries.\n results: InternalRefetchQueriesResult<TResult>[];\n}\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> extends Omit<RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloQueryResult<any>> :\n // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> =\n Map<ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>>;\n\n// TODO Remove this unnecessary type in Apollo Client 4.\nexport type { QueryOptions as PureQueryOptions };\n\nexport type OperationVariables = Record<string, any>;\n\nexport type ApolloQueryResult<T> = {\n data: T;\n /**\n * A list of any errors that occurred during server-side execution of a GraphQL operation.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n errors?: ReadonlyArray<GraphQLError>;\n /**\n * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls. \n * This will contain both a NetworkError field and any GraphQLErrors.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n // If result.data was read from the cache with missing fields,\n // result.partial will be true. Otherwise, result.partial will be falsy\n // (usually because the property is absent from the result object).\n partial?: boolean;\n};\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: FetchResult<T>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n },\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\n// @deprecated Use MutationUpdaterFunction instead.\nexport type MutationUpdaterFn<T = { [key: string]: any }> = (\n // The MutationUpdaterFn type is broken because it mistakenly uses the same\n // type parameter T for both the cache and the mutationResult. Do not use this\n // type unless you absolutely need it for backwards compatibility.\n cache: ApolloCache<T>,\n mutationResult: FetchResult<T>,\n) => void;\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache<any>\n> = (\n cache: TCache,\n result: Omit<FetchResult<TData>, 'context'>,\n options: {\n context?: TContext,\n variables?: TVariables,\n },\n) => void;\nexport interface Resolvers {\n [key: string]: {\n [ field: string ]: Resolver;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAe8D,CAAC","sourcesContent":["import { DocumentNode, GraphQLError } from 'graphql';\n\nimport { ApolloCache } from '../cache';\nimport { FetchResult } from '../link/core';\nimport { ApolloError } from '../errors';\nimport { QueryInfo } from './QueryInfo';\nimport { NetworkStatus } from './networkStatus';\nimport { Resolver } from './LocalState';\nimport { ObservableQuery } from './ObservableQuery';\nimport { QueryOptions } from './watchQueryOptions';\nimport { Cache } from '../cache';\nimport { IsStrictlyAny } from '../utilities';\n\nexport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nexport interface DefaultContext extends Record<string, any> {};\n\nexport type QueryListener = (queryInfo: QueryInfo) => void;\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined,\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// Used by ApolloClient[\"refetchQueries\"]\n// TODO Improve documentation comments for this public type.\nexport interface RefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> {\n updateCache?: (cache: TCache) => void;\n // The client.refetchQueries method discourages passing QueryOptions, by\n // restricting the public type of options.include to exclude QueryOptions as\n // an available array element type (see InternalRefetchQueriesInclude for a\n // version of RefetchQueriesInclude that allows legacy QueryOptions objects).\n include?: RefetchQueriesInclude;\n optimistic?: boolean;\n // If no onQueryUpdated function is provided, any queries affected by the\n // updateCache function or included in the options.include array will be\n // refetched by default. Passing null instead of undefined disables this\n // default refetching behavior for affected queries, though included queries\n // will still be refetched.\n onQueryUpdated?: OnQueryUpdated<TResult> | null;\n}\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsStrictlyAny<TResult> extends true ? any[] :\n // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloQueryResult<any>[] :\n // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[] :\n // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// The result of client.refetchQueries is thenable/awaitable, if you just want\n// an array of fully resolved results, but you can also access the raw results\n// immediately by examining the additional { queries, results } properties of\n// the RefetchQueriesResult<TResult> object.\nexport interface RefetchQueriesResult<TResult>\nextends Promise<RefetchQueriesPromiseResults<TResult>> {\n // An array of ObservableQuery objects corresponding 1:1 to TResult values\n // in the results arrays (both the TResult[] array below, and the results\n // array resolved by the Promise above).\n queries: ObservableQuery<any>[];\n // These are the raw TResult values returned by any onQueryUpdated functions\n // that were invoked by client.refetchQueries.\n results: InternalRefetchQueriesResult<TResult>[];\n}\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> extends Omit<RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloQueryResult<any>> :\n // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> =\n Map<ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>>;\n\n// TODO Remove this unnecessary type in Apollo Client 4.\nexport type { QueryOptions as PureQueryOptions };\n\nexport type OperationVariables = Record<string, any>;\n\nexport type ApolloQueryResult<T> = {\n data: T;\n /**\n * A list of any errors that occurred during server-side execution of a GraphQL operation.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n errors?: ReadonlyArray<GraphQLError>;\n /**\n * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls.\n * This will contain both a NetworkError field and any GraphQLErrors.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n // If result.data was read from the cache with missing fields,\n // result.partial will be true. Otherwise, result.partial will be falsy\n // (usually because the property is absent from the result object).\n partial?: boolean;\n};\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: FetchResult<T>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n },\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\n// @deprecated Use MutationUpdaterFunction instead.\nexport type MutationUpdaterFn<T = { [key: string]: any }> = (\n // The MutationUpdaterFn type is broken because it mistakenly uses the same\n // type parameter T for both the cache and the mutationResult. Do not use this\n // type unless you absolutely need it for backwards compatibility.\n cache: ApolloCache<T>,\n mutationResult: FetchResult<T>,\n) => void;\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache<any>\n> = (\n cache: TCache,\n result: Omit<FetchResult<TData>, 'context'>,\n options: {\n context?: TContext,\n variables?: TVariables,\n },\n) => void;\nexport interface Resolvers {\n [key: string]: {\n [ field: string ]: Resolver;\n };\n}\n\nexport interface TransformQueryOptions {\n /**\n * Determines whether fields using the `@client` directive should be removed\n * from the query before it is sent through the link chain. Defaults to `true`.\n */\n removeClientFields?: boolean\n}\n"]}
@@ -4,16 +4,16 @@ import { FetchResult } from '../link/core';
4
4
  import { DefaultContext, MutationQueryReducersMap, OperationVariables, MutationUpdaterFunction, OnQueryUpdated, InternalRefetchQueriesInclude } from './types';
5
5
  import { ApolloCache } from '../cache';
6
6
  import { ObservableQuery } from './ObservableQuery';
7
- export declare type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby';
8
- export declare type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';
9
- export declare type MutationFetchPolicy = Extract<FetchPolicy, 'network-only' | 'no-cache'>;
10
- export declare type RefetchWritePolicy = "merge" | "overwrite";
11
- export declare type ErrorPolicy = 'none' | 'ignore' | 'all';
7
+ export type FetchPolicy = 'cache-first' | 'network-only' | 'cache-only' | 'no-cache' | 'standby';
8
+ export type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';
9
+ export type MutationFetchPolicy = Extract<FetchPolicy, 'network-only' | 'no-cache'>;
10
+ export type RefetchWritePolicy = "merge" | "overwrite";
11
+ export type ErrorPolicy = 'none' | 'ignore' | 'all';
12
12
  export interface QueryOptions<TVariables = OperationVariables, TData = any> {
13
13
  query: DocumentNode | TypedDocumentNode<TData, TVariables>;
14
14
  variables?: TVariables;
15
15
  errorPolicy?: ErrorPolicy;
16
- context?: any;
16
+ context?: DefaultContext;
17
17
  fetchPolicy?: FetchPolicy;
18
18
  pollInterval?: number;
19
19
  notifyOnNetworkStatusChange?: boolean;
@@ -21,14 +21,14 @@ export interface QueryOptions<TVariables = OperationVariables, TData = any> {
21
21
  partialRefetch?: boolean;
22
22
  canonizeResults?: boolean;
23
23
  }
24
- export interface WatchQueryOptions<TVariables = OperationVariables, TData = any> extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {
24
+ export interface WatchQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = any> extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {
25
25
  fetchPolicy?: WatchQueryFetchPolicy;
26
26
  nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
27
27
  initialFetchPolicy?: WatchQueryFetchPolicy;
28
28
  refetchWritePolicy?: RefetchWritePolicy;
29
29
  fetchOnFirstSubscribe?: boolean;
30
30
  }
31
- export interface NextFetchPolicyContext<TData, TVariables> {
31
+ export interface NextFetchPolicyContext<TData, TVariables extends OperationVariables> {
32
32
  reason: "after-fetch" | "variables-changed";
33
33
  observable: ObservableQuery<TData, TVariables>;
34
34
  options: WatchQueryOptions<TVariables, TData>;
@@ -37,15 +37,15 @@ export interface NextFetchPolicyContext<TData, TVariables> {
37
37
  export interface FetchMoreQueryOptions<TVariables, TData = any> {
38
38
  query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
39
39
  variables?: Partial<TVariables>;
40
- context?: any;
40
+ context?: DefaultContext;
41
41
  }
42
- export declare type UpdateQueryFn<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = (previousQueryResult: TData, options: {
42
+ export type UpdateQueryFn<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = (previousQueryResult: TData, options: {
43
43
  subscriptionData: {
44
44
  data: TSubscriptionData;
45
45
  };
46
46
  variables?: TSubscriptionVariables;
47
47
  }) => TData;
48
- export declare type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = {
48
+ export type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = {
49
49
  document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
50
50
  variables?: TSubscriptionVariables;
51
51
  updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;
@@ -1 +1 @@
1
- {"version":3,"file":"watchQueryOptions.d.ts","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,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WAAW,CAAC,GAAG,CAAC,CAClD,SAAQ,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC;IAKhE,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAO9D,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAWlC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\nimport { ObservableQuery } from './ObservableQuery';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: any;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>,\n ) => WatchQueryFetchPolicy);\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /**\n * Determines whether the observable should execute a request when the first\n * observer subscribes to it.\n */\n fetchOnFirstSubscribe?: boolean\n}\n\nexport interface NextFetchPolicyContext<TData, TVariables> {\n reason:\n | \"after-fetch\"\n | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: any;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has successfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the initial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
1
+ {"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\nimport { ObservableQuery } from './ObservableQuery';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: DefaultContext;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>,\n ) => WatchQueryFetchPolicy);\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /**\n * Determines whether the observable should execute a request when the first\n * observer subscribes to it.\n */\n fetchOnFirstSubscribe?: boolean\n}\n\nexport interface NextFetchPolicyContext<TData, TVariables extends OperationVariables> {\n reason:\n | \"after-fetch\"\n | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: DefaultContext;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has successfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the initial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
package/errors/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { GraphQLError } from 'graphql';
3
3
  import { ServerParseError } from '../link/http';
4
4
  import { ServerError } from '../link/utils';
5
5
  export declare function isApolloError(err: Error): err is ApolloError;
6
- export declare type GraphQLErrors = ReadonlyArray<GraphQLError>;
7
- export declare type NetworkError = Error | ServerParseError | ServerError | null;
6
+ export type GraphQLErrors = ReadonlyArray<GraphQLError>;
7
+ export type NetworkError = Error | ServerParseError | ServerError | null;
8
8
  export declare class ApolloError extends Error {
9
9
  name: string;
10
10
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wBAAgB,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,GAAG,IAAI,WAAW,CAE5D;AA6BD,oBAAY,aAAa,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAExD,oBAAY,YAAY,GAAG,KAAK,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAC;AAEzE,qBAAa,WAAY,SAAQ,KAAK;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,YAAY,EAAE,KAAK,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAC;IAK5D,SAAS,EAAE,GAAG,CAAC;gBAKV,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,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,CAAC,EAAE,KAAK,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAC;QAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,GAAG,CAAC;KACjB;CAaF"}
@@ -5,7 +5,7 @@
5
5
  // consult the @apollo/client/invariantErrorCodes.js file specific to
6
6
  // your @apollo/client version. This file is not meant to be imported.
7
7
  {
8
- "@apollo/client version": "3.8.0-alpha.0",
8
+ "@apollo/client version": "3.8.0-alpha.10",
9
9
 
10
10
  1: {
11
11
  file: "@apollo/client/cache/inmemory/entityStore.js",
@@ -70,70 +70,75 @@
70
70
  },
71
71
 
72
72
  12: {
73
+ file: "@apollo/client/core/LocalState.js",
74
+ node: invariant(fragment, "No fragment named ".concat(spread.name.value))
75
+ },
76
+
77
+ 13: {
73
78
  file: "@apollo/client/core/ObservableQuery.js",
74
79
  node: invariant(pollInterval, 'Attempted to start a polling query without a polling interval.')
75
80
  },
76
81
 
77
- 13: {
82
+ 14: {
78
83
  file: "@apollo/client/core/QueryManager.js",
79
84
  node: new InvariantError('QueryManager stopped while query was in flight')
80
85
  },
81
86
 
82
- 14: {
87
+ 15: {
83
88
  file: "@apollo/client/core/QueryManager.js",
84
89
  node: invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.')
85
90
  },
86
91
 
87
- 15: {
92
+ 16: {
88
93
  file: "@apollo/client/core/QueryManager.js",
89
94
 
90
95
  node: invariant(fetchPolicy === 'network-only' ||
91
96
  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.")
92
97
  },
93
98
 
94
- 16: {
99
+ 17: {
95
100
  file: "@apollo/client/core/QueryManager.js",
96
101
 
97
102
  node: invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
98
103
  'in the query option.')
99
104
  },
100
105
 
101
- 17: {
106
+ 18: {
102
107
  file: "@apollo/client/core/QueryManager.js",
103
108
  node: invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.')
104
109
  },
105
110
 
106
- 18: {
111
+ 19: {
107
112
  file: "@apollo/client/core/QueryManager.js",
108
113
  node: invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.')
109
114
  },
110
115
 
111
- 19: {
116
+ 20: {
112
117
  file: "@apollo/client/core/QueryManager.js",
113
118
  node: invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.')
114
119
  },
115
120
 
116
- 20: {
121
+ 21: {
117
122
  file: "@apollo/client/core/QueryManager.js",
118
123
  node: new InvariantError('Store reset while query was in flight (not completed in link chain)')
119
124
  },
120
125
 
121
- 21: {
126
+ 22: {
122
127
  file: "@apollo/client/link/core/ApolloLink.js",
123
128
  node: new InvariantError('request is not implemented')
124
129
  },
125
130
 
126
- 22: {
131
+ 23: {
127
132
  file: "@apollo/client/link/http/checkFetcher.js",
128
133
  node: new 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 ")
129
134
  },
130
135
 
131
- 23: {
136
+ 24: {
132
137
  file: "@apollo/client/link/http/serializeFetchParameter.js",
133
138
  node: new InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message))
134
139
  },
135
140
 
136
- 24: {
141
+ 25: {
137
142
  file: "@apollo/client/link/persisted-queries/index.js",
138
143
 
139
144
  node: invariant(options && (typeof options.sha256 === 'function' ||
@@ -142,45 +147,45 @@
142
147
  'parameter.')
143
148
  },
144
149
 
145
- 25: {
150
+ 26: {
146
151
  file: "@apollo/client/link/persisted-queries/index.js",
147
152
  node: invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.')
148
153
  },
149
154
 
150
- 26: {
155
+ 27: {
151
156
  file: "@apollo/client/link/utils/validateOperation.js",
152
157
  node: new InvariantError("illegal argument: ".concat(key))
153
158
  },
154
159
 
155
- 27: {
160
+ 28: {
156
161
  file: "@apollo/client/react/context/ApolloConsumer.js",
157
162
 
158
163
  node: invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
159
164
  'Wrap the root component in an <ApolloProvider>.')
160
165
  },
161
166
 
162
- 28: {
167
+ 29: {
163
168
  file: "@apollo/client/react/context/ApolloProvider.js",
164
169
 
165
170
  node: invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
166
171
  'sure you pass in your client via the "client" prop.')
167
172
  },
168
173
 
169
- 29: {
174
+ 30: {
170
175
  file: "@apollo/client/react/hoc/hoc-utils.js",
171
176
 
172
177
  node: invariant(this.withRef, "To access the wrapped instance, you need to specify " +
173
178
  "{ withRef: true } in the options")
174
179
  },
175
180
 
176
- 30: {
181
+ 31: {
177
182
  file: "@apollo/client/react/hoc/withApollo.js",
178
183
 
179
184
  node: invariant(operationOptions.withRef, "To access the wrapped instance, you need to specify " +
180
185
  "{ withRef: true } in the options")
181
186
  },
182
187
 
183
- 31: {
188
+ 32: {
184
189
  file: "@apollo/client/react/hooks/useApolloClient.js",
185
190
 
186
191
  node: invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
@@ -188,19 +193,20 @@
188
193
  'instance in via options.')
189
194
  },
190
195
 
191
- 32: {
196
+ 33: {
192
197
  file: "@apollo/client/react/hooks/useSuspenseCache.js",
193
198
 
194
- node: invariant(suspenseCache, 'Could not find a "suspenseCache" in the context. Wrap the root component ' +
195
- 'in an <ApolloProvider> and provide a suspenseCache.')
199
+ node: invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
200
+ 'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
201
+ 'or pass a SuspenseCache instance in via options.')
196
202
  },
197
203
 
198
- 33: {
204
+ 34: {
199
205
  file: "@apollo/client/react/hooks/useSuspenseQuery.js",
200
206
  node: invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense."))
201
207
  },
202
208
 
203
- 34: {
209
+ 35: {
204
210
  file: "@apollo/client/react/parser/index.js",
205
211
 
206
212
  node: invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
@@ -208,7 +214,7 @@
208
214
  "to convert your operation into a document")
209
215
  },
210
216
 
211
- 35: {
217
+ 36: {
212
218
  file: "@apollo/client/react/parser/index.js",
213
219
 
214
220
  node: invariant(!fragments.length ||
@@ -216,7 +222,7 @@
216
222
  "You must include a query, subscription or mutation as well")
217
223
  },
218
224
 
219
- 36: {
225
+ 37: {
220
226
  file: "@apollo/client/react/parser/index.js",
221
227
 
222
228
  node: invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
@@ -225,7 +231,7 @@
225
231
  "You can use 'compose' to join multiple operation types to a component")
226
232
  },
227
233
 
228
- 37: {
234
+ 38: {
229
235
  file: "@apollo/client/react/parser/index.js",
230
236
 
231
237
  node: invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
@@ -233,23 +239,18 @@
233
239
  "You can use 'compose' to join multiple operation types to a component")
234
240
  },
235
241
 
236
- 38: {
242
+ 39: {
237
243
  file: "@apollo/client/react/parser/index.js",
238
244
 
239
245
  node: invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
240
246
  "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead."))
241
247
  },
242
248
 
243
- 39: {
249
+ 40: {
244
250
  file: "@apollo/client/testing/core/mocking/mockLink.js",
245
251
  node: invariant(queryWithoutConnection, "query is required")
246
252
  },
247
253
 
248
- 40: {
249
- file: "@apollo/client/utilities/globals/index.js",
250
- node: invariant("boolean" === typeof DEV, DEV)
251
- },
252
-
253
254
  41: {
254
255
  file: "@apollo/client/utilities/graphql/directives.js",
255
256
  node: invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive."))
@@ -10,6 +10,7 @@ var OperationBatcher = (function () {
10
10
  function OperationBatcher(_a) {
11
11
  var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey;
12
12
  this.batchesByKey = new Map();
13
+ this.scheduledBatchTimerByKey = new Map();
13
14
  this.batchDebounce = batchDebounce;
14
15
  this.batchInterval = batchInterval;
15
16
  this.batchMax = batchMax || 0;
@@ -118,10 +119,11 @@ var OperationBatcher = (function () {
118
119
  };
119
120
  OperationBatcher.prototype.scheduleQueueConsumption = function (key) {
120
121
  var _this = this;
121
- clearTimeout(this.scheduledBatchTimer);
122
- this.scheduledBatchTimer = setTimeout(function () {
122
+ clearTimeout(this.scheduledBatchTimerByKey.get(key));
123
+ this.scheduledBatchTimerByKey.set(key, setTimeout(function () {
123
124
  _this.consumeQueue(key);
124
- }, this.batchInterval);
125
+ _this.scheduledBatchTimerByKey.delete(key);
126
+ }, this.batchInterval));
125
127
  };
126
128
  return OperationBatcher;
127
129
  }());