@buoy-gg/react-query 7.0.41 → 7.0.42

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 (243) hide show
  1. package/README.md +11 -73
  2. package/lib/commonjs/checkPeer.js +1 -8
  3. package/lib/commonjs/checkPeer.web.js +1 -3
  4. package/lib/commonjs/index.js +1 -657
  5. package/lib/commonjs/preset.js +1 -243
  6. package/lib/commonjs/react-query/components/DataEditorMode.js +1 -317
  7. package/lib/commonjs/react-query/components/FilterStatusBadge.js +1 -55
  8. package/lib/commonjs/react-query/components/MutationBrowserMode.js +1 -52
  9. package/lib/commonjs/react-query/components/MutationEditorMode.js +1 -276
  10. package/lib/commonjs/react-query/components/QueryBrowserMode.js +1 -99
  11. package/lib/commonjs/react-query/components/QueryDebugInfo.js +1 -107
  12. package/lib/commonjs/react-query/components/QueryFilterViewV3.js +1 -224
  13. package/lib/commonjs/react-query/components/QuerySelector.js +1 -209
  14. package/lib/commonjs/react-query/components/ReactQueryDevToolsModal.js +1 -91
  15. package/lib/commonjs/react-query/components/ReactQuerySection.js +1 -47
  16. package/lib/commonjs/react-query/components/ReactQueryTracker.js +1 -38
  17. package/lib/commonjs/react-query/components/WifiToggle.js +1 -51
  18. package/lib/commonjs/react-query/components/modals/DataEditorModal.js +1 -103
  19. package/lib/commonjs/react-query/components/modals/MutationBrowserFooter.js +1 -61
  20. package/lib/commonjs/react-query/components/modals/MutationBrowserModal.js +1 -164
  21. package/lib/commonjs/react-query/components/modals/MutationEditorModal.js +1 -106
  22. package/lib/commonjs/react-query/components/modals/QueryBrowserFooter.js +1 -56
  23. package/lib/commonjs/react-query/components/modals/QueryBrowserModal.js +1 -254
  24. package/lib/commonjs/react-query/components/modals/ReactQueryModal.js +1 -83
  25. package/lib/commonjs/react-query/components/modals/ReactQueryModalHeader.js +1 -194
  26. package/lib/commonjs/react-query/components/modals/SwipeIndicator.js +1 -204
  27. package/lib/commonjs/react-query/components/query-browser/ActionButton.js +1 -100
  28. package/lib/commonjs/react-query/components/query-browser/ClearCacheButton.js +1 -53
  29. package/lib/commonjs/react-query/components/query-browser/Explorer.js +1 -75
  30. package/lib/commonjs/react-query/components/query-browser/MutationButton.js +1 -190
  31. package/lib/commonjs/react-query/components/query-browser/MutationDetails.js +1 -124
  32. package/lib/commonjs/react-query/components/query-browser/MutationDetailsChips.js +1 -68
  33. package/lib/commonjs/react-query/components/query-browser/MutationInformation.js +1 -118
  34. package/lib/commonjs/react-query/components/query-browser/MutationStatusCount.js +1 -84
  35. package/lib/commonjs/react-query/components/query-browser/MutationsList.js +1 -220
  36. package/lib/commonjs/react-query/components/query-browser/NetworkToggleButton.js +1 -54
  37. package/lib/commonjs/react-query/components/query-browser/QueryActions.js +1 -124
  38. package/lib/commonjs/react-query/components/query-browser/QueryBrowser.js +1 -181
  39. package/lib/commonjs/react-query/components/query-browser/QueryDetails.js +1 -141
  40. package/lib/commonjs/react-query/components/query-browser/QueryDetailsChip.js +1 -78
  41. package/lib/commonjs/react-query/components/query-browser/QueryInformation.js +1 -95
  42. package/lib/commonjs/react-query/components/query-browser/QueryRow.js +1 -96
  43. package/lib/commonjs/react-query/components/query-browser/QueryStatus.js +1 -167
  44. package/lib/commonjs/react-query/components/query-browser/QueryStatusCount.js +1 -100
  45. package/lib/commonjs/react-query/components/query-browser/StorageStatusCount.js +1 -61
  46. package/lib/commonjs/react-query/components/query-browser/index.js +1 -170
  47. package/lib/commonjs/react-query/components/query-browser/svgs.js +1 -72
  48. package/lib/commonjs/react-query/hooks/useActionButtons.js +1 -51
  49. package/lib/commonjs/react-query/hooks/useAllMutations.js +1 -85
  50. package/lib/commonjs/react-query/hooks/useAllQueries.js +1 -117
  51. package/lib/commonjs/react-query/hooks/useModalManager.js +1 -178
  52. package/lib/commonjs/react-query/hooks/useModalPersistence.js +1 -71
  53. package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +1 -21
  54. package/lib/commonjs/react-query/hooks/useQueryStatusCounts.js +1 -114
  55. package/lib/commonjs/react-query/hooks/useReactQueryState.js +1 -24
  56. package/lib/commonjs/react-query/hooks/useSelectedMutation.js +1 -30
  57. package/lib/commonjs/react-query/hooks/useSelectedQuery.js +1 -96
  58. package/lib/commonjs/react-query/hooks/useStorageQueryCounts.js +1 -28
  59. package/lib/commonjs/react-query/hooks/useWifiState.js +1 -67
  60. package/lib/commonjs/react-query/stores/reactQueryEventStore.js +1 -302
  61. package/lib/commonjs/react-query/sync/dehydrate.js +1 -166
  62. package/lib/commonjs/react-query/sync/reactQuerySyncAdapter.js +1 -593
  63. package/lib/commonjs/react-query/sync/snapshotProvider.js +1 -289
  64. package/lib/commonjs/react-query/sync/useReactQuerySyncAdapter.js +1 -34
  65. package/lib/commonjs/react-query/types/types.js +1 -14
  66. package/lib/commonjs/react-query/utils/actions/deleteItem.js +1 -23
  67. package/lib/commonjs/react-query/utils/actions/emitDevToolsEvent.js +1 -40
  68. package/lib/commonjs/react-query/utils/actions/invalidate.js +1 -15
  69. package/lib/commonjs/react-query/utils/actions/refetch.js +1 -17
  70. package/lib/commonjs/react-query/utils/actions/remove.js +1 -15
  71. package/lib/commonjs/react-query/utils/actions/reset.js +1 -17
  72. package/lib/commonjs/react-query/utils/actions/triggerError.js +1 -33
  73. package/lib/commonjs/react-query/utils/actions/triggerLoading.js +1 -54
  74. package/lib/commonjs/react-query/utils/deleteNestedDataByPath.js +1 -56
  75. package/lib/commonjs/react-query/utils/getQueryStatusColor.js +1 -16
  76. package/lib/commonjs/react-query/utils/getQueryStatusLabel.js +1 -23
  77. package/lib/commonjs/react-query/utils/getStorageQueryCounts.js +1 -35
  78. package/lib/commonjs/react-query/utils/modalStorageOperations.js +1 -127
  79. package/lib/commonjs/react-query/utils/storageQueryUtils.js +1 -149
  80. package/lib/commonjs/react-query/utils/testIDs.js +1 -61
  81. package/lib/commonjs/react-query/utils/updateNestedDataByPath.js +1 -61
  82. package/lib/module/checkPeer.js +1 -8
  83. package/lib/module/checkPeer.web.js +1 -3
  84. package/lib/module/index.js +1 -130
  85. package/lib/module/preset.js +1 -239
  86. package/lib/module/react-query/components/DataEditorMode.js +1 -311
  87. package/lib/module/react-query/components/FilterStatusBadge.js +1 -51
  88. package/lib/module/react-query/components/MutationBrowserMode.js +1 -47
  89. package/lib/module/react-query/components/MutationEditorMode.js +1 -270
  90. package/lib/module/react-query/components/QueryBrowserMode.js +1 -94
  91. package/lib/module/react-query/components/QueryDebugInfo.js +1 -104
  92. package/lib/module/react-query/components/QueryFilterViewV3.js +1 -221
  93. package/lib/module/react-query/components/QuerySelector.js +1 -205
  94. package/lib/module/react-query/components/ReactQueryDevToolsModal.js +1 -87
  95. package/lib/module/react-query/components/ReactQuerySection.js +1 -43
  96. package/lib/module/react-query/components/ReactQueryTracker.js +1 -35
  97. package/lib/module/react-query/components/WifiToggle.js +1 -48
  98. package/lib/module/react-query/components/modals/DataEditorModal.js +1 -99
  99. package/lib/module/react-query/components/modals/MutationBrowserFooter.js +1 -56
  100. package/lib/module/react-query/components/modals/MutationBrowserModal.js +1 -161
  101. package/lib/module/react-query/components/modals/MutationEditorModal.js +1 -102
  102. package/lib/module/react-query/components/modals/QueryBrowserFooter.js +1 -51
  103. package/lib/module/react-query/components/modals/QueryBrowserModal.js +1 -250
  104. package/lib/module/react-query/components/modals/ReactQueryModal.js +1 -79
  105. package/lib/module/react-query/components/modals/ReactQueryModalHeader.js +1 -190
  106. package/lib/module/react-query/components/modals/SwipeIndicator.js +1 -201
  107. package/lib/module/react-query/components/query-browser/ActionButton.js +1 -96
  108. package/lib/module/react-query/components/query-browser/ClearCacheButton.js +1 -49
  109. package/lib/module/react-query/components/query-browser/Explorer.js +1 -70
  110. package/lib/module/react-query/components/query-browser/MutationButton.js +1 -186
  111. package/lib/module/react-query/components/query-browser/MutationDetails.js +1 -119
  112. package/lib/module/react-query/components/query-browser/MutationDetailsChips.js +1 -64
  113. package/lib/module/react-query/components/query-browser/MutationInformation.js +1 -113
  114. package/lib/module/react-query/components/query-browser/MutationStatusCount.js +1 -79
  115. package/lib/module/react-query/components/query-browser/MutationsList.js +1 -215
  116. package/lib/module/react-query/components/query-browser/NetworkToggleButton.js +1 -50
  117. package/lib/module/react-query/components/query-browser/QueryActions.js +1 -119
  118. package/lib/module/react-query/components/query-browser/QueryBrowser.js +1 -176
  119. package/lib/module/react-query/components/query-browser/QueryDetails.js +1 -136
  120. package/lib/module/react-query/components/query-browser/QueryDetailsChip.js +1 -74
  121. package/lib/module/react-query/components/query-browser/QueryInformation.js +1 -90
  122. package/lib/module/react-query/components/query-browser/QueryRow.js +1 -92
  123. package/lib/module/react-query/components/query-browser/QueryStatus.js +1 -163
  124. package/lib/module/react-query/components/query-browser/QueryStatusCount.js +1 -95
  125. package/lib/module/react-query/components/query-browser/StorageStatusCount.js +1 -56
  126. package/lib/module/react-query/components/query-browser/index.js +1 -22
  127. package/lib/module/react-query/components/query-browser/svgs.js +1 -64
  128. package/lib/module/react-query/hooks/useActionButtons.js +1 -46
  129. package/lib/module/react-query/hooks/useAllMutations.js +1 -82
  130. package/lib/module/react-query/hooks/useAllQueries.js +1 -114
  131. package/lib/module/react-query/hooks/useModalManager.js +1 -175
  132. package/lib/module/react-query/hooks/useModalPersistence.js +1 -67
  133. package/lib/module/react-query/hooks/useMutationActionButtons.js +1 -17
  134. package/lib/module/react-query/hooks/useQueryStatusCounts.js +1 -112
  135. package/lib/module/react-query/hooks/useReactQueryState.js +1 -20
  136. package/lib/module/react-query/hooks/useSelectedMutation.js +1 -27
  137. package/lib/module/react-query/hooks/useSelectedQuery.js +1 -92
  138. package/lib/module/react-query/hooks/useStorageQueryCounts.js +1 -25
  139. package/lib/module/react-query/hooks/useWifiState.js +1 -64
  140. package/lib/module/react-query/stores/reactQueryEventStore.js +1 -293
  141. package/lib/module/react-query/sync/dehydrate.js +1 -156
  142. package/lib/module/react-query/sync/reactQuerySyncAdapter.js +1 -589
  143. package/lib/module/react-query/sync/snapshotProvider.js +1 -284
  144. package/lib/module/react-query/sync/useReactQuerySyncAdapter.js +1 -31
  145. package/lib/module/react-query/types/types.js +1 -10
  146. package/lib/module/react-query/utils/actions/deleteItem.js +1 -19
  147. package/lib/module/react-query/utils/actions/emitDevToolsEvent.js +1 -36
  148. package/lib/module/react-query/utils/actions/invalidate.js +1 -11
  149. package/lib/module/react-query/utils/actions/refetch.js +1 -13
  150. package/lib/module/react-query/utils/actions/remove.js +1 -11
  151. package/lib/module/react-query/utils/actions/reset.js +1 -13
  152. package/lib/module/react-query/utils/actions/triggerError.js +1 -29
  153. package/lib/module/react-query/utils/actions/triggerLoading.js +1 -50
  154. package/lib/module/react-query/utils/deleteNestedDataByPath.js +1 -51
  155. package/lib/module/react-query/utils/getQueryStatusColor.js +1 -12
  156. package/lib/module/react-query/utils/getQueryStatusLabel.js +1 -19
  157. package/lib/module/react-query/utils/getStorageQueryCounts.js +1 -31
  158. package/lib/module/react-query/utils/modalStorageOperations.js +1 -117
  159. package/lib/module/react-query/utils/storageQueryUtils.js +1 -140
  160. package/lib/module/react-query/utils/testIDs.js +1 -54
  161. package/lib/module/react-query/utils/updateNestedDataByPath.js +1 -56
  162. package/lib/web/index.mjs +3 -4
  163. package/package.json +3 -3
  164. package/lib/typescript/checkPeer.d.ts.map +0 -1
  165. package/lib/typescript/checkPeer.web.d.ts.map +0 -1
  166. package/lib/typescript/index.d.ts.map +0 -1
  167. package/lib/typescript/preset.d.ts.map +0 -1
  168. package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +0 -1
  169. package/lib/typescript/react-query/components/FilterStatusBadge.d.ts.map +0 -1
  170. package/lib/typescript/react-query/components/MutationBrowserMode.d.ts.map +0 -1
  171. package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +0 -1
  172. package/lib/typescript/react-query/components/QueryBrowserMode.d.ts.map +0 -1
  173. package/lib/typescript/react-query/components/QueryDebugInfo.d.ts.map +0 -1
  174. package/lib/typescript/react-query/components/QueryFilterViewV3.d.ts.map +0 -1
  175. package/lib/typescript/react-query/components/QuerySelector.d.ts.map +0 -1
  176. package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts.map +0 -1
  177. package/lib/typescript/react-query/components/ReactQuerySection.d.ts.map +0 -1
  178. package/lib/typescript/react-query/components/ReactQueryTracker.d.ts.map +0 -1
  179. package/lib/typescript/react-query/components/WifiToggle.d.ts.map +0 -1
  180. package/lib/typescript/react-query/components/modals/DataEditorModal.d.ts.map +0 -1
  181. package/lib/typescript/react-query/components/modals/MutationBrowserFooter.d.ts.map +0 -1
  182. package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts.map +0 -1
  183. package/lib/typescript/react-query/components/modals/MutationEditorModal.d.ts.map +0 -1
  184. package/lib/typescript/react-query/components/modals/QueryBrowserFooter.d.ts.map +0 -1
  185. package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts.map +0 -1
  186. package/lib/typescript/react-query/components/modals/ReactQueryModal.d.ts.map +0 -1
  187. package/lib/typescript/react-query/components/modals/ReactQueryModalHeader.d.ts.map +0 -1
  188. package/lib/typescript/react-query/components/modals/SwipeIndicator.d.ts.map +0 -1
  189. package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +0 -1
  190. package/lib/typescript/react-query/components/query-browser/ClearCacheButton.d.ts.map +0 -1
  191. package/lib/typescript/react-query/components/query-browser/Explorer.d.ts.map +0 -1
  192. package/lib/typescript/react-query/components/query-browser/MutationButton.d.ts.map +0 -1
  193. package/lib/typescript/react-query/components/query-browser/MutationDetails.d.ts.map +0 -1
  194. package/lib/typescript/react-query/components/query-browser/MutationDetailsChips.d.ts.map +0 -1
  195. package/lib/typescript/react-query/components/query-browser/MutationInformation.d.ts.map +0 -1
  196. package/lib/typescript/react-query/components/query-browser/MutationStatusCount.d.ts.map +0 -1
  197. package/lib/typescript/react-query/components/query-browser/MutationsList.d.ts.map +0 -1
  198. package/lib/typescript/react-query/components/query-browser/NetworkToggleButton.d.ts.map +0 -1
  199. package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +0 -1
  200. package/lib/typescript/react-query/components/query-browser/QueryBrowser.d.ts.map +0 -1
  201. package/lib/typescript/react-query/components/query-browser/QueryDetails.d.ts.map +0 -1
  202. package/lib/typescript/react-query/components/query-browser/QueryDetailsChip.d.ts.map +0 -1
  203. package/lib/typescript/react-query/components/query-browser/QueryInformation.d.ts.map +0 -1
  204. package/lib/typescript/react-query/components/query-browser/QueryRow.d.ts.map +0 -1
  205. package/lib/typescript/react-query/components/query-browser/QueryStatus.d.ts.map +0 -1
  206. package/lib/typescript/react-query/components/query-browser/QueryStatusCount.d.ts.map +0 -1
  207. package/lib/typescript/react-query/components/query-browser/StorageStatusCount.d.ts.map +0 -1
  208. package/lib/typescript/react-query/components/query-browser/index.d.ts.map +0 -1
  209. package/lib/typescript/react-query/components/query-browser/svgs.d.ts.map +0 -1
  210. package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +0 -1
  211. package/lib/typescript/react-query/hooks/useAllMutations.d.ts.map +0 -1
  212. package/lib/typescript/react-query/hooks/useAllQueries.d.ts.map +0 -1
  213. package/lib/typescript/react-query/hooks/useModalManager.d.ts.map +0 -1
  214. package/lib/typescript/react-query/hooks/useModalPersistence.d.ts.map +0 -1
  215. package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +0 -1
  216. package/lib/typescript/react-query/hooks/useQueryStatusCounts.d.ts.map +0 -1
  217. package/lib/typescript/react-query/hooks/useReactQueryState.d.ts.map +0 -1
  218. package/lib/typescript/react-query/hooks/useSelectedMutation.d.ts.map +0 -1
  219. package/lib/typescript/react-query/hooks/useSelectedQuery.d.ts.map +0 -1
  220. package/lib/typescript/react-query/hooks/useStorageQueryCounts.d.ts.map +0 -1
  221. package/lib/typescript/react-query/hooks/useWifiState.d.ts.map +0 -1
  222. package/lib/typescript/react-query/stores/reactQueryEventStore.d.ts.map +0 -1
  223. package/lib/typescript/react-query/sync/dehydrate.d.ts.map +0 -1
  224. package/lib/typescript/react-query/sync/reactQuerySyncAdapter.d.ts.map +0 -1
  225. package/lib/typescript/react-query/sync/snapshotProvider.d.ts.map +0 -1
  226. package/lib/typescript/react-query/sync/useReactQuerySyncAdapter.d.ts.map +0 -1
  227. package/lib/typescript/react-query/types/types.d.ts.map +0 -1
  228. package/lib/typescript/react-query/utils/actions/deleteItem.d.ts.map +0 -1
  229. package/lib/typescript/react-query/utils/actions/emitDevToolsEvent.d.ts.map +0 -1
  230. package/lib/typescript/react-query/utils/actions/invalidate.d.ts.map +0 -1
  231. package/lib/typescript/react-query/utils/actions/refetch.d.ts.map +0 -1
  232. package/lib/typescript/react-query/utils/actions/remove.d.ts.map +0 -1
  233. package/lib/typescript/react-query/utils/actions/reset.d.ts.map +0 -1
  234. package/lib/typescript/react-query/utils/actions/triggerError.d.ts.map +0 -1
  235. package/lib/typescript/react-query/utils/actions/triggerLoading.d.ts.map +0 -1
  236. package/lib/typescript/react-query/utils/deleteNestedDataByPath.d.ts.map +0 -1
  237. package/lib/typescript/react-query/utils/getQueryStatusColor.d.ts.map +0 -1
  238. package/lib/typescript/react-query/utils/getQueryStatusLabel.d.ts.map +0 -1
  239. package/lib/typescript/react-query/utils/getStorageQueryCounts.d.ts.map +0 -1
  240. package/lib/typescript/react-query/utils/modalStorageOperations.d.ts.map +0 -1
  241. package/lib/typescript/react-query/utils/storageQueryUtils.d.ts.map +0 -1
  242. package/lib/typescript/react-query/utils/testIDs.d.ts.map +0 -1
  243. package/lib/typescript/react-query/utils/updateNestedDataByPath.d.ts.map +0 -1
