@apollo/client 4.0.11 → 4.0.12-beta.0

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 (317) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/__cjs/cache/core/cache.cjs +216 -52
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +141 -25
  5. package/__cjs/cache/core/types/Cache.d.cts +77 -17
  6. package/__cjs/cache/index.cjs.map +1 -1
  7. package/__cjs/cache/index.d.cts +1 -1
  8. package/__cjs/cache/inmemory/entityStore.cjs +6 -4
  9. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  10. package/__cjs/cache/inmemory/helpers.d.cts +1 -1
  11. package/__cjs/cache/inmemory/inMemoryCache.cjs +62 -1
  12. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  13. package/__cjs/cache/inmemory/inMemoryCache.d.cts +48 -0
  14. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  15. package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  16. package/__cjs/cache/inmemory/policies.cjs +56 -17
  17. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  18. package/__cjs/cache/inmemory/policies.d.cts +30 -6
  19. package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
  20. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  21. package/__cjs/cache/inmemory/types.d.cts +2 -0
  22. package/__cjs/cache/inmemory/writeToStore.cjs +24 -10
  23. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  24. package/__cjs/cache/inmemory/writeToStore.d.cts +2 -1
  25. package/__cjs/core/ApolloClient.cjs +31 -49
  26. package/__cjs/core/ApolloClient.cjs.map +1 -1
  27. package/__cjs/core/ApolloClient.d.cts +143 -17
  28. package/__cjs/core/ObservableQuery.cjs +162 -128
  29. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  30. package/__cjs/core/ObservableQuery.d.cts +1 -0
  31. package/__cjs/core/QueryInfo.cjs +9 -1
  32. package/__cjs/core/QueryInfo.cjs.map +1 -1
  33. package/__cjs/core/QueryInfo.d.cts +2 -1
  34. package/__cjs/core/QueryManager.cjs +46 -24
  35. package/__cjs/core/QueryManager.cjs.map +1 -1
  36. package/__cjs/core/QueryManager.d.cts +18 -2
  37. package/__cjs/incremental/handlers/defer20220824.cjs +44 -19
  38. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  39. package/__cjs/incremental/handlers/defer20220824.d.cts +15 -7
  40. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +222 -0
  41. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -0
  42. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +98 -0
  43. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  44. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  45. package/__cjs/incremental/index.cjs +3 -1
  46. package/__cjs/incremental/index.cjs.map +1 -1
  47. package/__cjs/incremental/index.d.cts +1 -0
  48. package/__cjs/incremental/types.d.cts +9 -0
  49. package/__cjs/invariantErrorCodes.cjs +78 -62
  50. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +13 -1
  51. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  52. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
  53. package/__cjs/link/core/ApolloLink.cjs +3 -3
  54. package/__cjs/link/error/index.cjs +1 -1
  55. package/__cjs/link/error/index.cjs.map +1 -1
  56. package/__cjs/link/error/index.d.cts +1 -1
  57. package/__cjs/link/http/checkFetcher.cjs +1 -1
  58. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  59. package/__cjs/link/persisted-queries/index.cjs +2 -2
  60. package/__cjs/link/ws/index.cjs +1 -1
  61. package/__cjs/local-state/LocalState.cjs +28 -14
  62. package/__cjs/local-state/LocalState.cjs.map +1 -1
  63. package/__cjs/local-state/LocalState.d.cts +3 -2
  64. package/__cjs/masking/types.d.cts +2 -1
  65. package/__cjs/react/hooks/internal/useDeepMemo.cjs +2 -0
  66. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  67. package/__cjs/react/hooks/useBackgroundQuery.cjs +1 -3
  68. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  69. package/__cjs/react/hooks/useFragment.cjs +38 -87
  70. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  71. package/__cjs/react/hooks/useFragment.d.cts +65 -6
  72. package/__cjs/react/hooks/useLazyQuery.cjs +2 -0
  73. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  74. package/__cjs/react/hooks/useMutation.cjs +7 -1
  75. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  76. package/__cjs/react/hooks/useMutation.d.cts +13 -1
  77. package/__cjs/react/hooks/useQuery.cjs +1 -4
  78. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  79. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  80. package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -3
  81. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  82. package/__cjs/react/hooks/useReadQuery.cjs +1 -3
  83. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  84. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  85. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  86. package/__cjs/react/hooks/useSuspenseFragment.cjs +16 -16
  87. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  88. package/__cjs/react/hooks/useSuspenseFragment.d.cts +33 -7
  89. package/__cjs/react/hooks/useSuspenseQuery.cjs +4 -4
  90. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  91. package/__cjs/react/internal/cache/FragmentReference.cjs +3 -22
  92. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  93. package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -4
  94. package/__cjs/react/internal/cache/QueryReference.cjs +16 -0
  95. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  96. package/__cjs/react/internal/cache/QueryReference.d.cts +5 -0
  97. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  98. package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
  99. package/__cjs/react/internal/cache/types.d.cts +2 -2
  100. package/__cjs/react/query-preloader/createQueryPreloader.cjs +41 -1
  101. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  102. package/__cjs/react/ssr/useSSRQuery.cjs +1 -0
  103. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  104. package/__cjs/utilities/DeepPartial.cjs.map +1 -1
  105. package/__cjs/utilities/DeepPartial.d.cts +1 -1
  106. package/__cjs/utilities/internal/DeepMerger.cjs +36 -4
  107. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  108. package/__cjs/utilities/internal/DeepMerger.d.cts +20 -4
  109. package/__cjs/utilities/internal/combineLatestBatched.cjs +71 -0
  110. package/__cjs/utilities/internal/combineLatestBatched.cjs.map +1 -0
  111. package/__cjs/utilities/internal/combineLatestBatched.d.cts +14 -0
  112. package/__cjs/utilities/internal/constants.cjs +17 -1
  113. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  114. package/__cjs/utilities/internal/constants.d.cts +16 -0
  115. package/__cjs/utilities/internal/getStoreKeyName.cjs +1 -0
  116. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  117. package/__cjs/utilities/internal/index.cjs +8 -2
  118. package/__cjs/utilities/internal/index.cjs.map +1 -1
  119. package/__cjs/utilities/internal/index.d.cts +4 -1
  120. package/__cjs/utilities/internal/mapObservableFragment.cjs +27 -0
  121. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -0
  122. package/__cjs/utilities/internal/mapObservableFragment.d.cts +3 -0
  123. package/__cjs/utilities/internal/memoize.cjs +2 -2
  124. package/__cjs/utilities/internal/memoize.cjs.map +1 -1
  125. package/__cjs/utilities/internal/memoize.d.cts +2 -1
  126. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +61 -0
  127. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +1 -0
  128. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +11 -0
  129. package/__cjs/utilities/internal/ponyfills/index.cjs +6 -0
  130. package/__cjs/utilities/internal/ponyfills/index.cjs.map +1 -0
  131. package/__cjs/utilities/internal/ponyfills/index.d.cts +3 -0
  132. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +6 -0
  133. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +1 -0
  134. package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +2 -0
  135. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +3 -0
  136. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +1 -0
  137. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +24 -0
  138. package/__cjs/version.cjs +1 -1
  139. package/__cjs/version.cjs.map +1 -1
  140. package/cache/core/cache.d.ts +141 -25
  141. package/cache/core/cache.js +219 -55
  142. package/cache/core/cache.js.map +1 -1
  143. package/cache/core/types/Cache.d.ts +77 -17
  144. package/cache/core/types/Cache.js.map +1 -1
  145. package/cache/index.d.ts +1 -1
  146. package/cache/index.js.map +1 -1
  147. package/cache/inmemory/entityStore.js +6 -4
  148. package/cache/inmemory/entityStore.js.map +1 -1
  149. package/cache/inmemory/helpers.d.ts +1 -1
  150. package/cache/inmemory/inMemoryCache.d.ts +48 -0
  151. package/cache/inmemory/inMemoryCache.js +62 -1
  152. package/cache/inmemory/inMemoryCache.js.map +1 -1
  153. package/cache/inmemory/key-extractor.js +1 -1
  154. package/cache/inmemory/key-extractor.js.map +1 -1
  155. package/cache/inmemory/policies.d.ts +30 -6
  156. package/cache/inmemory/policies.js +45 -7
  157. package/cache/inmemory/policies.js.map +1 -1
  158. package/cache/inmemory/readFromStore.js +3 -3
  159. package/cache/inmemory/readFromStore.js.map +1 -1
  160. package/cache/inmemory/types.d.ts +2 -0
  161. package/cache/inmemory/types.js.map +1 -1
  162. package/cache/inmemory/writeToStore.d.ts +2 -1
  163. package/cache/inmemory/writeToStore.js +26 -12
  164. package/cache/inmemory/writeToStore.js.map +1 -1
  165. package/core/ApolloClient.d.ts +143 -17
  166. package/core/ApolloClient.js +32 -50
  167. package/core/ApolloClient.js.map +1 -1
  168. package/core/ObservableQuery.d.ts +1 -0
  169. package/core/ObservableQuery.js +165 -131
  170. package/core/ObservableQuery.js.map +1 -1
  171. package/core/QueryInfo.d.ts +2 -1
  172. package/core/QueryInfo.js +10 -2
  173. package/core/QueryInfo.js.map +1 -1
  174. package/core/QueryManager.d.ts +18 -2
  175. package/core/QueryManager.js +47 -25
  176. package/core/QueryManager.js.map +1 -1
  177. package/incremental/handlers/defer20220824.d.ts +15 -7
  178. package/incremental/handlers/defer20220824.js +44 -19
  179. package/incremental/handlers/defer20220824.js.map +1 -1
  180. package/incremental/handlers/graphql17Alpha9.d.ts +98 -0
  181. package/incremental/handlers/graphql17Alpha9.js +218 -0
  182. package/incremental/handlers/graphql17Alpha9.js.map +1 -0
  183. package/incremental/handlers/notImplemented.js +1 -1
  184. package/incremental/handlers/notImplemented.js.map +1 -1
  185. package/incremental/index.d.ts +1 -0
  186. package/incremental/index.js +3 -2
  187. package/incremental/index.js.map +1 -1
  188. package/incremental/types.d.ts +9 -0
  189. package/incremental/types.js.map +1 -1
  190. package/invariantErrorCodes.js +78 -62
  191. package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +1 -0
  192. package/legacyEntryPoints/utilities/internal/ponyfills/index.js +1 -0
  193. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +1 -0
  194. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +1 -0
  195. package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
  196. package/link/client-awareness/ClientAwarenessLink.js +13 -1
  197. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  198. package/link/core/ApolloLink.js +3 -3
  199. package/link/error/index.d.ts +1 -1
  200. package/link/error/index.js +1 -1
  201. package/link/error/index.js.map +1 -1
  202. package/link/http/checkFetcher.js +1 -1
  203. package/link/http/parseAndCheckHttpResponse.js +1 -1
  204. package/link/persisted-queries/index.js +2 -2
  205. package/link/ws/index.js +1 -1
  206. package/local-state/LocalState.d.ts +3 -2
  207. package/local-state/LocalState.js +28 -14
  208. package/local-state/LocalState.js.map +1 -1
  209. package/masking/types.d.ts +2 -1
  210. package/masking/types.js.map +1 -1
  211. package/package.json +15 -1
  212. package/react/hooks/internal/useDeepMemo.js +2 -0
  213. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  214. package/react/hooks/useBackgroundQuery.js +1 -3
  215. package/react/hooks/useBackgroundQuery.js.map +1 -1
  216. package/react/hooks/useFragment.d.ts +65 -6
  217. package/react/hooks/useFragment.js +38 -87
  218. package/react/hooks/useFragment.js.map +1 -1
  219. package/react/hooks/useLazyQuery.js +2 -0
  220. package/react/hooks/useLazyQuery.js.map +1 -1
  221. package/react/hooks/useMutation.d.ts +13 -1
  222. package/react/hooks/useMutation.js +7 -1
  223. package/react/hooks/useMutation.js.map +1 -1
  224. package/react/hooks/useQuery.js +1 -4
  225. package/react/hooks/useQuery.js.map +1 -1
  226. package/react/hooks/useQueryRefHandlers.js +1 -3
  227. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  228. package/react/hooks/useReadQuery.js +1 -3
  229. package/react/hooks/useReadQuery.js.map +1 -1
  230. package/react/hooks/useSubscription.js +1 -1
  231. package/react/hooks/useSubscription.js.map +1 -1
  232. package/react/hooks/useSuspenseFragment.d.ts +33 -7
  233. package/react/hooks/useSuspenseFragment.js +17 -17
  234. package/react/hooks/useSuspenseFragment.js.map +1 -1
  235. package/react/hooks/useSuspenseQuery.js +4 -4
  236. package/react/hooks/useSuspenseQuery.js.map +1 -1
  237. package/react/hooks-compiled/internal/useDeepMemo.js +2 -0
  238. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  239. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +0 -2
  240. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -1
  241. package/react/hooks-compiled/useBackgroundQuery.js +1 -3
  242. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  243. package/react/hooks-compiled/useFragment.d.ts +65 -6
  244. package/react/hooks-compiled/useFragment.js +110 -88
  245. package/react/hooks-compiled/useFragment.js.map +1 -1
  246. package/react/hooks-compiled/useLazyQuery.js +2 -0
  247. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  248. package/react/hooks-compiled/useLoadableQuery.js +69 -75
  249. package/react/hooks-compiled/useMutation.d.ts +13 -1
  250. package/react/hooks-compiled/useMutation.js +5 -13
  251. package/react/hooks-compiled/useMutation.js.map +1 -1
  252. package/react/hooks-compiled/useQuery.js +44 -56
  253. package/react/hooks-compiled/useQuery.js.map +1 -1
  254. package/react/hooks-compiled/useQueryRefHandlers.js +1 -5
  255. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  256. package/react/hooks-compiled/useReadQuery.js +77 -14
  257. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  258. package/react/hooks-compiled/useSubscription.js +237 -93
  259. package/react/hooks-compiled/useSubscription.js.map +1 -1
  260. package/react/hooks-compiled/useSuspenseFragment.d.ts +33 -7
  261. package/react/hooks-compiled/useSuspenseFragment.js +17 -17
  262. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  263. package/react/hooks-compiled/useSuspenseQuery.js +4 -8
  264. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  265. package/react/index.compiled.d.ts +1 -1
  266. package/react/index.compiled.js +1 -1
  267. package/react/index.compiled.js.map +1 -1
  268. package/react/internal/cache/FragmentReference.d.ts +2 -4
  269. package/react/internal/cache/FragmentReference.js +3 -22
  270. package/react/internal/cache/FragmentReference.js.map +1 -1
  271. package/react/internal/cache/QueryReference.d.ts +5 -0
  272. package/react/internal/cache/QueryReference.js +16 -0
  273. package/react/internal/cache/QueryReference.js.map +1 -1
  274. package/react/internal/cache/SuspenseCache.d.ts +1 -1
  275. package/react/internal/cache/SuspenseCache.js.map +1 -1
  276. package/react/internal/cache/types.d.ts +2 -2
  277. package/react/internal/cache/types.js.map +1 -1
  278. package/react/query-preloader/createQueryPreloader.js +41 -1
  279. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  280. package/react/ssr/useSSRQuery.js +1 -0
  281. package/react/ssr/useSSRQuery.js.map +1 -1
  282. package/utilities/DeepPartial.d.ts +1 -1
  283. package/utilities/DeepPartial.js.map +1 -1
  284. package/utilities/internal/DeepMerger.d.ts +20 -4
  285. package/utilities/internal/DeepMerger.js +36 -4
  286. package/utilities/internal/DeepMerger.js.map +1 -1
  287. package/utilities/internal/combineLatestBatched.d.ts +14 -0
  288. package/utilities/internal/combineLatestBatched.js +68 -0
  289. package/utilities/internal/combineLatestBatched.js.map +1 -0
  290. package/utilities/internal/constants.d.ts +16 -0
  291. package/utilities/internal/constants.js +16 -0
  292. package/utilities/internal/constants.js.map +1 -1
  293. package/utilities/internal/getStoreKeyName.js +1 -0
  294. package/utilities/internal/getStoreKeyName.js.map +1 -1
  295. package/utilities/internal/index.d.ts +4 -1
  296. package/utilities/internal/index.js +3 -1
  297. package/utilities/internal/index.js.map +1 -1
  298. package/utilities/internal/mapObservableFragment.d.ts +3 -0
  299. package/utilities/internal/mapObservableFragment.js +24 -0
  300. package/utilities/internal/mapObservableFragment.js.map +1 -0
  301. package/utilities/internal/memoize.d.ts +2 -1
  302. package/utilities/internal/memoize.js +2 -2
  303. package/utilities/internal/memoize.js.map +1 -1
  304. package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +11 -0
  305. package/utilities/internal/ponyfills/FinalizationRegistry.js +57 -0
  306. package/utilities/internal/ponyfills/FinalizationRegistry.js.map +1 -0
  307. package/utilities/internal/ponyfills/index.d.ts +3 -0
  308. package/utilities/internal/ponyfills/index.js +3 -0
  309. package/utilities/internal/ponyfills/index.js.map +1 -0
  310. package/utilities/internal/ponyfills/index.react-native.d.ts +2 -0
  311. package/utilities/internal/ponyfills/index.react-native.js +2 -0
  312. package/utilities/internal/ponyfills/index.react-native.js.map +1 -0
  313. package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +24 -0
  314. package/utilities/internal/types/ExtensionsWithStreamDetails.js +2 -0
  315. package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +1 -0
  316. package/version.js +1 -1
  317. package/version.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/incremental/index.ts"],"sourcesContent":["export type { Incremental } from \"./types.js\";\nexport { NotImplementedHandler } from \"./handlers/notImplemented.js\";\nexport {\n Defer20220824Handler,\n Defer20220824Handler as GraphQL17Alpha2Handler,\n} from \"./handlers/defer20220824.js\";\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoE;SAElE,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAEE,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAE0B,CAF1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SAGO,CAHP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/incremental/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,IAAI,sBAAsB,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export type { Incremental } from \"./types.js\";\nexport { NotImplementedHandler } from \"./handlers/notImplemented.js\";\nexport {\n Defer20220824Handler,\n Defer20220824Handler as GraphQL17Alpha2Handler,\n} from \"./handlers/defer20220824.js\";\nexport { GraphQL17Alpha9Handler } from \"./handlers/graphql17Alpha9.js\";\n"]}
