@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 +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;AA+MjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,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](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `HttpLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `HttpLink` constructor.\n * > If a value is provided to both, the value in `context` takes precedence.\n */\n interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#uri:member} */\n uri?: string | HttpLink.UriFunction;\n\n /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#headers:member} */\n headers?: Record<string, string>;\n\n /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#credentials:member} */\n credentials?: RequestCredentials;\n\n /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#fetchOptions:member} */\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` property of a request\n * context.\n */\n export interface HttpOptions {\n /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#includeExtensions:member} */\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 /** {@inheritDoc @apollo/client/link/http!HttpLink.Shared.Options#preserveHeaderCase:member} */\n preserveHeaderCase?: boolean;\n\n /**\n * A list of additional `accept` headers to include in the request,\n * as defined in 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 export namespace Shared {\n /** These options are shared between `HttpLink` and `BatchHttpLink` */\n export interface Options {\n /**\n * The URL of the GraphQL endpoint to send requests to. Can also be a\n * function that accepts an `ApolloLink.Operation` object and returns the\n * string URL to use for that operation.\n *\n * @defaultValue \"/graphql\"\n */\n uri?: string | HttpLink.UriFunction;\n\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 * A function to use instead of calling the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) directly\n * when sending HTTP requests to your GraphQL endpoint. The function must\n * conform to the signature of `fetch`.\n *\n * By default, the Fetch API is used unless it isn't available in your\n * runtime environment.\n *\n * See [Customizing `fetch`](https://apollographql.com/docs/react/api/link/introduction#customizing-fetch).\n */\n fetch?: typeof fetch;\n\n /**\n * An object representing headers to include in every HTTP request.\n *\n * @example\n *\n * ```json\n * {\n * \"Authorization\": \"Bearer 1234\"\n * }\n * ```\n */\n headers?: Record<string, string>;\n\n /**\n * If `true`, header names won't be automatically normalized to lowercase.\n * This allows for non-http-spec-compliant servers that might expect\n * capitalized header names.\n *\n * @defaultValue false\n */\n preserveHeaderCase?: boolean;\n\n /**\n * The credentials policy to use for each `fetch` call.\n */\n credentials?: RequestCredentials;\n\n /**\n * Any overrides of the fetch options argument to pass to the fetch call.\n *\n * An object containing options to use for each 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]\n * > If you set `fetchOptions.method` to `GET`, `HttpLink` follows [standard\n * > GraphQL HTTP GET encoding](http://graphql.org/learn/serving-over-http/#get-request).\n *\n * See [available options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n */\n fetchOptions?: RequestInit;\n\n /**\n * If `true`, unused variables from the operation will not be stripped from\n * the request and will instead be sent to the GraphQL endpoint.\n *\n * @remarks\n * Unused variables are likely to trigger server-side validation errors,\n * per https://spec.graphql.org/draft/#sec-All-Variables-Used.\n * `includeUnusedVariables` can be useful if your server deviates\n * from the GraphQL specification by not strictly enforcing that rule.\n *\n * @defaultValue false\n */\n includeUnusedVariables?: boolean;\n /**\n * A function to use when transforming a GraphQL document into a string. It\n * accepts an `ASTNode` (typically a `DocumentNode`) and the original `print`\n * function as arguments, and is expected to return a string. This option\n * enables you to, for example, use `stripIgnoredCharacters` to remove\n * whitespace from queries.\n *\n * By default the [GraphQL `print` function](https://graphql.org/graphql-js/language/#print) is used.\n *\n * @example\n *\n * ```ts\n * import { stripIgnoredCharacters } from \"graphql\";\n *\n * const httpLink = new HttpLink({\n * uri: \"/graphql\",\n * print: (ast, originalPrint) => stripIgnoredCharacters(originalPrint(ast)),\n * });\n * ```\n */\n print?: HttpLink.Printer;\n }\n }\n\n /**\n * Options provided to the `HttpLink` constructor.\n *\n * > [!NOTE]\n * > Some of these options are also available to override in [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context).\n * > Context options override the options passed to the constructor. Treat\n * > these options as default values that are used when the request context\n * > does not override the value.\n */\n interface Options extends Shared.Options {\n /**\n * If `true`, the link uses an HTTP `GET` request when sending query\n * operations to your GraphQL endpoint. Mutation operations continue to use\n * `POST` requests. If you want all operations to use `GET` requests,\n * set `fetchOptions.method` instead.\n *\n * @defaultValue false\n */\n useGETForQueries?: boolean;\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\n/**\n * `HttpLink` is a terminating link that sends a GraphQL operation to a remote\n * endpoint over HTTP. It combines the functionality of `BaseHttpLink` and\n * `ClientAwarenessLink` into a single link.\n *\n * @remarks\n *\n * `HttpLink` supports both POST and GET requests, and you can configure HTTP\n * options on a per-operation basis. You can use these options for\n * authentication, persisted queries, dynamic URIs, and other granular updates.\n *\n * @example\n *\n * ```ts\n * import { HttpLink } from \"@apollo/client\";\n *\n * const link = new HttpLink({\n * uri: \"http://localhost:4000/graphql\",\n * // Additional options\n * });\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,6 +1,4 @@
1
1
  export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js";
2
- export type { ClientParseError } from "./serializeFetchParameter.js";
3
- export { serializeFetchParameter } from "./serializeFetchParameter.js";
4
2
  export { defaultPrinter, fallbackHttpConfig, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, } from "./selectHttpOptionsAndBody.js";
5
3
  export { checkFetcher } from "./checkFetcher.js";
6
4
  export { createSignalIfSupported } from "./createSignalIfSupported.js";
@@ -1,5 +1,4 @@
1
1
  export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js";
2
- export { serializeFetchParameter } from "./serializeFetchParameter.js";
3
2
  export { defaultPrinter, fallbackHttpConfig, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public
4
3
  } from "./selectHttpOptionsAndBody.js";
5
4
  export { checkFetcher } from "./checkFetcher.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,gCAAgC,EAAE,yCAAyC;EAC5E,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { parseAndCheckHttpResponse } from \"./parseAndCheckHttpResponse.js\";\nexport type { ClientParseError } from \"./serializeFetchParameter.js\";\nexport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nexport {\n defaultPrinter,\n fallbackHttpConfig,\n selectHttpOptionsAndBody,\n selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public\n} from \"./selectHttpOptionsAndBody.js\";\nexport { checkFetcher } from \"./checkFetcher.js\";\nexport { createSignalIfSupported } from \"./createSignalIfSupported.js\";\nexport { selectURI } from \"./selectURI.js\";\nexport { BaseHttpLink } from \"./BaseHttpLink.js\";\nexport { createHttpLink, HttpLink } from \"./HttpLink.js\";\nexport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,gCAAgC,EAAE,yCAAyC;EAC5E,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { parseAndCheckHttpResponse } from \"./parseAndCheckHttpResponse.js\";\nexport {\n defaultPrinter,\n fallbackHttpConfig,\n selectHttpOptionsAndBody,\n selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public\n} from \"./selectHttpOptionsAndBody.js\";\nexport { checkFetcher } from \"./checkFetcher.js\";\nexport { createSignalIfSupported } from \"./createSignalIfSupported.js\";\nexport { selectURI } from \"./selectURI.js\";\nexport { BaseHttpLink } from \"./BaseHttpLink.js\";\nexport { createHttpLink, HttpLink } from \"./HttpLink.js\";\nexport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\n"]}