@@ -1,284 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Time Machine snapshot provider for React Query.
5
- *
6
- * Unlike the other providers this one can't register at module init — the
7
- * QueryClient only exists in React context — so useReactQuerySyncAdapter
8
- * (mounted app-lifetime by FloatingDevTools' auto external sync) registers
9
- * it per-client via an effect.
10
- *
11
- * Restore is a device-safe DIFF against the live cache, NOT the desktop
12
- * Hydrate: that one detaches live observers and mocks queryFns, which is
13
- * fine on a mirror client and destructive in a running app. Here existing
14
- * queries get `setState` (observers stay attached and are notified, keeping
15
- * their real queryFns), missing ones are built into the cache, and extras
16
- * are removed. Mutations aren't restorable (mutationFns can't be captured);
17
- * the mutation cache is cleared instead.
18
- */
19
-
20
- import { classifyPreviewItem, createRestoreScope, emptyRestoreResult, failedRestore, registerStateSnapshotProvider, superJsonSerialize } from "@buoy-gg/shared-ui";
21
- import { isWireDataMarker } from "./dehydrate";
22
- /** A restored query must never claim an in-flight fetch it doesn't have. */
23
- function normalizeState(state) {
24
- return {
25
- ...state,
26
- fetchStatus: "idle",
27
- fetchMeta: null
28
- };
29
- }
30
-
31
- /**
32
- * The comparable projection of a query for previews: status/error/data ONLY.
33
- * Timestamps (dataUpdatedAt etc.) are excluded — including them makes every
34
- * query read as "changed" the moment anything refetches.
35
- */
36
- function comparableQuery(q) {
37
- return {
38
- status: q.state.status,
39
- error: q.state.error ?? null,
40
- data: q.state.data
41
- };
42
- }
43
- function queryLabel(queryKey, queryHash) {
44
- try {
45
- const s = JSON.stringify(queryKey);
46
- return s.length > 60 ? `${s.slice(0, 57)}…` : s;
47
- } catch {
48
- return queryHash;
49
- }
50
- }
51
-
52
- /**
53
- * A query `error` (and `fetchFailureReason`) usually holds the live
54
- * Axios/fetch error: `request` points at the XHR, which is cyclic and would
55
- * fail the whole snapshot's serialization. Only name + message survive —
56
- * that's all a restored error state needs.
57
- */
58
- function toStoredError(value) {
59
- if (value == null) return value ?? null;
60
- if (typeof value === "object") {
61
- const err = value;
62
- const name = typeof err.name === "string" ? err.name : undefined;
63
- const message = typeof err.message === "string" ? err.message : undefined;
64
- if (name !== undefined || message !== undefined) {
65
- return {
66
- ...(name !== undefined ? {
67
- name
68
- } : {}),
69
- ...(message !== undefined ? {
70
- message
71
- } : {})
72
- };
73
- }
74
- }
75
- return value;
76
- }
77
-
78
- /** Would the Time Machine vault be able to store this value? */
79
- function isStorable(value) {
80
- if (value === undefined) return true;
81
- try {
82
- superJsonSerialize(value);
83
- return true;
84
- } catch {
85
- return false;
86
- }
87
- }
88
-
89
- /**
90
- * The queries as a SNAPSHOT sees them — raw.
91
- *
92
- * Deliberately NOT `dehydrateQueryClient()`: that is the WIRE form, which
93
- * swaps any payload over 16KB for a `DATA_ON_DEVICE` marker so the dashboard
94
- * stays inside its emit budget. Snapshots live on-device in persistentStorage
95
- * with no such budget, and restoring a marker would write the placeholder
96
- * object into the live cache — the app then renders `{__buoyDataOnDevice}` as
97
- * if it were its data and crashes on the first field it reads.
98
- */
99
- function captureQueries(client) {
100
- const warnings = [];
101
- const queries = [];
102
- for (const query of client.getQueryCache().getAll()) {
103
- const label = queryLabel(query.queryKey, query.queryHash);
104
- if (!isStorable(query.state.data)) {
105
- warnings.push(`query ${label}: data can't be serialized (circular reference?) — not captured`);
106
- continue;
107
- }
108
- queries.push({
109
- queryKey: query.queryKey,
110
- queryHash: query.queryHash,
111
- ...(query.meta && isStorable(query.meta) ? {
112
- meta: query.meta
113
- } : {}),
114
- state: normalizeState({
115
- ...query.state,
116
- error: toStoredError(query.state.error),
117
- fetchFailureReason: toStoredError(query.state.fetchFailureReason)
118
- })
119
- });
120
- }
121
- return {
122
- queries,
123
- warnings
124
- };
125
- }
126
- export function createQuerySnapshotProvider(queryClient) {
127
- return {
128
- id: "query",
129
- label: "React Query",
130
- status: () => ({
131
- canCapture: true,
132
- canRestore: true
133
- }),
134
- async capture() {
135
- const {
136
- queries,
137
- warnings
138
- } = captureQueries(queryClient);
139
- const mutationCount = queryClient.getMutationCache().getAll().length;
140
- if (mutationCount > 0) {
141
- warnings.push(`${mutationCount} mutation(s) not captured (mutation functions cannot be restored)`);
142
- }
143
- return {
144
- data: {
145
- queries
146
- },
147
- warnings
148
- };
149
- },
150
- async restore(data, options) {
151
- const snapshot = data;
152
- const scope = createRestoreScope(options);
153
- const result = emptyRestoreResult();
154
- if (!snapshot?.queries) {
155
- return failedRestore("empty query snapshot");
156
- }
157
- const cache = queryClient.getQueryCache();
158
- const snapHashes = new Set(snapshot.queries.map(q => q.queryHash));
159
- for (const snap of snapshot.queries) {
160
- if (!scope.allows(snap.queryHash)) continue;
161
- // Snapshots taken before the raw-capture fix hold a wire placeholder
162
- // instead of the data. Writing that into the cache hands the app an
163
- // object with none of its fields — leave the live query alone and say
164
- // why, rather than "restoring" a value that crashes the screen.
165
- if (isWireDataMarker(snap.state.data)) {
166
- result.skipped.push({
167
- id: snap.queryHash,
168
- reason: "captured as an on-device placeholder by an older Buoy — re-capture this restore point"
169
- });
170
- continue;
171
- }
172
- try {
173
- const state = normalizeState(snap.state);
174
- const existing = cache.get(snap.queryHash);
175
- if (existing) {
176
- // Observers stay attached (with their real queryFns) and get
177
- // notified — the safe on-device path, same as triggerError's.
178
- existing.setState(state);
179
- } else {
180
- cache.build(queryClient, {
181
- queryKey: snap.queryKey,
182
- queryHash: snap.queryHash,
183
- ...(snap.meta && {
184
- meta: snap.meta
185
- })
186
- }, state);
187
- }
188
- result.applied += 1;
189
- } catch (e) {
190
- result.skipped.push({
191
- id: snap.queryHash,
192
- reason: String(e)
193
- });
194
- result.ok = false;
195
- }
196
- }
197
-
198
- // Cache entries the snapshot doesn't know about get removed; a mounted
199
- // observer will rebuild + refetch its query on next interaction.
200
- for (const query of cache.getAll().slice()) {
201
- if (!scope.allows(query.queryHash)) continue;
202
- if (!snapHashes.has(query.queryHash)) {
203
- try {
204
- cache.remove(query);
205
- result.applied += 1;
206
- } catch (e) {
207
- result.skipped.push({
208
- id: query.queryHash,
209
- reason: String(e)
210
- });
211
- }
212
- }
213
- }
214
- const mutationCount = queryClient.getMutationCache().getAll().length;
215
- if (mutationCount > 0) {
216
- queryClient.getMutationCache().clear();
217
- result.warnings.push(`mutation cache cleared (${mutationCount} mutation(s))`);
218
- }
219
- const excludedWarning = scope.excludedWarning("quer(y/ies)");
220
- if (excludedWarning) result.warnings.push(excludedWarning);
221
- return result;
222
- },
223
- /** Per-query restore preview. `base` omitted = compare against live cache. */
224
- async previewItems(target, base) {
225
- const targetQueries = target?.queries ?? [];
226
- const liveMode = base === undefined;
227
- // Live side goes through the same raw capture as a snapshot would, so a
228
- // big query diffs as its real value instead of a wire placeholder.
229
- const baseQueries = liveMode ? captureQueries(queryClient).queries : base?.queries ?? [];
230
- const baseByHash = new Map(baseQueries.map(q => [q.queryHash, q]));
231
- const targetByHash = new Map(targetQueries.map(q => [q.queryHash, q]));
232
- const items = [];
233
- const notes = [];
234
- for (const q of targetQueries) {
235
- const label = queryLabel(q.queryKey, q.queryHash);
236
- if (isWireDataMarker(q.state.data)) {
237
- items.push({
238
- key: q.queryHash,
239
- label,
240
- verdict: "wont-apply",
241
- reason: "data stayed on the device when this was captured (older Buoy) — re-capture this restore point"
242
- });
243
- continue;
244
- }
245
- const baseQ = baseByHash.get(q.queryHash);
246
- items.push(classifyPreviewItem({
247
- key: q.queryHash,
248
- label,
249
- oldValue: baseQ ? comparableQuery(baseQ) : undefined,
250
- newValue: comparableQuery(q),
251
- inOld: baseQ !== undefined,
252
- inNew: true
253
- }, {
254
- tooLargeReason: "query data too large to render a diff — restore still applies it"
255
- }));
256
- }
257
- for (const q of baseQueries) {
258
- if (!targetByHash.has(q.queryHash)) {
259
- items.push({
260
- key: q.queryHash,
261
- label: queryLabel(q.queryKey, q.queryHash),
262
- verdict: "removed",
263
- oldValue: comparableQuery(q)
264
- });
265
- }
266
- }
267
- if (liveMode) {
268
- const mutationCount = queryClient.getMutationCache().getAll().length;
269
- if (mutationCount > 0) {
270
- notes.push(`${mutationCount} in-memory mutation record(s) will be cleared`);
271
- }
272
- }
273
- return {
274
- items,
275
- notes
276
- };
277
- }
278
- };
279
- }
280
-
281
- /** Register for one client; returns the unregister fn. Last client wins. */
282
- export function registerQuerySnapshotProvider(queryClient) {
283
- return registerStateSnapshotProvider(createQuerySnapshotProvider(queryClient));
284
- }
1
+ "use strict";import{classifyPreviewItem as w,createRestoreScope as b,emptyRestoreResult as S,failedRestore as Q,registerStateSnapshotProvider as M,superJsonSerialize as R}from"@buoy-gg/shared-ui";import{isWireDataMarker as p}from"./dehydrate";function m(t){return{...t,fetchStatus:"idle",fetchMeta:null}}function l(t){return{status:t.state.status,error:t.state.error??null,data:t.state.data}}function f(t,a){try{const s=JSON.stringify(t);return s.length>60?`${s.slice(0,57)}\u2026`:s}catch{return a}}function g(t){if(t==null)return t??null;if(typeof t==="object"){const a=t;const s=typeof a.name==="string"?a.name:void 0;const r=typeof a.message==="string"?a.message:void 0;if(s!==void 0||r!==void 0){return{...s!==void 0?{name:s}:{},...r!==void 0?{message:r}:{}}}}return t}function q(t){if(t===void 0)return true;try{R(t);return true}catch{return false}}function H(t){const a=[];const s=[];for(const r of t.getQueryCache().getAll()){const u=f(r.queryKey,r.queryHash);if(!q(r.state.data)){a.push(`query ${u}: data can't be serialized (circular reference?) \u2014 not captured`);continue}s.push({queryKey:r.queryKey,queryHash:r.queryHash,...r.meta&&q(r.meta)?{meta:r.meta}:{},state:m({...r.state,error:g(r.state.error),fetchFailureReason:g(r.state.fetchFailureReason)})})}return{queries:s,warnings:a}}export function createQuerySnapshotProvider(t){return{id:"query",label:"React Query",status:()=>({canCapture:true,canRestore:true}),async capture(){const{queries:a,warnings:s}=H(t);const r=t.getMutationCache().getAll().length;if(r>0){s.push(`${r} mutation(s) not captured (mutation functions cannot be restored)`)}return{data:{queries:a},warnings:s}},async restore(a,s){const r=a;const u=b(s);const n=S();if(!r?.queries){return Q("empty query snapshot")}const c=t.getQueryCache();const y=new Set(r.queries.map(e=>e.queryHash));for(const e of r.queries){if(!u.allows(e.queryHash))continue;if(p(e.state.data)){n.skipped.push({id:e.queryHash,reason:"captured as an on-device placeholder by an older Buoy \u2014 re-capture this restore point"});continue}try{const o=m(e.state);const d=c.get(e.queryHash);if(d){d.setState(o)}else{c.build(t,{queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:e.meta}},o)}n.applied+=1}catch(o){n.skipped.push({id:e.queryHash,reason:String(o)});n.ok=false}}for(const e of c.getAll().slice()){if(!u.allows(e.queryHash))continue;if(!y.has(e.queryHash)){try{c.remove(e);n.applied+=1}catch(o){n.skipped.push({id:e.queryHash,reason:String(o)})}}}const i=t.getMutationCache().getAll().length;if(i>0){t.getMutationCache().clear();n.warnings.push(`mutation cache cleared (${i} mutation(s))`)}const h=u.excludedWarning("quer(y/ies)");if(h)n.warnings.push(h);return n},async previewItems(a,s){const r=a?.queries??[];const u=s===void 0;const n=u?H(t).queries:s?.queries??[];const c=new Map(n.map(e=>[e.queryHash,e]));const y=new Map(r.map(e=>[e.queryHash,e]));const i=[];const h=[];for(const e of r){const o=f(e.queryKey,e.queryHash);if(p(e.state.data)){i.push({key:e.queryHash,label:o,verdict:"wont-apply",reason:"data stayed on the device when this was captured (older Buoy) \u2014 re-capture this restore point"});continue}const d=c.get(e.queryHash);i.push(w({key:e.queryHash,label:o,oldValue:d?l(d):void 0,newValue:l(e),inOld:d!==void 0,inNew:true},{tooLargeReason:"query data too large to render a diff \u2014 restore still applies it"}))}for(const e of n){if(!y.has(e.queryHash)){i.push({key:e.queryHash,label:f(e.queryKey,e.queryHash),verdict:"removed",oldValue:l(e)})}}if(u){const e=t.getMutationCache().getAll().length;if(e>0){h.push(`${e} in-memory mutation record(s) will be cleared`)}}return{items:i,notes:h}}}}export function registerQuerySnapshotProvider(t){return M(createQuerySnapshotProvider(t))}
@@ -1,31 +1 @@
1
- "use strict";
2
-
3
- import { useEffect, useMemo } from "react";
4
- import { useQueryClient } from "@tanstack/react-query";
5
- import { createReactQuerySyncAdapter } from "./reactQuerySyncAdapter";
6
- import { registerQuerySnapshotProvider } from "./snapshotProvider";
7
-
8
- /**
9
- * Context-based variant of createReactQuerySyncAdapter for zero-config
10
- * wiring (FloatingDevTools' auto external sync): reads the QueryClient from
11
- * the surrounding QueryClientProvider. Returns null when rendered outside a
12
- * provider so callers can skip registering the query tool.
13
- */
14
- export function useReactQuerySyncAdapter() {
15
- let queryClient;
16
- try {
17
- // Just a context read — throws only when there is no provider above us,
18
- // which never changes for a mounted tree, so hook order stays stable.
19
- queryClient = useQueryClient();
20
- } catch {
21
- queryClient = null;
22
- }
23
-
24
- // Register the Time Machine snapshot provider for this client — this hook
25
- // is the one app-lifetime spot that actually holds the QueryClient.
26
- useEffect(() => {
27
- if (!queryClient) return;
28
- return registerQuerySnapshotProvider(queryClient);
29
- }, [queryClient]);
30
- return useMemo(() => queryClient ? createReactQuerySyncAdapter(queryClient) : null, [queryClient]);
31
- }
1
+ "use strict";import{useEffect as e,useMemo as t}from"react";import{useQueryClient as u}from"@tanstack/react-query";import{createReactQuerySyncAdapter as o}from"./reactQuerySyncAdapter";import{registerQuerySnapshotProvider as n}from"./snapshotProvider";export function useReactQuerySyncAdapter(){let r;try{r=u()}catch{r=null}e(()=>{if(!r)return;return n(r)},[r]);return t(()=>r?o(r):null,[r])}
@@ -1,10 +1 @@
1
- "use strict";
2
-
3
- // Shared type definitions for the dev tools
4
-
5
- /**
6
- * Type guard that narrows a value to a plain object (excluding arrays, Dates, Maps, etc.).
7
- */
8
- export function isPlainObject(value) {
9
- return value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Error) && !(value instanceof Map) && !(value instanceof Set) && !(value instanceof RegExp) && typeof value !== "function";
10
- }
1
+ "use strict";export function isPlainObject(n){return n!==null&&n!==void 0&&typeof n==="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof Error)&&!(n instanceof Map)&&!(n instanceof Set)&&!(n instanceof RegExp)&&typeof n!=="function"}
@@ -1,19 +1 @@
1
- "use strict";
2
-
3
- import { deleteNestedDataByPath } from "../deleteNestedDataByPath";
4
- export default function deleteItem({
5
- activeQuery,
6
- dataPath,
7
- queryClient
8
- }) {
9
- if (!dataPath) {
10
- // Early return if path is missing
11
- return;
12
- }
13
- const oldData = activeQuery.state.data;
14
- const newData = deleteNestedDataByPath(oldData, dataPath);
15
-
16
- // Force a new object reference to ensure React detects the change
17
- const forceNewReference = JSON.parse(JSON.stringify(newData));
18
- queryClient.setQueryData(activeQuery.queryKey, forceNewReference);
19
- }
1
+ "use strict";import{deleteNestedDataByPath as o}from"../deleteNestedDataByPath";export default function f({activeQuery:e,dataPath:t,queryClient:r}){if(!t){return}const a=e.state.data;const s=o(a,t);const n=JSON.parse(JSON.stringify(s));r.setQueryData(e.queryKey,n)}
@@ -1,36 +1 @@
1
- "use strict";
2
-
3
- const DEV_TOOLS_EVENT = "@tanstack/query-devtools-event";
4
-
5
- /**
6
- * Announce a devtool action as the same DOM CustomEvent the official TanStack
7
- * devtools panel emits. On the device this is a no-op (React Native has no
8
- * CustomEvent), so actions stay purely local. In Buoy Desktop these components
9
- * render against a mirror QueryClient hydrated from the device, and the
10
- * dashboard listens for this event to forward the action over the sync
11
- * protocol — without it, actions only touch the mirror and are wiped by the
12
- * next device snapshot.
13
- *
14
- * Call BEFORE mutating the local cache: the desktop handler resolves the
15
- * query by hash, so for REMOVE the query must still exist in the mirror.
16
- */
17
- export function emitDevToolsEvent(type, queryHash) {
18
- try {
19
- // globalThis === window in browsers; React Native lacks CustomEvent, so
20
- // this bails out there. No DOM lib in this package's tsconfig — cast.
21
- const g = globalThis;
22
- if (typeof g.dispatchEvent !== "function" || typeof g.CustomEvent !== "function") {
23
- return;
24
- }
25
- g.dispatchEvent(new g.CustomEvent(DEV_TOOLS_EVENT, {
26
- detail: {
27
- type,
28
- queryHash
29
- },
30
- bubbles: true,
31
- cancelable: true
32
- }));
33
- } catch {
34
- // Never let event plumbing break the action itself.
35
- }
36
- }
1
+ "use strict";const o="@tanstack/query-devtools-event";export function emitDevToolsEvent(e,n){try{const t=globalThis;if(typeof t.dispatchEvent!=="function"||typeof t.CustomEvent!=="function"){return}t.dispatchEvent(new t.CustomEvent(o,{detail:{type:e,queryHash:n},bubbles:true,cancelable:true}))}catch{}}
@@ -1,11 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function invalidate({
5
- query,
6
- queryClient
7
- }) {
8
- emitDevToolsEvent("INVALIDATE", query.queryHash);
9
- // This matches the ACTION-INVALIDATE case from the external sync system
10
- queryClient.invalidateQueries(query);
11
- }
1
+ "use strict";import{emitDevToolsEvent as i}from"./emitDevToolsEvent";export default function a({query:e,queryClient:t}){i("INVALIDATE",e.queryHash);t.invalidateQueries(e)}
@@ -1,13 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function refetch({
5
- query
6
- }) {
7
- emitDevToolsEvent("REFETCH", query.queryHash);
8
- // This matches the ACTION-REFETCH case from the external sync system
9
- const promise = query.fetch();
10
- promise.catch(() => {
11
- // Silently handle fetch errors
12
- });
13
- }
1
+ "use strict";import{emitDevToolsEvent as o}from"./emitDevToolsEvent";export default function c({query:t}){o("REFETCH",t.queryHash);const e=t.fetch();e.catch(()=>{})}
@@ -1,11 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function remove({
5
- query,
6
- queryClient
7
- }) {
8
- // Emit first — the desktop bridge still needs to find this hash in the cache.
9
- emitDevToolsEvent("REMOVE", query.queryHash);
10
- queryClient.removeQueries(query);
11
- }
1
+ "use strict";import{emitDevToolsEvent as t}from"./emitDevToolsEvent";export default function r({query:e,queryClient:o}){t("REMOVE",e.queryHash);o.removeQueries(e)}
@@ -1,13 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function reset({
5
- query,
6
- queryClient
7
- }) {
8
- emitDevToolsEvent("RESET", query.queryHash);
9
- queryClient.resetQueries({
10
- queryKey: query.queryKey,
11
- exact: true
12
- });
13
- }
1
+ "use strict";import{emitDevToolsEvent as r}from"./emitDevToolsEvent";export default function s({query:e,queryClient:t}){r("RESET",e.queryHash);t.resetQueries({queryKey:e.queryKey,exact:true})}
@@ -1,29 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function triggerError({
5
- query,
6
- queryClient
7
- }) {
8
- if (query.state.status !== "error") {
9
- emitDevToolsEvent("TRIGGER_ERROR", query.queryHash);
10
- // --ACTION-TRIGGER-ERROR logic--
11
- // This matches the ACTION-TRIGGER-ERROR case from the external sync system
12
- const error = new Error("Unknown error from devtools");
13
- const __previousQueryOptions = query.options;
14
- query.setState({
15
- status: "error",
16
- error,
17
- fetchMeta: {
18
- ...query.state.fetchMeta,
19
- // @ts-expect-error This does exist
20
- __previousQueryOptions
21
- }
22
- });
23
- } else {
24
- emitDevToolsEvent("RESTORE_ERROR", query.queryHash);
25
- // --ACTION-RESTORE-ERROR logic--
26
- // This matches the ACTION-RESTORE-ERROR case from the external sync system
27
- queryClient.resetQueries(query);
28
- }
29
- }
1
+ "use strict";import{emitDevToolsEvent as e}from"./emitDevToolsEvent";export default function n({query:t,queryClient:r}){if(t.state.status!=="error"){e("TRIGGER_ERROR",t.queryHash);const o=new Error("Unknown error from devtools");const s=t.options;t.setState({status:"error",error:o,fetchMeta:{...t.state.fetchMeta,__previousQueryOptions:s}})}else{e("RESTORE_ERROR",t.queryHash);r.resetQueries(t)}}
@@ -1,50 +1 @@
1
- "use strict";
2
-
3
- import { emitDevToolsEvent } from "./emitDevToolsEvent";
4
- export default function triggerLoading({
5
- query
6
- }) {
7
- if (query.state.data === undefined) {
8
- emitDevToolsEvent("RESTORE_LOADING", query.queryHash);
9
- // --ACTION-RESTORE-LOADING logic--
10
- // This matches the ACTION-RESTORE-LOADING case from the external sync system
11
- const previousState = query.state;
12
- const previousOptions = query.state.fetchMeta ? query.state.fetchMeta.__previousQueryOptions : null;
13
- query.cancel({
14
- silent: true
15
- });
16
- query.setState({
17
- ...previousState,
18
- fetchStatus: "idle",
19
- fetchMeta: null
20
- });
21
- if (previousOptions) {
22
- query.fetch(previousOptions);
23
- }
24
- } else {
25
- emitDevToolsEvent("TRIGGER_LOADING", query.queryHash);
26
- // --ACTION-TRIGGER-LOADING logic--
27
- // This matches the ACTION-TRIGGER-LOADING case from the external sync system
28
- const __previousQueryOptions = query.options;
29
-
30
- // Trigger a fetch in order to trigger suspense as well.
31
- query.fetch({
32
- ...__previousQueryOptions,
33
- queryFn: () => {
34
- return new Promise(() => {
35
- // Never resolve - simulates perpetual loading
36
- });
37
- },
38
- gcTime: -1
39
- });
40
- query.setState({
41
- data: undefined,
42
- status: "pending",
43
- fetchMeta: {
44
- ...query.state.fetchMeta,
45
- // @ts-expect-error This does exist
46
- __previousQueryOptions
47
- }
48
- });
49
- }
50
- }
1
+ "use strict";import{emitDevToolsEvent as a}from"./emitDevToolsEvent";export default function n({query:t}){if(t.state.data===void 0){a("RESTORE_LOADING",t.queryHash);const e=t.state;const s=t.state.fetchMeta?t.state.fetchMeta.__previousQueryOptions:null;t.cancel({silent:true});t.setState({...e,fetchStatus:"idle",fetchMeta:null});if(s){t.fetch(s)}}else{a("TRIGGER_LOADING",t.queryHash);const e=t.options;t.fetch({...e,queryFn:()=>{return new Promise(()=>{})},gcTime:-1});t.setState({data:void 0,status:"pending",fetchMeta:{...t.state.fetchMeta,__previousQueryOptions:e}})}}
@@ -1,51 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Deletes nested data by path
5
- *
6
- * @param {unknown} oldData Data to be updated
7
- * @param {Array<string>} deletePath Path to the data to be deleted
8
- * @returns newData without the deleted items by path
9
- */
10
- export const deleteNestedDataByPath = (oldData, deletePath) => {
11
- if (oldData instanceof Map) {
12
- const newData = new Map(oldData);
13
- if (deletePath.length === 1) {
14
- newData.delete(deletePath[0]);
15
- return newData;
16
- }
17
- const [head, ...tail] = deletePath;
18
- newData.set(head, deleteNestedDataByPath(newData.get(head), tail));
19
- return newData;
20
- }
21
- if (oldData instanceof Set) {
22
- const setAsArray = deleteNestedDataByPath(Array.from(oldData), deletePath);
23
- return new Set(setAsArray);
24
- }
25
- if (Array.isArray(oldData)) {
26
- const newData = [...oldData];
27
- if (deletePath.length === 1) {
28
- return newData.filter((_, idx) => idx.toString() !== deletePath[0]);
29
- }
30
- const [head, ...tail] = deletePath;
31
-
32
- // @ts-expect-error NAS
33
- newData[head] = deleteNestedDataByPath(newData[head], tail);
34
- return newData;
35
- }
36
- if (oldData instanceof Object) {
37
- const newData = {
38
- ...oldData
39
- };
40
- if (deletePath.length === 1) {
41
- // @ts-expect-error NAS
42
- delete newData[deletePath[0]];
43
- return newData;
44
- }
45
- const [head, ...tail] = deletePath;
46
- // @ts-expect-error NAS
47
- newData[head] = deleteNestedDataByPath(newData[head], tail);
48
- return newData;
49
- }
50
- return oldData;
51
- };
1
+ "use strict";export const deleteNestedDataByPath=(t,r)=>{if(t instanceof Map){const n=new Map(t);if(r.length===1){n.delete(r[0]);return n}const[s,...i]=r;n.set(s,deleteNestedDataByPath(n.get(s),i));return n}if(t instanceof Set){const n=deleteNestedDataByPath(Array.from(t),r);return new Set(n)}if(Array.isArray(t)){const n=[...t];if(r.length===1){return n.filter((c,e)=>e.toString()!==r[0])}const[s,...i]=r;n[s]=deleteNestedDataByPath(n[s],i);return n}if(t instanceof Object){const n={...t};if(r.length===1){delete n[r[0]];return n}const[s,...i]=r;n[s]=deleteNestedDataByPath(n[s],i);return n}return t};
@@ -1,12 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Maps a query’s runtime state to one of the predefined status color tokens used in the UI.
5
- */
6
- export function getQueryStatusColor({
7
- queryState,
8
- observerCount,
9
- isStale
10
- }) {
11
- return queryState.fetchStatus === "fetching" ? "blue" : queryState.status === "error" ? "red" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
12
- }
1
+ "use strict";export function getQueryStatusColor({queryState:t,observerCount:e,isStale:r}){return t.fetchStatus==="fetching"?"blue":t.status==="error"?"red":!e?"gray":t.fetchStatus==="paused"?"purple":r?"yellow":"green"}
@@ -1,19 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Converts a query object into a human-friendly status string for badge rendering.
5
- * Priority order: disabled > fetching > error > inactive > paused > stale > fresh
6
- *
7
- * "error" sits just below "fetching" so a hard-failed query (status === "error",
8
- * i.e. failed with no cached data) surfaces as an error instead of hiding under
9
- * "inactive"/"stale", while an in-flight retry still reads as "fetching". This
10
- * is the single source of truth every consumer (cards, dots, counts, the Error
11
- * filter) reads, and it matches the dashboard sidebar's error dot exactly.
12
- */
13
- export function getQueryStatusLabel(query) {
14
- // Check disabled first - disabled queries won't automatically fetch
15
- if (query.isDisabled()) {
16
- return "disabled";
17
- }
18
- return query.state.fetchStatus === "fetching" ? "fetching" : query.state.status === "error" ? "error" : !query.getObserversCount() ? "inactive" : query.state.fetchStatus === "paused" ? "paused" : query.isStale() ? "stale" : "fresh";
19
- }
1
+ "use strict";export function getQueryStatusLabel(t){if(t.isDisabled()){return"disabled"}return t.state.fetchStatus==="fetching"?"fetching":t.state.status==="error"?"error":!t.getObserversCount()?"inactive":t.state.fetchStatus==="paused"?"paused":t.isStale()?"stale":"fresh"}
@@ -1,31 +1 @@
1
- "use strict";
2
-
3
- import { isStorageQuery, getStorageType, getCleanStorageKey } from "./storageQueryUtils";
4
- import { isDevToolsStorageKey } from "@buoy-gg/shared-ui";
5
- /**
6
- * Calculate counts for each storage type from storage queries
7
- * Following performance principles: no unnecessary memoization [[memory:4875074]]
8
- */
9
- export function getStorageQueryCounts(queries) {
10
- const counts = {
11
- mmkv: 0,
12
- async: 0,
13
- secure: 0,
14
- total: 0
15
- };
16
-
17
- // Filter to storage queries only, then count by type
18
- const storageQueries = queries.filter(query => isStorageQuery(query.queryKey));
19
- storageQueries.forEach(query => {
20
- const storageType = getStorageType(query.queryKey);
21
- if (storageType) {
22
- // Filter out dev tool keys from the counts
23
- const cleanKey = getCleanStorageKey(query.queryKey);
24
- if (!isDevToolsStorageKey(cleanKey)) {
25
- counts[storageType]++;
26
- counts.total++;
27
- }
28
- }
29
- });
30
- return counts;
31
- }
1
+ "use strict";import{isStorageQuery as y,getStorageType as n,getCleanStorageKey as c}from"./storageQueryUtils";import{isDevToolsStorageKey as u}from"@buoy-gg/shared-ui";export function getStorageQueryCounts(r){const t={mmkv:0,async:0,secure:0,total:0};const s=r.filter(e=>y(e.queryKey));s.forEach(e=>{const o=n(e.queryKey);if(o){const a=c(e.queryKey);if(!u(a)){t[o]++;t.total++}}});return t}