@apollo/client 4.3.8 → 4.4.0-alpha.1

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 (324) hide show
  1. package/CHANGELOG.md +76 -3
  2. package/__cjs/cache/core/cache.cjs +50 -15
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +22 -4
  5. package/__cjs/cache/index.cjs.map +1 -1
  6. package/__cjs/cache/index.d.cts +1 -1
  7. package/__cjs/cache/inmemory/entityStore.cjs +4 -4
  8. package/__cjs/cache/inmemory/helpers.cjs +12 -0
  9. package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
  10. package/__cjs/cache/inmemory/helpers.d.cts +10 -5
  11. package/__cjs/cache/inmemory/inMemoryCache.cjs +13 -2
  12. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  13. package/__cjs/cache/inmemory/inMemoryCache.d.cts +19 -4
  14. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  15. package/__cjs/cache/inmemory/policies.cjs +9 -9
  16. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  17. package/__cjs/cache/inmemory/policies.d.cts +1 -1
  18. package/__cjs/cache/inmemory/readFromStore.cjs +112 -19
  19. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  20. package/__cjs/cache/inmemory/types.d.cts +12 -1
  21. package/__cjs/cache/inmemory/writeToStore.cjs +53 -23
  22. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  23. package/__cjs/cache/inmemory/writeToStore.d.cts +8 -4
  24. package/__cjs/core/ApolloClient.cjs +19 -15
  25. package/__cjs/core/ApolloClient.cjs.map +1 -1
  26. package/__cjs/core/ApolloClient.d.cts +1 -0
  27. package/__cjs/core/ObservableQuery.cjs +8 -8
  28. package/__cjs/core/QueryInfo.cjs +1 -1
  29. package/__cjs/core/QueryManager.cjs +12 -12
  30. package/__cjs/core/RefetchEventManager.cjs +3 -3
  31. package/__cjs/errors/CombinedGraphQLErrors.cjs +3 -7
  32. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  33. package/__cjs/errors/CombinedGraphQLErrors.d.cts +2 -2
  34. package/__cjs/errors/CombinedProtocolErrors.cjs +3 -8
  35. package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
  36. package/__cjs/errors/CombinedProtocolErrors.d.cts +2 -2
  37. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +2 -2
  38. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  39. package/__cjs/invariantErrorCodes.cjs +125 -120
  40. package/__cjs/link/batch-http/BaseBatchHttpLink.cjs +9 -18
  41. package/__cjs/link/batch-http/BaseBatchHttpLink.cjs.map +1 -1
  42. package/__cjs/link/batch-http/BaseBatchHttpLink.d.cts +0 -7
  43. package/__cjs/link/core/ApolloLink.cjs +3 -3
  44. package/__cjs/link/http/checkFetcher.cjs +1 -1
  45. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  46. package/__cjs/link/persisted-queries/index.cjs +2 -2
  47. package/__cjs/link/ws/index.cjs +1 -1
  48. package/__cjs/local-state/LocalState.cjs +28 -16
  49. package/__cjs/local-state/LocalState.cjs.map +1 -1
  50. package/__cjs/masking/maskDefinition.cjs +20 -2
  51. package/__cjs/masking/maskDefinition.cjs.map +1 -1
  52. package/__cjs/masking/maskFragment.cjs +2 -2
  53. package/__cjs/masking/maskOperation.cjs +1 -1
  54. package/__cjs/masking/utils.cjs +3 -3
  55. package/__cjs/react/context/ApolloContext.cjs +1 -1
  56. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  57. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  58. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  59. package/__cjs/react/hooks/useFragment.cjs +8 -2
  60. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  61. package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
  62. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  63. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  64. package/__cjs/react/hooks/useSuspenseFragment.cjs +10 -4
  65. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  66. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  67. package/__cjs/react/internal/cache/FragmentReference.cjs +2 -2
  68. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  69. package/__cjs/react/internal/cache/FragmentReference.d.cts +4 -5
  70. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  71. package/__cjs/react/internal/cache/SuspenseCache.cjs +3 -3
  72. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  73. package/__cjs/react/internal/cache/SuspenseCache.d.cts +4 -5
  74. package/__cjs/react/internal/cache/types.d.cts +0 -5
  75. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  76. package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
  77. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  78. package/__cjs/utilities/internal/DeepMerger.cjs +6 -2
  79. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  80. package/__cjs/utilities/internal/DeepMerger.d.cts +13 -3
  81. package/__cjs/utilities/internal/argumentsObjectFromField.cjs.map +1 -1
  82. package/__cjs/utilities/internal/argumentsObjectFromField.d.cts +2 -2
  83. package/__cjs/utilities/internal/constants.cjs +33 -1
  84. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  85. package/__cjs/utilities/internal/constants.d.cts +32 -0
  86. package/__cjs/utilities/internal/createArgumentNode.cjs +14 -0
  87. package/__cjs/utilities/internal/createArgumentNode.cjs.map +1 -0
  88. package/__cjs/utilities/internal/createArgumentNode.d.cts +3 -0
  89. package/__cjs/utilities/internal/createDirectiveNode.cjs +14 -0
  90. package/__cjs/utilities/internal/createDirectiveNode.cjs.map +1 -0
  91. package/__cjs/utilities/internal/createDirectiveNode.d.cts +3 -0
  92. package/__cjs/utilities/internal/createFragmentArgumentNode.cjs +13 -0
  93. package/__cjs/utilities/internal/createFragmentArgumentNode.cjs.map +1 -0
  94. package/__cjs/utilities/internal/createFragmentArgumentNode.d.cts +3 -0
  95. package/__cjs/utilities/internal/createFragmentSpreadNode.cjs +20 -0
  96. package/__cjs/utilities/internal/createFragmentSpreadNode.cjs.map +1 -0
  97. package/__cjs/utilities/internal/createFragmentSpreadNode.d.cts +6 -0
  98. package/__cjs/utilities/internal/createNameNode.cjs +8 -0
  99. package/__cjs/utilities/internal/createNameNode.cjs.map +1 -0
  100. package/__cjs/utilities/internal/createNameNode.d.cts +3 -0
  101. package/__cjs/utilities/internal/createValueNode.cjs +27 -0
  102. package/__cjs/utilities/internal/createValueNode.cjs.map +1 -0
  103. package/__cjs/utilities/internal/createValueNode.d.cts +12 -0
  104. package/__cjs/utilities/internal/createVariableNode.cjs +9 -0
  105. package/__cjs/utilities/internal/createVariableNode.cjs.map +1 -0
  106. package/__cjs/utilities/internal/createVariableNode.d.cts +3 -0
  107. package/__cjs/utilities/internal/equalByQuery.cjs +16 -3
  108. package/__cjs/utilities/internal/equalByQuery.cjs.map +1 -1
  109. package/__cjs/utilities/internal/equalByQuery.d.cts +2 -3
  110. package/__cjs/utilities/internal/getDefaultValues.cjs.map +1 -1
  111. package/__cjs/utilities/internal/getDefaultValues.d.cts +2 -2
  112. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  113. package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
  114. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
  115. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +20 -9
  116. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
  117. package/__cjs/utilities/internal/getFragmentScope.cjs +23 -0
  118. package/__cjs/utilities/internal/getFragmentScope.cjs.map +1 -0
  119. package/__cjs/utilities/internal/getFragmentScope.d.cts +13 -0
  120. package/__cjs/utilities/internal/getFragmentVariables.cjs +33 -0
  121. package/__cjs/utilities/internal/getFragmentVariables.cjs.map +1 -0
  122. package/__cjs/utilities/internal/getFragmentVariables.d.cts +12 -0
  123. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  124. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  125. package/__cjs/utilities/internal/index.cjs +11 -2
  126. package/__cjs/utilities/internal/index.cjs.map +1 -1
  127. package/__cjs/utilities/internal/index.d.cts +6 -1
  128. package/__cjs/utilities/internal/isNonEmptyObject.cjs +13 -0
  129. package/__cjs/utilities/internal/isNonEmptyObject.cjs.map +1 -0
  130. package/__cjs/utilities/internal/isNonEmptyObject.d.cts +7 -0
  131. package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -1
  132. package/__cjs/utilities/internal/isNonNullObject.d.cts +1 -1
  133. package/__cjs/utilities/internal/mapObservableFragment.cjs +14 -9
  134. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -1
  135. package/__cjs/utilities/internal/mapObservableFragment.d.cts +5 -1
  136. package/__cjs/utilities/internal/mergeDeepArray.cjs +2 -2
  137. package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -1
  138. package/__cjs/utilities/internal/mergeDeepArray.d.cts +2 -1
  139. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +121 -62
  140. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -1
  141. package/__cjs/utilities/internal/removeFragmentSpreads.cjs +55 -2
  142. package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -1
  143. package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +17 -1
  144. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  145. package/__cjs/utilities/internal/types/FragmentInfo.cjs +3 -0
  146. package/__cjs/utilities/internal/types/FragmentInfo.cjs.map +1 -0
  147. package/__cjs/utilities/internal/types/FragmentInfo.d.cts +14 -0
  148. package/__cjs/utilities/internal/types/Mutable.cjs +3 -0
  149. package/__cjs/utilities/internal/types/Mutable.cjs.map +1 -0
  150. package/__cjs/utilities/internal/types/Mutable.d.cts +4 -0
  151. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs +3 -0
  152. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs.map +1 -0
  153. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.d.cts +13 -0
  154. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  155. package/__cjs/version.cjs +1 -1
  156. package/__cjs/version.cjs.map +1 -1
  157. package/cache/core/cache.d.ts +22 -4
  158. package/cache/core/cache.js +51 -16
  159. package/cache/core/cache.js.map +1 -1
  160. package/cache/index.d.ts +1 -1
  161. package/cache/index.js.map +1 -1
  162. package/cache/inmemory/entityStore.js +4 -4
  163. package/cache/inmemory/helpers.d.ts +10 -5
  164. package/cache/inmemory/helpers.js +12 -1
  165. package/cache/inmemory/helpers.js.map +1 -1
  166. package/cache/inmemory/inMemoryCache.d.ts +19 -4
  167. package/cache/inmemory/inMemoryCache.js +14 -3
  168. package/cache/inmemory/inMemoryCache.js.map +1 -1
  169. package/cache/inmemory/key-extractor.js +1 -1
  170. package/cache/inmemory/policies.d.ts +1 -1
  171. package/cache/inmemory/policies.js +9 -9
  172. package/cache/inmemory/policies.js.map +1 -1
  173. package/cache/inmemory/readFromStore.js +115 -22
  174. package/cache/inmemory/readFromStore.js.map +1 -1
  175. package/cache/inmemory/types.d.ts +12 -1
  176. package/cache/inmemory/types.js.map +1 -1
  177. package/cache/inmemory/writeToStore.d.ts +8 -4
  178. package/cache/inmemory/writeToStore.js +56 -26
  179. package/cache/inmemory/writeToStore.js.map +1 -1
  180. package/core/ApolloClient.d.ts +1 -0
  181. package/core/ApolloClient.js +20 -16
  182. package/core/ApolloClient.js.map +1 -1
  183. package/core/ObservableQuery.js +8 -8
  184. package/core/QueryInfo.js +1 -1
  185. package/core/QueryManager.js +12 -12
  186. package/core/RefetchEventManager.js +3 -3
  187. package/errors/CombinedGraphQLErrors.d.ts +2 -2
  188. package/errors/CombinedGraphQLErrors.js +3 -7
  189. package/errors/CombinedGraphQLErrors.js.map +1 -1
  190. package/errors/CombinedProtocolErrors.d.ts +2 -2
  191. package/errors/CombinedProtocolErrors.js +3 -8
  192. package/errors/CombinedProtocolErrors.js.map +1 -1
  193. package/incremental/handlers/graphql17Alpha9.js +2 -2
  194. package/incremental/handlers/notImplemented.js +1 -1
  195. package/invariantErrorCodes.js +125 -120
  196. package/link/batch-http/BaseBatchHttpLink.d.ts +0 -7
  197. package/link/batch-http/BaseBatchHttpLink.js +9 -18
  198. package/link/batch-http/BaseBatchHttpLink.js.map +1 -1
  199. package/link/core/ApolloLink.js +3 -3
  200. package/link/http/checkFetcher.js +1 -1
  201. package/link/http/parseAndCheckHttpResponse.js +1 -1
  202. package/link/persisted-queries/index.js +2 -2
  203. package/link/ws/index.js +1 -1
  204. package/local-state/LocalState.js +29 -17
  205. package/local-state/LocalState.js.map +1 -1
  206. package/masking/maskDefinition.js +21 -3
  207. package/masking/maskDefinition.js.map +1 -1
  208. package/masking/maskFragment.js +2 -2
  209. package/masking/maskOperation.js +1 -1
  210. package/masking/utils.js +3 -3
  211. package/package.json +2 -2
  212. package/react/context/ApolloContext.js +1 -1
  213. package/react/context/ApolloProvider.js +1 -1
  214. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  215. package/react/hooks/useApolloClient.js +1 -1
  216. package/react/hooks/useFragment.js +8 -2
  217. package/react/hooks/useFragment.js.map +1 -1
  218. package/react/hooks/useLazyQuery.js +2 -2
  219. package/react/hooks/useLoadableQuery.js +2 -2
  220. package/react/hooks/useSubscription.js +1 -1
  221. package/react/hooks/useSuspenseFragment.js +10 -4
  222. package/react/hooks/useSuspenseFragment.js.map +1 -1
  223. package/react/hooks/useSyncExternalStore.js +1 -1
  224. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
  225. package/react/hooks-compiled/useApolloClient.js +1 -1
  226. package/react/hooks-compiled/useFragment.js +56 -32
  227. package/react/hooks-compiled/useFragment.js.map +1 -1
  228. package/react/hooks-compiled/useLazyQuery.js +2 -2
  229. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  230. package/react/hooks-compiled/useSubscription.js +1 -1
  231. package/react/hooks-compiled/useSuspenseFragment.js +10 -4
  232. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  233. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  234. package/react/internal/cache/FragmentReference.d.ts +4 -5
  235. package/react/internal/cache/FragmentReference.js +2 -2
  236. package/react/internal/cache/FragmentReference.js.map +1 -1
  237. package/react/internal/cache/QueryReference.js +1 -1
  238. package/react/internal/cache/SuspenseCache.d.ts +4 -5
  239. package/react/internal/cache/SuspenseCache.js +3 -3
  240. package/react/internal/cache/SuspenseCache.js.map +1 -1
  241. package/react/internal/cache/types.d.ts +0 -5
  242. package/react/internal/cache/types.js.map +1 -1
  243. package/react/ssr/prerenderStatic.js +2 -2
  244. package/testing/core/mocking/mockLink.js +4 -4
  245. package/utilities/graphql/DocumentTransform.js +1 -1
  246. package/utilities/internal/DeepMerger.d.ts +13 -3
  247. package/utilities/internal/DeepMerger.js +6 -2
  248. package/utilities/internal/DeepMerger.js.map +1 -1
  249. package/utilities/internal/argumentsObjectFromField.d.ts +2 -2
  250. package/utilities/internal/argumentsObjectFromField.js.map +1 -1
  251. package/utilities/internal/constants.d.ts +32 -0
  252. package/utilities/internal/constants.js +32 -0
  253. package/utilities/internal/constants.js.map +1 -1
  254. package/utilities/internal/createArgumentNode.d.ts +3 -0
  255. package/utilities/internal/createArgumentNode.js +11 -0
  256. package/utilities/internal/createArgumentNode.js.map +1 -0
  257. package/utilities/internal/createDirectiveNode.d.ts +3 -0
  258. package/utilities/internal/createDirectiveNode.js +11 -0
  259. package/utilities/internal/createDirectiveNode.js.map +1 -0
  260. package/utilities/internal/createFragmentArgumentNode.d.ts +3 -0
  261. package/utilities/internal/createFragmentArgumentNode.js +10 -0
  262. package/utilities/internal/createFragmentArgumentNode.js.map +1 -0
  263. package/utilities/internal/createFragmentSpreadNode.d.ts +6 -0
  264. package/utilities/internal/createFragmentSpreadNode.js +17 -0
  265. package/utilities/internal/createFragmentSpreadNode.js.map +1 -0
  266. package/utilities/internal/createNameNode.d.ts +3 -0
  267. package/utilities/internal/createNameNode.js +5 -0
  268. package/utilities/internal/createNameNode.js.map +1 -0
  269. package/utilities/internal/createValueNode.d.ts +12 -0
  270. package/utilities/internal/createValueNode.js +24 -0
  271. package/utilities/internal/createValueNode.js.map +1 -0
  272. package/utilities/internal/createVariableNode.d.ts +3 -0
  273. package/utilities/internal/createVariableNode.js +6 -0
  274. package/utilities/internal/createVariableNode.js.map +1 -0
  275. package/utilities/internal/equalByQuery.d.ts +2 -3
  276. package/utilities/internal/equalByQuery.js +16 -3
  277. package/utilities/internal/equalByQuery.js.map +1 -1
  278. package/utilities/internal/getDefaultValues.d.ts +2 -2
  279. package/utilities/internal/getDefaultValues.js.map +1 -1
  280. package/utilities/internal/getFragmentDefinition.js +3 -3
  281. package/utilities/internal/getFragmentDefinition.js.map +1 -1
  282. package/utilities/internal/getFragmentFromSelection.js +1 -1
  283. package/utilities/internal/getFragmentQueryDocument.js +20 -9
  284. package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
  285. package/utilities/internal/getFragmentScope.d.ts +13 -0
  286. package/utilities/internal/getFragmentScope.js +20 -0
  287. package/utilities/internal/getFragmentScope.js.map +1 -0
  288. package/utilities/internal/getFragmentVariables.d.ts +12 -0
  289. package/utilities/internal/getFragmentVariables.js +30 -0
  290. package/utilities/internal/getFragmentVariables.js.map +1 -0
  291. package/utilities/internal/getMainDefinition.js +1 -1
  292. package/utilities/internal/getQueryDefinition.js +1 -1
  293. package/utilities/internal/index.d.ts +6 -1
  294. package/utilities/internal/index.js +4 -1
  295. package/utilities/internal/index.js.map +1 -1
  296. package/utilities/internal/isNonEmptyObject.d.ts +7 -0
  297. package/utilities/internal/isNonEmptyObject.js +10 -0
  298. package/utilities/internal/isNonEmptyObject.js.map +1 -0
  299. package/utilities/internal/isNonNullObject.d.ts +1 -1
  300. package/utilities/internal/isNonNullObject.js.map +1 -1
  301. package/utilities/internal/mapObservableFragment.d.ts +5 -1
  302. package/utilities/internal/mapObservableFragment.js +14 -9
  303. package/utilities/internal/mapObservableFragment.js.map +1 -1
  304. package/utilities/internal/mergeDeepArray.d.ts +2 -1
  305. package/utilities/internal/mergeDeepArray.js +2 -2
  306. package/utilities/internal/mergeDeepArray.js.map +1 -1
  307. package/utilities/internal/removeDirectivesFromDocument.js +121 -62
  308. package/utilities/internal/removeDirectivesFromDocument.js.map +1 -1
  309. package/utilities/internal/removeFragmentSpreads.d.ts +18 -2
  310. package/utilities/internal/removeFragmentSpreads.js +56 -3
  311. package/utilities/internal/removeFragmentSpreads.js.map +1 -1
  312. package/utilities/internal/shouldInclude.js +4 -4
  313. package/utilities/internal/types/FragmentInfo.d.ts +14 -0
  314. package/utilities/internal/types/FragmentInfo.js +2 -0
  315. package/utilities/internal/types/FragmentInfo.js.map +1 -0
  316. package/utilities/internal/types/Mutable.d.ts +4 -0
  317. package/utilities/internal/types/Mutable.js +2 -0
  318. package/utilities/internal/types/Mutable.js.map +1 -0
  319. package/utilities/internal/types/ObjectWithFragmentInfo.d.ts +13 -0
  320. package/utilities/internal/types/ObjectWithFragmentInfo.js +2 -0
  321. package/utilities/internal/types/ObjectWithFragmentInfo.js.map +1 -0
  322. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  323. package/version.js +1 -1
  324. package/version.js.map +1 -1
