@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":"Concast.js","sourceRoot":"","sources":["../../../src/utilities/observables/Concast.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAA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AG;YACvC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,IAAI,CAAC;gBACd,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAQH,cAAC;AAAD,CAAC,AAxND,CAAgC,UAAU,GAwNzC;;AASD,qBAAqB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import type { Observer, ObservableSubscription, Subscriber } from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\n\ntype MaybeAsync<T> = T | PromiseLike<T>;\n\nfunction isPromiseLike<T>(value: MaybeAsync<T>): value is PromiseLike<T> {\n return value && typeof (value as any).then === \"function\";\n}\n\n// Any individual Source<T> can be an Observable<T> or a promise for one.\ntype Source<T> = MaybeAsync<Observable<T>>;\n\nexport type ConcastSourcesIterable<T> = Iterable<Source<T>>;\nexport type ConcastSourcesArray<T> = Array<Source<T>>;\n\n// A Concast<T> observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast<T> is\n// similar to a BehaviorSubject<T>, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject<T>,\n// Concast<T> does not expose an Observer<T> interface (this.handlers is\n// intentionally private), since Concast<T> gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nexport class Concast<T> extends Observable<T> {\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n private observers = new Set<Observer<T>>();\n\n // This property starts off undefined to indicate the initial\n // subscription has not yet begun, then points to each source\n // subscription in turn, and finally becomes null after the sources have\n // been exhausted. After that, it stays null.\n private sub?: ObservableSubscription | null;\n\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>) {\n super(observer => {\n this.addObserver(observer);\n return () => this.removeObserver(observer);\n });\n\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n this.promise.catch(_ => {});\n\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n\n if (isPromiseLike(sources)) {\n sources.then(\n iterable => this.start(iterable),\n this.handlers.error,\n );\n } else {\n this.start(sources);\n }\n }\n\n // A consumable array of source observables, incrementally consumed each time\n // this.handlers.complete is called. This private field is not initialized\n // until the concast.start method is called, which can happen asynchronously\n // if a Promise is passed to the Concast constructor, so undefined is a\n // possible value for this.sources before concast.start is called.\n private sources: Source<T>[] | undefined;\n\n private start(sources: ConcastSourcesIterable<T>) {\n if (this.sub !== void 0) return;\n\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n }\n\n private deliverLastMessage(observer: Observer<T>) {\n if (this.latest) {\n const nextOrError = this.latest[0];\n const method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null &&\n nextOrError === \"next\" &&\n observer.complete) {\n observer.complete();\n }\n }\n }\n\n public addObserver(observer: Observer<T>) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n }\n }\n\n public removeObserver(observer: Observer<T>) {\n if (\n this.observers.delete(observer) &&\n this.observers.size < 1\n ) {\n // In case there are still any listeners in this.nextResultListeners, and\n // no error or completion has been broadcast yet, make sure those\n // observers have a chance to run and then remove themselves from\n // this.observers.\n this.handlers.complete();\n }\n }\n\n // Any Concast object can be trivially converted to a Promise, without\n // having to create a new wrapper Observable. This promise provides an\n // easy way to observe the final state of the Concast.\n private resolve: (result?: T | PromiseLike<T>) => void;\n private reject: (reason: any) => void;\n public readonly promise = new Promise<T>((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // Name and argument of the most recently invoked observer method, used\n // to deliver latest results immediately to new observers.\n private latest?: [\"next\", T] | [\"error\", any];\n\n // Bound handler functions that can be reused for every internal\n // subscription.\n private handlers = {\n next: (result: T) => {\n if (this.sub !== null) {\n this.latest = [\"next\", result];\n this.notify(\"next\", result);\n iterateObserversSafely(this.observers, \"next\", result);\n }\n },\n\n error: (error: any) => {\n const { sub } = this;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n this.latest = [\"error\", error];\n this.reject(error);\n this.notify(\"error\", error);\n iterateObserversSafely(this.observers, \"error\", error);\n }\n },\n\n complete: () => {\n const { sub, sources = [] } = this;\n if (sub !== null) {\n // If complete is called before concast.start, this.sources may be\n // undefined, so we use a default value of [] for sources. That works\n // here because it falls into the if (!value) {...} block, which\n // appropriately terminates the Concast, even if this.sources might\n // eventually have been initialized to a non-empty array.\n const value = sources.shift();\n if (!value) {\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n if (this.latest &&\n this.latest[0] === \"next\") {\n this.resolve(this.latest[1]);\n } else {\n this.resolve();\n }\n this.notify(\"complete\");\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(this.observers, \"complete\");\n } else if (isPromiseLike(value)) {\n value.then(obs => this.sub = obs.subscribe(this.handlers));\n } else {\n this.sub = value.subscribe(this.handlers);\n }\n }\n },\n };\n\n private nextResultListeners = new Set<NextResultListener>();\n\n private notify(\n method: Parameters<NextResultListener>[0],\n arg?: Parameters<NextResultListener>[1],\n ) {\n const { nextResultListeners } = this;\n if (nextResultListeners.size) {\n // Replacing this.nextResultListeners first ensures it does not grow while\n // we are iterating over it, potentially leading to infinite loops.\n this.nextResultListeners = new Set;\n nextResultListeners.forEach(listener => listener(method, arg));\n }\n }\n\n // We need a way to run callbacks just *before* the next result (or error or\n // completion) is delivered by this Concast, so we can be sure any code that\n // runs as a result of delivering that result/error observes the effects of\n // running the callback(s). It was tempting to reuse the Observer type instead\n // of introducing NextResultListener, but that messes with the sizing and\n // maintenance of this.observers, and ends up being more code overall.\n beforeNext(callback: NextResultListener) {\n let called = false;\n this.nextResultListeners.add((method, arg) => {\n if (!called) {\n called = true;\n callback(method, arg);\n }\n });\n }\n\n // A public way to abort observation and broadcast.\n public cancel = (reason: any) => {\n this.reject(reason);\n this.sources = [];\n this.handlers.complete();\n }\n}\n\ntype NextResultListener = (\n method: \"next\" | \"error\" | \"complete\",\n arg?: any,\n) => any;\n\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n"]}
1
+ {"version":3,"file":"Concast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,UAAW,QAA4B;QACrC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG;YACvC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,IAAI,CAAC;gBACd,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAQH,cAAC;AAAD,CAAC,AA/MD,CAAgC,UAAU,GA+MzC;;AASD,qBAAqB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import type {\n Observer,\n ObservableSubscription,\n Subscriber,\n} from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\n\ntype MaybeAsync<T> = T | PromiseLike<T>;\n\nfunction isPromiseLike<T>(value: MaybeAsync<T>): value is PromiseLike<T> {\n return value && typeof (value as any).then === \"function\";\n}\n\n// Any individual Source<T> can be an Observable<T> or a promise for one.\ntype Source<T> = MaybeAsync<Observable<T>>;\n\nexport type ConcastSourcesIterable<T> = Iterable<Source<T>>;\nexport type ConcastSourcesArray<T> = Array<Source<T>>;\n\n// A Concast<T> observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast<T> is\n// similar to a BehaviorSubject<T>, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject<T>,\n// Concast<T> does not expose an Observer<T> interface (this.handlers is\n// intentionally private), since Concast<T> gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nexport class Concast<T> extends Observable<T> {\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n private observers = new Set<Observer<T>>();\n\n // This property starts off undefined to indicate the initial\n // subscription has not yet begun, then points to each source\n // subscription in turn, and finally becomes null after the sources have\n // been exhausted. After that, it stays null.\n private sub?: ObservableSubscription | null;\n\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>) {\n super((observer) => {\n this.addObserver(observer);\n return () => this.removeObserver(observer);\n });\n\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n this.promise.catch((_) => {});\n\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n\n if (isPromiseLike(sources)) {\n sources.then((iterable) => this.start(iterable), this.handlers.error);\n } else {\n this.start(sources);\n }\n }\n\n // A consumable array of source observables, incrementally consumed each time\n // this.handlers.complete is called. This private field is not initialized\n // until the concast.start method is called, which can happen asynchronously\n // if a Promise is passed to the Concast constructor, so undefined is a\n // possible value for this.sources before concast.start is called.\n private sources: Source<T>[] | undefined;\n\n private start(sources: ConcastSourcesIterable<T>) {\n if (this.sub !== void 0) return;\n\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n }\n\n private deliverLastMessage(observer: Observer<T>) {\n if (this.latest) {\n const nextOrError = this.latest[0];\n const method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null && nextOrError === \"next\" && observer.complete) {\n observer.complete();\n }\n }\n }\n\n public addObserver(observer: Observer<T>) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n }\n }\n\n public removeObserver(observer: Observer<T>) {\n if (this.observers.delete(observer) && this.observers.size < 1) {\n // In case there are still any listeners in this.nextResultListeners, and\n // no error or completion has been broadcast yet, make sure those\n // observers have a chance to run and then remove themselves from\n // this.observers.\n this.handlers.complete();\n }\n }\n\n // Any Concast object can be trivially converted to a Promise, without\n // having to create a new wrapper Observable. This promise provides an\n // easy way to observe the final state of the Concast.\n private resolve: (result?: T | PromiseLike<T>) => void;\n private reject: (reason: any) => void;\n public readonly promise = new Promise<T>((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // Name and argument of the most recently invoked observer method, used\n // to deliver latest results immediately to new observers.\n private latest?: [\"next\", T] | [\"error\", any];\n\n // Bound handler functions that can be reused for every internal\n // subscription.\n private handlers = {\n next: (result: T) => {\n if (this.sub !== null) {\n this.latest = [\"next\", result];\n this.notify(\"next\", result);\n iterateObserversSafely(this.observers, \"next\", result);\n }\n },\n\n error: (error: any) => {\n const { sub } = this;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n this.latest = [\"error\", error];\n this.reject(error);\n this.notify(\"error\", error);\n iterateObserversSafely(this.observers, \"error\", error);\n }\n },\n\n complete: () => {\n const { sub, sources = [] } = this;\n if (sub !== null) {\n // If complete is called before concast.start, this.sources may be\n // undefined, so we use a default value of [] for sources. That works\n // here because it falls into the if (!value) {...} block, which\n // appropriately terminates the Concast, even if this.sources might\n // eventually have been initialized to a non-empty array.\n const value = sources.shift();\n if (!value) {\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n if (this.latest && this.latest[0] === \"next\") {\n this.resolve(this.latest[1]);\n } else {\n this.resolve();\n }\n this.notify(\"complete\");\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(this.observers, \"complete\");\n } else if (isPromiseLike(value)) {\n value.then((obs) => (this.sub = obs.subscribe(this.handlers)));\n } else {\n this.sub = value.subscribe(this.handlers);\n }\n }\n },\n };\n\n private nextResultListeners = new Set<NextResultListener>();\n\n private notify(\n method: Parameters<NextResultListener>[0],\n arg?: Parameters<NextResultListener>[1]\n ) {\n const { nextResultListeners } = this;\n if (nextResultListeners.size) {\n // Replacing this.nextResultListeners first ensures it does not grow while\n // we are iterating over it, potentially leading to infinite loops.\n this.nextResultListeners = new Set();\n nextResultListeners.forEach((listener) => listener(method, arg));\n }\n }\n\n // We need a way to run callbacks just *before* the next result (or error or\n // completion) is delivered by this Concast, so we can be sure any code that\n // runs as a result of delivering that result/error observes the effects of\n // running the callback(s). It was tempting to reuse the Observer type instead\n // of introducing NextResultListener, but that messes with the sizing and\n // maintenance of this.observers, and ends up being more code overall.\n beforeNext(callback: NextResultListener) {\n let called = false;\n this.nextResultListeners.add((method, arg) => {\n if (!called) {\n called = true;\n callback(method, arg);\n }\n });\n }\n\n // A public way to abort observation and broadcast.\n public cancel = (reason: any) => {\n this.reject(reason);\n this.sources = [];\n this.handlers.complete();\n };\n}\n\ntype NextResultListener = (\n method: \"next\" | \"error\" | \"complete\",\n arg?: any\n) => any;\n\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n"]}
@@ -1,6 +1,6 @@
1
- import type { Observer, Subscription as ObservableSubscription, Subscriber } from 'zen-observable-ts';
2
- import { Observable } from 'zen-observable-ts';
3
- import 'symbol-observable';
4
- export type { Observer, ObservableSubscription, Subscriber, };
1
+ import type { Observer, Subscription as ObservableSubscription, Subscriber } from "zen-observable-ts";
2
+ import { Observable } from "zen-observable-ts";
3
+ import "symbol-observable";
4
+ export type { Observer, ObservableSubscription, Subscriber };
5
5
  export { Observable };
