@gravity-ui/data-source 0.9.0 → 0.9.1-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","_interopRequireDefault","require","_react2","_ClientDataManager","_DataSourceProvider","_useQueryData","_factory","_jsxRuntime","e","__esModule","default","describe","queryClient","dataManager","beforeEach","ClientDataManager","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","_jsx","DataSourceProvider","makePlainQueryDataSource","fetch","_fetch","_callee11","_callee11$","_context11","options","renderHook","useQueryData","waitFor","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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA+D,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/DG,QAAQ,CAAC,yCAAyC,EAAE,YAAM;EACtD,IAAIC,WAAwB;EAC5B,IAAIC,WAA8B;EAElCC,UAA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2G,EAAE,CAACrB,UAAU,CAAE2C,kBAAkB,GAAGL,0BAA0B;YAC9DX,aAAa,CAACS,WAAW,CAAC,CAAC;YAC3Bf,EAAE,CAACnJ,eAAe,CAAEC,WAAW,CAAC,CAAC;YACjCkJ,EAAE,CAAC3J,WAAW,CAACU,KAAK,CAAC,CAAC;UAAC;UAAA;YAAA,OAAAoK,UAAA,CAAAtI,IAAA;QAAA;MAAA,GAAAmI,SAAA;IAAA,CAC1B,GAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,229 +0,0 @@
1
- "use strict";
2
-
3
- var _ClientDataManager = require("../ClientDataManager");
4
- describe('updateQueriesFromMutationData', function () {
5
- var dataManager;
6
- beforeEach(function () {
7
- dataManager = new _ClientDataManager.ClientDataManager({
8
- defaultOptions: {
9
- queries: {
10
- retry: false
11
- },
12
- mutations: {
13
- retry: false
14
- }
15
- },
16
- normalizerConfig: {
17
- devLogging: false
18
- }
19
- });
20
- });
21
- afterEach(function () {
22
- dataManager.queryClient.clear();
23
- });
24
- it('should update query data based on normalized data', function () {
25
- expect(dataManager.normalizer).toBeDefined();
26
-
27
- // Set initial data in query
28
- var queryKey = ['users'];
29
- dataManager.queryClient.setQueryData(queryKey, [{
30
- id: '1',
31
- name: 'Old Name'
32
- }]);
33
-
34
- // Add query to normalizer
35
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
36
- id: '1',
37
- name: 'Old Name'
38
- }]);
39
-
40
- // Update data via mutation
41
- var mutationData = {
42
- id: '1',
43
- name: 'New Name'
44
- };
45
- dataManager.optimisticUpdate(mutationData);
46
-
47
- // Verify that data was updated
48
- var updatedData = dataManager.queryClient.getQueryData(queryKey);
49
- expect(updatedData).toBeDefined();
50
- expect(updatedData[0].name).toBe('New Name');
51
- });
52
- it('should update multiple queries with the same object', function () {
53
- expect(dataManager.normalizer).toBeDefined();
54
- var queryKey1 = ['users'];
55
- var queryKey2 = ['user', '1'];
56
-
57
- // Set data in both queries
58
- dataManager.queryClient.setQueryData(queryKey1, [{
59
- id: '1',
60
- name: 'User 1'
61
- }]);
62
- dataManager.queryClient.setQueryData(queryKey2, {
63
- id: '1',
64
- name: 'User 1'
65
- });
66
-
67
- // Add to normalizer
68
- dataManager.normalizer.setQuery(JSON.stringify(queryKey1), [{
69
- id: '1',
70
- name: 'User 1'
71
- }]);
72
- dataManager.normalizer.setQuery(JSON.stringify(queryKey2), {
73
- id: '1',
74
- name: 'User 1'
75
- });
76
-
77
- // Update via mutation
78
- var mutationData = {
79
- id: '1',
80
- name: 'Updated User'
81
- };
82
- dataManager.optimisticUpdate(mutationData);
83
-
84
- // Check both queries
85
- var data1 = dataManager.queryClient.getQueryData(queryKey1);
86
- var data2 = dataManager.queryClient.getQueryData(queryKey2);
87
- expect(data1[0].name).toBe('Updated User');
88
- expect(data2.name).toBe('Updated User');
89
- });
90
- it('should preserve dataUpdatedAt on update', function () {
91
- expect(dataManager.normalizer).toBeDefined();
92
- var queryKey = ['users'];
93
- var originalUpdatedAt = Date.now();
94
-
95
- // Set initial data
96
- dataManager.queryClient.setQueryData(queryKey, [{
97
- id: '1',
98
- name: 'Old'
99
- }], {
100
- updatedAt: originalUpdatedAt
101
- });
102
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
103
- id: '1',
104
- name: 'Old'
105
- }]);
106
-
107
- // Update data
108
- var mutationData = {
109
- id: '1',
110
- name: 'New'
111
- };
112
- dataManager.optimisticUpdate(mutationData);
113
-
114
- // Verify that dataUpdatedAt was preserved
115
- var cachedQuery = dataManager.queryClient.getQueryCache().find({
116
- queryKey: queryKey
117
- });
118
- expect(cachedQuery === null || cachedQuery === void 0 ? void 0 : cachedQuery.state.dataUpdatedAt).toBe(originalUpdatedAt);
119
- });
120
- it('should preserve error state on update', function () {
121
- expect(dataManager.normalizer).toBeDefined();
122
- var queryKey = ['users'];
123
- var error = new Error('Test error');
124
-
125
- // Set initial data with error
126
- dataManager.queryClient.setQueryData(queryKey, [{
127
- id: '1',
128
- name: 'Old'
129
- }]);
130
- var cachedQuery = dataManager.queryClient.getQueryCache().find({
131
- queryKey: queryKey
132
- });
133
- cachedQuery === null || cachedQuery === void 0 || cachedQuery.setState({
134
- error: error,
135
- status: 'error'
136
- });
137
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
138
- id: '1',
139
- name: 'Old'
140
- }]);
141
-
142
- // Update data
143
- var mutationData = {
144
- id: '1',
145
- name: 'New'
146
- };
147
- dataManager.optimisticUpdate(mutationData);
148
-
149
- // Verify that error and status were preserved
150
- var updatedQuery = dataManager.queryClient.getQueryCache().find({
151
- queryKey: queryKey
152
- });
153
- expect(updatedQuery === null || updatedQuery === void 0 ? void 0 : updatedQuery.state.error).toBe(error);
154
- expect(updatedQuery === null || updatedQuery === void 0 ? void 0 : updatedQuery.state.status).toBe('error');
155
- });
156
- it('should preserve isInvalidated flag on update', function () {
157
- expect(dataManager.normalizer).toBeDefined();
158
- var queryKey = ['users'];
159
-
160
- // Set initial data and invalidate
161
- dataManager.queryClient.setQueryData(queryKey, [{
162
- id: '1',
163
- name: 'Old'
164
- }]);
165
- dataManager.queryClient.invalidateQueries({
166
- queryKey: queryKey
167
- });
168
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), [{
169
- id: '1',
170
- name: 'Old'
171
- }]);
172
- var cachedQueryBefore = dataManager.queryClient.getQueryCache().find({
173
- queryKey: queryKey
174
- });
175
- var isInvalidatedBefore = cachedQueryBefore === null || cachedQueryBefore === void 0 ? void 0 : cachedQueryBefore.state.isInvalidated;
176
-
177
- // Update data
178
- var mutationData = {
179
- id: '1',
180
- name: 'New'
181
- };
182
- dataManager.optimisticUpdate(mutationData);
183
-
184
- // Verify that isInvalidated was preserved
185
- var cachedQueryAfter = dataManager.queryClient.getQueryCache().find({
186
- queryKey: queryKey
187
- });
188
- expect(cachedQueryAfter === null || cachedQueryAfter === void 0 ? void 0 : cachedQueryAfter.state.isInvalidated).toBe(isInvalidatedBefore);
189
- });
190
- it('should work correctly with nested objects', function () {
191
- expect(dataManager.normalizer).toBeDefined();
192
- var queryKey = ['posts'];
193
- var initialData = [{
194
- id: '1',
195
- title: 'Post 1',
196
- author: {
197
- id: '10',
198
- name: 'Author 1'
199
- }
200
- }];
201
- dataManager.queryClient.setQueryData(queryKey, initialData);
202
- dataManager.normalizer.setQuery(JSON.stringify(queryKey), initialData);
203
-
204
- // Update author
205
- var mutationData = {
206
- id: '10',
207
- name: 'Updated Author'
208
- };
209
- dataManager.optimisticUpdate(mutationData);
210
-
211
- // Verify that author was updated
212
- var data = dataManager.queryClient.getQueryData(queryKey);
213
- expect(data[0].author.name).toBe('Updated Author');
214
- });
215
- it('should not throw if query is not in cache', function () {
216
- expect(dataManager.normalizer).toBeDefined();
217
- var mutationData = {
218
- id: '1',
219
- name: 'New'
220
- };
221
-
222
- // Don't add query to cache, only to normalizer
223
- // This should not throw an error
224
- expect(function () {
225
- dataManager.optimisticUpdate(mutationData);
226
- }).not.toThrow();
227
- });
228
- });
229
- // #sourceMappingURL=updateQueriesFromMutationData.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ClientDataManager","require","describe","dataManager","beforeEach","ClientDataManager","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,IAAAA,kBAAA,GAAAC,OAAA;AAEAC,QAAQ,CAAC,+BAA+B,EAAE,YAAM;EAC5C,IAAIC,WAA8B;EAElCC,UAAU,CAAC,YAAM;IACbD,WAAW,GAAG,IAAIE,oCAAiB,CAAC;MAChCC,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;IACZT,WAAW,CAACU,WAAW,CAACC,KAAK,CAAC,CAAC;EACnC,CAAC,CAAC;EAEFC,EAAE,CAAC,mDAAmD,EAAE,YAAM;IAC1DC,MAAM,CAACb,WAAW,CAACc,UAAU,CAAC,CAACC,WAAW,CAAC,CAAC;;IAE5C;IACA,IAAMC,QAAQ,GAAG,CAAC,OAAO,CAAC;IAC1BhB,WAAW,CAACU,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FH,MAAM,CAACyC,IAAI,CAAC,CAAC,CAAC,CAACD,MAAM,CAAClC,IAAI,CAAC,CAACQ,IAAI,CAAC,gBAAgB,CAAC;EACtD,CAAC,CAAC;EAEFf,EAAE,CAAC,2CAA2C,EAAE,YAAM;IAClDC,MAAM,CAACb,WAAW,CAACc,UAAU,CAAC,CAACC,WAAW,CAAC,CAAC;IAE5C,IAAMQ,YAAkB,GAAG;MAACL,EAAE,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAK,CAAC;;IAEjD;IACA;IACAN,MAAM,CAAC,YAAM;MACTb,WAAW,CAACwB,gBAAgB,CAACD,YAAY,CAAC;IAC9C,CAAC,CAAC,CAACgC,GAAG,CAACC,OAAO,CAAC,CAAC;EACpB,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
4
- var _reactQuery = require("@tanstack/react-query");
5
- var _react = require("@testing-library/react");
6
- var _useQueryContext = require("../useQueryContext");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
- jest.mock('@tanstack/react-query', function () {
9
- var originalModule = jest.requireActual('@tanstack/react-query');
10
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originalModule), {}, {
11
- useQueryClient: jest.fn()
12
- });
13
- });
14
- describe('useQueryContext', function () {
15
- var mockQueryClient = new _reactQuery.QueryClient();
16
- beforeEach(function () {
17
- jest.clearAllMocks();
18
- _reactQuery.useQueryClient.mockReturnValue(mockQueryClient);
19
- });
20
- it('should return context with queryClient', function () {
21
- var _renderHook = (0, _react.renderHook)(function () {
22
- return (0, _useQueryContext.useQueryContext)();
23
- }),
24
- result = _renderHook.result;
25
- expect(result.current).toEqual({
26
- queryClient: mockQueryClient
27
- });
28
- });
29
- it('should memoize the context', function () {
30
- var _renderHook2 = (0, _react.renderHook)(function () {
31
- return (0, _useQueryContext.useQueryContext)();
32
- }),
33
- result = _renderHook2.result,
34
- rerender = _renderHook2.rerender;
35
- var firstResult = result.current;
36
- rerender();
37
- expect(result.current).toBe(firstResult);
38
- });
39
- it('should update context when queryClient changes', function () {
40
- var _renderHook3 = (0, _react.renderHook)(function () {
41
- return (0, _useQueryContext.useQueryContext)();
42
- }),
43
- result = _renderHook3.result,
44
- rerender = _renderHook3.rerender;
45
- var firstResult = result.current;
46
- var newMockQueryClient = new _reactQuery.QueryClient();
47
- _reactQuery.useQueryClient.mockReturnValue(newMockQueryClient);
48
- rerender();
49
- expect(result.current).not.toBe(firstResult);
50
- expect(result.current).toEqual({
51
- queryClient: newMockQueryClient
52
- });
53
- });
54
- });
55
- // #sourceMappingURL=useQueryContext.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactQuery","require","_react","_useQueryContext","_interopRequireDefault","e","__esModule","default","jest","mock","originalModule","requireActual","_objectSpread","useQueryClient","fn","describe","mockQueryClient","QueryClient","beforeEach","clearAllMocks","mockReturnValue","it","_renderHook","renderHook","useQueryContext","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,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAAkD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElDG,IAAI,CAACC,IAAI,CAAC,uBAAuB,EAAE,YAAM;EACrC,IAAMC,cAAc,GAAGF,IAAI,CAACG,aAAa,CAAC,uBAAuB,CAAC;EAClE,WAAAC,sBAAA,MAAAA,sBAAA,MACOF,cAAc;IACjBG,cAAc,EAAEL,IAAI,CAACM,EAAE,CAAC;EAAC;AAEjC,CAAC,CAAC;AAEFC,QAAQ,CAAC,iBAAiB,EAAE,YAAM;EAC9B,IAAMC,eAAe,GAAG,IAAIC,uBAAW,CAAC,CAAC;EAEzCC,UAAU,CAAC,YAAM;IACbV,IAAI,CAACW,aAAa,CAAC,CAAC;IAEnBN,0BAAc,CAAeO,eAAe,CAACJ,eAAe,CAAC;EAClE,CAAC,CAAC;EAEFK,EAAE,CAAC,wCAAwC,EAAE,YAAM;IAC/C,IAAAC,WAAA,GAAiB,IAAAC,iBAAU,EAAC;QAAA,OAAM,IAAAC,gCAAe,EAAC,CAAC;MAAA,EAAC;MAA7CC,MAAM,GAAAH,WAAA,CAANG,MAAM;IAEbC,MAAM,CAACD,MAAM,CAACE,OAAO,CAAC,CAACC,OAAO,CAAC;MAACC,WAAW,EAAEb;IAAe,CAAC,CAAC;EAClE,CAAC,CAAC;EAEFK,EAAE,CAAC,4BAA4B,EAAE,YAAM;IACnC,IAAAS,YAAA,GAA2B,IAAAP,iBAAU,EAAC;QAAA,OAAM,IAAAC,gCAAe,EAAC,CAAC;MAAA,EAAC;MAAvDC,MAAM,GAAAK,YAAA,CAANL,MAAM;MAAEM,QAAQ,GAAAD,YAAA,CAARC,QAAQ;IAEvB,IAAMC,WAAW,GAAGP,MAAM,CAACE,OAAO;IAElCI,QAAQ,CAAC,CAAC;IAEVL,MAAM,CAACD,MAAM,CAACE,OAAO,CAAC,CAACM,IAAI,CAACD,WAAW,CAAC;EAC5C,CAAC,CAAC;EAEFX,EAAE,CAAC,gDAAgD,EAAE,YAAM;IACvD,IAAAa,YAAA,GAA2B,IAAAX,iBAAU,EAAC;QAAA,OAAM,IAAAC,gCAAe,EAAC,CAAC;MAAA,EAAC;MAAvDC,MAAM,GAAAS,YAAA,CAANT,MAAM;MAAEM,QAAQ,GAAAG,YAAA,CAARH,QAAQ;IAEvB,IAAMC,WAAW,GAAGP,MAAM,CAACE,OAAO;IAElC,IAAMQ,kBAAkB,GAAG,IAAIlB,uBAAW,CAAC,CAAC;IAE3CJ,0BAAc,CAAeO,eAAe,CAACe,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,230 +0,0 @@
1
- "use strict";
2
-
3
- var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
4
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
5
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
6
- var _reactQuery = require("@tanstack/react-query");
7
- var _react = require("@testing-library/react");
8
- var _core = require("../../../core");
9
- var _warnDisabledRefetch = require("../../utils/warnDisabledRefetch");
10
- var _useQueryContext = require("../useQueryContext");
11
- var _useQueryData = require("../useQueryData");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- jest.mock('@tanstack/react-query', function () {
14
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, jest.requireActual('@tanstack/react-query')), {}, {
15
- useQuery: jest.fn(),
16
- useInfiniteQuery: jest.fn()
17
- });
18
- });
19
- jest.mock('../useQueryContext');
20
- jest.mock('../../utils/warnDisabledRefetch');
21
- var mockUseQuery = _reactQuery.useQuery;
22
- var mockUseInfiniteQuery = _reactQuery.useInfiniteQuery;
23
- var mockWarnDisabledRefetch = _warnDisabledRefetch.warnDisabledRefetch;
24
- describe('useQueryData refetch behavior', function () {
25
- var mockQueryClient = new _reactQuery.QueryClient();
26
- var mockContext = {
27
- queryClient: mockQueryClient
28
- };
29
- beforeEach(function () {
30
- jest.clearAllMocks();
31
- _useQueryContext.useQueryContext.mockReturnValue(mockContext);
32
- });
33
- var createMockQueryResult = function createMockQueryResult() {
34
- var refetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : jest.fn();
35
- return {
36
- data: 'test-data',
37
- error: null,
38
- status: 'success',
39
- fetchStatus: 'idle',
40
- isLoading: false,
41
- isError: false,
42
- isSuccess: true,
43
- isPending: false,
44
- refetch: refetch,
45
- dataUpdatedAt: Date.now(),
46
- errorUpdatedAt: 0,
47
- failureCount: 0,
48
- failureReason: null,
49
- isFetched: true,
50
- isFetchedAfterMount: true,
51
- isFetching: false,
52
- isInitialLoading: false,
53
- isLoadingError: false,
54
- isPaused: false,
55
- isPlaceholderData: false,
56
- isPreviousData: false,
57
- isRefetchError: false,
58
- isRefetching: false,
59
- isStale: false,
60
- promise: Promise.resolve('test-data')
61
- };
62
- };
63
- var createMockInfiniteResult = function createMockInfiniteResult() {
64
- var refetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : jest.fn();
65
- return {
66
- data: {
67
- pages: [['item1'], ['item2']],
68
- pageParams: [undefined, 'next-page']
69
- },
70
- error: null,
71
- status: 'success',
72
- fetchStatus: 'idle',
73
- isLoading: false,
74
- isError: false,
75
- isSuccess: true,
76
- isPending: false,
77
- refetch: refetch,
78
- hasNextPage: false,
79
- hasPreviousPage: false,
80
- fetchNextPage: jest.fn(),
81
- fetchPreviousPage: jest.fn(),
82
- isFetchingNextPage: false,
83
- isFetchingPreviousPage: false,
84
- dataUpdatedAt: Date.now(),
85
- errorUpdatedAt: 0,
86
- failureCount: 0,
87
- failureReason: null,
88
- isFetched: true,
89
- isFetchedAfterMount: true,
90
- isFetching: false,
91
- isInitialLoading: false,
92
- isLoadingError: false,
93
- isPaused: false,
94
- isPlaceholderData: false,
95
- isPreviousData: false,
96
- isRefetchError: false,
97
- isRefetching: false,
98
- isStale: false,
99
- promise: Promise.resolve({
100
- pages: [['item1'], ['item2']],
101
- pageParams: [undefined, 'next-page']
102
- })
103
- };
104
- };
105
- describe('plain data source', function () {
106
- var plainDataSource = {
107
- type: 'plain',
108
- name: 'test-plain',
109
- fetch: jest.fn().mockResolvedValue({
110
- data: 'test-data'
111
- })
112
- };
113
- it('should wrap refetch when no enabled option', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
114
- var originalRefetch, _renderHook, result;
115
- return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
116
- while (1) switch (_context.prev = _context.next) {
117
- case 0:
118
- originalRefetch = jest.fn().mockResolvedValue({
119
- data: 'test',
120
- status: 'success'
121
- });
122
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
123
- _renderHook = (0, _react.renderHook)(function () {
124
- return (0, _useQueryData.useQueryData)(plainDataSource, {
125
- id: 1
126
- });
127
- }), result = _renderHook.result;
128
- expect(result.current.refetch).not.toBe(originalRefetch);
129
- expect(result.current.refetch).not.toBe(mockWarnDisabledRefetch);
130
- _context.next = 7;
131
- return result.current.refetch();
132
- case 7:
133
- expect(originalRefetch).toHaveBeenCalledTimes(1);
134
- case 8:
135
- case "end":
136
- return _context.stop();
137
- }
138
- }, _callee);
139
- })));
140
- it('should use warnDisabledRefetch when enabled: false', function () {
141
- var originalRefetch = jest.fn();
142
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
143
- var _renderHook2 = (0, _react.renderHook)(function () {
144
- return (0, _useQueryData.useQueryData)(plainDataSource, {
145
- id: 1
146
- }, {
147
- enabled: false
148
- });
149
- }),
150
- result = _renderHook2.result;
151
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
152
- expect(result.current.refetch).not.toBe(originalRefetch);
153
- });
154
- it('should use warnDisabledRefetch when params is idle', function () {
155
- var originalRefetch = jest.fn();
156
- mockUseQuery.mockReturnValue(createMockQueryResult(originalRefetch));
157
- var _renderHook3 = (0, _react.renderHook)(function () {
158
- return (0, _useQueryData.useQueryData)(plainDataSource, _core.idle);
159
- }),
160
- result = _renderHook3.result;
161
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
162
- expect(result.current.refetch).not.toBe(originalRefetch);
163
- });
164
- });
165
- describe('infinite data source', function () {
166
- var infiniteDataSource = {
167
- type: 'infinite',
168
- name: 'test-infinite',
169
- fetch: jest.fn().mockResolvedValue({
170
- data: ['item1', 'item2']
171
- }),
172
- next: jest.fn()
173
- };
174
- it('should wrap refetch when no enabled option', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
175
- var originalRefetch, _renderHook4, result;
176
- return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
177
- while (1) switch (_context2.prev = _context2.next) {
178
- case 0:
179
- originalRefetch = jest.fn().mockResolvedValue({
180
- data: {
181
- pages: [],
182
- pageParams: []
183
- },
184
- status: 'success'
185
- });
186
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
187
- _renderHook4 = (0, _react.renderHook)(function () {
188
- return (0, _useQueryData.useQueryData)(infiniteDataSource, {
189
- id: 1
190
- });
191
- }), result = _renderHook4.result;
192
- expect(result.current.refetch).not.toBe(originalRefetch);
193
- expect(result.current.refetch).not.toBe(mockWarnDisabledRefetch);
194
- _context2.next = 7;
195
- return result.current.refetch();
196
- case 7:
197
- expect(originalRefetch).toHaveBeenCalledTimes(1);
198
- case 8:
199
- case "end":
200
- return _context2.stop();
201
- }
202
- }, _callee2);
203
- })));
204
- it('should use warnDisabledRefetch when enabled: false', function () {
205
- var originalRefetch = jest.fn();
206
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
207
- var _renderHook5 = (0, _react.renderHook)(function () {
208
- return (0, _useQueryData.useQueryData)(infiniteDataSource, {
209
- id: 1
210
- }, {
211
- enabled: false
212
- });
213
- }),
214
- result = _renderHook5.result;
215
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
216
- expect(result.current.refetch).not.toBe(originalRefetch);
217
- });
218
- it('should use warnDisabledRefetch when params is idle', function () {
219
- var originalRefetch = jest.fn();
220
- mockUseInfiniteQuery.mockReturnValue(createMockInfiniteResult(originalRefetch));
221
- var _renderHook6 = (0, _react.renderHook)(function () {
222
- return (0, _useQueryData.useQueryData)(infiniteDataSource, _core.idle);
223
- }),
224
- result = _renderHook6.result;
225
- expect(result.current.refetch).toBe(mockWarnDisabledRefetch);
226
- expect(result.current.refetch).not.toBe(originalRefetch);
227
- });
228
- });
229
- });
230
- // #sourceMappingURL=useQueryData.refetch.test.js.map