@@ -30,13 +30,6 @@ export declare namespace BaseBatchHttpLink {
30
30
  * @defaultValue 10
31
31
  */
32
32
  batchMax?: number;
33
- /**
34
- * If differently-shaped operations (with/without `includeExtensions` or `includeQuery`) should be combined into a single batch request.
35
- * In most applications this will determine if persisted and non-persisted queries should be combined within the same batch.
36
- *
37
- * @defaultValue false
38
- */
39
- batchHybridRequests?: boolean;
40
33
  }
41
34
  }
42
35
  /**
@@ -58,16 +58,16 @@ export class BaseBatchHttpLink extends ApolloLink {
58
58
  this.batchMax = batchMax || 10;
59
59
  const batchHandler = (operations) => {
60
60
  const chosenURI = selectURI(operations[0], uri);
61
+ const context = operations[0].getContext();
62
+ const contextConfig = {
63
+ http: context.http,
64
+ options: context.fetchOptions,
65
+ credentials: context.credentials,
66
+ headers: context.headers,
67
+ };
61
68
  //uses fallback, link, and then context to build options
62
69
  const optsAndBody = operations.map((operation) => {
63
- const context = operation.getContext();
64
- const operationConfig = {
65
- http: context.http,
66
- options: context.fetchOptions,
67
- credentials: context.credentials,
68
- headers: context.headers,
69
- };
70
- const result = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, operationConfig);
70
+ const result = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig);
71
71
  if (result.body.variables && !includeUnusedVariables) {
72
72
  result.body.variables = filterOperationVariables(result.body.variables, operation.query);
73
73
  }
@@ -129,16 +129,7 @@ export class BaseBatchHttpLink extends ApolloLink {
129
129
  ((operation) => {
130
130
  const context = operation.getContext();
131
131
  const contextConfig = {
132
- http: options.batchHybridRequests ?
133
- {
134
- ...context.http,
135
- // omit includeExtensions and includeQuery from the HTTP options
136
- // they only influence body creation, not the HTTP request itself
137
- // so they should be grouped together
138
- includeExtensions: undefined,
139
- includeQuery: undefined,
140
- }
141
- : context.http,
132
+ http: context.http,
142
133
  options: context.fetchOptions,
143
134
  credentials: context.credentials,
144
135
  headers: context.headers,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseBatchHttpLink.js","sourceRoot":"","sources":["../../../src/link/batch-http/BaseBatchHttpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,yBA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AAS,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { Observable, throwError } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { BatchLink } from \"@apollo/client/link/batch\";\nimport type { BaseHttpLink } from \"@apollo/client/link/http\";\nimport {\n checkFetcher,\n defaultPrinter,\n fallbackHttpConfig,\n parseAndCheckHttpResponse,\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\nimport { filterOperationVariables } from \"@apollo/client/link/utils\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { compact } from \"@apollo/client/utilities/internal\";\nimport { maybe } from \"@apollo/client/utilities/internal/globals\";\n\nexport declare namespace BaseBatchHttpLink {\n /**\n * Options passed to `BaseBatchHttpLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `BatchHttpLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `BaseBatchHttpLink` constructor.\n * > If a value is provided to both, the value in `context` takes precedence.\n */\n export interface ContextOptions extends BaseHttpLink.ContextOptions {}\n /**\n * Configuration options for creating a `BaseBatchHttpLink` instance.\n *\n * > [!NOTE]\n * > Some of these options are also available to override in [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context).\n * > Context options override the options passed to the constructor. Treat\n * > these options as default values that are used when the request context\n * > does not override the value.\n */\n interface Options\n extends BatchLink.Shared.Options,\n BaseHttpLink.Shared.Options {\n /** {@inheritDoc @apollo/client/link/batch!BatchLink.Shared.Options#batchMax:member {\"defaultValue\": 10}} */\n batchMax?: number;\n\n /**\n * If differently-shaped operations (with/without `includeExtensions` or `includeQuery`) should be combined into a single batch request.\n * In most applications this will determine if persisted and non-persisted queries should be combined within the same batch.\n *\n * @defaultValue false\n */\n batchHybridRequests?: boolean;\n }\n}\n\nconst backupFetch = maybe(() => fetch);\n\n/**\n * `BaseBatchHttpLink` is a terminating link that batches array of individual\n * GraphQL operations into a single HTTP request that's sent to a single GraphQL\n * endpoint. It serves as a base link to `BatchHttpLink`.\n *\n * @remarks\n *\n * > [!NOTE]\n * > Prefer using `BatchHttpLink` over `BaseBatchHttpLink`. Use\n * > `BaseBatchHttpLink` when you need to disable client awareness features and\n * > would like to tree-shake the implementation of `ClientAwarenessLink` out\n * > of your app bundle.\n *\n * @example\n *\n * ```ts\n * import { BaseBatchHttpLink } from \"@apollo/client/link/batch-http\";\n *\n * const link = new BaseBatchHttpLink({\n * uri: \"http://localhost:4000/graphql\",\n * batchMax: 5, // No more than 5 operations per batch\n * batchInterval: 20, // Wait no more than 20ms after first batched operation\n * });\n * ```\n */\nexport class BaseBatchHttpLink extends ApolloLink {\n private batchDebounce?: boolean;\n private batchInterval: number;\n private batchMax: number;\n private batcher: ApolloLink;\n\n constructor(options: BaseBatchHttpLink.Options = {}) {\n super();\n\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing is passed in\n fetch: preferredFetch,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n batchInterval,\n batchDebounce,\n batchMax,\n batchKey,\n includeUnusedVariables = false,\n ...requestOptions\n } = options;\n\n if (__DEV__) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch\n // is defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n\n const linkConfig = {\n http: compact({ includeExtensions, preserveHeaderCase }),\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval || 10;\n this.batchMax = batchMax || 10;\n\n const batchHandler: BatchLink.BatchHandler = (operations) => {\n const chosenURI = selectURI(operations[0], uri);\n\n //uses fallback, link, and then context to build options\n const optsAndBody = operations.map((operation) => {\n const context = operation.getContext();\n\n const operationConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n const result = selectHttpOptionsAndBodyInternal(\n operation,\n print,\n fallbackHttpConfig,\n linkConfig,\n operationConfig\n );\n\n if (result.body.variables && !includeUnusedVariables) {\n result.body.variables = filterOperationVariables(\n result.body.variables,\n operation.query\n );\n }\n\n return result;\n });\n\n const loadedBody = optsAndBody.map(({ body }) => body);\n const options = optsAndBody[0].options;\n\n // There's no spec for using GET with batches.\n if (options.method === \"GET\") {\n return throwError(\n () =>\n new Error(\"apollo-link-batch-http does not support GET requests\")\n );\n }\n\n try {\n (options as any).body = JSON.stringify(loadedBody);\n } catch (parseError) {\n return throwError(() => parseError);\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n return new Observable((observer) => {\n // Prefer BatchHttpLink.Options.fetch (preferredFetch) if provided, and\n // otherwise fall back to the *current* global window.fetch function\n // (see issue #7832), or (if all else fails) the backupFetch function we\n // saved when this module was first evaluated. This last option protects\n // against the removal of window.fetch, which is unlikely but not\n // impossible.\n const currentFetch =\n preferredFetch || maybe(() => fetch) || backupFetch;\n\n currentFetch!(chosenURI, options)\n .then((response) => {\n // Make the raw response available in the context.\n operations.forEach((operation) =>\n operation.setContext({ response })\n );\n return response;\n })\n .then(parseAndCheckHttpResponse(operations))\n .then((result) => {\n controller = undefined;\n // we have data and can send it to back up the link chain\n observer.next(result);\n observer.complete();\n return result;\n })\n .catch((err) => {\n controller = undefined;\n observer.error(err);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n };\n\n batchKey =\n batchKey ||\n ((operation: ApolloLink.Operation) => {\n const context = operation.getContext();\n\n const contextConfig = {\n http:\n options.batchHybridRequests ?\n {\n ...context.http,\n // omit includeExtensions and includeQuery from the HTTP options\n // they only influence body creation, not the HTTP request itself\n // so they should be grouped together\n includeExtensions: undefined,\n includeQuery: undefined,\n }\n : context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //may throw error if config not serializable\n return selectURI(operation, uri) + JSON.stringify(contextConfig);\n });\n\n this.batcher = new BatchLink({\n batchDebounce: this.batchDebounce,\n batchInterval: this.batchInterval,\n batchMax: this.batchMax,\n batchKey,\n batchHandler,\n });\n }\n\n public request(\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ): Observable<ApolloLink.Result> {\n return this.batcher.request(operation, forward);\n }\n}\n"]}
1
+ {"version":3,"file":"BaseBatchHttpLink.js","sourceRoot":"","sources":["../../../src/link/batch-http/BaseBatchHttpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,SAAS,GACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AA8BlE,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IACvC,aAAa,CAAW;IACxB,aAAa,CAAS;IACtB,QAAQ,CAAS;IACjB,OAAO,CAAa;IAE5B,YAAY,UAAqC,EAAE;QACjD,KAAK,EAAE,CAAC;QAER,IAAI,EACF,GAAG,GAAG,UAAU;QAChB,mDAAmD;QACnD,KAAK,EAAE,cAAc,EACrB,KAAK,GAAG,cAAc,EACtB,iBAAiB,E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AAS,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;gBACnE,CAAC,CAAC,CAAC;QAEL,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ;YACR,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAEM,OAAO,CACZ,SAA+B,EAC/B,OAAmC;QAEnC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { Observable, throwError } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { BatchLink } from \"@apollo/client/link/batch\";\nimport type { BaseHttpLink } from \"@apollo/client/link/http\";\nimport {\n checkFetcher,\n defaultPrinter,\n fallbackHttpConfig,\n parseAndCheckHttpResponse,\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\nimport { filterOperationVariables } from \"@apollo/client/link/utils\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { compact } from \"@apollo/client/utilities/internal\";\nimport { maybe } from \"@apollo/client/utilities/internal/globals\";\n\nexport declare namespace BaseBatchHttpLink {\n /**\n * Options passed to `BaseBatchHttpLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `BatchHttpLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `BaseBatchHttpLink` constructor.\n * > If a value is provided to both, the value in `context` takes precedence.\n */\n export interface ContextOptions extends BaseHttpLink.ContextOptions {}\n /**\n * Configuration options for creating a `BaseBatchHttpLink` instance.\n *\n * > [!NOTE]\n * > Some of these options are also available to override in [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context).\n * > Context options override the options passed to the constructor. Treat\n * > these options as default values that are used when the request context\n * > does not override the value.\n */\n interface Options\n extends BatchLink.Shared.Options,\n BaseHttpLink.Shared.Options {\n /** {@inheritDoc @apollo/client/link/batch!BatchLink.Shared.Options#batchMax:member {\"defaultValue\": 10}} */\n batchMax?: number;\n }\n}\n\nconst backupFetch = maybe(() => fetch);\n\n/**\n * `BaseBatchHttpLink` is a terminating link that batches array of individual\n * GraphQL operations into a single HTTP request that's sent to a single GraphQL\n * endpoint. It serves as a base link to `BatchHttpLink`.\n *\n * @remarks\n *\n * > [!NOTE]\n * > Prefer using `BatchHttpLink` over `BaseBatchHttpLink`. Use\n * > `BaseBatchHttpLink` when you need to disable client awareness features and\n * > would like to tree-shake the implementation of `ClientAwarenessLink` out\n * > of your app bundle.\n *\n * @example\n *\n * ```ts\n * import { BaseBatchHttpLink } from \"@apollo/client/link/batch-http\";\n *\n * const link = new BaseBatchHttpLink({\n * uri: \"http://localhost:4000/graphql\",\n * batchMax: 5, // No more than 5 operations per batch\n * batchInterval: 20, // Wait no more than 20ms after first batched operation\n * });\n * ```\n */\nexport class BaseBatchHttpLink extends ApolloLink {\n private batchDebounce?: boolean;\n private batchInterval: number;\n private batchMax: number;\n private batcher: ApolloLink;\n\n constructor(options: BaseBatchHttpLink.Options = {}) {\n super();\n\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing is passed in\n fetch: preferredFetch,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n batchInterval,\n batchDebounce,\n batchMax,\n batchKey,\n includeUnusedVariables = false,\n ...requestOptions\n } = options;\n\n if (__DEV__) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch\n // is defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n\n const linkConfig = {\n http: compact({ includeExtensions, preserveHeaderCase }),\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval || 10;\n this.batchMax = batchMax || 10;\n\n const batchHandler: BatchLink.BatchHandler = (operations) => {\n const chosenURI = selectURI(operations[0], uri);\n\n const context = operations[0].getContext();\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //uses fallback, link, and then context to build options\n const optsAndBody = operations.map((operation) => {\n const result = selectHttpOptionsAndBodyInternal(\n operation,\n print,\n fallbackHttpConfig,\n linkConfig,\n contextConfig\n );\n\n if (result.body.variables && !includeUnusedVariables) {\n result.body.variables = filterOperationVariables(\n result.body.variables,\n operation.query\n );\n }\n\n return result;\n });\n\n const loadedBody = optsAndBody.map(({ body }) => body);\n const options = optsAndBody[0].options;\n\n // There's no spec for using GET with batches.\n if (options.method === \"GET\") {\n return throwError(\n () =>\n new Error(\"apollo-link-batch-http does not support GET requests\")\n );\n }\n\n try {\n (options as any).body = JSON.stringify(loadedBody);\n } catch (parseError) {\n return throwError(() => parseError);\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n return new Observable((observer) => {\n // Prefer BatchHttpLink.Options.fetch (preferredFetch) if provided, and\n // otherwise fall back to the *current* global window.fetch function\n // (see issue #7832), or (if all else fails) the backupFetch function we\n // saved when this module was first evaluated. This last option protects\n // against the removal of window.fetch, which is unlikely but not\n // impossible.\n const currentFetch =\n preferredFetch || maybe(() => fetch) || backupFetch;\n\n currentFetch!(chosenURI, options)\n .then((response) => {\n // Make the raw response available in the context.\n operations.forEach((operation) =>\n operation.setContext({ response })\n );\n return response;\n })\n .then(parseAndCheckHttpResponse(operations))\n .then((result) => {\n controller = undefined;\n // we have data and can send it to back up the link chain\n observer.next(result);\n observer.complete();\n return result;\n })\n .catch((err) => {\n controller = undefined;\n observer.error(err);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n };\n\n batchKey =\n batchKey ||\n ((operation: ApolloLink.Operation) => {\n const context = operation.getContext();\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //may throw error if config not serializable\n return selectURI(operation, uri) + JSON.stringify(contextConfig);\n });\n\n this.batcher = new BatchLink({\n batchDebounce: this.batchDebounce,\n batchInterval: this.batchInterval,\n batchMax: this.batchMax,\n batchKey,\n batchHandler,\n });\n }\n\n public request(\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ): Observable<ApolloLink.Result> {\n return this.batcher.request(operation, forward);\n }\n}\n"]}
@@ -100,7 +100,7 @@ export class ApolloLink {
100
100
  const result = test(operation);
101
101
  if (__DEV__) {
102
102
  if (typeof result !== "boolean") {
103
- __DEV__ && invariant.warn(65, result);
103
+ __DEV__ && invariant.warn(66, result);
104
104
  }
105
105
  }
106
106
  return result ?
@@ -142,7 +142,7 @@ export class ApolloLink {
142
142
  static execute(link, request, context) {
143
143
  return link.request(createOperation(request, context), () => {
144
144
  if (__DEV__) {
145
- __DEV__ && invariant.warn(66);
145
+ __DEV__ && invariant.warn(67);
146
146
  }
147
147
  return EMPTY;
148
148
  });
@@ -246,7 +246,7 @@ export class ApolloLink {
246
246
  * > request instead.
247
247
  */
248
248
  request(operation, forward) {
249
- throw newInvariantError(67);
249
+ throw newInvariantError(68);
250
250
  }
251
251
  /**
252
252
  * @internal
@@ -1,5 +1,5 @@
1
1
  import { invariant } from "@apollo/client/utilities/invariant";
2
2
  export const checkFetcher = (fetcher) => {
3
- invariant(fetcher || typeof fetch !== "undefined", 63);
3
+ invariant(fetcher || typeof fetch !== "undefined", 64);
4
4
  };
5
5
  //# sourceMappingURL=checkFetcher.js.map
@@ -33,7 +33,7 @@ async function* consumeMultipartBody(response) {
33
33
  /;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i);
34
34
  const boundary = "\r\n--" + (match ? match[1] ?? match[2] ?? match[3] ?? "-" : "-");
35
35
  let buffer = "";
36
- invariant(response.body && typeof response.body.getReader === "function", 64);
36
+ invariant(response.body && typeof response.body.getReader === "function", 65);
37
37
  const stream = response.body;
38
38
  const reader = stream.getReader();
39
39
  let done = false;
@@ -66,7 +66,7 @@ export class PersistedQueryLink extends ApolloLink {
66
66
  // hashing with something other than SHA-256.
67
67
  invariant(options &&
68
68
  (typeof options.sha256 === "function" ||
69
- typeof options.generateHash === "function"), 61);
69
+ typeof options.generateHash === "function"), 62);
70
70
  const { sha256,
71
71
  // If both a `sha256` and `generateHash` option are provided, the
72
72
  // `sha256` option will be ignored. Developers can configure and
@@ -92,7 +92,7 @@ export class PersistedQueryLink extends ApolloLink {
92
92
  return hash;
93
93
  }
94
94
  super((operation, forward) => {
95
- invariant(forward, 62);
95
+ invariant(forward, 63);
96
96
  const { query } = operation;
97
97
  return new Observable((observer) => {
98
98
  let subscription;
package/link/ws/index.js CHANGED
@@ -33,7 +33,7 @@ export class WebSocketLink extends ApolloLink {
33
33
  constructor(paramsOrClient) {
34
34
  super();
35
35
  if (__DEV__) {
36
- __DEV__ && invariant.warn(60);
36
+ __DEV__ && invariant.warn(61);
37
37
  }
38
38
  if (paramsOrClient instanceof SubscriptionClient) {
39
39
  this.subscriptionClient = paramsOrClient;
@@ -3,7 +3,7 @@ import { cacheSlot } from "@apollo/client/cache";
3
3
  import { LocalStateError, toErrorLike } from "@apollo/client/errors";
4
4
  import { stripTypename } from "@apollo/client/utilities";
5
5
  import { __DEV__ } from "@apollo/client/utilities/environment";
6
- import { argumentsObjectFromField, createFragmentMap, dealias, getFragmentDefinitions, getMainDefinition, hasDirectives, mergeDeep, mergeDeepArray, resultKeyNameFromField, shouldInclude, } from "@apollo/client/utilities/internal";
6
+ import { argumentsObjectFromField, createFragmentMap, dealias, getFragmentDefinitions, getFragmentScope, getMainDefinition, hasDirectives, mergeDeep, mergeDeepArray, resultKeyNameFromField, shouldInclude, } from "@apollo/client/utilities/internal";
7
7
  import { invariant, newInvariantError, } from "@apollo/client/utilities/invariant";
8
8
  /**
9
9
  * LocalState enables the use of `@client` fields in GraphQL operations.
@@ -66,7 +66,7 @@ export class LocalState {
66
66
  }
67
67
  async execute({ document, client, context, remoteResult, variables = {}, onlyRunForcedResolvers = false, returnPartialData = false, fetchPolicy, }) {
68
68
  if (__DEV__) {
69
- invariant(hasDirectives(["client"], document), 49);
69
+ invariant(hasDirectives(["client"], document), 50);
70
70
  validateCacheImplementation(client.cache);
71
71
  }
72
72
  // note: if `remoteResult` is `undefined`, we will execute resolvers since
@@ -99,6 +99,7 @@ export class LocalState {
99
99
  variables: variables ?? {},
100
100
  }) ?? requestContext,
101
101
  variables,
102
+ variablesScope: variables,
102
103
  exportedVariables: {},
103
104
  selectionsToResolve,
104
105
  onlyRunForcedResolvers,
@@ -122,7 +123,7 @@ export class LocalState {
122
123
  }
123
124
  async getExportedVariables({ document, client, context, variables, }) {
124
125
  if (__DEV__) {
125
- invariant(hasDirectives(["client"], document), 50);
126
+ invariant(hasDirectives(["client"], document), 51);
126
127
  validateCacheImplementation(client.cache);
127
128
  }
128
129
  const { exportsToResolve, exportedVariableDefs, fragmentMap, operationDefinition, } = this.collectQueryDetail(document);
@@ -145,6 +146,7 @@ export class LocalState {
145
146
  variables: variables ?? {},
146
147
  }) ?? requestContext,
147
148
  variables,
149
+ variablesScope: variables,
148
150
  exportedVariables: {},
149
151
  selectionsToResolve: exportsToResolve,
150
152
  onlyRunForcedResolvers: false,
@@ -161,7 +163,7 @@ export class LocalState {
161
163
  });
162
164
  }
163
165
  async resolveSelectionSet(selectionSet, isClientFieldDescendant, rootValue, execContext, path) {
164
- const { client, fragmentMap, variables, operationDefinition } = execContext;
166
+ const { client, fragmentMap, variablesScope, operationDefinition } = execContext;
165
167
  const { cache } = client;
166
168
  const resultsToMerge = [];
167
169
  const execute = async (selection) => {
@@ -171,7 +173,7 @@ export class LocalState {
171
173
  // (still processing if one of the ancestors or one of the child fields has @client directive)
172
174
  return;
173
175
  }
174
- if (!shouldInclude(selection, variables)) {
176
+ if (!shouldInclude(selection, variablesScope)) {
175
177
  // Skip this entirely.
176
178
  return;
177
179
  }
@@ -204,13 +206,22 @@ export class LocalState {
204
206
  }
205
207
  if (selection.kind === Kind.FRAGMENT_SPREAD) {
206
208
  const fragment = fragmentMap[selection.name.value];
207
- invariant(fragment, 51, selection.name.value);
209
+ invariant(fragment, 52, selection.name.value);
208
210
  const typename = rootValue?.__typename;
209
211
  const typeCondition = fragment.typeCondition.name.value;
210
212
  const matches = typename === typeCondition ||
211
213
  cache.fragmentMatches(fragment, typename ?? "");
212
214
  if (matches) {
213
- const fragmentResult = await this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext, path);
215
+ let context = execContext;
216
+ const variablesScope = getFragmentScope(selection, {
217
+ fragment,
218
+ variables: execContext.variables,
219
+ parentScope: execContext.variablesScope,
220
+ });
221
+ if (variablesScope !== execContext.variablesScope) {
222
+ context = { ...context, variablesScope };
223
+ }
224
+ const fragmentResult = await this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, context, path);
214
225
  if (fragmentResult) {
215
226
  resultsToMerge.push(fragmentResult);
216
227
  }
@@ -244,7 +255,7 @@ export class LocalState {
244
255
  return this.resolveSelectionSet(field.selectionSet, false, result, execContext, path);
245
256
  }
246
257
  async resolveClientField(field, isClientFieldDescendant, rootValue, execContext, parentSelectionSet, path) {
247
- const { client, diff, variables, operationDefinition, phase, onlyRunForcedResolvers, fetchPolicy, } = execContext;
258
+ const { client, diff, variablesScope, operationDefinition, phase, onlyRunForcedResolvers, fetchPolicy, } = execContext;
248
259
  let { returnPartialData } = execContext;
249
260
  const isRootField = parentSelectionSet === operationDefinition.selectionSet;
250
261
  const fieldName = field.name.value;
@@ -269,7 +280,7 @@ export class LocalState {
269
280
  }
270
281
  if (client.cache.resolvesClientField?.(typename, fieldName)) {
271
282
  if (fetchPolicy === "no-cache") {
272
- __DEV__ && invariant.warn(52, resolverName);
283
+ __DEV__ && invariant.warn(53, resolverName);
273
284
  return null;
274
285
  }
275
286
  // assume the cache will handle returning the correct value
@@ -277,7 +288,7 @@ export class LocalState {
277
288
  return;
278
289
  }
279
290
  if (!returnPartialData) {
280
- __DEV__ && invariant.warn(53, resolverName);
291
+ __DEV__ && invariant.warn(54, resolverName);
281
292
  return null;
282
293
  }
283
294
  });
@@ -295,7 +306,8 @@ export class LocalState {
295
306
  // set cacheSlot to the current cache instance.
296
307
  cacheSlot.withValue(client.cache, resolver, [
297
308
  rootValue ? dealias(rootValue, parentSelectionSet) : {},
298
- (argumentsObjectFromField(field, variables) ?? {}),
309
+ (argumentsObjectFromField(field, variablesScope) ??
310
+ {}),
299
311
  { requestContext: execContext.context, client, phase },
300
312
  { field, fragmentMap: execContext.fragmentMap, path },
301
313
  ]))
@@ -343,13 +355,13 @@ export class LocalState {
343
355
  if (result === undefined && !returnPartialData) {
344
356
  if (__DEV__ && phase === "resolve") {
345
357
  if (resolver && !onlyRunForcedResolvers) {
346
- __DEV__ && invariant.warn(54, resolverName);
358
+ __DEV__ && invariant.warn(55, resolverName);
347
359
  }
348
360
  else if (onlyRunForcedResolvers) {
349
- __DEV__ && invariant.warn(55, resolverName);
361
+ __DEV__ && invariant.warn(56, resolverName);
350
362
  }
351
363
  else {
352
- __DEV__ && invariant.warn(56, fieldName, rootValue);
364
+ __DEV__ && invariant.warn(57, fieldName, rootValue);
353
365
  }
354
366
  }
355
367
  result = null;
@@ -361,7 +373,7 @@ export class LocalState {
361
373
  return this.resolveSubSelectedArray(field, true, result, execContext, path);
362
374
  }
363
375
  if (phase === "resolve" && !result.__typename) {
364
- this.addError(newInvariantError(57, result, resolverName), path, execContext, { resolver: resolverName });
376
+ this.addError(newInvariantError(58, result, resolverName), path, execContext, { resolver: resolverName });
365
377
  return null;
366
378
  }
367
379
  return this.resolveSelectionSet(field.selectionSet, true, result, execContext, path);
@@ -472,7 +484,7 @@ export class LocalState {
472
484
  },
473
485
  FragmentSpread(spread, _, __, ___, ancestors) {
474
486
  const fragment = fragmentMap[spread.name.value];
475
- invariant(fragment, 58, spread.name.value);
487
+ invariant(fragment, 59, spread.name.value);
476
488
  const { selectionsToResolve: fragmentSelections } = traverse(fragment);
477
489
  if (fragmentSelections.size > 0) {
478
490
  // Fragment for this spread contains @client directive (either directly or transitively)
@@ -531,7 +543,7 @@ function getExportedVariableName(directive) {
531
543
  }
532
544
  }
533
545
  function validateCacheImplementation(cache) {
534
- invariant(cache.fragmentMatches, 59);
546
+ invariant(cache.fragmentMatches, 60);
535
547
  }
536
548
  function getCacheResultAtPath(diff, path) {
537
549
  if (diff.result === null) {