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

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 (309) hide show
  1. package/CHANGELOG.md +135 -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.map +1 -1
  15. package/__cjs/core/index.d.cts +1 -1
  16. package/__cjs/core/types.d.cts +40 -28
  17. package/__cjs/errors/CombinedGraphQLErrors.cjs +22 -17
  18. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  19. package/__cjs/errors/CombinedGraphQLErrors.d.cts +39 -20
  20. package/__cjs/errors/CombinedProtocolErrors.cjs +12 -6
  21. package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
  22. package/__cjs/errors/CombinedProtocolErrors.d.cts +12 -6
  23. package/__cjs/errors/ServerError.cjs +2 -1
  24. package/__cjs/errors/ServerError.cjs.map +1 -1
  25. package/__cjs/errors/ServerError.d.cts +2 -1
  26. package/__cjs/errors/ServerParseError.cjs +2 -1
  27. package/__cjs/errors/ServerParseError.cjs.map +1 -1
  28. package/__cjs/errors/ServerParseError.d.cts +2 -1
  29. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  30. package/__cjs/incremental/handlers/defer20220824.d.cts +4 -4
  31. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  32. package/__cjs/incremental/handlers/notImplemented.d.cts +2 -2
  33. package/__cjs/incremental/types.d.cts +4 -4
  34. package/__cjs/invariantErrorCodes.cjs +14 -10
  35. package/__cjs/link/batch/batchLink.cjs +3 -9
  36. package/__cjs/link/batch/batchLink.cjs.map +1 -1
  37. package/__cjs/link/batch/batchLink.d.cts +2 -3
  38. package/__cjs/link/batch/batching.cjs +1 -1
  39. package/__cjs/link/batch/batching.cjs.map +1 -1
  40. package/__cjs/link/batch/batching.d.cts +7 -7
  41. package/__cjs/link/batch-http/batchHttpLink.cjs +6 -3
  42. package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
  43. package/__cjs/link/batch-http/batchHttpLink.d.cts +1 -2
  44. package/__cjs/link/context/index.cjs.map +1 -1
  45. package/__cjs/link/context/index.d.cts +3 -4
  46. package/__cjs/link/core/ApolloLink.cjs +226 -54
  47. package/__cjs/link/core/ApolloLink.cjs.map +1 -1
  48. package/__cjs/link/core/ApolloLink.d.cts +355 -9
  49. package/__cjs/link/core/concat.cjs +4 -0
  50. package/__cjs/link/core/concat.cjs.map +1 -1
  51. package/__cjs/link/core/concat.d.cts +4 -0
  52. package/__cjs/link/core/deprecated.cjs +3 -0
  53. package/__cjs/link/core/deprecated.cjs.map +1 -0
  54. package/__cjs/link/core/deprecated.d.cts +10 -0
  55. package/__cjs/link/core/empty.cjs +4 -0
  56. package/__cjs/link/core/empty.cjs.map +1 -1
  57. package/__cjs/link/core/empty.d.cts +4 -0
  58. package/__cjs/link/core/from.cjs +4 -0
  59. package/__cjs/link/core/from.cjs.map +1 -1
  60. package/__cjs/link/core/from.d.cts +4 -0
  61. package/__cjs/link/core/split.cjs +4 -0
  62. package/__cjs/link/core/split.cjs.map +1 -1
  63. package/__cjs/link/core/split.d.cts +4 -0
  64. package/__cjs/link/core/types.d.cts +2 -33
  65. package/__cjs/link/error/index.cjs.map +1 -1
  66. package/__cjs/link/error/index.d.cts +4 -5
  67. package/__cjs/link/http/BaseHttpLink.cjs +2 -2
  68. package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
  69. package/__cjs/link/http/HttpLink.cjs +4 -1
  70. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  71. package/__cjs/link/http/HttpLink.d.cts +1 -2
  72. package/__cjs/link/http/checkFetcher.cjs +1 -1
  73. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +41 -26
  74. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  75. package/__cjs/link/http/parseAndCheckHttpResponse.d.cts +2 -2
  76. package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
  77. package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +3 -3
  78. package/__cjs/link/http/selectURI.cjs.map +1 -1
  79. package/__cjs/link/http/selectURI.d.cts +2 -2
  80. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  81. package/__cjs/link/index.cjs.map +1 -1
  82. package/__cjs/link/index.d.cts +2 -1
  83. package/__cjs/link/persisted-queries/index.cjs +2 -2
  84. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  85. package/__cjs/link/persisted-queries/index.d.cts +1 -2
  86. package/__cjs/link/retry/delayFunction.cjs.map +1 -1
  87. package/__cjs/link/retry/delayFunction.d.cts +2 -2
  88. package/__cjs/link/retry/retryFunction.cjs.map +1 -1
  89. package/__cjs/link/retry/retryFunction.d.cts +3 -3
  90. package/__cjs/link/retry/retryLink.cjs +2 -2
  91. package/__cjs/link/retry/retryLink.cjs.map +1 -1
  92. package/__cjs/link/retry/retryLink.d.cts +1 -2
  93. package/__cjs/link/schema/index.cjs.map +1 -1
  94. package/__cjs/link/schema/index.d.cts +2 -3
  95. package/__cjs/link/subscriptions/index.cjs.map +1 -1
  96. package/__cjs/link/subscriptions/index.d.cts +1 -2
  97. package/__cjs/link/utils/createOperation.cjs +12 -4
  98. package/__cjs/link/utils/createOperation.cjs.map +1 -1
  99. package/__cjs/link/utils/createOperation.d.cts +2 -2
  100. package/__cjs/link/utils/index.cjs +1 -5
  101. package/__cjs/link/utils/index.cjs.map +1 -1
  102. package/__cjs/link/utils/index.d.cts +0 -2
  103. package/__cjs/link/ws/index.cjs.map +1 -1
  104. package/__cjs/link/ws/index.d.cts +1 -2
  105. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  106. package/__cjs/react/hooks/useBackgroundQuery.d.cts +125 -93
  107. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  108. package/__cjs/react/hooks/useFragment.d.cts +2 -2
  109. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  110. package/__cjs/react/hooks/useLazyQuery.d.cts +70 -108
  111. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  112. package/__cjs/react/hooks/useLoadableQuery.d.cts +52 -61
  113. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  114. package/__cjs/react/hooks/useMutation.d.cts +36 -54
  115. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  116. package/__cjs/react/hooks/useQuery.d.cts +64 -105
  117. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  118. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +17 -8
  119. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  120. package/__cjs/react/hooks/useReadQuery.d.cts +6 -9
  121. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  122. package/__cjs/react/hooks/useSubscription.d.cts +32 -24
  123. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  124. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  125. package/__cjs/react/hooks/useSuspenseQuery.d.cts +75 -94
  126. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  127. package/__cjs/react/internal/cache/QueryReference.d.cts +3 -1
  128. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  129. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +29 -20
  130. package/__cjs/react/types/types.documentation.d.cts +5 -5
  131. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  132. package/__cjs/testing/core/mocking/mockLink.d.cts +5 -6
  133. package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
  134. package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +3 -4
  135. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +20 -28
  136. package/__cjs/utilities/internal/types/VariablesOption.d.cts +2 -6
  137. package/__cjs/version.cjs +1 -1
  138. package/cache/core/cache.d.ts +12 -7
  139. package/cache/core/cache.js +12 -7
  140. package/cache/core/cache.js.map +1 -1
  141. package/core/ApolloClient.d.ts +80 -98
  142. package/core/ApolloClient.js +2 -2
  143. package/core/ApolloClient.js.map +1 -1
  144. package/core/ObservableQuery.d.ts +41 -74
  145. package/core/QueryInfo.d.ts +3 -3
  146. package/core/QueryInfo.js.map +1 -1
  147. package/core/QueryManager.d.ts +3 -3
  148. package/core/QueryManager.js +0 -2
  149. package/core/QueryManager.js.map +1 -1
  150. package/core/index.d.ts +1 -1
  151. package/core/index.js.map +1 -1
  152. package/core/types.d.ts +40 -28
  153. package/errors/CombinedGraphQLErrors.d.ts +39 -20
  154. package/errors/CombinedGraphQLErrors.js +22 -17
  155. package/errors/CombinedGraphQLErrors.js.map +1 -1
  156. package/errors/CombinedProtocolErrors.d.ts +12 -6
  157. package/errors/CombinedProtocolErrors.js +12 -6
  158. package/errors/CombinedProtocolErrors.js.map +1 -1
  159. package/errors/ServerError.d.ts +2 -1
  160. package/errors/ServerError.js +2 -1
  161. package/errors/ServerError.js.map +1 -1
  162. package/errors/ServerParseError.d.ts +2 -1
  163. package/errors/ServerParseError.js +2 -1
  164. package/errors/ServerParseError.js.map +1 -1
  165. package/incremental/handlers/defer20220824.d.ts +4 -4
  166. package/incremental/handlers/defer20220824.js.map +1 -1
  167. package/incremental/handlers/notImplemented.d.ts +2 -2
  168. package/incremental/handlers/notImplemented.js.map +1 -1
  169. package/incremental/types.d.ts +4 -4
  170. package/incremental/types.js.map +1 -1
  171. package/invariantErrorCodes.js +14 -10
  172. package/link/batch/batchLink.d.ts +2 -3
  173. package/link/batch/batchLink.js +3 -9
  174. package/link/batch/batchLink.js.map +1 -1
  175. package/link/batch/batching.d.ts +7 -7
  176. package/link/batch/batching.js +2 -2
  177. package/link/batch/batching.js.map +1 -1
  178. package/link/batch-http/batchHttpLink.d.ts +1 -2
  179. package/link/batch-http/batchHttpLink.js +6 -3
  180. package/link/batch-http/batchHttpLink.js.map +1 -1
  181. package/link/context/index.d.ts +3 -4
  182. package/link/context/index.js.map +1 -1
  183. package/link/core/ApolloLink.d.ts +355 -9
  184. package/link/core/ApolloLink.js +227 -56
  185. package/link/core/ApolloLink.js.map +1 -1
  186. package/link/core/concat.d.ts +4 -0
  187. package/link/core/concat.js +4 -0
  188. package/link/core/concat.js.map +1 -1
  189. package/link/core/deprecated.d.ts +10 -0
  190. package/link/core/deprecated.js +2 -0
  191. package/link/core/deprecated.js.map +1 -0
  192. package/link/core/empty.d.ts +4 -0
  193. package/link/core/empty.js +4 -0
  194. package/link/core/empty.js.map +1 -1
  195. package/link/core/from.d.ts +4 -0
  196. package/link/core/from.js +4 -0
  197. package/link/core/from.js.map +1 -1
  198. package/link/core/split.d.ts +4 -0
  199. package/link/core/split.js +4 -0
  200. package/link/core/split.js.map +1 -1
  201. package/link/core/types.d.ts +2 -33
  202. package/link/core/types.js.map +1 -1
  203. package/link/error/index.d.ts +4 -5
  204. package/link/error/index.js.map +1 -1
  205. package/link/http/BaseHttpLink.js +2 -2
  206. package/link/http/BaseHttpLink.js.map +1 -1
  207. package/link/http/HttpLink.d.ts +1 -2
  208. package/link/http/HttpLink.js +4 -1
  209. package/link/http/HttpLink.js.map +1 -1
  210. package/link/http/checkFetcher.js +1 -1
  211. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  212. package/link/http/parseAndCheckHttpResponse.js +41 -26
  213. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  214. package/link/http/selectHttpOptionsAndBody.d.ts +3 -3
  215. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  216. package/link/http/selectURI.d.ts +2 -2
  217. package/link/http/selectURI.js.map +1 -1
  218. package/link/http/serializeFetchParameter.js +1 -1
  219. package/link/index.d.ts +2 -1
  220. package/link/index.js.map +1 -1
  221. package/link/persisted-queries/index.d.ts +1 -2
  222. package/link/persisted-queries/index.js +2 -2
  223. package/link/persisted-queries/index.js.map +1 -1
  224. package/link/retry/delayFunction.d.ts +2 -2
  225. package/link/retry/delayFunction.js.map +1 -1
  226. package/link/retry/retryFunction.d.ts +3 -3
  227. package/link/retry/retryFunction.js.map +1 -1
  228. package/link/retry/retryLink.d.ts +1 -2
  229. package/link/retry/retryLink.js +2 -2
  230. package/link/retry/retryLink.js.map +1 -1
  231. package/link/schema/index.d.ts +2 -3
  232. package/link/schema/index.js.map +1 -1
  233. package/link/subscriptions/index.d.ts +1 -2
  234. package/link/subscriptions/index.js.map +1 -1
  235. package/link/utils/createOperation.d.ts +2 -2
  236. package/link/utils/createOperation.js +12 -4
  237. package/link/utils/createOperation.js.map +1 -1
  238. package/link/utils/index.d.ts +0 -2
  239. package/link/utils/index.js +0 -2
  240. package/link/utils/index.js.map +1 -1
  241. package/link/ws/index.d.ts +1 -2
  242. package/link/ws/index.js.map +1 -1
  243. package/package.json +1 -1
  244. package/react/hooks/useBackgroundQuery.d.ts +125 -93
  245. package/react/hooks/useBackgroundQuery.js.map +1 -1
  246. package/react/hooks/useFragment.d.ts +2 -2
  247. package/react/hooks/useFragment.js.map +1 -1
  248. package/react/hooks/useLazyQuery.d.ts +70 -108
  249. package/react/hooks/useLazyQuery.js.map +1 -1
  250. package/react/hooks/useLoadableQuery.d.ts +52 -61
  251. package/react/hooks/useLoadableQuery.js.map +1 -1
  252. package/react/hooks/useMutation.d.ts +36 -54
  253. package/react/hooks/useMutation.js.map +1 -1
  254. package/react/hooks/useQuery.d.ts +64 -105
  255. package/react/hooks/useQuery.js.map +1 -1
  256. package/react/hooks/useQueryRefHandlers.d.ts +17 -8
  257. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  258. package/react/hooks/useReadQuery.d.ts +6 -9
  259. package/react/hooks/useReadQuery.js.map +1 -1
  260. package/react/hooks/useSubscription.d.ts +32 -24
  261. package/react/hooks/useSubscription.js.map +1 -1
  262. package/react/hooks/useSuspenseFragment.js.map +1 -1
  263. package/react/hooks/useSuspenseQuery.d.ts +75 -94
  264. package/react/hooks/useSuspenseQuery.js.map +1 -1
  265. package/react/hooks-compiled/useBackgroundQuery.d.ts +125 -93
  266. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  267. package/react/hooks-compiled/useFragment.d.ts +2 -2
  268. package/react/hooks-compiled/useFragment.js.map +1 -1
  269. package/react/hooks-compiled/useLazyQuery.d.ts +70 -108
  270. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  271. package/react/hooks-compiled/useLoadableQuery.d.ts +52 -61
  272. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  273. package/react/hooks-compiled/useMutation.d.ts +36 -54
  274. package/react/hooks-compiled/useMutation.js.map +1 -1
  275. package/react/hooks-compiled/useQuery.d.ts +64 -105
  276. package/react/hooks-compiled/useQuery.js.map +1 -1
  277. package/react/hooks-compiled/useQueryRefHandlers.d.ts +17 -8
  278. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  279. package/react/hooks-compiled/useReadQuery.d.ts +6 -9
  280. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  281. package/react/hooks-compiled/useSubscription.d.ts +32 -24
  282. package/react/hooks-compiled/useSubscription.js.map +1 -1
  283. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  284. package/react/hooks-compiled/useSuspenseQuery.d.ts +75 -94
  285. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  286. package/react/internal/cache/QueryReference.d.ts +3 -1
  287. package/react/internal/cache/QueryReference.js.map +1 -1
  288. package/react/query-preloader/createQueryPreloader.d.ts +29 -20
  289. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  290. package/react/types/types.documentation.d.ts +5 -5
  291. package/testing/core/mocking/mockLink.d.ts +5 -6
  292. package/testing/core/mocking/mockLink.js.map +1 -1
  293. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -4
  294. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  295. package/utilities/internal/types/DocumentationTypes.d.ts +20 -28
  296. package/utilities/internal/types/VariablesOption.d.ts +2 -6
  297. package/version.js +1 -1
  298. package/__cjs/link/utils/transformOperation.cjs +0 -22
  299. package/__cjs/link/utils/transformOperation.cjs.map +0 -1
  300. package/__cjs/link/utils/transformOperation.d.cts +0 -3
  301. package/__cjs/link/utils/validateOperation.cjs +0 -21
  302. package/__cjs/link/utils/validateOperation.cjs.map +0 -1
  303. package/__cjs/link/utils/validateOperation.d.cts +0 -3
  304. package/link/utils/transformOperation.d.ts +0 -3
  305. package/link/utils/transformOperation.js +0 -19
  306. package/link/utils/transformOperation.js.map +0 -1
  307. package/link/utils/validateOperation.d.ts +0 -3
  308. package/link/utils/validateOperation.js +0 -18
  309. package/link/utils/validateOperation.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloLink.js","sources":["../../../src/link/core/ApolloLink.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\nimport { EMPTY } from \"rxjs\";\n\nimport {\n createOperation,\n transformOperation,\n validateOperation,\n} from \"@apollo/client/link/utils\";\nimport {\n invariant,\n newInvariantError,\n} from \"@apollo/client/utilities/invariant\";\n\nimport type {\n ExecuteContext,\n FetchResult,\n GraphQLRequest,\n NextLink,\n Operation,\n RequestHandler,\n} from \"./types.js\";\n\nfunction passthrough(op: Operation, forward: NextLink) {\n return (forward ? forward(op) : EMPTY) as Observable<FetchResult>;\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\n\nfunction isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport class ApolloLink {\n public static empty(): ApolloLink {\n return new ApolloLink(() => EMPTY);\n }\n\n public static from(links: (ApolloLink | RequestHandler)[]): ApolloLink {\n if (links.length === 0) return ApolloLink.empty();\n return links.map(toLink).reduce((x, y) => x.concat(y)) as ApolloLink;\n }\n\n public static split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n let ret: ApolloLink;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink((operation) => {\n return test(operation) ?\n leftLink.request(operation) || EMPTY\n : rightLink.request(operation) || EMPTY;\n });\n } else {\n ret = new ApolloLink((operation, forward) => {\n return test(operation) ?\n leftLink.request(operation, forward) || EMPTY\n : rightLink.request(operation, forward) || EMPTY;\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n }\n\n public static execute(\n link: ApolloLink,\n operation: GraphQLRequest,\n context: ExecuteContext\n ): Observable<FetchResult> {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation)),\n context\n )\n ) || EMPTY\n );\n }\n\n public static concat(\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler\n ) {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n `You are calling concat on a terminating link, which will have no effect %o`,\n firstLink\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n let ret: ApolloLink;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(\n (operation) =>\n firstLink.request(operation, (op) => nextLink.request(op) || EMPTY) ||\n EMPTY\n );\n } else {\n ret = new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, (op) => {\n return nextLink.request(op, forward) || EMPTY;\n }) || EMPTY\n );\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n }\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n return this.concat(\n ApolloLink.split(test, left, right || new ApolloLink(passthrough))\n );\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return ApolloLink.concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable<FetchResult> | null {\n throw newInvariantError(\"request is not implemented\");\n }\n\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly left?: ApolloLink;\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly right?: ApolloLink;\n\n /**\n * @internal\n * Can be provided by a link that has an internal cache to report it's memory details.\n */\n getMemoryInternals?: () => unknown;\n}\n"],"names":[],"mappings":";AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAA4B;AAE5B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACiB,EACf,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEoB,EAClB,CAHF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAGmB,EAHnB,EAAA,CAAA,CAAA,CAAA,EAIO,CAJP,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,CAIkC;AAClC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,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AAA,CAAA,CAC0D,CAAC,CAD3D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACsE,CAAC,CAAC,CACnE;IACH;IAEO,CAAT,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,CAAhB,CAAA,CAAA,CAAiD,EAAjD;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAC,CAAtB,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAC,CAA7B,CAAA,CAAA,CAAiC,EAAE,CAAnC,CAAA,CAAA,CAAuC,CAAC;IACtC;IAEO,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CACZ,CADJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACwB,EACpB,CAFJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAEsB,EAFtB;QAII,CAAJ,CAAA,CAAA,CAAA,EAAU,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAyD;IACvD;;;;;;;IAMS,CAAX,CAAA,CAAA,CAAe;;;;;;;IAKJ,CAAX,CAAA,CAAA,CAAA,CAAgB;;;;;;;IAMd,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB;AACpB;"}