@@ -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
@@ -34,36 +34,51 @@ async function* consumeMultipartBody(response) {
34
34
  const boundary = "\r\n--" + (match?.findLast((val) => !!val) || "-");
35
35
  let buffer = "";
36
36
  invariant(response.body && typeof response.body.getReader === "function", 60);
37
- const reader = response.body.getReader();
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"parseAndCheckHttpResponse.js","sources":["../../../src/link/http/parseAndCheckHttpResponse.ts"],"sourcesContent":["import {\n CombinedProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n ServerError,\n ServerParseError,\n} from \"@apollo/client/errors\";\nimport type { ApolloPayloadResult, Operation } from \"@apollo/client/link\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * This function detects an Apollo payload result before it is transformed\n * into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n * once it leaves the link chain.\n */\nfunction isApolloPayloadResult(value: unknown): value is ApolloPayloadResult {\n return isNonNullObject(value) && \"payload\" in value;\n}\n\nasync function* consumeMultipartBody(\n response: Response\n): AsyncGenerator<string, void, void> {\n const decoder = new TextDecoder(\"utf-8\");\n const contentType = response.headers?.get(\"content-type\");\n\n // parse boundary value and ignore any subsequent name/value pairs after ;\n // https://www.rfc-editor.org/rfc/rfc9110.html#name-parameters\n // e.g. multipart/mixed;boundary=\"graphql\";deferSpec=20220824\n // if no boundary is specified, default to -\n const match = contentType?.match(\n /*\n ;\\s*boundary= # Match the boundary parameter\n (?: # either\n '([^']*)' # a string starting with ' doesn't contain ', ends with '\n | # or\n \"([^\"]*)\" # a string starting with \" doesn't contain \", ends with \"\n | # or\n ([^\"'].*?) # a string that doesn't start with ' or \", parsed non-greedily\n ) # end of the group\n \\s* # optional whitespace\n (?:;|$) # match a semicolon or end of string\n */\n /;\\s*boundary=(?:'([^']+)'|\"([^\"]+)\"|([^\"'].+?))\\s*(?:;|$)/i\n );\n const boundary = \"\\r\\n--\" + (match?.findLast((val) => !!val) || \"-\");\n let buffer = \"\";\n invariant(\n response.body && typeof response.body.getReader === \"function\",\n \"Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`.\"\n );\n\n const reader = response.body.getReader();\n let done = false;\n let value: Uint8Array<ArrayBufferLike> | string | undefined;\n\n while (!done) {\n ({ value, done } = await reader.read());\n const chunk = typeof value === \"string\" ? value : decoder.decode(value);\n const searchFrom = buffer.length - boundary.length + 1;\n buffer += chunk;\n let bi = buffer.indexOf(boundary, searchFrom);\n\n while (bi > -1) {\n let message: string;\n [message, buffer] = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ];\n const i = message.indexOf(\"\\r\\n\\r\\n\");\n const headers = parseHeaders(message.slice(0, i));\n const contentType = headers[\"content-type\"];\n if (\n contentType &&\n contentType.toLowerCase().indexOf(\"application/json\") === -1\n ) {\n throw new Error(\n \"Unsupported patch content type: application/json is required.\"\n );\n }\n // nb: Technically you'd want to slice off the beginning \"\\r\\n\" but since\n // this is going to be `JSON.parse`d there is no need.\n const body = message.slice(i);\n\n if (body) {\n yield body;\n }\n bi = buffer.indexOf(boundary);\n }\n }\n}\n\nexport async function readMultipartBody<\n T extends object = Record<string, unknown>,\n>(response: Response, nextValue: (value: T) => void) {\n for await (const body of consumeMultipartBody(response)) {\n const result = parseJsonEncoding(response, body);\n if (Object.keys(result).length == 0) continue;\n if (isApolloPayloadResult(result)) {\n if (Object.keys(result).length === 1 && result.payload === null) {\n return;\n }\n let next = { ...result.payload };\n if (\"errors\" in result) {\n next.extensions = {\n ...next.extensions,\n [PROTOCOL_ERRORS_SYMBOL]: new CombinedProtocolErrors(\n result.errors ?? []\n ),\n };\n }\n nextValue(next as T);\n } else {\n nextValue(result);\n }\n }\n}\n\nfunction parseHeaders(headerText: string): Record<string, string> {\n const headersInit: Record<string, string> = {};\n headerText.split(\"\\n\").forEach((line) => {\n const i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n const name = line.slice(0, i).trim().toLowerCase();\n const value = line.slice(i + 1).trim();\n headersInit[name] = value;\n }\n });\n return headersInit;\n}\n\nfunction parseJsonEncoding(response: Response, bodyText: string) {\n if (response.status >= 300) {\n throw new ServerError(\n `Response not successful: Received status code ${response.status}`,\n { response, bodyText }\n );\n }\n\n try {\n return JSON.parse(bodyText);\n } catch (err) {\n throw new ServerParseError(err, { response, bodyText });\n }\n}\n\nfunction parseGraphQLResponseJsonEncoding(\n response: Response,\n bodyText: string\n) {\n try {\n return JSON.parse(bodyText);\n } catch (err) {\n throw new ServerParseError(err, { response, bodyText });\n }\n}\n\nfunction parseResponse(response: Response, bodyText: string) {\n const contentType = response.headers.get(\"content-type\");\n\n if (contentType?.includes(\"application/graphql-response+json\")) {\n return parseGraphQLResponseJsonEncoding(response, bodyText);\n }\n\n return parseJsonEncoding(response, bodyText);\n}\n\nexport function parseAndCheckHttpResponse(operations: Operation | Operation[]) {\n return (response: Response) =>\n response.text().then((bodyText) => {\n const result = parseResponse(response, bodyText);\n\n if (\n !Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")\n ) {\n throw new ServerError(\n `Server response was malformed for query '${\n Array.isArray(operations) ?\n operations.map((op) => op.operationName)\n : operations.operationName\n }'.`,\n { response, bodyText }\n );\n }\n return result;\n });\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACwB,EACtB,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEwB,EACtB,CA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A,CAAA,CAAA,CAAA,CAA6B,CACnB,CADV,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAEY,CAFZ,CAAA,CAAA,CAAA,CAEiB,CAAC,CAFlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAEyB,CAAC,CAF1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEoC,EAAE;gBACxB,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAA4B,CAAC,CAAC,CAA9B,CAAgC,EAAE,CAAlC,EAAqC,CAArC,CAAuC,CAAC,CAAxC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqD;gBACzC,EAAE,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACU,CADV,CAAA,CAAA,CACc,EACJ,EAAE,CAFZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEoB,EAAE,CAFtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAEgC,CACvB;QACH;QACA,CAAN,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAmB;IACf,CAAC,CAAC;AACN;"}
1
+ {"version":3,"file":"parseAndCheckHttpResponse.js","sources":["../../../src/link/http/parseAndCheckHttpResponse.ts"],"sourcesContent":["import {\n CombinedProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n ServerError,\n ServerParseError,\n} from \"@apollo/client/errors\";\nimport type { ApolloLink, ApolloPayloadResult } from \"@apollo/client/link\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nconst { hasOwnProperty } = Object.prototype;\n\n/**\n * This function detects an Apollo payload result before it is transformed\n * into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n * once it leaves the link chain.\n */\nfunction isApolloPayloadResult(value: unknown): value is ApolloPayloadResult {\n return isNonNullObject(value) && \"payload\" in value;\n}\n\nasync function* consumeMultipartBody(\n response: Response\n): AsyncGenerator<string, void, void> {\n const decoder = new TextDecoder(\"utf-8\");\n const contentType = response.headers?.get(\"content-type\");\n\n // parse boundary value and ignore any subsequent name/value pairs after ;\n // https://www.rfc-editor.org/rfc/rfc9110.html#name-parameters\n // e.g. multipart/mixed;boundary=\"graphql\";deferSpec=20220824\n // if no boundary is specified, default to -\n const match = contentType?.match(\n /*\n ;\\s*boundary= # Match the boundary parameter\n (?: # either\n '([^']*)' # a string starting with ' doesn't contain ', ends with '\n | # or\n \"([^\"]*)\" # a string starting with \" doesn't contain \", ends with \"\n | # or\n ([^\"'].*?) # a string that doesn't start with ' or \", parsed non-greedily\n ) # end of the group\n \\s* # optional whitespace\n (?:;|$) # match a semicolon or end of string\n */\n /;\\s*boundary=(?:'([^']+)'|\"([^\"]+)\"|([^\"'].+?))\\s*(?:;|$)/i\n );\n const boundary = \"\\r\\n--\" + (match?.findLast((val) => !!val) || \"-\");\n let buffer = \"\";\n invariant(\n response.body && typeof response.body.getReader === \"function\",\n \"Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`.\"\n );\n\n const stream = response.body;\n const reader = stream.getReader();\n let done = false;\n let encounteredBoundary = false;\n let value: Uint8Array<ArrayBufferLike> | string | undefined;\n\n // check to see if we received the final boundary, which is a normal boundary followed by \"--\"\n // as described in https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1\n const passedFinalBoundary = () =>\n encounteredBoundary && buffer[0] == \"-\" && buffer[1] == \"-\";\n\n try {\n while (!done) {\n ({ value, done } = await reader.read());\n const chunk = typeof value === \"string\" ? value : decoder.decode(value);\n const searchFrom = buffer.length - boundary.length + 1;\n buffer += chunk;\n let bi = buffer.indexOf(boundary, searchFrom);\n while (bi > -1 && !passedFinalBoundary()) {\n encounteredBoundary = true;\n let message: string;\n [message, buffer] = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ];\n const i = message.indexOf(\"\\r\\n\\r\\n\");\n const headers = parseHeaders(message.slice(0, i));\n const contentType = headers[\"content-type\"];\n if (\n contentType &&\n contentType.toLowerCase().indexOf(\"application/json\") === -1\n ) {\n throw new Error(\n \"Unsupported patch content type: application/json is required.\"\n );\n }\n // nb: Technically you'd want to slice off the beginning \"\\r\\n\" but since\n // this is going to be `JSON.parse`d there is no need.\n const body = message.slice(i);\n\n if (body) {\n yield body;\n }\n bi = buffer.indexOf(boundary);\n }\n if (passedFinalBoundary()) {\n return;\n }\n }\n throw new Error(\"premature end of multipart body\");\n } finally {\n reader.cancel();\n }\n}\n\nexport async function readMultipartBody<\n T extends object = Record<string, unknown>,\n>(response: Response, nextValue: (value: T) => void) {\n for await (const body of consumeMultipartBody(response)) {\n const result = parseJsonEncoding(response, body);\n if (Object.keys(result).length == 0) continue;\n if (isApolloPayloadResult(result)) {\n if (Object.keys(result).length === 1 && result.payload === null) {\n return;\n }\n let next = { ...result.payload };\n if (\"errors\" in result) {\n next.extensions = {\n ...next.extensions,\n [PROTOCOL_ERRORS_SYMBOL]: new CombinedProtocolErrors(\n result.errors ?? []\n ),\n };\n }\n nextValue(next as T);\n } else {\n nextValue(result);\n }\n }\n}\n\nfunction parseHeaders(headerText: string): Record<string, string> {\n const headersInit: Record<string, string> = {};\n headerText.split(\"\\n\").forEach((line) => {\n const i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n const name = line.slice(0, i).trim().toLowerCase();\n const value = line.slice(i + 1).trim();\n headersInit[name] = value;\n }\n });\n return headersInit;\n}\n\nfunction parseJsonEncoding(response: Response, bodyText: string) {\n if (response.status >= 300) {\n throw new ServerError(\n `Response not successful: Received status code ${response.status}`,\n { response, bodyText }\n );\n }\n\n try {\n return JSON.parse(bodyText);\n } catch (err) {\n throw new ServerParseError(err, { response, bodyText });\n }\n}\n\nfunction parseGraphQLResponseJsonEncoding(\n response: Response,\n bodyText: string\n) {\n try {\n return JSON.parse(bodyText);\n } catch (err) {\n throw new ServerParseError(err, { response, bodyText });\n }\n}\n\nfunction parseResponse(response: Response, bodyText: string) {\n const contentType = response.headers.get(\"content-type\");\n\n if (contentType?.includes(\"application/graphql-response+json\")) {\n return parseGraphQLResponseJsonEncoding(response, bodyText);\n }\n\n return parseJsonEncoding(response, bodyText);\n}\n\nexport function parseAndCheckHttpResponse(\n operations: ApolloLink.Operation | ApolloLink.Operation[]\n) {\n return (response: Response) =>\n response.text().then((bodyText) => {\n const result = parseResponse(response, bodyText);\n\n if (\n !Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")\n ) {\n throw new ServerError(\n `Server response was malformed for query '${\n Array.isArray(operations) ?\n operations.map((op) => op.operationName)\n : operations.operationName\n }'.`,\n { response, bodyText }\n );\n }\n return result;\n });\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACwB,EACtB,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEwB,EACtB,CAHF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAGa,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@
1
- import { serializeFetchParameter } from "./serializeFetchParameter.js";
2
1
  // For GET operations, returns the given URI rewritten with parameters, or a
