@apollo/client 3.8.0 → 3.8.2

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 (443) hide show
  1. package/apollo-client.cjs +715 -587
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +253 -191
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +253 -191
  7. package/cache/core/cache.d.ts +4 -4
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js +10 -7
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/core/types/Cache.d.ts +3 -3
  12. package/cache/core/types/Cache.d.ts.map +1 -1
  13. package/cache/core/types/Cache.js +0 -1
  14. package/cache/core/types/Cache.js.map +1 -1
  15. package/cache/core/types/DataProxy.d.ts +6 -6
  16. package/cache/core/types/DataProxy.d.ts.map +1 -1
  17. package/cache/core/types/DataProxy.js.map +1 -1
  18. package/cache/core/types/common.d.ts +3 -3
  19. package/cache/core/types/common.d.ts.map +1 -1
  20. package/cache/core/types/common.js.map +1 -1
  21. package/cache/index.d.ts +20 -20
  22. package/cache/index.d.ts.map +1 -1
  23. package/cache/index.js +13 -13
  24. package/cache/index.js.map +1 -1
  25. package/cache/inmemory/entityStore.d.ts +6 -6
  26. package/cache/inmemory/entityStore.d.ts.map +1 -1
  27. package/cache/inmemory/entityStore.js +38 -30
  28. package/cache/inmemory/entityStore.js.map +1 -1
  29. package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -1
  30. package/cache/inmemory/fixPolyfills.native.js +10 -9
  31. package/cache/inmemory/fixPolyfills.native.js.map +1 -1
  32. package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
  33. package/cache/inmemory/fragmentRegistry.js +6 -4
  34. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  35. package/cache/inmemory/helpers.d.ts +6 -6
  36. package/cache/inmemory/helpers.d.ts.map +1 -1
  37. package/cache/inmemory/helpers.js +16 -14
  38. package/cache/inmemory/helpers.js.map +1 -1
  39. package/cache/inmemory/inMemoryCache.d.ts +9 -9
  40. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  41. package/cache/inmemory/inMemoryCache.js +29 -33
  42. package/cache/inmemory/inMemoryCache.js.map +1 -1
  43. package/cache/inmemory/key-extractor.d.ts.map +1 -1
  44. package/cache/inmemory/key-extractor.js +55 -49
  45. package/cache/inmemory/key-extractor.js.map +1 -1
  46. package/cache/inmemory/object-canon.d.ts.map +1 -1
  47. package/cache/inmemory/object-canon.js +5 -5
  48. package/cache/inmemory/object-canon.js.map +1 -1
  49. package/cache/inmemory/policies.d.ts +6 -6
  50. package/cache/inmemory/policies.d.ts.map +1 -1
  51. package/cache/inmemory/policies.js +74 -45
  52. package/cache/inmemory/policies.js.map +1 -1
  53. package/cache/inmemory/reactiveVars.d.ts +1 -1
  54. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  55. package/cache/inmemory/reactiveVars.js +5 -5
  56. package/cache/inmemory/reactiveVars.js.map +1 -1
  57. package/cache/inmemory/readFromStore.d.ts +7 -7
  58. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  59. package/cache/inmemory/readFromStore.js +21 -17
  60. package/cache/inmemory/readFromStore.js.map +1 -1
  61. package/cache/inmemory/types.d.ts +7 -7
  62. package/cache/inmemory/types.d.ts.map +1 -1
  63. package/cache/inmemory/types.js +0 -2
  64. package/cache/inmemory/types.js.map +1 -1
  65. package/cache/inmemory/writeToStore.d.ts +7 -7
  66. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  67. package/cache/inmemory/writeToStore.js +40 -30
  68. package/cache/inmemory/writeToStore.js.map +1 -1
  69. package/config/jest/setup.d.ts +2 -2
  70. package/config/jest/setup.js +5 -5
  71. package/config/jest/setup.js.map +1 -1
  72. package/core/ApolloClient.d.ts +11 -11
  73. package/core/ApolloClient.d.ts.map +1 -1
  74. package/core/ApolloClient.js +64 -50
  75. package/core/ApolloClient.js.map +1 -1
  76. package/core/LocalState.d.ts +6 -6
  77. package/core/LocalState.d.ts.map +1 -1
  78. package/core/LocalState.js +17 -16
  79. package/core/LocalState.js.map +1 -1
  80. package/core/ObservableQuery.d.ts +12 -10
  81. package/core/ObservableQuery.d.ts.map +1 -1
  82. package/core/ObservableQuery.js +57 -38
  83. package/core/ObservableQuery.js.map +1 -1
  84. package/core/QueryInfo.d.ts +11 -11
  85. package/core/QueryInfo.d.ts.map +1 -1
  86. package/core/QueryInfo.js +28 -34
  87. package/core/QueryInfo.js.map +1 -1
  88. package/core/QueryManager.d.ts +10 -10
  89. package/core/QueryManager.d.ts.map +1 -1
  90. package/core/QueryManager.js +117 -93
  91. package/core/QueryManager.js.map +1 -1
  92. package/core/core.cjs +255 -199
  93. package/core/core.cjs.map +1 -1
  94. package/core/core.cjs.native.js +255 -199
  95. package/core/networkStatus.js.map +1 -1
  96. package/core/types.d.ts +13 -13
  97. package/core/types.d.ts.map +1 -1
  98. package/core/types.js +0 -1
  99. package/core/types.js.map +1 -1
  100. package/core/watchQueryOptions.d.ts +11 -11
  101. package/core/watchQueryOptions.d.ts.map +1 -1
  102. package/core/watchQueryOptions.js.map +1 -1
  103. package/dev/dev.cjs +44 -40
  104. package/dev/dev.cjs.map +1 -1
  105. package/dev/dev.cjs.native.js +44 -40
  106. package/errors/errors.cjs +7 -5
  107. package/errors/errors.cjs.map +1 -1
  108. package/errors/errors.cjs.native.js +7 -5
  109. package/errors/index.d.ts +4 -4
  110. package/errors/index.d.ts.map +1 -1
  111. package/errors/index.js +9 -7
  112. package/errors/index.js.map +1 -1
  113. package/index.d.ts +2 -2
  114. package/index.js +2 -2
  115. package/index.js.map +1 -1
  116. package/invariantErrorCodes.d.ts.map +1 -1
  117. package/invariantErrorCodes.js +36 -36
  118. package/invariantErrorCodes.js.map +1 -1
  119. package/link/batch/batch.cjs +4 -4
  120. package/link/batch/batch.cjs.map +1 -1
  121. package/link/batch/batch.cjs.native.js +4 -4
  122. package/link/batch/batchLink.d.ts +6 -6
  123. package/link/batch/batchLink.d.ts.map +1 -1
  124. package/link/batch/batchLink.js +4 -4
  125. package/link/batch/batchLink.js.map +1 -1
  126. package/link/batch/batching.d.ts +2 -2
  127. package/link/batch/batching.d.ts.map +1 -1
  128. package/link/batch/batching.js +4 -4
  129. package/link/batch/batching.js.map +1 -1
  130. package/link/batch/index.d.ts +1 -1
  131. package/link/batch/index.js +1 -1
  132. package/link/batch/index.js.map +1 -1
  133. package/link/batch-http/batch-http.cjs +13 -11
  134. package/link/batch-http/batch-http.cjs.map +1 -1
  135. package/link/batch-http/batch-http.cjs.native.js +13 -11
  136. package/link/batch-http/batchHttpLink.d.ts +6 -6
  137. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  138. package/link/batch-http/batchHttpLink.js +17 -15
  139. package/link/batch-http/batchHttpLink.js.map +1 -1
  140. package/link/batch-http/index.d.ts +1 -1
  141. package/link/batch-http/index.js +1 -1
  142. package/link/batch-http/index.js.map +1 -1
  143. package/link/context/context.cjs.map +1 -1
  144. package/link/context/index.d.ts +3 -3
  145. package/link/context/index.js +2 -2
  146. package/link/context/index.js.map +1 -1
  147. package/link/core/ApolloLink.d.ts +3 -3
  148. package/link/core/ApolloLink.js +4 -4
  149. package/link/core/ApolloLink.js.map +1 -1
  150. package/link/core/concat.d.ts +1 -1
  151. package/link/core/concat.js +1 -1
  152. package/link/core/concat.js.map +1 -1
  153. package/link/core/core.cjs +1 -1
  154. package/link/core/core.cjs.map +1 -1
  155. package/link/core/core.cjs.native.js +1 -1
  156. package/link/core/empty.d.ts +1 -1
  157. package/link/core/empty.js +1 -1
  158. package/link/core/empty.js.map +1 -1
  159. package/link/core/execute.d.ts +1 -1
  160. package/link/core/execute.js +1 -1
  161. package/link/core/execute.js.map +1 -1
  162. package/link/core/from.d.ts +1 -1
  163. package/link/core/from.js +1 -1
  164. package/link/core/from.js.map +1 -1
  165. package/link/core/index.d.ts +8 -8
  166. package/link/core/index.js +8 -8
  167. package/link/core/index.js.map +1 -1
  168. package/link/core/split.d.ts +1 -1
  169. package/link/core/split.js +1 -1
  170. package/link/core/split.js.map +1 -1
  171. package/link/core/types.js.map +1 -1
  172. package/link/error/error.cjs.map +1 -1
  173. package/link/error/index.d.ts +5 -5
  174. package/link/error/index.js +2 -2
  175. package/link/error/index.js.map +1 -1
  176. package/link/http/HttpLink.d.ts +3 -3
  177. package/link/http/HttpLink.js +2 -2
  178. package/link/http/HttpLink.js.map +1 -1
  179. package/link/http/checkFetcher.d.ts +1 -1
  180. package/link/http/checkFetcher.d.ts.map +1 -1
  181. package/link/http/checkFetcher.js +2 -2
  182. package/link/http/checkFetcher.js.map +1 -1
  183. package/link/http/createHttpLink.d.ts +2 -2
  184. package/link/http/createHttpLink.d.ts.map +1 -1
  185. package/link/http/createHttpLink.js +27 -26
  186. package/link/http/createHttpLink.js.map +1 -1
  187. package/link/http/createSignalIfSupported.js +1 -1
  188. package/link/http/createSignalIfSupported.js.map +1 -1
  189. package/link/http/http.cjs +64 -41
  190. package/link/http/http.cjs.map +1 -1
  191. package/link/http/http.cjs.native.js +64 -41
  192. package/link/http/index.d.ts +13 -13
  193. package/link/http/index.js +10 -10
  194. package/link/http/index.js.map +1 -1
  195. package/link/http/iterators/nodeStream.d.ts.map +1 -1
  196. package/link/http/iterators/nodeStream.js.map +1 -1
  197. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  198. package/link/http/parseAndCheckHttpResponse.js +2 -2
  199. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  200. package/link/http/responseIterator.d.ts.map +1 -1
  201. package/link/http/responseIterator.js +20 -1
  202. package/link/http/responseIterator.js.map +1 -1
  203. package/link/http/rewriteURIForGET.d.ts +1 -1
  204. package/link/http/rewriteURIForGET.js +12 -12
  205. package/link/http/rewriteURIForGET.js.map +1 -1
  206. package/link/http/selectHttpOptionsAndBody.d.ts +5 -5
  207. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  208. package/link/http/selectHttpOptionsAndBody.js +8 -7
  209. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  210. package/link/http/selectURI.d.ts +1 -1
  211. package/link/http/selectURI.js +2 -2
  212. package/link/http/selectURI.js.map +1 -1
  213. package/link/http/serializeFetchParameter.d.ts +1 -1
  214. package/link/http/serializeFetchParameter.js +1 -1
  215. package/link/http/serializeFetchParameter.js.map +1 -1
  216. package/link/persisted-queries/index.d.ts +4 -4
  217. package/link/persisted-queries/index.d.ts.map +1 -1
  218. package/link/persisted-queries/index.js +26 -25
  219. package/link/persisted-queries/index.js.map +1 -1
  220. package/link/persisted-queries/persisted-queries.cjs +22 -17
  221. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  222. package/link/persisted-queries/persisted-queries.cjs.native.js +22 -17
  223. package/link/retry/delayFunction.d.ts +1 -1
  224. package/link/retry/delayFunction.js.map +1 -1
  225. package/link/retry/index.d.ts +1 -1
  226. package/link/retry/index.js +1 -1
  227. package/link/retry/index.js.map +1 -1
  228. package/link/retry/retry.cjs +2 -2
  229. package/link/retry/retry.cjs.map +1 -1
  230. package/link/retry/retry.cjs.native.js +2 -2
  231. package/link/retry/retryFunction.d.ts +1 -1
  232. package/link/retry/retryFunction.js.map +1 -1
  233. package/link/retry/retryLink.d.ts +5 -5
  234. package/link/retry/retryLink.d.ts.map +1 -1
  235. package/link/retry/retryLink.js +6 -6
  236. package/link/retry/retryLink.js.map +1 -1
  237. package/link/schema/index.d.ts +4 -4
  238. package/link/schema/index.d.ts.map +1 -1
  239. package/link/schema/index.js +13 -8
  240. package/link/schema/index.js.map +1 -1
  241. package/link/schema/schema.cjs +10 -5
  242. package/link/schema/schema.cjs.map +1 -1
  243. package/link/schema/schema.cjs.native.js +10 -5
  244. package/link/subscriptions/index.js +1 -1
  245. package/link/subscriptions/index.js.map +1 -1
  246. package/link/subscriptions/subscriptions.cjs.map +1 -1
  247. package/link/utils/createOperation.d.ts +1 -1
  248. package/link/utils/createOperation.js +3 -3
  249. package/link/utils/createOperation.js.map +1 -1
  250. package/link/utils/filterOperationVariables.d.ts +1 -1
  251. package/link/utils/filterOperationVariables.js +2 -2
  252. package/link/utils/filterOperationVariables.js.map +1 -1
  253. package/link/utils/fromError.d.ts +1 -1
  254. package/link/utils/fromError.js +1 -1
  255. package/link/utils/fromError.js.map +1 -1
  256. package/link/utils/fromPromise.d.ts +1 -1
  257. package/link/utils/fromPromise.js +1 -1
  258. package/link/utils/fromPromise.js.map +1 -1
  259. package/link/utils/index.d.ts +10 -10
  260. package/link/utils/index.js +9 -9
  261. package/link/utils/index.js.map +1 -1
  262. package/link/utils/throwServerError.js +1 -1
  263. package/link/utils/throwServerError.js.map +1 -1
  264. package/link/utils/toPromise.d.ts +1 -1
  265. package/link/utils/toPromise.js +1 -1
  266. package/link/utils/toPromise.js.map +1 -1
  267. package/link/utils/transformOperation.d.ts +1 -1
  268. package/link/utils/transformOperation.js +3 -3
  269. package/link/utils/transformOperation.js.map +1 -1
  270. package/link/utils/utils.cjs +12 -12
  271. package/link/utils/utils.cjs.map +1 -1
  272. package/link/utils/utils.cjs.native.js +12 -12
  273. package/link/utils/validateOperation.d.ts +1 -1
  274. package/link/utils/validateOperation.js +6 -6
  275. package/link/utils/validateOperation.js.map +1 -1
  276. package/link/ws/index.d.ts +5 -5
  277. package/link/ws/index.js +2 -2
  278. package/link/ws/index.js.map +1 -1
  279. package/link/ws/ws.cjs.map +1 -1
  280. package/package.json +27 -27
  281. package/react/cache/QueryReference.d.ts +1 -1
  282. package/react/cache/QueryReference.d.ts.map +1 -1
  283. package/react/cache/QueryReference.js +2 -0
  284. package/react/cache/QueryReference.js.map +1 -1
  285. package/react/hooks/constants.js +1 -1
  286. package/react/hooks/constants.js.map +1 -1
  287. package/react/hooks/hooks.cjs +10 -21
  288. package/react/hooks/hooks.cjs.map +1 -1
  289. package/react/hooks/hooks.cjs.native.js +10 -21
  290. package/react/hooks/useBackgroundQuery.d.ts +1 -1
  291. package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
  292. package/react/hooks/useBackgroundQuery.js.map +1 -1
  293. package/react/hooks/useQuery.d.ts.map +1 -1
  294. package/react/hooks/useQuery.js +1 -8
  295. package/react/hooks/useQuery.js.map +1 -1
  296. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  297. package/react/hooks/useReactiveVar.js +7 -12
  298. package/react/hooks/useReactiveVar.js.map +1 -1
  299. package/react/hooks/useReadQuery.d.ts +1 -1
  300. package/react/hooks/useReadQuery.d.ts.map +1 -1
  301. package/react/hooks/useReadQuery.js +1 -1
  302. package/react/hooks/useReadQuery.js.map +1 -1
  303. package/react/hooks/useSuspenseQuery.d.ts +1 -1
  304. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  305. package/react/hooks/useSuspenseQuery.js.map +1 -1
  306. package/react/react.cjs +2 -0
  307. package/react/react.cjs.map +1 -1
  308. package/react/react.cjs.native.js +2 -0
  309. package/react/types/types.js.map +1 -1
  310. package/testing/core/core.cjs +37 -28
  311. package/testing/core/core.cjs.map +1 -1
  312. package/testing/core/core.cjs.native.js +37 -28
  313. package/testing/core/itAsync.d.ts.map +1 -1
  314. package/testing/core/itAsync.js +8 -4
  315. package/testing/core/itAsync.js.map +1 -1
  316. package/testing/core/mocking/mockClient.d.ts +3 -3
  317. package/testing/core/mocking/mockClient.d.ts.map +1 -1
  318. package/testing/core/mocking/mockClient.js +6 -4
  319. package/testing/core/mocking/mockClient.js.map +1 -1
  320. package/testing/core/mocking/mockFetch.d.ts +1 -1
  321. package/testing/core/mocking/mockFetch.d.ts.map +1 -1
  322. package/testing/core/mocking/mockFetch.js +3 -3
  323. package/testing/core/mocking/mockFetch.js.map +1 -1
  324. package/testing/core/mocking/mockLink.d.ts +3 -3
  325. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  326. package/testing/core/mocking/mockLink.js +24 -23
  327. package/testing/core/mocking/mockLink.js.map +1 -1
  328. package/testing/core/mocking/mockQueryManager.d.ts +2 -2
  329. package/testing/core/mocking/mockQueryManager.js +3 -3
  330. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  331. package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
  332. package/testing/core/mocking/mockSubscriptionLink.js +4 -4
  333. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  334. package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
  335. package/testing/core/mocking/mockWatchQuery.js +2 -2
  336. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  337. package/testing/core/observableToPromise.d.ts +3 -3
  338. package/testing/core/observableToPromise.d.ts.map +1 -1
  339. package/testing/core/observableToPromise.js +8 -4
  340. package/testing/core/observableToPromise.js.map +1 -1
  341. package/testing/core/subscribeAndCount.d.ts +1 -1
  342. package/testing/core/subscribeAndCount.d.ts.map +1 -1
  343. package/testing/core/subscribeAndCount.js +5 -3
  344. package/testing/core/subscribeAndCount.js.map +1 -1
  345. package/testing/core/wait.js.map +1 -1
  346. package/testing/core/withConsoleSpy.d.ts.map +1 -1
  347. package/testing/core/withConsoleSpy.js.map +1 -1
  348. package/testing/core/wrap.d.ts.map +1 -1
  349. package/testing/core/wrap.js +14 -12
  350. package/testing/core/wrap.js.map +1 -1
  351. package/testing/index.d.ts +4 -4
  352. package/testing/index.js +3 -3
  353. package/testing/index.js.map +1 -1
  354. package/testing/react/MockedProvider.d.ts +7 -7
  355. package/testing/react/MockedProvider.d.ts.map +1 -1
  356. package/testing/react/MockedProvider.js +10 -11
  357. package/testing/react/MockedProvider.js.map +1 -1
  358. package/testing/testing.cjs +3 -5
  359. package/testing/testing.cjs.map +1 -1
  360. package/testing/testing.cjs.native.js +3 -5
  361. package/utilities/common/canUse.d.ts.map +1 -1
  362. package/utilities/common/canUse.js +4 -5
  363. package/utilities/common/canUse.js.map +1 -1
  364. package/utilities/common/cloneDeep.js +2 -2
  365. package/utilities/common/cloneDeep.js.map +1 -1
  366. package/utilities/common/compact.d.ts +1 -1
  367. package/utilities/common/compact.js.map +1 -1
  368. package/utilities/common/filterInPlace.js.map +1 -1
  369. package/utilities/common/maybeDeepFreeze.js +1 -1
  370. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  371. package/utilities/common/mergeDeep.d.ts.map +1 -1
  372. package/utilities/common/mergeDeep.js +3 -1
  373. package/utilities/common/mergeDeep.js.map +1 -1
  374. package/utilities/common/mergeOptions.d.ts.map +1 -1
  375. package/utilities/common/mergeOptions.js.map +1 -1
  376. package/utilities/common/objects.js +2 -2
  377. package/utilities/common/objects.js.map +1 -1
  378. package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
  379. package/utilities/common/stringifyForDisplay.js +3 -1
  380. package/utilities/common/stringifyForDisplay.js.map +1 -1
  381. package/utilities/globals/global.d.ts.map +1 -1
  382. package/utilities/globals/global.js +3 -1
  383. package/utilities/globals/global.js.map +1 -1
  384. package/utilities/globals/globals.cjs +8 -4
  385. package/utilities/globals/globals.cjs.map +1 -1
  386. package/utilities/globals/globals.cjs.native.js +8 -4
  387. package/utilities/globals/index.d.ts.map +1 -1
  388. package/utilities/globals/index.js +1 -1
  389. package/utilities/globals/index.js.map +1 -1
  390. package/utilities/globals/invariantWrappers.js +1 -1
  391. package/utilities/globals/invariantWrappers.js.map +1 -1
  392. package/utilities/globals/maybe.d.ts.map +1 -1
  393. package/utilities/globals/maybe.js.map +1 -1
  394. package/utilities/graphql/directives.d.ts +1 -1
  395. package/utilities/graphql/directives.d.ts.map +1 -1
  396. package/utilities/graphql/directives.js +17 -13
  397. package/utilities/graphql/directives.js.map +1 -1
  398. package/utilities/graphql/fragments.d.ts +1 -1
  399. package/utilities/graphql/fragments.d.ts.map +1 -1
  400. package/utilities/graphql/fragments.js +12 -12
  401. package/utilities/graphql/fragments.js.map +1 -1
  402. package/utilities/graphql/getFromAST.d.ts +1 -1
  403. package/utilities/graphql/getFromAST.js +16 -16
  404. package/utilities/graphql/getFromAST.js.map +1 -1
  405. package/utilities/graphql/storeUtils.d.ts +2 -2
  406. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  407. package/utilities/graphql/storeUtils.js +36 -34
  408. package/utilities/graphql/storeUtils.js.map +1 -1
  409. package/utilities/graphql/transform.d.ts +1 -1
  410. package/utilities/graphql/transform.d.ts.map +1 -1
  411. package/utilities/graphql/transform.js +48 -32
  412. package/utilities/graphql/transform.js.map +1 -1
  413. package/utilities/index.d.ts +0 -1
  414. package/utilities/index.d.ts.map +1 -1
  415. package/utilities/index.js +0 -1
  416. package/utilities/index.js.map +1 -1
  417. package/utilities/observables/Concast.d.ts.map +1 -1
  418. package/utilities/observables/Concast.js +5 -9
  419. package/utilities/observables/Concast.js.map +1 -1
  420. package/utilities/observables/Observable.d.ts +4 -4
  421. package/utilities/observables/Observable.d.ts.map +1 -1
  422. package/utilities/observables/Observable.js +6 -4
  423. package/utilities/observables/Observable.js.map +1 -1
  424. package/utilities/observables/asyncMap.d.ts.map +1 -1
  425. package/utilities/observables/asyncMap.js +5 -2
  426. package/utilities/observables/asyncMap.js.map +1 -1
  427. package/utilities/observables/iteration.js.map +1 -1
  428. package/utilities/policies/pagination.d.ts +1 -1
  429. package/utilities/policies/pagination.d.ts.map +1 -1
  430. package/utilities/policies/pagination.js +9 -7
  431. package/utilities/policies/pagination.js.map +1 -1
  432. package/utilities/types/IsStrictlyAny.d.ts +2 -2
  433. package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
  434. package/utilities/types/IsStrictlyAny.js.map +1 -1
  435. package/utilities/utilities.cjs +147 -147
  436. package/utilities/utilities.cjs.map +1 -1
  437. package/utilities/utilities.cjs.native.js +147 -147
  438. package/version.js +1 -1
  439. package/version.js.map +1 -1
  440. package/utilities/common/responseIterator.d.ts +0 -10
  441. package/utilities/common/responseIterator.d.ts.map +0 -1
  442. package/utilities/common/responseIterator.js +0 -21
  443. package/utilities/common/responseIterator.js.map +0 -1
