@apollo/client 3.8.7 → 3.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (609) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +14 -0
  3. package/CHANGELOG.md +3357 -0
  4. package/apollo-client.cjs +314 -316
  5. package/apollo-client.cjs.map +1 -1
  6. package/apollo-client.min.cjs +1 -1
  7. package/cache/cache.cjs +133 -152
  8. package/cache/cache.cjs.map +1 -1
  9. package/cache/cache.cjs.native.js +133 -152
  10. package/cache/core/cache.d.ts +10 -0
  11. package/cache/core/cache.js +17 -5
  12. package/cache/core/cache.js.map +1 -1
  13. package/cache/core/types/Cache.d.ts +1 -1
  14. package/cache/core/types/Cache.js.map +1 -1
  15. package/cache/core/types/DataProxy.d.ts +92 -0
  16. package/cache/core/types/common.js +4 -1
  17. package/cache/core/types/common.js.map +1 -1
  18. package/cache/inmemory/entityStore.d.ts +1 -1
  19. package/cache/inmemory/entityStore.js +190 -29
  20. package/cache/inmemory/entityStore.js.map +1 -1
  21. package/cache/inmemory/fixPolyfills.js +9 -0
  22. package/cache/inmemory/fixPolyfills.js.map +1 -1
  23. package/cache/inmemory/fixPolyfills.native.js +12 -0
  24. package/cache/inmemory/fixPolyfills.native.js.map +1 -1
  25. package/cache/inmemory/fragmentRegistry.js +23 -12
  26. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  27. package/cache/inmemory/helpers.js +20 -11
  28. package/cache/inmemory/helpers.js.map +1 -1
  29. package/cache/inmemory/inMemoryCache.js +161 -8
  30. package/cache/inmemory/inMemoryCache.js.map +1 -1
  31. package/cache/inmemory/key-extractor.js +72 -4
  32. package/cache/inmemory/key-extractor.js.map +1 -1
  33. package/cache/inmemory/object-canon.js +91 -3
  34. package/cache/inmemory/object-canon.js.map +1 -1
  35. package/cache/inmemory/policies.js +193 -43
  36. package/cache/inmemory/policies.js.map +1 -1
  37. package/cache/inmemory/reactiveVars.js +20 -2
  38. package/cache/inmemory/reactiveVars.js.map +1 -1
  39. package/cache/inmemory/readFromStore.d.ts +4 -0
  40. package/cache/inmemory/readFromStore.js +54 -9
  41. package/cache/inmemory/readFromStore.js.map +1 -1
  42. package/cache/inmemory/types.d.ts +28 -0
  43. package/cache/inmemory/types.js.map +1 -1
  44. package/cache/inmemory/writeToStore.js +152 -25
  45. package/cache/inmemory/writeToStore.js.map +1 -1
  46. package/config/jest/setup.js +2 -0
  47. package/config/jest/setup.js.map +1 -1
  48. package/core/ApolloClient.d.ts +264 -3
  49. package/core/ApolloClient.js +235 -7
  50. package/core/ApolloClient.js.map +1 -1
  51. package/core/LocalState.d.ts +4 -6
  52. package/core/LocalState.js +56 -18
  53. package/core/LocalState.js.map +1 -1
  54. package/core/ObservableQuery.d.ts +25 -0
  55. package/core/ObservableQuery.js +239 -30
  56. package/core/ObservableQuery.js.map +1 -1
  57. package/core/QueryInfo.d.ts +3 -3
  58. package/core/QueryInfo.js +116 -13
  59. package/core/QueryInfo.js.map +1 -1
  60. package/core/QueryManager.d.ts +4 -0
  61. package/core/QueryManager.js +229 -33
  62. package/core/QueryManager.js.map +1 -1
  63. package/core/core.cjs +112 -103
  64. package/core/core.cjs.map +1 -1
  65. package/core/core.cjs.native.js +112 -103
  66. package/core/equalByQuery.js +20 -1
  67. package/core/equalByQuery.js.map +1 -1
  68. package/core/index.d.ts +1 -1
  69. package/core/index.js +19 -0
  70. package/core/index.js.map +1 -1
  71. package/core/networkStatus.d.ts +39 -0
  72. package/core/networkStatus.js +39 -0
  73. package/core/networkStatus.js.map +1 -1
  74. package/core/types.d.ts +9 -0
  75. package/core/types.js.map +1 -1
  76. package/core/watchQueryOptions.d.ts +225 -1
  77. package/core/watchQueryOptions.js.map +1 -1
  78. package/dev/dev.cjs +5 -111
  79. package/dev/dev.cjs.map +1 -1
  80. package/dev/dev.cjs.native.js +5 -111
  81. package/dev/loadErrorMessageHandler.js.map +1 -1
  82. package/errors/errors.cjs +1 -1
  83. package/errors/errors.cjs.map +1 -1
  84. package/errors/errors.cjs.native.js +1 -1
  85. package/errors/index.js +14 -1
  86. package/errors/index.js.map +1 -1
  87. package/invariantErrorCodes.js +1 -0
  88. package/link/batch/batch.cjs +2 -2
  89. package/link/batch/batch.cjs.map +1 -1
  90. package/link/batch/batch.cjs.native.js +2 -2
  91. package/link/batch/batchLink.d.ts +21 -0
  92. package/link/batch/batchLink.js +2 -1
  93. package/link/batch/batchLink.js.map +1 -1
  94. package/link/batch/batching.js +24 -1
  95. package/link/batch/batching.js.map +1 -1
  96. package/link/batch-http/batch-http.cjs +3 -2
  97. package/link/batch-http/batch-http.cjs.map +1 -1
  98. package/link/batch-http/batch-http.cjs.native.js +3 -2
  99. package/link/batch-http/batchHttpLink.d.ts +4 -0
  100. package/link/batch-http/batchHttpLink.js +53 -2
  101. package/link/batch-http/batchHttpLink.js.map +1 -1
  102. package/link/context/context.cjs.map +1 -1
  103. package/link/context/index.js +1 -0
  104. package/link/context/index.js.map +1 -1
  105. package/link/core/ApolloLink.js +12 -5
  106. package/link/core/ApolloLink.js.map +1 -1
  107. package/link/core/core.cjs +5 -5
  108. package/link/core/core.cjs.map +1 -1
  109. package/link/core/core.cjs.native.js +5 -5
  110. package/link/error/error.cjs +1 -1
  111. package/link/error/error.cjs.map +1 -1
  112. package/link/error/error.cjs.native.js +1 -1
  113. package/link/error/index.d.ts +3 -0
  114. package/link/error/index.js +4 -1
  115. package/link/error/index.js.map +1 -1
  116. package/link/http/HttpLink.d.ts +0 -2
  117. package/link/http/HttpLink.js +1 -1
  118. package/link/http/HttpLink.js.map +1 -1
  119. package/link/http/checkFetcher.js.map +1 -1
  120. package/link/http/createHttpLink.js +23 -1
  121. package/link/http/createHttpLink.js.map +1 -1
  122. package/link/http/createSignalIfSupported.d.ts +5 -0
  123. package/link/http/createSignalIfSupported.js +5 -0
  124. package/link/http/createSignalIfSupported.js.map +1 -1
  125. package/link/http/http.cjs +14 -12
  126. package/link/http/http.cjs.map +1 -1
  127. package/link/http/http.cjs.native.js +14 -12
  128. package/link/http/index.js +2 -1
  129. package/link/http/index.js.map +1 -1
  130. package/link/http/iterators/async.d.ts +4 -0
  131. package/link/http/iterators/async.js +4 -0
  132. package/link/http/iterators/async.js.map +1 -1
  133. package/link/http/iterators/nodeStream.d.ts +4 -0
  134. package/link/http/iterators/nodeStream.js +4 -0
  135. package/link/http/iterators/nodeStream.js.map +1 -1
  136. package/link/http/iterators/promise.d.ts +4 -0
  137. package/link/http/iterators/promise.js +4 -0
  138. package/link/http/iterators/promise.js.map +1 -1
  139. package/link/http/iterators/reader.d.ts +4 -0
  140. package/link/http/iterators/reader.js +4 -0
  141. package/link/http/iterators/reader.js.map +1 -1
  142. package/link/http/parseAndCheckHttpResponse.js +51 -10
  143. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  144. package/link/http/responseIterator.d.ts +4 -0
  145. package/link/http/responseIterator.js +6 -0
  146. package/link/http/responseIterator.js.map +1 -1
  147. package/link/http/rewriteURIForGET.d.ts +1 -1
  148. package/link/http/rewriteURIForGET.js +10 -0
  149. package/link/http/rewriteURIForGET.js.map +1 -1
  150. package/link/http/selectHttpOptionsAndBody.d.ts +45 -0
  151. package/link/http/selectHttpOptionsAndBody.js +23 -0
  152. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  153. package/link/http/selectURI.js.map +1 -1
  154. package/link/http/serializeFetchParameter.js.map +1 -1
  155. package/link/persisted-queries/index.js +34 -4
  156. package/link/persisted-queries/index.js.map +1 -1
  157. package/link/persisted-queries/persisted-queries.cjs +4 -4
  158. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  159. package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
  160. package/link/remove-typename/remove-typename.cjs +12 -9
  161. package/link/remove-typename/remove-typename.cjs.map +1 -1
  162. package/link/remove-typename/remove-typename.cjs.native.js +12 -9
  163. package/link/remove-typename/removeTypenameFromVariables.js +12 -9
  164. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  165. package/link/retry/delayFunction.d.ts +29 -0
  166. package/link/retry/delayFunction.js +6 -0
  167. package/link/retry/delayFunction.js.map +1 -1
  168. package/link/retry/retry.cjs +5 -5
  169. package/link/retry/retry.cjs.map +1 -1
  170. package/link/retry/retry.cjs.native.js +5 -5
  171. package/link/retry/retryFunction.d.ts +20 -0
  172. package/link/retry/retryLink.d.ts +6 -0
  173. package/link/retry/retryLink.js +31 -6
  174. package/link/retry/retryLink.js.map +1 -1
  175. package/link/schema/index.d.ts +13 -0
  176. package/link/schema/index.js +3 -3
  177. package/link/schema/index.js.map +1 -1
  178. package/link/schema/schema.cjs +3 -3
  179. package/link/schema/schema.cjs.map +1 -1
  180. package/link/schema/schema.cjs.native.js +3 -3
  181. package/link/subscriptions/index.js +35 -2
  182. package/link/subscriptions/index.js.map +1 -1
  183. package/link/subscriptions/subscriptions.cjs +3 -2
  184. package/link/subscriptions/subscriptions.cjs.map +1 -1
  185. package/link/subscriptions/subscriptions.cjs.native.js +3 -2
  186. package/link/utils/createOperation.js.map +1 -1
  187. package/link/utils/filterOperationVariables.js +4 -0
  188. package/link/utils/filterOperationVariables.js.map +1 -1
  189. package/link/utils/toPromise.js.map +1 -1
  190. package/link/utils/transformOperation.js +3 -2
  191. package/link/utils/transformOperation.js.map +1 -1
  192. package/link/utils/utils.cjs +2 -2
  193. package/link/utils/utils.cjs.map +1 -1
  194. package/link/utils/utils.cjs.native.js +2 -2
  195. package/link/utils/validateOperation.js.map +1 -1
  196. package/link/ws/index.d.ts +12 -0
  197. package/link/ws/index.js +1 -1
  198. package/link/ws/index.js.map +1 -1
  199. package/link/ws/ws.cjs +1 -1
  200. package/link/ws/ws.cjs.map +1 -1
  201. package/link/ws/ws.cjs.native.js +1 -1
  202. package/package.json +49 -38
  203. package/react/cache/QueryReference.d.ts +6 -1
  204. package/react/cache/QueryReference.js +26 -1
  205. package/react/cache/QueryReference.js.map +1 -1
  206. package/react/cache/SuspenseCache.d.ts +10 -0
  207. package/react/cache/SuspenseCache.js +1 -1
  208. package/react/cache/SuspenseCache.js.map +1 -1
  209. package/react/cache/getSuspenseCache.js.map +1 -1
  210. package/react/context/ApolloContext.d.ts +5 -0
  211. package/react/context/ApolloContext.js +10 -3
  212. package/react/context/ApolloContext.js.map +1 -1
  213. package/react/context/context.cjs +1 -3
  214. package/react/context/context.cjs.map +1 -1
  215. package/react/context/context.cjs.native.js +1 -3
  216. package/react/hoc/graphql.js.map +1 -1
  217. package/react/hoc/hoc-utils.js +3 -1
  218. package/react/hoc/hoc-utils.js.map +1 -1
  219. package/react/hoc/hoc.cjs +9 -17
  220. package/react/hoc/hoc.cjs.map +1 -1
  221. package/react/hoc/hoc.cjs.native.js +9 -17
  222. package/react/hoc/mutation-hoc.js +9 -4
  223. package/react/hoc/mutation-hoc.js.map +1 -1
  224. package/react/hoc/query-hoc.js +10 -4
  225. package/react/hoc/query-hoc.js.map +1 -1
  226. package/react/hoc/subscription-hoc.js +10 -4
  227. package/react/hoc/subscription-hoc.js.map +1 -1
  228. package/react/hoc/withApollo.js +3 -4
  229. package/react/hoc/withApollo.js.map +1 -1
  230. package/react/hooks/hooks.cjs +30 -22
  231. package/react/hooks/hooks.cjs.map +1 -1
  232. package/react/hooks/hooks.cjs.native.js +30 -22
  233. package/react/hooks/internal/__use.js +5 -0
  234. package/react/hooks/internal/__use.js.map +1 -1
  235. package/react/hooks/internal/index.js +1 -0
  236. package/react/hooks/internal/index.js.map +1 -1
  237. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  238. package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
  239. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  240. package/react/hooks/useBackgroundQuery.js +6 -0
  241. package/react/hooks/useBackgroundQuery.js.map +1 -1
  242. package/react/hooks/useFragment.js +4 -3
  243. package/react/hooks/useFragment.js.map +1 -1
  244. package/react/hooks/useLazyQuery.js +13 -4
  245. package/react/hooks/useLazyQuery.js.map +1 -1
  246. package/react/hooks/useMutation.js +8 -3
  247. package/react/hooks/useMutation.js.map +1 -1
  248. package/react/hooks/useQuery.d.ts +11 -0
  249. package/react/hooks/useQuery.js +137 -5
  250. package/react/hooks/useQuery.js.map +1 -1
  251. package/react/hooks/useReactiveVar.js +5 -0
  252. package/react/hooks/useReactiveVar.js.map +1 -1
  253. package/react/hooks/useReadQuery.d.ts +19 -0
  254. package/react/hooks/useReadQuery.js.map +1 -1
  255. package/react/hooks/useSubscription.js +5 -0
  256. package/react/hooks/useSubscription.js.map +1 -1
  257. package/react/hooks/useSuspenseQuery.js +11 -5
  258. package/react/hooks/useSuspenseQuery.js.map +1 -1
  259. package/react/hooks/useSyncExternalStore.js +53 -1
  260. package/react/hooks/useSyncExternalStore.js.map +1 -1
  261. package/react/parser/index.js +4 -5
  262. package/react/parser/index.js.map +1 -1
  263. package/react/parser/parser.cjs +2 -4
  264. package/react/parser/parser.cjs.map +1 -1
  265. package/react/parser/parser.cjs.native.js +2 -4
  266. package/react/ssr/RenderPromises.js +21 -1
  267. package/react/ssr/RenderPromises.js.map +1 -1
  268. package/react/ssr/getDataFromTree.js +18 -3
  269. package/react/ssr/getDataFromTree.js.map +1 -1
  270. package/react/ssr/ssr.cjs +6 -4
  271. package/react/ssr/ssr.cjs.map +1 -1
  272. package/react/ssr/ssr.cjs.native.js +6 -4
  273. package/react/types/types.d.ts +66 -0
  274. package/testing/core/core.cjs +14 -11
  275. package/testing/core/core.cjs.map +1 -1
  276. package/testing/core/core.cjs.native.js +14 -11
  277. package/testing/core/itAsync.d.ts +1 -1
  278. package/testing/core/itAsync.js.map +1 -1
  279. package/testing/core/mocking/mockFetch.d.ts +2 -2
  280. package/testing/core/mocking/mockFetch.js +8 -4
  281. package/testing/core/mocking/mockFetch.js.map +1 -1
  282. package/testing/core/mocking/mockLink.js +17 -7
  283. package/testing/core/mocking/mockLink.js.map +1 -1
  284. package/testing/core/mocking/mockQueryManager.js +2 -0
  285. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  286. package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
  287. package/testing/core/mocking/mockSubscriptionLink.js +1 -1
  288. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  289. package/testing/core/mocking/mockWatchQuery.js +1 -1
  290. package/testing/core/mocking/mockWatchQuery.js.map +1 -1
  291. package/testing/core/observableToPromise.d.ts +17 -3
  292. package/testing/core/observableToPromise.js +5 -0
  293. package/testing/core/observableToPromise.js.map +1 -1
  294. package/testing/core/subscribeAndCount.js +3 -0
  295. package/testing/core/subscribeAndCount.js.map +1 -1
  296. package/testing/core/wait.js +2 -2
  297. package/testing/core/wait.js.map +1 -1
  298. package/testing/core/withConsoleSpy.d.ts +3 -0
  299. package/testing/core/withConsoleSpy.js +7 -1
  300. package/testing/core/withConsoleSpy.js.map +1 -1
  301. package/testing/core/wrap.js +2 -0
  302. package/testing/core/wrap.js.map +1 -1
  303. package/testing/internal/ObservableStream.js +14 -14
  304. package/testing/internal/ObservableStream.js.map +1 -1
  305. package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
  306. package/testing/internal/disposables/spyOnConsole.js +2 -0
  307. package/testing/internal/disposables/spyOnConsole.js.map +1 -1
  308. package/testing/internal/disposables/withCleanup.d.ts +1 -0
  309. package/testing/internal/disposables/withCleanup.js +3 -0
  310. package/testing/internal/disposables/withCleanup.js.map +1 -1
  311. package/testing/internal/profile/Render.d.ts +28 -0
  312. package/testing/internal/profile/Render.js +12 -1
  313. package/testing/internal/profile/Render.js.map +1 -1
  314. package/testing/internal/profile/profile.d.ts +44 -7
  315. package/testing/internal/profile/profile.js +63 -51
  316. package/testing/internal/profile/profile.js.map +1 -1
  317. package/testing/internal/profile/traces.d.ts +4 -0
  318. package/testing/internal/profile/traces.js +9 -5
  319. package/testing/internal/profile/traces.js.map +1 -1
  320. package/testing/matchers/ProfiledComponent.js +27 -22
  321. package/testing/matchers/ProfiledComponent.js.map +1 -1
  322. package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
  323. package/testing/matchers/toMatchDocument.js.map +1 -1
  324. package/testing/react/MockedProvider.d.ts +4 -0
  325. package/testing/react/MockedProvider.js +6 -2
  326. package/testing/react/MockedProvider.js.map +1 -1
  327. package/testing/testing.cjs +4 -2
  328. package/testing/testing.cjs.map +1 -1
  329. package/testing/testing.cjs.native.js +4 -2
  330. package/utilities/common/arrays.js +1 -0
  331. package/utilities/common/arrays.js.map +1 -1
  332. package/utilities/common/canUse.js +16 -1
  333. package/utilities/common/canUse.js.map +1 -1
  334. package/utilities/common/cloneDeep.d.ts +3 -0
  335. package/utilities/common/cloneDeep.js +5 -0
  336. package/utilities/common/cloneDeep.js.map +1 -1
  337. package/utilities/common/compact.d.ts +4 -0
  338. package/utilities/common/compact.js +4 -0
  339. package/utilities/common/compact.js.map +1 -1
  340. package/utilities/common/errorHandling.js +1 -3
  341. package/utilities/common/errorHandling.js.map +1 -1
  342. package/utilities/common/incrementalResult.js +3 -0
  343. package/utilities/common/incrementalResult.js.map +1 -1
  344. package/utilities/common/makeUniqueId.js +2 -0
  345. package/utilities/common/makeUniqueId.js.map +1 -1
  346. package/utilities/common/maybeDeepFreeze.js +3 -0
  347. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  348. package/utilities/common/mergeDeep.js +12 -1
  349. package/utilities/common/mergeDeep.js.map +1 -1
  350. package/utilities/common/mergeOptions.d.ts +1 -1
  351. package/utilities/common/mergeOptions.js.map +1 -1
  352. package/utilities/common/omitDeep.js.map +1 -1
  353. package/utilities/globals/global.js +7 -1
  354. package/utilities/globals/global.js.map +1 -1
  355. package/utilities/globals/globals.cjs +4 -5
  356. package/utilities/globals/globals.cjs.map +1 -1
  357. package/utilities/globals/globals.cjs.native.js +4 -5
  358. package/utilities/globals/index.d.ts +4 -0
  359. package/utilities/globals/index.js +7 -0
  360. package/utilities/globals/index.js.map +1 -1
  361. package/utilities/globals/invariantWrappers.d.ts +40 -0
  362. package/utilities/globals/invariantWrappers.js +11 -3
  363. package/utilities/globals/invariantWrappers.js.map +1 -1
  364. package/utilities/globals/maybe.js.map +1 -1
  365. package/utilities/graphql/DocumentTransform.js +19 -6
  366. package/utilities/graphql/DocumentTransform.js.map +1 -1
  367. package/utilities/graphql/directives.js +3 -0
  368. package/utilities/graphql/directives.js.map +1 -1
  369. package/utilities/graphql/fragments.d.ts +25 -0
  370. package/utilities/graphql/fragments.js +36 -0
  371. package/utilities/graphql/fragments.js.map +1 -1
  372. package/utilities/graphql/getFromAST.d.ts +5 -0
  373. package/utilities/graphql/getFromAST.js +9 -0
  374. package/utilities/graphql/getFromAST.js.map +1 -1
  375. package/utilities/graphql/print.js.map +1 -1
  376. package/utilities/graphql/storeUtils.d.ts +14 -0
  377. package/utilities/graphql/storeUtils.js +7 -2
  378. package/utilities/graphql/storeUtils.js.map +1 -1
  379. package/utilities/graphql/transform.js +106 -7
  380. package/utilities/graphql/transform.js.map +1 -1
  381. package/utilities/observables/Concast.d.ts +1 -1
  382. package/utilities/observables/Concast.js +84 -1
  383. package/utilities/observables/Concast.js.map +1 -1
  384. package/utilities/observables/Observable.js +6 -0
  385. package/utilities/observables/Observable.js.map +1 -1
  386. package/utilities/observables/asyncMap.js +12 -3
  387. package/utilities/observables/asyncMap.js.map +1 -1
  388. package/utilities/observables/iteration.js +3 -0
  389. package/utilities/observables/iteration.js.map +1 -1
  390. package/utilities/observables/subclassing.js +14 -0
  391. package/utilities/observables/subclassing.js.map +1 -1
  392. package/utilities/policies/pagination.js +47 -3
  393. package/utilities/policies/pagination.js.map +1 -1
  394. package/utilities/promises/decoration.js +1 -0
  395. package/utilities/promises/decoration.js.map +1 -1
  396. package/utilities/types/DeepOmit.js.map +1 -1
  397. package/utilities/types/DeepPartial.d.ts +1 -1
  398. package/utilities/types/DeepPartial.js +4 -0
  399. package/utilities/types/DeepPartial.js.map +1 -1
  400. package/utilities/types/IsStrictlyAny.js.map +1 -1
  401. package/utilities/types/TODO.d.ts +3 -0
  402. package/utilities/types/TODO.js +2 -0
  403. package/utilities/types/TODO.js.map +1 -0
  404. package/utilities/utilities.cjs +31 -27
  405. package/utilities/utilities.cjs.map +1 -1
  406. package/utilities/utilities.cjs.native.js +31 -27
  407. package/version.js +1 -1
  408. package/cache/core/cache.d.ts.map +0 -1
  409. package/cache/core/types/Cache.d.ts.map +0 -1
  410. package/cache/core/types/DataProxy.d.ts.map +0 -1
  411. package/cache/core/types/common.d.ts.map +0 -1
  412. package/cache/index.d.ts.map +0 -1
  413. package/cache/inmemory/entityStore.d.ts.map +0 -1
  414. package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
  415. package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
  416. package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
  417. package/cache/inmemory/helpers.d.ts.map +0 -1
  418. package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
  419. package/cache/inmemory/key-extractor.d.ts.map +0 -1
  420. package/cache/inmemory/object-canon.d.ts.map +0 -1
  421. package/cache/inmemory/policies.d.ts.map +0 -1
  422. package/cache/inmemory/reactiveVars.d.ts.map +0 -1
  423. package/cache/inmemory/readFromStore.d.ts.map +0 -1
  424. package/cache/inmemory/types.d.ts.map +0 -1
  425. package/cache/inmemory/writeToStore.d.ts.map +0 -1
  426. package/config/jest/setup.d.ts.map +0 -1
  427. package/core/ApolloClient.d.ts.map +0 -1
  428. package/core/LocalState.d.ts.map +0 -1
  429. package/core/ObservableQuery.d.ts.map +0 -1
  430. package/core/QueryInfo.d.ts.map +0 -1
  431. package/core/QueryManager.d.ts.map +0 -1
  432. package/core/equalByQuery.d.ts.map +0 -1
  433. package/core/index.d.ts.map +0 -1
  434. package/core/networkStatus.d.ts.map +0 -1
  435. package/core/types.d.ts.map +0 -1
  436. package/core/watchQueryOptions.d.ts.map +0 -1
  437. package/dev/index.d.ts.map +0 -1
  438. package/dev/loadDevMessages.d.ts.map +0 -1
  439. package/dev/loadErrorMessageHandler.d.ts.map +0 -1
  440. package/dev/loadErrorMessages.d.ts.map +0 -1
  441. package/errors/index.d.ts.map +0 -1
  442. package/index.d.ts.map +0 -1
  443. package/invariantErrorCodes.d.ts.map +0 -1
  444. package/link/batch/batchLink.d.ts.map +0 -1
  445. package/link/batch/batching.d.ts.map +0 -1
  446. package/link/batch/index.d.ts.map +0 -1
  447. package/link/batch-http/batchHttpLink.d.ts.map +0 -1
  448. package/link/batch-http/index.d.ts.map +0 -1
  449. package/link/context/index.d.ts.map +0 -1
  450. package/link/core/ApolloLink.d.ts.map +0 -1
  451. package/link/core/concat.d.ts.map +0 -1
  452. package/link/core/empty.d.ts.map +0 -1
  453. package/link/core/execute.d.ts.map +0 -1
  454. package/link/core/from.d.ts.map +0 -1
  455. package/link/core/index.d.ts.map +0 -1
  456. package/link/core/split.d.ts.map +0 -1
  457. package/link/core/types.d.ts.map +0 -1
  458. package/link/error/index.d.ts.map +0 -1
  459. package/link/http/HttpLink.d.ts.map +0 -1
  460. package/link/http/checkFetcher.d.ts.map +0 -1
  461. package/link/http/createHttpLink.d.ts.map +0 -1
  462. package/link/http/createSignalIfSupported.d.ts.map +0 -1
  463. package/link/http/index.d.ts.map +0 -1
  464. package/link/http/iterators/async.d.ts.map +0 -1
  465. package/link/http/iterators/nodeStream.d.ts.map +0 -1
  466. package/link/http/iterators/promise.d.ts.map +0 -1
  467. package/link/http/iterators/reader.d.ts.map +0 -1
  468. package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
  469. package/link/http/responseIterator.d.ts.map +0 -1
  470. package/link/http/rewriteURIForGET.d.ts.map +0 -1
  471. package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
  472. package/link/http/selectURI.d.ts.map +0 -1
  473. package/link/http/serializeFetchParameter.d.ts.map +0 -1
  474. package/link/persisted-queries/index.d.ts.map +0 -1
  475. package/link/remove-typename/index.d.ts.map +0 -1
  476. package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
  477. package/link/retry/delayFunction.d.ts.map +0 -1
  478. package/link/retry/index.d.ts.map +0 -1
  479. package/link/retry/retryFunction.d.ts.map +0 -1
  480. package/link/retry/retryLink.d.ts.map +0 -1
  481. package/link/schema/index.d.ts.map +0 -1
  482. package/link/subscriptions/index.d.ts.map +0 -1
  483. package/link/utils/createOperation.d.ts.map +0 -1
  484. package/link/utils/filterOperationVariables.d.ts.map +0 -1
  485. package/link/utils/fromError.d.ts.map +0 -1
  486. package/link/utils/fromPromise.d.ts.map +0 -1
  487. package/link/utils/index.d.ts.map +0 -1
  488. package/link/utils/throwServerError.d.ts.map +0 -1
  489. package/link/utils/toPromise.d.ts.map +0 -1
  490. package/link/utils/transformOperation.d.ts.map +0 -1
  491. package/link/utils/validateOperation.d.ts.map +0 -1
  492. package/link/ws/index.d.ts.map +0 -1
  493. package/react/cache/QueryReference.d.ts.map +0 -1
  494. package/react/cache/SuspenseCache.d.ts.map +0 -1
  495. package/react/cache/getSuspenseCache.d.ts.map +0 -1
  496. package/react/cache/index.d.ts.map +0 -1
  497. package/react/cache/types.d.ts.map +0 -1
  498. package/react/components/Mutation.d.ts.map +0 -1
  499. package/react/components/Query.d.ts.map +0 -1
  500. package/react/components/Subscription.d.ts.map +0 -1
  501. package/react/components/index.d.ts.map +0 -1
  502. package/react/components/types.d.ts.map +0 -1
  503. package/react/context/ApolloConsumer.d.ts.map +0 -1
  504. package/react/context/ApolloContext.d.ts.map +0 -1
  505. package/react/context/ApolloProvider.d.ts.map +0 -1
  506. package/react/context/index.d.ts.map +0 -1
  507. package/react/hoc/graphql.d.ts.map +0 -1
  508. package/react/hoc/hoc-utils.d.ts.map +0 -1
  509. package/react/hoc/index.d.ts.map +0 -1
  510. package/react/hoc/mutation-hoc.d.ts.map +0 -1
  511. package/react/hoc/query-hoc.d.ts.map +0 -1
  512. package/react/hoc/subscription-hoc.d.ts.map +0 -1
  513. package/react/hoc/types.d.ts.map +0 -1
  514. package/react/hoc/withApollo.d.ts.map +0 -1
  515. package/react/hooks/constants.d.ts.map +0 -1
  516. package/react/hooks/index.d.ts.map +0 -1
  517. package/react/hooks/internal/__use.d.ts.map +0 -1
  518. package/react/hooks/internal/index.d.ts.map +0 -1
  519. package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
  520. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
  521. package/react/hooks/useApolloClient.d.ts.map +0 -1
  522. package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
  523. package/react/hooks/useFragment.d.ts.map +0 -1
  524. package/react/hooks/useLazyQuery.d.ts.map +0 -1
  525. package/react/hooks/useMutation.d.ts.map +0 -1
  526. package/react/hooks/useQuery.d.ts.map +0 -1
  527. package/react/hooks/useReactiveVar.d.ts.map +0 -1
  528. package/react/hooks/useReadQuery.d.ts.map +0 -1
  529. package/react/hooks/useSubscription.d.ts.map +0 -1
  530. package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
  531. package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
  532. package/react/index.d.ts.map +0 -1
  533. package/react/parser/index.d.ts.map +0 -1
  534. package/react/ssr/RenderPromises.d.ts.map +0 -1
  535. package/react/ssr/getDataFromTree.d.ts.map +0 -1
  536. package/react/ssr/index.d.ts.map +0 -1
  537. package/react/ssr/renderToStringWithData.d.ts.map +0 -1
  538. package/react/types/types.d.ts.map +0 -1
  539. package/testing/core/index.d.ts.map +0 -1
  540. package/testing/core/itAsync.d.ts.map +0 -1
  541. package/testing/core/mocking/mockClient.d.ts.map +0 -1
  542. package/testing/core/mocking/mockFetch.d.ts.map +0 -1
  543. package/testing/core/mocking/mockLink.d.ts.map +0 -1
  544. package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
  545. package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
  546. package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
  547. package/testing/core/observableToPromise.d.ts.map +0 -1
  548. package/testing/core/subscribeAndCount.d.ts.map +0 -1
  549. package/testing/core/wait.d.ts.map +0 -1
  550. package/testing/core/withConsoleSpy.d.ts.map +0 -1
  551. package/testing/core/wrap.d.ts.map +0 -1
  552. package/testing/index.d.ts.map +0 -1
  553. package/testing/internal/ObservableStream.d.ts.map +0 -1
  554. package/testing/internal/disposables/index.d.ts.map +0 -1
  555. package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
  556. package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
  557. package/testing/internal/index.d.ts.map +0 -1
  558. package/testing/internal/profile/Render.d.ts.map +0 -1
  559. package/testing/internal/profile/index.d.ts.map +0 -1
  560. package/testing/internal/profile/profile.d.ts.map +0 -1
  561. package/testing/internal/profile/traces.d.ts.map +0 -1
  562. package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
  563. package/testing/matchers/index.d.ts.map +0 -1
  564. package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
  565. package/testing/matchers/toMatchDocument.d.ts.map +0 -1
  566. package/testing/react/MockedProvider.d.ts.map +0 -1
  567. package/utilities/common/arrays.d.ts.map +0 -1
  568. package/utilities/common/canUse.d.ts.map +0 -1
  569. package/utilities/common/cloneDeep.d.ts.map +0 -1
  570. package/utilities/common/compact.d.ts.map +0 -1
  571. package/utilities/common/errorHandling.d.ts.map +0 -1
  572. package/utilities/common/filterInPlace.d.ts +0 -2
  573. package/utilities/common/filterInPlace.d.ts.map +0 -1
  574. package/utilities/common/filterInPlace.js +0 -11
  575. package/utilities/common/filterInPlace.js.map +0 -1
  576. package/utilities/common/incrementalResult.d.ts.map +0 -1
  577. package/utilities/common/makeUniqueId.d.ts.map +0 -1
  578. package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
  579. package/utilities/common/mergeDeep.d.ts.map +0 -1
  580. package/utilities/common/mergeOptions.d.ts.map +0 -1
  581. package/utilities/common/objects.d.ts.map +0 -1
  582. package/utilities/common/omitDeep.d.ts.map +0 -1
  583. package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
  584. package/utilities/common/stripTypename.d.ts.map +0 -1
  585. package/utilities/globals/global.d.ts.map +0 -1
  586. package/utilities/globals/index.d.ts.map +0 -1
  587. package/utilities/globals/invariantWrappers.d.ts.map +0 -1
  588. package/utilities/globals/maybe.d.ts.map +0 -1
  589. package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
  590. package/utilities/graphql/directives.d.ts.map +0 -1
  591. package/utilities/graphql/fragments.d.ts.map +0 -1
  592. package/utilities/graphql/getFromAST.d.ts.map +0 -1
  593. package/utilities/graphql/operations.d.ts.map +0 -1
  594. package/utilities/graphql/print.d.ts.map +0 -1
  595. package/utilities/graphql/storeUtils.d.ts.map +0 -1
  596. package/utilities/graphql/transform.d.ts.map +0 -1
  597. package/utilities/index.d.ts.map +0 -1
  598. package/utilities/observables/Concast.d.ts.map +0 -1
  599. package/utilities/observables/Observable.d.ts.map +0 -1
  600. package/utilities/observables/asyncMap.d.ts.map +0 -1
  601. package/utilities/observables/iteration.d.ts.map +0 -1
  602. package/utilities/observables/subclassing.d.ts.map +0 -1
  603. package/utilities/policies/pagination.d.ts.map +0 -1
  604. package/utilities/promises/decoration.d.ts.map +0 -1
  605. package/utilities/types/DeepOmit.d.ts.map +0 -1
  606. package/utilities/types/DeepPartial.d.ts.map +0 -1
  607. package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
  608. package/utilities/types/Primitive.d.ts.map +0 -1
  609. package/version.d.ts.map +0 -1
