@apollo/client 4.0.0-alpha.21 → 4.0.0-alpha.23

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 (379) hide show
  1. package/CHANGELOG.md +341 -2
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  4. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  5. package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  6. package/__cjs/cache/inmemory/policies.cjs +4 -4
  7. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  8. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  9. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  10. package/__cjs/core/ApolloClient.cjs +24 -19
  11. package/__cjs/core/ApolloClient.cjs.map +1 -1
  12. package/__cjs/core/ApolloClient.d.cts +15 -11
  13. package/__cjs/core/ObservableQuery.cjs +52 -48
  14. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  15. package/__cjs/core/ObservableQuery.d.cts +48 -14
  16. package/__cjs/core/QueryInfo.cjs +146 -168
  17. package/__cjs/core/QueryInfo.cjs.map +1 -1
  18. package/__cjs/core/QueryInfo.d.cts +14 -11
  19. package/__cjs/core/QueryManager.cjs +138 -123
  20. package/__cjs/core/QueryManager.cjs.map +1 -1
  21. package/__cjs/core/QueryManager.d.cts +17 -6
  22. package/__cjs/core/index.cjs +2 -1
  23. package/__cjs/core/index.cjs.map +1 -1
  24. package/__cjs/core/index.d.cts +4 -4
  25. package/__cjs/core/types.d.cts +72 -18
  26. package/__cjs/core/watchQueryOptions.d.cts +2 -24
  27. package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
  28. package/__cjs/errors/CombinedGraphQLErrors.cjs +6 -3
  29. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  30. package/__cjs/errors/CombinedGraphQLErrors.d.cts +7 -2
  31. package/__cjs/errors/index.cjs +1 -1
  32. package/__cjs/errors/index.cjs.map +1 -1
  33. package/__cjs/errors/index.d.cts +1 -3
  34. package/__cjs/incremental/handlers/defer20220824.cjs +102 -0
  35. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -0
  36. package/__cjs/incremental/handlers/defer20220824.d.cts +55 -0
  37. package/__cjs/incremental/handlers/notImplemented.cjs +19 -0
  38. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -0
  39. package/__cjs/incremental/handlers/notImplemented.d.cts +9 -0
  40. package/__cjs/incremental/index.cjs +9 -0
  41. package/__cjs/incremental/index.cjs.map +1 -0
  42. package/__cjs/incremental/index.d.cts +4 -0
  43. package/__cjs/incremental/types.cjs +3 -0
  44. package/__cjs/incremental/types.cjs.map +1 -0
  45. package/__cjs/incremental/types.d.cts +24 -0
  46. package/__cjs/invariantErrorCodes.cjs +131 -114
  47. package/__cjs/link/batch-http/batchHttpLink.cjs +14 -14
  48. package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
  49. package/__cjs/link/batch-http/batchHttpLink.d.cts +4 -0
  50. package/__cjs/link/batch-http/index.cjs +2 -1
  51. package/__cjs/link/batch-http/index.cjs.map +1 -1
  52. package/__cjs/link/batch-http/index.d.cts +1 -1
  53. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +45 -0
  54. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -0
  55. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +62 -0
  56. package/__cjs/link/client-awareness/index.cjs +6 -0
  57. package/__cjs/link/client-awareness/index.cjs.map +1 -0
  58. package/__cjs/link/client-awareness/index.d.cts +2 -0
  59. package/__cjs/link/context/index.cjs +36 -25
  60. package/__cjs/link/context/index.cjs.map +1 -1
  61. package/__cjs/link/context/index.d.cts +8 -1
  62. package/__cjs/link/core/types.d.cts +5 -38
  63. package/__cjs/link/error/index.cjs +68 -65
  64. package/__cjs/link/error/index.cjs.map +1 -1
  65. package/__cjs/link/error/index.d.cts +15 -14
  66. package/__cjs/link/http/BaseHttpLink.cjs +111 -0
  67. package/__cjs/link/http/BaseHttpLink.cjs.map +1 -0
  68. package/__cjs/link/http/BaseHttpLink.d.cts +6 -0
  69. package/__cjs/link/http/HttpLink.cjs +12 -5
  70. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  71. package/__cjs/link/http/HttpLink.d.cts +20 -4
  72. package/__cjs/link/http/checkFetcher.cjs +1 -1
  73. package/__cjs/link/http/index.cjs +4 -3
  74. package/__cjs/link/http/index.cjs.map +1 -1
  75. package/__cjs/link/http/index.d.cts +2 -2
  76. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +45 -57
  77. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  78. package/__cjs/link/http/selectHttpOptionsAndBody.cjs +6 -5
  79. package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
  80. package/__cjs/link/index.cjs.map +1 -1
  81. package/__cjs/link/index.d.cts +1 -1
  82. package/__cjs/link/persisted-queries/index.cjs +159 -141
  83. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  84. package/__cjs/link/persisted-queries/index.d.cts +19 -19
  85. package/__cjs/link/remove-typename/index.cjs +2 -1
  86. package/__cjs/link/remove-typename/index.cjs.map +1 -1
  87. package/__cjs/link/remove-typename/index.d.cts +1 -1
  88. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +34 -23
  89. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  90. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +8 -9
  91. package/__cjs/link/utils/validateOperation.cjs +1 -1
  92. package/__cjs/local-state/LocalState.cjs +10 -18
  93. package/__cjs/local-state/LocalState.cjs.map +1 -1
  94. package/__cjs/local-state/LocalState.d.cts +3 -4
  95. package/__cjs/masking/maskDefinition.cjs +2 -2
  96. package/__cjs/masking/maskFragment.cjs +2 -2
  97. package/__cjs/masking/maskOperation.cjs +1 -1
  98. package/__cjs/masking/types.d.cts +6 -5
  99. package/__cjs/masking/utils.cjs +3 -3
  100. package/__cjs/react/context/ApolloConsumer.cjs +1 -1
  101. package/__cjs/react/context/ApolloContext.cjs +1 -1
  102. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  103. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  104. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  105. package/__cjs/react/hooks/useBackgroundQuery.cjs +1 -0
  106. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  107. package/__cjs/react/hooks/useFragment.cjs +1 -0
  108. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  109. package/__cjs/react/hooks/useLazyQuery.cjs +4 -4
  110. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  111. package/__cjs/react/hooks/useLazyQuery.d.cts +2 -7
  112. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  113. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  114. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  115. package/__cjs/react/hooks/useMutation.d.cts +2 -2
  116. package/__cjs/react/hooks/useQuery.cjs +23 -21
  117. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  118. package/__cjs/react/hooks/useQuery.d.cts +3 -8
  119. package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -0
  120. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  121. package/__cjs/react/hooks/useReadQuery.cjs +1 -0
  122. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  123. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  124. package/__cjs/react/hooks/useSuspenseFragment.cjs +1 -0
  125. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  126. package/__cjs/react/hooks/useSuspenseQuery.cjs +1 -0
  127. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  128. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  129. package/__cjs/react/internal/cache/QueryReference.cjs +5 -5
  130. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  131. package/__cjs/react/internal/cache/QueryReference.d.cts +2 -3
  132. package/__cjs/react/internal/types.d.cts +2 -7
  133. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  134. package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
  135. package/__cjs/utilities/caching/sizes.cjs.map +1 -1
  136. package/__cjs/utilities/caching/sizes.d.cts +6 -0
  137. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  138. package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +9 -0
  139. package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -0
  140. package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +3 -0
  141. package/__cjs/utilities/index.cjs +3 -1
  142. package/__cjs/utilities/index.cjs.map +1 -1
  143. package/__cjs/utilities/index.d.cts +1 -0
  144. package/__cjs/utilities/internal/checkDocument.cjs +47 -13
  145. package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
  146. package/__cjs/utilities/internal/checkDocument.d.cts +1 -1
  147. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  148. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
  149. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
  150. package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs +1 -12
  151. package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -1
  152. package/__cjs/utilities/internal/getGraphQLErrorsFromResult.d.cts +4 -2
  153. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  154. package/__cjs/utilities/internal/getMemoryInternals.cjs +1 -0
  155. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  156. package/__cjs/utilities/internal/getMemoryInternals.d.cts +0 -1
  157. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  158. package/__cjs/utilities/internal/graphQLResultHasError.cjs +1 -4
  159. package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -1
  160. package/__cjs/utilities/internal/graphQLResultHasError.d.cts +2 -2
  161. package/__cjs/utilities/internal/index.cjs +2 -10
  162. package/__cjs/utilities/internal/index.cjs.map +1 -1
  163. package/__cjs/utilities/internal/index.d.cts +0 -4
  164. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
  165. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  166. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  167. package/__cjs/version.cjs +3 -2
  168. package/__cjs/version.cjs.map +1 -1
  169. package/__cjs/version.d.cts +1 -0
  170. package/cache/core/cache.js +1 -1
  171. package/cache/inmemory/entityStore.js +3 -3
  172. package/cache/inmemory/key-extractor.js +1 -1
  173. package/cache/inmemory/key-extractor.js.map +1 -1
  174. package/cache/inmemory/policies.js +4 -4
  175. package/cache/inmemory/policies.js.map +1 -1
  176. package/cache/inmemory/readFromStore.js +2 -2
  177. package/cache/inmemory/writeToStore.js +4 -4
  178. package/core/ApolloClient.d.ts +15 -11
  179. package/core/ApolloClient.js +25 -20
  180. package/core/ApolloClient.js.map +1 -1
  181. package/core/ObservableQuery.d.ts +48 -14
  182. package/core/ObservableQuery.js +53 -49
  183. package/core/ObservableQuery.js.map +1 -1
  184. package/core/QueryInfo.d.ts +14 -11
  185. package/core/QueryInfo.js +147 -169
  186. package/core/QueryInfo.js.map +1 -1
  187. package/core/QueryManager.d.ts +17 -6
  188. package/core/QueryManager.js +140 -125
  189. package/core/QueryManager.js.map +1 -1
  190. package/core/index.d.ts +4 -4
  191. package/core/index.js +1 -1
  192. package/core/index.js.map +1 -1
  193. package/core/types.d.ts +72 -18
  194. package/core/watchQueryOptions.d.ts +2 -24
  195. package/dev/setErrorMessageHandler.js.map +1 -1
  196. package/errors/CombinedGraphQLErrors.d.ts +7 -2
  197. package/errors/CombinedGraphQLErrors.js +6 -3
  198. package/errors/CombinedGraphQLErrors.js.map +1 -1
  199. package/errors/index.d.ts +1 -3
  200. package/errors/index.js +1 -1
  201. package/errors/index.js.map +1 -1
  202. package/incremental/handlers/defer20220824.d.ts +55 -0
  203. package/incremental/handlers/defer20220824.js +97 -0
  204. package/incremental/handlers/defer20220824.js.map +1 -0
  205. package/incremental/handlers/notImplemented.d.ts +9 -0
  206. package/incremental/handlers/notImplemented.js +15 -0
  207. package/incremental/handlers/notImplemented.js.map +1 -0
  208. package/incremental/index.d.ts +4 -0
  209. package/incremental/index.js +3 -0
  210. package/incremental/index.js.map +1 -0
  211. package/incremental/types.d.ts +24 -0
  212. package/incremental/types.js +2 -0
  213. package/incremental/types.js.map +1 -0
  214. package/invariantErrorCodes.js +132 -118
  215. package/legacyEntryPoints/incremental/incremental.cjs +1 -0
  216. package/legacyEntryPoints/incremental/incremental.d.cts +1 -0
  217. package/legacyEntryPoints/incremental/index.d.ts +1 -0
  218. package/legacyEntryPoints/incremental/index.js +1 -0
  219. package/legacyEntryPoints/link/client-awareness/client-awareness.cjs +1 -0
  220. package/legacyEntryPoints/link/client-awareness/client-awareness.d.cts +1 -0
  221. package/legacyEntryPoints/link/client-awareness/index.d.ts +1 -0
  222. package/legacyEntryPoints/link/client-awareness/index.js +1 -0
  223. package/link/batch-http/batchHttpLink.d.ts +4 -0
  224. package/link/batch-http/batchHttpLink.js +11 -12
  225. package/link/batch-http/batchHttpLink.js.map +1 -1
  226. package/link/batch-http/index.d.ts +1 -1
  227. package/link/batch-http/index.js +1 -1
  228. package/link/batch-http/index.js.map +1 -1
  229. package/link/client-awareness/ClientAwarenessLink.d.ts +62 -0
  230. package/link/client-awareness/ClientAwarenessLink.js +41 -0
  231. package/link/client-awareness/ClientAwarenessLink.js.map +1 -0
  232. package/link/client-awareness/index.d.ts +2 -0
  233. package/link/client-awareness/index.js +2 -0
  234. package/link/client-awareness/index.js.map +1 -0
  235. package/link/context/index.d.ts +8 -1
  236. package/link/context/index.js +34 -25
  237. package/link/context/index.js.map +1 -1
  238. package/link/core/types.d.ts +5 -38
  239. package/link/error/index.d.ts +15 -14
  240. package/link/error/index.js +68 -65
  241. package/link/error/index.js.map +1 -1
  242. package/link/http/BaseHttpLink.d.ts +6 -0
  243. package/link/http/BaseHttpLink.js +107 -0
  244. package/link/http/BaseHttpLink.js.map +1 -0
  245. package/link/http/HttpLink.d.ts +20 -4
  246. package/link/http/HttpLink.js +10 -4
  247. package/link/http/HttpLink.js.map +1 -1
  248. package/link/http/checkFetcher.js +1 -1
  249. package/link/http/index.d.ts +2 -2
  250. package/link/http/index.js +2 -2
  251. package/link/http/index.js.map +1 -1
  252. package/link/http/parseAndCheckHttpResponse.js +45 -57
  253. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  254. package/link/http/selectHttpOptionsAndBody.js +6 -5
  255. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  256. package/link/index.d.ts +1 -1
  257. package/link/index.js.map +1 -1
  258. package/link/persisted-queries/index.d.ts +19 -19
  259. package/link/persisted-queries/index.js +157 -140
  260. package/link/persisted-queries/index.js.map +1 -1
  261. package/link/remove-typename/index.d.ts +1 -1
  262. package/link/remove-typename/index.js +1 -1
  263. package/link/remove-typename/index.js.map +1 -1
  264. package/link/remove-typename/removeTypenameFromVariables.d.ts +8 -9
  265. package/link/remove-typename/removeTypenameFromVariables.js +32 -22
  266. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  267. package/link/utils/validateOperation.js +1 -1
  268. package/local-state/LocalState.d.ts +3 -4
  269. package/local-state/LocalState.js +10 -18
  270. package/local-state/LocalState.js.map +1 -1
  271. package/masking/maskDefinition.js +2 -2
  272. package/masking/maskFragment.js +2 -2
  273. package/masking/maskOperation.js +1 -1
  274. package/masking/types.d.ts +6 -5
  275. package/masking/utils.js +3 -3
  276. package/package.json +15 -2
  277. package/react/context/ApolloConsumer.js +1 -1
  278. package/react/context/ApolloContext.js +1 -1
  279. package/react/context/ApolloProvider.js +1 -1
  280. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  281. package/react/hooks/useApolloClient.js +15 -2
  282. package/react/hooks/useApolloClient.js.map +1 -1
  283. package/react/hooks/useBackgroundQuery.js +7 -6
  284. package/react/hooks/useBackgroundQuery.js.map +1 -1
  285. package/react/hooks/useFragment.js +12 -11
  286. package/react/hooks/useFragment.js.map +1 -1
  287. package/react/hooks/useLazyQuery.d.ts +2 -7
  288. package/react/hooks/useLazyQuery.js +17 -17
  289. package/react/hooks/useLazyQuery.js.map +1 -1
  290. package/react/hooks/useLoadableQuery.js +229 -69
  291. package/react/hooks/useLoadableQuery.js.map +1 -1
  292. package/react/hooks/useMutation.d.ts +2 -2
  293. package/react/hooks/useMutation.js +191 -81
  294. package/react/hooks/useMutation.js.map +1 -1
  295. package/react/hooks/useQuery.d.ts +3 -8
  296. package/react/hooks/useQuery.js +243 -70
  297. package/react/hooks/useQuery.js.map +1 -1
  298. package/react/hooks/useQueryRefHandlers.js +64 -23
  299. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  300. package/react/hooks/useReadQuery.js +3 -2
  301. package/react/hooks/useReadQuery.js.map +1 -1
  302. package/react/hooks/useSubscription.js +5 -5
  303. package/react/hooks/useSubscription.js.map +1 -1
  304. package/react/hooks/useSuspenseFragment.js +1 -0
  305. package/react/hooks/useSuspenseFragment.js.map +1 -1
  306. package/react/hooks/useSuspenseQuery.js +59 -33
  307. package/react/hooks/useSuspenseQuery.js.map +1 -1
  308. package/react/hooks/useSyncExternalStore.js +1 -1
  309. package/react/internal/cache/QueryReference.d.ts +2 -3
  310. package/react/internal/cache/QueryReference.js +5 -5
  311. package/react/internal/cache/QueryReference.js.map +1 -1
  312. package/react/internal/types.d.ts +2 -7
  313. package/react/ssr/prerenderStatic.js +2 -2
  314. package/testing/core/mocking/mockLink.js +4 -4
  315. package/utilities/caching/sizes.d.ts +6 -0
  316. package/utilities/caching/sizes.js.map +1 -1
  317. package/utilities/graphql/DocumentTransform.js +1 -1
  318. package/utilities/graphql/isFormattedExecutionResult.d.ts +3 -0
  319. package/utilities/graphql/isFormattedExecutionResult.js +6 -0
  320. package/utilities/graphql/isFormattedExecutionResult.js.map +1 -0
  321. package/utilities/index.d.ts +1 -0
  322. package/utilities/index.js +1 -0
  323. package/utilities/index.js.map +1 -1
  324. package/utilities/internal/checkDocument.d.ts +1 -1
  325. package/utilities/internal/checkDocument.js +46 -12
  326. package/utilities/internal/checkDocument.js.map +1 -1
  327. package/utilities/internal/getFragmentDefinition.js +3 -3
  328. package/utilities/internal/getFragmentFromSelection.js +1 -1
  329. package/utilities/internal/getFragmentQueryDocument.js +2 -2
  330. package/utilities/internal/getGraphQLErrorsFromResult.d.ts +4 -2
  331. package/utilities/internal/getGraphQLErrorsFromResult.js +1 -12
  332. package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -1
  333. package/utilities/internal/getMainDefinition.js +1 -1
  334. package/utilities/internal/getMemoryInternals.d.ts +0 -1
  335. package/utilities/internal/getMemoryInternals.js +1 -0
  336. package/utilities/internal/getMemoryInternals.js.map +1 -1
  337. package/utilities/internal/getQueryDefinition.js +1 -1
  338. package/utilities/internal/graphQLResultHasError.d.ts +2 -2
  339. package/utilities/internal/graphQLResultHasError.js +1 -4
  340. package/utilities/internal/graphQLResultHasError.js.map +1 -1
  341. package/utilities/internal/index.d.ts +0 -4
  342. package/utilities/internal/index.js +0 -4
  343. package/utilities/internal/index.js.map +1 -1
  344. package/utilities/internal/removeDirectivesFromDocument.js +1 -1
  345. package/utilities/internal/shouldInclude.js +4 -4
  346. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  347. package/version.d.ts +1 -0
  348. package/version.js +2 -1
  349. package/version.js.map +1 -1
  350. package/__cjs/link/http/createHttpLink.cjs +0 -151
  351. package/__cjs/link/http/createHttpLink.cjs.map +0 -1
  352. package/__cjs/link/http/createHttpLink.d.cts +0 -4
  353. package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs +0 -12
  354. package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs.map +0 -1
  355. package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.d.cts +0 -8
  356. package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs +0 -12
  357. package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs.map +0 -1
  358. package/__cjs/utilities/internal/isExecutionPatchIninitialResult.d.cts +0 -8
  359. package/__cjs/utilities/internal/isExecutionPatchResult.cjs +0 -15
  360. package/__cjs/utilities/internal/isExecutionPatchResult.cjs.map +0 -1
  361. package/__cjs/utilities/internal/isExecutionPatchResult.d.cts +0 -8
  362. package/__cjs/utilities/internal/mergeIncrementalData.cjs +0 -30
  363. package/__cjs/utilities/internal/mergeIncrementalData.cjs.map +0 -1
  364. package/__cjs/utilities/internal/mergeIncrementalData.d.cts +0 -8
  365. package/link/http/createHttpLink.d.ts +0 -4
  366. package/link/http/createHttpLink.js +0 -143
  367. package/link/http/createHttpLink.js.map +0 -1
  368. package/utilities/internal/isExecutionPatchIncrementalResult.d.ts +0 -8
  369. package/utilities/internal/isExecutionPatchIncrementalResult.js +0 -9
  370. package/utilities/internal/isExecutionPatchIncrementalResult.js.map +0 -1
  371. package/utilities/internal/isExecutionPatchIninitialResult.d.ts +0 -8
  372. package/utilities/internal/isExecutionPatchIninitialResult.js +0 -9
  373. package/utilities/internal/isExecutionPatchIninitialResult.js.map +0 -1
  374. package/utilities/internal/isExecutionPatchResult.d.ts +0 -8
  375. package/utilities/internal/isExecutionPatchResult.js +0 -12
  376. package/utilities/internal/isExecutionPatchResult.js.map +0 -1
  377. package/utilities/internal/mergeIncrementalData.d.ts +0 -8
  378. package/utilities/internal/mergeIncrementalData.js +0 -27
  379. package/utilities/internal/mergeIncrementalData.js.map +0 -1