@@ -8,9 +8,6 @@ var utilities = require('../../utilities');
8
8
  var core = require('../core');
9
9
 
10
10
  var VERSION = 1;
11
- exports.PersistedQueryLink = void 0;
12
- (function (PersistedQueryLink) {
13
- })(exports.PersistedQueryLink || (exports.PersistedQueryLink = {}));
14
11
  function processErrors(graphQLErrors) {
15
12
  var byMessage = Object.create(null), byCode = Object.create(null);
16
13
  if (utilities.isNonEmptyArray(graphQLErrors)) {
@@ -22,7 +19,8 @@ function processErrors(graphQLErrors) {
22
19
  });
23
20
  }
24
21
  return {
25
- persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported || byCode.PERSISTED_QUERY_NOT_SUPPORTED),
22
+ persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported ||
23
+ byCode.PERSISTED_QUERY_NOT_SUPPORTED),
26
24
  persistedQueryNotFound: !!(byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND),
27
25
  };
28
26
  }
@@ -38,24 +36,27 @@ var defaultOptions = {
38
36
  useGETForHashedQueries: false,
39
37
  };
40
38
  function operationDefinesMutation(operation) {
41
- return operation.query.definitions.some(function (d) { return d.kind === 'OperationDefinition' && d.operation === 'mutation'; });
39
+ return operation.query.definitions.some(function (d) { return d.kind === "OperationDefinition" && d.operation === "mutation"; });
42
40
  }
