@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAC;AAIvC,OAAO,EAAE,eAAe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AAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;QACzC,KAAI,CAAC,OAAO,GAAG,YAAY,IAAI,oBAAoB,CAAC,KAAI,CAAC,CAAC;QAC1D,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAI1B,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxCD,CAAiC,KAAK,GAwCrC","sourcesContent":["import '../utilities/globals/index.js';\n\nimport type { GraphQLError, GraphQLErrorExtensions } from 'graphql';\n\nimport { isNonNullObject } from '../utilities/index.js';\nimport type { ServerParseError } from '../link/http/index.js';\nimport type { ServerError } from '../link/utils/index.js';\nimport type { FetchResult } from \"../link/core/index.js\";\n\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport const PROTOCOL_ERRORS_SYMBOL: unique symbol = Symbol();\n\ntype FetchResultWithSymbolExtensions<T> = FetchResult<T> & {\n extensions: Record<string | symbol, any>\n};\n\nexport interface ApolloErrorOptions {\n graphQLErrors?: ReadonlyArray<GraphQLError>;\n protocolErrors?: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n clientErrors?: ReadonlyArray<Error>;\n networkError?: Error | ServerParseError | ServerError | null;\n errorMessage?: string;\n extraInfo?: any;\n}\n\nexport function graphQLResultHasProtocolErrors<T>(\n result: FetchResult<T>\n): result is FetchResultWithSymbolExtensions<T> {\n if (result.extensions) {\n return Array.isArray(\n (result as FetchResultWithSymbolExtensions<T>).extensions[\n PROTOCOL_ERRORS_SYMBOL\n ]\n );\n }\n return false;\n}\n\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty('graphQLErrors');\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n const errors = [\n ...err.graphQLErrors,\n ...err.clientErrors,\n ...err.protocolErrors\n ];\n if (err.networkError) errors.push(err.networkError);\n return errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(err => isNonNullObject(err) && err.message || 'Error message not found.')\n .join('\\n');\n};\n\nexport type GraphQLErrors = ReadonlyArray<GraphQLError>;\n\nexport type NetworkError = Error | ServerParseError | ServerError | null;\n\nexport class ApolloError extends Error {\n public name: string;\n public message: string;\n public graphQLErrors: GraphQLErrors;\n public protocolErrors: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n public clientErrors: ReadonlyArray<Error>;\n public networkError: Error | ServerParseError | ServerError | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n protocolErrors,\n clientErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: ApolloErrorOptions) {\n super(errorMessage);\n this.name = 'ApolloError';\n this.graphQLErrors = graphQLErrors || [];\n this.protocolErrors = protocolErrors || [];\n this.clientErrors = clientErrors || [];\n this.networkError = networkError || null;\n this.message = errorMessage || generateErrorMessage(this);\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,MAAM,CAAC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAkB9D,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB,OAAO,KAAK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1B,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxCD,CAAiC,KAAK,GAwCrC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nimport type { GraphQLError, GraphQLErrorExtensions } from \"graphql\";\n\nimport { isNonNullObject } from \"../utilities/index.js\";\nimport type { ServerParseError } from \"../link/http/index.js\";\nimport type { ServerError } from \"../link/utils/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\n\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport const PROTOCOL_ERRORS_SYMBOL: unique symbol = Symbol();\n\ntype FetchResultWithSymbolExtensions<T> = FetchResult<T> & {\n extensions: Record<string | symbol, any>;\n};\n\nexport interface ApolloErrorOptions {\n graphQLErrors?: ReadonlyArray<GraphQLError>;\n protocolErrors?: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n clientErrors?: ReadonlyArray<Error>;\n networkError?: Error | ServerParseError | ServerError | null;\n errorMessage?: string;\n extraInfo?: any;\n}\n\nexport function graphQLResultHasProtocolErrors<T>(\n result: FetchResult<T>\n): result is FetchResultWithSymbolExtensions<T> {\n if (result.extensions) {\n return Array.isArray(\n (result as FetchResultWithSymbolExtensions<T>).extensions[\n PROTOCOL_ERRORS_SYMBOL\n ]\n );\n }\n return false;\n}\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n const errors = [\n ...err.graphQLErrors,\n ...err.clientErrors,\n ...err.protocolErrors,\n ];\n if (err.networkError) errors.push(err.networkError);\n return (\n errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(\n (err) =>\n (isNonNullObject(err) && err.message) || \"Error message not found.\"\n )\n .join(\"\\n\")\n );\n};\n\nexport type GraphQLErrors = ReadonlyArray<GraphQLError>;\n\nexport type NetworkError = Error | ServerParseError | ServerError | null;\n\nexport class ApolloError extends Error {\n public name: string;\n public message: string;\n public graphQLErrors: GraphQLErrors;\n public protocolErrors: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n public clientErrors: ReadonlyArray<Error>;\n public networkError: Error | ServerParseError | ServerError | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n protocolErrors,\n clientErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: ApolloErrorOptions) {\n super(errorMessage);\n this.name = \"ApolloError\";\n this.graphQLErrors = graphQLErrors || [];\n this.protocolErrors = protocolErrors || [];\n this.clientErrors = clientErrors || [];\n this.networkError = networkError || null;\n this.message = errorMessage || generateErrorMessage(this);\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n"]}
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './core/index.js';
2
- export * from './react/index.js';
1
+ export * from "./core/index.js";
2
+ export * from "./react/index.js";
3
3
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './core/index.js';
2
- export * from './react/index.js';
1
+ export * from "./core/index.js";
2
+ export * from "./react/index.js";
3
3
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './core/index.js';\nexport * from './react/index.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./core/index.js\";\nexport * from \"./react/index.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"invariantErrorCodes.d.ts","sourceRoot":"","sources":["../src/invariantErrorCodes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACxE;AAED,eAAO,MAAM,UAAU,EAAE,UAAe,CAAC;AACzC,eAAO,MAAM,QAAQ,EAAE,UAAe,CAAC;AACvC,eAAO,MAAM,MAAM,EAAE,UAAe,CAAC;AACrC,eAAO,MAAM,OAAO,EAAE,UAAe,CAAC;AACtC,eAAO,MAAM,QAAQ,EAAE,UAAe,CAAC"}
1
+ {"version":3,"file":"invariantErrorCodes.d.ts","sourceRoot":"","sources":["../src/invariantErrorCodes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED,eAAO,MAAM,UAAU,EAAE,UAAe,CAAC;AACzC,eAAO,MAAM,QAAQ,EAAE,UAAe,CAAC;AACvC,eAAO,MAAM,MAAM,EAAE,UAAe,CAAC;AACrC,eAAO,MAAM,OAAO,EAAE,UAAe,CAAC;AACtC,eAAO,MAAM,QAAQ,EAAE,UAAe,CAAC"}
@@ -56,12 +56,12 @@ export const errorCodes = // This file is used by the error message display webs
56
56
 
57
57
  14: {
58
58
  file: "@apollo/client/core/ApolloClient.js",
59
- condition: "options.fetchPolicy !== 'cache-and-network'",
59
+ condition: "options.fetchPolicy !== \"cache-and-network\"",
60
60
 
61
- message: 'The cache-and-network fetchPolicy does not work with client.query, because ' +
62
- 'client.query can only return a single result. Please use client.watchQuery ' +
63
- 'to receive multiple results from the cache and the network, or consider ' +
64
- 'using a different fetchPolicy, such as cache-first or network-only.'
61
+ message: "The cache-and-network fetchPolicy does not work with client.query, because " +
62
+ "client.query can only return a single result. Please use client.watchQuery " +
63
+ "to receive multiple results from the cache and the network, or consider " +
64
+ "using a different fetchPolicy, such as cache-first or network-only."
65
65
  },
66
66
 
67
67
  16: {
@@ -79,23 +79,23 @@ export const errorCodes = // This file is used by the error message display webs
79
79
  20: {
80
80
  file: "@apollo/client/core/ObservableQuery.js",
81
81
  condition: "pollInterval",
82
- message: 'Attempted to start a polling query without a polling interval.'
82
+ message: "Attempted to start a polling query without a polling interval."
83
83
  },
84
84
 
85
85
  23: {
86
86
  file: "@apollo/client/core/QueryManager.js",
87
- message: 'QueryManager stopped while query was in flight'
87
+ message: "QueryManager stopped while query was in flight"
88
88
  },
89
89
 
90
90
  24: {
91
91
  file: "@apollo/client/core/QueryManager.js",
92
92
  condition: "mutation",
93
- message: 'mutation option is required. You must specify your GraphQL document in the mutation option.'
93
+ message: "mutation option is required. You must specify your GraphQL document in the mutation option."
94
94
  },
95
95
 
96
96
  25: {
97
97
  file: "@apollo/client/core/QueryManager.js",
98
- condition: "fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache'",
98
+ condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"",
99
99
  message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."
100
100
  },
101
101
 
@@ -103,36 +103,36 @@ export const errorCodes = // This file is used by the error message display webs
103
103
  file: "@apollo/client/core/QueryManager.js",
104
104
  condition: "options.query",
105
105
 
106
- message: 'query option is required. You must specify your GraphQL document ' +
107
- 'in the query option.'
106
+ message: "query option is required. You must specify your GraphQL document " +
107
+ "in the query option."
108
108
  },
109
109
 
110
110
  27: {
111
111
  file: "@apollo/client/core/QueryManager.js",
112
- condition: "options.query.kind === 'Document'",
112
+ condition: "options.query.kind === \"Document\"",
113
113
  message: 'You must wrap the query string in a "gql" tag.'
114
114
  },
115
115
 
116
116
  28: {
117
117
  file: "@apollo/client/core/QueryManager.js",
118
118
  condition: "!options.returnPartialData",
119
- message: 'returnPartialData option only supported on watchQuery.'
119
+ message: "returnPartialData option only supported on watchQuery."
120
120
  },
121
121
 
122
122
  29: {
123
123
  file: "@apollo/client/core/QueryManager.js",
124
124
  condition: "!options.pollInterval",
125
- message: 'pollInterval option only supported on watchQuery.'
125
+ message: "pollInterval option only supported on watchQuery."
126
126
  },
127
127
 
128
128
  30: {
129
129
  file: "@apollo/client/core/QueryManager.js",
130
- message: 'Store reset while query was in flight (not completed in link chain)'
130
+ message: "Store reset while query was in flight (not completed in link chain)"
131
131
  },
132
132
 
133
133
  34: {
134
134
  file: "@apollo/client/link/core/ApolloLink.js",
135
- message: 'request is not implemented'
135
+ message: "request is not implemented"
136
136
  },
137
137
 
138
138
  35: {
@@ -147,17 +147,17 @@ export const errorCodes = // This file is used by the error message display webs
147
147
 
148
148
  38: {
149
149
  file: "@apollo/client/link/persisted-queries/index.js",
150
- condition: "options && (typeof options.sha256 === 'function' ||\n typeof options.generateHash === 'function')",
150
+ condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
151
151
 
152
152
  message: 'Missing/invalid "sha256" or "generateHash" function. Please ' +
153
153
  'configure one using the "createPersistedQueryLink(options)" options ' +
154
- 'parameter.'
154
+ "parameter."
155
155
  },
156
156
 
157
157
  39: {
158
158
  file: "@apollo/client/link/persisted-queries/index.js",
159
159
  condition: "forward",
160
- message: 'PersistedQueryLink cannot be the last link in the chain.'
160
+ message: "PersistedQueryLink cannot be the last link in the chain."
161
161
  },
162
162
 
163
163
  41: {
@@ -299,13 +299,13 @@ export const errorCodes = // This file is used by the error message display webs
299
299
 
300
300
  66: {
301
301
  file: "@apollo/client/utilities/graphql/directives.js",
302
- condition: "ifArgument.name && ifArgument.name.value === 'if'",
302
+ condition: "ifArgument.name && ifArgument.name.value === \"if\"",
303
303
  message: "Invalid argument for the @%s directive."
304
304
  },
305
305
 
306
306
  67: {
307
307
  file: "@apollo/client/utilities/graphql/directives.js",
308
- condition: "ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue')",
308
+ condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
309
309
  message: "Argument for the @%s directive must be a variable or a boolean value."
310
310
  },
311
311
 
@@ -313,7 +313,7 @@ export const errorCodes = // This file is used by the error message display webs
313
313
  file: "@apollo/client/utilities/graphql/fragments.js",
314
314
 
315
315
  message: "Found a %s operation%s. " +
316
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'
316
+ "No operations are allowed when using a fragment as a query. Only fragments are allowed."
317
317
  },
318
318
 
319
319
  69: {
@@ -330,7 +330,7 @@ export const errorCodes = // This file is used by the error message display webs
330
330
 
331
331
  71: {
332
332
  file: "@apollo/client/utilities/graphql/getFromAST.js",
333
- condition: "doc && doc.kind === 'Document'",
333
+ condition: "doc && doc.kind === \"Document\"",
334
334
  message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
335
335
  },
336
336
 
@@ -347,39 +347,39 @@ export const errorCodes = // This file is used by the error message display webs
347
347
 
348
348
  74: {
349
349
  file: "@apollo/client/utilities/graphql/getFromAST.js",
350
- condition: "queryDef && queryDef.operation === 'query'",
351
- message: 'Must contain a query definition.'
350
+ condition: "queryDef && queryDef.operation === \"query\"",
351
+ message: "Must contain a query definition."
352
352
  },
353
353
 
354
354
  75: {
355
355
  file: "@apollo/client/utilities/graphql/getFromAST.js",
356
- condition: "doc.kind === 'Document'",
356
+ condition: "doc.kind === \"Document\"",
357
357
  message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
358
358
  },
359
359
 
360
360
  76: {
361
361
  file: "@apollo/client/utilities/graphql/getFromAST.js",
362
362
  condition: "doc.definitions.length <= 1",
363
- message: 'Fragment must have exactly one definition.'
363
+ message: "Fragment must have exactly one definition."
364
364
  },
365
365
 
366
366
  77: {
367
367
  file: "@apollo/client/utilities/graphql/getFromAST.js",
368
- condition: "fragmentDef.kind === 'FragmentDefinition'",
369
- message: 'Must be a fragment definition.'
368
+ condition: "fragmentDef.kind === \"FragmentDefinition\"",
369
+ message: "Must be a fragment definition."
370
370
  },
371
371
 
372
372
  78: {
373
373
  file: "@apollo/client/utilities/graphql/getFromAST.js",
374
- message: 'Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'
374
+ message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
375
375
  },
376
376
 
377
377
  79: {
378
378
  file: "@apollo/client/utilities/graphql/storeUtils.js",
379
379
 
380
380
  message: "The inline argument \"%s\" of kind \"%s\"" +
381
- 'is not supported. Use variables instead of inline arguments to ' +
382
- 'overcome this limitation.'
381
+ "is not supported. Use variables instead of inline arguments to " +
382
+ "overcome this limitation."
383
383
  }
384
384
  };
385
385
 
@@ -476,8 +476,8 @@ export const devWarn = {
476
476
  81: {
477
477
  file: "@apollo/client/utilities/graphql/transform.js",
478
478
 
479
- message: 'Removing an @connection directive even though it does not have a key. ' +
480
- 'You may want to use the key parameter to specify a store key.'
479
+ message: "Removing an @connection directive even though it does not have a key. " +
480
+ "You may want to use the key parameter to specify a store key."
481
481
  }
482
482
  };
483
483
 
@@ -489,12 +489,12 @@ export const devError = {
489
489
 
490
490
  19: {
491
491
  file: "@apollo/client/core/ObservableQuery.js",
492
- message: 'Unhandled GraphQL subscription error'
492
+ message: "Unhandled GraphQL subscription error"
493
493
  },
494
494
 
495
495
  21: {
496
496
  file: "@apollo/client/core/ObservableQuery.js",
497
- message: 'Unhandled error'
497
+ message: "Unhandled error"
498
498
  },
499
499
 
500
500
  56: {
@@ -1 +1 @@
1
- {"version":3,"file":"invariantErrorCodes.js","sourceRoot":"","sources":["../src/invariantErrorCodes.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,IAAM,UAAU,GAAe,EAAE,CAAC;AACzC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC;AACvC,MAAM,CAAC,IAAM,MAAM,GAAe,EAAE,CAAC;AACrC,MAAM,CAAC,IAAM,OAAO,GAAe,EAAE,CAAC;AACtC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC","sourcesContent":["export interface ErrorCodes {\n [key: number]: { file: string, condition?: string, message?: string }\n}\n\nexport const errorCodes: ErrorCodes = {};\nexport const devDebug: ErrorCodes = {};\nexport const devLog: ErrorCodes = {};\nexport const devWarn: ErrorCodes = {};\nexport const devError: ErrorCodes = {};\n"]}
1
+ {"version":3,"file":"invariantErrorCodes.js","sourceRoot":"","sources":["../src/invariantErrorCodes.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,IAAM,UAAU,GAAe,EAAE,CAAC;AACzC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC;AACvC,MAAM,CAAC,IAAM,MAAM,GAAe,EAAE,CAAC;AACrC,MAAM,CAAC,IAAM,OAAO,GAAe,EAAE,CAAC;AACtC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC","sourcesContent":["export interface ErrorCodes {\n [key: number]: { file: string; condition?: string; message?: string };\n}\n\nexport const errorCodes: ErrorCodes = {};\nexport const devDebug: ErrorCodes = {};\nexport const devLog: ErrorCodes = {};\nexport const devWarn: ErrorCodes = {};\nexport const devError: ErrorCodes = {};\n"]}
@@ -15,7 +15,7 @@ var OperationBatcher = (function () {
15
15
  this.batchInterval = batchInterval;
16
16
  this.batchMax = batchMax || 0;
17
17
  this.batchHandler = batchHandler;
18
- this.batchKey = batchKey || (function () { return ''; });
18
+ this.batchKey = batchKey || (function () { return ""; });
19
19
  }
20
20
  OperationBatcher.prototype.enqueueRequest = function (request) {
21
21
  var _this = this;
@@ -25,7 +25,7 @@ var OperationBatcher = (function () {
25
25
  requestCopy.observable = new utilities.Observable(function (observer) {
26
26
  var batch = _this.batchesByKey.get(key);
27
27
  if (!batch)
28
- _this.batchesByKey.set(key, batch = new Set());
28
+ _this.batchesByKey.set(key, (batch = new Set()));
29
29
  var isFirstEnqueuedRequest = batch.size === 0;
30
30
  var isFirstSubscriber = requestCopy.subscribers.size === 0;
31
31
  requestCopy.subscribers.add(observer);
@@ -62,7 +62,7 @@ var OperationBatcher = (function () {
62
62
  return requestCopy.observable;
63
63
  };
64
64
  OperationBatcher.prototype.consumeQueue = function (key) {
65
- if (key === void 0) { key = ''; }
65
+ if (key === void 0) { key = ""; }
66
66
  var batch = this.batchesByKey.get(key);
67
67
  this.batchesByKey.delete(key);
68
68
  if (!batch || !batch.size) {
@@ -132,7 +132,7 @@ var BatchLink = (function (_super) {
132
132
  tslib.__extends(BatchLink, _super);
133
133
  function BatchLink(fetchParams) {
134
134
  var _this = _super.call(this) || this;
135
- var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ''; } : _e;
135
+ var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e;
136
136
  _this.batcher = new OperationBatcher({
137
137
  batchDebounce: batchDebounce,
138
138
  batchInterval: batchInterval,
@@ -1 +1 @@
1
- {"version":3,"file":"batch.cjs","sources":["batching.js","batchLink.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { Observable } from '../../utilities/index.js';\nvar OperationBatcher = (function () {\n function OperationBatcher(_a) {\n var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey;\n this.batchesByKey = new Map();\n this.scheduledBatchTimerByKey = new Map();\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (function () { return ''; });\n }\n OperationBatcher.prototype.enqueueRequest = function (request) {\n var _this = this;\n var requestCopy = __assign(__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() });\n var key = this.batchKey(request.operation);\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable(function (observer) {\n var batch = _this.batchesByKey.get(key);\n if (!batch)\n _this.batchesByKey.set(key, batch = new Set());\n var isFirstEnqueuedRequest = batch.size === 0;\n var isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n if (isFirstEnqueuedRequest || _this.batchDebounce) {\n _this.scheduleQueueConsumption(key);\n }\n if (batch.size === _this.batchMax) {\n _this.consumeQueue(key);\n }\n return function () {\n var _a;\n if (requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1) {\n if (batch.delete(requestCopy) && batch.size < 1) {\n _this.consumeQueue(key);\n (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();\n }\n }\n };\n });\n }\n return requestCopy.observable;\n };\n OperationBatcher.prototype.consumeQueue = function (key) {\n if (key === void 0) { key = ''; }\n var batch = this.batchesByKey.get(key);\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n return;\n }\n var operations = [];\n var forwards = [];\n var observables = [];\n var nexts = [];\n var errors = [];\n var completes = [];\n batch.forEach(function (request) {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n var batchedObservable = this.batchHandler(operations, forwards) || Observable.of();\n var onError = function (error) {\n errors.forEach(function (rejecters) {\n if (rejecters) {\n rejecters.forEach(function (e) { return e(error); });\n }\n });\n };\n batch.subscription = batchedObservable.subscribe({\n next: function (results) {\n if (!Array.isArray(results)) {\n results = [results];\n }\n if (nexts.length !== results.length) {\n var error = new Error(\"server returned results with length \".concat(results.length, \", expected length of \").concat(nexts.length));\n error.result = results;\n return onError(error);\n }\n results.forEach(function (result, index) {\n if (nexts[index]) {\n nexts[index].forEach(function (next) { return next(result); });\n }\n });\n },\n error: onError,\n complete: function () {\n completes.forEach(function (complete) {\n if (complete) {\n complete.forEach(function (c) { return c(); });\n }\n });\n },\n });\n return observables;\n };\n OperationBatcher.prototype.scheduleQueueConsumption = function (key) {\n var _this = this;\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(key, setTimeout(function () {\n _this.consumeQueue(key);\n _this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval));\n };\n return OperationBatcher;\n}());\nexport { OperationBatcher };\n//# sourceMappingURL=batching.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from '../core/index.js';\nimport { OperationBatcher } from './batching.js';\nexport { OperationBatcher } from './batching.js';\nvar BatchLink = (function (_super) {\n __extends(BatchLink, _super);\n function BatchLink(fetchParams) {\n var _this = _super.call(this) || this;\n var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ''; } : _e;\n _this.batcher = new OperationBatcher({\n batchDebounce: batchDebounce,\n batchInterval: batchInterval,\n batchMax: batchMax,\n batchHandler: batchHandler,\n batchKey: batchKey,\n });\n if (fetchParams.batchHandler.length <= 1) {\n _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); };\n }\n return _this;\n }\n BatchLink.prototype.request = function (operation, forward) {\n return this.batcher.enqueueRequest({\n operation: operation,\n forward: forward,\n });\n };\n return BatchLink;\n}(ApolloLink));\nexport { BatchLink };\n//# sourceMappingURL=batchLink.js.map"],"names":["__assign","Observable","__extends","ApolloLink"],"mappings":";;;;;;;;AAEG,IAAC,gBAAgB,IAAI,YAAY;AACpC,IAAI,SAAS,gBAAgB,CAAC,EAAE,EAAE;AAClC,QAAQ,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AAC/J,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AACtC,QAAQ,IAAI,CAAC,wBAAwB,GAAG,IAAI,GAAG,EAAE,CAAC;AAClD,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AAC3C,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AAC3C,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;AACtC,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACzC,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ,KAAK,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AACjE,KAAK;AACL,IAAI,gBAAgB,CAAC,SAAS,CAAC,cAAc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E,OAAO;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;;"}
1
+ {"version":3,"file":"batch.cjs","sources":["batching.js","batchLink.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { Observable } from \"../../utilities/index.js\";\nvar OperationBatcher = (function () {\n function OperationBatcher(_a) {\n var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey;\n this.batchesByKey = new Map();\n this.scheduledBatchTimerByKey = new Map();\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (function () { return \"\"; });\n }\n OperationBatcher.prototype.enqueueRequest = function (request) {\n var _this = this;\n var requestCopy = __assign(__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() });\n var key = this.batchKey(request.operation);\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable(function (observer) {\n var batch = _this.batchesByKey.get(key);\n if (!batch)\n _this.batchesByKey.set(key, (batch = new Set()));\n var isFirstEnqueuedRequest = batch.size === 0;\n var isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n if (isFirstEnqueuedRequest || _this.batchDebounce) {\n _this.scheduleQueueConsumption(key);\n }\n if (batch.size === _this.batchMax) {\n _this.consumeQueue(key);\n }\n return function () {\n var _a;\n if (requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1) {\n if (batch.delete(requestCopy) && batch.size < 1) {\n _this.consumeQueue(key);\n (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();\n }\n }\n };\n });\n }\n return requestCopy.observable;\n };\n OperationBatcher.prototype.consumeQueue = function (key) {\n if (key === void 0) { key = \"\"; }\n var batch = this.batchesByKey.get(key);\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n return;\n }\n var operations = [];\n var forwards = [];\n var observables = [];\n var nexts = [];\n var errors = [];\n var completes = [];\n batch.forEach(function (request) {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n var batchedObservable = this.batchHandler(operations, forwards) || Observable.of();\n var onError = function (error) {\n errors.forEach(function (rejecters) {\n if (rejecters) {\n rejecters.forEach(function (e) { return e(error); });\n }\n });\n };\n batch.subscription = batchedObservable.subscribe({\n next: function (results) {\n if (!Array.isArray(results)) {\n results = [results];\n }\n if (nexts.length !== results.length) {\n var error = new Error(\"server returned results with length \".concat(results.length, \", expected length of \").concat(nexts.length));\n error.result = results;\n return onError(error);\n }\n results.forEach(function (result, index) {\n if (nexts[index]) {\n nexts[index].forEach(function (next) { return next(result); });\n }\n });\n },\n error: onError,\n complete: function () {\n completes.forEach(function (complete) {\n if (complete) {\n complete.forEach(function (c) { return c(); });\n }\n });\n },\n });\n return observables;\n };\n OperationBatcher.prototype.scheduleQueueConsumption = function (key) {\n var _this = this;\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(key, setTimeout(function () {\n _this.consumeQueue(key);\n _this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval));\n };\n return OperationBatcher;\n}());\nexport { OperationBatcher };\n//# sourceMappingURL=batching.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { OperationBatcher } from \"./batching.js\";\nexport { OperationBatcher } from \"./batching.js\";\nvar BatchLink = (function (_super) {\n __extends(BatchLink, _super);\n function BatchLink(fetchParams) {\n var _this = _super.call(this) || this;\n var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return \"\"; } : _e;\n _this.batcher = new OperationBatcher({\n batchDebounce: batchDebounce,\n batchInterval: batchInterval,\n batchMax: batchMax,\n batchHandler: batchHandler,\n batchKey: batchKey,\n });\n if (fetchParams.batchHandler.length <= 1) {\n _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); };\n }\n return _this;\n }\n BatchLink.prototype.request = function (operation, forward) {\n return this.batcher.enqueueRequest({\n operation: operation,\n forward: forward,\n });\n };\n return BatchLink;\n}(ApolloLink));\nexport { BatchLink };\n//# sourceMappingURL=batchLink.js.map"],"names":["__assign","Observable","__extends","ApolloLink"],"mappings":";;;;;;;;AAEG,IAAC,gBAAgB,IAAI,YAAY;AACpC,IAAI,SAAS,gBAAgB,CAAC,EAAE,EAAE;AAClC,QAAQ,IAAI,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AAC/J,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AACtC,QAAQ,IAAI,CAAC,wBAAwB,GAAG,IAAI,GAAG,EAAE,CAAC;AAClD,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AAC3C,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AAC3C,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;AACtC,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACzC,QAAQ,IAAI,CAAC,QAAQ,GAAG,Q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EAAE;AAChE,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;AAC3C,YAAY,SAAS,EAAE,SAAS;AAChC,YAAY,OAAO,EAAE,OAAO;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;;"}
@@ -15,7 +15,7 @@ var OperationBatcher = (function () {
15
15
  this.batchInterval = batchInterval;
16
16
  this.batchMax = batchMax || 0;
17
17
  this.batchHandler = batchHandler;
18
- this.batchKey = batchKey || (function () { return ''; });
18
+ this.batchKey = batchKey || (function () { return ""; });
19
19
  }
20
20
  OperationBatcher.prototype.enqueueRequest = function (request) {
21
21
  var _this = this;
@@ -25,7 +25,7 @@ var OperationBatcher = (function () {
25
25
  requestCopy.observable = new utilities.Observable(function (observer) {
26
26
  var batch = _this.batchesByKey.get(key);
27
27
  if (!batch)
28
- _this.batchesByKey.set(key, batch = new Set());
28
+ _this.batchesByKey.set(key, (batch = new Set()));
29
29
  var isFirstEnqueuedRequest = batch.size === 0;
30
30
  var isFirstSubscriber = requestCopy.subscribers.size === 0;
31
31
  requestCopy.subscribers.add(observer);
@@ -62,7 +62,7 @@ var OperationBatcher = (function () {
62
62
  return requestCopy.observable;
63
63
  };
64
64
  OperationBatcher.prototype.consumeQueue = function (key) {
65
- if (key === void 0) { key = ''; }
65
+ if (key === void 0) { key = ""; }
66
66
  var batch = this.batchesByKey.get(key);
67
67
  this.batchesByKey.delete(key);
68
68
  if (!batch || !batch.size) {
@@ -132,7 +132,7 @@ var BatchLink = (function (_super) {
132
132
  tslib.__extends(BatchLink, _super);
133
133
  function BatchLink(fetchParams) {
134
134
  var _this = _super.call(this) || this;
135
- var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ''; } : _e;
135
+ var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e;
136
136
  _this.batcher = new OperationBatcher({
137
137
  batchDebounce: batchDebounce,
138
138
  batchInterval: batchInterval,
@@ -1,9 +1,9 @@
1
- import type { Operation, FetchResult, NextLink } from '../core/index.js';
2
- import { ApolloLink } from '../core/index.js';
3
- import type { Observable } from '../../utilities/index.js';
4
- import type { BatchHandler } from './batching.js';
5
- export type { BatchableRequest, BatchHandler } from './batching.js';
6
- export { OperationBatcher } from './batching.js';
1
+ import type { Operation, FetchResult, NextLink } from "../core/index.js";
2
+ import { ApolloLink } from "../core/index.js";
3
+ import type { Observable } from "../../utilities/index.js";
4
+ import type { BatchHandler } from "./batching.js";
5
+ export type { BatchableRequest, BatchHandler } from "./batching.js";
6
+ export { OperationBatcher } from "./batching.js";
7
7
  export declare namespace BatchLink {
8
8
  interface Options {
9
9
  batchInterval?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"batchLink.d.ts","sourceRoot":"","sources":["../../../src/link/batch/batchLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA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,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,OAAO,CAAmB;gBAEtB,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO;IAyBpC,OAAO,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,QAAQ,GACjB,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;CAMlC"}
@@ -1,12 +1,12 @@
1
1
  import { __extends } from "tslib";
2
- import { ApolloLink } from '../core/index.js';
3
- import { OperationBatcher } from './batching.js';
4
- export { OperationBatcher } from './batching.js';
2
+ import { ApolloLink } from "../core/index.js";
3
+ import { OperationBatcher } from "./batching.js";
4
+ export { OperationBatcher } from "./batching.js";
5
5
  var BatchLink = (function (_super) {
6
6
  __extends(BatchLink, _super);
7
7
  function BatchLink(fetchParams) {
8
8
  var _this = _super.call(this) || this;
9
- var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ''; } : _e;
9
+ var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e;
10
10
  _this.batcher = new OperationBatcher({
11
11
  batchDebounce: batchDebounce,
12
12
  batchInterval: batchInterval,
@@ -1 +1 @@
1
- {"version":3,"file":"batchLink.js","sourceRoot":"","sources":["../../../src/link/batch/batchLink.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsCjD;IAA+B,6BAAU;IAGvC,mBAAY,WAA+B;QAA3C,YACE,iBAAO,SAsBR;QApBO,IAAA,KAMF,WAAW,IAAI,EAAE,EALnB,aAAa,mBAAA,EACb,qBAAkB,EAAlB,aAAa,mBAAG,EAAE,KAAA,EAClB,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EACZ,oBAAyB,EAAzB,YAAY,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EACzB,gBAAmB,EAAnB,QAAQ,mBAAG,cAAM,OAAA,EAAE,EAAF,CAAE,KACA,CAAC;QAEtB,KAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC;YAClC,aAAa,eAAA;YACb,aAAa,eAAA;YACb,QAAQ,UAAA;YACR,YAAY,cAAA;YACZ,QAAQ,UAAA;SACT,CAAC,CAAC;QAGH,IAAI,WAAY,CAAC,YAAa,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1C,KAAI,CAAC,OAAO,GAAG,UAAA,SAAS,IAAI,OAAA,KAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,EAA1C,CAA0C,CAAC;SACxE;;IACH,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;YACjC,SAAS,WAAA;YACT,OAAO,SAAA;SACR,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AArCD,CAA+B,UAAU,GAqCxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from '../core/index.js';\nimport { ApolloLink } from '../core/index.js';\nimport type { Observable } from '../../utilities/index.js';\nimport type { BatchHandler } from './batching.js';\nimport { OperationBatcher } from './batching.js';\nexport type { BatchableRequest, BatchHandler } from './batching.js';\nexport { OperationBatcher } from './batching.js';\n\n\nexport namespace BatchLink {\n export interface Options {\n /**\n * The interval at which to batch, in milliseconds.\n *\n * Defaults to 10.\n */\n batchInterval?: number;\n\n /**\n * \"batchInterval\" is a throttling behavior by default, if you instead wish\n * to debounce outbound requests, set \"batchDebounce\" to true. More useful\n * for mutations than queries.\n */\n batchDebounce?: boolean;\n\n /**\n * The maximum number of operations to include in one fetch.\n *\n * Defaults to 0 (infinite operations within the interval).\n */\n batchMax?: number;\n\n /**\n * The handler that should execute a batch of operations.\n */\n batchHandler?: BatchHandler;\n\n /**\n * creates the key for a batch\n */\n batchKey?: (operation: Operation) => string;\n }\n}\n\nexport class BatchLink extends ApolloLink {\n private batcher: OperationBatcher;\n\n constructor(fetchParams?: BatchLink.Options) {\n super();\n\n const {\n batchDebounce,\n batchInterval = 10,\n batchMax = 0,\n batchHandler = () => null,\n batchKey = () => '',\n } = fetchParams || {};\n\n this.batcher = new OperationBatcher({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n });\n\n //make this link terminating\n if (fetchParams!.batchHandler!.length <= 1) {\n this.request = operation => this.batcher.enqueueRequest({ operation });\n }\n }\n\n public request(\n operation: Operation,\n forward?: NextLink,\n ): Observable<FetchResult> | null {\n return this.batcher.enqueueRequest({\n operation,\n forward,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"batchLink.js","sourceRoot":"","sources":["../../../src/link/batch/batchLink.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAqCjD;IAA+B,6BAAU;IAGvC,mBAAY,WAA+B;QAA3C,YACE,iBAAO,SAsBR;QApBO,IAAA,KAMF,WAAW,IAAI,EAAE,EALnB,aAAa,mBAAA,EACb,qBAAkB,EAAlB,aAAa,mBAAG,EAAE,KAAA,EAClB,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EACZ,oBAAyB,EAAzB,YAAY,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EACzB,gBAAmB,EAAnB,QAAQ,mBAAG,cAAM,OAAA,EAAE,EAAF,CAAE,KACA,CAAC;QAEtB,KAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC;YAClC,aAAa,eAAA;YACb,aAAa,eAAA;YACb,QAAQ,UAAA;YACR,YAAY,cAAA;YACZ,QAAQ,UAAA;SACT,CAAC,CAAC;QAGH,IAAI,WAAY,CAAC,YAAa,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1C,KAAI,CAAC,OAAO,GAAG,UAAC,SAAS,IAAK,OAAA,KAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,EAA1C,CAA0C,CAAC;SAC1E;;IACH,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;YACjC,SAAS,WAAA;YACT,OAAO,SAAA;SACR,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AArCD,CAA+B,UAAU,GAqCxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\nimport type { BatchHandler } from \"./batching.js\";\nimport { OperationBatcher } from \"./batching.js\";\nexport type { BatchableRequest, BatchHandler } from \"./batching.js\";\nexport { OperationBatcher } from \"./batching.js\";\n\nexport namespace BatchLink {\n export interface Options {\n /**\n * The interval at which to batch, in milliseconds.\n *\n * Defaults to 10.\n */\n batchInterval?: number;\n\n /**\n * \"batchInterval\" is a throttling behavior by default, if you instead wish\n * to debounce outbound requests, set \"batchDebounce\" to true. More useful\n * for mutations than queries.\n */\n batchDebounce?: boolean;\n\n /**\n * The maximum number of operations to include in one fetch.\n *\n * Defaults to 0 (infinite operations within the interval).\n */\n batchMax?: number;\n\n /**\n * The handler that should execute a batch of operations.\n */\n batchHandler?: BatchHandler;\n\n /**\n * creates the key for a batch\n */\n batchKey?: (operation: Operation) => string;\n }\n}\n\nexport class BatchLink extends ApolloLink {\n private batcher: OperationBatcher;\n\n constructor(fetchParams?: BatchLink.Options) {\n super();\n\n const {\n batchDebounce,\n batchInterval = 10,\n batchMax = 0,\n batchHandler = () => null,\n batchKey = () => \"\",\n } = fetchParams || {};\n\n this.batcher = new OperationBatcher({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n });\n\n //make this link terminating\n if (fetchParams!.batchHandler!.length <= 1) {\n this.request = (operation) => this.batcher.enqueueRequest({ operation });\n }\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable<FetchResult> | null {\n return this.batcher.enqueueRequest({\n operation,\n forward,\n });\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { FetchResult, NextLink, Operation } from '../core/index.js';
2
- import { Observable } from '../../utilities/index.js';
1
+ import type { FetchResult, NextLink, Operation } from "../core/index.js";
2
+ import { Observable } from "../../utilities/index.js";
3
3
  export type BatchHandler = (operations: Operation[], forward?: (NextLink | undefined)[]) => Observable<FetchResult[]> | null;
4
4
  export interface BatchableRequest {
5
5
  operation: Operation;
@@ -1 +1 @@
1
- {"version":3,"file":"batching.d.ts","sourceRoot":"","sources":["../../../src/link/batch/batching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,CACzB,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,CAAC,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,KAC/B,UAAU,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAA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;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAmBD,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,YAAY,CAAmC;IAEvD,OAAO,CAAC,wBAAwB,CAG5B;IACJ,OAAO,CAAC,aAAa,CAAC,CAAU;IAChC,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAmC;gBAEvC,EACV,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE;QACD,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,YAAY,CAAC;QAC3B,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC;KAC7C;IAQM,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,UAAU,CAAC,WAAW,CAAC;IAuElE,YAAY,CACjB,GAAG,GAAE,MAAW,GACf,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS;IA4EtD,OAAO,CAAC,wBAAwB;CAUjC"}
@@ -1,5 +1,5 @@
1
1
  import { __assign } from "tslib";
2
- import { Observable } from '../../utilities/index.js';
2
+ import { Observable } from "../../utilities/index.js";
3
3
  var OperationBatcher = (function () {
4
4
  function OperationBatcher(_a) {
5
5
  var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey;
@@ -9,7 +9,7 @@ var OperationBatcher = (function () {
9
9
  this.batchInterval = batchInterval;
10
10
  this.batchMax = batchMax || 0;
11
11
  this.batchHandler = batchHandler;
12
- this.batchKey = batchKey || (function () { return ''; });
12
+ this.batchKey = batchKey || (function () { return ""; });
13
13
  }
14
14
  OperationBatcher.prototype.enqueueRequest = function (request) {
15
15
  var _this = this;
@@ -19,7 +19,7 @@ var OperationBatcher = (function () {
19
19
  requestCopy.observable = new Observable(function (observer) {
20
20
  var batch = _this.batchesByKey.get(key);
21
21
  if (!batch)
22
- _this.batchesByKey.set(key, batch = new Set());
22
+ _this.batchesByKey.set(key, (batch = new Set()));
23
23
  var isFirstEnqueuedRequest = batch.size === 0;
24
24
  var isFirstSubscriber = requestCopy.subscribers.size === 0;
25
25
  requestCopy.subscribers.add(observer);
@@ -56,7 +56,7 @@ var OperationBatcher = (function () {
56
56
  return requestCopy.observable;
57
57
  };
58
58
  OperationBatcher.prototype.consumeQueue = function (key) {
59
- if (key === void 0) { key = ''; }
59
+ if (key === void 0) { key = ""; }
60
60
  var batch = this.batchesByKey.get(key);
61
61
  this.batchesByKey.delete(key);
62
62
  if (!batch || !batch.size) {
@@ -1 +1 @@
1
- {"version":3,"file":"batching.js","sourceRoot":"","sources":["../../../src/link/batch/batching.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA6BtD;IAaE,0BAAY,EAYX;YAXC,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,QAAQ,cAAA;QAhBF,iBAAY,GAAG,IAAI,GAAG,EAAwB,CAAC;QAE/C,6BAAwB,GAAG,IAAI,GAAG,EAAyC,CAAC;QAsBlF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,cAAM,OAAA,EAAE,EAAF,CAAE,CAAC,CAAC;IACzC,CAAC;IAEM,yCAAc,GAArB,UAAsB,OAAyB;QAA/C,iBAiEC;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CAAC,KAAK,CAAC,CAAC;iBACvB;gBAED,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM,EAAE,KAAK;oBAC5B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;wBAChB,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,EAAZ,CAAY,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YACD,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE;gBACR,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ;oBACxB,IAAI,QAAQ,EAAE;wBAEZ,QAAQ,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,EAAE,EAAH,CAAG,CAAC,CAAC;qBAC9B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,mDAAwB,GAAhC,UAAiC,GAAW;QAA5C,iBAMC;QALC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC;YAChD,KAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACvB,KAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1B,CAAC;IACH,uBAAC;AAAD,CAAC,AA7LD,IA6LC","sourcesContent":["import type { FetchResult, NextLink, Operation } from '../core/index.js';\nimport type { ObservableSubscription } from '../../utilities/index.js';\nimport { Observable } from '../../utilities/index.js';\n\nexport type BatchHandler = (\n operations: Operation[],\n forward?: (NextLink | undefined)[],\n) => Observable<FetchResult[]> | null;\n\nexport interface BatchableRequest {\n operation: Operation;\n forward?: NextLink;\n}\n\ntype QueuedRequest = BatchableRequest & {\n observable?: Observable<FetchResult>;\n next: Array<(result: FetchResult) => void>;\n error: Array<(error: Error) => void>;\n complete: Array<() => void>;\n subscribers: Set<object>;\n}\n\n// Batches are primarily a Set<QueuedRequest>, but may have other optional\n// properties, such as batch.subscription.\ntype RequestBatch = Set<QueuedRequest> & {\n subscription?: ObservableSubscription;\n}\n\n// QueryBatcher doesn't fire requests immediately. Requests that were enqueued within\n// a certain amount of time (configurable through `batchInterval`) will be batched together\n// into one query.\nexport class OperationBatcher {\n // Queue on which the QueryBatcher will operate on a per-tick basis.\n private batchesByKey = new Map<string, RequestBatch>();\n\n private scheduledBatchTimerByKey = new Map<string, ReturnType<typeof setTimeout>>();\n private batchDebounce?: boolean;\n private batchInterval?: number;\n private batchMax: number;\n\n //This function is called to the queries in the queue to the server.\n private batchHandler: BatchHandler;\n private batchKey: (operation: Operation) => string;\n\n constructor({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n }: {\n batchDebounce?: boolean;\n batchInterval?: number;\n batchMax?: number;\n batchHandler: BatchHandler;\n batchKey?: (operation: Operation) => string;\n }) {\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (() => '');\n }\n\n public enqueueRequest(request: BatchableRequest): Observable<FetchResult> {\n const requestCopy: QueuedRequest = {\n ...request,\n next: [],\n error: [],\n complete: [],\n subscribers: new Set(),\n };\n\n const key = this.batchKey(request.operation);\n\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable<FetchResult>(observer => {\n let batch = this.batchesByKey.get(key)!;\n if (!batch) this.batchesByKey.set(key, batch = new Set());\n\n // These booleans seem to me (@benjamn) like they might always be the\n // same (and thus we could do with only one of them), but I'm not 100%\n // sure about that.\n const isFirstEnqueuedRequest = batch.size === 0;\n const isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n\n // called for each subscriber, so need to save all listeners (next, error, complete)\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n\n // The first enqueued request triggers the queue consumption after `batchInterval` milliseconds.\n if (isFirstEnqueuedRequest || this.batchDebounce) {\n this.scheduleQueueConsumption(key);\n }\n\n // When amount of requests reaches `batchMax`, trigger the queue consumption without waiting on the `batchInterval`.\n if (batch.size === this.batchMax) {\n this.consumeQueue(key);\n }\n\n return () => {\n // If this is last subscriber for this request, remove request from queue\n if (requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1) {\n // If this is last request from queue, remove queue entirely\n if (batch.delete(requestCopy) && batch.size < 1) {\n this.consumeQueue(key);\n // If queue was in flight, cancel it\n batch.subscription?.unsubscribe();\n }\n }\n }\n });\n }\n\n return requestCopy.observable;\n }\n\n // Consumes the queue.\n // Returns a list of promises (one for each query).\n public consumeQueue(\n key: string = '',\n ): (Observable<FetchResult> | undefined)[] | undefined {\n const batch = this.batchesByKey.get(key);\n // Delete this batch and process it below.\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n // No requests to be processed.\n return;\n }\n\n const operations: QueuedRequest['operation'][] = [];\n const forwards: QueuedRequest['forward'][] = [];\n const observables: QueuedRequest['observable'][] = [];\n const nexts: QueuedRequest['next'][] = [];\n const errors: QueuedRequest['error'][] = [];\n const completes: QueuedRequest['complete'][] = [];\n\n // Even though batch is a Set, it preserves the order of first insertion\n // when iterating (per ECMAScript specification), so these requests will be\n // handled in the order they were enqueued (minus any deleted ones).\n batch.forEach(request => {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n\n const batchedObservable =\n this.batchHandler(operations, forwards) || Observable.of();\n\n const onError = (error: Error) => {\n //each callback list in batch\n errors.forEach(rejecters => {\n if (rejecters) {\n //each subscriber to request\n rejecters.forEach((e) => e(error));\n }\n });\n };\n\n batch.subscription = batchedObservable.subscribe({\n next: results => {\n if (!Array.isArray(results)) {\n results = [results];\n }\n\n if (nexts.length !== results.length) {\n const error = new Error(\n `server returned results with length ${\n results.length\n }, expected length of ${nexts.length}`,\n );\n (error as any).result = results;\n\n return onError(error);\n }\n\n results.forEach((result, index) => {\n if (nexts[index]) {\n nexts[index].forEach((next) => next(result));\n }\n });\n },\n error: onError,\n complete: () => {\n completes.forEach(complete => {\n if (complete) {\n //each subscriber to request\n complete.forEach((c) => c());\n }\n });\n },\n });\n\n return observables;\n }\n\n private scheduleQueueConsumption(key: string): void {\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(key, setTimeout(() => {\n this.consumeQueue(key);\n this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval));\n }\n}\n"]}
1
+ {"version":3,"file":"batching.js","sourceRoot":"","sources":["../../../src/link/batch/batching.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA6BtD;IAgBE,0BAAY,EAYX;YAXC,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,QAAQ,cAAA;QAnBF,iBAAY,GAAG,IAAI,GAAG,EAAwB,CAAC;QAE/C,6BAAwB,GAAG,IAAI,GAAG,EAGvC,CAAC;QAsBF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,cAAM,OAAA,EAAE,EAAF,CAAE,CAAC,CAAC;IACzC,CAAC;IAEM,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ACD,KAAa,CAAC,MAAM,GAAG,OAAO,CAAC;oBAEhC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;iBACvB;gBAED,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM,EAAE,KAAK;oBAC5B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;wBAChB,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,EAAZ,CAAY,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YACD,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE;gBACR,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;oBACzB,IAAI,QAAQ,EAAE;wBAEZ,QAAQ,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,EAAE,EAAH,CAAG,CAAC,CAAC;qBAC9B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,mDAAwB,GAAhC,UAAiC,GAAW;QAA5C,iBASC;QARC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAC/B,GAAG,EACH,UAAU,CAAC;YACT,KAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACvB,KAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CACvB,CAAC;IACJ,CAAC;IACH,uBAAC;AAAD,CAAC,AAnMD,IAmMC","sourcesContent":["import type { FetchResult, NextLink, Operation } from \"../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\n\nexport type BatchHandler = (\n operations: Operation[],\n forward?: (NextLink | undefined)[]\n) => Observable<FetchResult[]> | null;\n\nexport interface BatchableRequest {\n operation: Operation;\n forward?: NextLink;\n}\n\ntype QueuedRequest = BatchableRequest & {\n observable?: Observable<FetchResult>;\n next: Array<(result: FetchResult) => void>;\n error: Array<(error: Error) => void>;\n complete: Array<() => void>;\n subscribers: Set<object>;\n};\n\n// Batches are primarily a Set<QueuedRequest>, but may have other optional\n// properties, such as batch.subscription.\ntype RequestBatch = Set<QueuedRequest> & {\n subscription?: ObservableSubscription;\n};\n\n// QueryBatcher doesn't fire requests immediately. Requests that were enqueued within\n// a certain amount of time (configurable through `batchInterval`) will be batched together\n// into one query.\nexport class OperationBatcher {\n // Queue on which the QueryBatcher will operate on a per-tick basis.\n private batchesByKey = new Map<string, RequestBatch>();\n\n private scheduledBatchTimerByKey = new Map<\n string,\n ReturnType<typeof setTimeout>\n >();\n private batchDebounce?: boolean;\n private batchInterval?: number;\n private batchMax: number;\n\n //This function is called to the queries in the queue to the server.\n private batchHandler: BatchHandler;\n private batchKey: (operation: Operation) => string;\n\n constructor({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n }: {\n batchDebounce?: boolean;\n batchInterval?: number;\n batchMax?: number;\n batchHandler: BatchHandler;\n batchKey?: (operation: Operation) => string;\n }) {\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (() => \"\");\n }\n\n public enqueueRequest(request: BatchableRequest): Observable<FetchResult> {\n const requestCopy: QueuedRequest = {\n ...request,\n next: [],\n error: [],\n complete: [],\n subscribers: new Set(),\n };\n\n const key = this.batchKey(request.operation);\n\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable<FetchResult>((observer) => {\n let batch = this.batchesByKey.get(key)!;\n if (!batch) this.batchesByKey.set(key, (batch = new Set()));\n\n // These booleans seem to me (@benjamn) like they might always be the\n // same (and thus we could do with only one of them), but I'm not 100%\n // sure about that.\n const isFirstEnqueuedRequest = batch.size === 0;\n const isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n\n // called for each subscriber, so need to save all listeners (next, error, complete)\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n\n // The first enqueued request triggers the queue consumption after `batchInterval` milliseconds.\n if (isFirstEnqueuedRequest || this.batchDebounce) {\n this.scheduleQueueConsumption(key);\n }\n\n // When amount of requests reaches `batchMax`, trigger the queue consumption without waiting on the `batchInterval`.\n if (batch.size === this.batchMax) {\n this.consumeQueue(key);\n }\n\n return () => {\n // If this is last subscriber for this request, remove request from queue\n if (\n requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1\n ) {\n // If this is last request from queue, remove queue entirely\n if (batch.delete(requestCopy) && batch.size < 1) {\n this.consumeQueue(key);\n // If queue was in flight, cancel it\n batch.subscription?.unsubscribe();\n }\n }\n };\n });\n }\n\n return requestCopy.observable;\n }\n\n // Consumes the queue.\n // Returns a list of promises (one for each query).\n public consumeQueue(\n key: string = \"\"\n ): (Observable<FetchResult> | undefined)[] | undefined {\n const batch = this.batchesByKey.get(key);\n // Delete this batch and process it below.\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n // No requests to be processed.\n return;\n }\n\n const operations: QueuedRequest[\"operation\"][] = [];\n const forwards: QueuedRequest[\"forward\"][] = [];\n const observables: QueuedRequest[\"observable\"][] = [];\n const nexts: QueuedRequest[\"next\"][] = [];\n const errors: QueuedRequest[\"error\"][] = [];\n const completes: QueuedRequest[\"complete\"][] = [];\n\n // Even though batch is a Set, it preserves the order of first insertion\n // when iterating (per ECMAScript specification), so these requests will be\n // handled in the order they were enqueued (minus any deleted ones).\n batch.forEach((request) => {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n\n const batchedObservable =\n this.batchHandler(operations, forwards) || Observable.of();\n\n const onError = (error: Error) => {\n //each callback list in batch\n errors.forEach((rejecters) => {\n if (rejecters) {\n //each subscriber to request\n rejecters.forEach((e) => e(error));\n }\n });\n };\n\n batch.subscription = batchedObservable.subscribe({\n next: (results) => {\n if (!Array.isArray(results)) {\n results = [results];\n }\n\n if (nexts.length !== results.length) {\n const error = new Error(\n `server returned results with length ${results.length}, expected length of ${nexts.length}`\n );\n (error as any).result = results;\n\n return onError(error);\n }\n\n results.forEach((result, index) => {\n if (nexts[index]) {\n nexts[index].forEach((next) => next(result));\n }\n });\n },\n error: onError,\n complete: () => {\n completes.forEach((complete) => {\n if (complete) {\n //each subscriber to request\n complete.forEach((c) => c());\n }\n });\n },\n });\n\n return observables;\n }\n\n private scheduleQueueConsumption(key: string): void {\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(\n key,\n setTimeout(() => {\n this.consumeQueue(key);\n this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval)\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export * from './batchLink.js';
1
+ export * from "./batchLink.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './batchLink.js';
1
+ export * from "./batchLink.js";
2
2
  //# sourceMappingURL=index.js.map