3
2
  // parse error.
4
3
  export function rewriteURIForGET(chosenURI, body) {
@@ -17,7 +16,7 @@ export function rewriteURIForGET(chosenURI, body) {
17
16
  if (body.variables) {
18
17
  let serializedVariables;
19
18
  try {
20
- serializedVariables = serializeFetchParameter(body.variables, "Variables map");
19
+ serializedVariables = JSON.stringify(body.variables);
21
20
  }
22
21
  catch (parseError) {
23
22
  return { parseError };
@@ -27,7 +26,7 @@ export function rewriteURIForGET(chosenURI, body) {
27
26
  if (body.extensions) {
28
27
  let serializedExtensions;
29
28
  try {
30
- serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map");
29
+ serializedExtensions = JSON.stringify(body.extensions);
31
30
  }
32
31
  catch (parseError) {
33
32
  return { parseError };
@@ -1 +1 @@
1
- {"version":3,"file":"rewriteURIForGET.js","sourceRoot":"","sources":["../../../src/link/http/rewriteURIForGET.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,4EAA4E;AAC5E,eAAe;AACf,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,IAAmB;IACrE,yEAAyE;IACzE,yCAAyC;IACzC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QACnD,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,KAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,IAAI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AAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACrE,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC","sourcesContent":["import type { HttpLink } from \"./HttpLink.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\n\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI: string, body: HttpLink.Body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n const queryParams: string[] = [];\n const addQueryParam = (key: string, value: string) => {\n queryParams.push(`${key}=${encodeURIComponent(value)}`);\n };\n\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query!);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n let serializedVariables;\n try {\n serializedVariables = serializeFetchParameter(\n body.variables,\n \"Variables map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n let serializedExtensions;\n try {\n serializedExtensions = serializeFetchParameter(\n body.extensions,\n \"Extensions map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n let fragment = \"\",\n preFragment = chosenURI;\n const fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n const queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n const newURI =\n preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI };\n}\n"]}
1
+ {"version":3,"file":"rewriteURIForGET.js","sourceRoot":"","sources":["../../../src/link/http/rew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0E;IAC1E,yEAAyE;IACzE,kEAAkE;IAClE,mEAAmE;IACnE,IAAI,QAAQ,GAAG,EAAE,EACf,WAAW,GAAG,SAAS,CAAC;IAC1B,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC3C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACtE,MAAM,MAAM,GACV,WAAW,GAAG,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACrE,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC","sourcesContent":["import type { HttpLink } from \"./HttpLink.js\";\n\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI: string, body: HttpLink.Body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n const queryParams: string[] = [];\n const addQueryParam = (key: string, value: string) => {\n queryParams.push(`${key}=${encodeURIComponent(value)}`);\n };\n\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query!);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n let serializedVariables;\n try {\n serializedVariables = JSON.stringify(body.variables);\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n let serializedExtensions;\n try {\n serializedExtensions = JSON.stringify(body.extensions);\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n let fragment = \"\",\n preFragment = chosenURI;\n const fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n const queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n const newURI =\n preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Operation } from "@apollo/client/link";
1
+ import type { ApolloLink } from "@apollo/client/link";
2
2
  import type { HttpLink } from "./HttpLink.js";
3
3
  interface HttpConfig {
4
4
  http?: HttpLink.HttpOptions;
@@ -17,11 +17,11 @@ export declare const fallbackHttpConfig: {
17
17
  };
18
18
  };
19
19
  export declare const defaultPrinter: HttpLink.Printer;
20
- export declare function selectHttpOptionsAndBody(operation: Operation, fallbackConfig: HttpConfig, ...configs: Array<HttpConfig>): {
20
+ export declare function selectHttpOptionsAndBody(operation: ApolloLink.Operation, fallbackConfig: HttpConfig, ...configs: Array<HttpConfig>): {
21
21
  options: HttpConfig & Record<string, any>;
22
22
  body: HttpLink.Body;
23
23
  };
24
- export declare function selectHttpOptionsAndBodyInternal(operation: Operation, printer: HttpLink.Printer, ...configs: HttpConfig[]): {
24
+ export declare function selectHttpOptionsAndBodyInternal(operation: ApolloLink.Operation, printer: HttpLink.Printer, ...configs: HttpConfig[]): {
25
25
  options: HttpConfig & Record<string, any>;
26
26
  body: HttpLink.Body;
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"selectHttpOptionsAndBody.js","sourceRoot":"","sources":["../../../src/link/http/selectHttpOptionsAndBody.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KA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C;QACrD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,qEAAqE;IACrE,gCAAgC;IAChC,4EAA4E;IAC5E,wCAAwC;IACxC,MAAM,UAAU,GACd,EAAE,CAAC;IACL,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5C,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG;YAC/B,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;SACrB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAA2B,EAAE,CAAC;IACrD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import type { Operation } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\n\nimport type { HttpLink } from \"./HttpLink.js\";\n\ninterface HttpConfig {\n http?: HttpLink.HttpOptions;\n options?: any;\n headers?: Record<string, string>;\n credentials?: any;\n}\n\nconst defaultHttpOptions: HttpLink.HttpOptions = {\n includeQuery: true,\n includeExtensions: true,\n preserveHeaderCase: false,\n};\n\nconst defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"application/graphql-response+json,application/json;q=0.9\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\n\nconst defaultOptions = {\n method: \"POST\",\n};\n\nexport const fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\n\nexport const defaultPrinter: HttpLink.Printer = (ast, printer) => printer(ast);\n\nexport function selectHttpOptionsAndBody(\n operation: Operation,\n fallbackConfig: HttpConfig,\n ...configs: Array<HttpConfig>\n) {\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal(\n operation,\n defaultPrinter,\n ...configs\n );\n}\n\nexport function selectHttpOptionsAndBodyInternal(\n operation: Operation,\n printer: HttpLink.Printer,\n ...configs: HttpConfig[]\n) {\n let options = {} as HttpConfig & Record<string, any>;\n let http = {} as HttpLink.HttpOptions;\n\n configs.forEach((config) => {\n options = {\n ...options,\n ...config.options,\n headers: {\n ...options.headers,\n ...config.headers,\n },\n };\n\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n\n options.headers!.accept = (config.http?.accept || [])\n .concat(options.headers!.accept)\n .join(\",\");\n\n http = {\n ...http,\n ...config.http,\n };\n });\n\n options.headers = removeDuplicateHeaders(\n options.headers!,\n http.preserveHeaderCase\n );\n\n //The body depends on the http options\n const { operationName, extensions, variables, query } = operation;\n const body: HttpLink.Body = { operationName, variables };\n\n if (http.includeExtensions && Object.keys(extensions || {}).length)\n (body as any).extensions = extensions;\n\n // not sending the query (i.e persisted queries)\n if (http.includeQuery) (body as any).query = printer(query, print);\n\n return {\n options,\n body,\n };\n}\n\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(\n headers: Record<string, string>,\n preserveHeaderCase: boolean | undefined\n): typeof headers {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n const normalizedHeaders: Record<string, string> = {};\n Object.keys(Object(headers)).forEach((name) => {\n normalizedHeaders[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders;\n }\n\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n const headerData: Record<string, { originalName: string; value: string }> =\n {};\n Object.keys(Object(headers)).forEach((name) => {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n\n const normalizedHeaders: Record<string, string> = {};\n Object.keys(headerData).forEach((name) => {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n"]}
1
+ {"version":3,"file":"selectHttpOptionsAndBody.js","sourceRoot":"","sources":["../../../src/link/http/selectHttpOptionsAndBody.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAWjD,MAAM,kBAAkB,GAAyB;IAC/C,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,KAAK;CAC1B,CAAC;AAEF,MAAM,cAAc,GAAG;IACrB,qEAAqE;IACrE,MAAM,EAAE,0DAA0D;IAClE,6EAA6E;IAC7E,4EAA4E;IAC5E,8EAA8E;IAC9E,6EAA6E;IAC7E,2EAA2E;IAC3E,wEAAwE;IACxE,4EAA4E;IAC5E,6EAA6E;IAC7E,2EAA2E;IAC3E,iEAAiE;IACjE,6GAA6G;IAC7G,oBAAoB;IACpB,cAAc,EAAE,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AO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5C,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG;YAC/B,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;SACrB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAA2B,EAAE,CAAC;IACrD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import type { ApolloLink } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\n\nimport type { HttpLink } from \"./HttpLink.js\";\n\ninterface HttpConfig {\n http?: HttpLink.HttpOptions;\n options?: any;\n headers?: Record<string, string>;\n credentials?: any;\n}\n\nconst defaultHttpOptions: HttpLink.HttpOptions = {\n includeQuery: true,\n includeExtensions: true,\n preserveHeaderCase: false,\n};\n\nconst defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"application/graphql-response+json,application/json;q=0.9\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\n\nconst defaultOptions = {\n method: \"POST\",\n};\n\nexport const fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\n\nexport const defaultPrinter: HttpLink.Printer = (ast, printer) => printer(ast);\n\nexport function selectHttpOptionsAndBody(\n operation: ApolloLink.Operation,\n fallbackConfig: HttpConfig,\n ...configs: Array<HttpConfig>\n) {\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal(\n operation,\n defaultPrinter,\n ...configs\n );\n}\n\nexport function selectHttpOptionsAndBodyInternal(\n operation: ApolloLink.Operation,\n printer: HttpLink.Printer,\n ...configs: HttpConfig[]\n) {\n let options = {} as HttpConfig & Record<string, any>;\n let http = {} as HttpLink.HttpOptions;\n\n configs.forEach((config) => {\n options = {\n ...options,\n ...config.options,\n headers: {\n ...options.headers,\n ...config.headers,\n },\n };\n\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n\n options.headers!.accept = (config.http?.accept || [])\n .concat(options.headers!.accept)\n .join(\",\");\n\n http = {\n ...http,\n ...config.http,\n };\n });\n\n options.headers = removeDuplicateHeaders(\n options.headers!,\n http.preserveHeaderCase\n );\n\n //The body depends on the http options\n const { operationName, extensions, variables, query } = operation;\n const body: HttpLink.Body = { operationName, variables };\n\n if (http.includeExtensions && Object.keys(extensions || {}).length)\n (body as any).extensions = extensions;\n\n // not sending the query (i.e persisted queries)\n if (http.includeQuery) (body as any).query = printer(query, print);\n\n return {\n options,\n body,\n };\n}\n\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(\n headers: Record<string, string>,\n preserveHeaderCase: boolean | undefined\n): typeof headers {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n const normalizedHeaders: Record<string, string> = {};\n Object.keys(Object(headers)).forEach((name) => {\n normalizedHeaders[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders;\n }\n\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n const headerData: Record<string, { originalName: string; value: string }> =\n {};\n Object.keys(Object(headers)).forEach((name) => {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n\n const normalizedHeaders: Record<string, string> = {};\n Object.keys(headerData).forEach((name) => {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n"]}
@@ -1,3 +1,3 @@
1
- import type { Operation } from "@apollo/client/link";
2
- export declare const selectURI: (operation: Operation, fallbackURI?: string | ((operation: Operation) => string)) => any;
1
+ import type { ApolloLink } from "@apollo/client/link";
2
+ export declare const selectURI: (operation: ApolloLink.Operation, fallbackURI?: string | ((operation: ApolloLink.Operation) => string)) => any;
3
3
  //# sourceMappingURL=selectURI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectURI.js","sourceRoot":"","sources":["../../../src/link/http/selectURI.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,SAAoB,EACpB,WAAyD,EACzD,EAAE;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAE/B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAQ,WAAsB,IAAI,UAAU,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { Operation } from \"@apollo/client/link\";\n\nexport const selectURI = (\n operation: Operation,\n fallbackURI?: string | ((operation: Operation) => string)\n) => {\n const context = operation.getContext();\n const contextURI = context.uri;\n\n if (contextURI) {\n return contextURI;\n } else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n } else {\n return (fallbackURI as string) || \"/graphql\";\n }\n};\n"]}
1
+ {"version":3,"file":"selectURI.js","sourceRoot":"","sources":["../../../src/link/http/selectURI.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,SAA+B,EAC/B,WAAoE,EACpE,EAAE;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAE/B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAQ,WAAsB,IAAI,UAAU,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { ApolloLink } from \"@apollo/client/link\";\n\nexport const selectURI = (\n operation: ApolloLink.Operation,\n fallbackURI?: string | ((operation: ApolloLink.Operation) => string)\n) => {\n const context = operation.getContext();\n const contextURI = context.uri;\n\n if (contextURI) {\n return contextURI;\n } else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n } else {\n return (fallbackURI as string) || \"/graphql\";\n }\n};\n"]}
package/link/index.d.ts CHANGED
@@ -4,5 +4,6 @@ export { split } from "./core/split.js";
4
4
  export { concat } from "./core/concat.js";
5
5
  export { execute } from "./core/execute.js";
6
6
  export { ApolloLink } from "./core/ApolloLink.js";
7
- export type { AdditionalFetchResultTypes, ApolloPayloadResult, DocumentNode, ExecuteContext, FetchResult, GraphQLRequest, NextLink, Operation, OperationContext, RequestHandler, } from "./core/types.js";
7
+ export type { AdditionalApolloLinkResultTypes, ApolloPayloadResult, DocumentNode, } from "./core/types.js";
8
+ export type { FetchResult, GraphQLRequest, Operation, RequestHandler, } from "./core/deprecated.js";
8
9
  //# sourceMappingURL=index.d.ts.map
package/link/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { empty } from \"./core/empty.js\";\nexport { from } from \"./core/from.js\";\nexport { split } from \"./core/split.js\";\nexport { concat } from \"./core/concat.js\";\nexport { execute } from \"./core/execute.js\";\nexport { ApolloLink } from \"./core/ApolloLink.js\";\n\nexport type {\n AdditionalFetchResultTypes,\n ApolloPayloadResult,\n DocumentNode,\n ExecuteContext,\n FetchResult,\n GraphQLRequest,\n NextLink,\n Operation,\n OperationContext,\n RequestHandler,\n} from \"./core/types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { empty } from \"./core/empty.js\";\nexport { from } from \"./core/from.js\";\nexport { split } from \"./core/split.js\";\nexport { concat } from \"./core/concat.js\";\nexport { execute } from \"./core/execute.js\";\nexport { ApolloLink } from \"./core/ApolloLink.js\";\n\nexport type {\n AdditionalApolloLinkResultTypes,\n ApolloPayloadResult,\n DocumentNode,\n} from \"./core/types.js\";\n\nexport type {\n FetchResult,\n GraphQLRequest,\n Operation,\n RequestHandler,\n} from \"./core/deprecated.js\";\n"]}
@@ -1,38 +1,37 @@
1
1
  import type { DocumentNode, FormattedExecutionResult } from "graphql";
2
2
  import type { ErrorLike } from "@apollo/client";
3
- import type { Operation } from "@apollo/client/link";
4
3
  import { ApolloLink } from "@apollo/client/link";
5
4
  export declare const VERSION = 1;
6
- type ErrorMeta = {
7
- persistedQueryNotSupported: boolean;
8
- persistedQueryNotFound: boolean;
9
- };
10
- type SHA256Function = (...args: any[]) => string | PromiseLike<string>;
11
- type GenerateHashFunction = (document: DocumentNode) => string | PromiseLike<string>;
12
- interface BaseOptions {
13
- disable?: (options: PersistedQueryLink.DisableFunctionOptions) => boolean;
14
- retry?: (options: PersistedQueryLink.RetryFunctionOptions) => boolean;
15
- useGETForHashedQueries?: boolean;
16
- }
17
5
  export declare namespace PersistedQueryLink {
18
- interface CallbackOptions {
19
- error: ErrorLike;
20
- operation: Operation;
21
- meta: ErrorMeta;
22
- result?: FormattedExecutionResult;
6
+ namespace Base {
7
+ interface Options {
8
+ disable?: (options: PersistedQueryLink.DisableFunctionOptions) => boolean;
9
+ retry?: (options: PersistedQueryLink.RetryFunctionOptions) => boolean;
10
+ useGETForHashedQueries?: boolean;
11
+ }
23
12
  }
24
- interface SHA256Options extends BaseOptions {
25
- sha256: SHA256Function;
13
+ interface ErrorMeta {
14
+ persistedQueryNotSupported: boolean;
15
+ persistedQueryNotFound: boolean;
16
+ }
17
+ type GenerateHashFunction = (document: DocumentNode) => string | PromiseLike<string>;
18
+ type SHA256Function = (queryString: string) => string | PromiseLike<string>;
19
+ interface SHA256Options extends Base.Options {
20
+ sha256: PersistedQueryLink.SHA256Function;
26
21
  generateHash?: never;
27
22
  }
28
- interface GenerateHashOptions extends BaseOptions {
23
+ interface GenerateHashOptions extends Base.Options {
29
24
  sha256?: never;
30
- generateHash: GenerateHashFunction;
25
+ generateHash: PersistedQueryLink.GenerateHashFunction;
31
26
  }
32
- type Options = SHA256Options | GenerateHashOptions;
33
- interface RetryFunctionOptions extends CallbackOptions {
27
+ type Options = PersistedQueryLink.SHA256Options | PersistedQueryLink.GenerateHashOptions;
28
+ interface RetryFunctionOptions {
29
+ error: ErrorLike;
30
+ operation: ApolloLink.Operation;
31
+ meta: PersistedQueryLink.ErrorMeta;
32
+ result?: FormattedExecutionResult;
34
33
  }
35
- interface DisableFunctionOptions extends CallbackOptions {
34
+ interface DisableFunctionOptions extends PersistedQueryLink.RetryFunctionOptions {
36
35
  }
37
36
  }
38
37
  /**
@@ -44,5 +43,4 @@ export declare class PersistedQueryLink extends ApolloLink {
44
43
  constructor(options: PersistedQueryLink.Options);
45
44
  resetHashCache: () => void;
46
45
  }
47
- export {};
48
46
  //# sourceMappingURL=index.d.ts.map