6
6
  //# sourceMappingURL=Observable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Observable.d.ts","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,IAAI,sBAAsB,EACtC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EACL,UAAU,EACX,MAAM,mBAAmB,CAAC;AAI3B,OAAO,mBAAmB,CAAC;AAE3B,YAAY,EACV,QAAQ,EACR,sBAAsB,EACtB,UAAU,GACX,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"Observable.d.ts","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,IAAI,sBAAsB,EACtC,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,mBAAmB,CAAC;AAE3B,YAAY,EAAE,QAAQ,EAAE,sBAAsB,EAAE,UAAU,EAAE,CAAC;AAa7D,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,9 +1,11 @@
1
- import { Observable } from 'zen-observable-ts';
2
- import 'symbol-observable';
1
+ import { Observable } from "zen-observable-ts";
2
+ import "symbol-observable";
3
3
  var prototype = Observable.prototype;
4
- var fakeObsSymbol = '@@observable';
4
+ var fakeObsSymbol = "@@observable";
5
5
  if (!prototype[fakeObsSymbol]) {
6
- prototype[fakeObsSymbol] = function () { return this; };
6
+ prototype[fakeObsSymbol] = function () {
7
+ return this;
8
+ };
7
9
  }
8
10
  export { Observable };
9
11
  //# sourceMappingURL=Observable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACX,MAAM,mBAAmB,CAAC;AAI3B,OAAO,mBAAmB,CAAC;AAWnB,IAAA,SAAS,GAAK,UAAU,UAAf,CAAgB;AACjC,IAAM,aAAa,GAAG,cAAwC,CAAC;AAC/D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE;IAC7B,SAAS,CAAC,aAAa,CAAC,GAAG,cAAc,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;CACzD;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n Observer,\n Subscription as ObservableSubscription,\n Subscriber} from 'zen-observable-ts';\nimport {\n Observable\n} from 'zen-observable-ts';\n\n// This simplified polyfill attempts to follow the ECMAScript Observable\n// proposal (https://github.com/zenparsing/es-observable)\nimport 'symbol-observable';\n\nexport type {\n Observer,\n ObservableSubscription,\n Subscriber,\n};\n\n// The zen-observable package defines Observable.prototype[Symbol.observable]\n// when Symbol is supported, but RxJS interop depends on also setting this fake\n// '@@observable' string as a polyfill for Symbol.observable.\nconst { prototype } = Observable;\nconst fakeObsSymbol = '@@observable' as keyof typeof prototype;\nif (!prototype[fakeObsSymbol]) {\n prototype[fakeObsSymbol] = function () { return this; };\n}\n\nexport { Observable };\n"]}
