@gravity-ui/data-source 0.9.0 → 0.10.0-alpha.0

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 (232) hide show
  1. package/build/cjs/core/types/DataSource.d.ts +8 -8
  2. package/build/cjs/core/types/DataSource.js.map +1 -1
  3. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
  4. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js +35 -0
  5. package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
  6. package/build/cjs/react/components/AsyncBoundary/index.d.ts +3 -0
  7. package/build/cjs/react/components/AsyncBoundary/index.js +20 -0
  8. package/build/cjs/react/components/AsyncBoundary/index.js.map +1 -0
  9. package/build/cjs/react/components/AsyncBoundary/types.d.ts +13 -0
  10. package/build/cjs/react/components/AsyncBoundary/types.js +6 -0
  11. package/build/cjs/react/components/AsyncBoundary/types.js.map +1 -0
  12. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
  13. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js +26 -0
  14. package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
  15. package/build/cjs/react/components/EmptyView/EmptyView.d.ts +2 -0
  16. package/build/cjs/react/components/EmptyView/EmptyView.js +10 -0
  17. package/build/cjs/react/components/EmptyView/EmptyView.js.map +1 -0
  18. package/build/cjs/react/components/EmptyView/index.d.ts +1 -0
  19. package/build/cjs/react/components/EmptyView/index.js +13 -0
  20. package/build/cjs/react/components/EmptyView/index.js.map +1 -0
  21. package/build/cjs/react/components/types.d.ts +1 -1
  22. package/build/cjs/react/components/types.js.map +1 -1
  23. package/build/cjs/react/index.d.ts +5 -3
  24. package/build/cjs/react/index.js +27 -3
  25. package/build/cjs/react/index.js.map +1 -1
  26. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
  27. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +23 -0
  28. package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
  29. package/build/cjs/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
  30. package/build/cjs/react-query/components/QueryAsyncBoundary/index.js +20 -0
  31. package/build/cjs/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
  32. package/build/cjs/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
  33. package/build/cjs/react-query/components/QueryAsyncBoundary/types.js +6 -0
  34. package/build/cjs/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
  35. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
  36. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +26 -0
  37. package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
  38. package/build/cjs/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
  39. package/build/cjs/react-query/hooks/useSuspenseQueryData.js +22 -0
  40. package/build/cjs/react-query/hooks/useSuspenseQueryData.js.map +1 -0
  41. package/build/cjs/react-query/index.d.ts +2 -0
  42. package/build/cjs/react-query/index.js +35 -0
  43. package/build/cjs/react-query/index.js.map +1 -1
  44. package/build/esm/core/types/DataSource.d.ts +8 -8
  45. package/build/esm/core/types/DataSource.js.map +1 -1
  46. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
  47. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js +28 -0
  48. package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
  49. package/build/esm/react/components/AsyncBoundary/index.d.ts +3 -0
  50. package/build/esm/react/components/AsyncBoundary/index.js +3 -0
  51. package/build/esm/react/components/AsyncBoundary/index.js.map +1 -0
  52. package/build/esm/react/components/AsyncBoundary/types.d.ts +13 -0
  53. package/build/esm/react/components/AsyncBoundary/types.js +2 -0
  54. package/build/esm/react/components/AsyncBoundary/types.js.map +1 -0
  55. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
  56. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js +19 -0
  57. package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
  58. package/build/esm/react/components/EmptyView/EmptyView.d.ts +2 -0
  59. package/build/esm/react/components/EmptyView/EmptyView.js +4 -0
  60. package/build/esm/react/components/EmptyView/EmptyView.js.map +1 -0
  61. package/build/esm/react/components/EmptyView/index.d.ts +1 -0
  62. package/build/esm/react/components/EmptyView/index.js +2 -0
  63. package/build/esm/react/components/EmptyView/index.js.map +1 -0
  64. package/build/esm/react/components/types.d.ts +1 -1
  65. package/build/esm/react/components/types.js.map +1 -1
  66. package/build/esm/react/index.d.ts +5 -3
  67. package/build/esm/react/index.js +4 -2
  68. package/build/esm/react/index.js.map +1 -1
  69. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
  70. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +16 -0
  71. package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
  72. package/build/esm/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
  73. package/build/esm/react-query/components/QueryAsyncBoundary/index.js +3 -0
  74. package/build/esm/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
  75. package/build/esm/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
  76. package/build/esm/react-query/components/QueryAsyncBoundary/types.js +2 -0
  77. package/build/esm/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
  78. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
  79. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +19 -0
  80. package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
  81. package/build/esm/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
  82. package/build/esm/react-query/hooks/useSuspenseQueryData.js +15 -0
  83. package/build/esm/react-query/hooks/useSuspenseQueryData.js.map +1 -0
  84. package/build/esm/react-query/index.d.ts +2 -0
  85. package/build/esm/react-query/index.js +2 -0
  86. package/build/esm/react-query/index.js.map +1 -1
  87. package/build/plugin/esbuild.d.mts +7 -0
  88. package/build/plugin/esbuild.mjs +6 -0
  89. package/build/plugin/factory-2tSt4Rte.mjs +513 -0
  90. package/build/plugin/index-mY40Sgl5.d.mts +24 -0
  91. package/build/plugin/index.d.mts +7 -0
  92. package/build/plugin/index.mjs +6 -0
  93. package/build/plugin/rollup.d.mts +6 -0
  94. package/build/plugin/rollup.mjs +6 -0
  95. package/build/plugin/rspack.d.mts +7 -0
  96. package/build/plugin/rspack.mjs +6 -0
  97. package/build/plugin/typings/client.d.ts +11 -0
  98. package/build/plugin/vite.d.mts +6 -0
  99. package/build/plugin/vite.mjs +6 -0
  100. package/build/plugin/webpack.d.mts +7 -0
  101. package/build/plugin/webpack.mjs +6 -0
  102. package/package.json +54 -5
  103. package/build/cjs/core/utils/__tests__/composeFullKey.test.js +0 -34
  104. package/build/cjs/core/utils/__tests__/composeFullKey.test.js.map +0 -1
  105. package/build/cjs/core/utils/__tests__/composeKey.test.js +0 -32
  106. package/build/cjs/core/utils/__tests__/composeKey.test.js.map +0 -1
  107. package/build/cjs/core/utils/__tests__/getError.test.js +0 -31
  108. package/build/cjs/core/utils/__tests__/getError.test.js.map +0 -1
  109. package/build/cjs/core/utils/__tests__/getStatus.test.js +0 -49
  110. package/build/cjs/core/utils/__tests__/getStatus.test.js.map +0 -1
  111. package/build/cjs/core/utils/__tests__/hasTag.test.js +0 -31
  112. package/build/cjs/core/utils/__tests__/hasTag.test.js.map +0 -1
  113. package/build/cjs/core/utils/__tests__/mergeStatuses.test.js +0 -25
  114. package/build/cjs/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
  115. package/build/cjs/core/utils/__tests__/skipContext.test.js +0 -70
  116. package/build/cjs/core/utils/__tests__/skipContext.test.js.map +0 -1
  117. package/build/cjs/core/utils/__tests__/withCancellation.test.js +0 -106
  118. package/build/cjs/core/utils/__tests__/withCancellation.test.js.map +0 -1
  119. package/build/cjs/core/utils/__tests__/withCatch.test.js +0 -208
  120. package/build/cjs/core/utils/__tests__/withCatch.test.js.map +0 -1
  121. package/build/cjs/react/__tests__/DataManagerContext.test.js +0 -47
  122. package/build/cjs/react/__tests__/DataManagerContext.test.js.map +0 -1
  123. package/build/cjs/react/__tests__/withDataManager.test.js +0 -61
  124. package/build/cjs/react/__tests__/withDataManager.test.js.map +0 -1
  125. package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -187
  126. package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
  127. package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js +0 -119
  128. package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
  129. package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js +0 -177
  130. package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
  131. package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js +0 -100
  132. package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
  133. package/build/cjs/react-query/__tests__/subscriptions.test.js +0 -1180
  134. package/build/cjs/react-query/__tests__/subscriptions.test.js.map +0 -1
  135. package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js +0 -659
  136. package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
  137. package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -229
  138. package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
  139. package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js +0 -55
  140. package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
  141. package/build/cjs/react-query/hooks/__tests__/useQueryData.refetch.test.js +0 -230
  142. package/build/cjs/react-query/hooks/__tests__/useQueryData.refetch.test.js.map +0 -1
  143. package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js +0 -97
  144. package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
  145. package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js +0 -77
  146. package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
  147. package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js +0 -79
  148. package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
  149. package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -117
  150. package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
  151. package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -156
  152. package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
  153. package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -295
  154. package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
  155. package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js +0 -27
  156. package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
  157. package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -76
  158. package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
  159. package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js +0 -30
  160. package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
  161. package/build/cjs/react-query/utils/__tests__/notReachable.test.js +0 -35
  162. package/build/cjs/react-query/utils/__tests__/notReachable.test.js.map +0 -1
  163. package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js +0 -27
  164. package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
  165. package/build/cjs/setupTests.d.ts +0 -1
  166. package/build/cjs/setupTests.js +0 -4
  167. package/build/cjs/setupTests.js.map +0 -1
  168. package/build/esm/core/utils/__tests__/composeFullKey.test.js +0 -32
  169. package/build/esm/core/utils/__tests__/composeFullKey.test.js.map +0 -1
  170. package/build/esm/core/utils/__tests__/composeKey.test.js +0 -30
  171. package/build/esm/core/utils/__tests__/composeKey.test.js.map +0 -1
  172. package/build/esm/core/utils/__tests__/getError.test.js +0 -29
  173. package/build/esm/core/utils/__tests__/getError.test.js.map +0 -1
  174. package/build/esm/core/utils/__tests__/getStatus.test.js +0 -47
  175. package/build/esm/core/utils/__tests__/getStatus.test.js.map +0 -1
  176. package/build/esm/core/utils/__tests__/hasTag.test.js +0 -29
  177. package/build/esm/core/utils/__tests__/hasTag.test.js.map +0 -1
  178. package/build/esm/core/utils/__tests__/mergeStatuses.test.js +0 -23
  179. package/build/esm/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
  180. package/build/esm/core/utils/__tests__/skipContext.test.js +0 -67
  181. package/build/esm/core/utils/__tests__/skipContext.test.js.map +0 -1
  182. package/build/esm/core/utils/__tests__/withCancellation.test.js +0 -104
  183. package/build/esm/core/utils/__tests__/withCancellation.test.js.map +0 -1
  184. package/build/esm/core/utils/__tests__/withCatch.test.js +0 -205
  185. package/build/esm/core/utils/__tests__/withCatch.test.js.map +0 -1
  186. package/build/esm/react/__tests__/DataManagerContext.test.js +0 -44
  187. package/build/esm/react/__tests__/DataManagerContext.test.js.map +0 -1
  188. package/build/esm/react/__tests__/withDataManager.test.js +0 -58
  189. package/build/esm/react/__tests__/withDataManager.test.js.map +0 -1
  190. package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -184
  191. package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
  192. package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js +0 -116
  193. package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
  194. package/build/esm/react-query/__tests__/createQueryNormalizer.test.js +0 -174
  195. package/build/esm/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
  196. package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js +0 -98
  197. package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
  198. package/build/esm/react-query/__tests__/subscriptions.test.js +0 -1176
  199. package/build/esm/react-query/__tests__/subscriptions.test.js.map +0 -1
  200. package/build/esm/react-query/__tests__/threeLevelIntegration.test.js +0 -656
  201. package/build/esm/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
  202. package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -227
  203. package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
  204. package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js +0 -52
  205. package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
  206. package/build/esm/react-query/hooks/__tests__/useQueryData.refetch.test.js +0 -227
  207. package/build/esm/react-query/hooks/__tests__/useQueryData.refetch.test.js.map +0 -1
  208. package/build/esm/react-query/hooks/__tests__/useQueryData.test.js +0 -95
  209. package/build/esm/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
  210. package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js +0 -74
  211. package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
  212. package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js +0 -77
  213. package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
  214. package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -115
  215. package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
  216. package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -154
  217. package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
  218. package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -292
  219. package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
  220. package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js +0 -25
  221. package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
  222. package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -74
  223. package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
  224. package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js +0 -28
  225. package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
  226. package/build/esm/react-query/utils/__tests__/notReachable.test.js +0 -33
  227. package/build/esm/react-query/utils/__tests__/notReachable.test.js.map +0 -1
  228. package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js +0 -25
  229. package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
  230. package/build/esm/setupTests.d.ts +0 -1
  231. package/build/esm/setupTests.js +0 -2
  232. package/build/esm/setupTests.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","renderHook","waitFor","ClientDataManager","DataSourceProvider","useQueryData","makePlainQueryDataSource","jsx","_jsx","describe","queryClient","dataManager","beforeEach","normalizerConfig","devLogging","afterEach","_dataManager$queryNor","queryNormalizer","unsubscribe","clear","it","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","customGetKey","customDataManager","queryKey","normalized","wrap","_callee2$","_context2","prev","next","jest","fn","obj","concat","id","getNormalizationObjectKey","subscribe","fetchQuery","queryFn","_queryFn","_callee","_callee$","_context","abrupt","name","stop","apply","arguments","normalize","getNormalizedData","expect","objects","toBeDefined","toHaveBeenCalled","_callee4","customGetArrayType","_callee4$","_context4","_ref3","arrayKey","getArrayType","_queryFn2","_callee3","_callee3$","_context3","items","_callee6","_callee6$","_context6","_queryFn3","_callee5","_callee5$","_context5","_callee8","_callee8$","_context8","_queryFn4","_callee7","_callee7$","_context7","toBeUndefined","_callee10","_callee10$","_context10","_queryFn5","_callee9","_callee9$","_context9","_callee12","wrapper","dataSource","_renderHook","result","_callee12$","_context12","_ref8","children","fetch","_fetch","_callee11","_callee11$","_context11","options","current","status","toBe","_callee15","dataSource1","dataSource2","_renderHook2","result1","_renderHook3","result2","_callee15$","_context15","_ref10","_fetch2","_callee13","_callee13$","_context13","_fetch3","_callee14","_callee14$","_context14","title","_callee16","dmWithOptimistic","initialData","data","_callee16$","_context16","optimistic","setQueryData","normalizer","setQuery","JSON","stringify","setNormalizedData","getQueryData","_callee17","dmWithOptimisticConfig","_callee17$","_context17","autoCalculateRollback","_callee18","dmWithInvalidate","_callee18$","_context18","invalidate","_callee19","dmWithBoth","_callee19$","_context19","_callee20","dm","_callee20$","_context20","update","_callee21","cache","invalidateSpy","_callee21$","_context21","getQueryCache","find","setState","fetchStatus","isInvalidated","spyOn","mockRestore","_callee22","originalGetQueriesToUpdate","_callee22$","_context22","email","age","getQueriesToUpdate","mockReturnValue"],"sources":["threeLevelIntegration.test.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {QueryClient} from '@tanstack/react-query';\nimport {renderHook, waitFor} from '@testing-library/react';\n\nimport {ClientDataManager} from '../ClientDataManager';\nimport {DataSourceProvider} from '../DataSourceProvider';\nimport {useQueryData} from '../hooks/useQueryData';\nimport {makePlainQueryDataSource} from '../impl/plain/factory';\n\ndescribe('Normalization Configuration Integration', () => {\n let queryClient: QueryClient;\n let dataManager: ClientDataManager;\n\n beforeEach(() => {\n dataManager = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n },\n });\n queryClient = dataManager.queryClient;\n });\n\n afterEach(() => {\n dataManager.queryNormalizer?.unsubscribe();\n queryClient.clear();\n });\n\n describe('ClientDataManager configuration', () => {\n it('should use custom getNormalizationObjectKey from config', async () => {\n const customGetKey = jest.fn((obj) => `custom:${obj.id}`);\n\n const customDataManager = new ClientDataManager({\n normalizerConfig: {\n getNormalizationObjectKey: customGetKey,\n devLogging: false,\n },\n });\n\n customDataManager.queryNormalizer!.subscribe();\n\n const queryKey = ['users'];\n\n await customDataManager.queryClient.fetchQuery({\n queryKey,\n queryFn: async () => [{id: '1', name: 'User 1'}],\n normalize: true,\n } as Parameters<typeof customDataManager.queryClient.fetchQuery>[0] & {\n normalize: boolean;\n });\n\n const normalized = customDataManager.queryNormalizer!.getNormalizedData();\n\n expect(normalized.objects['@@custom:1']).toBeDefined();\n expect(customGetKey).toHaveBeenCalled();\n\n customDataManager.queryNormalizer!.unsubscribe();\n customDataManager.queryClient.clear();\n });\n\n it('should use custom getArrayType from config', async () => {\n const customGetArrayType = jest.fn(({arrayKey}) => `custom:${arrayKey}`);\n\n const customDataManager = new ClientDataManager({\n normalizerConfig: {\n getArrayType: customGetArrayType,\n devLogging: false,\n },\n });\n\n customDataManager.queryNormalizer!.subscribe();\n\n const queryKey = ['items'];\n\n await customDataManager.queryClient.fetchQuery({\n queryKey,\n queryFn: async () => ({\n items: [{id: '1', name: 'Item 1'}],\n }),\n normalize: true,\n } as Parameters<typeof customDataManager.queryClient.fetchQuery>[0] & {\n normalize: boolean;\n });\n\n expect(customGetArrayType).toHaveBeenCalled();\n\n customDataManager.queryNormalizer!.unsubscribe();\n customDataManager.queryClient.clear();\n });\n });\n\n describe('Query-level normalization control', () => {\n it('should normalize when query has normalize: true', async () => {\n dataManager.queryNormalizer!.subscribe();\n\n const queryKey = ['users-normalized'];\n\n await dataManager.queryClient.fetchQuery({\n queryKey,\n queryFn: async () => [{id: '1', name: 'User 1'}],\n normalize: true,\n } as Parameters<typeof dataManager.queryClient.fetchQuery>[0] & {normalize: boolean});\n\n const normalized = dataManager.queryNormalizer!.getNormalizedData();\n\n // Data SHOULD be normalized\n expect(normalized.objects['@@1']).toBeDefined();\n });\n\n it('should NOT normalize when query has normalize: false', async () => {\n dataManager.queryNormalizer!.subscribe();\n\n const queryKey = ['users-not-normalized'];\n\n await dataManager.queryClient.fetchQuery({\n queryKey,\n queryFn: async () => [{id: '2', name: 'User 2'}],\n normalize: false,\n } as Parameters<typeof dataManager.queryClient.fetchQuery>[0] & {normalize: boolean});\n\n const normalized = dataManager.queryNormalizer!.getNormalizedData();\n\n // Data should NOT be normalized\n expect(normalized.objects['@@2']).toBeUndefined();\n });\n\n it('should normalize by default when normalize option is not provided', async () => {\n dataManager.queryNormalizer!.subscribe();\n\n const queryKey = ['users-default'];\n\n await dataManager.queryClient.fetchQuery({\n queryKey,\n queryFn: async () => [{id: '3', name: 'User 3'}],\n });\n\n const normalized = dataManager.queryNormalizer!.getNormalizedData();\n\n // Data SHOULD be normalized (default behavior is now true)\n expect(normalized.objects['@@3']).toBeDefined();\n });\n });\n\n describe('DataSourceProvider integration', () => {\n it('should auto-subscribe queryNormalizer on mount', async () => {\n const wrapper = ({children}: {children: React.ReactNode}) => (\n <DataSourceProvider dataManager={dataManager}>{children}</DataSourceProvider>\n );\n\n const dataSource = makePlainQueryDataSource({\n name: 'users',\n fetch: async () => [{id: '1', name: 'User 1'}],\n options: {\n normalize: true,\n },\n });\n\n const {result} = renderHook(() => useQueryData(dataSource, {}), {wrapper});\n\n await waitFor(() => expect(result.current.status).toBe('success'));\n\n const normalized = dataManager.queryNormalizer!.getNormalizedData();\n\n // Data should be normalized because DataSourceProvider subscribes automatically\n expect(normalized.objects['@@1']).toBeDefined();\n });\n\n it('should work with multiple queries', async () => {\n const wrapper = ({children}: {children: React.ReactNode}) => (\n <DataSourceProvider dataManager={dataManager}>{children}</DataSourceProvider>\n );\n\n const dataSource1 = makePlainQueryDataSource({\n name: 'users',\n fetch: async () => [{id: '1', name: 'User 1'}],\n options: {\n normalize: true,\n },\n });\n\n const dataSource2 = makePlainQueryDataSource({\n name: 'posts',\n fetch: async () => [{id: '2', title: 'Post 1'}],\n options: {\n normalize: true,\n },\n });\n\n const {result: result1} = renderHook(() => useQueryData(dataSource1, {}), {wrapper});\n const {result: result2} = renderHook(() => useQueryData(dataSource2, {}), {wrapper});\n\n await waitFor(() => {\n expect(result1.current.status).toBe('success');\n expect(result2.current.status).toBe('success');\n });\n\n const normalized = dataManager.queryNormalizer!.getNormalizedData();\n\n expect(normalized.objects['@@1']).toBeDefined();\n expect(normalized.objects['@@2']).toBeDefined();\n });\n });\n\n describe('Optimistic updates configuration', () => {\n it('should enable optimistic updates when configured', async () => {\n const dmWithOptimistic = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n optimistic: true,\n },\n });\n\n expect(dmWithOptimistic.queryNormalizer).toBeDefined();\n\n dmWithOptimistic.queryNormalizer!.subscribe();\n\n const queryKey = ['users'];\n const initialData = [{id: '1', name: 'Old'}];\n\n dmWithOptimistic.queryClient.setQueryData(queryKey, initialData);\n dmWithOptimistic.normalizer!.setQuery(JSON.stringify(queryKey), initialData);\n\n // Manual optimistic update via setNormalizedData\n dmWithOptimistic.queryNormalizer!.setNormalizedData({id: '1', name: 'New'});\n\n const data = dmWithOptimistic.queryClient.getQueryData(queryKey) as Array<{\n id: string;\n name: string;\n }>;\n expect(data[0].name).toBe('New');\n\n dmWithOptimistic.queryNormalizer!.unsubscribe();\n dmWithOptimistic.queryClient.clear();\n });\n\n it('should work with optimistic config object', async () => {\n const dmWithOptimisticConfig = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n optimistic: {\n autoCalculateRollback: true,\n devLogging: false,\n },\n },\n });\n\n expect(dmWithOptimisticConfig.queryNormalizer).toBeDefined();\n expect(dmWithOptimisticConfig.normalizer).toBeDefined();\n\n dmWithOptimisticConfig.queryClient.clear();\n });\n });\n\n describe('Invalidate configuration', () => {\n it('should support invalidate option in global config', async () => {\n const dmWithInvalidate = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n invalidate: true,\n },\n });\n\n expect(dmWithInvalidate.queryNormalizer).toBeDefined();\n expect(dmWithInvalidate.normalizer).toBeDefined();\n\n dmWithInvalidate.queryClient.clear();\n });\n\n it('should support both optimistic and invalidate options', async () => {\n const dmWithBoth = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n optimistic: true,\n invalidate: true,\n },\n });\n\n expect(dmWithBoth.queryNormalizer).toBeDefined();\n expect(dmWithBoth.normalizer).toBeDefined();\n\n dmWithBoth.queryClient.clear();\n });\n });\n\n describe('ClientDataManager.update()', () => {\n it('should work with array of objects for optimistic update', async () => {\n const dm = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n optimistic: true,\n },\n });\n\n dm.queryNormalizer!.subscribe();\n\n const queryKey = ['users'];\n const initialData = [\n {id: '1', name: 'User 1'},\n {id: '2', name: 'User 2'},\n ];\n\n dm.queryClient.setQueryData(queryKey, initialData);\n dm.normalizer!.setQuery(JSON.stringify(queryKey), initialData);\n\n // Update both objects\n dm.update([\n {id: '1', name: 'Updated 1'},\n {id: '2', name: 'Updated 2'},\n ]);\n\n const data = dm.queryClient.getQueryData(queryKey) as Array<{\n id: string;\n name: string;\n }>;\n\n expect(data[0].name).toBe('Updated 1');\n expect(data[1].name).toBe('Updated 2');\n\n dm.queryNormalizer!.unsubscribe();\n dm.queryClient.clear();\n });\n\n it('should call invalidateData when invalidate option is enabled', async () => {\n const dm = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n invalidate: true,\n },\n });\n\n dm.queryNormalizer!.subscribe();\n\n const queryKey = ['users'];\n const initialData = [{id: '1', name: 'User 1'}];\n\n dm.queryClient.setQueryData(queryKey, initialData);\n dm.normalizer!.setQuery(JSON.stringify(queryKey), initialData);\n\n // Set query state to success so it can be invalidated\n const cache = dm.queryClient.getQueryCache().find({queryKey});\n cache?.setState({status: 'success', fetchStatus: 'idle', isInvalidated: false});\n\n const invalidateSpy = jest.spyOn(dm, 'invalidateData');\n\n dm.update({id: '1', name: 'Updated'});\n\n expect(invalidateSpy).toHaveBeenCalled();\n\n invalidateSpy.mockRestore();\n dm.queryNormalizer!.unsubscribe();\n dm.queryClient.clear();\n });\n\n it('should trigger refetch when mutation has fewer keys and normy returns empty queriesToUpdate', async () => {\n // checkMutationObjectsKeys is called only when getQueriesToUpdate returns []\n // This happens when normy can't compute a diff (e.g., structure mismatch)\n const dm = new ClientDataManager({\n normalizerConfig: {\n devLogging: false,\n invalidate: true, // Need to enable invalidate for refetch to work\n },\n });\n\n dm.queryNormalizer!.subscribe();\n\n const queryKey = ['users'];\n // Store data with more keys\n const initialData = [{id: '1', name: 'User 1', email: 'user@test.com', age: 25}];\n\n dm.queryClient.setQueryData(queryKey, initialData);\n dm.normalizer!.setQuery(JSON.stringify(queryKey), initialData);\n\n // Set query state to success so it can be invalidated\n const cache = dm.queryClient.getQueryCache().find({queryKey});\n cache?.setState({status: 'success', fetchStatus: 'idle', isInvalidated: false});\n\n // Mock getQueriesToUpdate to return empty array (simulating normy can't compute diff)\n const originalGetQueriesToUpdate = dm.normalizer!.getQueriesToUpdate;\n dm.normalizer!.getQueriesToUpdate = jest.fn().mockReturnValue([]);\n\n const invalidateSpy = jest.spyOn(dm.queryClient, 'invalidateQueries');\n\n // Update with fewer keys - should trigger refetch via checkMutationObjectsKeys\n dm.update({id: '1', name: 'Updated'});\n\n // Check if invalidation was triggered due to fewer keys\n expect(invalidateSpy).toHaveBeenCalled();\n\n // Restore mocks\n dm.normalizer!.getQueriesToUpdate = originalGetQueriesToUpdate;\n invalidateSpy.mockRestore();\n dm.queryNormalizer!.unsubscribe();\n dm.queryClient.clear();\n });\n });\n});\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,UAAU,EAAEC,OAAO,QAAO,wBAAwB;AAE1D,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,kBAAkB,QAAO,uBAAuB;AACxD,SAAQC,YAAY,QAAO,uBAAuB;AAClD,SAAQC,wBAAwB,QAAO,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/DC,QAAQ,CAAC,yCAAyC,EAAE,YAAM;EACtD,IAAIC,WAAwB;EAC5B,IAAIC,WAA8B;EAElCC,UAAU,CAAC,YAAM;IACbD,WAAW,GAAG,IAAIR,iBAAiB,CAAC;MAChCU,gBAAgB,EAAE;QACdC,UAAU,EAAE;MAChB;IACJ,CAAC,CAAC;IACFJ,WAAW,GAAGC,WAAW,CAACD,WAAW;EACzC,CAAC,CAA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SAAA;IAAA,CAC1B,GAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,227 +0,0 @@
1
- import { ClientDataManager } from '../ClientDataManager';
2
- describe('updateQueriesFromMutationData', function () {
3
- var dataManager;
4
- beforeEach(function () {
5
- dataManager = new ClientDataManager({
6
- defaultOptions: {
7
- queries: {
8
- retry: false
9
- },
10
- mutations: {
11
- retry: false
12
- }
13
- },
14
- normalizerConfig: {
15
- devLogging: false
16
- }
17
- });
18
- });
19
- afterEach(function () {
20
- dataManager.queryClient.clear();
21
- });
22
- it('should update query data based on normalized data', function () {
23
- expect(dataManager.normalizer).toBeDefined();
24
-
25
- // Set initial data in query
26
- var queryKey = ['users'];
27
- dataManager.queryClient.setQueryData(queryKey, [{
28
- id: '1',
29
- name: 'Old Name'
30
- }]);
31
-
32
- // Add query to normalizer
33
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
34
- id: '1',
35
- name: 'Old Name'
36
- }]);
37
-
38
- // Update data via mutation
39
- var mutationData = {
40
- id: '1',
41
- name: 'New Name'
42
- };
43
- dataManager.optimisticUpdate(mutationData);
44
-
45
- // Verify that data was updated
46
- var updatedData = dataManager.queryClient.getQueryData(queryKey);
47
- expect(updatedData).toBeDefined();
48
- expect(updatedData[0].name).toBe('New Name');
49
- });
50
- it('should update multiple queries with the same object', function () {
51
- expect(dataManager.normalizer).toBeDefined();
52
- var queryKey1 = ['users'];
53
- var queryKey2 = ['user', '1'];
54
-
55
- // Set data in both queries
56
- dataManager.queryClient.setQueryData(queryKey1, [{
57
- id: '1',
58
- name: 'User 1'
59
- }]);
60
- dataManager.queryClient.setQueryData(queryKey2, {
61
- id: '1',
62
- name: 'User 1'
63
- });
64
-
65
- // Add to normalizer
66
- dataManager.normalizer.setQuery(JSON.stringify(queryKey1), [{
67
- id: '1',
68
- name: 'User 1'
69
- }]);
70
- dataManager.normalizer.setQuery(JSON.stringify(queryKey2), {
71
- id: '1',
72
- name: 'User 1'
73
- });
74
-
75
- // Update via mutation
76
- var mutationData = {
77
- id: '1',
78
- name: 'Updated User'
79
- };
80
- dataManager.optimisticUpdate(mutationData);
81
-
82
- // Check both queries
83
- var data1 = dataManager.queryClient.getQueryData(queryKey1);
84
- var data2 = dataManager.queryClient.getQueryData(queryKey2);
85
- expect(data1[0].name).toBe('Updated User');
86
- expect(data2.name).toBe('Updated User');
87
- });
88
- it('should preserve dataUpdatedAt on update', function () {
89
- expect(dataManager.normalizer).toBeDefined();
90
- var queryKey = ['users'];
91
- var originalUpdatedAt = Date.now();
92
-
93
- // Set initial data
94
- dataManager.queryClient.setQueryData(queryKey, [{
95
- id: '1',
96
- name: 'Old'
97
- }], {
98
- updatedAt: originalUpdatedAt
99
- });
100
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
101
- id: '1',
102
- name: 'Old'
103
- }]);
104
-
105
- // Update data
106
- var mutationData = {
107
- id: '1',
108
- name: 'New'
109
- };
110
- dataManager.optimisticUpdate(mutationData);
111
-
112
- // Verify that dataUpdatedAt was preserved
113
- var cachedQuery = dataManager.queryClient.getQueryCache().find({
114
- queryKey: queryKey
115
- });
116
- expect(cachedQuery === null || cachedQuery === void 0 ? void 0 : cachedQuery.state.dataUpdatedAt).toBe(originalUpdatedAt);
117
- });
118
- it('should preserve error state on update', function () {
119
- expect(dataManager.normalizer).toBeDefined();
120
- var queryKey = ['users'];
121
- var error = new Error('Test error');
122
-
123
- // Set initial data with error
124
- dataManager.queryClient.setQueryData(queryKey, [{
125
- id: '1',
126
- name: 'Old'
127
- }]);
128
- var cachedQuery = dataManager.queryClient.getQueryCache().find({
129
- queryKey: queryKey
130
- });
131
- cachedQuery === null || cachedQuery === void 0 || cachedQuery.setState({
132
- error: error,
133
- status: 'error'
134
- });
135
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
136
- id: '1',
137
- name: 'Old'
138
- }]);
139
-
140
- // Update data
141
- var mutationData = {
142
- id: '1',
143
- name: 'New'
144
- };
145
- dataManager.optimisticUpdate(mutationData);
146
-
147
- // Verify that error and status were preserved
148
- var updatedQuery = dataManager.queryClient.getQueryCache().find({
149
- queryKey: queryKey
150
- });
151
- expect(updatedQuery === null || updatedQuery === void 0 ? void 0 : updatedQuery.state.error).toBe(error);
152
- expect(updatedQuery === null || updatedQuery === void 0 ? void 0 : updatedQuery.state.status).toBe('error');
153
- });
154
- it('should preserve isInvalidated flag on update', function () {
155
- expect(dataManager.normalizer).toBeDefined();
156
- var queryKey = ['users'];
157
-
158
- // Set initial data and invalidate
159
- dataManager.queryClient.setQueryData(queryKey, [{
160
- id: '1',
161
- name: 'Old'
162
- }]);
163
- dataManager.queryClient.invalidateQueries({
164
- queryKey: queryKey
165
- });
166
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
167
- id: '1',
168
- name: 'Old'
169
- }]);
170
- var cachedQueryBefore = dataManager.queryClient.getQueryCache().find({
171
- queryKey: queryKey
172
- });
173
- var isInvalidatedBefore = cachedQueryBefore === null || cachedQueryBefore === void 0 ? void 0 : cachedQueryBefore.state.isInvalidated;
174
-
175
- // Update data
176
- var mutationData = {
177
- id: '1',
178
- name: 'New'
179
- };
180
- dataManager.optimisticUpdate(mutationData);
181
-
182
- // Verify that isInvalidated was preserved
183
- var cachedQueryAfter = dataManager.queryClient.getQueryCache().find({
184
- queryKey: queryKey
185
- });
186
- expect(cachedQueryAfter === null || cachedQueryAfter === void 0 ? void 0 : cachedQueryAfter.state.isInvalidated).toBe(isInvalidatedBefore);
187
- });
188
- it('should work correctly with nested objects', function () {
189
- expect(dataManager.normalizer).toBeDefined();
190
- var queryKey = ['posts'];
191
- var initialData = [{
192
- id: '1',
193
- title: 'Post 1',
194
- author: {
195
- id: '10',
196
- name: 'Author 1'
197
- }
198
- }];
199
- dataManager.queryClient.setQueryData(queryKey, initialData);
200
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), initialData);
201
-
202
- // Update author
203
- var mutationData = {
204
- id: '10',
205
- name: 'Updated Author'
206
- };
207
- dataManager.optimisticUpdate(mutationData);
208
-
209
- // Verify that author was updated
210
- var data = dataManager.queryClient.getQueryData(queryKey);
211
- expect(data[0].author.name).toBe('Updated Author');
212
- });
213
- it('should not throw if query is not in cache', function () {
214
- expect(dataManager.normalizer).toBeDefined();
215
- var mutationData = {
216
- id: '1',
217
- name: 'New'
218
- };
219
-
220
- // Don't add query to cache, only to normalizer
221
- // This should not throw an error
222
- expect(function () {
223
- dataManager.optimisticUpdate(mutationData);
224
- }).not.toThrow();
225
- });
226
- });
227
- // #sourceMappingURL=updateQueriesFromMutationData.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ClientDataManager","describe","dataManager","beforeEach","defaultOptions","queries","retry","mutations","normalizerConfig","devLogging","afterEach","queryClient","clear","it","expect","normalizer","toBeDefined","queryKey","setQueryData","id","name","setQuery","JSON","stringify","mutationData","optimisticUpdate","updatedData","getQueryData","toBe","queryKey1","queryKey2","data1","data2","originalUpdatedAt","Date","now","updatedAt","cachedQuery","getQueryCache","find","state","dataUpdatedAt","error","Error","setState","status","updatedQuery","invalidateQueries","cachedQueryBefore","isInvalidatedBefore","isInvalidated","cachedQueryAfter","initialData","title","author","data","not","toThrow"],"sources":["updateQueriesFromMutationData.test.tsx"],"sourcesContent":["import type {Data} from '@normy/core';\n\nimport {ClientDataManager} from '../ClientDataManager';\n\ndescribe('updateQueriesFromMutationData', () => {\n let dataManager: ClientDataManager;\n\n beforeEach(() => {\n dataManager = new ClientDataManager({\n defaultOptions: {\n queries: {retry: false},\n mutations: {retry: false},\n },\n normalizerConfig: {\n devLogging: false,\n },\n });\n });\n\n afterEach(() => {\n dataManager.queryClient.clear();\n });\n\n it('should update query data based on normalized data', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n // Set initial data in query\n const queryKey = ['users'];\n dataManager.queryClient.setQueryData(queryKey, [{id: '1', name: 'Old Name'}]);\n\n // Add query to normalizer\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey), [{id: '1', name: 'Old Name'}]);\n\n // Update data via mutation\n const mutationData: Data = {id: '1', name: 'New Name'};\n\n dataManager.optimisticUpdate(mutationData);\n\n // Verify that data was updated\n const updatedData = dataManager.queryClient.getQueryData(queryKey) as Array<{\n id: string;\n name: string;\n }>;\n expect(updatedData).toBeDefined();\n expect(updatedData[0].name).toBe('New Name');\n });\n\n it('should update multiple queries with the same object', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const queryKey1 = ['users'];\n const queryKey2 = ['user', '1'];\n\n // Set data in both queries\n dataManager.queryClient.setQueryData(queryKey1, [{id: '1', name: 'User 1'}]);\n dataManager.queryClient.setQueryData(queryKey2, {id: '1', name: 'User 1'});\n\n // Add to normalizer\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey1), [{id: '1', name: 'User 1'}]);\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey2), {id: '1', name: 'User 1'});\n\n // Update via mutation\n const mutationData: Data = {id: '1', name: 'Updated User'};\n dataManager.optimisticUpdate(mutationData);\n\n // Check both queries\n const data1 = dataManager.queryClient.getQueryData(queryKey1) as Array<{\n id: string;\n name: string;\n }>;\n const data2 = dataManager.queryClient.getQueryData(queryKey2) as {id: string; name: string};\n\n expect(data1[0].name).toBe('Updated User');\n expect(data2.name).toBe('Updated User');\n });\n\n it('should preserve dataUpdatedAt on update', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const queryKey = ['users'];\n const originalUpdatedAt = Date.now();\n\n // Set initial data\n dataManager.queryClient.setQueryData(queryKey, [{id: '1', name: 'Old'}], {\n updatedAt: originalUpdatedAt,\n });\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey), [{id: '1', name: 'Old'}]);\n\n // Update data\n const mutationData: Data = {id: '1', name: 'New'};\n dataManager.optimisticUpdate(mutationData);\n\n // Verify that dataUpdatedAt was preserved\n const cachedQuery = dataManager.queryClient.getQueryCache().find({queryKey});\n expect(cachedQuery?.state.dataUpdatedAt).toBe(originalUpdatedAt);\n });\n\n it('should preserve error state on update', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const queryKey = ['users'];\n const error = new Error('Test error');\n\n // Set initial data with error\n dataManager.queryClient.setQueryData(queryKey, [{id: '1', name: 'Old'}]);\n const cachedQuery = dataManager.queryClient.getQueryCache().find({queryKey});\n cachedQuery?.setState({error, status: 'error'});\n\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey), [{id: '1', name: 'Old'}]);\n\n // Update data\n const mutationData: Data = {id: '1', name: 'New'};\n dataManager.optimisticUpdate(mutationData);\n\n // Verify that error and status were preserved\n const updatedQuery = dataManager.queryClient.getQueryCache().find({queryKey});\n expect(updatedQuery?.state.error).toBe(error);\n expect(updatedQuery?.state.status).toBe('error');\n });\n\n it('should preserve isInvalidated flag on update', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const queryKey = ['users'];\n\n // Set initial data and invalidate\n dataManager.queryClient.setQueryData(queryKey, [{id: '1', name: 'Old'}]);\n dataManager.queryClient.invalidateQueries({queryKey});\n\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey), [{id: '1', name: 'Old'}]);\n\n const cachedQueryBefore = dataManager.queryClient.getQueryCache().find({queryKey});\n const isInvalidatedBefore = cachedQueryBefore?.state.isInvalidated;\n\n // Update data\n const mutationData: Data = {id: '1', name: 'New'};\n dataManager.optimisticUpdate(mutationData);\n\n // Verify that isInvalidated was preserved\n const cachedQueryAfter = dataManager.queryClient.getQueryCache().find({queryKey});\n expect(cachedQueryAfter?.state.isInvalidated).toBe(isInvalidatedBefore);\n });\n\n it('should work correctly with nested objects', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const queryKey = ['posts'];\n const initialData = [\n {\n id: '1',\n title: 'Post 1',\n author: {id: '10', name: 'Author 1'},\n },\n ];\n\n dataManager.queryClient.setQueryData(queryKey, initialData);\n dataManager.normalizer!.setQuery(JSON.stringify(queryKey), initialData);\n\n // Update author\n const mutationData: Data = {id: '10', name: 'Updated Author'};\n dataManager.optimisticUpdate(mutationData);\n\n // Verify that author was updated\n const data = dataManager.queryClient.getQueryData(queryKey) as Array<{\n id: string;\n title: string;\n author: {id: string; name: string};\n }>;\n expect(data[0].author.name).toBe('Updated Author');\n });\n\n it('should not throw if query is not in cache', () => {\n expect(dataManager.normalizer).toBeDefined();\n\n const mutationData: Data = {id: '1', name: 'New'};\n\n // Don't add query to cache, only to normalizer\n // This should not throw an error\n expect(() => {\n dataManager.optimisticUpdate(mutationData);\n }).not.toThrow();\n });\n});\n"],"mappings":"AAEA,SAAQA,iBAAiB,QAAO,sBAAsB;AAEtDC,QAAQ,CAAC,+BAA+B,EAAE,YAAM;EAC5C,IAAIC,WAA8B;EAElCC,UAAU,CAAC,YAAM;IACbD,WAAW,GAAG,IAAIF,iBAAiB,CAAC;MAChCI,cAAc,EAAE;QACZC,OAAO,EAAE;UAACC,KAAK,EAAE;QAAK,CAAC;QACvBC,SAAS,EAAE;UAACD,KAAK,EAAE;QAAK;MAC5B,CAAC;MACDE,gBAAgB,EAAE;QACdC,UAAU,EAAE;MAChB;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFC,SAAS,CAAC,YAAM;IACZR,WAAW,CAACS,WAAW,CAACC,KAAK,CAAC,CAAC;EACnC,CAAC,CAAC;EAEFC,EAAE,CAAC,mDAAmD,EAAE,YAAM;IAC1DC,MAAM,CAACZ,WAAW,CAACa,UAAU,CAAC,CAACC,WAAW,CAAC,CAAC;;IAE5C;IACA,IAAMC,QAAQ,GAAG,CAAC,OAAO,CAAC;IAC1Bf,WAAW,CAACS,WAAW,CAACO,YAAY,CAACD,QAAQ,EAAE,CAAC;MAACE,EAAE,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAU,CAAC,CAAC,CAAC;;IAE7E;IACAlB,WAAW,CAACa,UAAU,CAAEM,QAAQ,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,EAAE,CAAC;MAACE,EAAE,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAU,CAAC,CAAC,CAAC;;IAEzF;IACA,IAAMI,YAAk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IAAK,CAAC;;IAEjD;IACA;IACAN,MAAM,CAAC,YAAM;MACTZ,WAAW,CAACuB,gBAAgB,CAACD,YAAY,CAAC;IAC9C,CAAC,CAAC,CAACgC,GAAG,CAACC,OAAO,CAAC,CAAC;EACpB,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,52 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import { QueryClient, useQueryClient } from '@tanstack/react-query';
3
- import { renderHook } from '@testing-library/react';
4
- import { useQueryContext } from '../useQueryContext';
5
- jest.mock('@tanstack/react-query', function () {
6
- var originalModule = jest.requireActual('@tanstack/react-query');
7
- return _objectSpread(_objectSpread({}, originalModule), {}, {
8
- useQueryClient: jest.fn()
9
- });
10
- });
11
- describe('useQueryContext', function () {
12
- var mockQueryClient = new QueryClient();
13
- beforeEach(function () {
14
- jest.clearAllMocks();
15
- useQueryClient.mockReturnValue(mockQueryClient);
16
- });
17
- it('should return context with queryClient', function () {
18
- var _renderHook = renderHook(function () {
19
- return useQueryContext();
20
- }),
21
- result = _renderHook.result;
22
- expect(result.current).toEqual({
23
- queryClient: mockQueryClient
24
- });
25
- });
26
- it('should memoize the context', function () {
27
- var _renderHook2 = renderHook(function () {
28
- return useQueryContext();
29
- }),
30
- result = _renderHook2.result,
31
- rerender = _renderHook2.rerender;
32
- var firstResult = result.current;
33
- rerender();
34
- expect(result.current).toBe(firstResult);
35
- });
36
- it('should update context when queryClient changes', function () {
37
- var _renderHook3 = renderHook(function () {
38
- return useQueryContext();
39
- }),
40
- result = _renderHook3.result,
41
- rerender = _renderHook3.rerender;
42
- var firstResult = result.current;
43
- var newMockQueryClient = new QueryClient();
44
- useQueryClient.mockReturnValue(newMockQueryClient);
45
- rerender();
46
- expect(result.current).not.toBe(firstResult);
47
- expect(result.current).toEqual({
48
- queryClient: newMockQueryClient
49
- });
50
- });
51
- });
52
- // #sourceMappingURL=useQueryContext.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["QueryClient","useQueryClient","renderHook","useQueryContext","jest","mock","originalModule","requireActual","_objectSpread","fn","describe","mockQueryClient","beforeEach","clearAllMocks","mockReturnValue","it","_renderHook","result","expect","current","toEqual","queryClient","_renderHook2","rerender","firstResult","toBe","_renderHook3","newMockQueryClient","not"],"sources":["useQueryContext.test.ts"],"sourcesContent":["import {QueryClient, useQueryClient} from '@tanstack/react-query';\nimport {renderHook} from '@testing-library/react';\n\nimport {useQueryContext} from '../useQueryContext';\n\njest.mock('@tanstack/react-query', () => {\n const originalModule = jest.requireActual('@tanstack/react-query');\n return {\n ...originalModule,\n useQueryClient: jest.fn(),\n };\n});\n\ndescribe('useQueryContext', () => {\n const mockQueryClient = new QueryClient();\n\n beforeEach(() => {\n jest.clearAllMocks();\n\n (useQueryClient as jest.Mock).mockReturnValue(mockQueryClient);\n });\n\n it('should return context with queryClient', () => {\n const {result} = renderHook(() => useQueryContext());\n\n expect(result.current).toEqual({queryClient: mockQueryClient});\n });\n\n it('should memoize the context', () => {\n const {result, rerender} = renderHook(() => useQueryContext());\n\n const firstResult = result.current;\n\n rerender();\n\n expect(result.current).toBe(firstResult);\n });\n\n it('should update context when queryClient changes', () => {\n const {result, rerender} = renderHook(() => useQueryContext());\n\n const firstResult = result.current;\n\n const newMockQueryClient = new QueryClient();\n\n (useQueryClient as jest.Mock).mockReturnValue(newMockQueryClient);\n\n rerender();\n\n expect(result.current).not.toBe(firstResult);\n expect(result.current).toEqual({queryClient: newMockQueryClient});\n });\n});\n"],"mappings":";AAAA,SAAQA,WAAW,EAAEC,cAAc,QAAO,uBAAuB;AACjE,SAAQC,UAAU,QAAO,wBAAwB;AAEjD,SAAQC,eAAe,QAAO,oBAAoB;AAElDC,IAAI,CAACC,IAAI,CAAC,uBAAuB,EAAE,YAAM;EACrC,IAAMC,cAAc,GAAGF,IAAI,CAACG,aAAa,CAAC,uBAAuB,CAAC;EAClE,OAAAC,aAAA,CAAAA,aAAA,KACOF,cAAc;IACjBL,cAAc,E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AE3CC,cAAc,CAAea,eAAe,CAACa,kBAAkB,CAAC;IAEjEJ,QAAQ,CAAC,CAAC;IAEVL,MAAM,CAACD,MAAM,CAACE,OAAO,CAAC,CAACS,GAAG,CAACH,IAAI,CAACD,WAAW,CAAC;IAC5CN,MAAM,CAACD,MAAM,CAACE,OAAO,CAAC,CAACC,OAAO,CAAC;MAACC,WAAW,EAAEM;IAAkB,CAAC,CAAC;EACrE,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,227 +0,0 @@
1
- import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
- import { QueryClient, useInfiniteQuery, useQuery } from '@tanstack/react-query';
5
- import { renderHook } from '@testing-library/react';
6
- import { idle } from '../../../core';
7
- import { warnDisabledRefetch } from '../../utils/warnDisabledRefetch';
8
- import { useQueryContext } from '../useQueryContext';
9
- import { useQueryData } from '../useQueryData';
10
- jest.mock('@tanstack/react-query', function () {
11
- return _objectSpread(_objectSpread({}, jest.requireActual('@tanstack/react-query')), {}, {
12
- useQuery: jest.fn(),
13
- useInfiniteQuery: jest.fn()
14
- });
15
- });
16
- jest.mock('../useQueryContext');
17
- jest.mock('../../utils/warnDisabledRefetch');
18
- var mockUseQuery = useQuery;
19
- var mockUseInfiniteQuery = useInfiniteQuery;
20
- var mockWarnDisabledRefetch = warnDisabledRefetch;
21
- describe('useQueryData refetch behavior', function () {
22
- var mockQueryClient = new QueryClient();
23
- var mockContext = {
24
- queryClient: mockQueryClient
25
- };
26
- beforeEach(function () {
27
- jest.clearAllMocks();
28
- useQueryContext.mockReturnValue(mockContext);
29
- });
30
- var createMockQueryResult = function createMockQueryResult() {
31
- var refetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : jest.fn();
32
- return {
33
- data: 'test-data',
34
- error: null,
35
- status: 'success',
36
- fetchStatus: 'idle',
37
- isLoading: false,
38
- isError: false,
39
- isSuccess: true,
40
- isPending: false,
41
- refetch: refetch,
42
- dataUpdatedAt: Date.now(),
43
- errorUpdatedAt: 0,
44
- failureCount: 0,
45
- failureReason: null,
46
- isFetched: true,
47
- isFetchedAfterMount: true,
48
- isFetching: false,
49
- isInitialLoading: false,
50
- isLoadingError: false,
51
- isPaused: false,
52
- isPlaceholderData: false,
53
- isPreviousData: false,
54
- isRefetchError: false,
55
- isRefetching: false,
56
- isStale: false,
57
- promise: Promise.resolve('test-data')
58
- };
59
- };
60
- var createMockInfiniteResult = function createMockInfiniteResult() {
61
- var refetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : jest.fn();
62
- return {
63
- data: {
64
- pages: [['item1'], ['item2']],
65
- pageParams: [undefined, 'next-page']
66
- },
67
- error: null,
68
- status: 'success',
69
- fetchStatus: 'idle',
70
- isLoading: false,
71
- isError: false,
72
- isSuccess: true,
73
- isPending: false,
74
- refetch: refetch,
75
- hasNextPage: false,
76
- hasPreviousPage: false,
77
- fetchNextPage: jest.fn(),
78
- fetchPreviousPage: jest.fn(),
79
- isFetchingNextPage: false,
80
- isFetchingPreviousPage: false,
81
- dataUpdatedAt: Date.now(),
82
- errorUpdatedAt: 0,
83
- failureCount: 0,
84
- failureReason: null,
85
- isFetched: true,
86
- isFetchedAfterMount: true,
87
- isFetching: false,
88
- isInitialLoading: false,
89
- isLoadingError: false,
90
- isPaused: false,
91
- isPlaceholderData: false,
92
- isPreviousData: false,
93
- isRefetchError: false,
94
- isRefetching: false,
95
- isStale: false,
96
- promise: Promise.resolve({
97
- pages: [['item1'], ['item2']],
98
- pageParams: [undefined, 'next-page']
99
- })
100
- };
101
- };
102
- describe('plain data source', function () {
103
- var plainDataSource = {
104
- type: 'plain',
105
- name: 'test-plain',
106
- fetch: jest.fn().mockResolvedValue({
107
- data: 'test-data'
108
- })
109
- };
110
- it('should wrap refetch when no enabled option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
111
- var originalRefetch, _renderHook, result;
112
- return _regeneratorRuntime().wrap(function _callee$(_context) {
113
- while (1) switch (_context.prev = _context.next) {
114
- case 0:
115
- originalRefetch = jest.fn().mockResolvedValue({
116
- data: 'test',
117
- status: 'success'
118
- });
119
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
120
- _renderHook = renderHook(function () {
121
- return useQueryData(plainDataSource, {
122
- id: 1
123
- });
124
- }), result = _renderHook.result;
125
- expect(result.current.refetch).not.toBe(originalRefetch);
126
- expect(result.current.refetch).not.toBe(mockWarnDisabledRefetch);
127
- _context.next = 7;
128
- return result.current.refetch();
129
- case 7:
130
- expect(originalRefetch).toHaveBeenCalledTimes(1);
131
- case 8:
132
- case "end":
133
- return _context.stop();
134
- }
135
- }, _callee);
136
- })));
137
- it('should use warnDisabledRefetch when enabled: false', function () {
138
- var originalRefetch = jest.fn();
139
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
140
- var _renderHook2 = renderHook(function () {
141
- return useQueryData(plainDataSource, {
142
- id: 1
143
- }, {
144
- enabled: false
145
- });
146
- }),
147
- result = _renderHook2.result;
148
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
149
- expect(result.current.refetch).not.toBe(originalRefetch);
150
- });
151
- it('should use warnDisabledRefetch when params is idle', function () {
152
- var originalRefetch = jest.fn();
153
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
154
- var _renderHook3 = renderHook(function () {
155
- return useQueryData(plainDataSource, idle);
156
- }),
157
- result = _renderHook3.result;
158
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
159
- expect(result.current.refetch).not.toBe(originalRefetch);
160
- });
161
- });
162
- describe('infinite data source', function () {
163
- var infiniteDataSource = {
164
- type: 'infinite',
165
- name: 'test-infinite',
166
- fetch: jest.fn().mockResolvedValue({
167
- data: ['item1', 'item2']
168
- }),
169
- next: jest.fn()
170
- };
171
- it('should wrap refetch when no enabled option', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
172
- var originalRefetch, _renderHook4, result;
173
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
174
- while (1) switch (_context2.prev = _context2.next) {
175
- case 0:
176
- originalRefetch = jest.fn().mockResolvedValue({
177
- data: {
178
- pages: [],
179
- pageParams: []
180
- },
181
- status: 'success'
182
- });
183
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
184
- _renderHook4 = renderHook(function () {
185
- return useQueryData(infiniteDataSource, {
186
- id: 1
187
- });
188
- }), result = _renderHook4.result;
189
- expect(result.current.refetch).not.toBe(originalRefetch);
190
- expect(result.current.refetch).not.toBe(mockWarnDisabledRefetch);
191
- _context2.next = 7;
192
- return result.current.refetch();
193
- case 7:
194
- expect(originalRefetch).toHaveBeenCalledTimes(1);
195
- case 8:
196
- case "end":
197
- return _context2.stop();
198
- }
199
- }, _callee2);
200
- })));
201
- it('should use warnDisabledRefetch when enabled: false', function () {
202
- var originalRefetch = jest.fn();
203
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
204
- var _renderHook5 = renderHook(function () {
205
- return useQueryData(infiniteDataSource, {
206
- id: 1
207
- }, {
208
- enabled: false
209
- });
210
- }),
211
- result = _renderHook5.result;
212
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
213
- expect(result.current.refetch).not.toBe(originalRefetch);
214
- });
215
- it('should use warnDisabledRefetch when params is idle', function () {
216
- var originalRefetch = jest.fn();
217
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
218
- var _renderHook6 = renderHook(function () {
219
- return useQueryData(infiniteDataSource, idle);
220
- }),
221
- result = _renderHook6.result;
222
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
223
- expect(result.current.refetch).not.toBe(originalRefetch);
224
- });
225
- });
226
- });
227
- // #sourceMappingURL=useQueryData.refetch.test.js.map