@apollo/client 4.3.0-alpha.1 → 4.3.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 (389) hide show
  1. package/CHANGELOG.md +484 -0
  2. package/README.md +3 -7
  3. package/__cjs/cache/core/Scalar.cjs +36 -0
  4. package/__cjs/cache/core/Scalar.cjs.map +1 -0
  5. package/__cjs/cache/core/Scalar.d.cts +20 -0
  6. package/__cjs/cache/core/cache.cjs +32 -1
  7. package/__cjs/cache/core/cache.cjs.map +1 -1
  8. package/__cjs/cache/core/cache.d.cts +89 -6
  9. package/__cjs/cache/core/types/Cache.d.cts +25 -0
  10. package/__cjs/cache/index.cjs +3 -1
  11. package/__cjs/cache/index.cjs.map +1 -1
  12. package/__cjs/cache/index.d.cts +3 -2
  13. package/__cjs/cache/inmemory/entityStore.cjs +48 -5
  14. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  15. package/__cjs/cache/inmemory/entityStore.d.cts +3 -0
  16. package/__cjs/cache/inmemory/helpers.d.cts +9 -1
  17. package/__cjs/cache/inmemory/inMemoryCache.cjs +83 -4
  18. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  19. package/__cjs/cache/inmemory/inMemoryCache.d.cts +44 -5
  20. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  21. package/__cjs/cache/inmemory/policies.cjs +35 -6
  22. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/policies.d.cts +4 -1
  24. package/__cjs/cache/inmemory/readFromStore.cjs +490 -49
  25. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  26. package/__cjs/cache/inmemory/readFromStore.d.cts +11 -2
  27. package/__cjs/cache/inmemory/types.d.cts +29 -4
  28. package/__cjs/cache/inmemory/writeToStore.cjs +6 -6
  29. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  30. package/__cjs/core/ApolloClient.cjs +37 -38
  31. package/__cjs/core/ApolloClient.cjs.map +1 -1
  32. package/__cjs/core/ApolloClient.d.cts +44 -10
  33. package/__cjs/core/ObservableQuery.cjs +228 -76
  34. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  35. package/__cjs/core/ObservableQuery.d.cts +16 -8
  36. package/__cjs/core/QueryInfo.cjs +178 -190
  37. package/__cjs/core/QueryInfo.cjs.map +1 -1
  38. package/__cjs/core/QueryInfo.d.cts +16 -21
  39. package/__cjs/core/QueryManager.cjs +88 -59
  40. package/__cjs/core/QueryManager.cjs.map +1 -1
  41. package/__cjs/core/QueryManager.d.cts +1 -3
  42. package/__cjs/core/RefetchEventManager.cjs +3 -3
  43. package/__cjs/core/dataStateErrorCache.cjs +12 -0
  44. package/__cjs/core/dataStateErrorCache.cjs.map +1 -0
  45. package/__cjs/core/dataStateErrorCache.d.cts +3 -0
  46. package/__cjs/core/index.cjs +2 -1
  47. package/__cjs/core/index.cjs.map +1 -1
  48. package/__cjs/core/index.d.cts +4 -3
  49. package/__cjs/core/types.d.cts +11 -4
  50. package/__cjs/incremental/GraphQLCodegenIncremental.cjs +3 -0
  51. package/__cjs/incremental/GraphQLCodegenIncremental.cjs.map +1 -0
  52. package/__cjs/incremental/GraphQLCodegenIncremental.d.cts +55 -0
  53. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  54. package/__cjs/incremental/handlers/defer20220824.d.cts +2 -4
  55. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +47 -16
  56. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
  57. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +29 -6
  58. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  59. package/__cjs/incremental/index.cjs.map +1 -1
  60. package/__cjs/incremental/index.d.cts +1 -0
  61. package/__cjs/incremental/internal/types.cjs +3 -0
  62. package/__cjs/incremental/internal/types.cjs.map +1 -0
  63. package/__cjs/incremental/internal/types.d.cts +17 -0
  64. package/__cjs/incremental/types.d.cts +55 -4
  65. package/__cjs/invariantErrorCodes.cjs +167 -112
  66. package/__cjs/link/core/ApolloLink.cjs +3 -3
  67. package/__cjs/link/http/checkFetcher.cjs +1 -1
  68. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
  69. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  70. package/__cjs/link/persisted-queries/index.cjs +2 -2
  71. package/__cjs/link/ws/index.cjs +1 -1
  72. package/__cjs/local-state/LocalState.cjs +11 -11
  73. package/__cjs/masking/internal/types.d.cts +1 -2
  74. package/__cjs/masking/maskDefinition.cjs +2 -2
  75. package/__cjs/masking/maskFragment.cjs +2 -2
  76. package/__cjs/masking/maskOperation.cjs +1 -1
  77. package/__cjs/masking/utils.cjs +3 -3
  78. package/__cjs/react/context/ApolloContext.cjs +1 -1
  79. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  80. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  81. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  82. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  83. package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
  84. package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
  85. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  86. package/__cjs/react/hooks/useLazyQuery.d.cts +39 -33
  87. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  88. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  89. package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
  90. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  91. package/__cjs/react/hooks/useMutation.d.cts +10 -7
  92. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  93. package/__cjs/react/hooks/useQuery.d.cts +74 -32
  94. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  95. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  96. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  97. package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
  98. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  99. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  100. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  101. package/__cjs/react/internal/types.d.cts +14 -3
  102. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  103. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
  104. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  105. package/__cjs/testing/core/mocking/mockLink.cjs +25 -5
  106. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  107. package/__cjs/testing/core/mocking/mockLink.d.cts +1 -2
  108. package/__cjs/utilities/caching/sizes.cjs.map +1 -1
  109. package/__cjs/utilities/caching/sizes.d.cts +39 -1
  110. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  111. package/__cjs/utilities/index.cjs.map +1 -1
  112. package/__cjs/utilities/index.d.cts +1 -0
  113. package/__cjs/utilities/internal/StreamArrayState.cjs +27 -0
  114. package/__cjs/utilities/internal/StreamArrayState.cjs.map +1 -0
  115. package/__cjs/utilities/internal/StreamArrayState.d.cts +12 -0
  116. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs +33 -0
  117. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs.map +1 -0
  118. package/__cjs/utilities/internal/addDeferFragmentLabels.d.cts +3 -0
  119. package/__cjs/utilities/internal/capitalize.cjs +12 -0
  120. package/__cjs/utilities/internal/capitalize.cjs.map +1 -0
  121. package/__cjs/utilities/internal/capitalize.d.cts +7 -0
  122. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +69 -0
  123. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -0
  124. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.d.cts +9 -0
  125. package/__cjs/utilities/internal/constants.cjs +20 -1
  126. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  127. package/__cjs/utilities/internal/constants.d.cts +19 -0
  128. package/__cjs/utilities/internal/getDirectiveArgValue.cjs +19 -0
  129. package/__cjs/utilities/internal/getDirectiveArgValue.cjs.map +1 -0
  130. package/__cjs/utilities/internal/getDirectiveArgValue.d.cts +9 -0
  131. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  132. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +2 -2
  133. package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
  134. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
  135. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  136. package/__cjs/utilities/internal/getMemoryInternals.cjs +6 -0
  137. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  138. package/__cjs/utilities/internal/getMemoryInternals.d.cts +4 -0
  139. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  140. package/__cjs/utilities/internal/getUnwrappedType.cjs +20 -0
  141. package/__cjs/utilities/internal/getUnwrappedType.cjs.map +1 -0
  142. package/__cjs/utilities/internal/getUnwrappedType.d.cts +8 -0
  143. package/__cjs/utilities/internal/index.cjs +25 -2
  144. package/__cjs/utilities/internal/index.cjs.map +1 -1
  145. package/__cjs/utilities/internal/index.d.cts +16 -1
  146. package/__cjs/utilities/internal/isDeferredFragment.cjs +38 -0
  147. package/__cjs/utilities/internal/isDeferredFragment.cjs.map +1 -0
  148. package/__cjs/utilities/internal/isDeferredFragment.d.cts +9 -0
  149. package/__cjs/utilities/internal/isStreamField.cjs +37 -0
  150. package/__cjs/utilities/internal/isStreamField.cjs.map +1 -0
  151. package/__cjs/utilities/internal/isStreamField.d.cts +9 -0
  152. package/__cjs/utilities/internal/isTypenameField.cjs +7 -0
  153. package/__cjs/utilities/internal/isTypenameField.cjs.map +1 -0
  154. package/__cjs/utilities/internal/isTypenameField.d.cts +3 -0
  155. package/__cjs/utilities/internal/makeStreamInfoTrie.cjs +17 -0
  156. package/__cjs/utilities/internal/makeStreamInfoTrie.cjs.map +1 -0
  157. package/__cjs/utilities/internal/makeStreamInfoTrie.d.cts +8 -0
  158. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
  159. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  160. package/__cjs/utilities/internal/toDiffWithDataState.cjs +20 -0
  161. package/__cjs/utilities/internal/toDiffWithDataState.cjs.map +1 -0
  162. package/__cjs/utilities/internal/toDiffWithDataState.d.cts +8 -0
  163. package/__cjs/utilities/internal/types/DeferInfo.cjs +3 -0
  164. package/__cjs/utilities/internal/types/DeferInfo.cjs.map +1 -0
  165. package/__cjs/utilities/internal/types/DeferInfo.d.cts +10 -0
  166. package/__cjs/utilities/internal/types/Exact.cjs +3 -0
  167. package/__cjs/utilities/internal/types/Exact.cjs.map +1 -0
  168. package/__cjs/utilities/internal/types/Exact.d.cts +2 -0
  169. package/__cjs/utilities/internal/types/IsLooselyEqual.cjs +3 -0
  170. package/__cjs/utilities/internal/types/IsLooselyEqual.cjs.map +1 -0
  171. package/__cjs/utilities/internal/types/IsLooselyEqual.d.cts +10 -0
  172. package/__cjs/utilities/internal/types/IsNeverish.cjs +3 -0
  173. package/__cjs/utilities/internal/types/IsNeverish.cjs.map +1 -0
  174. package/__cjs/utilities/internal/types/IsNeverish.d.cts +4 -0
  175. package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +2 -0
  176. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  177. package/__cjs/utilities/policies/pagination.cjs.map +1 -1
  178. package/__cjs/utilities/policies/pagination.d.cts +1 -1
  179. package/__cjs/utilities/subscriptions/relay/index.cjs +1 -0
  180. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  181. package/__cjs/version.cjs +1 -1
  182. package/__cjs/version.cjs.map +1 -1
  183. package/cache/core/Scalar.d.ts +20 -0
  184. package/cache/core/Scalar.js +32 -0
  185. package/cache/core/Scalar.js.map +1 -0
  186. package/cache/core/cache.d.ts +89 -6
  187. package/cache/core/cache.js +33 -2
  188. package/cache/core/cache.js.map +1 -1
  189. package/cache/core/types/Cache.d.ts +25 -0
  190. package/cache/core/types/Cache.js.map +1 -1
  191. package/cache/index.d.ts +3 -2
  192. package/cache/index.js +1 -0
  193. package/cache/index.js.map +1 -1
  194. package/cache/inmemory/entityStore.d.ts +3 -0
  195. package/cache/inmemory/entityStore.js +49 -6
  196. package/cache/inmemory/entityStore.js.map +1 -1
  197. package/cache/inmemory/helpers.d.ts +9 -1
  198. package/cache/inmemory/inMemoryCache.d.ts +44 -5
  199. package/cache/inmemory/inMemoryCache.js +84 -5
  200. package/cache/inmemory/inMemoryCache.js.map +1 -1
  201. package/cache/inmemory/key-extractor.js +1 -1
  202. package/cache/inmemory/policies.d.ts +4 -1
  203. package/cache/inmemory/policies.js +35 -6
  204. package/cache/inmemory/policies.js.map +1 -1
  205. package/cache/inmemory/readFromStore.d.ts +11 -2
  206. package/cache/inmemory/readFromStore.js +486 -49
  207. package/cache/inmemory/readFromStore.js.map +1 -1
  208. package/cache/inmemory/types.d.ts +30 -5
  209. package/cache/inmemory/types.js.map +1 -1
  210. package/cache/inmemory/writeToStore.js +7 -7
  211. package/cache/inmemory/writeToStore.js.map +1 -1
  212. package/core/ApolloClient.d.ts +44 -10
  213. package/core/ApolloClient.js +37 -38
  214. package/core/ApolloClient.js.map +1 -1
  215. package/core/ObservableQuery.d.ts +16 -8
  216. package/core/ObservableQuery.js +225 -77
  217. package/core/ObservableQuery.js.map +1 -1
  218. package/core/QueryInfo.d.ts +17 -22
  219. package/core/QueryInfo.js +174 -190
  220. package/core/QueryInfo.js.map +1 -1
  221. package/core/QueryManager.d.ts +1 -3
  222. package/core/QueryManager.js +89 -60
  223. package/core/QueryManager.js.map +1 -1
  224. package/core/RefetchEventManager.js +3 -3
  225. package/core/dataStateErrorCache.d.ts +3 -0
  226. package/core/dataStateErrorCache.js +9 -0
  227. package/core/dataStateErrorCache.js.map +1 -0
  228. package/core/index.d.ts +4 -3
  229. package/core/index.js +1 -1
  230. package/core/index.js.map +1 -1
  231. package/core/types.d.ts +11 -4
  232. package/core/types.js.map +1 -1
  233. package/incremental/GraphQLCodegenIncremental.d.ts +55 -0
  234. package/incremental/GraphQLCodegenIncremental.js +2 -0
  235. package/incremental/GraphQLCodegenIncremental.js.map +1 -0
  236. package/incremental/handlers/defer20220824.d.ts +2 -4
  237. package/incremental/handlers/defer20220824.js.map +1 -1
  238. package/incremental/handlers/graphql17Alpha9.d.ts +29 -6
  239. package/incremental/handlers/graphql17Alpha9.js +48 -17
  240. package/incremental/handlers/graphql17Alpha9.js.map +1 -1
  241. package/incremental/handlers/notImplemented.js +1 -1
  242. package/incremental/index.d.ts +1 -0
  243. package/incremental/index.js.map +1 -1
  244. package/incremental/internal/types.d.ts +17 -0
  245. package/incremental/internal/types.js +2 -0
  246. package/incremental/internal/types.js.map +1 -0
  247. package/incremental/types.d.ts +55 -4
  248. package/incremental/types.js.map +1 -1
  249. package/invariantErrorCodes.js +167 -112
  250. package/link/core/ApolloLink.js +3 -3
  251. package/link/http/checkFetcher.js +1 -1
  252. package/link/http/parseAndCheckHttpResponse.js +2 -2
  253. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  254. package/link/persisted-queries/index.js +2 -2
  255. package/link/ws/index.js +1 -1
  256. package/local-state/LocalState.js +11 -11
  257. package/masking/internal/types.d.ts +1 -2
  258. package/masking/internal/types.js.map +1 -1
  259. package/masking/maskDefinition.js +2 -2
  260. package/masking/maskFragment.js +2 -2
  261. package/masking/maskOperation.js +1 -1
  262. package/masking/utils.js +3 -3
  263. package/package.json +1 -1
  264. package/react/context/ApolloContext.js +1 -1
  265. package/react/context/ApolloProvider.js +1 -1
  266. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  267. package/react/hooks/useApolloClient.js +1 -1
  268. package/react/hooks/useBackgroundQuery.d.ts +100 -47
  269. package/react/hooks/useBackgroundQuery.js.map +1 -1
  270. package/react/hooks/useLazyQuery.d.ts +39 -33
  271. package/react/hooks/useLazyQuery.js +2 -2
  272. package/react/hooks/useLazyQuery.js.map +1 -1
  273. package/react/hooks/useLoadableQuery.d.ts +23 -15
  274. package/react/hooks/useLoadableQuery.js +2 -2
  275. package/react/hooks/useLoadableQuery.js.map +1 -1
  276. package/react/hooks/useMutation.d.ts +10 -7
  277. package/react/hooks/useMutation.js.map +1 -1
  278. package/react/hooks/useQuery.d.ts +74 -32
  279. package/react/hooks/useQuery.js.map +1 -1
  280. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  281. package/react/hooks/useSubscription.js +1 -1
  282. package/react/hooks/useSuspenseQuery.d.ts +83 -34
  283. package/react/hooks/useSuspenseQuery.js.map +1 -1
  284. package/react/hooks/useSyncExternalStore.js +1 -1
  285. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
  286. package/react/hooks-compiled/useApolloClient.js +1 -1
  287. package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
  288. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  289. package/react/hooks-compiled/useLazyQuery.d.ts +39 -33
  290. package/react/hooks-compiled/useLazyQuery.js +2 -2
  291. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  292. package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
  293. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  294. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  295. package/react/hooks-compiled/useMutation.d.ts +10 -7
  296. package/react/hooks-compiled/useMutation.js.map +1 -1
  297. package/react/hooks-compiled/useQuery.d.ts +74 -32
  298. package/react/hooks-compiled/useQuery.js.map +1 -1
  299. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  300. package/react/hooks-compiled/useSubscription.js +1 -1
  301. package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
  302. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  303. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  304. package/react/internal/cache/QueryReference.js +1 -1
  305. package/react/internal/cache/QueryReference.js.map +1 -1
  306. package/react/internal/types.d.ts +15 -4
  307. package/react/internal/types.js.map +1 -1
  308. package/react/query-preloader/createQueryPreloader.d.ts +20 -5
  309. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  310. package/react/ssr/prerenderStatic.js +2 -2
  311. package/testing/core/mocking/mockLink.d.ts +1 -2
  312. package/testing/core/mocking/mockLink.js +25 -5
  313. package/testing/core/mocking/mockLink.js.map +1 -1
  314. package/utilities/caching/sizes.d.ts +39 -1
  315. package/utilities/caching/sizes.js.map +1 -1
  316. package/utilities/graphql/DocumentTransform.js +1 -1
  317. package/utilities/index.d.ts +1 -0
  318. package/utilities/index.js.map +1 -1
  319. package/utilities/internal/StreamArrayState.d.ts +12 -0
  320. package/utilities/internal/StreamArrayState.js +23 -0
  321. package/utilities/internal/StreamArrayState.js.map +1 -0
  322. package/utilities/internal/addDeferFragmentLabels.d.ts +3 -0
  323. package/utilities/internal/addDeferFragmentLabels.js +30 -0
  324. package/utilities/internal/addDeferFragmentLabels.js.map +1 -0
  325. package/utilities/internal/capitalize.d.ts +7 -0
  326. package/utilities/internal/capitalize.js +9 -0
  327. package/utilities/internal/capitalize.js.map +1 -0
  328. package/utilities/internal/coerceScalarFieldsToParsed.d.ts +9 -0
  329. package/utilities/internal/coerceScalarFieldsToParsed.js +66 -0
  330. package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -0
  331. package/utilities/internal/constants.d.ts +19 -0
  332. package/utilities/internal/constants.js +19 -0
  333. package/utilities/internal/constants.js.map +1 -1
  334. package/utilities/internal/getDirectiveArgValue.d.ts +9 -0
  335. package/utilities/internal/getDirectiveArgValue.js +16 -0
  336. package/utilities/internal/getDirectiveArgValue.js.map +1 -0
  337. package/utilities/internal/getFragmentDefinition.js +3 -3
  338. package/utilities/internal/getFragmentFromSelection.js +2 -2
  339. package/utilities/internal/getFragmentFromSelection.js.map +1 -1
  340. package/utilities/internal/getFragmentQueryDocument.js +2 -2
  341. package/utilities/internal/getMainDefinition.js +1 -1
  342. package/utilities/internal/getMemoryInternals.d.ts +4 -0
  343. package/utilities/internal/getMemoryInternals.js +6 -0
  344. package/utilities/internal/getMemoryInternals.js.map +1 -1
  345. package/utilities/internal/getQueryDefinition.js +1 -1
  346. package/utilities/internal/getUnwrappedType.d.ts +8 -0
  347. package/utilities/internal/getUnwrappedType.js +17 -0
  348. package/utilities/internal/getUnwrappedType.js.map +1 -0
  349. package/utilities/internal/index.d.ts +16 -1
  350. package/utilities/internal/index.js +12 -1
  351. package/utilities/internal/index.js.map +1 -1
  352. package/utilities/internal/isDeferredFragment.d.ts +9 -0
  353. package/utilities/internal/isDeferredFragment.js +35 -0
  354. package/utilities/internal/isDeferredFragment.js.map +1 -0
  355. package/utilities/internal/isStreamField.d.ts +9 -0
  356. package/utilities/internal/isStreamField.js +34 -0
  357. package/utilities/internal/isStreamField.js.map +1 -0
  358. package/utilities/internal/isTypenameField.d.ts +3 -0
  359. package/utilities/internal/isTypenameField.js +4 -0
  360. package/utilities/internal/isTypenameField.js.map +1 -0
  361. package/utilities/internal/makeStreamInfoTrie.d.ts +8 -0
  362. package/utilities/internal/makeStreamInfoTrie.js +14 -0
  363. package/utilities/internal/makeStreamInfoTrie.js.map +1 -0
  364. package/utilities/internal/removeDirectivesFromDocument.js +1 -1
  365. package/utilities/internal/shouldInclude.js +4 -4
  366. package/utilities/internal/toDiffWithDataState.d.ts +8 -0
  367. package/utilities/internal/toDiffWithDataState.js +17 -0
  368. package/utilities/internal/toDiffWithDataState.js.map +1 -0
  369. package/utilities/internal/types/DeferInfo.d.ts +10 -0
  370. package/utilities/internal/types/DeferInfo.js +2 -0
  371. package/utilities/internal/types/DeferInfo.js.map +1 -0
  372. package/utilities/internal/types/Exact.d.ts +2 -0
  373. package/utilities/internal/types/Exact.js +2 -0
  374. package/utilities/internal/types/Exact.js.map +1 -0
  375. package/utilities/internal/types/IsLooselyEqual.d.ts +10 -0
  376. package/utilities/internal/types/IsLooselyEqual.js +2 -0
  377. package/utilities/internal/types/IsLooselyEqual.js.map +1 -0
  378. package/utilities/internal/types/IsNeverish.d.ts +4 -0
  379. package/utilities/internal/types/IsNeverish.js +2 -0
  380. package/utilities/internal/types/IsNeverish.js.map +1 -0
  381. package/utilities/internal/types/StreamInfoTrie.d.ts +2 -0
  382. package/utilities/internal/types/StreamInfoTrie.js.map +1 -1
  383. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  384. package/utilities/policies/pagination.d.ts +1 -1
  385. package/utilities/policies/pagination.js.map +1 -1
  386. package/utilities/subscriptions/relay/index.js +1 -0
  387. package/utilities/subscriptions/relay/index.js.map +1 -1
  388. package/version.js +1 -1
  389. package/version.js.map +1 -1