1
+ {"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,mBAAmB,CAAC;AAOnB,IAAA,SAAS,GAAK,UAAU,UAAf,CAAgB;AACjC,IAAM,aAAa,GAAG,cAAwC,CAAC;AAC/D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE;IAC7B,SAAS,CAAC,aAAa,CAAC,GAAG;QACzB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;CACH;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n Observer,\n Subscription as ObservableSubscription,\n Subscriber,\n} from \"zen-observable-ts\";\nimport { Observable } from \"zen-observable-ts\";\n\n// This simplified polyfill attempts to follow the ECMAScript Observable\n// proposal (https://github.com/zenparsing/es-observable)\nimport \"symbol-observable\";\n\nexport type { Observer, ObservableSubscription, Subscriber };\n\n// The zen-observable package defines Observable.prototype[Symbol.observable]\n// when Symbol is supported, but RxJS interop depends on also setting this fake\n// '@@observable' string as a polyfill for Symbol.observable.\nconst { prototype } = Observable;\nconst fakeObsSymbol = \"@@observable\" as keyof typeof prototype;\nif (!prototype[fakeObsSymbol]) {\n prototype[fakeObsSymbol] = function () {\n return this;\n };\n}\n\nexport { Observable };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"asyncMap.d.ts","sourceRoot":"","sources":["../../../src/utilities/observables/asyncMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAC3C,UAAU,CAAC,CAAC,CAAC,CAyDf"}
1
+ {"version":3,"file":"asyncMap.d.ts","sourceRoot":"","sources":["../../../src/utilities/observables/asyncMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAC3C,UAAU,CAAC,CAAC,CAAC,CA4Df"}
@@ -14,7 +14,9 @@ export function asyncMap(observable, mapFn, catchFn) {
14
14
  return function (arg) {
15
15
  ++activeCallbackCount;
16
16
  var both = function () { return examiner(arg); };
17
- promiseQueue = promiseQueue.then(both, both).then(function (result) {
17
+ promiseQueue = promiseQueue
18
+ .then(both, both)
19
+ .then(function (result) {
18
20
  --activeCallbackCount;
19
21
  next && next.call(observer, result);
20
22
  if (completed) {
@@ -23,7 +25,8 @@ export function asyncMap(observable, mapFn, catchFn) {
23
25
  }, function (error) {
24
26
  --activeCallbackCount;
25
27
  throw error;
26
- }).catch(function (caught) {
28
+ })
29
+ .catch(function (caught) {
27
30
  error && error.call(observer, caught);
28
31
  });
29
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"asyncMap.js","sourceRoot":"","sources":["../../../src/utilities/observables/asyncMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,MAAM,UAAU,QAAQ,CACtB,UAAyB,EACzB,KAAuC,EACvC,OAA4C;IAE5C,OAAO,IAAI,UAAU,CAAI,UAAA,QAAQ;QACvB,IAAA,IAAI,GAAsB,QAAQ,KAA9B,EAAE,KAAK,GAAe,QAAQ,MAAvB,EAAE,QAAQ,GAAK,QAAQ,SAAb,CAAc;QAC3C,IAAI,mBAAmB,GAAG,CAAC,CAAC;QAC5B,IAAI,SAAS,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,GAAG,IAAI,CAAC;gBACjB,IAAI,CAAC,mBAAmB,EAAE;oBACxB,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACrC;YACH,CAAC;SACF,CAAC;QAEF,IAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,cAAM,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap<V, R>(\n observable: Observable<V>,\n mapFn: (value: V) => R | PromiseLike<R>,\n catchFn?: (error: any) => R | PromiseLike<R>,\n): Observable<R> {\n return new Observable<R>(observer => {\n const { next, error, complete } = observer;\n let activeCallbackCount = 0;\n let completed = false;\n let promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then(callback: () => any) {\n return new Promise(resolve => resolve(callback()));\n },\n } as Promise<void>;\n\n function makeCallback(\n examiner: typeof mapFn | typeof catchFn,\n delegate: typeof next | typeof error,\n ): (arg: any) => void {\n if (examiner) {\n return arg => {\n ++activeCallbackCount;\n const both = () => examiner(arg);\n promiseQueue = promiseQueue.then(both, both).then(\n result => {\n --activeCallbackCount;\n next && next.call(observer, result);\n if (completed) {\n handler.complete!();\n }\n },\n error => {\n --activeCallbackCount;\n throw error;\n },\n ).catch(caught => {\n error && error.call(observer, caught);\n });\n };\n } else {\n return arg => delegate && delegate.call(observer, arg);\n }\n }\n\n const handler: Observer<V> = {\n next: makeCallback(mapFn, next),\n error: makeCallback(catchFn, error),\n complete() {\n completed = true;\n if (!activeCallbackCount) {\n complete && complete.call(observer);\n }\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n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ACZ,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;oBACxC,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC;aACH;iBAAM;gBACL,OAAO,UAAC,GAAG,IAAK,OAAA,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAxC,CAAwC,CAAC;aAC1D;QACH,CAAC;QAED,IAAM,OAAO,GAAgB;YAC3B,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC;YAC/B,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;YACnC,QAAQ;gBACN,SAAS,GAAG,IAAI,CAAC;gBACjB,IAAI,CAAC,mBAAmB,EAAE;oBACxB,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACrC;YACH,CAAC;SACF,CAAC;QAEF,IAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,cAAM,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap<V, R>(\n observable: Observable<V>,\n mapFn: (value: V) => R | PromiseLike<R>,\n catchFn?: (error: any) => R | PromiseLike<R>\n): Observable<R> {\n return new Observable<R>((observer) => {\n const { next, error, complete } = observer;\n let activeCallbackCount = 0;\n let completed = false;\n let promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then(callback: () => any) {\n return new Promise((resolve) => resolve(callback()));\n },\n } as Promise<void>;\n\n function makeCallback(\n examiner: typeof mapFn | typeof catchFn,\n delegate: typeof next | typeof error\n ): (arg: any) => void {\n if (examiner) {\n return (arg) => {\n ++activeCallbackCount;\n const both = () => examiner(arg);\n promiseQueue = promiseQueue\n .then(both, both)\n .then(\n (result) => {\n --activeCallbackCount;\n next && next.call(observer, result);\n if (completed) {\n handler.complete!();\n }\n },\n (error) => {\n --activeCallbackCount;\n throw error;\n }\n )\n .catch((caught) => {\n error && error.call(observer, caught);\n });\n };\n } else {\n return (arg) => delegate && delegate.call(observer, arg);\n }\n }\n\n const handler: Observer<V> = {\n next: makeCallback(mapFn, next),\n error: makeCallback(catchFn, error),\n complete() {\n completed = true;\n if (!activeCallbackCount) {\n complete && complete.call(observer);\n }\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"iteration.js","sourceRoot":"","sources":["../../../src/utilities/observables/iteration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CACpC,SAA2B,EAC3B,MAAyB,EACzB,QAAY;IAKZ,IAAM,mBAAmB,GAAkB,EAAE,CAAC;IAC9C,SAAS,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAA5C,CAA4C,CAAC,CAAC;IACvE,mBAAmB,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAC,GAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAA9B,CAA8B,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\n\nexport function iterateObserversSafely<E, A>(\n observers: Set<Observer<E>>,\n method: keyof Observer<E>,\n argument?: A,\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer<E>[] = [];\n observers.forEach(obs => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach(obs => (obs as any)[method](argument));\n}\n"]}
1
+ {"version":3,"file":"iteration.js","sourceRoot":"","sources":["../../../src/utilities/observables/iteration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CACpC,SAA2B,EAC3B,MAAyB,EACzB,QAAY;IAKZ,IAAM,mBAAmB,GAAkB,EAAE,CAAC;IAC9C,SAAS,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAA5C,CAA4C,CAAC,CAAC;IACzE,mBAAmB,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAC,GAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAA9B,CAA8B,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\n\nexport function iterateObserversSafely<E, A>(\n observers: Set<Observer<E>>,\n method: keyof Observer<E>,\n argument?: A\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer<E>[] = [];\n observers.forEach((obs) => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach((obs) => (obs as any)[method](argument));\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { FieldPolicy, Reference } from '../../cache/index.js';
1
+ import type { FieldPolicy, Reference } from "../../cache/index.js";
2
2
  type KeyArgs = FieldPolicy<any>["keyArgs"];
3
3
  export declare function concatPagination<T = Reference>(keyArgs?: KeyArgs): FieldPolicy<T[]>;
4
4
  export declare function offsetLimitPagination<T = Reference>(keyArgs?: KeyArgs): FieldPolicy<T[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGnE,KAAK,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,SAA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cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,EAC5B,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAC7B,CAAC;AAKF,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,EACtE,OAAO,GAAE,OAAe,GACvB,gBAAgB,CAAC,KAAK,CAAC,CA6KzB"}
@@ -1,6 +1,6 @@
1
1
  import { __assign, __rest as __rest_1, __spreadArray } from "tslib";
2
2
  import { __rest } from "tslib";
3
- import { mergeDeep } from '../common/mergeDeep.js';
3
+ import { mergeDeep } from "../common/mergeDeep.js";
4
4
  export function concatPagination(keyArgs) {
5
5
  if (keyArgs === void 0) { keyArgs = false; }
6
6
  return {
@@ -66,12 +66,14 @@ export function relayStylePagination(keyArgs) {
66
66
  if (!incoming) {
67
67
  return existing;
68
68
  }
69
- var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) {
70
- if (isReference(edge = __assign({}, edge))) {
71
- edge.cursor = readField("cursor", edge);
72
- }
73
- return edge;
74
- }) : [];
69
+ var incomingEdges = incoming.edges
70
+ ? incoming.edges.map(function (edge) {
71
+ if (isReference((edge = __assign({}, edge)))) {
72
+ edge.cursor = readField("cursor", edge);
73
+ }
74
+ return edge;
75
+ })
76
+ : [];
75
77
  if (incoming.pageInfo) {
76
78
  var pageInfo_1 = incoming.pageInfo;
77
79
  var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor;
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,MAAM,UAAU,gBAAgB,CAC9B,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ;YACtB,OAAO,QAAQ,C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ChE;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAClB,IAAI,KAAK,CAAC,KAAK,WAAW;wBAAE,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;oBAC/D,IAAI,KAAK,CAAC,KAAK,SAAS;wBAAE,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;iBAC1D;aACF;YAED,sCACK,SAAS,CAAC,QAAQ,CAAC,GACnB,SAAS,CAAC,QAAQ,CAAC,KACtB,KAAK,OAAA,EACL,QAAQ,UAAA,IACR;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAGD,IAAM,SAAS,GAAG,UAAC,GAAwB,IAAK,OAAA,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAtB,CAAsB,CAAC;AACvE,IAAM,SAAS,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAExC,SAAS,aAAa;IACpB,OAAO;QACL,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { __rest } from \"tslib\";\n\nimport type { FieldPolicy, Reference } from '../../cache/index.js';\nimport { mergeDeep } from '../common/mergeDeep.js';\n\ntype KeyArgs = FieldPolicy<any>[\"keyArgs\"];\n\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination<T = Reference>(\n keyArgs: KeyArgs = false,\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming) {\n return existing ? [\n ...existing,\n ...incoming,\n ] : incoming;\n },\n };\n}\n\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination<T = Reference>(\n keyArgs: KeyArgs = false,\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming, { args }) {\n const merged = existing ? existing.slice(0) : [];\n\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n const { offset = 0 } = args;\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n } else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push.apply(merged, incoming);\n }\n }\n\n return merged;\n },\n };\n}\n\n// Whether TRelayEdge<TNode> is a normalized Reference or a non-normalized\n// object, it needs a .cursor property where the relayStylePagination\n// merge function can store cursor strings taken from pageInfo. Storing an\n// extra reference.cursor property should be safe, and is easier than\n// attempting to update the cursor field of the normalized StoreObject\n// that the reference refers to, or managing edge wrapper objects\n// (something I attempted in #7023, but abandoned because of #7088).\nexport type TRelayEdge<TNode> = {\n cursor?: string;\n node: TNode;\n} | (Reference & { cursor?: string });\n\nexport type TRelayPageInfo = {\n hasPreviousPage: boolean;\n hasNextPage: boolean;\n startCursor: string;\n endCursor: string;\n};\n\nexport type TExistingRelay<TNode> = Readonly<{\n edges: TRelayEdge<TNode>[];\n pageInfo: TRelayPageInfo;\n}>;\n\nexport type TIncomingRelay<TNode> = {\n edges?: TRelayEdge<TNode>[];\n pageInfo?: TRelayPageInfo;\n};\n\nexport type RelayFieldPolicy<TNode> = FieldPolicy<\n TExistingRelay<TNode> | null,\n TIncomingRelay<TNode> | null,\n TIncomingRelay<TNode> | null\n>;\n\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination<TNode extends Reference = Reference>(\n keyArgs: KeyArgs = false,\n): RelayFieldPolicy<TNode> {\n return {\n keyArgs,\n\n read(existing, { canRead, readField }) {\n if (!existing) return existing;\n\n const edges: TRelayEdge<TNode>[] = [];\n let firstEdgeCursor = \"\";\n let lastEdgeCursor = \"\";\n existing.edges.forEach(edge => {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\"\n }\n\n const {\n startCursor,\n endCursor,\n } = existing.pageInfo || {};\n\n return {\n // Some implementations return additional Connection fields, such\n // as existing.totalCount. These fields are saved by the merge\n // function, so the read function should also preserve them.\n ...getExtras(existing),\n edges,\n pageInfo: {\n ...existing.pageInfo,\n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor,\n endCursor: endCursor || lastEdgeCursor,\n },\n };\n },\n\n merge(existing, incoming, { args, isReference, readField }) {\n if (!existing) {\n existing = makeEmptyData();\n }\n\n if (!incoming) {\n return existing;\n }\n\n const incomingEdges = incoming.edges ? incoming.edges.map(edge => {\n if (isReference(edge = { ...edge })) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField<string>(\"cursor\", edge);\n }\n return edge;\n }) : [];\n\n if (incoming.pageInfo) {\n const { pageInfo } = incoming;\n const { startCursor, endCursor } = pageInfo;\n const firstEdge = incomingEdges[0];\n const lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n const firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n const lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n\n let prefix = existing.edges;\n let suffix: typeof prefix = [];\n\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n const index = prefix.findIndex(edge => edge.cursor === args.after);\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n } else if (args && args.before) {\n const index = prefix.findIndex(edge => edge.cursor === args.before);\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n } else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n\n const edges = [\n ...prefix,\n ...incomingEdges,\n ...suffix,\n ];\n\n const pageInfo: TRelayPageInfo = {\n // The ordering of these two ...spreads may be surprising, but it\n // makes sense because we want to combine PageInfo properties with a\n // preference for existing values, *unless* the existing values are\n // overridden by the logic below, which is permitted only when the\n // incoming page falls at the beginning or end of the data.\n ...incoming.pageInfo,\n ...existing.pageInfo,\n };\n\n if (incoming.pageInfo) {\n const {\n hasPreviousPage, hasNextPage,\n startCursor, endCursor,\n ...extras\n } = incoming.pageInfo;\n\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage) pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor) pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor) pageInfo.endCursor = endCursor;\n }\n }\n\n return {\n ...getExtras(existing),\n ...getExtras(incoming),\n edges,\n pageInfo,\n };\n },\n };\n}\n\n// Returns any unrecognized properties of the given object.\nconst getExtras = (obj: Record<string, any>) => __rest(obj, notExtras);\nconst notExtras = [\"edges\", \"pageInfo\"];\n\nfunction makeEmptyData(): TExistingRelay<any> {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n"]}
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,MAAM,UAAU,gBAAgB,CAC9B,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ;YACtB,OAAO,QAAQ,CAAC,CAAC,iCAAK,QAAQ,SAAK,QAAQ,QAAE,CAAC,CAAC,QAAQ,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,qBAAqB,CACnC,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ,EAAE,EAAQ;gBAAN,IAAI,UAAA;YAC9B,IAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAEjD,IAAI,QAAQ,EAAE;gBACZ,IAAI,IAAI,EAAE;oBAEA,IAAA,KAAe,IAAI,OAAT,EAAV,MAAM,mBAAG,C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;AACvE,IAAM,SAAS,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAExC,SAAS,aAAa;IACpB,OAAO;QACL,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { __rest } from \"tslib\";\n\nimport type { FieldPolicy, Reference } from \"../../cache/index.js\";\nimport { mergeDeep } from \"../common/mergeDeep.js\";\n\ntype KeyArgs = FieldPolicy<any>[\"keyArgs\"];\n\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming) {\n return existing ? [...existing, ...incoming] : incoming;\n },\n };\n}\n\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming, { args }) {\n const merged = existing ? existing.slice(0) : [];\n\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n const { offset = 0 } = args;\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n } else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push.apply(merged, incoming);\n }\n }\n\n return merged;\n },\n };\n}\n\n// Whether TRelayEdge<TNode> is a normalized Reference or a non-normalized\n// object, it needs a .cursor property where the relayStylePagination\n// merge function can store cursor strings taken from pageInfo. Storing an\n// extra reference.cursor property should be safe, and is easier than\n// attempting to update the cursor field of the normalized StoreObject\n// that the reference refers to, or managing edge wrapper objects\n// (something I attempted in #7023, but abandoned because of #7088).\nexport type TRelayEdge<TNode> =\n | {\n cursor?: string;\n node: TNode;\n }\n | (Reference & { cursor?: string });\n\nexport type TRelayPageInfo = {\n hasPreviousPage: boolean;\n hasNextPage: boolean;\n startCursor: string;\n endCursor: string;\n};\n\nexport type TExistingRelay<TNode> = Readonly<{\n edges: TRelayEdge<TNode>[];\n pageInfo: TRelayPageInfo;\n}>;\n\nexport type TIncomingRelay<TNode> = {\n edges?: TRelayEdge<TNode>[];\n pageInfo?: TRelayPageInfo;\n};\n\nexport type RelayFieldPolicy<TNode> = FieldPolicy<\n TExistingRelay<TNode> | null,\n TIncomingRelay<TNode> | null,\n TIncomingRelay<TNode> | null\n>;\n\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination<TNode extends Reference = Reference>(\n keyArgs: KeyArgs = false\n): RelayFieldPolicy<TNode> {\n return {\n keyArgs,\n\n read(existing, { canRead, readField }) {\n if (!existing) return existing;\n\n const edges: TRelayEdge<TNode>[] = [];\n let firstEdgeCursor = \"\";\n let lastEdgeCursor = \"\";\n existing.edges.forEach((edge) => {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\";\n }\n\n const { startCursor, endCursor } = existing.pageInfo || {};\n\n return {\n // Some implementations return additional Connection fields, such\n // as existing.totalCount. These fields are saved by the merge\n // function, so the read function should also preserve them.\n ...getExtras(existing),\n edges,\n pageInfo: {\n ...existing.pageInfo,\n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor,\n endCursor: endCursor || lastEdgeCursor,\n },\n };\n },\n\n merge(existing, incoming, { args, isReference, readField }) {\n if (!existing) {\n existing = makeEmptyData();\n }\n\n if (!incoming) {\n return existing;\n }\n\n const incomingEdges = incoming.edges\n ? incoming.edges.map((edge) => {\n if (isReference((edge = { ...edge }))) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField<string>(\"cursor\", edge);\n }\n return edge;\n })\n : [];\n\n if (incoming.pageInfo) {\n const { pageInfo } = incoming;\n const { startCursor, endCursor } = pageInfo;\n const firstEdge = incomingEdges[0];\n const lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n const firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n const lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n\n let prefix = existing.edges;\n let suffix: typeof prefix = [];\n\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n const index = prefix.findIndex((edge) => edge.cursor === args.after);\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n } else if (args && args.before) {\n const index = prefix.findIndex((edge) => edge.cursor === args.before);\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n } else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n\n const edges = [...prefix, ...incomingEdges, ...suffix];\n\n const pageInfo: TRelayPageInfo = {\n // The ordering of these two ...spreads may be surprising, but it\n // makes sense because we want to combine PageInfo properties with a\n // preference for existing values, *unless* the existing values are\n // overridden by the logic below, which is permitted only when the\n // incoming page falls at the beginning or end of the data.\n ...incoming.pageInfo,\n ...existing.pageInfo,\n };\n\n if (incoming.pageInfo) {\n const {\n hasPreviousPage,\n hasNextPage,\n startCursor,\n endCursor,\n ...extras\n } = incoming.pageInfo;\n\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage)\n pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor) pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor) pageInfo.endCursor = endCursor;\n }\n }\n\n return {\n ...getExtras(existing),\n ...getExtras(incoming),\n edges,\n pageInfo,\n };\n },\n };\n}\n\n// Returns any unrecognized properties of the given object.\nconst getExtras = (obj: Record<string, any>) => __rest(obj, notExtras);\nconst notExtras = [\"edges\", \"pageInfo\"];\n\nfunction makeEmptyData(): TExistingRelay<any> {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export type IsStrictlyAny<T> = UnionToIntersection<UnionForAny<T>> extends never ? true : false;
2
- type UnionForAny<T> = T extends never ? 'a' : 1;
3
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
2
+ type UnionForAny<T> = T extends never ? "a" : 1;
3
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
4
4
  export {};
5
5
  //# sourceMappingURL=IsStrictlyAny.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IsStrictlyAny.d.ts","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,CAAC,CAAC,IACzB,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAKnE,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;AAMhD,KAAK,mBAAmB,CAAC,CAAC,IACxB,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SACtC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA"}
1
+ {"version":3,"file":"IsStrictlyAny.d.ts","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAC5E,IAAI,GACJ,KAAK,CAAC;AAKV,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;AAMhD,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAC7E,CAAC,EAAE,MAAM,CAAC,KACP,IAAI,GACL,CAAC,GACD,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"IsStrictlyAny.js","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"","sourcesContent":["// Returns true if T is any, or false for any other type.\n// Inspired by https://stackoverflow.com/a/61625296/128454.\nexport type IsStrictlyAny<T> =\n UnionToIntersection<UnionForAny<T>> extends never ? true : false;\n\n// If (and only if) T is any, the union 'a' | 1 is returned here, representing\n// both branches of this conditional type. Only UnionForAny<any> produces this\n// union type; all other inputs produce the 1 literal type.\ntype UnionForAny<T> = T extends never ? 'a' : 1;\n\n// If that 'a' | 1 union is then passed to UnionToIntersection, the result\n// should be 'a' & 1, which TypeScript simplifies to the never type, since the\n// literal type 'a' and the literal type 1 are incompatible. More explanation of\n// this helper type: https://stackoverflow.com/a/50375286/62076.\ntype UnionToIntersection<U> =\n (U extends any ? (k: U) => void : never) extends\n ((k: infer I) => void) ? I : never\n"]}
1
+ {"version":3,"file":"IsStrictlyAny.js","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"","sourcesContent":["// Returns true if T is any, or false for any other type.\n// Inspired by https://stackoverflow.com/a/61625296/128454.\nexport type IsStrictlyAny<T> = UnionToIntersection<UnionForAny<T>> extends never\n ? true\n : false;\n\n// If (and only if) T is any, the union 'a' | 1 is returned here, representing\n// both branches of this conditional type. Only UnionForAny<any> produces this\n// union type; all other inputs produce the 1 literal type.\ntype UnionForAny<T> = T extends never ? \"a\" : 1;\n\n// If that 'a' | 1 union is then passed to UnionToIntersection, the result\n// should be 'a' & 1, which TypeScript simplifies to the never type, since the\n// literal type 'a' and the literal type 1 are incompatible. More explanation of\n// this helper type: https://stackoverflow.com/a/50375286/62076.\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I\n) => void\n ? I\n : never;\n"]}