1
+ {"version":3,"file":"ApolloLink.js","sources":["../../../src/link/core/ApolloLink.ts"],"sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n OperationTypeNode,\n} from \"graphql\";\nimport type { Observable } from \"rxjs\";\nimport { EMPTY } from \"rxjs\";\n\nimport type {\n ApolloClient,\n DefaultContext,\n OperationVariables,\n} from \"@apollo/client\";\nimport { createOperation } from \"@apollo/client/link/utils\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport {\n invariant,\n newInvariantError,\n} from \"@apollo/client/utilities/invariant\";\n\nimport type { AdditionalApolloLinkResultTypes } from \"./types.js\";\n\nexport declare namespace ApolloLink {\n /**\n * Context provided for link execution, such as the client executing the\n * request. It is separate from the request operation context.\n */\n export interface ExecuteContext {\n /**\n * The Apollo Client instance that executed the GraphQL request.\n */\n client: ApolloClient;\n }\n\n /** {@inheritDoc @apollo/client/link!ApolloLink.DocumentationTypes.ForwardFunction:function(1)} */\n export type ForwardFunction = (\n operation: ApolloLink.Operation\n ) => Observable<ApolloLink.Result>;\n\n /**\n * The input object provided to `ApolloLink.execute` to send a GraphQL request through\n * the link chain.\n */\n export interface Request {\n /**\n * The parsed GraphQL document that will be sent with the GraphQL request to\n * the server.\n */\n query: DocumentNode;\n\n /**\n * The variables provided for the query.\n */\n variables?: OperationVariables;\n\n /**\n * Context provided to the link chain. Context is not sent to the server and\n * is used to communicate additional metadata from a request to individual\n * links in the link chain.\n */\n context?: DefaultContext;\n\n /**\n * A map of extensions that will be sent with the GraphQL request to the\n * server.\n */\n extensions?: Record<string, any>;\n }\n\n /** {@inheritDoc @apollo/client/link!ApolloLink.DocumentationTypes.RequestHandler:function(1)} */\n export type RequestHandler = (\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ) => Observable<ApolloLink.Result>;\n\n export type Result<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n > =\n | FormattedExecutionResult<TData, TExtensions>\n | AdditionalApolloLinkResultTypes<\n TData,\n TExtensions\n >[keyof AdditionalApolloLinkResultTypes<TData, TExtensions>];\n\n /**\n * The currently executed operation object provided to an `ApolloLink.RequestHandler`\n * for each link in the link chain.\n */\n export interface Operation {\n /**\n * A `DocumentNode` that describes the operation taking place.\n */\n query: DocumentNode;\n\n /**\n * A map of GraphQL variables being sent with the operation.\n */\n variables: OperationVariables;\n\n /**\n * The string name of the GraphQL operation. If it is anonymous,\n * `operationName` will be `undefined`.\n */\n operationName: string | undefined;\n\n /**\n * The type of the GraphQL operation, such as query or mutation.\n */\n operationType: OperationTypeNode;\n\n /**\n * A map that stores extensions data to be sent to the server.\n */\n extensions: Record<string, any>;\n\n /**\n * A function that takes either a new context object, or a function which\n * takes in the previous context and returns a new one. See [managing\n * context](https://apollographql.com/docs/react/api/link/introduction#managing-context).\n */\n setContext: {\n (context: Partial<ApolloLink.OperationContext>): void;\n (\n updateContext: (\n previousContext: Readonly<ApolloLink.OperationContext>\n ) => Partial<ApolloLink.OperationContext>\n ): void;\n };\n\n /**\n * A function that gets the current context of the request. This can be used\n * by links to determine which actions to perform. See [managing context](https://apollographql.com/docs/react/api/link/introduction#managing-context)\n */\n getContext: () => Readonly<ApolloLink.OperationContext>;\n\n /**\n * The Apollo Client instance executing the request.\n */\n readonly client: ApolloClient;\n }\n\n /**\n * The `context` object that can be read and modified by links using the\n * `operation.getContext()` and `operation.setContext()` methods.\n */\n export interface OperationContext extends DefaultContext {}\n\n export namespace DocumentationTypes {\n /**\n * A request handler is responsible for performing some logic and executing the\n * request, either by [forwarding](https://apollographql.com/docs/react/api/link/introduction#the-request-handler) the operation to the next link in the\n * chain, or sending the operation to the destination that executes it, such as\n * a GraphQL server.\n *\n * @param operation - The `Operation` object that provides information about the\n * currently executed GraphQL request.\n *\n * @param forward - A function that is called to execute the next link in the\n * chain.\n */\n export function RequestHandler(\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ): Observable<ApolloLink.Result>;\n\n /**\n * A function that when called will execute the next link in the link chain.\n *\n * @example\n *\n * ```ts\n * const link = new ApolloLink((operation, forward) => {\n * // process the request\n *\n * // Call `forward` to execute the next link in the chain\n * return forward(operation);\n * });\n * ```\n *\n * @param operation - The current `ApolloLink.Operation` object for the\n * request.\n */\n export function ForwardFunction(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result>;\n }\n}\n\n/**\n * The base class for all links in Apollo Client. A link represents either a\n * self-contained modification to a GraphQL operation or a side effect (such as\n * logging).\n *\n * @remarks\n *\n * Links enable you to customize Apollo Client's request flow by composing\n * together different pieces of functionality into a chain of links. Each\n * link represents a specific capability, such as adding authentication headers,\n * retrying failed requests, batching operations, or sending requests to a\n * GraphQL server.\n *\n * Every link must define a request handler via its constructor or by extending\n * this class and implementing the `request` method.\n *\n * @example\n *\n * ```ts\n * import { ApolloLink } from \"@apollo/client\";\n *\n * const link = new ApolloLink((operation, forward) => {\n * console.log(\"Operation:\", operation.operationName);\n * return forward(operation);\n * });\n * ```\n */\nexport class ApolloLink {\n /**\n * Creates a link that completes immediately and does not emit a result.\n *\n * @example\n *\n * ```ts\n * const link = ApolloLink.empty();\n * ```\n */\n public static empty(): ApolloLink {\n return new ApolloLink(() => EMPTY);\n }\n\n /**\n * Composes multiple links into a single composed link that executes each\n * provided link in serial order.\n *\n * @example\n *\n * ```ts\n * import { from, HttpLink, ApolloLink } from \"@apollo/client\";\n * import { RetryLink } from \"@apollo/client/link/retry\";\n * import MyAuthLink from \"../auth\";\n *\n * const link = ApolloLink.from([\n * new RetryLink(),\n * new MyAuthLink(),\n * new HttpLink({ uri: \"http://localhost:4000/graphql\" }),\n * ]);\n * ```\n *\n * @param links - An array of `ApolloLink` instances or request handlers that\n * are executed in serial order.\n */\n public static from(links: ApolloLink[]): ApolloLink {\n if (links.length === 0) return ApolloLink.empty();\n\n const [first, ...rest] = links;\n return first.concat(...rest);\n }\n\n /**\n * Creates a link that conditionally routes a request to different links.\n *\n * @example\n *\n * ```ts\n * import { ApolloLink, HttpLink } from \"@apollo/client\";\n *\n * const link = ApolloLink.split(\n * (operation) => operation.getContext().version === 1,\n * new HttpLink({ uri: \"http://localhost:4000/v1/graphql\" }),\n * new HttpLink({ uri: \"http://localhost:4000/v2/graphql\" })\n * );\n * ```\n *\n * @param test - A predicate function that receives the current `operation`\n * and returns a boolean indicating which link to execute. Returning `true`\n * executes the `left` link. Returning `false` executes the `right` link.\n *\n * @param left - The link that executes when the `test` function returns\n * `true`.\n *\n * @param right - The link that executes when the `test` function returns\n * `false`. If the `right` link is not provided, the request is forwarded to\n * the next link in the chain.\n */\n public static split(\n test: (op: ApolloLink.Operation) => boolean,\n left: ApolloLink,\n right: ApolloLink = new ApolloLink((op, forward) => forward(op))\n ): ApolloLink {\n const link = new ApolloLink((operation, forward) => {\n const result = test(operation);\n\n if (__DEV__) {\n if (typeof result !== \"boolean\") {\n invariant.warn(\n \"[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`.\",\n result\n );\n }\n }\n\n return result ?\n left.request(operation, forward)\n : right.request(operation, forward);\n });\n return Object.assign(link, { left, right });\n }\n\n /**\n * Executes a GraphQL request against a link. The `execute` function begins\n * the request by calling the request handler of the link.\n *\n * @example\n *\n * ```ts\n * const observable = ApolloLink.execute(link, { query, variables }, { client });\n *\n * observable.subscribe({\n * next(value) {\n * console.log(\"Received\", value);\n * },\n * error(error) {\n * console.error(\"Oops got error\", error);\n * },\n * complete() {\n * console.log(\"Request complete\");\n * },\n * });\n * ```\n *\n * @param link - The `ApolloLink` instance to execute the request.\n *\n * @param request - The GraphQL request details, such as the `query` and\n * `variables`.\n *\n * @param context - The execution context for the request, such as the\n * `client` making the request.\n */\n public static execute(\n link: ApolloLink,\n request: ApolloLink.Request,\n context: ApolloLink.ExecuteContext\n ): Observable<ApolloLink.Result> {\n return link.request(createOperation(request, context), () => {\n if (__DEV__) {\n invariant.warn(\n \"The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. \" +\n \"This results in an observable that immediately completes and does not emit a value. \" +\n \"Please provide a terminating link that properly handles the request.\\n\\n\" +\n \"If you are using a split link, ensure each branch contains a terminating link that handles the request.\"\n );\n }\n return EMPTY;\n });\n }\n\n /**\n * Combines multiple links into a single composed link.\n *\n * @example\n *\n * ```ts\n * const link = ApolloLink.concat(firstLink, secondLink, thirdLink);\n * ```\n *\n * @param links - The links to concatenate into a single link. Each link will\n * execute in serial order.\n *\n * @deprecated Use `ApolloLink.from` instead. `ApolloLink.concat` will be\n * removed in a future major version.\n */\n public static concat(...links: ApolloLink[]) {\n return ApolloLink.from(links);\n }\n\n constructor(request?: ApolloLink.RequestHandler) {\n if (request) this.request = request;\n }\n\n /**\n * Concatenates a link that conditionally routes a request to different links.\n *\n * @example\n *\n * ```ts\n * import { ApolloLink, HttpLink } from \"@apollo/client\";\n *\n * const previousLink = new ApolloLink((operation, forward) => {\n * // Handle the request\n *\n * return forward(operation);\n * });\n *\n * const link = previousLink.split(\n * (operation) => operation.getContext().version === 1,\n * new HttpLink({ uri: \"http://localhost:4000/v1/graphql\" }),\n * new HttpLink({ uri: \"http://localhost:4000/v2/graphql\" })\n * );\n * ```\n *\n * @param test - A predicate function that receives the current `operation`\n * and returns a boolean indicating which link to execute. Returning `true`\n * executes the `left` link. Returning `false` executes the `right` link.\n *\n * @param left - The link that executes when the `test` function returns\n * `true`.\n *\n * @param right - The link that executes when the `test` function returns\n * `false`. If the `right` link is not provided, the request is forwarded to\n * the next link in the chain.\n */\n public split(\n test: (op: ApolloLink.Operation) => boolean,\n left: ApolloLink,\n right?: ApolloLink\n ): ApolloLink {\n return this.concat(ApolloLink.split(test, left, right));\n }\n\n /**\n * Combines the link with other links into a single composed link.\n *\n * @example\n *\n * ```ts\n * import { ApolloLink, HttpLink } from \"@apollo/client\";\n *\n * const previousLink = new ApolloLink((operation, forward) => {\n * // Handle the request\n *\n * return forward(operation);\n * });\n *\n * const link = previousLink.concat(\n * link1,\n * link2,\n * new HttpLink({ uri: \"http://localhost:4000/graphql\" })\n * );\n * ```\n */\n public concat(...links: ApolloLink[]): ApolloLink {\n if (links.length === 0) {\n return this;\n }\n\n return links.reduce(this.combine.bind(this), this);\n }\n\n private combine(left: ApolloLink, right: ApolloLink) {\n const link = new ApolloLink((operation, forward) => {\n return left.request(operation, (op) => right.request(op, forward));\n });\n\n return Object.assign(link, { left, right });\n }\n\n /**\n * Runs the request handler for the provided operation.\n *\n * > [!NOTE]\n * > This is called by the `ApolloLink.execute` function for you and should\n * > not be called directly. Prefer using `ApolloLink.execute` to make the\n * > request instead.\n */\n public request(\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ): Observable<ApolloLink.Result> {\n throw newInvariantError(\"request is not implemented\");\n }\n\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly left?: ApolloLink;\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly right?: ApolloLink;\n\n /**\n * @internal\n * Can be provided by a link that has an internal cache to report it's memory details.\n */\n getMemoryInternals?: () => unknown;\n}\n"],"names":[],"mappings":"AAMA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAA4B;AAO5B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAgC,CAAhC,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,CAA2D;AAC3D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAwB,CAAxB,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAC9D,CAAA,CAAA,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AnD,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0D,CAAC,CAA3D,CAA6D,EAAE,CAA/D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsE,CAAC,CAAC;QACpE,CAAC,CAAC;QAEF,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAiB,CAAC,CAAlB,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAA6B,EAAE,EAAE,CAAjC,CAAA,CAAA,CAAqC,EAAE,CAAvC,CAAA,CAAA,CAAA,EAAA,CAA8C,CAAC;IAC7C;IAEA,CAAF,CAAA;;;;;;;KAOA,CAAA;IACS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CACZ,CADJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACmC,EAC/B,CAFJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAEuC,EAFvC;QAII,CAAJ,CAAA,CAAA,CAAA,EAAU,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAyD;IACvD;;;;;;;IAMS,CAAX,CAAA,CAAA,CAAe;;;;;;;IAKJ,CAAX,CAAA,CAAA,CAAA,CAAgB;;;;;;;IAMd,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB;AACpB;"}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
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.ts.map
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
2
+ /**
3
+ * @deprecated Use `ApolloLink.from` instead. `concat` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export const concat = ApolloLink.concat;
3
7
  //# sourceMappingURL=concat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/link/core/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const concat = ApolloLink.concat;\n"]}
1
+ {"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/link/core/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC","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"]}
@@ -0,0 +1,10 @@
1
+ import type { ApolloLink } from "./ApolloLink.js";
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.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deprecated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../../src/link/core/deprecated.ts"],"names":[],"mappings":"","sourcesContent":["import type { ApolloLink } from \"./ApolloLink.js\";\n\n/** @deprecated Use `ApolloLink.Request` instead */\nexport type GraphQLRequest = ApolloLink.Request;\n\n/** @deprecated Use `ApolloLink.Operation` instead */\nexport type Operation = ApolloLink.Operation;\n\n/** @deprecated Use `ApolloLink.RequestHandler` instead */\nexport type RequestHandler = ApolloLink.RequestHandler;\n\n/** @deprecated Use `ApolloLink.Result` instead */\nexport type FetchResult<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> = ApolloLink.Result<TData, TExtensions>;\n"]}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
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.ts.map
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
2
+ /**
3
+ * @deprecated Use `ApolloLink.empty` instead. `empty` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export const empty = ApolloLink.empty;
3
7
  //# sourceMappingURL=empty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../src/link/core/empty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const empty = ApolloLink.empty;\n"]}
1
+ {"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../src/link/core/empty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","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"]}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
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.ts.map
package/link/core/from.js CHANGED
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
2
+ /**
3
+ * @deprecated Use `ApolloLink.from` instead. `from` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export const from = ApolloLink.from;
3
7
  //# sourceMappingURL=from.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/link/core/from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const from = ApolloLink.from;\n"]}
1
+ {"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/link/core/from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC","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"]}
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
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.ts.map
@@ -1,3 +1,7 @@
1
1
  import { ApolloLink } from "./ApolloLink.js";
2
+ /**
3
+ * @deprecated Use `ApolloLink.split` instead. `split` will be removed in a
4
+ * future major version.
5
+ */
2
6
  export const split = ApolloLink.split;
