@apollo/client 4.0.10 → 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 (319) hide show
  1. package/CHANGELOG.md +217 -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 +159 -18
  28. package/__cjs/core/ObservableQuery.cjs +173 -128
  29. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  30. package/__cjs/core/ObservableQuery.d.cts +2 -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 +47 -25
  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 +83 -61
  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 +2 -2
  59. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  60. package/__cjs/link/persisted-queries/index.cjs +2 -2
  61. package/__cjs/link/ws/index.cjs +1 -1
  62. package/__cjs/local-state/LocalState.cjs +28 -14
  63. package/__cjs/local-state/LocalState.cjs.map +1 -1
  64. package/__cjs/local-state/LocalState.d.cts +3 -2
  65. package/__cjs/masking/types.d.cts +2 -1
  66. package/__cjs/react/hooks/internal/useDeepMemo.cjs +2 -0
  67. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  68. package/__cjs/react/hooks/useBackgroundQuery.cjs +1 -3
  69. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  70. package/__cjs/react/hooks/useFragment.cjs +38 -87
  71. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  72. package/__cjs/react/hooks/useFragment.d.cts +65 -6
  73. package/__cjs/react/hooks/useLazyQuery.cjs +3 -0
  74. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  75. package/__cjs/react/hooks/useMutation.cjs +7 -1
  76. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  77. package/__cjs/react/hooks/useMutation.d.cts +13 -1
  78. package/__cjs/react/hooks/useQuery.cjs +8 -8
  79. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  80. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  81. package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -3
  82. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  83. package/__cjs/react/hooks/useReadQuery.cjs +1 -3
  84. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  85. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  86. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  87. package/__cjs/react/hooks/useSuspenseFragment.cjs +16 -16
  88. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  89. package/__cjs/react/hooks/useSuspenseFragment.d.cts +33 -7
  90. package/__cjs/react/hooks/useSuspenseQuery.cjs +6 -4
  91. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  92. package/__cjs/react/internal/cache/FragmentReference.cjs +3 -22
  93. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  94. package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -4
  95. package/__cjs/react/internal/cache/QueryReference.cjs +16 -0
  96. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  97. package/__cjs/react/internal/cache/QueryReference.d.cts +5 -0
  98. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  99. package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
  100. package/__cjs/react/internal/cache/types.d.cts +2 -2
  101. package/__cjs/react/query-preloader/createQueryPreloader.cjs +41 -1
  102. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  103. package/__cjs/react/ssr/useSSRQuery.cjs +1 -0
  104. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  105. package/__cjs/utilities/DeepPartial.cjs.map +1 -1
  106. package/__cjs/utilities/DeepPartial.d.cts +1 -1
  107. package/__cjs/utilities/internal/DeepMerger.cjs +36 -4
  108. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  109. package/__cjs/utilities/internal/DeepMerger.d.cts +20 -4
  110. package/__cjs/utilities/internal/combineLatestBatched.cjs +71 -0
  111. package/__cjs/utilities/internal/combineLatestBatched.cjs.map +1 -0
  112. package/__cjs/utilities/internal/combineLatestBatched.d.cts +14 -0
  113. package/__cjs/utilities/internal/constants.cjs +29 -0
  114. package/__cjs/utilities/internal/constants.cjs.map +1 -0
  115. package/__cjs/utilities/internal/constants.d.cts +26 -0
  116. package/__cjs/utilities/internal/getStoreKeyName.cjs +1 -0
  117. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  118. package/__cjs/utilities/internal/index.cjs +10 -2
  119. package/__cjs/utilities/internal/index.cjs.map +1 -1
  120. package/__cjs/utilities/internal/index.d.cts +4 -0
  121. package/__cjs/utilities/internal/mapObservableFragment.cjs +27 -0
  122. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -0
  123. package/__cjs/utilities/internal/mapObservableFragment.d.cts +3 -0
  124. package/__cjs/utilities/internal/memoize.cjs +2 -2
  125. package/__cjs/utilities/internal/memoize.cjs.map +1 -1
  126. package/__cjs/utilities/internal/memoize.d.cts +2 -1
  127. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +61 -0
  128. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +1 -0
  129. package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +11 -0
  130. package/__cjs/utilities/internal/ponyfills/index.cjs +6 -0
  131. package/__cjs/utilities/internal/ponyfills/index.cjs.map +1 -0
  132. package/__cjs/utilities/internal/ponyfills/index.d.cts +3 -0
  133. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +6 -0
  134. package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +1 -0
  135. package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +2 -0
  136. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +3 -0
  137. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +1 -0
  138. package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +24 -0
  139. package/__cjs/version.cjs +1 -1
  140. package/__cjs/version.cjs.map +1 -1
  141. package/cache/core/cache.d.ts +141 -25
  142. package/cache/core/cache.js +219 -55
  143. package/cache/core/cache.js.map +1 -1
  144. package/cache/core/types/Cache.d.ts +77 -17
  145. package/cache/core/types/Cache.js.map +1 -1
  146. package/cache/index.d.ts +1 -1
  147. package/cache/index.js.map +1 -1
  148. package/cache/inmemory/entityStore.js +6 -4
  149. package/cache/inmemory/entityStore.js.map +1 -1
  150. package/cache/inmemory/helpers.d.ts +1 -1
  151. package/cache/inmemory/inMemoryCache.d.ts +48 -0
  152. package/cache/inmemory/inMemoryCache.js +62 -1
  153. package/cache/inmemory/inMemoryCache.js.map +1 -1
  154. package/cache/inmemory/key-extractor.js +1 -1
  155. package/cache/inmemory/key-extractor.js.map +1 -1
  156. package/cache/inmemory/policies.d.ts +30 -6
  157. package/cache/inmemory/policies.js +45 -7
  158. package/cache/inmemory/policies.js.map +1 -1
  159. package/cache/inmemory/readFromStore.js +3 -3
  160. package/cache/inmemory/readFromStore.js.map +1 -1
  161. package/cache/inmemory/types.d.ts +2 -0
  162. package/cache/inmemory/types.js.map +1 -1
  163. package/cache/inmemory/writeToStore.d.ts +2 -1
  164. package/cache/inmemory/writeToStore.js +26 -12
  165. package/cache/inmemory/writeToStore.js.map +1 -1
  166. package/core/ApolloClient.d.ts +159 -18
  167. package/core/ApolloClient.js +32 -50
  168. package/core/ApolloClient.js.map +1 -1
  169. package/core/ObservableQuery.d.ts +2 -0
  170. package/core/ObservableQuery.js +176 -131
  171. package/core/ObservableQuery.js.map +1 -1
  172. package/core/QueryInfo.d.ts +2 -1
  173. package/core/QueryInfo.js +10 -2
  174. package/core/QueryInfo.js.map +1 -1
  175. package/core/QueryManager.d.ts +18 -2
  176. package/core/QueryManager.js +48 -26
  177. package/core/QueryManager.js.map +1 -1
  178. package/incremental/handlers/defer20220824.d.ts +15 -7
  179. package/incremental/handlers/defer20220824.js +44 -19
  180. package/incremental/handlers/defer20220824.js.map +1 -1
  181. package/incremental/handlers/graphql17Alpha9.d.ts +98 -0
  182. package/incremental/handlers/graphql17Alpha9.js +218 -0
  183. package/incremental/handlers/graphql17Alpha9.js.map +1 -0
  184. package/incremental/handlers/notImplemented.js +1 -1
  185. package/incremental/handlers/notImplemented.js.map +1 -1
  186. package/incremental/index.d.ts +1 -0
  187. package/incremental/index.js +3 -2
  188. package/incremental/index.js.map +1 -1
  189. package/incremental/types.d.ts +9 -0
  190. package/incremental/types.js.map +1 -1
  191. package/invariantErrorCodes.js +83 -61
  192. package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +1 -0
  193. package/legacyEntryPoints/utilities/internal/ponyfills/index.js +1 -0
  194. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +1 -0
  195. package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +1 -0
  196. package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
  197. package/link/client-awareness/ClientAwarenessLink.js +13 -1
  198. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  199. package/link/core/ApolloLink.js +3 -3
  200. package/link/error/index.d.ts +1 -1
  201. package/link/error/index.js +1 -1
  202. package/link/error/index.js.map +1 -1
  203. package/link/http/checkFetcher.js +1 -1
  204. package/link/http/parseAndCheckHttpResponse.js +2 -2
  205. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  206. package/link/persisted-queries/index.js +2 -2
  207. package/link/ws/index.js +1 -1
  208. package/local-state/LocalState.d.ts +3 -2
  209. package/local-state/LocalState.js +28 -14
  210. package/local-state/LocalState.js.map +1 -1
  211. package/masking/types.d.ts +2 -1
  212. package/masking/types.js.map +1 -1
  213. package/package.json +15 -1
  214. package/react/hooks/internal/useDeepMemo.js +2 -0
  215. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  216. package/react/hooks/useBackgroundQuery.js +1 -3
  217. package/react/hooks/useBackgroundQuery.js.map +1 -1
  218. package/react/hooks/useFragment.d.ts +65 -6
  219. package/react/hooks/useFragment.js +38 -87
  220. package/react/hooks/useFragment.js.map +1 -1
  221. package/react/hooks/useLazyQuery.js +4 -1
  222. package/react/hooks/useLazyQuery.js.map +1 -1
  223. package/react/hooks/useMutation.d.ts +13 -1
  224. package/react/hooks/useMutation.js +7 -1
  225. package/react/hooks/useMutation.js.map +1 -1
  226. package/react/hooks/useQuery.js +9 -9
  227. package/react/hooks/useQuery.js.map +1 -1
  228. package/react/hooks/useQueryRefHandlers.js +1 -3
  229. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  230. package/react/hooks/useReadQuery.js +1 -3
  231. package/react/hooks/useReadQuery.js.map +1 -1
  232. package/react/hooks/useSubscription.js +1 -1
  233. package/react/hooks/useSubscription.js.map +1 -1
  234. package/react/hooks/useSuspenseFragment.d.ts +33 -7
  235. package/react/hooks/useSuspenseFragment.js +17 -17
  236. package/react/hooks/useSuspenseFragment.js.map +1 -1
  237. package/react/hooks/useSuspenseQuery.js +6 -4
  238. package/react/hooks/useSuspenseQuery.js.map +1 -1
  239. package/react/hooks-compiled/internal/useDeepMemo.js +2 -0
  240. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  241. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +0 -2
  242. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -1
  243. package/react/hooks-compiled/useBackgroundQuery.js +1 -3
  244. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  245. package/react/hooks-compiled/useFragment.d.ts +65 -6
  246. package/react/hooks-compiled/useFragment.js +110 -88
  247. package/react/hooks-compiled/useFragment.js.map +1 -1
  248. package/react/hooks-compiled/useLazyQuery.js +4 -1
  249. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  250. package/react/hooks-compiled/useLoadableQuery.js +69 -75
  251. package/react/hooks-compiled/useMutation.d.ts +13 -1
  252. package/react/hooks-compiled/useMutation.js +5 -13
  253. package/react/hooks-compiled/useMutation.js.map +1 -1
  254. package/react/hooks-compiled/useQuery.js +53 -61
  255. package/react/hooks-compiled/useQuery.js.map +1 -1
  256. package/react/hooks-compiled/useQueryRefHandlers.js +1 -5
  257. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  258. package/react/hooks-compiled/useReadQuery.js +77 -14
  259. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  260. package/react/hooks-compiled/useSubscription.js +237 -93
  261. package/react/hooks-compiled/useSubscription.js.map +1 -1
  262. package/react/hooks-compiled/useSuspenseFragment.d.ts +33 -7
  263. package/react/hooks-compiled/useSuspenseFragment.js +17 -17
  264. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  265. package/react/hooks-compiled/useSuspenseQuery.js +7 -9
  266. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  267. package/react/index.compiled.d.ts +1 -1
  268. package/react/index.compiled.js +1 -1
  269. package/react/index.compiled.js.map +1 -1
  270. package/react/internal/cache/FragmentReference.d.ts +2 -4
  271. package/react/internal/cache/FragmentReference.js +3 -22
  272. package/react/internal/cache/FragmentReference.js.map +1 -1
  273. package/react/internal/cache/QueryReference.d.ts +5 -0
  274. package/react/internal/cache/QueryReference.js +16 -0
  275. package/react/internal/cache/QueryReference.js.map +1 -1
  276. package/react/internal/cache/SuspenseCache.d.ts +1 -1
  277. package/react/internal/cache/SuspenseCache.js.map +1 -1
  278. package/react/internal/cache/types.d.ts +2 -2
  279. package/react/internal/cache/types.js.map +1 -1
  280. package/react/query-preloader/createQueryPreloader.js +41 -1
  281. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  282. package/react/ssr/useSSRQuery.js +1 -0
  283. package/react/ssr/useSSRQuery.js.map +1 -1
  284. package/utilities/DeepPartial.d.ts +1 -1
  285. package/utilities/DeepPartial.js.map +1 -1
  286. package/utilities/internal/DeepMerger.d.ts +20 -4
  287. package/utilities/internal/DeepMerger.js +36 -4
  288. package/utilities/internal/DeepMerger.js.map +1 -1
  289. package/utilities/internal/combineLatestBatched.d.ts +14 -0
  290. package/utilities/internal/combineLatestBatched.js +68 -0
  291. package/utilities/internal/combineLatestBatched.js.map +1 -0
  292. package/utilities/internal/constants.d.ts +26 -0
  293. package/utilities/internal/constants.js +26 -0
  294. package/utilities/internal/constants.js.map +1 -0
  295. package/utilities/internal/getStoreKeyName.js +1 -0
  296. package/utilities/internal/getStoreKeyName.js.map +1 -1
  297. package/utilities/internal/index.d.ts +4 -0
  298. package/utilities/internal/index.js +3 -0
  299. package/utilities/internal/index.js.map +1 -1
  300. package/utilities/internal/mapObservableFragment.d.ts +3 -0
  301. package/utilities/internal/mapObservableFragment.js +24 -0
  302. package/utilities/internal/mapObservableFragment.js.map +1 -0
  303. package/utilities/internal/memoize.d.ts +2 -1
  304. package/utilities/internal/memoize.js +2 -2
  305. package/utilities/internal/memoize.js.map +1 -1
  306. package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +11 -0
  307. package/utilities/internal/ponyfills/FinalizationRegistry.js +57 -0
  308. package/utilities/internal/ponyfills/FinalizationRegistry.js.map +1 -0
  309. package/utilities/internal/ponyfills/index.d.ts +3 -0
  310. package/utilities/internal/ponyfills/index.js +3 -0
  311. package/utilities/internal/ponyfills/index.js.map +1 -0
  312. package/utilities/internal/ponyfills/index.react-native.d.ts +2 -0
  313. package/utilities/internal/ponyfills/index.react-native.js +2 -0
  314. package/utilities/internal/ponyfills/index.react-native.js.map +1 -0
  315. package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +24 -0
  316. package/utilities/internal/types/ExtensionsWithStreamDetails.js +2 -0
  317. package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +1 -0
  318. package/version.js +1 -1
  319. 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,158 +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
