@apollo/client 4.0.0-rc.6 → 4.0.0-rc.8

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 (351) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/__cjs/cache/core/cache.cjs +12 -7
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +12 -7
  5. package/__cjs/core/ApolloClient.cjs +2 -2
  6. package/__cjs/core/ApolloClient.cjs.map +1 -1
  7. package/__cjs/core/ApolloClient.d.cts +80 -98
  8. package/__cjs/core/ObservableQuery.d.cts +41 -74
  9. package/__cjs/core/QueryInfo.cjs.map +1 -1
  10. package/__cjs/core/QueryInfo.d.cts +3 -3
  11. package/__cjs/core/QueryManager.cjs +0 -2
  12. package/__cjs/core/QueryManager.cjs.map +1 -1
  13. package/__cjs/core/QueryManager.d.cts +3 -3
  14. package/__cjs/core/index.cjs +1 -2
  15. package/__cjs/core/index.cjs.map +1 -1
  16. package/__cjs/core/index.d.cts +2 -3
  17. package/__cjs/core/types.d.cts +40 -28
  18. package/__cjs/errors/CombinedGraphQLErrors.cjs +22 -17
  19. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  20. package/__cjs/errors/CombinedGraphQLErrors.d.cts +39 -20
  21. package/__cjs/errors/CombinedProtocolErrors.cjs +12 -6
  22. package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
  23. package/__cjs/errors/CombinedProtocolErrors.d.cts +12 -6
  24. package/__cjs/errors/ServerError.cjs +2 -1
  25. package/__cjs/errors/ServerError.cjs.map +1 -1
  26. package/__cjs/errors/ServerError.d.cts +2 -1
  27. package/__cjs/errors/ServerParseError.cjs +2 -1
  28. package/__cjs/errors/ServerParseError.cjs.map +1 -1
  29. package/__cjs/errors/ServerParseError.d.cts +2 -1
  30. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  31. package/__cjs/incremental/handlers/defer20220824.d.cts +4 -4
  32. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  33. package/__cjs/incremental/handlers/notImplemented.d.cts +2 -2
  34. package/__cjs/incremental/types.d.cts +4 -4
  35. package/__cjs/invariantErrorCodes.cjs +15 -11
  36. package/__cjs/link/batch/batchLink.cjs +4 -12
  37. package/__cjs/link/batch/batchLink.cjs.map +1 -1
  38. package/__cjs/link/batch/batchLink.d.cts +36 -28
  39. package/__cjs/link/batch/batching.cjs +1 -1
  40. package/__cjs/link/batch/batching.cjs.map +1 -1
  41. package/__cjs/link/batch/batching.d.cts +8 -8
  42. package/__cjs/link/batch/index.cjs +1 -2
  43. package/__cjs/link/batch/index.cjs.map +1 -1
  44. package/__cjs/link/batch/index.d.cts +1 -2
  45. package/__cjs/link/batch-http/batchHttpLink.cjs +29 -6
  46. package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
  47. package/__cjs/link/batch-http/batchHttpLink.d.cts +45 -6
  48. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +33 -0
  49. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  50. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +35 -2
  51. package/__cjs/link/context/index.cjs.map +1 -1
  52. package/__cjs/link/context/index.d.cts +3 -4
  53. package/__cjs/link/core/ApolloLink.cjs +226 -54
  54. package/__cjs/link/core/ApolloLink.cjs.map +1 -1
  55. package/__cjs/link/core/ApolloLink.d.cts +355 -9
  56. package/__cjs/link/core/concat.cjs +4 -0
  57. package/__cjs/link/core/concat.cjs.map +1 -1
  58. package/__cjs/link/core/concat.d.cts +4 -0
  59. package/__cjs/link/core/deprecated.cjs +3 -0
  60. package/__cjs/link/core/deprecated.cjs.map +1 -0
  61. package/__cjs/link/core/deprecated.d.cts +10 -0
  62. package/__cjs/link/core/empty.cjs +4 -0
  63. package/__cjs/link/core/empty.cjs.map +1 -1
  64. package/__cjs/link/core/empty.d.cts +4 -0
  65. package/__cjs/link/core/from.cjs +4 -0
  66. package/__cjs/link/core/from.cjs.map +1 -1
  67. package/__cjs/link/core/from.d.cts +4 -0
  68. package/__cjs/link/core/split.cjs +4 -0
  69. package/__cjs/link/core/split.cjs.map +1 -1
  70. package/__cjs/link/core/split.d.cts +4 -0
  71. package/__cjs/link/core/types.d.cts +2 -33
  72. package/__cjs/link/error/index.cjs +44 -0
  73. package/__cjs/link/error/index.cjs.map +1 -1
  74. package/__cjs/link/error/index.d.cts +68 -9
  75. package/__cjs/link/http/BaseHttpLink.cjs +3 -4
  76. package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
  77. package/__cjs/link/http/HttpLink.cjs +26 -1
  78. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  79. package/__cjs/link/http/HttpLink.d.cts +191 -89
  80. package/__cjs/link/http/index.cjs +1 -3
  81. package/__cjs/link/http/index.cjs.map +1 -1
  82. package/__cjs/link/http/index.d.cts +0 -2
  83. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +40 -25
  84. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  85. package/__cjs/link/http/parseAndCheckHttpResponse.d.cts +2 -2
  86. package/__cjs/link/http/rewriteURIForGET.cjs +2 -3
  87. package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
  88. package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
  89. package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +3 -3
  90. package/__cjs/link/http/selectURI.cjs.map +1 -1
  91. package/__cjs/link/http/selectURI.d.cts +2 -2
  92. package/__cjs/link/index.cjs.map +1 -1
  93. package/__cjs/link/index.d.cts +2 -1
  94. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  95. package/__cjs/link/persisted-queries/index.d.cts +23 -25
  96. package/__cjs/link/remove-typename/index.cjs.map +1 -1
  97. package/__cjs/link/remove-typename/index.d.cts +0 -1
  98. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  99. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +9 -8
  100. package/__cjs/link/retry/delayFunction.cjs.map +1 -1
  101. package/__cjs/link/retry/delayFunction.d.cts +2 -39
  102. package/__cjs/link/retry/retryFunction.cjs.map +1 -1
  103. package/__cjs/link/retry/retryFunction.d.cts +2 -29
  104. package/__cjs/link/retry/retryLink.cjs +12 -9
  105. package/__cjs/link/retry/retryLink.cjs.map +1 -1
  106. package/__cjs/link/retry/retryLink.d.cts +57 -6
  107. package/__cjs/link/schema/index.cjs.map +1 -1
  108. package/__cjs/link/schema/index.d.cts +3 -4
  109. package/__cjs/link/subscriptions/index.cjs +23 -0
  110. package/__cjs/link/subscriptions/index.cjs.map +1 -1
  111. package/__cjs/link/subscriptions/index.d.cts +24 -2
  112. package/__cjs/link/utils/createOperation.cjs +12 -4
  113. package/__cjs/link/utils/createOperation.cjs.map +1 -1
  114. package/__cjs/link/utils/createOperation.d.cts +2 -2
  115. package/__cjs/link/utils/index.cjs +1 -5
  116. package/__cjs/link/utils/index.cjs.map +1 -1
  117. package/__cjs/link/utils/index.d.cts +0 -2
  118. package/__cjs/link/ws/index.cjs +17 -1
  119. package/__cjs/link/ws/index.cjs.map +1 -1
  120. package/__cjs/link/ws/index.d.cts +8 -2
  121. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  122. package/__cjs/react/hooks/useBackgroundQuery.d.cts +125 -93
  123. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  124. package/__cjs/react/hooks/useFragment.d.cts +2 -2
  125. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  126. package/__cjs/react/hooks/useLazyQuery.d.cts +70 -108
  127. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  128. package/__cjs/react/hooks/useLoadableQuery.d.cts +52 -61
  129. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  130. package/__cjs/react/hooks/useMutation.d.cts +36 -54
  131. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  132. package/__cjs/react/hooks/useQuery.d.cts +64 -105
  133. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  134. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +17 -8
  135. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  136. package/__cjs/react/hooks/useReadQuery.d.cts +6 -9
  137. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  138. package/__cjs/react/hooks/useSubscription.d.cts +32 -24
  139. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  140. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  141. package/__cjs/react/hooks/useSuspenseQuery.d.cts +75 -94
  142. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  143. package/__cjs/react/internal/cache/QueryReference.d.cts +3 -1
  144. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  145. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +29 -20
  146. package/__cjs/react/types/types.documentation.d.cts +5 -5
  147. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  148. package/__cjs/testing/core/mocking/mockLink.d.cts +5 -6
  149. package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
  150. package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +3 -4
  151. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +20 -28
  152. package/__cjs/utilities/internal/types/VariablesOption.d.cts +2 -6
  153. package/__cjs/utilities/subscriptions/relay/index.cjs +1 -2
  154. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  155. package/__cjs/version.cjs +1 -1
  156. package/cache/core/cache.d.ts +12 -7
  157. package/cache/core/cache.js +12 -7
  158. package/cache/core/cache.js.map +1 -1
  159. package/core/ApolloClient.d.ts +80 -98
  160. package/core/ApolloClient.js +2 -2
  161. package/core/ApolloClient.js.map +1 -1
  162. package/core/ObservableQuery.d.ts +41 -74
  163. package/core/QueryInfo.d.ts +3 -3
  164. package/core/QueryInfo.js.map +1 -1
  165. package/core/QueryManager.d.ts +3 -3
  166. package/core/QueryManager.js +0 -2
  167. package/core/QueryManager.js.map +1 -1
  168. package/core/index.d.ts +2 -3
  169. package/core/index.js +1 -1
  170. package/core/index.js.map +1 -1
  171. package/core/types.d.ts +40 -28
  172. package/errors/CombinedGraphQLErrors.d.ts +39 -20
  173. package/errors/CombinedGraphQLErrors.js +22 -17
  174. package/errors/CombinedGraphQLErrors.js.map +1 -1
  175. package/errors/CombinedProtocolErrors.d.ts +12 -6
  176. package/errors/CombinedProtocolErrors.js +12 -6
  177. package/errors/CombinedProtocolErrors.js.map +1 -1
  178. package/errors/ServerError.d.ts +2 -1
  179. package/errors/ServerError.js +2 -1
  180. package/errors/ServerError.js.map +1 -1
  181. package/errors/ServerParseError.d.ts +2 -1
  182. package/errors/ServerParseError.js +2 -1
  183. package/errors/ServerParseError.js.map +1 -1
  184. package/incremental/handlers/defer20220824.d.ts +4 -4
  185. package/incremental/handlers/defer20220824.js.map +1 -1
  186. package/incremental/handlers/notImplemented.d.ts +2 -2
  187. package/incremental/handlers/notImplemented.js.map +1 -1
  188. package/incremental/types.d.ts +4 -4
  189. package/incremental/types.js.map +1 -1
  190. package/invariantErrorCodes.js +15 -11
  191. package/link/batch/batchLink.d.ts +37 -29
  192. package/link/batch/batchLink.js +3 -10
  193. package/link/batch/batchLink.js.map +1 -1
  194. package/link/batch/batching.d.ts +8 -8
  195. package/link/batch/batching.js +2 -2
  196. package/link/batch/batching.js.map +1 -1
  197. package/link/batch/index.d.ts +1 -2
  198. package/link/batch/index.js +1 -1
  199. package/link/batch/index.js.map +1 -1
  200. package/link/batch-http/batchHttpLink.d.ts +46 -7
  201. package/link/batch-http/batchHttpLink.js +30 -7
  202. package/link/batch-http/batchHttpLink.js.map +1 -1
  203. package/link/client-awareness/ClientAwarenessLink.d.ts +35 -2
  204. package/link/client-awareness/ClientAwarenessLink.js +33 -0
  205. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  206. package/link/context/index.d.ts +3 -4
  207. package/link/context/index.js.map +1 -1
  208. package/link/core/ApolloLink.d.ts +355 -9
  209. package/link/core/ApolloLink.js +227 -56
  210. package/link/core/ApolloLink.js.map +1 -1
  211. package/link/core/concat.d.ts +4 -0
  212. package/link/core/concat.js +4 -0
  213. package/link/core/concat.js.map +1 -1
  214. package/link/core/deprecated.d.ts +10 -0
  215. package/link/core/deprecated.js +2 -0
  216. package/link/core/deprecated.js.map +1 -0
  217. package/link/core/empty.d.ts +4 -0
  218. package/link/core/empty.js +4 -0
  219. package/link/core/empty.js.map +1 -1
  220. package/link/core/from.d.ts +4 -0
  221. package/link/core/from.js +4 -0
  222. package/link/core/from.js.map +1 -1
  223. package/link/core/split.d.ts +4 -0
  224. package/link/core/split.js +4 -0
  225. package/link/core/split.js.map +1 -1
  226. package/link/core/types.d.ts +2 -33
  227. package/link/core/types.js.map +1 -1
  228. package/link/error/index.d.ts +69 -10
  229. package/link/error/index.js +44 -0
  230. package/link/error/index.js.map +1 -1
  231. package/link/http/BaseHttpLink.js +3 -4
  232. package/link/http/BaseHttpLink.js.map +1 -1
  233. package/link/http/HttpLink.d.ts +192 -90
  234. package/link/http/HttpLink.js +26 -1
  235. package/link/http/HttpLink.js.map +1 -1
  236. package/link/http/index.d.ts +0 -2
  237. package/link/http/index.js +0 -1
  238. package/link/http/index.js.map +1 -1
  239. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  240. package/link/http/parseAndCheckHttpResponse.js +40 -25
  241. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  242. package/link/http/rewriteURIForGET.js +2 -3
  243. package/link/http/rewriteURIForGET.js.map +1 -1
  244. package/link/http/selectHttpOptionsAndBody.d.ts +3 -3
  245. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  246. package/link/http/selectURI.d.ts +2 -2
  247. package/link/http/selectURI.js.map +1 -1
  248. package/link/index.d.ts +2 -1
  249. package/link/index.js.map +1 -1
  250. package/link/persisted-queries/index.d.ts +23 -25
  251. package/link/persisted-queries/index.js.map +1 -1
  252. package/link/remove-typename/index.d.ts +0 -1
  253. package/link/remove-typename/index.js.map +1 -1
  254. package/link/remove-typename/removeTypenameFromVariables.d.ts +9 -8
  255. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  256. package/link/retry/delayFunction.d.ts +2 -39
  257. package/link/retry/delayFunction.js.map +1 -1
  258. package/link/retry/retryFunction.d.ts +2 -29
  259. package/link/retry/retryFunction.js.map +1 -1
  260. package/link/retry/retryLink.d.ts +57 -6
  261. package/link/retry/retryLink.js +13 -10
  262. package/link/retry/retryLink.js.map +1 -1
  263. package/link/schema/index.d.ts +3 -4
  264. package/link/schema/index.js.map +1 -1
  265. package/link/subscriptions/index.d.ts +24 -2
  266. package/link/subscriptions/index.js +23 -0
  267. package/link/subscriptions/index.js.map +1 -1
  268. package/link/utils/createOperation.d.ts +2 -2
  269. package/link/utils/createOperation.js +12 -4
  270. package/link/utils/createOperation.js.map +1 -1
  271. package/link/utils/index.d.ts +0 -2
  272. package/link/utils/index.js +0 -2
  273. package/link/utils/index.js.map +1 -1
  274. package/link/ws/index.d.ts +8 -2
  275. package/link/ws/index.js +13 -1
  276. package/link/ws/index.js.map +1 -1
  277. package/package.json +1 -1
  278. package/react/hooks/useBackgroundQuery.d.ts +125 -93
  279. package/react/hooks/useBackgroundQuery.js.map +1 -1
  280. package/react/hooks/useFragment.d.ts +2 -2
  281. package/react/hooks/useFragment.js.map +1 -1
  282. package/react/hooks/useLazyQuery.d.ts +70 -108
  283. package/react/hooks/useLazyQuery.js.map +1 -1
  284. package/react/hooks/useLoadableQuery.d.ts +52 -61
  285. package/react/hooks/useLoadableQuery.js.map +1 -1
  286. package/react/hooks/useMutation.d.ts +36 -54
  287. package/react/hooks/useMutation.js.map +1 -1
  288. package/react/hooks/useQuery.d.ts +64 -105
  289. package/react/hooks/useQuery.js.map +1 -1
  290. package/react/hooks/useQueryRefHandlers.d.ts +17 -8
  291. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  292. package/react/hooks/useReadQuery.d.ts +6 -9
  293. package/react/hooks/useReadQuery.js.map +1 -1
  294. package/react/hooks/useSubscription.d.ts +32 -24
  295. package/react/hooks/useSubscription.js.map +1 -1
  296. package/react/hooks/useSuspenseFragment.js.map +1 -1
  297. package/react/hooks/useSuspenseQuery.d.ts +75 -94
  298. package/react/hooks/useSuspenseQuery.js.map +1 -1
  299. package/react/hooks-compiled/useBackgroundQuery.d.ts +125 -93
  300. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  301. package/react/hooks-compiled/useFragment.d.ts +2 -2
  302. package/react/hooks-compiled/useFragment.js.map +1 -1
  303. package/react/hooks-compiled/useLazyQuery.d.ts +70 -108
  304. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  305. package/react/hooks-compiled/useLoadableQuery.d.ts +52 -61
  306. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  307. package/react/hooks-compiled/useMutation.d.ts +36 -54
  308. package/react/hooks-compiled/useMutation.js.map +1 -1
  309. package/react/hooks-compiled/useQuery.d.ts +64 -105
  310. package/react/hooks-compiled/useQuery.js.map +1 -1
  311. package/react/hooks-compiled/useQueryRefHandlers.d.ts +17 -8
  312. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  313. package/react/hooks-compiled/useReadQuery.d.ts +6 -9
  314. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  315. package/react/hooks-compiled/useSubscription.d.ts +32 -24
  316. package/react/hooks-compiled/useSubscription.js.map +1 -1
  317. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  318. package/react/hooks-compiled/useSuspenseQuery.d.ts +75 -94
  319. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  320. package/react/internal/cache/QueryReference.d.ts +3 -1
  321. package/react/internal/cache/QueryReference.js.map +1 -1
  322. package/react/query-preloader/createQueryPreloader.d.ts +29 -20
  323. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  324. package/react/types/types.documentation.d.ts +5 -5
  325. package/testing/core/mocking/mockLink.d.ts +5 -6
  326. package/testing/core/mocking/mockLink.js.map +1 -1
  327. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -4
  328. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  329. package/utilities/internal/types/DocumentationTypes.d.ts +20 -28
  330. package/utilities/internal/types/VariablesOption.d.ts +2 -6
  331. package/utilities/subscriptions/relay/index.js +1 -2
  332. package/utilities/subscriptions/relay/index.js.map +1 -1
  333. package/version.js +1 -1
  334. package/__cjs/link/http/serializeFetchParameter.cjs +0 -18
  335. package/__cjs/link/http/serializeFetchParameter.cjs.map +0 -1
  336. package/__cjs/link/http/serializeFetchParameter.d.cts +0 -6
  337. package/__cjs/link/utils/transformOperation.cjs +0 -22
  338. package/__cjs/link/utils/transformOperation.cjs.map +0 -1
  339. package/__cjs/link/utils/transformOperation.d.cts +0 -3
  340. package/__cjs/link/utils/validateOperation.cjs +0 -21
  341. package/__cjs/link/utils/validateOperation.cjs.map +0 -1
  342. package/__cjs/link/utils/validateOperation.d.cts +0 -3
  343. package/link/http/serializeFetchParameter.d.ts +0 -6
  344. package/link/http/serializeFetchParameter.js +0 -14
  345. package/link/http/serializeFetchParameter.js.map +0 -1
  346. package/link/utils/transformOperation.d.ts +0 -3
  347. package/link/utils/transformOperation.js +0 -19
  348. package/link/utils/transformOperation.js.map +0 -1
  349. package/link/utils/validateOperation.d.ts +0 -3
  350. package/link/utils/validateOperation.js +0 -18
  351. package/link/utils/validateOperation.js.map +0 -1