3
7
  //# sourceMappingURL=split.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/link/core/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const split = ApolloLink.split;\n"]}
1
+ {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/link/core/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","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"]}
@@ -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.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/link/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n FormattedExecutionResult,\n GraphQLFormattedError,\n OperationTypeNode,\n} from \"graphql\";\nimport type { DocumentNode } from \"graphql\";\nimport type { Observable } from \"rxjs\";\n\nimport type {\n ApolloClient,\n DefaultContext,\n OperationVariables,\n} from \"@apollo/client\";\n\nexport type { DocumentNode };\n\nexport interface ApolloPayloadResult<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> {\n payload: FormattedExecutionResult<TData, TExtensions> | null;\n // Transport layer errors (as distinct from GraphQL or NetworkErrors),\n // these are fatal errors that will include done: true.\n errors?: ReadonlyArray<GraphQLFormattedError>;\n}\n\nexport interface GraphQLRequest<\n TVariables extends OperationVariables = Record<string, any>,\n> {\n query: DocumentNode;\n variables?: TVariables;\n operationName?: string;\n operationType?: OperationTypeNode;\n context?: DefaultContext;\n extensions?: Record<string, any>;\n}\n\nexport interface Operation {\n query: DocumentNode;\n variables: Record<string, any>;\n operationName: string;\n operationType: OperationTypeNode | undefined;\n extensions: Record<string, any>;\n setContext: {\n (context: Partial<OperationContext>): void;\n (\n updateContext: (\n previousContext: OperationContext\n ) => Partial<OperationContext>\n ): void;\n };\n getContext: () => OperationContext;\n readonly client: ApolloClient;\n}\n\nexport interface ExecuteContext {\n client: ApolloClient;\n}\n\nexport interface OperationContext extends DefaultContext {}\n\nexport type FetchResult<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> =\n | FormattedExecutionResult<TData, TExtensions>\n | AdditionalFetchResultTypes<\n TData,\n TExtensions\n >[keyof AdditionalFetchResultTypes<TData, TExtensions>];\n\nexport interface AdditionalFetchResultTypes<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> {}\n\nexport type NextLink = (operation: Operation) => Observable<FetchResult>;\n\nexport type RequestHandler = (\n operation: Operation,\n forward: NextLink\n) => Observable<FetchResult> | null;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/link/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { FormattedExecutionResult, GraphQLFormattedError } from \"graphql\";\nimport type { DocumentNode } from \"graphql\";\n\nexport type { DocumentNode };\n\nexport interface ApolloPayloadResult<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> {\n payload: FormattedExecutionResult<TData, TExtensions> | null;\n // Transport layer errors (as distinct from GraphQL or NetworkErrors),\n // these are fatal errors that will include done: true.\n errors?: ReadonlyArray<GraphQLFormattedError>;\n}\n\nexport interface AdditionalApolloLinkResultTypes<\n TData = Record<string, any>,\n TExtensions = Record<string, any>,\n> {}\n"]}
@@ -1,13 +1,12 @@
1
1
  import { Observable } from "rxjs";