@@ -8,7 +8,7 @@ import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
8
8
  import type { LocalState } from "@apollo/client/local-state";
9
9
  import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
10
10
  import { DocumentTransform } from "@apollo/client/utilities";
11
- import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
11
+ import type { LazyType, OptionWithFallback, Prettify, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
12
12
  import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
13
13
  import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.js";
14
14
  import type { ObservableQuery } from "./ObservableQuery.js";
@@ -232,7 +232,20 @@ export declare namespace ApolloClient {
232
232
  export namespace mutate {
233
233
  interface DefaultOptions extends ApolloClient.DefaultOptions.Mutate.Calculated {
234
234
  }
235
- type ResultForOptions<TData, TVariables extends OperationVariables, TCache extends Cache.Implementation, TOptions extends Record<string, unknown> | MutateOptions<any, TVariables, TCache>> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
235
+ type OptionsFor<TData, TVariables extends OperationVariables, TCache extends Cache.Implementation, TOptions extends {
236
+ variables?: unknown;
237
+ }> = MutateOptions<NoInfer<TData>, NoInfer<TVariables>, TCache> & {
238
+ variables?: Prettify<TVariables & {
239
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
240
+ }>;
241
+ } & (Exclude<keyof TOptions, keyof MutateOptions<any, any, any>> extends (infer InvalidOptionNames extends string) ? [
242
+ InvalidOptionNames
243
+ ] extends [never] ? unknown : {
244
+ [K in InvalidOptionNames]: never;
245
+ } : never);
246
+ type ResultForOptions<TData, TErrorPolicy extends ErrorPolicy | undefined = undefined> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<{
247
+ errorPolicy: TErrorPolicy;
248
+ }, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
236
249
  namespace Signatures {
237
250
  interface Classic {
238
251
  /**
@@ -271,11 +284,21 @@ export declare namespace ApolloClient {
271
284
  *
272
285
  * It takes options as an object with the following keys and values:
273
286
  */
274
- <TData, TVariables extends OperationVariables, TOptions extends ApolloClient.MutateOptions<NoInfer<TData>, NoInfer<TVariables>, Cache.Implementation> & VariablesOption<TVariables & {
275
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
276
- }>>(options: TOptions & {
287
+ <TData, TVariables extends OperationVariables, TOptions extends Omit<ApolloClient.MutateOptions<NoInfer<TData>, any, Cache.Implementation>, "variables"> & {
288
+ variables?: unknown;
289
+ }, TErrorPolicy extends ErrorPolicy | undefined = undefined>(options: TOptions & ApolloClient.mutate.OptionsFor<TData, TVariables, Cache.Implementation, TOptions> & {
277
290
  mutation: TypedDocumentNode<TData, TVariables>;
278
- }): Promise<ApolloClient.mutate.ResultForOptions<TData, TVariables, Cache.Implementation, TOptions>>;
291
+ /**
292
+ * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.
293
+ *
294
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
295
+ *
296
+ * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.
297
+ *
298
+ * @docGroup 1. Operation options
299
+ */
300
+ errorPolicy?: TErrorPolicy;
301
+ }): Promise<ApolloClient.mutate.ResultForOptions<TData, TErrorPolicy>>;
279
302
  }
280
303
  type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
281
304
  }
@@ -473,7 +496,18 @@ export declare namespace ApolloClient {
473
496
  export namespace query {
474
497
  interface DefaultOptions extends ApolloClient.DefaultOptions.Query.Calculated {
475
498
  }
476
- type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | QueryOptions<any, TVariables>> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
499
+ type OptionsFor<TData, TVariables extends OperationVariables, TOptions extends {
500
+ variables?: unknown;
501
+ }> = QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & {
502
+ variables?: Prettify<TVariables & {
503
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
504
+ }>;
505
+ } & (Exclude<keyof TOptions, keyof QueryOptions<any, any>> extends (infer InvalidOptionNames extends string) ? [
506
+ InvalidOptionNames
507
+ ] extends [never] ? unknown : {
508
+ [K in InvalidOptionNames]: never;
509
+ } : never);
510
+ type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | Omit<QueryOptions<any, any>, "variables">> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
477
511
  namespace Signatures {
478
512
  interface Classic {
479
513
  /**
@@ -515,9 +549,9 @@ export declare namespace ApolloClient {
515
549
  * describe how this query should be treated e.g. whether it should hit the
516
550
  * server at all or just resolve from the cache, etc.
517
551
  */
518
- <TData, TVariables extends OperationVariables, TOptions extends ApolloClient.QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & VariablesOption<TVariables & {
519
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
520
- }>>(options: TOptions & {
552
+ <TData, TVariables extends OperationVariables, TOptions extends Omit<ApolloClient.QueryOptions<NoInfer<TData>, any>, "variables"> & {
553
+ variables?: unknown;
554
+ }>(options: TOptions & ApolloClient.query.OptionsFor<TData, TVariables, TOptions> & {
521
555
  query: TypedDocumentNode<TData, TVariables>;
522
556
  }): Promise<ApolloClient.query.ResultForOptions<TData, TVariables, TOptions>>;
523
557
  }
@@ -71,8 +71,8 @@ export class ApolloClient {
71
71
  */
72
72
  constructor(options) {
73
73
  if (__DEV__) {
74
- invariant(options.cache, 68);
75
- invariant(options.link, 69);
74
+ invariant(options.cache, 69);
75
+ invariant(options.link, 70);
76
76
  }
77
77
  const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], refetchEventManager, } = options;
78
78
  this.link = link;
@@ -141,29 +141,28 @@ export class ApolloClient {
141
141
  */
142
142
  if (!hasSuggestedDevtools && __DEV__) {
143
143
  hasSuggestedDevtools = true;
144
- if (window.document &&
145
- window.top === window.self &&
146
- /^(https?|file):$/.test(window.location.protocol)) {
144
+ const win = window;
145
+ const ua = win.navigator.userAgent;
146
+ let url;
147
+ if (typeof ua === "string") {
148
+ if (ua.indexOf("Chrome/") > -1) {
149
+ url =
150
+ "https://chrome.google.com/webstore/detail/" +
151
+ "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
152
+ }
153
+ else if (ua.indexOf("Firefox/") > -1) {
154
+ url =
155
+ "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
156
+ }
157
+ }
158
+ if (win.document &&
159
+ win.top === win.self &&
160
+ /^(https?|file):$/.test(win.location.protocol) &&
161
+ url) {
147
162
  setTimeout(() => {
148
- if (!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
149
- const nav = window.navigator;
150
- const ua = nav && nav.userAgent;
151
- let url;
152
- if (typeof ua === "string") {
153
- if (ua.indexOf("Chrome/") > -1) {
154
- url =
155
- "https://chrome.google.com/webstore/detail/" +
156
- "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
157
- }
158
- else if (ua.indexOf("Firefox/") > -1) {
159
- url =
160
- "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
161
- }
162
- }
163
- if (url) {
164
- __DEV__ && invariant.log("Download the Apollo DevTools for a better development " +
165
- "experience: %s", url);
166
- }
163
+ if (!win.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
164
+ __DEV__ && invariant.log("Download the Apollo DevTools for a better development " +
165
+ "experience: %s", url);
167
166
  }
168
167
  }, 10000);
169
168
  }
@@ -261,12 +260,12 @@ export class ApolloClient {
261
260
  if (refetchOn) {
262
261
  const operationName = getOperationName(query, "(anonymous)");
263
262
  if (!refetchEventManager) {
264
- __DEV__ && invariant.warn(70, operationName);
263
+ __DEV__ && invariant.warn(71, operationName);
265
264
  }
266
265
  else if (typeof refetchOn === "object") {
267
266
  Object.keys(refetchOn).forEach((source) => {
268
267
  if (!refetchEventManager.hasSource(source)) {
269
- __DEV__ && invariant.warn(71, source, operationName);
268
+ __DEV__ && invariant.warn(72, source, operationName);
270
269
  }
271
270
  });
272
271
  }
@@ -288,13 +287,13 @@ export class ApolloClient {
288
287
  options = mergeOptions(this.defaultOptions.query, options);
289
288
  }
290
289
  if (__DEV__) {
291
- invariant(options.fetchPolicy !== "cache-and-network", 72);
292
- invariant(options.fetchPolicy !== "standby", 73);
293
- invariant(options.query, 74);
294
- invariant(options.query.kind === "Document", 75);
295
- invariant(!options.returnPartialData, 76);
296
- invariant(!options.pollInterval, 77);
297
- invariant(!options.notifyOnNetworkStatusChange, 78);
290
+ invariant(options.fetchPolicy !== "cache-and-network", 73);
291
+ invariant(options.fetchPolicy !== "standby", 74);
292
+ invariant(options.query, 75);
293
+ invariant(options.query.kind === "Document", 76);
294
+ invariant(!options.returnPartialData, 77);
295
+ invariant(!options.pollInterval, 78);
296
+ invariant(!options.notifyOnNetworkStatusChange, 79);
298
297
  }
299
298
  return this.queryManager.query(options);
300
299
  };
@@ -312,9 +311,9 @@ export class ApolloClient {
312
311
  errorPolicy: "none",
313
312
  }, this.defaultOptions.mutate), options);
314
313
  if (__DEV__) {
315
- invariant(optionsWithDefaults.mutation, 79);
314
+ invariant(optionsWithDefaults.mutation, 80);
316
315
  invariant(optionsWithDefaults.fetchPolicy === "network-only" ||
317
- optionsWithDefaults.fetchPolicy === "no-cache", 80);
316
+ optionsWithDefaults.fetchPolicy === "no-cache", 81);
318
317
  }
319
318
  checkDocument(optionsWithDefaults.mutation, OperationTypeNode.MUTATION);
320
319
  return this.queryManager.mutate(optionsWithDefaults);
@@ -337,7 +336,7 @@ export class ApolloClient {
337
336
  })));
338
337
  return Object.assign(mapped, { restart: observable.restart });
339
338
  }
340
- readQuery(options, optimistic = false) {
339
+ readQuery(options, optimistic = !!options.optimistic) {
341
340
  return this.cache.readQuery({ ...options, query: this.transform(options.query) }, optimistic);
342
341
  }
343
342
  watchFragment(options) {
@@ -362,7 +361,7 @@ export class ApolloClient {
362
361
  }
363
362
  return observable;
364
363
  }
365
- readFragment(options, optimistic = false) {
364
+ readFragment(options, optimistic = !!options.optimistic) {
366
365
  return this.cache.readFragment({ ...options, fragment: this.transform(options.fragment) }, optimistic);
367
366
  }
368
367
  /**
@@ -520,7 +519,7 @@ export class ApolloClient {
520
519
  // result.queries and result.results instead, you shouldn't have to worry
521
520
  // about preventing uncaught rejections for the Promise.all result.
522
521
  result.catch((error) => {
523
- __DEV__ && invariant.debug(81, error);
522
+ __DEV__ && invariant.debug(82, error);
524
523
  });
525
524
  return result;
526
525
  }