@@ -1,15 +1,361 @@
1
+ import type { DocumentNode, FormattedExecutionResult, OperationTypeNode } from "graphql";
1
2
  import type { Observable } from "rxjs";
2
- import type { ExecuteContext, FetchResult, GraphQLRequest, NextLink, Operation, RequestHandler } from "./types.cjs";
3
+ import type { ApolloClient, DefaultContext, OperationVariables } from "@apollo/client";
4
+ import type { AdditionalApolloLinkResultTypes } from "./types.cjs";
5
+ export declare namespace ApolloLink {
6
+ /**
7
+ * Context provided for link execution, such as the client executing the
8
+ * request. It is separate from the request operation context.
9
+ */
10
+ interface ExecuteContext {
11
+ /**
12
+ * The Apollo Client instance that executed the GraphQL request.
13
+ */
14
+ client: ApolloClient;
15
+ }
16
+ /**
17
+ * A function that when called will execute the next link in the link chain.
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * const link = new ApolloLink((operation, forward) => {
23
+ * // process the request
24
+ *
25
+ * // Call `forward` to execute the next link in the chain
26
+ * return forward(operation);
27
+ * });
28
+ * ```
29
+ *
30
+ * @param operation - The current `ApolloLink.Operation` object for the
31
+ * request.
32
+ */
33
+ type ForwardFunction = (operation: ApolloLink.Operation) => Observable<ApolloLink.Result>;
34
+ /**
35
+ * The input object provided to `ApolloLink.execute` to send a GraphQL request through
36
+ * the link chain.
37
+ */
38
+ interface Request {
39
+ /**
40
+ * The parsed GraphQL document that will be sent with the GraphQL request to
41
+ * the server.
42
+ */
43
+ query: DocumentNode;
44
+ /**
45
+ * The variables provided for the query.
46
+ */
47
+ variables?: OperationVariables;
48
+ /**
49
+ * Context provided to the link chain. Context is not sent to the server and
50
+ * is used to communicate additional metadata from a request to individual
51
+ * links in the link chain.
52
+ */
53
+ context?: DefaultContext;
54
+ /**
55
+ * A map of extensions that will be sent with the GraphQL request to the
56
+ * server.
57
+ */
58
+ extensions?: Record<string, any>;
59
+ }
60
+ /**
61
+ * A request handler is responsible for performing some logic and executing the
62
+ * request, either by [forwarding](https://apollographql.com/docs/react/api/link/introduction#the-request-handler) the operation to the next link in the
63
+ * chain, or sending the operation to the destination that executes it, such as
64
+ * a GraphQL server.
65
+ *
66
+ * @param operation - The `Operation` object that provides information about the
67
+ * currently executed GraphQL request.
68
+ *
69
+ * @param forward - A function that is called to execute the next link in the
70
+ * chain.
71
+ */
72
+ type RequestHandler = (operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction) => Observable<ApolloLink.Result>;
73
+ type Result<TData = Record<string, any>, TExtensions = Record<string, any>> = FormattedExecutionResult<TData, TExtensions> | AdditionalApolloLinkResultTypes<TData, TExtensions>[keyof AdditionalApolloLinkResultTypes<TData, TExtensions>];
74
+ /**
75
+ * The currently executed operation object provided to an `ApolloLink.RequestHandler`
76
+ * for each link in the link chain.
77
+ */
78
+ interface Operation {
79
+ /**
80
+ * A `DocumentNode` that describes the operation taking place.
81
+ */
82
+ query: DocumentNode;
83
+ /**
84
+ * A map of GraphQL variables being sent with the operation.
85
+ */
86
+ variables: OperationVariables;
87
+ /**
88
+ * The string name of the GraphQL operation. If it is anonymous,
89
+ * `operationName` will be `undefined`.
90
+ */
91
+ operationName: string | undefined;
92
+ /**
93
+ * The type of the GraphQL operation, such as query or mutation.
94
+ */
95
+ operationType: OperationTypeNode;
96
+ /**
97
+ * A map that stores extensions data to be sent to the server.
98
+ */
99
+ extensions: Record<string, any>;
100
+ /**
101
+ * A function that takes either a new context object, or a function which
102
+ * takes in the previous context and returns a new one. See [managing
103
+ * context](https://apollographql.com/docs/react/api/link/introduction#managing-context).
104
+ */
105
+ setContext: {
106
+ (context: Partial<ApolloLink.OperationContext>): void;
107
+ (updateContext: (previousContext: Readonly<ApolloLink.OperationContext>) => Partial<ApolloLink.OperationContext>): void;
108
+ };
109
+ /**
110
+ * A function that gets the current context of the request. This can be used
111
+ * by links to determine which actions to perform. See [managing context](https://apollographql.com/docs/react/api/link/introduction#managing-context)
112
+ */
113
+ getContext: () => Readonly<ApolloLink.OperationContext>;
114
+ /**
115
+ * The Apollo Client instance executing the request.
116
+ */
117
+ readonly client: ApolloClient;
118
+ }
119
+ /**
120
+ * The `context` object that can be read and modified by links using the
121
+ * `operation.getContext()` and `operation.setContext()` methods.
122
+ */
123
+ interface OperationContext extends DefaultContext {
124
+ }
125
+ namespace DocumentationTypes {
126
+ /**
127
+ * A request handler is responsible for performing some logic and executing the
128
+ * request, either by [forwarding](https://apollographql.com/docs/react/api/link/introduction#the-request-handler) the operation to the next link in the
129
+ * chain, or sending the operation to the destination that executes it, such as
130
+ * a GraphQL server.
131
+ *
132
+ * @param operation - The `Operation` object that provides information about the
133
+ * currently executed GraphQL request.
134
+ *
135
+ * @param forward - A function that is called to execute the next link in the
136
+ * chain.
137
+ */
138
+ function RequestHandler(operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction): Observable<ApolloLink.Result>;
139
+ /**
140
+ * A function that when called will execute the next link in the link chain.
141
+ *
142
+ * @example
143
+ *
144
+ * ```ts
145
+ * const link = new ApolloLink((operation, forward) => {
146
+ * // process the request
147
+ *
148
+ * // Call `forward` to execute the next link in the chain
149
+ * return forward(operation);
150
+ * });
151
+ * ```
152
+ *
153
+ * @param operation - The current `ApolloLink.Operation` object for the
154
+ * request.
155
+ */
156
+ function ForwardFunction(operation: ApolloLink.Operation): Observable<ApolloLink.Result>;
157
+ }
158
+ }
159
+ /**
160
+ * The base class for all links in Apollo Client. A link represents either a
161
+ * self-contained modification to a GraphQL operation or a side effect (such as
162
+ * logging).
163
+ *
164
+ * @remarks
165
+ *
166
+ * Links enable you to customize Apollo Client's request flow by composing
167
+ * together different pieces of functionality into a chain of links. Each
168
+ * link represents a specific capability, such as adding authentication headers,
169
+ * retrying failed requests, batching operations, or sending requests to a
170
+ * GraphQL server.
171
+ *
172
+ * Every link must define a request handler via its constructor or by extending
173
+ * this class and implementing the `request` method.
174
+ *
175
+ * @example
176
+ *
177
+ * ```ts
178
+ * import { ApolloLink } from "@apollo/client";
179
+ *
180
+ * const link = new ApolloLink((operation, forward) => {
181
+ * console.log("Operation:", operation.operationName);
182
+ * return forward(operation);
183
+ * });
184
+ * ```
185
+ */
3
186
  export declare class ApolloLink {
187
+ /**
188
+ * Creates a link that completes immediately and does not emit a result.
189
+ *
190
+ * @example
191
+ *
192
+ * ```ts
193
+ * const link = ApolloLink.empty();
194
+ * ```
195
+ */
4
196
  static empty(): ApolloLink;
5
- static from(links: (ApolloLink | RequestHandler)[]): ApolloLink;
6
- static split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink;
7
- static execute(link: ApolloLink, operation: GraphQLRequest, context: ExecuteContext): Observable<FetchResult>;
8
- static concat(first: ApolloLink | RequestHandler, second: ApolloLink | RequestHandler): ApolloLink;
9
- constructor(request?: RequestHandler);
10
- split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink;
11
- concat(next: ApolloLink | RequestHandler): ApolloLink;
12
- request(operation: Operation, forward?: NextLink): Observable<FetchResult> | null;
197
+ /**
198
+ * Composes multiple links into a single composed link that executes each
199
+ * provided link in serial order.
200
+ *
201
+ * @example
202
+ *
203
+ * ```ts
204
+ * import { from, HttpLink, ApolloLink } from "@apollo/client";
205
+ * import { RetryLink } from "@apollo/client/link/retry";
206
+ * import MyAuthLink from "../auth";
207
+ *
208
+ * const link = ApolloLink.from([
209
+ * new RetryLink(),
210
+ * new MyAuthLink(),
211
+ * new HttpLink({ uri: "http://localhost:4000/graphql" }),
212
+ * ]);
213
+ * ```
214
+ *
215
+ * @param links - An array of `ApolloLink` instances or request handlers that
216
+ * are executed in serial order.
217
+ */
218
+ static from(links: ApolloLink[]): ApolloLink;
219
+ /**
220
+ * Creates a link that conditionally routes a request to different links.
221
+ *
222
+ * @example
223
+ *
224
+ * ```ts
225
+ * import { ApolloLink, HttpLink } from "@apollo/client";
226
+ *
227
+ * const link = ApolloLink.split(
228
+ * (operation) => operation.getContext().version === 1,
229
+ * new HttpLink({ uri: "http://localhost:4000/v1/graphql" }),
230
+ * new HttpLink({ uri: "http://localhost:4000/v2/graphql" })
231
+ * );
232
+ * ```
233
+ *
234
+ * @param test - A predicate function that receives the current `operation`
235
+ * and returns a boolean indicating which link to execute. Returning `true`
236
+ * executes the `left` link. Returning `false` executes the `right` link.
237
+ *
238
+ * @param left - The link that executes when the `test` function returns
239
+ * `true`.
240
+ *
241
+ * @param right - The link that executes when the `test` function returns
242
+ * `false`. If the `right` link is not provided, the request is forwarded to
243
+ * the next link in the chain.
244
+ */
245
+ static split(test: (op: ApolloLink.Operation) => boolean, left: ApolloLink, right?: ApolloLink): ApolloLink;
246
+ /**
247
+ * Executes a GraphQL request against a link. The `execute` function begins
248
+ * the request by calling the request handler of the link.
249
+ *
250
+ * @example
251
+ *
252
+ * ```ts
253
+ * const observable = ApolloLink.execute(link, { query, variables }, { client });
254
+ *
255
+ * observable.subscribe({
256
+ * next(value) {
257
+ * console.log("Received", value);
258
+ * },
259
+ * error(error) {
260
+ * console.error("Oops got error", error);
261
+ * },
262
+ * complete() {
263
+ * console.log("Request complete");
264
+ * },
265
+ * });
266
+ * ```
267
+ *
268
+ * @param link - The `ApolloLink` instance to execute the request.
269
+ *
270
+ * @param request - The GraphQL request details, such as the `query` and
271
+ * `variables`.
272
+ *
273
+ * @param context - The execution context for the request, such as the
274
+ * `client` making the request.
275
+ */
276
+ static execute(link: ApolloLink, request: ApolloLink.Request, context: ApolloLink.ExecuteContext): Observable<ApolloLink.Result>;
277
+ /**
278
+ * Combines multiple links into a single composed link.
279
+ *
280
+ * @example
281
+ *
282
+ * ```ts
283
+ * const link = ApolloLink.concat(firstLink, secondLink, thirdLink);
284
+ * ```
285
+ *
286
+ * @param links - The links to concatenate into a single link. Each link will
287
+ * execute in serial order.
288
+ *
289
+ * @deprecated Use `ApolloLink.from` instead. `ApolloLink.concat` will be
290
+ * removed in a future major version.
291
+ */
292
+ static concat(...links: ApolloLink[]): ApolloLink;
293
+ constructor(request?: ApolloLink.RequestHandler);
294
+ /**
295
+ * Concatenates a link that conditionally routes a request to different links.
296
+ *
297
+ * @example
298
+ *
299
+ * ```ts
300
+ * import { ApolloLink, HttpLink } from "@apollo/client";
301
+ *
302
+ * const previousLink = new ApolloLink((operation, forward) => {
303
+ * // Handle the request
304
+ *
305
+ * return forward(operation);
306
+ * });
307
+ *
308
+ * const link = previousLink.split(
309
+ * (operation) => operation.getContext().version === 1,
310
+ * new HttpLink({ uri: "http://localhost:4000/v1/graphql" }),
311
+ * new HttpLink({ uri: "http://localhost:4000/v2/graphql" })
312
+ * );
313
+ * ```
314
+ *
315
+ * @param test - A predicate function that receives the current `operation`
316
+ * and returns a boolean indicating which link to execute. Returning `true`
317
+ * executes the `left` link. Returning `false` executes the `right` link.
318
+ *
319
+ * @param left - The link that executes when the `test` function returns
320
+ * `true`.
321
+ *
322
+ * @param right - The link that executes when the `test` function returns
323
+ * `false`. If the `right` link is not provided, the request is forwarded to
324
+ * the next link in the chain.
325
+ */
326
+ split(test: (op: ApolloLink.Operation) => boolean, left: ApolloLink, right?: ApolloLink): ApolloLink;
327
+ /**
328
+ * Combines the link with other links into a single composed link.
329
+ *
330
+ * @example
331
+ *
332
+ * ```ts
333
+ * import { ApolloLink, HttpLink } from "@apollo/client";
334
+ *
335
+ * const previousLink = new ApolloLink((operation, forward) => {
336
+ * // Handle the request
337
+ *
338
+ * return forward(operation);
339
+ * });
340
+ *
341
+ * const link = previousLink.concat(
342
+ * link1,
343
+ * link2,
344
+ * new HttpLink({ uri: "http://localhost:4000/graphql" })
345
+ * );
346
+ * ```
347
+ */
348
+ concat(...links: ApolloLink[]): ApolloLink;
349
+ private combine;
350
+ /**
351
+ * Runs the request handler for the provided operation.
352
+ *
353
+ * > [!NOTE]
354
+ * > This is called by the `ApolloLink.execute` function for you and should
355
+ * > not be called directly. Prefer using `ApolloLink.execute` to make the
356
+ * > request instead.
357
+ */
358
+ request(operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction): Observable<ApolloLink.Result>;
13
359
  /**
14
360
  * @internal
15
361
  * Used to iterate through all links that are concatenations or `split` links.
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.concat = void 0;
4
4
  const ApolloLink_js_1 = require("./ApolloLink.cjs");
5
+ /**
6
+ * @deprecated Use `ApolloLink.from` instead. `concat` will be removed in a
7
+ * future major version.
8
+ */
5
9
  exports.concat = ApolloLink_js_1.ApolloLink.concat;
6
10
  //# sourceMappingURL=concat.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"concat.cjs","sources":["../../../../src/link/core/concat.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const concat = ApolloLink.concat;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,EAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAuC;"}
1
+ {"version":3,"file":"concat.cjs","sources":["../../../../src/link/core/concat.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\n/**\n * @deprecated Use `ApolloLink.from` instead. `concat` will be removed in a\n * future major version.\n */\nexport const concat = ApolloLink.concat;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEA,CAAA,CAAA;;;CAGA,CAAA;AACa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,EAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAuC;"}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.cjs";
2
+ /**
3
+ * @deprecated Use `ApolloLink.from` instead. `concat` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export declare const concat: typeof ApolloLink.concat;
3
7
  //# sourceMappingURL=concat.d.cts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=deprecated.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,10 @@
1
+ import type { ApolloLink } from "./ApolloLink.cjs";
2
+ /** @deprecated Use `ApolloLink.Request` instead */
3
+ export type GraphQLRequest = ApolloLink.Request;
4
+ /** @deprecated Use `ApolloLink.Operation` instead */
5
+ export type Operation = ApolloLink.Operation;
6
+ /** @deprecated Use `ApolloLink.RequestHandler` instead */
7
+ export type RequestHandler = ApolloLink.RequestHandler;
8
+ /** @deprecated Use `ApolloLink.Result` instead */
9
+ export type FetchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = ApolloLink.Result<TData, TExtensions>;
10
+ //# sourceMappingURL=deprecated.d.cts.map
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.empty = void 0;
4
4
  const ApolloLink_js_1 = require("./ApolloLink.cjs");
5
+ /**
6
+ * @deprecated Use `ApolloLink.empty` instead. `empty` will be removed in a
7
+ * future major version.
8
+ */
5
9
  exports.empty = ApolloLink_js_1.ApolloLink.empty;
6
10
  //# sourceMappingURL=empty.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty.cjs","sources":["../../../../src/link/core/empty.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const empty = ApolloLink.empty;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAqC;"}
1
+ {"version":3,"file":"empty.cjs","sources":["../../../../src/link/core/empty.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\n/**\n * @deprecated Use `ApolloLink.empty` instead. `empty` will be removed in a\n * future major version.\n */\nexport const empty = ApolloLink.empty;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEA,CAAA,CAAA;;;CAGA,CAAA;AACa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAqC;"}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.cjs";
2
+ /**
3
+ * @deprecated Use `ApolloLink.empty` instead. `empty` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export declare const empty: typeof ApolloLink.empty;
3
7
  //# sourceMappingURL=empty.d.cts.map
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.from = void 0;
4
4
  const ApolloLink_js_1 = require("./ApolloLink.cjs");
5
+ /**
6
+ * @deprecated Use `ApolloLink.from` instead. `from` will be removed in a
7
+ * future major version.
8
+ */
5
9
  exports.from = ApolloLink_js_1.ApolloLink.from;
6
10
  //# sourceMappingURL=from.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"from.cjs","sources":["../../../../src/link/core/from.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const from = ApolloLink.from;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,EAAA,EAAoB,CAApB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B,CAAC,CAA/B,CAAA,CAAA,CAAmC;"}
1
+ {"version":3,"file":"from.cjs","sources":["../../../../src/link/core/from.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\n/**\n * @deprecated Use `ApolloLink.from` instead. `from` will be removed in a\n * future major version.\n */\nexport const from = ApolloLink.from;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEA,CAAA,CAAA;;;CAGA,CAAA;AACa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,EAAA,EAAoB,CAApB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B,CAAC,CAA/B,CAAA,CAAA,CAAmC;"}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.cjs";
2
+ /**
3
+ * @deprecated Use `ApolloLink.from` instead. `from` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export declare const from: typeof ApolloLink.from;
3
7
  //# sourceMappingURL=from.d.cts.map
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.split = void 0;
4
4
  const ApolloLink_js_1 = require("./ApolloLink.cjs");
5
+ /**
6
+ * @deprecated Use `ApolloLink.split` instead. `split` will be removed in a
7
+ * future major version.
8
+ */
5
9
  exports.split = ApolloLink_js_1.ApolloLink.split;
6
10
  //# sourceMappingURL=split.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"split.cjs","sources":["../../../../src/link/core/split.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const split = ApolloLink.split;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAqC;"}
1
+ {"version":3,"file":"split.cjs","sources":["../../../../src/link/core/split.ts"],"sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\n/**\n * @deprecated Use `ApolloLink.split` instead. `split` will be removed in a\n * future major version.\n */\nexport const split = ApolloLink.split;\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,CAAA;AAEA,CAAA,CAAA;;;CAGA,CAAA;AACa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAqC;"}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.cjs";
2
+ /**
3
+ * @deprecated Use `ApolloLink.split` instead. `split` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export declare const split: typeof ApolloLink.split;
3
7
  //# sourceMappingURL=split.d.cts.map
@@ -1,41 +1,10 @@
1
- import type { FormattedExecutionResult, GraphQLFormattedError, OperationTypeNode } from "graphql";
1
+ import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
2
2
  import type { DocumentNode } from "graphql";
3
- import type { Observable } from "rxjs";
4
- import type { ApolloClient, DefaultContext, OperationVariables } from "@apollo/client";
5
3
  export type { DocumentNode };
6
4
  export interface ApolloPayloadResult<TData = Record<string, any>, TExtensions = Record<string, any>> {
7
5
  payload: FormattedExecutionResult<TData, TExtensions> | null;
8
6
  errors?: ReadonlyArray<GraphQLFormattedError>;
9
7
  }
10
- export interface GraphQLRequest<TVariables extends OperationVariables = Record<string, any>> {
11
- query: DocumentNode;
12
- variables?: TVariables;
13
- operationName?: string;
14
- operationType?: OperationTypeNode;
15
- context?: DefaultContext;
16
- extensions?: Record<string, any>;
8
+ export interface AdditionalApolloLinkResultTypes<TData = Record<string, any>, TExtensions = Record<string, any>> {
17
9
  }
18
- export interface Operation {
19
- query: DocumentNode;
20
- variables: Record<string, any>;
21
- operationName: string;
22
- operationType: OperationTypeNode | undefined;
23
- extensions: Record<string, any>;
24
- setContext: {
25
- (context: Partial<OperationContext>): void;
26
- (updateContext: (previousContext: OperationContext) => Partial<OperationContext>): void;
27
- };
28
- getContext: () => OperationContext;
29
- readonly client: ApolloClient;
30
- }
31
- export interface ExecuteContext {
32
- client: ApolloClient;
33
- }
34
- export interface OperationContext extends DefaultContext {
35
- }
36
- export type FetchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = FormattedExecutionResult<TData, TExtensions> | AdditionalFetchResultTypes<TData, TExtensions>[keyof AdditionalFetchResultTypes<TData, TExtensions>];
37
- export interface AdditionalFetchResultTypes<TData = Record<string, any>, TExtensions = Record<string, any>> {
38
- }
39
- export type NextLink = (operation: Operation) => Observable<FetchResult>;
40
- export type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;
41
10
  //# sourceMappingURL=types.d.cts.map
@@ -12,6 +12,50 @@ const link_1 = require("@apollo/client/link");
12
12
  function onError(errorHandler) {
13
13
  return new ErrorLink(errorHandler);
14
14
  }
15
+ /**
16
+ * Use the `ErrorLink` to perform custom logic when a [GraphQL or network error](https://apollographql.com/docs/react/data/error-handling)
17
+ * occurs.
18
+ *
19
+ * @remarks
20
+ *
21
+ * This link is used after the GraphQL operation completes and execution is
22
+ * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
23
+ * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
24
+ *
25
+ * For more information on the types of errors that might be encountered, see
26
+ * the guide on [error handling](https://apollographql.com/docs/react/data/error-handling).
27
+ *
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { ErrorLink } from "@apollo/client/link/error";
32
+ * import {
33
+ * CombinedGraphQLErrors,
34
+ * CombinedProtocolErrors,
35
+ * } from "@apollo/client/errors";
36
+ *
37
+ * // Log any GraphQL errors, protocol errors, or network error that occurred
38
+ * const errorLink = new ErrorLink(({ error, operation }) => {
39
+ * if (CombinedGraphQLErrors.is(error)) {
40
+ * error.errors.forEach(({ message, locations, path }) =>
41
+ * console.log(
42
+ * `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
43
+ * )
44
+ * );
45
+ * } else if (CombinedProtocolErrors.is(error)) {
46
+ * error.errors.forEach(({ message, extensions }) =>
47
+ * console.log(
48
+ * `[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(
49
+ * extensions
50
+ * )}`
51
+ * )
52
+ * );
53
+ * } else {
54
+ * console.error(`[Network error]: ${error}`);
55
+ * }
56
+ * });
57
+ * ```
58
+ */
15
59
  class ErrorLink extends link_1.ApolloLink {
16
60
  constructor(errorHandler) {
17
61
  super((operation, forward) => {