- 78: {
429
+ 80: {
430
+ file: "@apollo/client/core/ObservableQuery.js",
431
+ condition: "fetchPolicy === \"standby\"",
432
+ message: "The `variablesUnknown` option can only be used together with a `standby` fetch policy."
433
+ },
434
+
435
+ 82: {
424
436
  file: "@apollo/client/core/ObservableQuery.js",
425
437
  condition: "this.options.fetchPolicy !== \"cache-only\"",
426
438
  message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
427
439
  },
428
440
 
429
- 79: {
441
+ 83: {
430
442
  file: "@apollo/client/core/ObservableQuery.js",
431
443
  condition: "updateQuery",
432
444
  message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
433
445
  },
434
446
 
435
- 83: {
447
+ 87: {
436
448
  file: "@apollo/client/core/QueryManager.js",
437
449
  message: "QueryManager stopped while query was in flight"
438
450
  },
439
451
 
440
- 84: {
452
+ 88: {
441
453
  file: "@apollo/client/core/QueryManager.js",
442
454
  condition: "this.localState",
443
455
  message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
444
456
  },
445
457
 
446
- 85: {
458
+ 89: {
447
459
  file: "@apollo/client/core/QueryManager.js",
448
460
  message: "Store reset while query was in flight (not completed in link chain)"
449
461
  },
450
462
 
451
- 88: {
463
+ 92: {
452
464
  file: "@apollo/client/core/QueryManager.js",
453
465
  condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
454
466
  message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
455
467
  },
456
468
 
457
- 89: {
469
+ 93: {
458
470
  file: "@apollo/client/core/QueryManager.js",
459
471
  condition: "this.localState",
460
472
  message: "%s '%s' contains `@client` fields but local state has not been configured."
461
473
  },
462
474
 
463
- 90: {
475
+ 94: {
464
476
  file: "@apollo/client/core/QueryManager.js",
465
477
  condition: "!hasIncrementalDirective",
466
478
  message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
467
479
  },
468
480
 
469
- 91: {
481
+ 95: {
470
482
  file: "@apollo/client/core/QueryManager.js",
471
483
  condition: "this.localState",
472
484
  message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
473
485
  },
474
486
 
475
- 93: {
487
+ 97: {
476
488
  file: "@apollo/client/core/QueryManager.js",
477
489
  condition: "this.localState",
478
490
  message: "Query '%s' contains `@client` fields but local state has not been configured."
479
491
  },
480
492
 
481
- 94: {
493
+ 98: {
482
494
  file: "@apollo/client/core/QueryManager.js",
483
495
  condition: "didEmitValue",
484
496
  message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
485
497
  },
486
498
 
487
- 95: {
499
+ 99: {
488
500
  file: "@apollo/client/cache/inmemory/entityStore.js",
489
501
  condition: "typeof dataId === \"string\"",
490
502
  message: "store.merge expects a string ID"
491
503
  },
492
504
 
493
- 98: {
505
+ 102: {
494
506
  file: "@apollo/client/cache/inmemory/key-extractor.js",
495
507
  condition: "extracted !== void 0",
496
508
  message: `Missing field '%s' while extracting keyFields from %s`
497
509
  },
498
510
 
499
- 99: {
511
+ 103: {
500
512
  file: "@apollo/client/cache/inmemory/policies.js",
501
513
  condition: "!old || old === which",
502
514
  message: `Cannot change root %s __typename more than once`
503
515
  },
504
516
 
505
- 102: {
517
+ 106: {
506
518
  file: "@apollo/client/cache/inmemory/policies.js",
507
519
  message: "Cannot automatically merge arrays"
508
520
  },
509
521
 
510
- 103: {
522
+ 107: {
511
523
  file: "@apollo/client/cache/inmemory/readFromStore.js",
512
524
  message: `No fragment named %s`
513
525
  },
514
526
 
515
- 104: {
527
+ 108: {
516
528
  file: "@apollo/client/cache/inmemory/readFromStore.js",
517
529
  condition: "!isReference(value)",
518
530
  message: `Missing selection set for object of type %s returned for query field %s`
519
531
  },
520
532
 
521
- 105: {
533
+ 109: {
522
534
  file: "@apollo/client/cache/inmemory/writeToStore.js",
523
535
  message: `Could not identify object %s`
524
536
  },
525
537
 
526
- 107: {
538
+ 111: {
527
539
  file: "@apollo/client/cache/inmemory/writeToStore.js",
528
540
  message: `No fragment named %s`
529
541
  }
530
542
  };
531
543
 
532
544
  export const devDebug = {
533
- 76: {
545
+ 79: {
534
546
  file: "@apollo/client/core/ApolloClient.js",
535
547
  message: `In client.refetchQueries, Promise.all promise rejected with error %o`
536
548
  },
537
549
 
538
- 82: {
550
+ 86: {
539
551
  file: "@apollo/client/core/ObservableQuery.js",
540
552
  message: `Missing cache result fields: %o`
541
553
  }
@@ -571,30 +583,40 @@ export const devWarn = {
571
583
 
572
584
  50: {
573
585
  file: "@apollo/client/local-state/LocalState.js",
574
- 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."
575
587
  },
576
588
 
577
589
  51: {
578
590
  file: "@apollo/client/local-state/LocalState.js",
579
- 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'."
580
592
  },
581
593
 
582
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: {
583
605
  file: "@apollo/client/local-state/LocalState.js",
584
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."
585
607
  },
586
608
 
587
- 56: {
609
+ 58: {
588
610
  file: "@apollo/client/link/ws/index.js",
589
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)."
590
612
  },
591
613
 
592
- 61: {
614
+ 63: {
593
615
  file: "@apollo/client/link/core/ApolloLink.js",
594
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`."
595
617
  },
596
618
 
597
- 62: {
619
+ 64: {
598
620
  file: "@apollo/client/link/core/ApolloLink.js",
599
621
 
600
622
  message: "The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. " +
@@ -603,34 +625,34 @@ export const devWarn = {
603
625
  "If you are using a split link, ensure each branch contains a terminating link that handles the request."
604
626
  },
605
627
 
606
- 77: {
628
+ 81: {
607
629
  file: "@apollo/client/core/ObservableQuery.js",
608
630
 
609
631
  message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
610
632
  Did you mean to call refetch(variables) instead of refetch({ variables })?`
611
633
  },
612
634
 
613
- 81: {
635
+ 85: {
614
636
  file: "@apollo/client/core/ObservableQuery.js",
615
637
  message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
616
638
  },
617
639
 
618
- 86: {
640
+ 90: {
619
641
  file: "@apollo/client/core/QueryManager.js",
620
642
  message: `Unknown query named "%s" requested in refetchQueries options.include array`
621
643
  },
622
644
 
623
- 87: {
645
+ 91: {
624
646
  file: "@apollo/client/core/QueryManager.js",
625
647
  message: `Unknown anonymous query requested in refetchQueries options.include array`
626
648
  },
627
649
 
628
- 92: {
650
+ 96: {
629
651
  file: "@apollo/client/core/QueryManager.js",
630
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.'
631
653
  },
632
654
 
633
- 96: {
655
+ 100: {
634
656
  file: "@apollo/client/cache/inmemory/entityStore.js",
635
657
 
636
658
  message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
@@ -638,24 +660,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
638
660
  "`toReference(object, true)`"
639
661
  },
640
662
 
641
- 97: {
663
+ 101: {
642
664
  file: "@apollo/client/cache/inmemory/entityStore.js",
643
665
 
644
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" +
645
667
  "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
646
668
  },
647
669
 
648
- 100: {
670
+ 104: {
649
671
  file: "@apollo/client/cache/inmemory/policies.js",
650
672
  message: `Inferring subtype %s of supertype %s`
651
673
  },
652
674
 
653
- 101: {
675
+ 105: {
654
676
  file: "@apollo/client/cache/inmemory/policies.js",
655
677
  message: `Undefined 'from' passed to readField with arguments %s`
656
678
  },
657
679
 
658
- 108: {
680
+ 112: {
659
681
  file: "@apollo/client/cache/inmemory/writeToStore.js",
660
682
 
661
683
  message: `Cache data may be lost when replacing the %s field of a %s object.
@@ -674,7 +696,7 @@ For more information about these options, please refer to the documentation:
674
696
  `
675
697
  },
676
698
 
677
- 109: {
699
+ 113: {
678
700
  file: "@apollo/client/cache/core/cache.js",
679
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."
680
702
  }
@@ -691,12 +713,12 @@ export const devError = {
691
713
  message: "The result of getSnapshot should be cached to avoid an infinite loop"
692
714
  },
693
715
 
694
- 80: {
716
+ 84: {
695
717
  file: "@apollo/client/core/ObservableQuery.js",
696
718
  message: "Unhandled GraphQL subscription error"
697
719
  },
698
720
 
699
- 106: {
721
+ 110: {
700
722
  file: "@apollo/client/cache/inmemory/writeToStore.js",
701
723
  message: `Missing field '%s' while writing result %o`
702
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