@@ -20,5 +20,14 @@ export declare namespace Incremental {
20
20
  hasNext: boolean;
21
21
  handle: (cacheData: TData | DeepPartial<TData> | undefined | null, chunk: Chunk) => FormattedExecutionResult<TData>;
22
22
  }
23
+ /**
24
+ * @internal
25
+ *
26
+ * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
27
+ */
28
+ interface StreamFieldInfo {
29
+ isFirstChunk: boolean;
30
+ isLastChunk: boolean;
31
+ }
23
32
  }
24
33
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/incremental/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\n\nexport declare namespace Incremental {\n export type Path = ReadonlyArray<string | number>;\n\n /** @internal */\n export interface Handler<\n Chunk extends Record<string, unknown> = Record<string, unknown>,\n > {\n isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;\n prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;\n extractErrors: (\n result: ApolloLink.Result<any>\n ) => readonly GraphQLFormattedError[] | undefined | void;\n startRequest: <TData extends Record<string, unknown>>(request: {\n query: DocumentNode;\n }) => IncrementalRequest<Chunk, TData>;\n }\n\n export interface IncrementalRequest<\n Chunk extends Record<string, unknown>,\n TData,\n > {\n hasNext: boolean;\n handle: (\n cacheData: TData | DeepPartial<TData> | undefined | null,\n chunk: Chunk\n ) => FormattedExecutionResult<TData>;\n }\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/incremental/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\n\nexport declare namespace Incremental {\n export type Path = ReadonlyArray<string | number>;\n\n /** @internal */\n export interface Handler<\n Chunk extends Record<string, unknown> = Record<string, unknown>,\n > {\n isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;\n prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;\n extractErrors: (\n result: ApolloLink.Result<any>\n ) => readonly GraphQLFormattedError[] | undefined | void;\n startRequest: <TData extends Record<string, unknown>>(request: {\n query: DocumentNode;\n }) => IncrementalRequest<Chunk, TData>;\n }\n\n export interface IncrementalRequest<\n Chunk extends Record<string, unknown>,\n TData,\n > {\n hasNext: boolean;\n handle: (\n cacheData: TData | DeepPartial<TData> | undefined | null,\n chunk: Chunk\n ) => FormattedExecutionResult<TData>;\n }\n\n /** @internal */\n export interface StreamFieldInfo {\n isFirstChunk: boolean;\n isLastChunk: boolean;\n }\n}\n"]}
@@ -272,24 +272,24 @@ you have an infinite render loop in your application.`
272
272
  message: "No fragment named %s"
273
273
  },
274
274
 
275
- 53: {
275
+ 55: {
276
276
  file: "@apollo/client/local-state/LocalState.js",
277
277
  message: "Could not resolve __typename on object %o returned from resolver '%s'. '__typename' needs to be returned to properly resolve child fields."
278
278
  },
279
279
 
280
- 54: {
280
+ 56: {
281
281
  file: "@apollo/client/local-state/LocalState.js",
282
282
  condition: "fragment",
283
283
  message: `No fragment named %s`
284
284
  },
285
285
 
286
- 55: {
286
+ 57: {
287
287
  file: "@apollo/client/local-state/LocalState.js",
288
288
  condition: "cache.fragmentMatches",
289
289
  message: "The configured cache does not support fragment matching which will lead to incorrect results when executing local resolvers. Please use a cache that implements `fragmetMatches`."
290
290
  },
291
291
 
292
- 57: {
292
+ 59: {
293
293
  file: "@apollo/client/link/persisted-queries/index.js",
294
294
  condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
295
295
 
@@ -298,13 +298,13 @@ you have an infinite render loop in your application.`
298
298
  "parameter."
299
299
  },