@@ -1,23 +1,24 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { WaitForRenderTimeoutError } from "../internal/index.js";
3
- export var toRerender = function (_profiled, options) {
3
+ export var toRerender = function (actual, options) {
4
4
  return __awaiter(this, void 0, void 0, function () {
5
- var profiled, hint, pass, e_1;
5
+ var _profiled, profiled, hint, pass, e_1;
6
6
  return __generator(this, function (_a) {
7
7
  switch (_a.label) {
8
8
  case 0:
9
- profiled = "ProfiledComponent" in _profiled
10
- ? _profiled.ProfiledComponent
9
+ _profiled = actual;
10
+ profiled = "ProfiledComponent" in _profiled ?
11
+ _profiled.ProfiledComponent
11
12
  : _profiled;
12
13
  hint = this.utils.matcherHint("toRerender");
13
14
  pass = true;
14
15
  _a.label = 1;
15
16
  case 1:
16
17
  _a.trys.push([1, 3, , 4]);
17
- return [4, profiled.peekRender(__assign({ timeout: 100 }, options))];
18
+ return [4 /*yield*/, profiled.peekRender(__assign({ timeout: 100 }, options))];
18
19
  case 2:
19
20
  _a.sent();
20
- return [3, 4];
21
+ return [3 /*break*/, 4];
21
22
  case 3:
22
23
  e_1 = _a.sent();
23
24
  if (e_1 instanceof WaitForRenderTimeoutError) {
@@ -26,8 +27,8 @@ export var toRerender = function (_profiled, options) {
26
27
  else {
27
28
  throw e_1;
28
29
  }
29
- return [3, 4];
30
- case 4: return [2, {
30
+ return [3 /*break*/, 4];
31
+ case 4: return [2 /*return*/, {
31
32
  pass: pass,
32
33
  message: function () {
33
34
  return (hint +
@@ -39,13 +40,15 @@ export var toRerender = function (_profiled, options) {
39
40
  });
40
41
  });
41
42
  };
43
+ /** to be thrown to "break" test execution and fail it */
42
44
  var failed = {};
43
- export var toRenderExactlyTimes = function (_profiled, times, optionsPerRender) {
45
+ export var toRenderExactlyTimes = function (actual, times, optionsPerRender) {
44
46
  return __awaiter(this, void 0, void 0, function () {
45
- var profiled, options, hint, pass, e_2, e_3, e_4;
47
+ var _profiled, profiled, options, hint, pass, e_2, e_3, e_4;
46
48
  return __generator(this, function (_a) {
47
49
  switch (_a.label) {
48
50
  case 0:
51
+ _profiled = actual;
49
52
  profiled = "ProfiledComponent" in _profiled ? _profiled.ProfiledComponent : _profiled;
50
53
  options = __assign({ timeout: 100 }, optionsPerRender);
51
54
  hint = this.utils.matcherHint("toRenderExactlyTimes");
@@ -53,7 +56,7 @@ export var toRenderExactlyTimes = function (_profiled, times, optionsPerRender)
53
56
  _a.label = 1;
54
57
  case 1:
55
58
  _a.trys.push([1, 11, , 12]);
56
- if (profiled.currentRenderCount() > times) {
59
+ if (profiled.totalRenderCount() > times) {
57
60
  throw failed;
58
61
  }
59
62
  _a.label = 2;
@@ -61,28 +64,30 @@ export var toRenderExactlyTimes = function (_profiled, times, optionsPerRender)
61
64
  _a.trys.push([2, 6, , 7]);
62
65
  _a.label = 3;
63
66
  case 3:
64
- if (!(profiled.currentRenderCount() < times)) return [3, 5];
65
- return [4, profiled.waitForNextRender(options)];
67
+ if (!(profiled.totalRenderCount() < times)) return [3 /*break*/, 5];
68
+ return [4 /*yield*/, profiled.waitForNextRender(options)];
66
69
  case 4:
67
70
  _a.sent();
68
- return [3, 3];
69
- case 5: return [3, 7];
71
+ return [3 /*break*/, 3];
72
+ case 5: return [3 /*break*/, 7];
70
73
  case 6:
71
74
  e_2 = _a.sent();
75
+ // timeouts here should just fail the test, rethrow other errors
72
76
  throw e_2 instanceof WaitForRenderTimeoutError ? failed : e_2;
73
77
  case 7:
74
78
  _a.trys.push([7, 9, , 10]);
75
- return [4, profiled.waitForNextRender(options)];
79
+ return [4 /*yield*/, profiled.waitForNextRender(options)];
76
80
  case 8:
77
81
  _a.sent();
78
- return [3, 10];
82
+ return [3 /*break*/, 10];
79
83
  case 9:
80
84
  e_3 = _a.sent();
85
+ // we are expecting a timeout here, so swallow that error, rethrow others
81
86
  if (!(e_3 instanceof WaitForRenderTimeoutError)) {
82
87
  throw e_3;
83
88
  }
84
- return [3, 10];
85
- case 10: return [3, 12];
89
+ return [3 /*break*/, 10];
90
+ case 10: return [3 /*break*/, 12];
86
91
  case 11:
87
92
  e_4 = _a.sent();
88
93
  if (e_4 === failed) {
@@ -91,13 +96,13 @@ export var toRenderExactlyTimes = function (_profiled, times, optionsPerRender)
91
96
  else {
92
97
  throw e_4;
93
98
  }
94
- return [3, 12];
95
- case 12: return [2, {
99
+ return [3 /*break*/, 12];
100
+ case 12: return [2 /*return*/, {
96
101
  pass: pass,
97
102
  message: function () {
98
103
  return (hint +
99
104
  " Expected component to".concat(pass ? " not" : "", " render exactly ").concat(times, ".") +
100
- " It rendered ".concat(profiled.currentRenderCount(), " times."));
105
+ " It rendered ".concat(profiled.totalRenderCount(), " times."));
101
106
  },
102
107
  }];
103
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProfiledComponent.js","sourceRoot":"","sources":["../../../src/testing/matchers/ProfiledComponent.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAMjE,MAAM,CAAC,IAAM,UAAU,GACrB,UACE,SAA+D,EAC/D,OAA2B;;;;;;oBAErB,QAAQ,GACZ,mBAAmB,IAAI,SAAS;wBAC9B,CAAC,CAAC,SAAS,CAAC,iBAAiB;wBAC7B,CAAC,CAAC,SAAS,CAAC;oBACV,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;oBAC9C,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,WAAM,QAAQ,CAAC,UAAU,YAAG,OAAO,EAAE,GAAG,IAAK,OAAO,EAAG,EAAA;;oBAAvD,SAAuD,CAAC;;;;oBAExD,IAAI,GAAC,YAAY,yBAAyB,EAAE;wBAC1C,IAAI,GAAG,KAAK,CAAC;qBACd;yBAAM;wBACL,MAAM,GAAC,CAAC;qBACT;;wBAEH,WAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAa;gCACxD,oBAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAG,CACnC,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC;AAGJ,IAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,CAAC,IAAM,oBAAoB,GAE7B,UACF,SAA+D,EAC/D,KAAa,EACb,gBAAoC;;;;;;oBAE9B,QAAQ,GACZ,mBAAmB,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;oBACvE,OAAO,cAAK,OAAO,EAAE,GAAG,IAAK,gBAAgB,CAAE,CAAC;oBAChD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBACxD,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,IAAI,QAAQ,CAAC,kBAAkB,EAAE,GAAG,KAAK,EAAE;wBACzC,MAAM,MAAM,CAAC;qBACd;;;;;;yBAEQ,CAAA,QAAQ,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAA;oBAC1C,WAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;;oBAI5C,MAAM,GAAC,YAAY,yBAAyB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAC,CAAC;;;oBAG1D,WAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;oBAG1C,IAAI,CAAC,CAAC,GAAC,YAAY,yBAAyB,CAAC,EAAE;wBAC7C,MAAM,GAAC,CAAC;qBACT;;;;;oBAGH,IAAI,GAAC,KAAK,MAAM,EAAE;wBAChB,IAAI,GAAG,KAAK,CAAC;qBACd;yBAAM;wBACL,MAAM,GAAC,CAAC;qBACT;;yBAEH,WAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,6BAAmB,KAAK,MAAG;gCACtE,uBAAgB,QAAQ,CAAC,kBAAkB,EAAE,YAAS,CACvD,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport { WaitForRenderTimeoutError } from \"../internal/index.js\";\nimport type {\n NextRenderOptions,\n ProfiledComponent,\n ProfiledHook,\n} from \"../internal/index.js\";\nexport const toRerender: MatcherFunction<[options?: NextRenderOptions]> =\n async function (\n _profiled: ProfiledComponent<any, any> | ProfiledHook<any, any>,\n options?: NextRenderOptions\n ) {\n const profiled =\n \"ProfiledComponent\" in _profiled\n ? _profiled.ProfiledComponent\n : _profiled;\n const hint = this.utils.matcherHint(\"toRerender\");\n let pass = true;\n try {\n await profiled.peekRender({ timeout: 100, ...options });\n } catch (e) {\n if (e instanceof WaitForRenderTimeoutError) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} rerender, ` +\n `but it did${pass ? \"\" : \" not\"}.`\n );\n },\n };\n };\n\n/** to be thrown to \"break\" test execution and fail it */\nconst failed = {};\n\nexport const toRenderExactlyTimes: MatcherFunction<\n [times: number, options?: NextRenderOptions]\n> = async function (\n _profiled: ProfiledComponent<any, any> | ProfiledHook<any, any>,\n times: number,\n optionsPerRender?: NextRenderOptions\n) {\n const profiled =\n \"ProfiledComponent\" in _profiled ? _profiled.ProfiledComponent : _profiled;\n const options = { timeout: 100, ...optionsPerRender };\n const hint = this.utils.matcherHint(\"toRenderExactlyTimes\");\n let pass = true;\n try {\n if (profiled.currentRenderCount() > times) {\n throw failed;\n }\n try {\n while (profiled.currentRenderCount() < times) {\n await profiled.waitForNextRender(options);\n }\n } catch (e) {\n // timeouts here should just fail the test, rethrow other errors\n throw e instanceof WaitForRenderTimeoutError ? failed : e;\n }\n try {\n await profiled.waitForNextRender(options);\n } catch (e) {\n // we are expecting a timeout here, so swallow that error, rethrow others\n if (!(e instanceof WaitForRenderTimeoutError)) {\n throw e;\n }\n }\n } catch (e) {\n if (e === failed) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} render exactly ${times}.` +\n ` It rendered ${profiled.currentRenderCount()} times.`\n );\n },\n };\n};\n"]}
1
+ {"version":3,"file":"ProfiledComponent.js","sourceRoot":"","sources":["../../../src/testing/matchers/ProfiledComponent.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAMjE,MAAM,CAAC,IAAM,UAAU,GACrB,UAAgB,MAAM,EAAE,OAAO;;;;;;oBACvB,SAAS,GAAG,MAEQ,CAAC;oBACrB,QAAQ,GACZ,mBAAmB,IAAI,SAAS,CAAC,CAAC;wBAChC,SAAS,CAAC,iBAAiB;wBAC7B,CAAC,CAAC,SAAS,CAAC;oBACR,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;oBAC9C,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,qBAAM,QAAQ,CAAC,UAAU,YAAG,OAAO,EAAE,GAAG,IAAK,OAAO,EAAG,EAAA;;oBAAvD,SAAuD,CAAC;;;;oBAExD,IAAI,GAAC,YAAY,yBAAyB,EAAE,CAAC;wBAC3C,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;wBAEH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAa;gCACxD,oBAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAG,CACnC,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC;AAEJ,yDAAyD;AACzD,IAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,CAAC,IAAM,oBAAoB,GAE7B,UAAgB,MAAM,EAAE,KAAK,EAAE,gBAAgB;;;;;;oBAC3C,SAAS,GAAG,MAEQ,CAAC;oBACrB,QAAQ,GACZ,mBAAmB,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;oBACvE,OAAO,cAAK,OAAO,EAAE,GAAG,IAAK,gBAAgB,CAAE,CAAC;oBAChD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBACxD,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,IAAI,QAAQ,CAAC,gBAAgB,EAAE,GAAG,KAAK,EAAE,CAAC;wBACxC,MAAM,MAAM,CAAC;oBACf,CAAC;;;;;;yBAEQ,CAAA,QAAQ,CAAC,gBAAgB,EAAE,GAAG,KAAK,CAAA;oBACxC,qBAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;;oBAG5C,gEAAgE;oBAChE,MAAM,GAAC,YAAY,yBAAyB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAC,CAAC;;;oBAG1D,qBAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;;;;oBAE1C,yEAAyE;oBACzE,IAAI,CAAC,CAAC,GAAC,YAAY,yBAAyB,CAAC,EAAE,CAAC;wBAC9C,MAAM,GAAC,CAAC;oBACV,CAAC;;;;;oBAGH,IAAI,GAAC,KAAK,MAAM,EAAE,CAAC;wBACjB,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;yBAEH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,6BAAmB,KAAK,MAAG;gCACtE,uBAAgB,QAAQ,CAAC,gBAAgB,EAAE,YAAS,CACrD,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport { WaitForRenderTimeoutError } from \"../internal/index.js\";\nimport type {\n NextRenderOptions,\n ProfiledComponent,\n ProfiledHook,\n} from \"../internal/index.js\";\nexport const toRerender: MatcherFunction<[options?: NextRenderOptions]> =\n async function (actual, options) {\n const _profiled = actual as\n | ProfiledComponent<any, any>\n | ProfiledHook<any, any>;\n const profiled =\n \"ProfiledComponent\" in _profiled ?\n _profiled.ProfiledComponent\n : _profiled;\n const hint = this.utils.matcherHint(\"toRerender\");\n let pass = true;\n try {\n await profiled.peekRender({ timeout: 100, ...options });\n } catch (e) {\n if (e instanceof WaitForRenderTimeoutError) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} rerender, ` +\n `but it did${pass ? \"\" : \" not\"}.`\n );\n },\n };\n };\n\n/** to be thrown to \"break\" test execution and fail it */\nconst failed = {};\n\nexport const toRenderExactlyTimes: MatcherFunction<\n [times: number, options?: NextRenderOptions]\n> = async function (actual, times, optionsPerRender) {\n const _profiled = actual as\n | ProfiledComponent<any, any>\n | ProfiledHook<any, any>;\n const profiled =\n \"ProfiledComponent\" in _profiled ? _profiled.ProfiledComponent : _profiled;\n const options = { timeout: 100, ...optionsPerRender };\n const hint = this.utils.matcherHint(\"toRenderExactlyTimes\");\n let pass = true;\n try {\n if (profiled.totalRenderCount() > times) {\n throw failed;\n }\n try {\n while (profiled.totalRenderCount() < times) {\n await profiled.waitForNextRender(options);\n }\n } catch (e) {\n // timeouts here should just fail the test, rethrow other errors\n throw e instanceof WaitForRenderTimeoutError ? failed : e;\n }\n try {\n await profiled.waitForNextRender(options);\n } catch (e) {\n // we are expecting a timeout here, so swallow that error, rethrow others\n if (!(e instanceof WaitForRenderTimeoutError)) {\n throw e;\n }\n }\n } catch (e) {\n if (e === failed) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} render exactly ${times}.` +\n ` It rendered ${profiled.totalRenderCount()} times.`\n );\n },\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toHaveSuspenseCacheEntryUsing.js","sourceRoot":"","sources":["../../../src/testing/matchers/toHaveSuspenseCacheEntryUsing.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,MAAM,CAAC,IAAM,6BAA6B,GAQtC,UACF,MAAM,EACN,KAAK,EACL,EAAkD;;QAAlD,qBAA+B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAA,EAAhD,SAAS,eAAA,EAAE,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA;IAE1B,IAAI,CAAC,CAAC,MAAM,YAAY,YAAY,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IAED,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAM,QAAQ;QACZ,KAAK;QACL,kBAAkB,CAAC,SAAS,CAAC;OACzB,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAClC,CAAC;IACF,IAAM,QAAQ,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,OAAO,CAAC;IAE3E,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,QAAQ;QAChB,OAAO,EAAE;YACP,OAAO,kCACL,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,kCACO,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { DocumentNode } from \"graphql\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { getSuspenseCache } from \"../../react/cache/index.js\";\nimport type { CacheKey } from \"../../react/cache/types.js\";\n\nexport const toHaveSuspenseCacheEntryUsing: MatcherFunction<\n [\n query: DocumentNode,\n options: {\n variables?: OperationVariables;\n queryKey?: string | number | any[];\n },\n ]\n> = function (\n client,\n query,\n { variables, queryKey = [] } = Object.create(null)\n) {\n if (!(client instanceof ApolloClient)) {\n throw new Error(\"Actual must be an instance of `ApolloClient`\");\n }\n\n const suspenseCache = getSuspenseCache(client);\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n const queryRef = suspenseCache[\"queryRefs\"].lookupArray(cacheKey)?.current;\n\n return {\n pass: !!queryRef,\n message: () => {\n return `Expected suspense cache ${\n queryRef ? \"not \" : \"\"\n }to have cache entry using key`;\n },\n };\n};\n"]}
1
+ {"version":3,"file":"toHaveSuspenseCacheEntryUsing.js","sourceRoot":"","sources":["../../../src/testing/matchers/toHaveSuspenseCacheEntryUsing.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,MAAM,CAAC,IAAM,6BAA6B,GAQtC,UACF,MAAM,EACN,KAAK,EACL,EAAkD;;QAAlD,qBAA+B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAA,EAAhD,SAAS,eAAA,EAAE,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA;IAE1B,IAAI,CAAC,CAAC,MAAM,YAAY,YAAY,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAM,QAAQ;QACZ,KAAK;QACL,kBAAkB,CAAC,SAAS,CAAC;OACzB,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAClC,CAAC;IACF,IAAM,QAAQ,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,OAAO,CAAC;IAE3E,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,QAAQ;QAChB,OAAO,EAAE;YACP,OAAO,kCACL,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,kCACO,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { DocumentNode } from \"graphql\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { getSuspenseCache } from \"../../react/cache/index.js\";\nimport type { CacheKey } from \"../../react/cache/types.js\";\n\nexport const toHaveSuspenseCacheEntryUsing: MatcherFunction<\n [\n query: DocumentNode,\n options: {\n variables?: OperationVariables;\n queryKey?: string | number | any[];\n },\n ]\n> = function (\n client,\n query,\n { variables, queryKey = [] } = Object.create(null)\n) {\n if (!(client instanceof ApolloClient)) {\n throw new Error(\"Actual must be an instance of `ApolloClient`\");\n }\n\n const suspenseCache = getSuspenseCache(client);\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n const queryRef = suspenseCache[\"queryRefs\"].lookupArray(cacheKey)?.current;\n\n return {\n pass: !!queryRef,\n message: () => {\n return `Expected suspense cache ${\n queryRef ? \"not \" : \"\"\n }to have cache entry using key`;\n },\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toMatchDocument.js","sourceRoot":"","sources":["../../../src/testing/matchers/toMatchDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIhE,MAAM,CAAC,IAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,QAAQ;IAA1B,iBA+CC;IA9CC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACvD,IAAM,cAAc,GAAG,KAAK,CAC1B,gBAAgB,CACd,MAAM,EACN,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IACF,IAAM,gBAAgB,GAAG,KAAK,CAC5B,gBAAgB,CACd,QAAQ,EACR,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IAEF,IAAM,IAAI,GAAG,cAAc,KAAK,gBAAgB,CAAC;IAEjD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP,IAAM,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,WAAW,CACjC,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,EAAE,KAAK,EAAE,KAAI,CAAC,KAAK,EAAE,CACtB,CAAC;YAEF,IAAI,IAAI,EAAE;gBACR,OAAO,CACL,IAAI;oBACJ,MAAM;oBACN,eAAe;oBACf,KAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAC1C,CAAC;aACH;YAED,OAAO,CACL,IAAI,GAAG,MAAM,GAAG,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAClE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,SAAS,gBAAgB,CAAC,QAAiB,EAAE,OAAe;IAC1D,IAAI;QACF,aAAa,CAAC,QAAwB,CAAC,CAAC;KACzC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;IAED,OAAO,QAAwB,CAAC;AAClC,CAAC","sourcesContent":["import { checkDocument, print } from \"../../utilities/index.js\";\nimport type { DocumentNode } from \"../../core/index.js\";\nimport type { MatcherFunction } from \"expect\";\n\nexport const toMatchDocument: MatcherFunction<[document: DocumentNode]> =\n function (actual, document) {\n const hint = this.utils.matcherHint(\"toMatchDocument\");\n const actualDocument = print(\n validateDocument(\n actual,\n hint +\n `\\n\\n${this.utils.RECEIVED_COLOR(\n \"received\"\n )} document must be a parsed document.`\n )\n );\n const expectedDocument = print(\n validateDocument(\n document,\n hint +\n `\\n\\n${this.utils.EXPECTED_COLOR(\n \"expected\"\n )} document must be a parsed document.`\n )\n );\n\n const pass = actualDocument === expectedDocument;\n\n return {\n pass,\n message: () => {\n const hint = this.utils.matcherHint(\n \"toMatchDocument\",\n undefined,\n undefined,\n { isNot: this.isNot }\n );\n\n if (pass) {\n return (\n hint +\n \"\\n\\n\" +\n \"Received:\\n\\n\" +\n this.utils.RECEIVED_COLOR(actualDocument)\n );\n }\n\n return (\n hint + \"\\n\\n\" + this.utils.diff(expectedDocument, actualDocument)\n );\n },\n };\n };\n\nfunction validateDocument(document: unknown, message: string) {\n try {\n checkDocument(document as DocumentNode);\n } catch (e) {\n throw new Error(message);\n }\n\n return document as DocumentNode;\n}\n"]}
1
+ {"version":3,"file":"toMatchDocument.js","sourceRoot":"","sources":["../../../src/testing/matchers/toMatchDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIhE,MAAM,CAAC,IAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,QAAQ;IAA1B,iBA+CC;IA9CC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACvD,IAAM,cAAc,GAAG,KAAK,CAC1B,gBAAgB,CACd,MAAM,EACN,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IACF,IAAM,gBAAgB,GAAG,KAAK,CAC5B,gBAAgB,CACd,QAAQ,EACR,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IAEF,IAAM,IAAI,GAAG,cAAc,KAAK,gBAAgB,CAAC;IAEjD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP,IAAM,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,WAAW,CACjC,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,EAAE,KAAK,EAAE,KAAI,CAAC,KAAK,EAAE,CACtB,CAAC;YAEF,IAAI,IAAI,EAAE,CAAC;gBACT,OAAO,CACL,IAAI;oBACJ,MAAM;oBACN,eAAe;oBACf,KAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAC1C,CAAC;YACJ,CAAC;YAED,OAAO,CACL,IAAI,GAAG,MAAM,GAAG,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAClE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,SAAS,gBAAgB,CAAC,QAAiB,EAAE,OAAe;IAC1D,IAAI,CAAC;QACH,aAAa,CAAC,QAAwB,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,QAAwB,CAAC;AAClC,CAAC","sourcesContent":["import { checkDocument, print } from \"../../utilities/index.js\";\nimport type { DocumentNode } from \"../../core/index.js\";\nimport type { MatcherFunction } from \"expect\";\n\nexport const toMatchDocument: MatcherFunction<[document: DocumentNode]> =\n function (actual, document) {\n const hint = this.utils.matcherHint(\"toMatchDocument\");\n const actualDocument = print(\n validateDocument(\n actual,\n hint +\n `\\n\\n${this.utils.RECEIVED_COLOR(\n \"received\"\n )} document must be a parsed document.`\n )\n );\n const expectedDocument = print(\n validateDocument(\n document,\n hint +\n `\\n\\n${this.utils.EXPECTED_COLOR(\n \"expected\"\n )} document must be a parsed document.`\n )\n );\n\n const pass = actualDocument === expectedDocument;\n\n return {\n pass,\n message: () => {\n const hint = this.utils.matcherHint(\n \"toMatchDocument\",\n undefined,\n undefined,\n { isNot: this.isNot }\n );\n\n if (pass) {\n return (\n hint +\n \"\\n\\n\" +\n \"Received:\\n\\n\" +\n this.utils.RECEIVED_COLOR(actualDocument)\n );\n }\n\n return (\n hint + \"\\n\\n\" + this.utils.diff(expectedDocument, actualDocument)\n );\n },\n };\n };\n\nfunction validateDocument(document: unknown, message: string) {\n try {\n checkDocument(document as DocumentNode);\n } catch (e) {\n throw new Error(message);\n }\n\n return document as DocumentNode;\n}\n"]}
@@ -15,6 +15,10 @@ export interface MockedProviderProps<TSerializedCache = {}> {
15
15
  children?: any;
16
16
  link?: ApolloLink;
17
17
  showWarnings?: boolean;
18
+ /**
19
+ * If set to true, the MockedProvider will try to connect to the Apollo DevTools.
20
+ * Defaults to false.
21
+ */
18
22
  connectToDevTools?: boolean;
19
23
  }
20
24
  export interface MockedProviderState {
@@ -4,7 +4,7 @@ import { ApolloClient } from "../../core/index.js";
4
4
  import { InMemoryCache as Cache } from "../../cache/index.js";
5
5
  import { ApolloProvider } from "../../react/context/index.js";
6
6
  import { MockLink } from "../core/index.js";
7
- var MockedProvider = (function (_super) {
7
+ var MockedProvider = /** @class */ (function (_super) {
8
8
  __extends(MockedProvider, _super);
9
9
  function MockedProvider(props) {
10
10
  var _this = _super.call(this, props) || this;
@@ -24,9 +24,13 @@ var MockedProvider = (function (_super) {
24
24
  MockedProvider.prototype.render = function () {
25
25
  var _a = this.props, children = _a.children, childProps = _a.childProps;
26
26
  var client = this.state.client;
27
- return React.isValidElement(children) ? (React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))) : null;
27
+ return React.isValidElement(children) ?
28
+ React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))
29
+ : null;
28
30
  };
29
31
  MockedProvider.prototype.componentWillUnmount = function () {
32
+ // Since this.state.client was created in the constructor, it's this
33
+ // MockedProvider's responsibility to terminate it.
30
34
  this.state.client.stop();
31
35
  };
32
36
  MockedProvider.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"MockedProvider.js","sourceRoot":"","sources":["../../../src/testing/react/MockedProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA0B5C;IAAoC,kCAGnC;IAKC,wBAAY,KAA0B;QAAtC,YACE,kBAAM,KAAK,CAAC,SAuBb;QArBO,IAAA,KASF,KAAI,CAAC,KAAK,EARZ,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,KAAK,WAAA,EACL,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,YAAY,kBAAA,EACZ,yBAAyB,EAAzB,iBAAiB,mBAAG,KAAK,KACb,CAAC;QACf,IAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,WAAW,aAAA,EAAE,CAAC;YAC1C,cAAc,gBAAA;YACd,iBAAiB,mBAAA;YACjB,IAAI,EAAE,IAAI,IAAI,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,YAAY,cAAA,EAAE,CAAC;YACtE,SAAS,WAAA;SACV,CAAC,CAAC;QAEH,KAAI,CAAC,KAAK,GAAG;YACX,MAAM,QAAA;SACP,CAAC;;IACJ,CAAC;IAEM,+BAAM,GAAb;QACQ,IAAA,KAA2B,IAAI,CAAC,KAAK,EAAnC,QAAQ,cAAA,EAAE,UAAU,gBAAe,CAAC;QACpC,IAAA,MAAM,GAAK,IAAI,CAAC,KAAK,OAAf,CAAgB;QAE9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACtC,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM,IAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAO,UAAU,EAAG,CACtD,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAEM,6CAAoB,GAA3B;QAGE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IA7Ca,2BAAY,GAAwB;QAChD,WAAW,EAAE,IAAI;KAClB,CAAC;IA4CJ,qBAAC;CAAA,AAlDD,CAAoC,KAAK,CAAC,SAAS,GAkDlD;SAlDY,cAAc","sourcesContent":["import * as React from \"react\";\n\nimport type { DefaultOptions } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport type { MockedResponse } from \"../core/index.js\";\nimport { MockLink } from \"../core/index.js\";\nimport type { ApolloLink } from \"../../link/core/index.js\";\nimport type { Resolvers } from \"../../core/index.js\";\nimport type { ApolloCache } from \"../../cache/index.js\";\n\nexport interface MockedProviderProps<TSerializedCache = {}> {\n mocks?: ReadonlyArray<MockedResponse>;\n addTypename?: boolean;\n defaultOptions?: DefaultOptions;\n cache?: ApolloCache<TSerializedCache>;\n resolvers?: Resolvers;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n /**\n * If set to true, the MockedProvider will try to connect to the Apollo DevTools.\n * Defaults to false.\n */\n connectToDevTools?: boolean;\n}\n\nexport interface MockedProviderState {\n client: ApolloClient<any>;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n public static defaultProps: MockedProviderProps = {\n addTypename: true,\n };\n\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n addTypename,\n defaultOptions,\n cache,\n resolvers,\n link,\n showWarnings,\n connectToDevTools = false,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache({ addTypename }),\n defaultOptions,\n connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings }),\n resolvers,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ? (\n <ApolloProvider client={client}>\n {React.cloneElement(React.Children.only(children), { ...childProps })}\n </ApolloProvider>\n ) : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"]}
1
+ {"version":3,"file":"MockedProvider.js","sourceRoot":"","sources":["../../../src/testing/react/MockedProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA0B5C;IAAoC,kCAGnC;IAKC,wBAAY,KAA0B;QACpC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAEP,IAAA,KASF,KAAI,CAAC,KAAK,EARZ,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,KAAK,WAAA,EACL,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,YAAY,kBAAA,EACZ,yBAAyB,EAAzB,iBAAiB,mBAAG,KAAK,KACb,CAAC;QACf,IAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,WAAW,aAAA,EAAE,CAAC;YAC1C,cAAc,gBAAA;YACd,iBAAiB,mBAAA;YACjB,IAAI,EAAE,IAAI,IAAI,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,YAAY,cAAA,EAAE,CAAC;YACtE,SAAS,WAAA;SACV,CAAC,CAAC;QAEH,KAAI,CAAC,KAAK,GAAG;YACX,MAAM,QAAA;SACP,CAAC;;IACJ,CAAC;IAEM,+BAAM,GAAb;QACQ,IAAA,KAA2B,IAAI,CAAC,KAAK,EAAnC,QAAQ,cAAA,EAAE,UAAU,gBAAe,CAAC;QACpC,IAAA,MAAM,GAAK,IAAI,CAAC,KAAK,OAAf,CAAgB;QAE9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM,IAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAO,UAAU,EAAG,CACtD;YACnB,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAEM,6CAAoB,GAA3B;QACE,oEAAoE;QACpE,mDAAmD;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IA7Ca,2BAAY,GAAwB;QAChD,WAAW,EAAE,IAAI;KAClB,CAAC;IA4CJ,qBAAC;CAAA,AAlDD,CAAoC,KAAK,CAAC,SAAS,GAkDlD;SAlDY,cAAc","sourcesContent":["import * as React from \"react\";\n\nimport type { DefaultOptions } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport type { MockedResponse } from \"../core/index.js\";\nimport { MockLink } from \"../core/index.js\";\nimport type { ApolloLink } from \"../../link/core/index.js\";\nimport type { Resolvers } from \"../../core/index.js\";\nimport type { ApolloCache } from \"../../cache/index.js\";\n\nexport interface MockedProviderProps<TSerializedCache = {}> {\n mocks?: ReadonlyArray<MockedResponse>;\n addTypename?: boolean;\n defaultOptions?: DefaultOptions;\n cache?: ApolloCache<TSerializedCache>;\n resolvers?: Resolvers;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n /**\n * If set to true, the MockedProvider will try to connect to the Apollo DevTools.\n * Defaults to false.\n */\n connectToDevTools?: boolean;\n}\n\nexport interface MockedProviderState {\n client: ApolloClient<any>;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n public static defaultProps: MockedProviderProps = {\n addTypename: true,\n };\n\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n addTypename,\n defaultOptions,\n cache,\n resolvers,\n link,\n showWarnings,\n connectToDevTools = false,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache({ addTypename }),\n defaultOptions,\n connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings }),\n resolvers,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ?\n <ApolloProvider client={client}>\n {React.cloneElement(React.Children.only(children), { ...childProps })}\n </ApolloProvider>\n : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"]}
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
26
 
27
- var MockedProvider = (function (_super) {
27
+ var MockedProvider = (function (_super) {
28
28
  tslib.__extends(MockedProvider, _super);
29
29
  function MockedProvider(props) {
30
30
  var _this = _super.call(this, props) || this;
@@ -44,7 +44,9 @@ var MockedProvider = (function (_super) {
44
44
  MockedProvider.prototype.render = function () {
45
45
  var _a = this.props, children = _a.children, childProps = _a.childProps;
46
46
  var client = this.state.client;
47
- return React__namespace.isValidElement(children) ? (React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))) : null;
47
+ return React__namespace.isValidElement(children) ?
48
+ React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))
49
+ : null;
48
50
  };
49
51
  MockedProvider.prototype.componentWillUnmount = function () {
50
52
  this.state.client.stop();
@@ -1 +1 @@
1
- {"version":3,"file":"testing.cjs","sources":["react/MockedProvider.js"],"sourcesContent":["import { __assign, __extends } from \"tslib\";\nimport * as React from \"react\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport { MockLink } from \"../core/index.js\";\nvar MockedProvider = (function (_super) {\n __extends(MockedProvider, _super);\n function MockedProvider(props) {\n var _this = _super.call(this, props) || this;\n var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b;\n var client = new ApolloClient({\n cache: cache || new Cache({ addTypename: addTypename }),\n defaultOptions: defaultOptions,\n connectToDevTools: connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings: showWarnings }),\n resolvers: resolvers,\n });\n _this.state = {\n client: client,\n };\n return _this;\n }\n MockedProvider.prototype.render = function () {\n var _a = this.props, children = _a.children, childProps = _a.childProps;\n var client = this.state.client;\n return React.isValidElement(children) ? (React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))) : null;\n };\n MockedProvider.prototype.componentWillUnmount = function () {\n this.state.client.stop();\n };\n MockedProvider.defaultProps = {\n addTypename: true,\n };\n return MockedProvider;\n}(React.Component));\nexport { MockedProvider };\n//# sourceMappingURL=MockedProvider.js.map"],"names":["__extends","cache","ApolloClient","Cache","MockLink","React","ApolloProvider","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMG,IAAC,cAAc,IAAI,UAAU,MAAM,EAAE;AACxC,IAAIA,eAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AACtC,IAAI,SAAS,cAAc,CAAC,KAAK,EAAE;AACnC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;AACrD,QAAQ,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,EAAE,CAAC,WAAW,EAAE,cAAc,GAAG,EAAE,CAAC,cAAc,EAAEC,OAAK,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;AACxR,QAAQ,IAAI,MAAM,GAAG,IAAIC,mBAAY,CAAC;AACtC,YAAY,KAAK,EAAED,OAAK,IAAI,IAAIE,mBAAK,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACnE,YAAY,cAAc,EAAE,cAAc;AAC1C,YAAY,iBAAiB,EAAE,iBAAiB;AAChD,YAAY,IAAI,EAAE,IAAI,IAAI,IAAIC,aAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAChG,YAAY,SAAS,EAAE,SAAS;AAChC,SAAS,CAAC,CAAC;AACX,QAAQ,KAAK,CAAC,KAAK,GAAG;AACtB,YAAY,MAAM,EAAE,MAAM;AAC1B,SAAS,CAAC;AACV,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,GAAG,YAAY;AAClD,QAAQ,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AAChF,QAAQ,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;AACvC,QAAQ,OAAOC,gBAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAIA,gBAAK,CAAC,aAAa,CAACC,sBAAc,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAED,gBAAK,CAAC,YAAY,CAACA,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAEE,cAAQ,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9L,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAG,YAAY;AAChE,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACjC,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,YAAY,GAAG;AAClC,QAAQ,WAAW,EAAE,IAAI;AACzB,KAAK,CAAC;AACN,IAAI,OAAO,cAAc,CAAC;AAC1B,CAAC,CAACF,gBAAK,CAAC,SAAS,CAAC;;;;;;;"}
1
+ {"version":3,"file":"testing.cjs","sources":["react/MockedProvider.js"],"sourcesContent":["import { __assign, __extends } from \"tslib\";\nimport * as React from \"react\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport { MockLink } from \"../core/index.js\";\nvar MockedProvider = /** @class */ (function (_super) {\n __extends(MockedProvider, _super);\n function MockedProvider(props) {\n var _this = _super.call(this, props) || this;\n var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b;\n var client = new ApolloClient({\n cache: cache || new Cache({ addTypename: addTypename }),\n defaultOptions: defaultOptions,\n connectToDevTools: connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings: showWarnings }),\n resolvers: resolvers,\n });\n _this.state = {\n client: client,\n };\n return _this;\n }\n MockedProvider.prototype.render = function () {\n var _a = this.props, children = _a.children, childProps = _a.childProps;\n var client = this.state.client;\n return React.isValidElement(children) ?\n React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))\n : null;\n };\n MockedProvider.prototype.componentWillUnmount = function () {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n };\n MockedProvider.defaultProps = {\n addTypename: true,\n };\n return MockedProvider;\n}(React.Component));\nexport { MockedProvider };\n//# sourceMappingURL=MockedProvider.js.map"],"names":["__extends","cache","ApolloClient","Cache","MockLink","React","ApolloProvider","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMG,IAAC,cAAc,KAAkB,UAAU,MAAM,EAAE;AACtD,IAAIA,eAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AACtC,IAAI,SAAS,cAAc,CAAC,KAAK,EAAE;AACnC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;AACrD,QAAQ,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,EAAE,CAAC,WAAW,EAAE,cAAc,GAAG,EAAE,CAAC,cAAc,EAAEC,OAAK,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;AACxR,QAAQ,IAAI,MAAM,GAAG,IAAIC,mBAAY,CAAC;AACtC,YAAY,KAAK,EAAED,OAAK,IAAI,IAAIE,mBAAK,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACnE,YAAY,cAAc,EAAE,cAAc;AAC1C,YAAY,iBAAiB,EAAE,iBAAiB;AAChD,YAAY,IAAI,EAAE,IAAI,IAAI,IAAIC,aAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAChG,YAAY,SAAS,EAAE,SAAS;AAChC,SAAS,CAAC,CAAC;AACX,QAAQ,KAAK,CAAC,KAAK,GAAG;AACtB,YAAY,MAAM,EAAE,MAAM;AAC1B,SAAS,CAAC;AACV,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,GAAG,YAAY;AAClD,QAAQ,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AAChF,QAAQ,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;AACvC,QAAQ,OAAOC,gBAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;AAC7C,YAAYA,gBAAK,CAAC,aAAa,CAACC,sBAAc,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAED,gBAAK,CAAC,YAAY,CAACA,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAEE,cAAQ,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;AAChJ,cAAc,IAAI,CAAC;AACnB,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAG,YAAY;AAGhE,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACjC,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,YAAY,GAAG;AAClC,QAAQ,WAAW,EAAE,IAAI;AACzB,KAAK,CAAC;AACN,IAAI,OAAO,cAAc,CAAC;AAC1B,CAAC,CAACF,gBAAK,CAAC,SAAS,CAAC;;;;;;;"}
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
26
 
27
- var MockedProvider = (function (_super) {
27
+ var MockedProvider = (function (_super) {
28
28
  tslib.__extends(MockedProvider, _super);
29
29
  function MockedProvider(props) {
30
30
  var _this = _super.call(this, props) || this;
@@ -44,7 +44,9 @@ var MockedProvider = (function (_super) {
44
44
  MockedProvider.prototype.render = function () {
45
45
  var _a = this.props, children = _a.children, childProps = _a.childProps;
46
46
  var client = this.state.client;
47
- return React__namespace.isValidElement(children) ? (React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))) : null;
47
+ return React__namespace.isValidElement(children) ?
48
+ React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))
49
+ : null;
48
50
  };
49
51
  MockedProvider.prototype.componentWillUnmount = function () {
50
52
  this.state.client.stop();
@@ -1,3 +1,4 @@
1
+ // A version of Array.isArray that works better with readonly arrays.
1
2
  export var isArray = Array.isArray;
2
3
  export function isNonEmptyArray(value) {
3
4
  return Array.isArray(value) && value.length > 0;
@@ -1 +1 @@
1
- {"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../../src/utilities/common/arrays.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,IAAM,OAAO,GAA4C,KAAK,CAAC,OAAO,CAAC;AAE9E,MAAM,UAAU,eAAe,CAAI,KAAoB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// A version of Array.isArray that works better with readonly arrays.\nexport const isArray: (a: any) => a is any[] | readonly any[] = Array.isArray;\n\nexport function isNonEmptyArray<T>(value?: ArrayLike<T>): value is Array<T> {\n return Array.isArray(value) && value.length > 0;\n}\n"]}
1
+ {"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../../src/utilities/common/arrays.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,CAAC,IAAM,OAAO,GAA4C,KAAK,CAAC,OAAO,CAAC;AAE9E,MAAM,UAAU,eAAe,CAAI,KAAoB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// A version of Array.isArray that works better with readonly arrays.\nexport const isArray: (a: any) => a is any[] | readonly any[] = Array.isArray;\n\nexport function isNonEmptyArray<T>(value?: ArrayLike<T>): value is Array<T> {\n return Array.isArray(value) && value.length > 0;\n}\n"]}
@@ -5,6 +5,21 @@ export var canUseWeakSet = typeof WeakSet === "function";
5
5
  export var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
6
6
  export var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
7
7
  export var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function";
8
- var usingJSDOM = maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
8
+ var usingJSDOM =
9
+ // Following advice found in this comment from @domenic (maintainer of jsdom):
10
+ // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327
11
+ //
12
+ // Since we control the version of Jest and jsdom used when running Apollo
13
+ // Client tests, and that version is recent enought to include " jsdom/x.y.z"
14
+ // at the end of the user agent string, I believe this case is all we need to
15
+ // check. Testing for "Node.js" was recommended for backwards compatibility
16
+ // with older version of jsdom, but we don't have that problem.
17
+ maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
18
+ // Our tests should all continue to pass if we remove this !usingJSDOM
19
+ // condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,
20
+ // if we allow useLayoutEffect, then useSyncExternalStore generates many
21
+ // warnings about useLayoutEffect doing nothing on the server. While these
22
+ // warnings are harmless, this !usingJSDOM condition seems to be the best way to
23
+ // prevent them (i.e. skipping useLayoutEffect when using jsdom).
9
24
  export var canUseLayoutEffect = canUseDOM && !usingJSDOM;
10
25
  //# sourceMappingURL=canUse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,CAAC,IAAM,aAAa,GACxB,OAAO,OAAO,KAAK,UAAU;IAC7B,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,OAAO,EAAjB,CAAiB,CAAC,KAAK,aAAa,CAAC;AAEnD,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC;AAE3D,MAAM,CAAC,IAAM,YAAY,GACvB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC;AAEnE,MAAM,CAAC,IAAM,yBAAyB,GAAG,YAAY,IAAI,MAAM,CAAC,aAAa,CAAC;AAE9E,MAAM,CAAC,IAAM,SAAS,GACpB,OAAO,KAAK,CAAC,cAAM,OAAA,MAAM,CAAC,QAAQ,CAAC,aAAa,EAA7B,CAA6B,CAAC,KAAK,UAAU,CAAC;AAEnE,IAAM,UAAU,GASd,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAzC,CAAyC,CAAC,IAAI,KAAK,CAAC;AAQlE,MAAM,CAAC,IAAM,kBAAkB,GAAG,SAAS,IAAI,CAAC,UAAU,CAAC","sourcesContent":["import { maybe } from \"../globals/index.js\";\n\nexport const canUseWeakMap =\n typeof WeakMap === \"function\" &&\n maybe(() => navigator.product) !== \"ReactNative\";\n\nexport const canUseWeakSet = typeof WeakSet === \"function\";\n\nexport const canUseSymbol =\n typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\n\nexport const canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\n\nexport const canUseDOM =\n typeof maybe(() => window.document.createElement) === \"function\";\n\nconst usingJSDOM: boolean =\n // Following advice found in this comment from @domenic (maintainer of jsdom):\n // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n //\n // Since we control the version of Jest and jsdom used when running Apollo\n // Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n // at the end of the user agent string, I believe this case is all we need to\n // check. Testing for \"Node.js\" was recommended for backwards compatibility\n // with older version of jsdom, but we don't have that problem.\n maybe(() => navigator.userAgent.indexOf(\"jsdom\") >= 0) || false;\n\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport const canUseLayoutEffect = canUseDOM && !usingJSDOM;\n"]}
1
+ {"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,CAAC,IAAM,aAAa,GACxB,OAAO,OAAO,KAAK,UAAU;IAC7B,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,OAAO,EAAjB,CAAiB,CAAC,KAAK,aAAa,CAAC;AAEnD,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC;AAE3D,MAAM,CAAC,IAAM,YAAY,GACvB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC;AAEnE,MAAM,CAAC,IAAM,yBAAyB,GAAG,YAAY,IAAI,MAAM,CAAC,aAAa,CAAC;AAE9E,MAAM,CAAC,IAAM,SAAS,GACpB,OAAO,KAAK,CAAC,cAAM,OAAA,MAAM,CAAC,QAAQ,CAAC,aAAa,EAA7B,CAA6B,CAAC,KAAK,UAAU,CAAC;AAEnE,IAAM,UAAU;AACd,8EAA8E;AAC9E,oEAAoE;AACpE,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,+DAA+D;AAC/D,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAzC,CAAyC,CAAC,IAAI,KAAK,CAAC;AAElE,sEAAsE;AACtE,+EAA+E;AAC/E,wEAAwE;AACxE,0EAA0E;AAC1E,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,CAAC,IAAM,kBAAkB,GAAG,SAAS,IAAI,CAAC,UAAU,CAAC","sourcesContent":["import { maybe } from \"../globals/index.js\";\n\nexport const canUseWeakMap =\n typeof WeakMap === \"function\" &&\n maybe(() => navigator.product) !== \"ReactNative\";\n\nexport const canUseWeakSet = typeof WeakSet === \"function\";\n\nexport const canUseSymbol =\n typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\n\nexport const canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\n\nexport const canUseDOM =\n typeof maybe(() => window.document.createElement) === \"function\";\n\nconst usingJSDOM: boolean =\n // Following advice found in this comment from @domenic (maintainer of jsdom):\n // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n //\n // Since we control the version of Jest and jsdom used when running Apollo\n // Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n // at the end of the user agent string, I believe this case is all we need to\n // check. Testing for \"Node.js\" was recommended for backwards compatibility\n // with older version of jsdom, but we don't have that problem.\n maybe(() => navigator.userAgent.indexOf(\"jsdom\") >= 0) || false;\n\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport const canUseLayoutEffect = canUseDOM && !usingJSDOM;\n"]}
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Deeply clones a value to create a new instance.
3
+ */
1
4
  export declare function cloneDeep<T>(value: T): T;
2
5
  //# sourceMappingURL=cloneDeep.d.ts.map
@@ -1,4 +1,7 @@
1
1
  var toString = Object.prototype.toString;
2
+ /**
3
+ * Deeply clones a value to create a new instance.
4
+ */
2
5
  export function cloneDeep(value) {
3
6
  return cloneDeepHelper(value);
4
7
  }
@@ -19,6 +22,8 @@ function cloneDeepHelper(val, seen) {
19
22
  seen = seen || new Map();
20
23
  if (seen.has(val))
21
24
  return seen.get(val);
25
+ // High fidelity polyfills of Object.create and Object.getPrototypeOf are
26
+ // possible in all JS environments, so we will assume they exist/work.
22
27
  var copy_2 = Object.create(Object.getPrototypeOf(val));
23
28
  seen.set(val, copy_2);
24
29
  Object.keys(val).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../../src/utilities/common/cloneDeep.ts"],"names":[],"mappings":"AAAQ,IAAA,QAAQ,GAAK,MAAM,CAAC,SAAS,SAArB,CAAsB;AAKtC,MAAM,UAAU,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAoB;IACtD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC1B,KAAK,gBAAgB,CAAC,CAAC;YACrB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED,KAAK,iBAAiB,CAAC,CAAC;YACtB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAGxC,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAA8B,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;gBACtD,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;SACb;QAED;YACE,OAAO,GAAG,CAAC;KACd;AACH,CAAC","sourcesContent":["const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep<T>(value: T): T {\n return cloneDeepHelper(value);\n}\n\nfunction cloneDeepHelper<T>(val: T, seen?: Map<any, any>): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val as T & Record<string, any>).forEach((key) => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n"]}
1
+ {"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../../src/utilities/common/cloneDeep.ts"],"names":[],"mappings":"AAAQ,IAAA,QAAQ,GAAK,MAAM,CAAC,SAAS,SAArB,CAAsB;AAEtC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAoB;IACtD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACtB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;QACd,CAAC;QAED,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACvB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,yEAAyE;YACzE,sEAAsE;YACtE,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAA8B,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;gBACtD,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;QACd,CAAC;QAED;YACE,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep<T>(value: T): T {\n return cloneDeepHelper(value);\n}\n\nfunction cloneDeepHelper<T>(val: T, seen?: Map<any, any>): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val as T & Record<string, any>).forEach((key) => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n"]}
@@ -1,3 +1,7 @@
1
1
  import type { TupleToIntersection } from "./mergeDeep.js";
2
+ /**
3
+ * Merges the provided objects shallowly and removes
4
+ * all properties with an `undefined` value
5
+ */
2
6
  export declare function compact<TArgs extends any[]>(...objects: TArgs): TupleToIntersection<TArgs>;
3
7
  //# sourceMappingURL=compact.d.ts.map
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Merges the provided objects shallowly and removes
3
+ * all properties with an `undefined` value
4
+ */
1
5
  export function compact() {
2
6
  var objects = [];
3
7
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../src/utilities/common/compact.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,OAAO;IACrB,iBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,4BAAiB;;IAEjB,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC3B,IAAM,KAAK,GAAI,GAAW,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE;gBACpB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { TupleToIntersection } from \"./mergeDeep.js\";\n\n/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact<TArgs extends any[]>(\n ...objects: TArgs\n): TupleToIntersection<TArgs> {\n const result = Object.create(null);\n\n objects.forEach((obj) => {\n if (!obj) return;\n Object.keys(obj).forEach((key) => {\n const value = (obj as any)[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../src/utilities/common/compact.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,OAAO;IACrB,iBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,4BAAiB;;IAEjB,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC3B,IAAM,KAAK,GAAI,GAAW,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE,CAAC;gBACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { TupleToIntersection } from \"./mergeDeep.js\";\n\n/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact<TArgs extends any[]>(\n ...objects: TArgs\n): TupleToIntersection<TArgs> {\n const result = Object.create(null);\n\n objects.forEach((obj) => {\n if (!obj) return;\n Object.keys(obj).forEach((key) => {\n const value = (obj as any)[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n\n return result;\n}\n"]}
@@ -5,9 +5,7 @@ export function graphQLResultHasError(result) {
5
5
  return isNonEmptyArray(errors);
6
6
  }
7
7
  export function getGraphQLErrorsFromResult(result) {
8
- var graphQLErrors = isNonEmptyArray(result.errors)
9
- ? result.errors.slice(0)
10
- : [];
8
+ var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
11
9
  if (isExecutionPatchIncrementalResult(result) &&
12
10
  isNonEmptyArray(result.incremental)) {
13
11
  result.incremental.forEach(function (incrementalResult) {
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../../src/utilities/common/errorHandling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,UAAU,qBAAqB,CAAI,MAAsB;IAC7D,IAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAI,MAAsB;IAClE,IAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC;QAClD,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,CAAC,CAAC,EAAE,CAAC;IAEP,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC;QACA,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,iBAAiB;YAC3C,IAAI,iBAAiB,CAAC,MAAM,EAAE;gBAC5B,aAAa,CAAC,IAAI,OAAlB,aAAa,EAAS,iBAAiB,CAAC,MAAM,EAAE;aACjD;QACH,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { FetchResult } from \"../../link/core/index.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { isExecutionPatchIncrementalResult } from \"./incrementalResult.js\";\n\nexport function graphQLResultHasError<T>(result: FetchResult<T>): boolean {\n const errors = getGraphQLErrorsFromResult(result);\n return isNonEmptyArray(errors);\n}\n\nexport function getGraphQLErrorsFromResult<T>(result: FetchResult<T>) {\n const graphQLErrors = isNonEmptyArray(result.errors)\n ? result.errors.slice(0)\n : [];\n\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach((incrementalResult) => {\n if (incrementalResult.errors) {\n graphQLErrors.push(...incrementalResult.errors);\n }\n });\n }\n return graphQLErrors;\n}\n"]}
1
+ {"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../../src/utilities/common/errorHandling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,UAAU,qBAAqB,CAAI,MAAsB;IAC7D,IAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAI,MAAsB;IAClE,IAAM,aAAa,GACjB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/D,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,iBAAiB;YAC3C,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;gBAC7B,aAAa,CAAC,IAAI,OAAlB,aAAa,EAAS,iBAAiB,CAAC,MAAM,EAAE;YAClD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { FetchResult } from \"../../link/core/index.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { isExecutionPatchIncrementalResult } from \"./incrementalResult.js\";\n\nexport function graphQLResultHasError<T>(result: FetchResult<T>): boolean {\n const errors = getGraphQLErrorsFromResult(result);\n return isNonEmptyArray(errors);\n}\n\nexport function getGraphQLErrorsFromResult<T>(result: FetchResult<T>) {\n const graphQLErrors =\n isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach((incrementalResult) => {\n if (incrementalResult.errors) {\n graphQLErrors.push(...incrementalResult.errors);\n }\n });\n }\n return graphQLErrors;\n}\n"]}
@@ -11,6 +11,9 @@ export function isExecutionPatchResult(value) {
11
11
  return (isExecutionPatchIncrementalResult(value) ||
12
12
  isExecutionPatchInitialResult(value));
13
13
  }
14
+ // This function detects an Apollo payload result before it is transformed
15
+ // into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult
16
+ // once it leaves the link chain.
14
17
  export function isApolloPayloadResult(value) {
15
18
  return isNonNullObject(value) && "payload" in value;
16
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"incrementalResult.js","sourceRoot":"","sources":["../../../src/utilities/common/incrementalResult.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iCAAiC,CAC/C,KAAqB;IAErB,OAAO,aAAa,IAAI,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAqB;IAErB,OAAO,SAAS,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAqB;IAErB,OAAO,CACL,iCAAiC,CAAC,KAAK,CAAC;QACxC,6BAA6B,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC;AAKD,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAAiB,EACjB,MAAmC;IAEnC,IAAI,UAAU,GAAG,UAAU,CAAC;IAC5B,IAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC;QACA,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,EAAc;gBAAZ,IAAI,UAAA,EAAE,IAAI,UAAA;YACtC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;gBACzC,IAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAM,YAAY,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClC,IAAM,QAAM,GAAiC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,QAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACnB,IAAI,GAAG,QAAqB,CAAC;aAC9B;YACD,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,UAAmB,CAAC;AAC7B,CAAC","sourcesContent":["import type {\n ExecutionPatchIncrementalResult,\n ExecutionPatchInitialResult,\n ExecutionPatchResult,\n ApolloPayloadResult,\n FetchResult,\n} from \"../../link/core/index.js\";\nimport { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\n\nexport function isExecutionPatchIncrementalResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchIncrementalResult {\n return \"incremental\" in value;\n}\n\nexport function isExecutionPatchInitialResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchInitialResult<T> {\n return \"hasNext\" in value && \"data\" in value;\n}\n\nexport function isExecutionPatchResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchResult<T> {\n return (\n isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value)\n );\n}\n\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(\n value: unknown\n): value is ApolloPayloadResult {\n return isNonNullObject(value) && \"payload\" in value;\n}\n\nexport function mergeIncrementalData<TData extends object>(\n prevResult: TData,\n result: ExecutionPatchResult<TData>\n) {\n let mergedData = prevResult;\n const merger = new DeepMerger();\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach(({ data, path }) => {\n for (let i = path.length - 1; i >= 0; --i) {\n const key = path[i];\n const isNumericKey = !isNaN(+key);\n const parent: Record<string | number, any> = isNumericKey ? [] : {};\n parent[key] = data;\n data = parent as typeof data;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData as TData;\n}\n"]}
1
+ {"version":3,"file":"incrementalResult.js","sourceRoot":"","sources":["../../../src/utilities/common/incrementalResult.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iCAAiC,CAC/C,KAAqB;IAErB,OAAO,aAAa,IAAI,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAqB;IAErB,OAAO,SAAS,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAqB;IAErB,OAAO,CACL,iCAAiC,CAAC,KAAK,CAAC;QACxC,6BAA6B,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,2EAA2E;AAC3E,iCAAiC;AACjC,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAAiB,EACjB,MAAmC;IAEnC,IAAI,UAAU,GAAG,UAAU,CAAC;IAC5B,IAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,EAAc;gBAAZ,IAAI,UAAA,EAAE,IAAI,UAAA;YACtC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;gBAC1C,IAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAM,YAAY,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClC,IAAM,QAAM,GAAiC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,QAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACnB,IAAI,GAAG,QAAqB,CAAC;YAC/B,CAAC;YACD,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,UAAmB,CAAC;AAC7B,CAAC","sourcesContent":["import type {\n ExecutionPatchIncrementalResult,\n ExecutionPatchInitialResult,\n ExecutionPatchResult,\n ApolloPayloadResult,\n FetchResult,\n} from \"../../link/core/index.js\";\nimport { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\n\nexport function isExecutionPatchIncrementalResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchIncrementalResult {\n return \"incremental\" in value;\n}\n\nexport function isExecutionPatchInitialResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchInitialResult<T> {\n return \"hasNext\" in value && \"data\" in value;\n}\n\nexport function isExecutionPatchResult<T>(\n value: FetchResult<T>\n): value is ExecutionPatchResult<T> {\n return (\n isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value)\n );\n}\n\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(\n value: unknown\n): value is ApolloPayloadResult {\n return isNonNullObject(value) && \"payload\" in value;\n}\n\nexport function mergeIncrementalData<TData extends object>(\n prevResult: TData,\n result: ExecutionPatchResult<TData>\n) {\n let mergedData = prevResult;\n const merger = new DeepMerger();\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach(({ data, path }) => {\n for (let i = path.length - 1; i >= 0; --i) {\n const key = path[i];\n const isNumericKey = !isNaN(+key);\n const parent: Record<string | number, any> = isNumericKey ? [] : {};\n parent[key] = data;\n data = parent as typeof data;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData as TData;\n}\n"]}
@@ -1,4 +1,6 @@
1
1
  var prefixCounts = new Map();
2
+ // These IDs won't be globally unique, but they will be unique within this
3
+ // process, thanks to the counter, and unguessable thanks to the random suffix.
2
4
  export function makeUniqueId(prefix) {
3
5
  var count = prefixCounts.get(prefix) || 1;
4
6
  prefixCounts.set(prefix, count + 1);
@@ -1 +1 @@
1
- {"version":3,"file":"makeUniqueId.js","sourceRoot":"","sources":["../../../src/utilities/common/makeUniqueId.ts"],"names":[],"mappings":"AAAA,IAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAI/C,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACpC,OAAO,UAAG,MAAM,cAAI,KAAK,cAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,CAAC;AACrE,CAAC","sourcesContent":["const prefixCounts = new Map<string, number>();\n\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix: string) {\n const count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return `${prefix}:${count}:${Math.random().toString(36).slice(2)}`;\n}\n"]}
1
+ {"version":3,"file":"makeUniqueId.js","sourceRoot":"","sources":["../../../src/utilities/common/makeUniqueId.ts"],"names":[],"mappings":"AAAA,IAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE/C,0EAA0E;AAC1E,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACpC,OAAO,UAAG,MAAM,cAAI,KAAK,cAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,CAAC;AACrE,CAAC","sourcesContent":["const prefixCounts = new Map<string, number>();\n\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix: string) {\n const count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return `${prefix}:${count}:${Math.random().toString(36).slice(2)}`;\n}\n"]}
@@ -17,6 +17,9 @@ function shallowFreeze(obj) {
17
17
  Object.freeze(obj);
18
18
  }
19
19
  catch (e) {
20
+ // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but
21
+ // they all throw a TypeError when you try, so we re-throw any exceptions
22
+ // that are not TypeErrors, since that would be unexpected.
20
23
  if (e instanceof TypeError)
21
24
  return null;
22
25
  throw e;
@@ -1 +1 @@
1
- {"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../../src/utilities/common/maybeDeepFreeze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,SAAS,UAAU,CAAC,KAAU;IAC5B,IAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;YACtD,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;gBAC3C,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAmB,GAAM;IAC7C,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACpC,IAAI;YACF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACpB;QAAC,OAAO,CAAC,EAAE;YAIV,IAAI,CAAC,YAAY,SAAS;gBAAE,OAAO,IAAI,CAAC;YACxC,MAAM,CAAC,CAAC;SACT;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,eAAe,CAAI,GAAM;IACvC,IAAI,OAAO,EAAE;QACX,UAAU,CAAC,GAAG,CAAC,CAAC;KACjB;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { isNonNullObject } from \"./objects.js\";\n\nfunction deepFreeze(value: any) {\n const workSet = new Set([value]);\n workSet.forEach((obj) => {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach((name) => {\n if (isNonNullObject(obj[name])) workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\n\nfunction shallowFreeze<T extends object>(obj: T): T | null {\n if (__DEV__ && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n } catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError) return null;\n throw e;\n }\n }\n return obj;\n}\n\nexport function maybeDeepFreeze<T>(obj: T): T {\n if (__DEV__) {\n deepFreeze(obj);\n }\n return obj;\n}\n"]}
1
+ {"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../../src/utilities/common/maybeDeepFreeze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,SAAS,UAAU,CAAC,KAAU;IAC5B,IAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;YACvD,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;gBAC3C,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAmB,GAAM;IAC7C,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,wEAAwE;YACxE,yEAAyE;YACzE,2DAA2D;YAC3D,IAAI,CAAC,YAAY,SAAS;gBAAE,OAAO,IAAI,CAAC;YACxC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,eAAe,CAAI,GAAM;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,UAAU,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { isNonNullObject } from \"./objects.js\";\n\nfunction deepFreeze(value: any) {\n const workSet = new Set([value]);\n workSet.forEach((obj) => {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach((name) => {\n if (isNonNullObject(obj[name])) workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\n\nfunction shallowFreeze<T extends object>(obj: T): T | null {\n if (__DEV__ && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n } catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError) return null;\n throw e;\n }\n }\n return obj;\n}\n\nexport function maybeDeepFreeze<T>(obj: T): T {\n if (__DEV__) {\n deepFreeze(obj);\n }\n return obj;\n}\n"]}
@@ -8,6 +8,12 @@ export function mergeDeep() {
8
8
  }
9
9
  return mergeDeepArray(sources);
10
10
  }
11
+ // In almost any situation where you could succeed in getting the
12
+ // TypeScript compiler to infer a tuple type for the sources array, you
13
+ // could just use mergeDeep instead of mergeDeepArray, so instead of
14
+ // trying to convert T[] to an intersection type we just infer the array
15
+ // element type, which works perfectly when the sources array has a
16
+ // consistent element type.
11
17
  export function mergeDeepArray(sources) {
12
18
  var target = sources[0] || {};
13
19
  var count = sources.length;
@@ -22,7 +28,7 @@ export function mergeDeepArray(sources) {
22
28
  var defaultReconciler = function (target, source, property) {
23
29
  return this.merge(target[property], source[property]);
24
30
  };
25
- var DeepMerger = (function () {
31
+ var DeepMerger = /** @class */ (function () {
26
32
  function DeepMerger(reconciler) {
27
33
  if (reconciler === void 0) { reconciler = defaultReconciler; }
28
34
  this.reconciler = reconciler;
@@ -43,6 +49,8 @@ var DeepMerger = (function () {
43
49
  var result = _this.reconciler.apply(_this, __spreadArray([target,
44
50
  source,
45
51
  sourceKey], context, false));
52
+ // A well-implemented reconciler may return targetValue to indicate
53
+ // the merge changed nothing about the structure of the target.
46
54
  if (result !== targetValue) {
47
55
  target = _this.shallowCopyForMerge(target);
48
56
  target[sourceKey] = result;
@@ -50,12 +58,15 @@ var DeepMerger = (function () {
50
58
  }
51
59
  }
52
60
  else {
61
+ // If there is no collision, the target can safely share memory with
62
+ // the source, and the recursion can terminate here.
53
63
  target = _this.shallowCopyForMerge(target);
54
64
  target[sourceKey] = source[sourceKey];
55
65
  }
56
66
  });
57
67
  return target;
58
68
  }
69
+ // If source (or target) is not an object, let source replace target.
59
70
  return source;
60
71
  };
61
72
  DeepMerger.prototype.shallowCopyForMerge = function (value) {