2
2
  import type { ErrorLike } from "@apollo/client";
3
- import type { FetchResult, NextLink, Operation } from "@apollo/client/link";
4
3
  import { ApolloLink } from "@apollo/client/link";
5
4
  export declare namespace ErrorLink {
6
5
  /**
7
6
  * Callback to be triggered when an error occurs within the link stack.
8
7
  */
9
8
  interface ErrorHandler {
10
- (options: ErrorHandlerOptions): Observable<FetchResult> | void;
9
+ (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
11
10
  }
12
11
  interface ErrorHandlerOptions {
13
12
  /**
@@ -22,16 +21,16 @@ export declare namespace ErrorLink {
22
21
  * The raw GraphQL result from the server (if available), which may include
23
22
  * partial data alongside errors.
24
23
  */
25
- result?: FetchResult;
24
+ result?: ApolloLink.Result;
26
25
  /** The details of the GraphQL operation that produced an error. */
27
- operation: Operation;
26
+ operation: ApolloLink.Operation;
28
27
  /**
29
28
  * A function that calls the next link in the link chain. Calling
30
29
  * `return forward(operation)` in your `ErrorLink` callback
31
30
  * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the
32
31
  * upstream link to subscribe to.
33
32
  */
34
- forward: NextLink;
33
+ forward: ApolloLink.ForwardFunction;
35
34
  }
36
35
  }
37
36
  export import ErrorHandler = ErrorLink.ErrorHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/error/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,sBAAsB,EACtB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAyCjD;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,YAA0B;IAChD,OAAO,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,OAAO,SAAU,SAAQ,UAAU;IACvC,YAAY,YAAoC;QAC9C,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;YAC3B,OAAO,IAAI,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACjC,IAAI,GAA6B,CAAC;g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CAAC,UAAU,EAAE,CAAC;gCAChB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;4BACxB,CAAC;wBACH,CAAC;wBACD,QAAQ,EAAE,GAAG,EAAE;4BACb,+DAA+D;4BAC/D,yBAAyB;4BACzB,IAAI,CAAC,aAAa,EAAE,CAAC;gCACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;4BACtB,CAAC;wBACH,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,YAAY,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC5D,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC;gBAED,OAAO,GAAG,EAAE;oBACV,IAAI,GAAG;wBAAE,GAAG,CAAC,WAAW,EAAE,CAAC;oBAC3B,IAAI,UAAU;wBAAE,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport type { FetchResult, NextLink, Operation } from \"@apollo/client/link\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n /**\n * Callback to be triggered when an error occurs within the link stack.\n */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<FetchResult> | void;\n }\n\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: FetchResult;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: NextLink;\n }\n}\n\n// For backwards compatibility.\nexport import ErrorHandler = ErrorLink.ErrorHandler;\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/error/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,sBAAsB,EACtB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAyCjD;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,YAA0B;IAChD,OAAO,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,OAAO,SAAU,SAAQ,UAAU;IACvC,YAAY,YAAoC;QAC9C,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;YAC3B,OAAO,IAAI,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACjC,IAAI,GAA6B,CAAC;gBAClC,IAAI,UAAoC,CAAC;gBACzC,IAAI,aAAuC,CAAC;gBAE5C,IAAI,CAAC;oBACH,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;wBACjC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;4BACf,MAAM,OAAO,GACX,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAC;4BACtD,MAAM,MAAM,GACV,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;gCACnC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;gCAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;4BAClB,IAAI,MAAM,EAAE,CAAC;gCACX,aAAa,GAAG,YAAY,CAAC;oCAC3B,KAAK,EAAE,IAAI,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC;oCAChD,MAAM;oCACN,SAAS;oCACT,OAAO;iCACR,C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AAU;wBAAE,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n /**\n * Callback to be triggered when an error occurs within the link stack.\n */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;\n }\n\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: ApolloLink.Result;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: ApolloLink.Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: ApolloLink.ForwardFunction;\n }\n}\n\n// For backwards compatibility.\nexport import ErrorHandler = ErrorLink.ErrorHandler;\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"]}