300
300
 
301
- 58: {
301
+ 60: {
302
302
  file: "@apollo/client/link/persisted-queries/index.js",
303
303
  condition: "forward",
304
304
  message: "PersistedQueryLink cannot be the last link in the chain."
305
305
  },
306
306
 
307
- 59: {
307
+ 61: {
308
308
  file: "@apollo/client/link/http/checkFetcher.js",
309
309
  condition: "fetcher || typeof fetch !== \"undefined\"",
310
310
 
@@ -322,24 +322,30 @@ const client = new ApolloClient({
322
322
  `
323
323
  },
324
324
 
325
- 60: {
325
+ 62: {
326
326
  file: "@apollo/client/link/http/parseAndCheckHttpResponse.js",
327
327
  condition: "response.body && typeof response.body.getReader === \"function\"",
328
328
  message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
329
329
  },
330
330
 
331
- 63: {
331
+ 65: {
332
332
  file: "@apollo/client/link/core/ApolloLink.js",
333
333
  message: "request is not implemented"
334
334
  },
335
335
 
336
- 64: {
336
+ 66: {
337
+ file: "@apollo/client/incremental/handlers/graphql17Alpha9.js",
338
+ condition: "pending",
339
+ message: "Could not find pending chunk for incremental value. Please file an issue for the Apollo Client team to investigate."
340
+ },
341
+
342
+ 67: {
337
343
  file: "@apollo/client/incremental/handlers/notImplemented.js",
338
- condition: "!hasDirectives([\"defer\"], request.query)",
339
- message: "`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
344
+ condition: "!hasDirectives([\"defer\", \"stream\"], request.query)",
345
+ message: "`@defer` and `@stream` are not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
340
346
  },
341
347
 
342
- 65: {
348
+ 68: {
343
349
  file: "@apollo/client/core/ApolloClient.js",
344
350
  condition: "options.cache",
345
351
 
@@ -348,7 +354,7 @@ const client = new ApolloClient({
348
354
  "For more information, please visit: https://go.apollo.dev/c/docs"
349
355
  },
350
356
 
351
- 66: {
357
+ 69: {
352
358
  file: "@apollo/client/core/ApolloClient.js",
353
359
  condition: "options.link",
354
360
 
@@ -357,7 +363,7 @@ const client = new ApolloClient({
357
363
  "For more information, please visit: https://go.apollo.dev/c/docs"
358
364
  },
359
365
 
360
- 67: {
366
+ 70: {
361
367
  file: "@apollo/client/core/ApolloClient.js",
362
368
  condition: "options.fetchPolicy !== \"cache-and-network\"",
363
369
 
@@ -367,7 +373,7 @@ const client = new ApolloClient({
367
373
  "using a different fetchPolicy, such as cache-first or network-only."
368
374
  },
369
375
 
370
- 68: {
376
+ 71: {
371
377
  file: "@apollo/client/core/ApolloClient.js",
372
378
  condition: "options.fetchPolicy !== \"standby\"",
373
379
 
@@ -376,7 +382,7 @@ const client = new ApolloClient({
376
382
  "as cache-first or network-only."
377
383
  },
378
384
 
379
- 69: {
385
+ 72: {
380
386
  file: "@apollo/client/core/ApolloClient.js",
381
387
  condition: "options.query",
382
388
 
@@ -384,164 +390,164 @@ const client = new ApolloClient({
384
390
  "in the query option."
385
391
  },
386
392
 
387
- 70: {
393
+ 73: {
388
394
  file: "@apollo/client/core/ApolloClient.js",
389
395
  condition: "options.query.kind === \"Document\"",
390
396
  message: 'You must wrap the query string in a "gql" tag.'
391
397
  },
392
398
 
393
- 71: {
399
+ 74: {
394
400
  file: "@apollo/client/core/ApolloClient.js",
395
401
  condition: "!options.returnPartialData",
396
402
  message: "returnPartialData option only supported on watchQuery."
397
403
  },
398
404
 
399
- 72: {
405
+ 75: {
400
406
  file: "@apollo/client/core/ApolloClient.js",
401
407
  condition: "!options.pollInterval",
402
408
  message: "pollInterval option only supported on watchQuery."
403
409
  },
404
410
 
405
- 73: {
411
+ 76: {
406
412
  file: "@apollo/client/core/ApolloClient.js",
407
413
  condition: "!options.notifyOnNetworkStatusChange",
408
414
  message: "notifyOnNetworkStatusChange option only supported on watchQuery."
409
415
  },
410
416
 
411
- 74: {
417
+ 77: {
412
418
  file: "@apollo/client/core/ApolloClient.js",
413
419
  condition: "optionsWithDefaults.mutation",
414
420
  message: "The `mutation` option is required. Please provide a GraphQL document in the `mutation` option."
415
421
  },
416
422
 
417
- 75: {
423
+ 78: {
418
424
  file: "@apollo/client/core/ApolloClient.js",
419
425
  condition: "optionsWithDefaults.fetchPolicy === \"network-only\" ||\n optionsWithDefaults.fetchPolicy === \"no-cache\"",
420
426
  message: "Mutations only support 'network-only' or 'no-cache' fetch policies. The default 'network-only' behavior automatically writes mutation results to the cache. Passing 'no-cache' skips the cache write."
421
427
  },
422
428
 
423
- 77: {
429
+ 80: {
424
430
  file: "@apollo/client/core/ObservableQuery.js",
425
431
  condition: "fetchPolicy === \"standby\"",
426
432
  message: "The `variablesUnknown` option can only be used together with a `standby` fetch policy."
427
433
  },
428
434
 
429
- 79: {
435
+ 82: {
430
436
  file: "@apollo/client/core/ObservableQuery.js",
431
437
  condition: "this.options.fetchPolicy !== \"cache-only\"",
432
438
  message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
433
439
  },
434
440
 
435
- 80: {
441
+ 83: {
436
442
  file: "@apollo/client/core/ObservableQuery.js",
437
443
  condition: "updateQuery",
438
444
  message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
439
445
  },
440
446
 
441
- 84: {
447
+ 87: {
442
448
  file: "@apollo/client/core/QueryManager.js",
443
449
  message: "QueryManager stopped while query was in flight"
444
450
  },
445
451
 
446
- 85: {
452
+ 88: {
447
453
  file: "@apollo/client/core/QueryManager.js",
448
454
  condition: "this.localState",
449
455
  message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
450
456
  },
451
457
 
452
- 86: {
458
+ 89: {
453
459
  file: "@apollo/client/core/QueryManager.js",
454
460
  message: "Store reset while query was in flight (not completed in link chain)"
455
461
  },
456
462
 
457
- 89: {
463
+ 92: {
458
464
  file: "@apollo/client/core/QueryManager.js",
459
465
  condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
460
466
  message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
461
467
  },
462
468
 
463
- 90: {
469
+ 93: {
464
470
  file: "@apollo/client/core/QueryManager.js",
465
471
  condition: "this.localState",
466
472
  message: "%s '%s' contains `@client` fields but local state has not been configured."
467
473
  },
468
474
 
469
- 91: {
475
+ 94: {
470
476
  file: "@apollo/client/core/QueryManager.js",
471
477
  condition: "!hasIncrementalDirective",
472
478
  message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
473
479
  },
474
480
 
475
- 92: {
481
+ 95: {
476
482
  file: "@apollo/client/core/QueryManager.js",
477
483
  condition: "this.localState",
478
484
  message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
479
485
  },
480
486
 
481
- 94: {
487
+ 97: {
482
488
  file: "@apollo/client/core/QueryManager.js",
483
489
  condition: "this.localState",
484
490
  message: "Query '%s' contains `@client` fields but local state has not been configured."
485
491
  },
486
492
 
487
- 95: {
493
+ 98: {
488
494
  file: "@apollo/client/core/QueryManager.js",
489
495
  condition: "didEmitValue",
490
496
  message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
491
497
  },
492
498
 
493
- 96: {
499
+ 99: {
494
500
  file: "@apollo/client/cache/inmemory/entityStore.js",
495
501
  condition: "typeof dataId === \"string\"",
496
502
  message: "store.merge expects a string ID"
497
503
  },
498
504
 
499
- 99: {
505
+ 102: {
500
506
  file: "@apollo/client/cache/inmemory/key-extractor.js",
501
507
  condition: "extracted !== void 0",
502
508
  message: `Missing field '%s' while extracting keyFields from %s`
503
509
  },
504
510
 
505
- 100: {
511
+ 103: {
506
512
  file: "@apollo/client/cache/inmemory/policies.js",
507
513
  condition: "!old || old === which",
508
514
  message: `Cannot change root %s __typename more than once`
509
515
  },
510
516
 
511
- 103: {
517
+ 106: {
512
518
  file: "@apollo/client/cache/inmemory/policies.js",
513
519
  message: "Cannot automatically merge arrays"
514
520
  },
515
521
 
516
- 104: {
522
+ 107: {
517
523
  file: "@apollo/client/cache/inmemory/readFromStore.js",
518
524
  message: `No fragment named %s`
519
525
  },
520
526
 
521
- 105: {
527
+ 108: {
522
528
  file: "@apollo/client/cache/inmemory/readFromStore.js",
523
529
  condition: "!isReference(value)",
524
530
  message: `Missing selection set for object of type %s returned for query field %s`
525
531
  },
526
532
 
527
- 106: {
533
+ 109: {
528
534
  file: "@apollo/client/cache/inmemory/writeToStore.js",
529
535
  message: `Could not identify object %s`
530
536
  },
531
537
 
532
- 108: {
538
+ 111: {
533
539
  file: "@apollo/client/cache/inmemory/writeToStore.js",
534
540
  message: `No fragment named %s`
535
541
  }
536
542
  };
537
543
 
538
544
  export const devDebug = {
539
- 76: {
545
+ 79: {
540
546
  file: "@apollo/client/core/ApolloClient.js",
541
547
  message: `In client.refetchQueries, Promise.all promise rejected with error %o`
542
548
  },
543
549
 
544
- 83: {
550
+ 86: {
545
551
  file: "@apollo/client/core/ObservableQuery.js",
546
552
  message: `Missing cache result fields: %o`
547
553
  }
@@ -577,30 +583,40 @@ export const devWarn = {
577
583
 
578
584
  50: {
579
585
  file: "@apollo/client/local-state/LocalState.js",
580
- message: "The '%s' resolver returned `undefined` instead of a value. This is likely a bug in the resolver. If you didn't mean to return a value, return `null` instead."
586
+ message: "The '%s' field resolves the value from the cache, for example from a 'read' function, but a 'no-cache' fetch policy was used. The field value has been set to `null`. Either define a local resolver or use a fetch policy that uses the cache to ensure the field is resolved correctly."
581
587
  },
582
588
 
583
589
  51: {
584
590
  file: "@apollo/client/local-state/LocalState.js",
585
- message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
591
+ message: "Could not find a resolver for the '%s' field nor does the cache resolve the field. The field value has been set to `null`. Either define a resolver for the field or ensure the cache can resolve the value, for example, by adding a 'read' function to a field policy in 'InMemoryCache'."
586
592
  },
587
593
 
588
594
  52: {
595
+ file: "@apollo/client/local-state/LocalState.js",
596
+ message: "The '%s' resolver returned `undefined` instead of a value. This is likely a bug in the resolver. If you didn't mean to return a value, return `null` instead."
597
+ },
598
+
599
+ 53: {
600
+ file: "@apollo/client/local-state/LocalState.js",
601
+ message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
602
+ },
603
+
604
+ 54: {
589
605
  file: "@apollo/client/local-state/LocalState.js",
590
606
  message: "The '%s' field on object %o returned `undefined` instead of a value. The parent resolver did not include the property in the returned value and there was no resolver defined for the field."
591
607
  },
592
608
 
593
- 56: {
609
+ 58: {
594
610
  file: "@apollo/client/link/ws/index.js",
595
611
  message: "`WebSocketLink` uses the deprecated and unmaintained `subscriptions-transport-ws` library. This link is no longer maintained and will be removed in a future major version of Apollo Client. We recommend switching to `GraphQLWsLink` which uses the `graphql-ws` library to send GraphQL operations through WebSocket connections (https://the-guild.dev/graphql/ws)."
596
612
  },
597
613
 
598
- 61: {
614
+ 63: {
599
615
  file: "@apollo/client/link/core/ApolloLink.js",
600
616
  message: "[ApolloLink.split]: The test function returned a non-boolean value which could result in subtle bugs (e.g. such as using an `async` function which always returns a truthy value). Got `%o`."
601
617
  },
602
618
 
603
- 62: {
619
+ 64: {
604
620
  file: "@apollo/client/link/core/ApolloLink.js",
605
621
 
606
622
  message: "The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. " +
@@ -609,34 +625,34 @@ export const devWarn = {
609
625
  "If you are using a split link, ensure each branch contains a terminating link that handles the request."
610
626
  },
611
627
 
612
- 78: {
628
+ 81: {
613
629
  file: "@apollo/client/core/ObservableQuery.js",
614
630
 
615
631
  message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
616
632
  Did you mean to call refetch(variables) instead of refetch({ variables })?`
617
633
  },
618
634
 
619
- 82: {
635
+ 85: {
620
636
  file: "@apollo/client/core/ObservableQuery.js",
621
637
  message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
622
638
  },
623
639
 
624
- 87: {
640
+ 90: {
625
641
  file: "@apollo/client/core/QueryManager.js",
626
642
  message: `Unknown query named "%s" requested in refetchQueries options.include array`
627
643
  },
628
644
 
629
- 88: {
645
+ 91: {
630
646
  file: "@apollo/client/core/QueryManager.js",
631
647
  message: `Unknown anonymous query requested in refetchQueries options.include array`
632
648
  },
633
649
 
634
- 93: {
650
+ 96: {
635
651
  file: "@apollo/client/core/QueryManager.js",
636
652
  message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
637
653
  },
638
654
 
639
- 97: {
655
+ 100: {
640
656
  file: "@apollo/client/cache/inmemory/entityStore.js",
641
657
 
642
658
  message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
@@ -644,24 +660,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
644
660
  "`toReference(object, true)`"
645
661
  },
646
662
 
647
- 98: {
663
+ 101: {
648
664
  file: "@apollo/client/cache/inmemory/entityStore.js",
649
665
 
650
666
  message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
651
667
  "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
652
668
  },
653
669
 
654
- 101: {
670
+ 104: {
655
671
  file: "@apollo/client/cache/inmemory/policies.js",
656
672
  message: `Inferring subtype %s of supertype %s`
657
673
  },
658
674
 
659
- 102: {
675
+ 105: {
660
676
  file: "@apollo/client/cache/inmemory/policies.js",
661
677
  message: `Undefined 'from' passed to readField with arguments %s`
662
678
  },
663
679
 
664
- 109: {
680
+ 112: {
665
681
  file: "@apollo/client/cache/inmemory/writeToStore.js",
666
682
 
667
683
  message: `Cache data may be lost when replacing the %s field of a %s object.
@@ -680,7 +696,7 @@ For more information about these options, please refer to the documentation:
680
696
  `
681
697
  },
682
698
 
683
- 110: {
699
+ 113: {
684
700
  file: "@apollo/client/cache/core/cache.js",
685
701
  message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object."
686
702
  }
@@ -697,12 +713,12 @@ export const devError = {
697
713
  message: "The result of getSnapshot should be cached to avoid an infinite loop"
698
714
  },
699
715
 
700
- 81: {
716
+ 84: {
701
717
  file: "@apollo/client/core/ObservableQuery.js",
702
718
  message: "Unhandled GraphQL subscription error"
703
719
  },
704
720
 
705
- 107: {
721
+ 110: {
706
722
  file: "@apollo/client/cache/inmemory/writeToStore.js",
707
723
  message: `Missing field '%s' while writing result %o`
708
724
  }
@@ -0,0 +1 @@
1
+ export * from "@apollo/client/utilities/internal/ponyfills";
@@ -0,0 +1 @@
1
+ export * from "@apollo/client/utilities/internal/ponyfills";
@@ -0,0 +1 @@
1
+ module.exports = require("@apollo/client/utilities/internal/ponyfills");
@@ -0,0 +1 @@
1
+ export * from "@apollo/client/utilities/internal/ponyfills";
@@ -56,7 +56,7 @@ export declare namespace ClientAwarenessLink {
56
56
  *
57
57
  * @defaultValue "extensions"
58
58
  */
59
- transport?: "extensions" | false;
59
+ transport?: "headers" | "extensions" | false;
60
60
  }
61
61
  interface Options {
62
62
  /**
@@ -42,7 +42,7 @@ export class ClientAwarenessLink extends ApolloLink {
42
42
  {
43
43
  const { name, version, transport = "headers", } = compact({}, clientOptions.clientAwareness, options.clientAwareness, context.clientAwareness);
44
44
  if (transport === "headers") {
45
- operation.setContext(({ headers, extensions }) => {
45
+ operation.setContext(({ headers }) => {
46
46
  return {
47
47
  headers: compact(
48
48
  // setting these first so that they can be overridden by user-provided headers
@@ -66,6 +66,18 @@ export class ClientAwarenessLink extends ApolloLink {
66
66
  },
67
67
  }, operation.extensions);
68
68
  }
69
+ if (transport === "headers") {
70
+ operation.setContext(({ headers }) => {
71
+ return {
72
+ headers: compact(
73
+ // setting these first so that they can be overridden by user-provided headers
74
+ {
75
+ "apollographql-library-name": "@apollo/client",
76
+ "apollographql-library-version": client.version,
77
+ }, headers),
78
+ };
79
+ });
80
+ }
69
81
  }
70
82
  return forward(operation);
71
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ClientAwarenessLink.js","sourceRoot":"","sources":["../../../src/link/client-awareness/ClientAwarenessLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AA4E5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,UAAuC,EAAE;QACnD,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;YAEhC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;YAC3D,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;YACvC,CAAC;gBACC,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,GAAG,SAAS,GACtB,GAAG,OAAO,CACT,EAAE,EACF,aAAa,CAAC,eAAe,EAC7B,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,eAAe,CACxB,CAAC;gBAEF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;oBAC5B,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;wBAC/C,OAAO;4BACL,OAAO,EAAE,OAAO;4BACd,8EAA8E;4BAC9E;gCACE,2BAA2B,EAAE,IAAI;gCACjC,8BAA8B,EAAE,OAAO;6BACxC,EACD,OAAO,CACR;yBACF,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,CAAC;gBACC,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,GAAG,OAAO,CAC1C,EAAE,EACF,aAAa,CAAC,uBAAuB,EACrC,OAAO,CAAC,uBAAuB,CAChC,CAAC;gBACF,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;oBAC/B,SAAS,CAAC,UAAU,GAAG,OAAO;oBAC5B,+EAA+E;oBAC/E;wBACE,aAAa,EAAE;4BACb,IAAI,EAAE,gBAAgB;4BACtB,OAAO,EAAE,MAAM,CAAC,OAAO;yBACxB;qBACF,EACD,SAAS,CAAC,UAAU,CACrB,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n /**\n * Options passed to `ClientAwarenessLink` 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 `ClientAwarenessLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `ClientAwarenessLink`\n * > constructor. If a value is provided to both, the value in `context` takes\n * > precedence.\n */\n export interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/client-awareness!ClientAwarenessLink.Options#clientAwareness:member} */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n }\n\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;\n }\n}\n\n/**\n * `ClientAwarenessLink` provides support for providing client awareness\n * features.\n *\n * @remarks\n *\n * Client awareness adds identifying information about the client to HTTP\n * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).\n * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.\n *\n * Client awareness distinguishes between user-provided client awareness\n * (provided by the `clientAwareness` option) and enhanced client awareness\n * (provided by the `enhancedClientAwareness` option). User-provided client\n * awareness enables you to set a customized client name and version for\n * identification in metrics reporting tools. Enhanced client awareness enables\n * the identification of the Apollo Client package name and version.\n *\n * @example\n *\n * ```ts\n * import { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\n *\n * const link = new ClientAwarenessLink({\n * clientAwareness: {\n * name: \"My Client\",\n * version: \"1\",\n * },\n * enhancedClientAwareness: {\n * transport: \"extensions\",\n * },\n * });\n * ```\n */\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(options: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n options.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers, extensions }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n options.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.version,\n },\n },\n operation.extensions\n );\n }\n }\n\n return forward(operation);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ClientAwarenessLink.js","sourceRoot":"","sources":["../../../src/link/client-awareness/ClientAwarenessLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AA4E5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,UAAuC,EAAE;QACnD,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;YAEhC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC;YAC3D,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;YACvC,CAAC;gBACC,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,GAAG,SAAS,GACtB,GAAG,OAAO,CACT,EAAE,EACF,aAAa,CAAC,eAAe,EAC7B,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,eAAe,CACxB,CAAC;gBAEF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;oBAC5B,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;wBACnC,OAAO;4BACL,OAAO,EAAE,OAAO;4BACd,8EAA8E;4BAC9E;gCACE,2BAA2B,EAAE,IAAI;gCACjC,8BAA8B,EAAE,OAAO;6BACxC,EACD,OAAO,CACR;yBACF,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,CAAC;gBACC,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,GAAG,OAAO,CAC1C,EAAE,EACF,aAAa,CAAC,uBAAuB,EACrC,OAAO,CAAC,uBAAuB,CAChC,CAAC;gBACF,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;oBAC/B,SAAS,CAAC,UAAU,GAAG,OAAO;oBAC5B,+EAA+E;oBAC/E;wBACE,aAAa,EAAE;4BACb,IAAI,EAAE,gBAAgB;4BACtB,OAAO,EAAE,MAAM,CAAC,OAAO;yBACxB;qBACF,EACD,SAAS,CAAC,UAAU,CACrB,CAAC;gBACJ,CAAC;gBAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;oBAC5B,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;wBACnC,OAAO;4BACL,OAAO,EAAE,OAAO;4BACd,8EAA8E;4BAC9E;gCACE,4BAA4B,EAAE,gBAAgB;gCAC9C,+BAA+B,EAAE,MAAM,CAAC,OAAO;6BAChD,EACD,OAAO,CACR;yBACF,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n /**\n * Options passed to `ClientAwarenessLink` 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 `ClientAwarenessLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `ClientAwarenessLink`\n * > constructor. If a value is provided to both, the value in `context` takes\n * > precedence.\n */\n export interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/client-awareness!ClientAwarenessLink.Options#clientAwareness:member} */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n }\n\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"headers\" | \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;\n }\n}\n\n/**\n * `ClientAwarenessLink` provides support for providing client awareness\n * features.\n *\n * @remarks\n *\n * Client awareness adds identifying information about the client to HTTP\n * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).\n * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.\n *\n * Client awareness distinguishes between user-provided client awareness\n * (provided by the `clientAwareness` option) and enhanced client awareness\n * (provided by the `enhancedClientAwareness` option). User-provided client\n * awareness enables you to set a customized client name and version for\n * identification in metrics reporting tools. Enhanced client awareness enables\n * the identification of the Apollo Client package name and version.\n *\n * @example\n *\n * ```ts\n * import { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\n *\n * const link = new ClientAwarenessLink({\n * clientAwareness: {\n * name: \"My Client\",\n * version: \"1\",\n * },\n * enhancedClientAwareness: {\n * transport: \"extensions\",\n * },\n * });\n * ```\n */\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(options: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n options.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n options.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.version,\n },\n },\n operation.extensions\n );\n }\n\n if (transport === \"headers\") {\n operation.setContext(({ headers }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-library-name\": \"@apollo/client\",\n \"apollographql-library-version\": client.version,\n },\n headers\n ),\n };\n });\n }\n }\n\n return forward(operation);\n });\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(61, result);
103
+ __DEV__ && invariant.warn(63, 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(62);
145
+ __DEV__ && invariant.warn(64);
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(63);
249
+ throw newInvariantError(65);
250
250
  }
251
251
  /**
252
252
  * @internal
@@ -62,7 +62,7 @@ export declare function onError(errorHandler: ErrorLink.ErrorHandler): ErrorLink
62
62
  * @remarks
63
63
  *
64
64
  * This link is used after the GraphQL operation completes and execution is
65
- * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
65
+ * moving back up your [link chain](https://apollographql.com/docs/react/api/link/introduction#handling-a-response). The `errorHandler` function should
66
66
  * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
67
67
  *
68
68
  * For more information on the types of errors that might be encountered, see
@@ -15,7 +15,7 @@ export function onError(errorHandler) {
15
15
  * @remarks
16
16
  *
17
17
  * This link is used after the GraphQL operation completes and execution is
18
- * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
18
+ * moving back up your [link chain](https://apollographql.com/docs/react/api/link/introduction#handling-a-response). The `errorHandler` function should
19
19
  * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
20
20
  *
21
21
  * For more information on the types of errors that might be encountered, see