43
41
  var createPersistedQueryLink = function (options) {
44
42
  var hashesByQuery = new WeakMap();
45
- globals.invariant(options && (typeof options.sha256 === 'function' ||
46
- typeof options.generateHash === 'function'), 38);
47
- var _a = utilities.compact(defaultOptions, options), sha256 = _a.sha256, _b = _a.generateHash, generateHash = _b === void 0 ? function (query) { return Promise.resolve(sha256(utilities.print(query))); } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries;
43
+ globals.invariant(options &&
44
+ (typeof options.sha256 === "function" ||
45
+ typeof options.generateHash === "function"), 38);
46
+ var _a = utilities.compact(defaultOptions, options), sha256 = _a.sha256, _b = _a.generateHash, generateHash = _b === void 0 ? function (query) {
47
+ return Promise.resolve(sha256(utilities.print(query)));
48
+ } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries;
48
49
  var supportsPersistedQueries = true;
49
50
  var getHashPromise = function (query) {
50
51
  return new Promise(function (resolve) { return resolve(generateHash(query)); });
51
52
  };
52
53
  function getQueryHash(query) {
53
- if (!query || typeof query !== 'object') {
54
+ if (!query || typeof query !== "object") {
54
55
  return getHashPromise(query);
55
56
  }
56
57
  var hash = hashesByQuery.get(query);
57
58
  if (!hash)
58
- hashesByQuery.set(query, hash = getHashPromise(query));
59
+ hashesByQuery.set(query, (hash = getHashPromise(query)));
59
60
  return hash;
60
61
  }
61
62
  return new core.ApolloLink(function (operation, forward) {
@@ -76,7 +77,7 @@ var createPersistedQueryLink = function (options) {
76
77
  graphQLErrors.push.apply(graphQLErrors, responseErrors);
77
78
  }
78
79
  var networkErrors = void 0;
79
- if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== 'string') {
80
+ if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== "string") {
80
81
  networkErrors =
81
82
  networkError &&
82
83
  networkError.result &&
@@ -89,8 +90,10 @@ var createPersistedQueryLink = function (options) {
89
90
  response: response,
90
91
  networkError: networkError,
91
92
  operation: operation,
92
- graphQLErrors: utilities.isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0,
93
- meta: processErrors(graphQLErrors)
93
+ graphQLErrors: utilities.isNonEmptyArray(graphQLErrors)
94
+ ? graphQLErrors
95
+ : void 0,
96
+ meta: processErrors(graphQLErrors),
94
97
  };
95
98
  supportsPersistedQueries = !disable(disablePayload);
96
99
  if (retry(disablePayload)) {
@@ -102,7 +105,7 @@ var createPersistedQueryLink = function (options) {
102
105
  includeExtensions: supportsPersistedQueries,
103
106
  },
104
107
  fetchOptions: {
105
- method: 'POST',
108
+ method: "POST",
106
109
  },
107
110
  });
108
111
  if (setFetchOptions) {
@@ -136,19 +139,21 @@ var createPersistedQueryLink = function (options) {
136
139
  var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b;
137
140
  originalFetchOptions = fetchOptions;
138
141
  return {
139
- fetchOptions: tslib.__assign(tslib.__assign({}, fetchOptions), { method: 'GET' }),
142
+ fetchOptions: tslib.__assign(tslib.__assign({}, fetchOptions), { method: "GET" }),
140
143
  };
141
144
  });
142
145
  setFetchOptions = true;
143
146
  }
144
147
  if (supportsPersistedQueries) {
145
- getQueryHash(query).then(function (sha256Hash) {
148
+ getQueryHash(query)
149
+ .then(function (sha256Hash) {
146
150
  operation.extensions.persistedQuery = {
147
151
  version: VERSION,
148
152
  sha256Hash: sha256Hash,
149
153
  };
150
154
  subscription = forward(operation).subscribe(handler);
151
- }).catch(observer.error.bind(observer));
155
+ })
156
+ .catch(observer.error.bind(observer));
152
157
  }
153
158
  else {
154
159
  subscription = forward(operation).subscribe(handler);
@@ -1,4 +1,4 @@
1
- import type { Operation } from '../core/index.js';
1
+ import type { Operation } from "../core/index.js";
2
2
  export interface DelayFunction {
3
3
  (count: number, operation: Operation, error: any): number;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"delayFunction.js","sourceRoot":"","sources":["../../../src/link/retry/delayFunction.ts"],"names":[],"mappings":"AA2CA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAmD,YAAY,IAAI,EAAE,EAAnE,eAAa,EAAb,OAAO,mBAAG,GAAG,KAAA,EAAE,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EAAE,WAAc,EAAd,GAAG,mBAAG,QAAQ,KAAuB,CAAC;IAK5E,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;IAEjD,OAAO,SAAS,aAAa,CAAC,KAAa;QACzC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,SAAA,CAAC,EAAI,KAAK,CAAA,CAAC,CAAC;QAClD,IAAI,MAAM,EAAE;YAGV,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;SAC/B;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from '../core/index.js';\n\n/**\n * Advanced mode: a function that implements the strategy for calculating delays\n * for particular responses.\n */\nexport interface DelayFunction {\n (count: number, operation: Operation, error: any): number;\n}\n\nexport interface DelayFunctionOptions {\n /**\n * The number of milliseconds to wait before attempting the first retry.\n *\n * Delays will increase exponentially for each attempt. E.g. if this is\n * set to 100, subsequent retries will be delayed by 200, 400, 800, etc,\n * until they reach maxDelay.\n *\n * Note that if jittering is enabled, this is the _average_ delay.\n *\n * Defaults to 300.\n */\n initial?: number;\n\n /**\n * The maximum number of milliseconds that the link should wait for any\n * retry.\n *\n * Defaults to Infinity.\n */\n max?: number;\n\n /**\n * Whether delays between attempts should be randomized.\n *\n * This helps avoid thundering herd type situations by better distributing\n * load during major outages.\n *\n * Defaults to true.\n */\n jitter?: boolean;\n}\n\nexport function buildDelayFunction(\n delayOptions?: DelayFunctionOptions,\n): DelayFunction {\n const { initial = 300, jitter = true, max = Infinity } = delayOptions || {};\n // If we're jittering, baseDelay is half of the maximum delay for that\n // attempt (and is, on average, the delay we will encounter).\n // If we're not jittering, adjust baseDelay so that the first attempt\n // lines up with initialDelay, for everyone's sanity.\n const baseDelay = jitter ? initial : initial / 2;\n\n return function delayFunction(count: number) {\n let delay = Math.min(max, baseDelay * 2 ** count);\n if (jitter) {\n // We opt for a full jitter approach for a mostly uniform distribution,\n // but bound it within initialDelay and delay for everyone's sanity.\n delay = Math.random() * delay;\n }\n\n return delay;\n };\n}\n"]}
1
+ {"version":3,"file":"delayFunction.js","sourceRoot":"","sources":["../../../src/link/retry/delayFunction.ts"],"names":[],"mappings":"AA2CA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAmD,YAAY,IAAI,EAAE,EAAnE,eAAa,EAAb,OAAO,mBAAG,GAAG,KAAA,EAAE,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EAAE,WAAc,EAAd,GAAG,mBAAG,QAAQ,KAAuB,CAAC;IAK5E,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;IAEjD,OAAO,SAAS,aAAa,CAAC,KAAa;QACzC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,SAAA,CAAC,EAAI,KAAK,CAAA,CAAC,CAAC;QAClD,IAAI,MAAM,EAAE;YAGV,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;SAC/B;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\n/**\n * Advanced mode: a function that implements the strategy for calculating delays\n * for particular responses.\n */\nexport interface DelayFunction {\n (count: number, operation: Operation, error: any): number;\n}\n\nexport interface DelayFunctionOptions {\n /**\n * The number of milliseconds to wait before attempting the first retry.\n *\n * Delays will increase exponentially for each attempt. E.g. if this is\n * set to 100, subsequent retries will be delayed by 200, 400, 800, etc,\n * until they reach maxDelay.\n *\n * Note that if jittering is enabled, this is the _average_ delay.\n *\n * Defaults to 300.\n */\n initial?: number;\n\n /**\n * The maximum number of milliseconds that the link should wait for any\n * retry.\n *\n * Defaults to Infinity.\n */\n max?: number;\n\n /**\n * Whether delays between attempts should be randomized.\n *\n * This helps avoid thundering herd type situations by better distributing\n * load during major outages.\n *\n * Defaults to true.\n */\n jitter?: boolean;\n}\n\nexport function buildDelayFunction(\n delayOptions?: DelayFunctionOptions\n): DelayFunction {\n const { initial = 300, jitter = true, max = Infinity } = delayOptions || {};\n // If we're jittering, baseDelay is half of the maximum delay for that\n // attempt (and is, on average, the delay we will encounter).\n // If we're not jittering, adjust baseDelay so that the first attempt\n // lines up with initialDelay, for everyone's sanity.\n const baseDelay = jitter ? initial : initial / 2;\n\n return function delayFunction(count: number) {\n let delay = Math.min(max, baseDelay * 2 ** count);\n if (jitter) {\n // We opt for a full jitter approach for a mostly uniform distribution,\n // but bound it within initialDelay and delay for everyone's sanity.\n delay = Math.random() * delay;\n }\n\n return delay;\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- export * from './retryLink.js';
1
+ export * from "./retryLink.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './retryLink.js';
1
+ export * from "./retryLink.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/retry/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './retryLink.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/retry/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./retryLink.js\";\n"]}
@@ -148,9 +148,9 @@ var RetryLink = (function (_super) {
148
148
  var _this = _super.call(this) || this;
149
149
  var _a = options || {}, attempts = _a.attempts, delay = _a.delay;
150
150
  _this.delayFor =
151
- typeof delay === 'function' ? delay : buildDelayFunction(delay);
151
+ typeof delay === "function" ? delay : buildDelayFunction(delay);
152
152
  _this.retryIf =
153
- typeof attempts === 'function' ? attempts : buildRetryFunction(attempts);
153
+ typeof attempts === "function" ? attempts : buildRetryFunction(attempts);
154
154
  return _this;
155
155
  }
156
156
  RetryLink.prototype.request = function (operation, nextLink) {
@@ -1 +1 @@
1
- {"version":3,"file":"retry.cjs","sources":["delayFunction.js","retryFunction.js","retryLink.js"],"sourcesContent":["export function buildDelayFunction(delayOptions) {\n var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d;\n var baseDelay = jitter ? initial : initial / 2;\n return function delayFunction(count) {\n var delay = Math.min(max, baseDelay * Math.pow(2, count));\n if (jitter) {\n delay = Math.random() * delay;\n }\n return delay;\n };\n}\n//# sourceMappingURL=delayFunction.js.map","export function buildRetryFunction(retryOptions) {\n var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b;\n return function retryFunction(count, operation, error) {\n if (count >= max)\n return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n//# sourceMappingURL=retryFunction.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { ApolloLink } from '../core/index.js';\nimport { Observable } from '../../utilities/index.js';\nimport { buildDelayFunction, } from './delayFunction.js';\nimport { buildRetryFunction, } from './retryFunction.js';\nvar RetryableOperation = (function () {\n function RetryableOperation(operation, nextLink, delayFor, retryIf) {\n var _this = this;\n this.operation = operation;\n this.nextLink = nextLink;\n this.delayFor = delayFor;\n this.retryIf = retryIf;\n this.retryCount = 0;\n this.values = [];\n this.complete = false;\n this.canceled = false;\n this.observers = [];\n this.currentSubscription = null;\n this.onNext = function (value) {\n _this.values.push(value);\n for (var _i = 0, _a = _this.observers; _i < _a.length; _i++) {\n var observer = _a[_i];\n if (!observer)\n continue;\n observer.next(value);\n }\n };\n this.onComplete = function () {\n _this.complete = true;\n for (var _i = 0, _a = _this.observers; _i < _a.length; _i++) {\n var observer = _a[_i];\n if (!observer)\n continue;\n observer.complete();\n }\n };\n this.onError = function (error) { return __awaiter(_this, void 0, void 0, function () {\n var shouldRetry, _i, _a, observer;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n this.retryCount += 1;\n return [4, this.retryIf(this.retryCount, this.operation, error)];\n case 1:\n shouldRetry = _b.sent();\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return [2];\n }\n this.error = error;\n for (_i = 0, _a = this.observers; _i < _a.length; _i++) {\n observer = _a[_i];\n if (!observer)\n continue;\n observer.error(error);\n }\n return [2];\n }\n });\n }); };\n }\n RetryableOperation.prototype.subscribe = function (observer) {\n if (this.canceled) {\n throw new Error(\"Subscribing to a retryable link that was canceled is not supported\");\n }\n this.observers.push(observer);\n for (var _i = 0, _a = this.values; _i < _a.length; _i++) {\n var value = _a[_i];\n observer.next(value);\n }\n if (this.complete) {\n observer.complete();\n }\n else if (this.error) {\n observer.error(this.error);\n }\n };\n RetryableOperation.prototype.unsubscribe = function (observer) {\n var index = this.observers.indexOf(observer);\n if (index < 0) {\n throw new Error(\"RetryLink BUG! Attempting to unsubscribe unknown observer!\");\n }\n this.observers[index] = null;\n if (this.observers.every(function (o) { return o === null; })) {\n this.cancel();\n }\n };\n RetryableOperation.prototype.start = function () {\n if (this.currentSubscription)\n return;\n this.try();\n };\n RetryableOperation.prototype.cancel = function () {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n this.canceled = true;\n };\n RetryableOperation.prototype.try = function () {\n this.currentSubscription = this.nextLink(this.operation).subscribe({\n next: this.onNext,\n error: this.onError,\n complete: this.onComplete,\n });\n };\n RetryableOperation.prototype.scheduleRetry = function (delay) {\n var _this = this;\n if (this.timerId) {\n throw new Error(\"RetryLink BUG! Encountered overlapping retries\");\n }\n this.timerId = setTimeout(function () {\n _this.timerId = undefined;\n _this.try();\n }, delay);\n };\n return RetryableOperation;\n}());\nvar RetryLink = (function (_super) {\n __extends(RetryLink, _super);\n function RetryLink(options) {\n var _this = _super.call(this) || this;\n var _a = options || {}, attempts = _a.attempts, delay = _a.delay;\n _this.delayFor =\n typeof delay === 'function' ? delay : buildDelayFunction(delay);\n _this.retryIf =\n typeof attempts === 'function' ? attempts : buildRetryFunction(attempts);\n return _this;\n }\n RetryLink.prototype.request = function (operation, nextLink) {\n var retryable = new RetryableOperation(operation, nextLink, this.delayFor, this.retryIf);\n retryable.start();\n return new Observable(function (observer) {\n retryable.subscribe(observer);\n return function () {\n retryable.unsubscribe(observer);\n };\n });\n };\n return RetryLink;\n}(ApolloLink));\nexport { RetryLink };\n//# sourceMappingURL=retryLink.js.map"],"names":["__awaiter","__generator","__extends","Observable","ApolloLink"],"mappings":";;;;;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,KAAK,CAAC,OAAO;AACrB,YAAY,OAAO,QAAQ,KAAK,UAAU,GAAG,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACrF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,QAAQ,EAAE;AACjE,QAAQ,IAAI,SAAS,GAAG,IAAI,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AACjG,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;AAC1B,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,YAAY,OAAO,YAAY;AAC/B,gBAAgB,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AAChD,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;"}
1
+ {"version":3,"file":"retry.cjs","sources":["delayFunction.js","retryFunction.js","retryLink.js"],"sourcesContent":["export function buildDelayFunction(delayOptions) {\n var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d;\n var baseDelay = jitter ? initial : initial / 2;\n return function delayFunction(count) {\n var delay = Math.min(max, baseDelay * Math.pow(2, count));\n if (jitter) {\n delay = Math.random() * delay;\n }\n return delay;\n };\n}\n//# sourceMappingURL=delayFunction.js.map","export function buildRetryFunction(retryOptions) {\n var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b;\n return function retryFunction(count, operation, error) {\n if (count >= max)\n return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n//# sourceMappingURL=retryFunction.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { buildDelayFunction } from \"./delayFunction.js\";\nimport { buildRetryFunction } from \"./retryFunction.js\";\nvar RetryableOperation = (function () {\n function RetryableOperation(operation, nextLink, delayFor, retryIf) {\n var _this = this;\n this.operation = operation;\n this.nextLink = nextLink;\n this.delayFor = delayFor;\n this.retryIf = retryIf;\n this.retryCount = 0;\n this.values = [];\n this.complete = false;\n this.canceled = false;\n this.observers = [];\n this.currentSubscription = null;\n this.onNext = function (value) {\n _this.values.push(value);\n for (var _i = 0, _a = _this.observers; _i < _a.length; _i++) {\n var observer = _a[_i];\n if (!observer)\n continue;\n observer.next(value);\n }\n };\n this.onComplete = function () {\n _this.complete = true;\n for (var _i = 0, _a = _this.observers; _i < _a.length; _i++) {\n var observer = _a[_i];\n if (!observer)\n continue;\n observer.complete();\n }\n };\n this.onError = function (error) { return __awaiter(_this, void 0, void 0, function () {\n var shouldRetry, _i, _a, observer;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n this.retryCount += 1;\n return [4, this.retryIf(this.retryCount, this.operation, error)];\n case 1:\n shouldRetry = _b.sent();\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return [2];\n }\n this.error = error;\n for (_i = 0, _a = this.observers; _i < _a.length; _i++) {\n observer = _a[_i];\n if (!observer)\n continue;\n observer.error(error);\n }\n return [2];\n }\n });\n }); };\n }\n RetryableOperation.prototype.subscribe = function (observer) {\n if (this.canceled) {\n throw new Error(\"Subscribing to a retryable link that was canceled is not supported\");\n }\n this.observers.push(observer);\n for (var _i = 0, _a = this.values; _i < _a.length; _i++) {\n var value = _a[_i];\n observer.next(value);\n }\n if (this.complete) {\n observer.complete();\n }\n else if (this.error) {\n observer.error(this.error);\n }\n };\n RetryableOperation.prototype.unsubscribe = function (observer) {\n var index = this.observers.indexOf(observer);\n if (index < 0) {\n throw new Error(\"RetryLink BUG! Attempting to unsubscribe unknown observer!\");\n }\n this.observers[index] = null;\n if (this.observers.every(function (o) { return o === null; })) {\n this.cancel();\n }\n };\n RetryableOperation.prototype.start = function () {\n if (this.currentSubscription)\n return;\n this.try();\n };\n RetryableOperation.prototype.cancel = function () {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n this.canceled = true;\n };\n RetryableOperation.prototype.try = function () {\n this.currentSubscription = this.nextLink(this.operation).subscribe({\n next: this.onNext,\n error: this.onError,\n complete: this.onComplete,\n });\n };\n RetryableOperation.prototype.scheduleRetry = function (delay) {\n var _this = this;\n if (this.timerId) {\n throw new Error(\"RetryLink BUG! Encountered overlapping retries\");\n }\n this.timerId = setTimeout(function () {\n _this.timerId = undefined;\n _this.try();\n }, delay);\n };\n return RetryableOperation;\n}());\nvar RetryLink = (function (_super) {\n __extends(RetryLink, _super);\n function RetryLink(options) {\n var _this = _super.call(this) || this;\n var _a = options || {}, attempts = _a.attempts, delay = _a.delay;\n _this.delayFor =\n typeof delay === \"function\" ? delay : buildDelayFunction(delay);\n _this.retryIf =\n typeof attempts === \"function\" ? attempts : buildRetryFunction(attempts);\n return _this;\n }\n RetryLink.prototype.request = function (operation, nextLink) {\n var retryable = new RetryableOperation(operation, nextLink, this.delayFor, this.retryIf);\n retryable.start();\n return new Observable(function (observer) {\n retryable.subscribe(observer);\n return function () {\n retryable.unsubscribe(observer);\n };\n });\n };\n return RetryLink;\n}(ApolloLink));\nexport { RetryLink };\n//# sourceMappingURL=retryLink.js.map"],"names":["__awaiter","__generator","__extends","Observable","ApolloLink"],"mappings":";;;;;;;;AAAO,SAAS,kBAAkB,CAAC,YAAY,EAAE;AACjD,IAAI,IAAI,EAAE,GAAG,YAAY,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,OA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,CAAC;AACrB,KAAK;AACL,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,QAAQ,EAAE;AACjE,QAAQ,IAAI,SAAS,GAAG,IAAI,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AACjG,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;AAC1B,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,YAAY,OAAO,YAAY;AAC/B,gBAAgB,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AAChD,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;"}
@@ -148,9 +148,9 @@ var RetryLink = (function (_super) {
148
148
  var _this = _super.call(this) || this;
149
149
  var _a = options || {}, attempts = _a.attempts, delay = _a.delay;
150
150
  _this.delayFor =
151
- typeof delay === 'function' ? delay : buildDelayFunction(delay);
151
+ typeof delay === "function" ? delay : buildDelayFunction(delay);
152
152
  _this.retryIf =
153
- typeof attempts === 'function' ? attempts : buildRetryFunction(attempts);
153
+ typeof attempts === "function" ? attempts : buildRetryFunction(attempts);
154
154
  return _this;
155
155
  }
156
156
  RetryLink.prototype.request = function (operation, nextLink) {
@@ -1,4 +1,4 @@
1
- import type { Operation } from '../core/index.js';
1
+ import type { Operation } from "../core/index.js";
2
2
  export interface RetryFunction {
3
3
  (count: number, operation: Operation, error: any): boolean | Promise<boolean>;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"retryFunction.js","sourceRoot":"","sources":["../../../src/link/retry/retryFunction.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAuB,YAAY,IAAK,EAA2B,EAAjE,OAAO,aAAA,EAAE,WAAO,EAAP,GAAG,mBAAG,CAAC,KAAiD,CAAC;IAC1E,OAAO,SAAS,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK;QACnD,IAAI,KAAK,IAAI,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from '../core/index.js';\n\n/**\n * Advanced mode: a function that determines both whether a particular\n * response should be retried.\n */\nexport interface RetryFunction {\n (count: number, operation: Operation, error: any): boolean | Promise<boolean>;\n}\n\nexport interface RetryFunctionOptions {\n /**\n * The max number of times to try a single operation before giving up.\n *\n * Note that this INCLUDES the initial request as part of the count.\n * E.g. maxTries of 1 indicates no retrying should occur.\n *\n * Defaults to 5. Pass Infinity for infinite retries.\n */\n max?: number;\n\n /**\n * Predicate function that determines whether a particular error should\n * trigger a retry.\n *\n * For example, you may want to not retry 4xx class HTTP errors.\n *\n * By default, all errors are retried.\n */\n retryIf?: (error: any, operation: Operation) => boolean | Promise<boolean>;\n}\n\nexport function buildRetryFunction(\n retryOptions?: RetryFunctionOptions,\n): RetryFunction {\n const { retryIf, max = 5 } = retryOptions || ({} as RetryFunctionOptions);\n return function retryFunction(count, operation, error) {\n if (count >= max) return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n"]}
1
+ {"version":3,"file":"retryFunction.js","sourceRoot":"","sources":["../../../src/link/retry/retryFunction.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAuB,YAAY,IAAK,EAA2B,EAAjE,OAAO,aAAA,EAAE,WAAO,EAAP,GAAG,mBAAG,CAAC,KAAiD,CAAC;IAC1E,OAAO,SAAS,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK;QACnD,IAAI,KAAK,IAAI,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\n/**\n * Advanced mode: a function that determines both whether a particular\n * response should be retried.\n */\nexport interface RetryFunction {\n (count: number, operation: Operation, error: any): boolean | Promise<boolean>;\n}\n\nexport interface RetryFunctionOptions {\n /**\n * The max number of times to try a single operation before giving up.\n *\n * Note that this INCLUDES the initial request as part of the count.\n * E.g. maxTries of 1 indicates no retrying should occur.\n *\n * Defaults to 5. Pass Infinity for infinite retries.\n */\n max?: number;\n\n /**\n * Predicate function that determines whether a particular error should\n * trigger a retry.\n *\n * For example, you may want to not retry 4xx class HTTP errors.\n *\n * By default, all errors are retried.\n */\n retryIf?: (error: any, operation: Operation) => boolean | Promise<boolean>;\n}\n\nexport function buildRetryFunction(\n retryOptions?: RetryFunctionOptions\n): RetryFunction {\n const { retryIf, max = 5 } = retryOptions || ({} as RetryFunctionOptions);\n return function retryFunction(count, operation, error) {\n if (count >= max) return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { Operation, FetchResult, NextLink } from '../core/index.js';
2
- import { ApolloLink } from '../core/index.js';
3
- import { Observable } from '../../utilities/index.js';
4
- import type { DelayFunction, DelayFunctionOptions } from './delayFunction.js';
5
- import type { RetryFunction, RetryFunctionOptions } from './retryFunction.js';
1
+ import type { Operation, FetchResult, NextLink } from "../core/index.js";
2
+ import { ApolloLink } from "../core/index.js";
3
+ import { Observable } from "../../utilities/index.js";
4
+ import type { DelayFunction, DelayFunctionOptions } from "./delayFunction.js";
5
+ import type { RetryFunction, RetryFunctionOptions } from "./retryFunction.js";
6
6
  export declare namespace RetryLink {
7
7
  interface Options {
8
8
  delay?: DelayFunctionOptions | DelayFunction;
@@ -1 +1 @@
1
- {"version":3,"file":"retryLink.d.ts","sourceRoot":"","sources":["../../../src/link/retry/retryLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAIlD,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAKlD,yBAAiB,SAAS,CAAC;IACzB,UAAiB,OAAO;QAItB,KAAK,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;QAK7C,QAAQ,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;KACjD;CACF;AAsJD,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,OAAO,CAAgB;gBAEnB,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO;IAShC,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GACjB,UAAU,CAAC,WAAW,CAAC;CAgB3B"}
1
+ {"version":3,"file":"retryLink.d.ts","sourceRoot":"","sources":["../../../src/link/retry/retryLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG9E,yBAAiB,SAAS,CAAC;IACzB,UAAiB,OAAO;QAItB,KAAK,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;QAK7C,QAAQ,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC;KACjD;CACF;AAsJD,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,OAAO,CAAgB;gBAEnB,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO;IAShC,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GACjB,UAAU,CAAC,WAAW,CAAC;CAgB3B"}
@@ -1,8 +1,8 @@
1
1
  import { __awaiter, __extends, __generator } from "tslib";
2
- import { ApolloLink } from '../core/index.js';
3
- import { Observable } from '../../utilities/index.js';
4
- import { buildDelayFunction, } from './delayFunction.js';
5
- import { buildRetryFunction, } from './retryFunction.js';
2
+ import { ApolloLink } from "../core/index.js";
3
+ import { Observable } from "../../utilities/index.js";
4
+ import { buildDelayFunction } from "./delayFunction.js";
5
+ import { buildRetryFunction } from "./retryFunction.js";
6
6
  var RetryableOperation = (function () {
7
7
  function RetryableOperation(operation, nextLink, delayFor, retryIf) {
8
8
  var _this = this;
@@ -124,9 +124,9 @@ var RetryLink = (function (_super) {
124
124
  var _this = _super.call(this) || this;
125
125
  var _a = options || {}, attempts = _a.attempts, delay = _a.delay;
126
126
  _this.delayFor =
127
- typeof delay === 'function' ? delay : buildDelayFunction(delay);
127
+ typeof delay === "function" ? delay : buildDelayFunction(delay);
128
128
  _this.retryIf =
129
- typeof attempts === 'function' ? attempts : buildRetryFunction(attempts);
129
+ typeof attempts === "function" ? attempts : buildRetryFunction(attempts);
130
130
  return _this;
131
131
  }
132
132
  RetryLink.prototype.request = function (operation, nextLink) {
@@ -1 +1 @@
1
- {"version":3,"file":"retryLink.js","sourceRoot":"","sources":["../../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AC,OAAO,GAAG,SAAS,CAAC;YACzB,KAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC,EAAE,KAAK,CAAmB,CAAC;IAC9B,CAAC;IACH,yBAAC;AAAD,CAAC,AA/ID,IA+IC;AAED;IAA+B,6BAAU;IAIvC,mBAAY,OAA2B;QAAvC,YACE,iBAAO,SAMR;QALO,IAAA,KAAsB,OAAO,IAAK,EAAwB,EAAxD,QAAQ,cAAA,EAAE,KAAK,WAAyC,CAAC;QACjE,KAAI,CAAC,QAAQ;YACX,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClE,KAAI,CAAC,OAAO;YACV,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;;IAC7E,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,QAAkB;QAElB,IAAM,SAAS,GAAG,IAAI,kBAAkB,CACtC,SAAS,EACT,QAAQ,EACR,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,OAAO,CACb,CAAC;QACF,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,IAAI,UAAU,CAAC,UAAA,QAAQ;YAC5B,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC9B,OAAO;gBACL,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AAhCD,CAA+B,UAAU,GAgCxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from '../core/index.js';\nimport { ApolloLink } from '../core/index.js';\nimport type { Observer, ObservableSubscription } from '../../utilities/index.js';\nimport { Observable } from '../../utilities/index.js';\nimport type {\n DelayFunction,\n DelayFunctionOptions} from './delayFunction.js';\nimport {\n buildDelayFunction,\n} from './delayFunction.js';\nimport type {\n RetryFunction,\n RetryFunctionOptions} from './retryFunction.js';\nimport {\n buildRetryFunction,\n} from './retryFunction.js';\n\nexport namespace RetryLink {\n export interface Options {\n /**\n * Configuration for the delay strategy to use, or a custom delay strategy.\n */\n delay?: DelayFunctionOptions | DelayFunction;\n\n /**\n * Configuration for the retry strategy to use, or a custom retry strategy.\n */\n attempts?: RetryFunctionOptions | RetryFunction;\n }\n}\n\n/**\n * Tracking and management of operations that may be (or currently are) retried.\n */\nclass RetryableOperation<TValue = any> {\n private retryCount: number = 0;\n private values: any[] = [];\n private error: any;\n private complete = false;\n private canceled = false;\n private observers: (Observer<TValue> | null)[] = [];\n private currentSubscription: ObservableSubscription | null = null;\n private timerId: number | undefined;\n\n constructor(\n private operation: Operation,\n private nextLink: NextLink,\n private delayFor: DelayFunction,\n private retryIf: RetryFunction,\n ) {}\n\n /**\n * Register a new observer for this operation.\n *\n * If the operation has previously emitted other events, they will be\n * immediately triggered for the observer.\n */\n public subscribe(observer: Observer<TValue>) {\n if (this.canceled) {\n throw new Error(\n `Subscribing to a retryable link that was canceled is not supported`,\n );\n }\n this.observers.push(observer);\n\n // If we've already begun, catch this observer up.\n for (const value of this.values) {\n observer.next!(value);\n }\n\n if (this.complete) {\n observer.complete!();\n } else if (this.error) {\n observer.error!(this.error);\n }\n }\n\n /**\n * Remove a previously registered observer from this operation.\n *\n * If no observers remain, the operation will stop retrying, and unsubscribe\n * from its downstream link.\n */\n public unsubscribe(observer: Observer<TValue>) {\n const index = this.observers.indexOf(observer);\n if (index < 0) {\n throw new Error(\n `RetryLink BUG! Attempting to unsubscribe unknown observer!`,\n );\n }\n // Note that we are careful not to change the order of length of the array,\n // as we are often mid-iteration when calling this method.\n this.observers[index] = null;\n\n // If this is the last observer, we're done.\n if (this.observers.every(o => o === null)) {\n this.cancel();\n }\n }\n\n /**\n * Start the initial request.\n */\n public start() {\n if (this.currentSubscription) return; // Already started.\n\n this.try();\n }\n\n /**\n * Stop retrying for the operation, and cancel any in-progress requests.\n */\n public cancel() {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n this.canceled = true;\n }\n\n private try() {\n this.currentSubscription = this.nextLink(this.operation).subscribe({\n next: this.onNext,\n error: this.onError,\n complete: this.onComplete,\n });\n }\n\n private onNext = (value: any) => {\n this.values.push(value);\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.next!(value);\n }\n };\n\n private onComplete = () => {\n this.complete = true;\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.complete!();\n }\n };\n\n private onError = async (error: any) => {\n this.retryCount += 1;\n\n // Should we retry?\n const shouldRetry = await this.retryIf(\n this.retryCount,\n this.operation,\n error,\n );\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return;\n }\n\n this.error = error;\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.error!(error);\n }\n };\n\n private scheduleRetry(delay: number) {\n if (this.timerId) {\n throw new Error(`RetryLink BUG! Encountered overlapping retries`);\n }\n\n this.timerId = (setTimeout(() => {\n this.timerId = undefined;\n this.try();\n }, delay) as any) as number;\n }\n}\n\nexport class RetryLink extends ApolloLink {\n private delayFor: DelayFunction;\n private retryIf: RetryFunction;\n\n constructor(options?: RetryLink.Options) {\n super();\n const { attempts, delay } = options || ({} as RetryLink.Options);\n this.delayFor =\n typeof delay === 'function' ? delay : buildDelayFunction(delay);\n this.retryIf =\n typeof attempts === 'function' ? attempts : buildRetryFunction(attempts);\n }\n\n public request(\n operation: Operation,\n nextLink: NextLink,\n ): Observable<FetchResult> {\n const retryable = new RetryableOperation(\n operation,\n nextLink,\n this.delayFor,\n this.retryIf,\n );\n retryable.start();\n\n return new Observable(observer => {\n retryable.subscribe(observer);\n return () => {\n retryable.unsubscribe(observer);\n };\n });\n }\n}\n"]}
1
+ {"version":3,"file":"retryLink.js","sourceRoot":"","sources":["../../../src/link/retry/retryLink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AAG,SAAS,CAAC;YACzB,KAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC,EAAE,KAAK,CAAkB,CAAC;IAC7B,CAAC;IACH,yBAAC;AAAD,CAAC,AA/ID,IA+IC;AAED;IAA+B,6BAAU;IAIvC,mBAAY,OAA2B;QAAvC,YACE,iBAAO,SAMR;QALO,IAAA,KAAsB,OAAO,IAAK,EAAwB,EAAxD,QAAQ,cAAA,EAAE,KAAK,WAAyC,CAAC;QACjE,KAAI,CAAC,QAAQ;YACX,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClE,KAAI,CAAC,OAAO;YACV,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;;IAC7E,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,QAAkB;QAElB,IAAM,SAAS,GAAG,IAAI,kBAAkB,CACtC,SAAS,EACT,QAAQ,EACR,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,OAAO,CACb,CAAC;QACF,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC9B,OAAO;gBACL,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AAhCD,CAA+B,UAAU,GAgCxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type {\n Observer,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type { DelayFunction, DelayFunctionOptions } from \"./delayFunction.js\";\nimport { buildDelayFunction } from \"./delayFunction.js\";\nimport type { RetryFunction, RetryFunctionOptions } from \"./retryFunction.js\";\nimport { buildRetryFunction } from \"./retryFunction.js\";\n\nexport namespace RetryLink {\n export interface Options {\n /**\n * Configuration for the delay strategy to use, or a custom delay strategy.\n */\n delay?: DelayFunctionOptions | DelayFunction;\n\n /**\n * Configuration for the retry strategy to use, or a custom retry strategy.\n */\n attempts?: RetryFunctionOptions | RetryFunction;\n }\n}\n\n/**\n * Tracking and management of operations that may be (or currently are) retried.\n */\nclass RetryableOperation<TValue = any> {\n private retryCount: number = 0;\n private values: any[] = [];\n private error: any;\n private complete = false;\n private canceled = false;\n private observers: (Observer<TValue> | null)[] = [];\n private currentSubscription: ObservableSubscription | null = null;\n private timerId: number | undefined;\n\n constructor(\n private operation: Operation,\n private nextLink: NextLink,\n private delayFor: DelayFunction,\n private retryIf: RetryFunction\n ) {}\n\n /**\n * Register a new observer for this operation.\n *\n * If the operation has previously emitted other events, they will be\n * immediately triggered for the observer.\n */\n public subscribe(observer: Observer<TValue>) {\n if (this.canceled) {\n throw new Error(\n `Subscribing to a retryable link that was canceled is not supported`\n );\n }\n this.observers.push(observer);\n\n // If we've already begun, catch this observer up.\n for (const value of this.values) {\n observer.next!(value);\n }\n\n if (this.complete) {\n observer.complete!();\n } else if (this.error) {\n observer.error!(this.error);\n }\n }\n\n /**\n * Remove a previously registered observer from this operation.\n *\n * If no observers remain, the operation will stop retrying, and unsubscribe\n * from its downstream link.\n */\n public unsubscribe(observer: Observer<TValue>) {\n const index = this.observers.indexOf(observer);\n if (index < 0) {\n throw new Error(\n `RetryLink BUG! Attempting to unsubscribe unknown observer!`\n );\n }\n // Note that we are careful not to change the order of length of the array,\n // as we are often mid-iteration when calling this method.\n this.observers[index] = null;\n\n // If this is the last observer, we're done.\n if (this.observers.every((o) => o === null)) {\n this.cancel();\n }\n }\n\n /**\n * Start the initial request.\n */\n public start() {\n if (this.currentSubscription) return; // Already started.\n\n this.try();\n }\n\n /**\n * Stop retrying for the operation, and cancel any in-progress requests.\n */\n public cancel() {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n this.canceled = true;\n }\n\n private try() {\n this.currentSubscription = this.nextLink(this.operation).subscribe({\n next: this.onNext,\n error: this.onError,\n complete: this.onComplete,\n });\n }\n\n private onNext = (value: any) => {\n this.values.push(value);\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.next!(value);\n }\n };\n\n private onComplete = () => {\n this.complete = true;\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.complete!();\n }\n };\n\n private onError = async (error: any) => {\n this.retryCount += 1;\n\n // Should we retry?\n const shouldRetry = await this.retryIf(\n this.retryCount,\n this.operation,\n error\n );\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return;\n }\n\n this.error = error;\n for (const observer of this.observers) {\n if (!observer) continue;\n observer.error!(error);\n }\n };\n\n private scheduleRetry(delay: number) {\n if (this.timerId) {\n throw new Error(`RetryLink BUG! Encountered overlapping retries`);\n }\n\n this.timerId = setTimeout(() => {\n this.timerId = undefined;\n this.try();\n }, delay) as any as number;\n }\n}\n\nexport class RetryLink extends ApolloLink {\n private delayFor: DelayFunction;\n private retryIf: RetryFunction;\n\n constructor(options?: RetryLink.Options) {\n super();\n const { attempts, delay } = options || ({} as RetryLink.Options);\n this.delayFor =\n typeof delay === \"function\" ? delay : buildDelayFunction(delay);\n this.retryIf =\n typeof attempts === \"function\" ? attempts : buildRetryFunction(attempts);\n }\n\n public request(\n operation: Operation,\n nextLink: NextLink\n ): Observable<FetchResult> {\n const retryable = new RetryableOperation(\n operation,\n nextLink,\n this.delayFor,\n this.retryIf\n );\n retryable.start();\n\n return new Observable((observer) => {\n retryable.subscribe(observer);\n return () => {\n retryable.unsubscribe(observer);\n };\n });\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { GraphQLSchema } from 'graphql';
2
- import type { Operation, FetchResult } from '../core/index.js';
3
- import { ApolloLink } from '../core/index.js';
4
- import { Observable } from '../../utilities/index.js';
1
+ import type { GraphQLSchema } from "graphql";
2
+ import type { Operation, FetchResult } from "../core/index.js";
3
+ import { ApolloLink } from "../core/index.js";
4
+ import { Observable } from "../../utilities/index.js";
5
5
  export declare namespace SchemaLink {
6
6
  type ResolverContext = Record<string, any>;
7
7
  type ResolverContextFunction = (operation: Operation) => ResolverContext | PromiseLike<ResolverContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,yBAAiB,UAAU,CAAC;IAC1B,KAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClD,KAAY,uBAAuB,GAAG,CACpC,SAAS,EAAE,SAAS,KACjB,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAEpD,UAAiB,OAAO;QAItB,MAAM,EAAE,aAAa,CAAC;QAKtB,SAAS,CAAC,EAAE,GAAG,CAAC;QAKhB,OAAO,CAAC,EAAE,eAAe,GAAG,uBAAuB,CAAC;QAMpD,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;CACF;AAED,qBAAa,UAAW,SAAQ,UAAU;IACjC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,UAAU,CAAC,OAAO;IAQhC,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC;CAoC9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,yBAAiB,UAAU,CAAC;IAC1B,KAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClD,KAAY,uBAAuB,GAAG,CACpC,SAAS,EAAE,SAAS,KACjB,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAEpD,UAAiB,OAAO;QAItB,MAAM,EAAE,aAAa,CAAC;QAKtB,SAAS,CAAC,EAAE,GAAG,CAAC;QAKhB,OAAO,CAAC,EAAE,eAAe,GAAG,uBAAuB,CAAC;QAMpD,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;CACF;AAED,qBAAa,UAAW,SAAQ,UAAU;IACjC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,UAAU,CAAC,OAAO;IAQhC,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC;CAuC9D"}
@@ -1,7 +1,7 @@
1
1
  import { __extends } from "tslib";
2
- import { validate, execute } from 'graphql';
3
- import { ApolloLink } from '../core/index.js';
4
- import { Observable } from '../../utilities/index.js';
2
+ import { validate, execute } from "graphql";
3
+ import { ApolloLink } from "../core/index.js";
4
+ import { Observable } from "../../utilities/index.js";
5
5
  var SchemaLink = (function (_super) {
6
6
  __extends(SchemaLink, _super);
7
7
  function SchemaLink(options) {
@@ -15,9 +15,12 @@ var SchemaLink = (function (_super) {
15
15
  SchemaLink.prototype.request = function (operation) {
16
16
  var _this = this;
17
17
  return new Observable(function (observer) {
18
- new Promise(function (resolve) { return resolve(typeof _this.context === 'function'
19
- ? _this.context(operation)
20
- : _this.context); }).then(function (context) {
18
+ new Promise(function (resolve) {
19
+ return resolve(typeof _this.context === "function"
20
+ ? _this.context(operation)
21
+ : _this.context);
22
+ })
23
+ .then(function (context) {
21
24
  if (_this.validate) {
22
25
  var validationErrors = validate(_this.schema, operation.query);
23
26
  if (validationErrors.length > 0) {
@@ -32,12 +35,14 @@ var SchemaLink = (function (_super) {
32
35
  variableValues: operation.variables,
33
36
  operationName: operation.operationName,
34
37
  });
35
- }).then(function (data) {
38
+ })
39
+ .then(function (data) {
36
40
  if (!observer.closed) {
37
41
  observer.next(data);
38
42
  observer.complete();
39
43
  }
40
- }).catch(function (error) {
44
+ })
45
+ .catch(function (error) {
41
46
  if (!observer.closed) {
42
47
  observer.error(error);
43
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAgCtD;IAAgC,8BAAU;IAMxC,oBAAY,OAA2B;QAAvC,YACE,iBAAO,SAKR;QAJC,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,KAAI,CAAC,SAAS,GAAG,OAAO,CAA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,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACpB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACvB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AAlDD,CAAgC,UAAU,GAkDzC","sourcesContent":["import type { GraphQLSchema } from 'graphql';\nimport { validate, execute } from 'graphql';\n\nimport type { Operation, FetchResult } from '../core/index.js';\nimport { ApolloLink } from '../core/index.js';\nimport { Observable } from '../../utilities/index.js';\n\nexport namespace SchemaLink {\n export type ResolverContext = Record<string, any>;\n export type ResolverContextFunction = (\n operation: Operation,\n ) => ResolverContext | PromiseLike<ResolverContext>;\n\n export interface Options {\n /**\n * The schema to generate responses from.\n */\n schema: GraphQLSchema;\n\n /**\n * The root value to use when generating responses.\n */\n rootValue?: any;\n\n /**\n * A context to provide to resolvers declared within the schema.\n */\n context?: ResolverContext | ResolverContextFunction;\n\n /**\n * Validate incoming queries against the given schema, returning\n * validation errors as a GraphQL server would.\n */\n validate?: boolean;\n }\n}\n\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(operation: Operation): Observable<FetchResult> {\n return new Observable<FetchResult>(observer => {\n new Promise<SchemaLink.ResolverContext>(\n resolve => resolve(\n typeof this.context === 'function'\n ? this.context(operation)\n : this.context\n )\n ).then(context => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n }).then(data => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n }).catch(error => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAgCtD;IAAgC,8BAAU;IAMxC,oBAAY,OAA2B;QAAvC,YACE,iBAAO,SAKR;QAJC,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,KAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;;IACrC,CAAC;IAEM,4BAAO,GAAd,UAAe,SAAoB;QAAnC,iBAsCC;QArCC,OAAO,IAAI,UAAU,CAAc,UAAC,QAAQ;YAC1C,IAAI,OAAO,CAA6B,UAAC,OAAO;gBAC9C,OAAA,OAAO,CACL,OAAO,KAAI,CAAC,OAAO,KAAK,UAAU;oBAChC,CAAC,CAAC,KAAI,CAAC,OAAO,CAAC,SAAS,CAAC;oBACzB,CAAC,CAAC,KAAI,CAAC,OAAO,CACjB;YAJD,CAIC,CACF;iBACE,IAAI,CAAC,UAAC,OAAO;gBACZ,IAAI,KAAI,CAAC,QAAQ,EAAE;oBACjB,IAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAChE,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC/B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;qBACrC;iBACF;gBAED,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,KAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,SAAS,CAAC,KAAK;oBACzB,SAAS,EAAE,KAAI,CAAC,SAAS;oBACzB,YAAY,EAAE,OAAO;oBACrB,cAAc,EAAE,SAAS,CAAC,SAAS;oBACnC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,IAAI,CAAC,UAAC,IAAI;gBACT,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACpB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACpB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,KAAK;gBACX,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACpB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACvB;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AArDD,CAAgC,UAAU,GAqDzC","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { validate, execute } from \"graphql\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\n\nexport namespace SchemaLink {\n export type ResolverContext = Record<string, any>;\n export type ResolverContextFunction = (\n operation: Operation\n ) => ResolverContext | PromiseLike<ResolverContext>;\n\n export interface Options {\n /**\n * The schema to generate responses from.\n */\n schema: GraphQLSchema;\n\n /**\n * The root value to use when generating responses.\n */\n rootValue?: any;\n\n /**\n * A context to provide to resolvers declared within the schema.\n */\n context?: ResolverContext | ResolverContextFunction;\n\n /**\n * Validate incoming queries against the given schema, returning\n * validation errors as a GraphQL server would.\n */\n validate?: boolean;\n }\n}\n\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(operation: Operation): Observable<FetchResult> {\n return new Observable<FetchResult>((observer) => {\n new Promise<SchemaLink.ResolverContext>((resolve) =>\n resolve(\n typeof this.context === \"function\"\n ? this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
@@ -20,9 +20,12 @@ var SchemaLink = (function (_super) {
20
20
  SchemaLink.prototype.request = function (operation) {
21
21
  var _this = this;
22
22
  return new utilities.Observable(function (observer) {
23
- new Promise(function (resolve) { return resolve(typeof _this.context === 'function'
24
- ? _this.context(operation)
25
- : _this.context); }).then(function (context) {
23
+ new Promise(function (resolve) {
24
+ return resolve(typeof _this.context === "function"
25
+ ? _this.context(operation)
26
+ : _this.context);
27
+ })
28
+ .then(function (context) {
26
29
  if (_this.validate) {
27
30
  var validationErrors = graphql.validate(_this.schema, operation.query);
28
31
  if (validationErrors.length > 0) {
@@ -37,12 +40,14 @@ var SchemaLink = (function (_super) {
37
40
  variableValues: operation.variables,
38
41
  operationName: operation.operationName,
39
42
  });
40
- }).then(function (data) {
43
+ })
44
+ .then(function (data) {
41
45
  if (!observer.closed) {
42
46
  observer.next(data);
43
47
  observer.complete();
44
48
  }
45
- }).catch(function (error) {
49
+ })
50
+ .catch(function (error) {
46
51
  if (!observer.closed) {
47
52
  observer.error(error);
48
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schema.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { validate, execute } from 'graphql';\nimport { ApolloLink } from '../core/index.js';\nimport { Observable } from '../../utilities/index.js';\nvar SchemaLink = (function (_super) {\n __extends(SchemaLink, _super);\n function SchemaLink(options) {\n var _this = _super.call(this) || this;\n _this.schema = options.schema;\n _this.rootValue = options.rootValue;\n _this.context = options.context;\n _this.validate = !!options.validate;\n return _this;\n }\n SchemaLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n new Promise(function (resolve) { return resolve(typeof _this.context === 'function'\n ? _this.context(operation)\n : _this.context); }).then(function (context) {\n if (_this.validate) {\n var validationErrors = validate(_this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n return execute({\n schema: _this.schema,\n document: operation.query,\n rootValue: _this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n }).then(function (data) {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n }).catch(function (error) {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n };\n return SchemaLink;\n}(ApolloLink));\nexport { SchemaLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","Observable","validate","execute","ApolloLink"],"mappings":";;;;;;;;;AAIG,IAAC,UAAU,IAAI,UAAU,MAAM,EAAE;AACpC,IAAIA,eAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAClC,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACtC,QAAQ,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AAC5C,QAAQ,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC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pC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;AACtC,oBAAoB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,oBAAoB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACxC,iBAAiB;AACjB,aAAa,CAAC,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE;AACtC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;AACtC,oBAAoB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1C,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,CAACC,eAAU,CAAC;;;;"}
1
+ {"version":3,"file":"schema.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { validate, execute } from \"graphql\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nvar SchemaLink = (function (_super) {\n __extends(SchemaLink, _super);\n function SchemaLink(options) {\n var _this = _super.call(this) || this;\n _this.schema = options.schema;\n _this.rootValue = options.rootValue;\n _this.context = options.context;\n _this.validate = !!options.validate;\n return _this;\n }\n SchemaLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n new Promise(function (resolve) {\n return resolve(typeof _this.context === \"function\"\n ? _this.context(operation)\n : _this.context);\n })\n .then(function (context) {\n if (_this.validate) {\n var validationErrors = validate(_this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n return execute({\n schema: _this.schema,\n document: operation.query,\n rootValue: _this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then(function (data) {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch(function (error) {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n };\n return SchemaLink;\n}(ApolloLink));\nexport { SchemaL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C,MAAM,GAAG,CAAC,EAAE;AACrD,wBAAwB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAC5D,qBAAqB;AACrB,iBAAiB;AACjB,gBAAgB,OAAOC,eAAO,CAAC;AAC/B,oBAAoB,MAAM,EAAE,KAAK,CAAC,MAAM;AACxC,oBAAoB,QAAQ,EAAE,SAAS,CAAC,KAAK;AAC7C,oBAAoB,SAAS,EAAE,KAAK,CAAC,SAAS;AAC9C,oBAAoB,YAAY,EAAE,OAAO;AACzC,oBAAoB,cAAc,EAAE,SAAS,CAAC,SAAS;AACvD,oBAAoB,aAAa,EAAE,SAAS,CAAC,aAAa;AAC1D,iBAAiB,CAAC,CAAC;AACnB,aAAa,CAAC;AACd,iBAAiB,IAAI,CAAC,UAAU,IAAI,EAAE;AACtC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;AACtC,oBAAoB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,oBAAoB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACxC,iBAAiB;AACjB,aAAa,CAAC;AACd,iBAAiB,KAAK,CAAC,UAAU,KAAK,EAAE;AACxC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;AACtC,oBAAoB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1C,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,CAACC,eAAU,CAAC;;;;"}
@@ -20,9 +20,12 @@ var SchemaLink = (function (_super) {
20
20
  SchemaLink.prototype.request = function (operation) {
21
21
  var _this = this;
22
22
  return new utilities.Observable(function (observer) {
23
- new Promise(function (resolve) { return resolve(typeof _this.context === 'function'
24
- ? _this.context(operation)
25
- : _this.context); }).then(function (context) {
23
+ new Promise(function (resolve) {
24
+ return resolve(typeof _this.context === "function"
25
+ ? _this.context(operation)
26
+ : _this.context);
27
+ })
28
+ .then(function (context) {
26
29
  if (_this.validate) {
27
30
  var validationErrors = graphql.validate(_this.schema, operation.query);
28
31
  if (validationErrors.length > 0) {
@@ -37,12 +40,14 @@ var SchemaLink = (function (_super) {
37
40
  variableValues: operation.variables,
38
41
  operationName: operation.operationName,
39
42
  });
40
- }).then(function (data) {
43
+ })
44
+ .then(function (data) {
41
45
  if (!observer.closed) {
42
46
  observer.next(data);
43
47
  observer.complete();
44
48
  }
45
- }).catch(function (error) {
49
+ })
50
+ .catch(function (error) {
46
51
  if (!observer.closed) {
47
52
  observer.error(error);
48
53
  }
@@ -1,5 +1,5 @@
1
1
  import { __assign, __extends } from "tslib";
2
- import { print } from '../../utilities/index.js';
2
+ import { print } from "../../utilities/index.js";
3
3
  import { ApolloLink } from "../core/index.js";
4
4
  import { isNonNullObject, Observable } from "../../utilities/index.js";
5
5
  import { ApolloError } from "../../errors/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":";AA8BA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC;AAClE,CAAC;AAGD,SAAS,gBAAgB,CAAC,GAAY;;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,UAAU,MAAK,SAAS,CAAC,MAAM,CAAC;AAC7E,CAAC;AAED;IAAmC,iCAAU;IAC3C,uBAA4B,MAAc;QAA1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C","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport { print } from '../../utilities/index.js';\nimport type { Client } from \"graphql-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { isNonNullObject, Observable } from \"../../utilities/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(operation: Operation): Observable<FetchResult> {\n return new Observable((observer) => {\n return this.client.subscribe<FetchResult>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(`Socket closed${\n likeClose ? ` with event ${err.code}` : \"\"\n }${\n likeClose ? ` ${err.reason}` : \"\"\n }`)\n );\n }\n\n return observer.error(\n new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n })\n );\n },\n }\n );\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":";AA8BA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC;AAClE,CAAC;AAGD,SAAS,gBAAgB,CAAC,GAAY;;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,UAAU,MAAK,SAAS,CAAC,MAAM,CAAC;AAC7E,CAAC;AAED;IAAmC,iCAAU;IAC3C,uBAA4B,MAAc;QAA1C,YACE,iBAAO,SACR;QAF2B,YAAM,GAAN,MAAM,CAAQ;;IAE1C,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QAAnC,iBAgCC;QA/BC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,OAAO,KAAI,CAAC,MAAM,CAAC,SAAS,uBACrB,SAAS,KAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAC7C;gBACE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAClC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC1C,KAAK,EAAE,UAAC,GAAG;oBACT,IAAI,GAAG,YAAY,KAAK,EAAE;wBACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;qBAC5B;oBACD,IAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;oBACxC,IAAI,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;wBACtC,OAAO,QAAQ,CAAC,KAAK,CAEnB,IAAI,KAAK,CACP,uBAAgB,SAAS,CAAC,CAAC,CAAC,sBAAe,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAE,SACxD,SAAS,CAAC,CAAC,CAAC,WAAI,GAAG,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC,EAAE,CACjC,CACH,CACF,CAAC;qBACH;oBAED,OAAO,QAAQ,CAAC,KAAK,CACnB,IAAI,WAAW,CAAC;wBACd,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;qBAChD,CAAC,CACH,CAAC;gBACJ,CAAC;aACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AAtCD,CAAmC,UAAU,GAsC5C","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport { print } from \"../../utilities/index.js\";\nimport type { Client } from \"graphql-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { isNonNullObject, Observable } from \"../../utilities/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(operation: Operation): Observable<FetchResult> {\n return new Observable((observer) => {\n return this.client.subscribe<FetchResult>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n })\n );\n },\n }\n );\n });\n }\n}\n"]}