@@ -31,7 +31,7 @@ export class BaseHttpLink extends ApolloLink {
31
31
  super((operation) => {
32
32
  let chosenURI = selectURI(operation, uri);
33
33
  const context = operation.getContext();
34
- const http = (context.http ??= {});
34
+ const http = { ...context.http };
35
35
  if (isSubscriptionOperation(operation.query)) {
36
36
  http.accept = [
37
37
  "multipart/mixed;boundary=graphql;subscriptionSpec=1.0",
@@ -39,7 +39,7 @@ export class BaseHttpLink extends ApolloLink {
39
39
  ];
40
40
  }
41
41
  const contextConfig = {
42
- http: context.http,
42
+ http,
43
43
  options: context.fetchOptions,
44
44
  credentials: context.credentials,
45
45
  headers: context.headers,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseHttpLink.js","sourceRoot":"","sources":["../../../src/link/http/BaseHttpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MA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AAY,CAAC,CAAC;oBACnD,CAAC;yBAAM,CAAC;wBACN,OAAO,yBAAyB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CACxD,YAAY,CACb,CAAC;oBACJ,CAAC;gBACH,CAAC,CAAC;qBACD,IAAI,CAAC,GAAG,EAAE;oBACT,UAAU,GAAG,SAAS,CAAC;oBACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACb,UAAU,GAAG,SAAS,CAAC;oBACvB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC;gBAEL,OAAO,GAAG,EAAE;oBACV,qCAAqC;oBACrC,oEAAoE;oBACpE,IAAI,UAAU;wBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;gBACrC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { filterOperationVariables } from \"@apollo/client/link/utils\";\nimport {\n isMutationOperation,\n isSubscriptionOperation,\n} from \"@apollo/client/utilities\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { compact } from \"@apollo/client/utilities/internal\";\nimport { maybe } from \"@apollo/client/utilities/internal/globals\";\n\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport type { HttpLink } from \"./HttpLink.js\";\nimport {\n parseAndCheckHttpResponse,\n readMultipartBody,\n} from \"./parseAndCheckHttpResponse.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport {\n defaultPrinter,\n fallbackHttpConfig,\n selectHttpOptionsAndBodyInternal,\n} from \"./selectHttpOptionsAndBody.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\n\nconst backupFetch = maybe(() => fetch);\n\nexport class BaseHttpLink extends ApolloLink {\n constructor(linkOptions: HttpLink.Options = {}) {\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing passed in\n fetch: preferredFetch,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n useGETForQueries,\n includeUnusedVariables = false,\n ...requestOptions\n } = linkOptions;\n\n if (__DEV__) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch is\n // defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n\n const linkConfig = {\n http: compact({ includeExtensions, preserveHeaderCase }),\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n super((operation) => {\n let chosenURI = selectURI(operation, uri);\n\n const context = operation.getContext();\n\n const http = (context.http ??= {});\n if (isSubscriptionOperation(operation.query)) {\n http.accept = [\n \"multipart/mixed;boundary=graphql;subscriptionSpec=1.0\",\n ...(http.accept || []),\n ];\n }\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //uses fallback, link, and then context to build options\n const { options, body } = selectHttpOptionsAndBodyInternal(\n operation,\n print,\n fallbackHttpConfig,\n linkConfig,\n contextConfig\n );\n\n if (body.variables && !includeUnusedVariables) {\n body.variables = filterOperationVariables(\n body.variables,\n operation.query\n );\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n if (useGETForQueries && !isMutationOperation(operation.query)) {\n options.method = \"GET\";\n }\n\n return new Observable((observer) => {\n if (options.method === \"GET\") {\n const { newURI, parseError } = rewriteURIForGET(chosenURI, body);\n if (parseError) {\n throw parseError;\n }\n chosenURI = newURI;\n } else {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise\n // fall back to the *current* global window.fetch function (see issue\n // #7832), or (if all else fails) the backupFetch function we saved when\n // this module was first evaluated. This last option protects against the\n // removal of window.fetch, which is unlikely but not impossible.\n const currentFetch =\n preferredFetch || maybe(() => fetch) || backupFetch;\n\n const observerNext = observer.next.bind(observer);\n currentFetch!(chosenURI, options)\n .then((response) => {\n operation.setContext({ response });\n const ctype = response.headers?.get(\"content-type\");\n\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n } else {\n return parseAndCheckHttpResponse(operation)(response).then(\n observerNext\n );\n }\n })\n .then(() => {\n controller = undefined;\n observer.complete();\n })\n .catch((err) => {\n controller = undefined;\n observer.error(err);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"BaseHttpLink.js","sourceRoot":"","sources":["../../../src/link/http/BaseHttpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OA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} from \"@apollo/client/link\";\nimport { filterOperationVariables } from \"@apollo/client/link/utils\";\nimport {\n isMutationOperation,\n isSubscriptionOperation,\n} from \"@apollo/client/utilities\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { compact } from \"@apollo/client/utilities/internal\";\nimport { maybe } from \"@apollo/client/utilities/internal/globals\";\n\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport type { HttpLink } from \"./HttpLink.js\";\nimport {\n parseAndCheckHttpResponse,\n readMultipartBody,\n} from \"./parseAndCheckHttpResponse.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport {\n defaultPrinter,\n fallbackHttpConfig,\n selectHttpOptionsAndBodyInternal,\n} from \"./selectHttpOptionsAndBody.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\n\nconst backupFetch = maybe(() => fetch);\n\nexport class BaseHttpLink extends ApolloLink {\n constructor(linkOptions: HttpLink.Options = {}) {\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing passed in\n fetch: preferredFetch,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n useGETForQueries,\n includeUnusedVariables = false,\n ...requestOptions\n } = linkOptions;\n\n if (__DEV__) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch is\n // defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n\n const linkConfig = {\n http: compact({ includeExtensions, preserveHeaderCase }),\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n super((operation) => {\n let chosenURI = selectURI(operation, uri);\n\n const context = operation.getContext();\n\n const http = { ...context.http };\n if (isSubscriptionOperation(operation.query)) {\n http.accept = [\n \"multipart/mixed;boundary=graphql;subscriptionSpec=1.0\",\n ...(http.accept || []),\n ];\n }\n\n const contextConfig = {\n http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //uses fallback, link, and then context to build options\n const { options, body } = selectHttpOptionsAndBodyInternal(\n operation,\n print,\n fallbackHttpConfig,\n linkConfig,\n contextConfig\n );\n\n if (body.variables && !includeUnusedVariables) {\n body.variables = filterOperationVariables(\n body.variables,\n operation.query\n );\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n if (useGETForQueries && !isMutationOperation(operation.query)) {\n options.method = \"GET\";\n }\n\n return new Observable((observer) => {\n if (options.method === \"GET\") {\n const { newURI, parseError } = rewriteURIForGET(chosenURI, body);\n if (parseError) {\n throw parseError;\n }\n chosenURI = newURI;\n } else {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise\n // fall back to the *current* global window.fetch function (see issue\n // #7832), or (if all else fails) the backupFetch function we saved when\n // this module was first evaluated. This last option protects against the\n // removal of window.fetch, which is unlikely but not impossible.\n const currentFetch =\n preferredFetch || maybe(() => fetch) || backupFetch;\n\n const observerNext = observer.next.bind(observer);\n currentFetch!(chosenURI, options)\n .then((response) => {\n operation.setContext({ response });\n const ctype = response.headers?.get(\"content-type\");\n\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n } else {\n return parseAndCheckHttpResponse(operation)(response).then(\n observerNext\n );\n }\n })\n .then(() => {\n controller = undefined;\n observer.complete();\n })\n .catch((err) => {\n controller = undefined;\n observer.error(err);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n });\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import type { ASTNode } from "graphql";
2
- import type { Operation } from "@apollo/client/link";
3
2
  import { ApolloLink } from "@apollo/client/link";
4
3
  import { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
5
4
  import type { print } from "@apollo/client/utilities";
@@ -146,7 +145,7 @@ export declare namespace HttpLink {
146
145
  extensions?: Record<string, any>;
147
146
  }
148
147
  type Printer = (node: ASTNode, originalPrint: typeof print) => string;
149
- type UriFunction = (operation: Operation) => string;
148
+ type UriFunction = (operation: ApolloLink.Operation) => string;
150
149
  }
151
150
  export declare class HttpLink extends ApolloLink {
152
151
  constructor(options?: HttpLink.Options & ClientAwarenessLink.Options);
@@ -3,7 +3,10 @@ import { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
3
3
  import { BaseHttpLink } from "./BaseHttpLink.js";
4
4
  export class HttpLink extends ApolloLink {
5
5
  constructor(options = {}) {
6
- const { left, right, request } = ApolloLink.concat(new ClientAwarenessLink(options), new BaseHttpLink(options));
6
+ const { left, right, request } = ApolloLink.from([
7
+ new ClientAwarenessLink(options),
8
+ new BaseHttpLink(options),
9
+ ]);
7
10
  super(request);
8
11
  Object.assign(this, { left, right });
9
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"HttpLink.js","sourceRoot":"","sources":["../../../src/link/http/HttpLink.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuKjD,MAAM,OAAO,QAAS,SAAQ,UAAU;IACtC,YAAY,UAA0D,EAAE;QACtE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,MAAM,CAChD,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAChC,IAAI,YAAY,CAAC,OAAO,CAAC,CAC1B,CAAC;QACF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,cAA8D,EAAE,EAChE,EAAE,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import type { ASTNode } from \"graphql\";\n\nimport type { Operation } from \"@apollo/client/link\";\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { print } from \"@apollo/client/utilities\";\n\nimport { BaseHttpLink } from \"./BaseHttpLink.js\";\n\nexport declare namespace HttpLink {\n /**\n * Options passed to `HttpLink` through request context.\n */\n interface ContextOptions {\n /**\n * The URL of the GraphQL endpoint to send requests to. Can also be a\n * function that accepts an `Operation` object and returns the string URL to\n * use for that operation.\n */\n uri?: string | UriFunction;\n\n /**\n * An object representing headers to include in the HTTP request, such as\n * `{Authorization: 'Bearer abc123'}`.\n */\n headers?: Record<string, string>;\n\n /**\n * The credentials policy to use for this fetch call. Can be `omit`, `include`,\n * or `same-origin`.\n */\n credentials?: RequestCredentials;\n\n /**\n * An object containing options to use for this call to `fetch`. If a\n * particular option is not included in this object, the default value of\n * that option is used.\n *\n * Note that if you set `fetchOptions.method` to `GET`, `HttpLink` follows\n * [standard GraphQL HTTP GET encoding](http://graphql.org/learn/serving-over-http/#get-request).\n */\n fetchOptions?: RequestInit;\n\n /**\n * An object that configures advanced `HttpLink` functionality, such as\n * support for persisted queries.\n */\n http?: HttpLink.HttpOptions;\n }\n\n /**\n * Options passed to `HttpLink` through the `http` constructor option\n * or the `http` property of a request context.\n */\n export interface HttpOptions {\n /**\n * If `true`, includes the `extensions` field in operations sent to your\n * GraphQL endpoint.\n *\n * @defaultValue true\n */\n includeExtensions?: boolean;\n\n /**\n * If `false`, the GraphQL query string is not included in the request. Set\n * this option if you're sending a request that uses a [persisted query](https://www.apollographql.com/docs/react/api/link/persisted-queries/).\n *\n * @defaultValue true\n */\n includeQuery?: boolean;\n\n /**\n * If set to true, header names won't be automatically normalized to\n * lowercase. This allows for non-http-spec-compliant servers that might\n * expect capitalized header names.\n *\n * @defaultValue false\n */\n preserveHeaderCase?: boolean;\n\n /**\n * A list of additional `accept` headers to include in the request,\n * as defined in\n * https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2\n *\n * @example\n *\n * ```json\n * [\"application/custom+json;q=1.0\"]\n * ```\n */\n accept?: string[];\n }\n\n /**\n * Options for the `HttpLink` constructor.\n */\n export interface Options {\n /**\n * The URI to use when fetching operations.\n *\n * Defaults to '/graphql'.\n */\n uri?: string | UriFunction;\n\n /**\n * Passes the extensions field to your graphql server.\n *\n * Defaults to true.\n */\n includeExtensions?: boolean;\n\n /**\n * A `fetch`-compatible API to use when making requests.\n */\n fetch?: typeof fetch;\n\n /**\n * An object representing values to be sent as headers on the request.\n */\n headers?: Record<string, string>;\n\n /**\n * If set to true, header names won't be automatically normalized to\n * lowercase. This allows for non-http-spec-compliant servers that might\n * expect capitalized header names.\n */\n preserveHeaderCase?: boolean;\n\n /**\n * The credentials policy you want to use for the fetch call.\n */\n credentials?: string;\n\n /**\n * Any overrides of the fetch options argument to pass to the fetch call.\n */\n fetchOptions?: any;\n\n /**\n * If set to true, use the HTTP GET method for query operations. Mutations\n * will still use the method specified in fetchOptions.method (which defaults\n * to POST).\n */\n useGETForQueries?: boolean;\n\n /**\n * If set to true, the default behavior of stripping unused variables\n * from the request will be disabled.\n *\n * Unused variables are likely to trigger server-side validation errors,\n * per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this\n * includeUnusedVariables option can be useful if your server deviates\n * from the GraphQL specification by not strictly enforcing that rule.\n */\n includeUnusedVariables?: boolean;\n /**\n * A function to substitute for the default query print function. Can be\n * used to apply changes to the results of the print function.\n */\n print?: Printer;\n }\n\n interface Body {\n query?: string;\n operationName?: string;\n variables?: Record<string, any>;\n extensions?: Record<string, any>;\n }\n\n type Printer = (node: ASTNode, originalPrint: typeof print) => string;\n type UriFunction = (operation: Operation) => string;\n}\n\nexport class HttpLink extends ApolloLink {\n constructor(options: HttpLink.Options & ClientAwarenessLink.Options = {}) {\n const { left, right, request } = ApolloLink.concat(\n new ClientAwarenessLink(options),\n new BaseHttpLink(options)\n );\n super(request);\n Object.assign(this, { left, right });\n }\n}\n\n/**\n * @deprecated\n * Use `HttpLink` from `@apollo/client/link/http` instead.\n */\nexport const createHttpLink = (\n linkOptions: HttpLink.Options & ClientAwarenessLink.Options = {}\n) => new HttpLink(linkOptions);\n"]}
1
+ {"version":3,"file":"HttpLink.js","sourceRoot":"","sources":["../../../src/link/http/HttpLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuKjD,MAAM,OAAO,QAAS,SAAQ,UAAU;IACtC,YAAY,UAA0D,EAAE;QACtE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;YAC/C,IAAI,mBAAmB,CAAC,OAAO,CAAC;YAChC,IAAI,YAAY,CAAC,OAAO,CAAC;SAC1B,CAAC,CAAC;QACH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,cAA8D,EAAE,EAChE,EAAE,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import type { ASTNode } from \"graphql\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { print } from \"@apollo/client/utilities\";\n\nimport { BaseHttpLink } from \"./BaseHttpLink.js\";\n\nexport declare namespace HttpLink {\n /**\n * Options passed to `HttpLink` through request context.\n */\n interface ContextOptions {\n /**\n * The URL of the GraphQL endpoint to send requests to. Can also be a\n * function that accepts an `Operation` object and returns the string URL to\n * use for that operation.\n */\n uri?: string | UriFunction;\n\n /**\n * An object representing headers to include in the HTTP request, such as\n * `{Authorization: 'Bearer abc123'}`.\n */\n headers?: Record<string, string>;\n\n /**\n * The credentials policy to use for this fetch call. Can be `omit`, `include`,\n * or `same-origin`.\n */\n credentials?: RequestCredentials;\n\n /**\n * An object containing options to use for this call to `fetch`. If a\n * particular option is not included in this object, the default value of\n * that option is used.\n *\n * Note that if you set `fetchOptions.method` to `GET`, `HttpLink` follows\n * [standard GraphQL HTTP GET encoding](http://graphql.org/learn/serving-over-http/#get-request).\n */\n fetchOptions?: RequestInit;\n\n /**\n * An object that configures advanced `HttpLink` functionality, such as\n * support for persisted queries.\n */\n http?: HttpLink.HttpOptions;\n }\n\n /**\n * Options passed to `HttpLink` through the `http` constructor option\n * or the `http` property of a request context.\n */\n export interface HttpOptions {\n /**\n * If `true`, includes the `extensions` field in operations sent to your\n * GraphQL endpoint.\n *\n * @defaultValue true\n */\n includeExtensions?: boolean;\n\n /**\n * If `false`, the GraphQL query string is not included in the request. Set\n * this option if you're sending a request that uses a [persisted query](https://www.apollographql.com/docs/react/api/link/persisted-queries/).\n *\n * @defaultValue true\n */\n includeQuery?: boolean;\n\n /**\n * If set to true, header names won't be automatically normalized to\n * lowercase. This allows for non-http-spec-compliant servers that might\n * expect capitalized header names.\n *\n * @defaultValue false\n */\n preserveHeaderCase?: boolean;\n\n /**\n * A list of additional `accept` headers to include in the request,\n * as defined in\n * https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2\n *\n * @example\n *\n * ```json\n * [\"application/custom+json;q=1.0\"]\n * ```\n */\n accept?: string[];\n }\n\n /**\n * Options for the `HttpLink` constructor.\n */\n export interface Options {\n /**\n * The URI to use when fetching operations.\n *\n * Defaults to '/graphql'.\n */\n uri?: string | UriFunction;\n\n /**\n * Passes the extensions field to your graphql server.\n *\n * Defaults to true.\n */\n includeExtensions?: boolean;\n\n /**\n * A `fetch`-compatible API to use when making requests.\n */\n fetch?: typeof fetch;\n\n /**\n * An object representing values to be sent as headers on the request.\n */\n headers?: Record<string, string>;\n\n /**\n * If set to true, header names won't be automatically normalized to\n * lowercase. This allows for non-http-spec-compliant servers that might\n * expect capitalized header names.\n */\n preserveHeaderCase?: boolean;\n\n /**\n * The credentials policy you want to use for the fetch call.\n */\n credentials?: string;\n\n /**\n * Any overrides of the fetch options argument to pass to the fetch call.\n */\n fetchOptions?: any;\n\n /**\n * If set to true, use the HTTP GET method for query operations. Mutations\n * will still use the method specified in fetchOptions.method (which defaults\n * to POST).\n */\n useGETForQueries?: boolean;\n\n /**\n * If set to true, the default behavior of stripping unused variables\n * from the request will be disabled.\n *\n * Unused variables are likely to trigger server-side validation errors,\n * per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this\n * includeUnusedVariables option can be useful if your server deviates\n * from the GraphQL specification by not strictly enforcing that rule.\n */\n includeUnusedVariables?: boolean;\n /**\n * A function to substitute for the default query print function. Can be\n * used to apply changes to the results of the print function.\n */\n print?: Printer;\n }\n\n interface Body {\n query?: string;\n operationName?: string;\n variables?: Record<string, any>;\n extensions?: Record<string, any>;\n }\n\n type Printer = (node: ASTNode, originalPrint: typeof print) => string;\n type UriFunction = (operation: ApolloLink.Operation) => string;\n}\n\nexport class HttpLink extends ApolloLink {\n constructor(options: HttpLink.Options & ClientAwarenessLink.Options = {}) {\n const { left, right, request } = ApolloLink.from([\n new ClientAwarenessLink(options),\n new BaseHttpLink(options),\n ]);\n super(request);\n Object.assign(this, { left, right });\n }\n}\n\n/**\n * @deprecated\n * Use `HttpLink` from `@apollo/client/link/http` instead.\n */\nexport const createHttpLink = (\n linkOptions: HttpLink.Options & ClientAwarenessLink.Options = {}\n) => new HttpLink(linkOptions);\n"]}
@@ -1,5 +1,5 @@
1
1
  import { invariant } from "@apollo/client/utilities/invariant";
2
2
  export const checkFetcher = (fetcher) => {
3
- invariant(fetcher || typeof fetch !== "undefined", 59);
3
+ invariant(fetcher || typeof fetch !== "undefined", 58);
4
4
  };
5
5
  //# sourceMappingURL=checkFetcher.js.map
@@ -1,4 +1,4 @@
1
- import type { Operation } from "@apollo/client/link";
1
+ import type { ApolloLink } from "@apollo/client/link";
2
2
  export declare function readMultipartBody<T extends object = Record<string, unknown>>(response: Response, nextValue: (value: T) => void): Promise<void>;
3
- export declare function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise<any>;
3
+ export declare function parseAndCheckHttpResponse(operations: ApolloLink.Operation | ApolloLink.Operation[]): (response: Response) => Promise<any>;
4
4
  //# sourceMappingURL=parseAndCheckHttpResponse.d.ts.map
@@ -33,37 +33,52 @@ async function* consumeMultipartBody(response) {
33
33
  /;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i);
34
34
  const boundary = "\r\n--" + (match?.findLast((val) => !!val) || "-");
35
35
  let buffer = "";
36
- invariant(response.body && typeof response.body.getReader === "function", 60);
37
- const reader = response.body.getReader();
36
+ invariant(response.body && typeof response.body.getReader === "function", 59);
37
+ const stream = response.body;
38
+ const reader = stream.getReader();
38
39
  let done = false;
40
+ let encounteredBoundary = false;
39
41
  let value;
40
- while (!done) {
41
- ({ value, done } = await reader.read());
42
- const chunk = typeof value === "string" ? value : decoder.decode(value);
43
- const searchFrom = buffer.length - boundary.length + 1;
44
- buffer += chunk;
45
- let bi = buffer.indexOf(boundary, searchFrom);
46
- while (bi > -1) {
47
- let message;
48
- [message, buffer] = [
49
- buffer.slice(0, bi),
50
- buffer.slice(bi + boundary.length),
51
- ];
52
- const i = message.indexOf("\r\n\r\n");
53
- const headers = parseHeaders(message.slice(0, i));
54
- const contentType = headers["content-type"];
55
- if (contentType &&
56
- contentType.toLowerCase().indexOf("application/json") === -1) {
57
- throw new Error("Unsupported patch content type: application/json is required.");
42
+ // check to see if we received the final boundary, which is a normal boundary followed by "--"
43
+ // as described in https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1
44
+ const passedFinalBoundary = () => encounteredBoundary && buffer[0] == "-" && buffer[1] == "-";
45
+ try {
46
+ while (!done) {
47
+ ({ value, done } = await reader.read());
48
+ const chunk = typeof value === "string" ? value : decoder.decode(value);
49
+ const searchFrom = buffer.length - boundary.length + 1;
50
+ buffer += chunk;
51
+ let bi = buffer.indexOf(boundary, searchFrom);
52
+ while (bi > -1 && !passedFinalBoundary()) {
53
+ encounteredBoundary = true;
54
+ let message;
55
+ [message, buffer] = [
56
+ buffer.slice(0, bi),
57
+ buffer.slice(bi + boundary.length),
58
+ ];
59
+ const i = message.indexOf("\r\n\r\n");
60
+ const headers = parseHeaders(message.slice(0, i));
61
+ const contentType = headers["content-type"];
62
+ if (contentType &&
63
+ contentType.toLowerCase().indexOf("application/json") === -1) {
64
+ throw new Error("Unsupported patch content type: application/json is required.");
65
+ }
66
+ // nb: Technically you'd want to slice off the beginning "\r\n" but since
67
+ // this is going to be `JSON.parse`d there is no need.
68
+ const body = message.slice(i);
69
+ if (body) {
70
+ yield body;
71
+ }
72
+ bi = buffer.indexOf(boundary);
58
73
  }
59
- // nb: Technically you'd want to slice off the beginning "\r\n" but since
60
- // this is going to be `JSON.parse`d there is no need.
61
- const body = message.slice(i);
62
- if (body) {
63
- yield body;
74
+ if (passedFinalBoundary()) {
75
+ return;
64
76
  }
65
- bi = buffer.indexOf(boundary);
66
77
  }
78
+ throw new Error("premature end of multipart body");
79
+ }
80
+ finally {
81
+ reader.cancel();
67
82
  }
68
83
  }
69
84
  export async function readMultipartBody(response, nextValue) {