@@ -24,14 +24,18 @@ const QueryInfo_js_1 = require("./QueryInfo.cjs");
24
24
  class QueryManager {
25
25
  defaultOptions;
26
26
  client;
27
+ /**
28
+ * The options that were passed to the ApolloClient constructor.
29
+ */
30
+ clientOptions;
27
31
  assumeImmutableResults;
28
32
  documentTransform;
29
33
  ssrMode;
30
34
  defaultContext;
31
35
  dataMasking;
36
+ incrementalHandler;
32
37
  localState;
33
38
  queryDeduplication;
34
- clientAwareness = {};
35
39
  /**
36
40
  * Whether to prioritize cache values over network results when
37
41
  * `fetchObservableWithInfo` is called.
@@ -61,11 +65,12 @@ class QueryManager {
61
65
  this.client = options.client;
62
66
  this.defaultOptions = options.defaultOptions;
63
67
  this.queryDeduplication = options.queryDeduplication;
64
- this.clientAwareness = options.clientAwareness;
68
+ this.clientOptions = options.clientOptions;
65
69
  this.ssrMode = options.ssrMode;
66
70
  this.assumeImmutableResults = options.assumeImmutableResults;
67
71
  this.dataMasking = options.dataMasking;
68
72
  this.localState = options.localState;
73
+ this.incrementalHandler = options.incrementalHandler;
69
74
  const documentTransform = options.documentTransform;
70
75
  this.documentTransform =
71
76
  documentTransform ?
@@ -94,16 +99,13 @@ class QueryManager {
94
99
  */
95
100
  stop() {
96
101
  this.obsQueries.forEach((oq) => oq.stop());
97
- this.cancelPendingFetches((0, invariant_1.newInvariantError)(81));
102
+ this.cancelPendingFetches((0, invariant_1.newInvariantError)(85));
98
103
  }
99
104
  cancelPendingFetches(error) {
100
105
  this.fetchCancelFns.forEach((cancel) => cancel(error));
101
106
  this.fetchCancelFns.clear();
102
107
  }
103
- async mutate({ mutation, variables, optimisticResponse, updateQueries, refetchQueries = [], awaitRefetchQueries = false, update: updateWithProxyFn, onQueryUpdated, fetchPolicy = this.defaultOptions.mutate?.fetchPolicy || "network-only", errorPolicy = this.defaultOptions.mutate?.errorPolicy || "none", keepRootFields, context, }) {
104
- (0, invariant_1.invariant)(mutation, 82);
105
- (0, internal_1.checkDocument)(mutation, graphql_1.OperationTypeNode.MUTATION);
106
- (0, invariant_1.invariant)(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 83);
108
+ async mutate({ mutation, variables, optimisticResponse, updateQueries, refetchQueries = [], awaitRefetchQueries = false, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }) {
107
109
  const queryInfo = new QueryInfo_js_1.QueryInfo(this);
108
110
  mutation = this.cache.transformForLink(this.transform(mutation));
109
111
  const { hasClientExports } = this.getDocumentInfo(mutation);
@@ -112,7 +114,7 @@ class QueryManager {
112
114
  if (environment_1.__DEV__) {
113
115
  (0, invariant_1.invariant)(
114
116
  this.localState,
115
- 84,
117
+ 86,
116
118
  (0, internal_1.getOperationName)(mutation, "(anonymous)")
117
119
  );
118
120
  }
@@ -151,21 +153,7 @@ class QueryManager {
151
153
  optimisticResponse: isOptimistic ? optimisticResponse : void 0,
152
154
  }, variables, {}, false)
153
155
  .observable.pipe(validateDidEmitValue(), (0, rxjs_2.mergeMap)((result) => {
154
- const hasErrors = (0, internal_1.graphQLResultHasError)(result);
155
- if (hasErrors && errorPolicy === "none") {
156
- throw new errors_1.CombinedGraphQLErrors(result);
157
- }
158
- if (mutationStoreValue) {
159
- mutationStoreValue.loading = false;
160
- mutationStoreValue.error = null;
161
- }
162
156
  const storeResult = { ...result };
163
- if (typeof refetchQueries === "function") {
164
- refetchQueries = refetchQueries(storeResult);
165
- }
166
- if (errorPolicy === "ignore" && hasErrors) {
167
- delete storeResult.errors;
168
- }
169
157
  return (0, rxjs_2.from)(queryInfo.markMutationResult(storeResult, {
170
158
  document: mutation,
171
159
  variables,
@@ -182,6 +170,17 @@ class QueryManager {
182
170
  onQueryUpdated,
183
171
  keepRootFields,
184
172
  }));
173
+ }))
174
+ .pipe((0, rxjs_2.map)((storeResult) => {
175
+ const hasErrors = (0, internal_1.graphQLResultHasError)(storeResult);
176
+ if (hasErrors && errorPolicy === "none") {
177
+ throw new errors_1.CombinedGraphQLErrors(storeResult);
178
+ }
179
+ if (mutationStoreValue) {
180
+ mutationStoreValue.loading = false;
181
+ mutationStoreValue.error = null;
182
+ }
183
+ return storeResult;
185
184
  }))
186
185
  .subscribe({
187
186
  next: (storeResult) => {
@@ -191,7 +190,7 @@ class QueryManager {
191
190
  // we resolve with a SingleExecutionResult or after the final
192
191
  // ExecutionPatchResult has arrived and we have assembled the
193
192
  // multipart response into a single result.
194
- if (!("hasNext" in storeResult) || storeResult.hasNext === false) {
193
+ if (!queryInfo.hasNext) {
195
194
  const result = {
196
195
  data: this.maskOperation({
197
196
  document: mutation,
@@ -203,7 +202,7 @@ class QueryManager {
203
202
  if ((0, internal_1.graphQLResultHasError)(storeResult)) {
204
203
  result.error = new errors_1.CombinedGraphQLErrors(storeResult);
205
204
  }
206
- if (storeResult.extensions) {
205
+ if (Object.keys(storeResult.extensions || {}).length) {
207
206
  result.extensions = storeResult.extensions;
208
207
  }
209
208
  resolve(result);
@@ -230,7 +229,10 @@ class QueryManager {
230
229
  });
231
230
  }
232
231
  fetchQuery(options, networkStatus) {
233
- return (0, rxjs_2.lastValueFrom)(this.fetchObservableWithInfo(options, {
232
+ (0, internal_1.checkDocument)(options.query, graphql_1.OperationTypeNode.QUERY);
233
+ // do the rest asynchronously to keep the same rejection timing as
234
+ // checks further in `.mutate`
235
+ return (async () => (0, rxjs_2.lastValueFrom)(this.fetchObservableWithInfo(options, {
234
236
  networkStatus,
235
237
  }).observable.pipe((0, internal_1.filterMap)((value) => {
236
238
  switch (value.kind) {
@@ -245,7 +247,7 @@ class QueryManager {
245
247
  // This default is needed when a `standby` fetch policy is used to avoid
246
248
  // an EmptyError from rejecting this promise.
247
249
  defaultValue: { data: undefined },
248
- });
250
+ }))();
249
251
  }
250
252
  transform(document) {
251
253
  return this.documentTransform.transformDocument(document);
@@ -265,6 +267,7 @@ class QueryManager {
265
267
  hasClientExports: (0, internal_1.hasDirectives)(["client", "export"], document, true),
266
268
  hasForcedResolvers: (0, internal_1.hasForcedResolvers)(document),
267
269
  hasNonreactiveDirective: (0, internal_1.hasDirectives)(["nonreactive"], document),
270
+ hasIncrementalDirective: (0, internal_1.hasDirectives)(["defer"], document),
268
271
  nonReactiveQuery: addNonReactiveToNamedFragments(document),
269
272
  clientQuery: (0, internal_1.hasDirectives)(["client"], document) ? document : null,
270
273
  serverQuery: (0, internal_1.removeDirectivesFromDocument)([
@@ -290,7 +293,11 @@ class QueryManager {
290
293
  };
291
294
  transformCache.set(document, cacheEntry);
292
295
  }
293
- return transformCache.get(document);
296
+ const entry = transformCache.get(document);
297
+ if (entry.violation) {
298
+ throw entry.violation;
299
+ }
300
+ return entry;
294
301
  }
295
302
  getVariables(document, variables) {
296
303
  const defaultVars = this.getDocumentInfo(document).defaultVars;
@@ -320,7 +327,7 @@ class QueryManager {
320
327
  });
321
328
  return observable;
322
329
  }
323
- async query(options) {
330
+ query(options) {
324
331
  const query = this.transform(options.query);
325
332
  return this.fetchQuery({
326
333
  ...options,
@@ -346,7 +353,7 @@ class QueryManager {
346
353
  // depend on values that previously existed in the data portion of the
347
354
  // store. So, we cancel the promises and observers that we have issued
348
355
  // so far and not yet resolved (in the case of queries).
349
- this.cancelPendingFetches((0, invariant_1.newInvariantError)(85));
356
+ this.cancelPendingFetches((0, invariant_1.newInvariantError)(87));
350
357
  this.obsQueries.forEach((observableQuery) => {
351
358
  // Set loading to true so listeners don't trigger unless they want
352
359
  // results with partial data.
@@ -416,10 +423,10 @@ class QueryManager {
416
423
  if (!included) {
417
424
  const queryName = queryNames.get(nameOrQueryString);
418
425
  if (queryName) {
419
- __DEV__ && invariant_1.invariant.warn(86, queryName);
426
+ __DEV__ && invariant_1.invariant.warn(88, queryName);
420
427
  }
421
428
  else {
422
- __DEV__ && invariant_1.invariant.warn(87);
429
+ __DEV__ && invariant_1.invariant.warn(89);
423
430
  }
424
431
  }
425
432
  });
@@ -430,8 +437,8 @@ class QueryManager {
430
437
  const observableQueryPromises = [];
431
438
  this.getObservableQueries(includeStandby ? "all" : "active").forEach((observableQuery) => {
432
439
  const { fetchPolicy } = observableQuery.options;
433
- if (includeStandby ||
434
- (fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
440
+ if ((includeStandby || fetchPolicy !== "standby") &&
441
+ fetchPolicy !== "cache-only") {
435
442
  observableQueryPromises.push(observableQuery.refetch());
436
443
  }
437
444
  });
@@ -448,7 +455,7 @@ class QueryManager {
448
455
  if (environment_1.__DEV__) {
449
456
  (0, invariant_1.invariant)(
450
457
  !this.getDocumentInfo(query).hasClientExports || this.localState,
451
- 88,
458
+ 90,
452
459
  (0, internal_1.getOperationName)(query, "(anonymous)")
453
460
  );
454
461
  }
@@ -516,82 +523,92 @@ class QueryManager {
516
523
  deduplication = context?.queryDeduplication ??
517
524
  this.queryDeduplication) {
518
525
  let entry = {};
519
- const { serverQuery, clientQuery, operationType } = this.getDocumentInfo(query);
526
+ const { serverQuery, clientQuery, operationType, hasIncrementalDirective } = this.getDocumentInfo(query);
520
527
  const operationName = (0, internal_1.getOperationName)(query);
521
528
  const executeContext = {
522
529
  client: this.client,
523
530
  };
524
531
  if (serverQuery) {
525
532
  const { inFlightLinkObservables, link } = this;
526
- const operation = {
527
- query: serverQuery,
528
- variables,
529
- operationName,
530
- context: {
531
- ...this.defaultContext,
532
- ...context,
533
- queryDeduplication: deduplication,
534
- clientAwareness: this.clientAwareness,
535
- },
536
- extensions,
537
- };
538
- context = operation.context;
539
- function withRestart(source) {
540
- return new rxjs_1.Observable((observer) => {
541
- function subscribe() {
542
- return source.subscribe({
543
- next: observer.next.bind(observer),
544
- complete: observer.complete.bind(observer),
545
- error: observer.error.bind(observer),
546
- });
547
- }
548
- let subscription = subscribe();
549
- entry.restart ||= () => {
550
- subscription.unsubscribe();
551
- subscription = subscribe();
552
- };
553
- return () => {
554
- subscription.unsubscribe();
555
- entry.restart = undefined;
556
- };
533
+ try {
534
+ const operation = this.incrementalHandler.prepareRequest({
535
+ query: serverQuery,
536
+ variables,
537
+ operationName,
538
+ context: {
539
+ ...this.defaultContext,
540
+ ...context,
541
+ queryDeduplication: deduplication,
542
+ },
543
+ extensions,
557
544
  });
558
- }
559
- if (deduplication) {
560
- const printedServerQuery = (0, utilities_1.print)(serverQuery);
561
- const varJson = (0, cache_1.canonicalStringify)(variables);
562
- entry = inFlightLinkObservables.lookup(printedServerQuery, varJson);
563
- if (!entry.observable) {
564
- entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart, (0, rxjs_2.finalize)(() => {
565
- if (inFlightLinkObservables.peek(printedServerQuery, varJson) ===
566
- entry) {
567
- inFlightLinkObservables.remove(printedServerQuery, varJson);
545
+ context = operation.context;
546
+ function withRestart(source) {
547
+ return new rxjs_1.Observable((observer) => {
548
+ function subscribe() {
549
+ return source.subscribe({
550
+ next: observer.next.bind(observer),
551
+ complete: observer.complete.bind(observer),
552
+ error: observer.error.bind(observer),
553
+ });
568
554
  }
569
- }),
570
- // We don't want to replay the last emitted value for
571
- // subscriptions and instead opt to wait to receive updates until
572
- // the subscription emits new values.
573
- operationType === graphql_1.OperationTypeNode.SUBSCRIPTION ?
574
- (0, rxjs_2.share)()
575
- : (0, rxjs_2.shareReplay)({ refCount: true }));
555
+ let subscription = subscribe();
556
+ entry.restart ||= () => {
557
+ subscription.unsubscribe();
558
+ subscription = subscribe();
559
+ };
560
+ return () => {
561
+ subscription.unsubscribe();
562
+ entry.restart = undefined;
563
+ };
564
+ });
565
+ }
566
+ if (deduplication) {
567
+ const printedServerQuery = (0, utilities_1.print)(serverQuery);
568
+ const varJson = (0, cache_1.canonicalStringify)(variables);
569
+ entry = inFlightLinkObservables.lookup(printedServerQuery, varJson);
570
+ if (!entry.observable) {
571
+ entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart, (0, rxjs_2.finalize)(() => {
572
+ if (inFlightLinkObservables.peek(printedServerQuery, varJson) ===
573
+ entry) {
574
+ inFlightLinkObservables.remove(printedServerQuery, varJson);
575
+ }
576
+ }),
577
+ // We don't want to replay the last emitted value for
578
+ // subscriptions and instead opt to wait to receive updates until
579
+ // the subscription emits new values.
580
+ operationType === graphql_1.OperationTypeNode.SUBSCRIPTION ?
581
+ (0, rxjs_2.share)()
582
+ : (0, rxjs_2.shareReplay)({ refCount: true }));
583
+ }
584
+ }
585
+ else {
586
+ entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart);
576
587
  }
577
588
  }
578
- else {
579
- entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart);
589
+ catch (error) {
590
+ entry.observable = (0, rxjs_1.throwError)(() => error);
580
591
  }
581
592
  }
582
593
  else {
583
594
  entry.observable = (0, rxjs_2.of)({ data: {} });
584
595
  }
585
596
  if (clientQuery) {
597
+ const { operation } = (0, internal_1.getOperationDefinition)(query);
586
598
  if (environment_1.__DEV__) {
587
- const { operation } = (0, internal_1.getOperationDefinition)(query);
588
599
  (0, invariant_1.invariant)(
589
600
  this.localState,
590
- 89,
601
+ 91,
591
602
  operation[0].toUpperCase() + operation.slice(1),
592
603
  operationName ?? "(anonymous)"
593
604
  );
594
605
  }
606
+ (0, invariant_1.invariant)(
607
+ !hasIncrementalDirective,
608
+ 92,
609
+ operation[0].toUpperCase() + operation.slice(1),
610
+ operationName ?? "(anonymous)"
611
+ );
595
612
  entry.observable = entry.observable.pipe((0, rxjs_2.mergeMap)((result) => {
596
613
  return (0, rxjs_2.from)(this.localState.execute({
597
614
  client: this.client,
@@ -618,30 +635,24 @@ class QueryManager {
618
635
  // missing fragment definitions (for example) before sending this document
619
636
  // through the link chain.
620
637
  const linkDocument = this.cache.transformForLink(options.query);
621
- return this.getObservableFromLink(linkDocument, options.context, options.variables).observable.pipe((0, rxjs_2.map)((result) => {
622
- const graphQLErrors = (0, internal_1.getGraphQLErrorsFromResult)(result);
623
- const hasErrors = graphQLErrors.length > 0;
624
- // If we interrupted this request by calling getResultsFromLink again
625
- // with the same QueryInfo object, we ignore the old results.
626
- if (requestId >= queryInfo.lastRequestId) {
627
- if (hasErrors && errorPolicy === "none") {
628
- queryInfo.resetLastWrite();
629
- observableQuery?.["resetNotifications"]();
630
- // Throwing here effectively calls observer.error.
631
- throw new errors_1.CombinedGraphQLErrors(result);
632
- }
633
- // Use linkDocument rather than queryInfo.document so the
634
- // operation/fragments used to write the result are the same as the
635
- // ones used to obtain it from the link.
636
- queryInfo.markQueryResult(result, {
637
- ...options,
638
- document: linkDocument,
639
- cacheWriteBehavior,
640
- });
638
+ return this.getObservableFromLink(linkDocument, options.context, options.variables).observable.pipe((0, rxjs_2.map)((incoming) => {
639
+ // Use linkDocument rather than queryInfo.document so the
640
+ // operation/fragments used to write the result are the same as the
641
+ // ones used to obtain it from the link.
642
+ const result = queryInfo.markQueryResult(incoming, {
643
+ ...options,
644
+ document: linkDocument,
645
+ cacheWriteBehavior,
646
+ });
647
+ const hasErrors = (0, internal_1.graphQLResultHasError)(result);
648
+ if (hasErrors && errorPolicy === "none") {
649
+ queryInfo.resetLastWrite();
650
+ observableQuery?.["resetNotifications"]();
651
+ throw new errors_1.CombinedGraphQLErrors(result);
641
652
  }
642
653
  const aqr = {
643
654
  data: result.data,
644
- ...((0, internal_1.isExecutionPatchResult)(result) && result.hasNext ?
655
+ ...(queryInfo.hasNext ?
645
656
  {
646
657
  loading: true,
647
658
  networkStatus: networkStatus_js_1.NetworkStatus.streaming,
@@ -659,15 +670,16 @@ class QueryManager {
659
670
  // want to ensure we properly set `data` if we're reporting on an old
660
671
  // result which will not be caught by the conditional above that ends up
661
672
  // throwing the markError result.
662
- if (hasErrors && errorPolicy === "none") {
663
- aqr.data = void 0;
664
- aqr.dataState = "empty";
665
- }
666
- if (hasErrors && errorPolicy !== "ignore") {
667
- aqr.error = new errors_1.CombinedGraphQLErrors(result);
668
- aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
669
- if (aqr.data) {
670
- aqr.dataState = "complete";
673
+ if (hasErrors) {
674
+ if (errorPolicy === "none") {
675
+ aqr.data = void 0;
676
+ aqr.dataState = "empty";
677
+ }
678
+ if (errorPolicy !== "ignore") {
679
+ aqr.error = new errors_1.CombinedGraphQLErrors(result);
680
+ if (aqr.dataState !== "streaming") {
681
+ aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
682
+ }
671
683
  }
672
684
  }
673
685
  return aqr;
@@ -762,7 +774,7 @@ class QueryManager {
762
774
  if (environment_1.__DEV__) {
763
775
  (0, invariant_1.invariant)(
764
776
  this.localState,
765
- 90,
777
+ 93,
766
778
  (0, internal_1.getOperationName)(normalized.query, "(anonymous)")
767
779
  );
768
780
  }
@@ -799,6 +811,9 @@ class QueryManager {
799
811
  const includedQueriesByOq = new Map();
800
812
  if (include) {
801
813
  this.getObservableQueries(include).forEach((oq) => {
814
+ if (oq.options.fetchPolicy === "cache-only") {
815
+ return;
816
+ }
802
817
  const current = oq.getCurrentResult();
803
818
  includedQueriesByOq.set(oq, {
804
819
  oq,
@@ -878,7 +893,8 @@ class QueryManager {
878
893
  // onQueryUpdated returns false.
879
894
  return result;
880
895
  }
881
- if (onQueryUpdated !== null) {
896
+ if (onQueryUpdated !== null &&
897
+ oq.options.fetchPolicy !== "cache-only") {
882
898
  // If we don't have an onQueryUpdated function, and onQueryUpdated
883
899
  // was not disabled by passing null, make sure this query is
884
900
  // "included" like any other options.include-specified query.
@@ -934,7 +950,7 @@ class QueryManager {
934
950
  !this.noCacheWarningsByCause.has(cause)) {
935
951
  this.noCacheWarningsByCause.add(cause);
936
952
  __DEV__ && invariant_1.invariant.warn(
937
- 91,
953
+ 94,
938
954
  (0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
939
955
  );
940
956
  }
@@ -996,7 +1012,7 @@ class QueryManager {
996
1012
  if (environment_1.__DEV__) {
997
1013
  (0, invariant_1.invariant)(
998
1014
  this.localState,
999
- 92,
1015
+ 95,
1000
1016
  (0, internal_1.getOperationName)(query, "(anonymous)")
1001
1017
  );
1002
1018
  }
@@ -1090,7 +1106,7 @@ function validateDidEmitValue() {
1090
1106
  didEmitValue = true;
1091
1107
  },
1092
1108
  complete() {
1093
- (0, invariant_1.invariant)(didEmitValue, 93);
1109
+ (0, invariant_1.invariant)(didEmitValue, 96);
1094
1110
  },
1095
1111
  });
1096
1112
  }
@@ -1109,7 +1125,6 @@ function isFullyUnmaskedOperation(document) {
1109
1125
  return isUnmasked;
1110
1126
  }
1111
1127
  function addNonReactiveToNamedFragments(document) {
1112
- (0, internal_1.checkDocument)(document);
1113
1128
  return (0, graphql_1.visit)(document, {
1114
1129
  FragmentSpread: (node) => {
1115
1130
  // Do not add `@nonreactive` if the fragment is marked with `@unmask`