@fozy-labs/rx-toolkit 0.5.4 → 0.6.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 (302) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +22 -13
  3. package/dist/common/devtools/reduxDevtools.js +17 -2
  4. package/dist/common/react/index.d.ts +1 -0
  5. package/dist/common/react/index.js +1 -0
  6. package/dist/common/react/useIsomorphicLayoutEffect.d.ts +17 -0
  7. package/dist/common/react/useIsomorphicLayoutEffect.js +17 -0
  8. package/dist/index.d.ts +1 -2
  9. package/dist/index.js +1 -2
  10. package/dist/query/api/createApi.d.ts +4 -0
  11. package/dist/query/api/createApi.js +9 -0
  12. package/dist/query/api/index.d.ts +1 -0
  13. package/dist/query/api/index.js +1 -0
  14. package/dist/query/constants.d.ts +12 -0
  15. package/dist/query/constants.js +15 -0
  16. package/dist/query/core/api/Api.d.ts +20 -0
  17. package/dist/query/core/api/Api.js +129 -0
  18. package/dist/query/core/api/constants.d.ts +2 -0
  19. package/dist/query/core/api/constants.js +3 -0
  20. package/dist/query/core/api/index.d.ts +4 -0
  21. package/dist/query/core/api/index.js +4 -0
  22. package/dist/query/core/api/mergeHooks.d.ts +2 -0
  23. package/dist/query/core/api/mergeHooks.js +26 -0
  24. package/dist/query/core/api/normalizeLinks.d.ts +2 -0
  25. package/dist/query/core/api/normalizeLinks.js +11 -0
  26. package/dist/query/core/cache/CacheEntry.d.ts +21 -0
  27. package/dist/query/core/cache/CacheEntry.js +54 -0
  28. package/dist/query/core/cache/CacheMap.d.ts +19 -0
  29. package/dist/query/core/cache/CacheMap.js +32 -0
  30. package/dist/query/core/cache/QueryCacheEntry.d.ts +21 -0
  31. package/dist/query/core/cache/QueryCacheEntry.js +136 -0
  32. package/dist/query/core/cache/index.d.ts +3 -0
  33. package/dist/query/core/cache/index.js +3 -0
  34. package/dist/query/core/command/Command.d.ts +67 -0
  35. package/dist/query/core/command/Command.js +253 -0
  36. package/dist/query/core/command/CommandAgent.d.ts +17 -0
  37. package/dist/query/core/command/CommandAgent.js +67 -0
  38. package/dist/query/core/command/LinkManager.d.ts +24 -0
  39. package/dist/query/core/command/LinkManager.js +71 -0
  40. package/dist/query/core/command/index.d.ts +2 -0
  41. package/dist/query/core/command/index.js +2 -0
  42. package/dist/query/core/errors/CacheEntryRemovedError.d.ts +7 -0
  43. package/dist/query/core/errors/CacheEntryRemovedError.js +9 -0
  44. package/dist/query/core/errors/MachineStateError.d.ts +8 -0
  45. package/dist/query/core/errors/MachineStateError.js +10 -0
  46. package/dist/query/core/errors/MachineTransitionError.d.ts +7 -0
  47. package/dist/query/core/errors/MachineTransitionError.js +9 -0
  48. package/dist/query/core/errors/index.d.ts +3 -0
  49. package/dist/query/core/errors/index.js +3 -0
  50. package/dist/query/core/index.d.ts +8 -0
  51. package/dist/query/core/index.js +8 -0
  52. package/dist/query/core/machine/Machine.d.ts +21 -0
  53. package/dist/query/core/machine/Machine.js +42 -0
  54. package/dist/query/core/machine/MachineBase.d.ts +31 -0
  55. package/dist/query/core/machine/MachineBase.js +176 -0
  56. package/dist/query/core/machine/MachineError.d.ts +10 -0
  57. package/dist/query/core/machine/MachineError.js +19 -0
  58. package/dist/query/core/machine/MachinePending.d.ts +13 -0
  59. package/dist/query/core/machine/MachinePending.js +32 -0
  60. package/dist/query/core/machine/MachineRefreshError.d.ts +12 -0
  61. package/dist/query/core/machine/MachineRefreshError.js +23 -0
  62. package/dist/query/core/machine/MachineRefreshing.d.ts +15 -0
  63. package/dist/query/core/machine/MachineRefreshing.js +43 -0
  64. package/dist/query/core/machine/MachineSuccess.d.ts +12 -0
  65. package/dist/query/core/machine/MachineSuccess.js +23 -0
  66. package/dist/query/core/machine/MachineWithData.d.ts +25 -0
  67. package/dist/query/core/machine/MachineWithData.js +73 -0
  68. package/dist/query/core/machine/index.d.ts +9 -0
  69. package/dist/query/core/machine/index.js +9 -0
  70. package/dist/query/core/machine/machine-helpers.d.ts +9 -0
  71. package/dist/query/core/machine/machine-helpers.js +80 -0
  72. package/dist/query/core/patcher/Patcher.d.ts +30 -0
  73. package/dist/query/core/patcher/Patcher.js +122 -0
  74. package/dist/query/core/patcher/index.d.ts +1 -0
  75. package/dist/query/core/patcher/index.js +1 -0
  76. package/dist/query/core/resource/Resource.d.ts +105 -0
  77. package/dist/query/core/resource/Resource.js +340 -0
  78. package/dist/query/core/resource/ResourceAgent.d.ts +37 -0
  79. package/dist/query/core/resource/ResourceAgent.js +179 -0
  80. package/dist/query/core/resource/index.d.ts +2 -0
  81. package/dist/query/core/resource/index.js +2 -0
  82. package/dist/query/core/snapshoter/Snapshoter.d.ts +22 -0
  83. package/dist/query/core/snapshoter/Snapshoter.js +78 -0
  84. package/dist/query/core/snapshoter/index.d.ts +2 -0
  85. package/dist/query/core/snapshoter/index.js +1 -0
  86. package/dist/query/core/syncer/Syncer.d.ts +32 -0
  87. package/dist/query/core/syncer/Syncer.js +85 -0
  88. package/dist/query/core/syncer/index.d.ts +2 -0
  89. package/dist/query/core/syncer/index.js +1 -0
  90. package/dist/query/index.d.ts +5 -10
  91. package/dist/query/index.js +5 -13
  92. package/dist/query/lib/broadcastSyncDriver.d.ts +5 -0
  93. package/dist/query/lib/broadcastSyncDriver.js +46 -0
  94. package/dist/query/lib/index.d.ts +3 -0
  95. package/dist/query/lib/index.js +3 -0
  96. package/dist/{query-v2 → query}/lib/stableStringify.js +5 -3
  97. package/dist/query/lib/toKeyed.d.ts +11 -0
  98. package/dist/query/lib/toKeyed.js +18 -0
  99. package/dist/query/react/ReactHooksPlugin.d.ts +31 -0
  100. package/dist/query/react/ReactHooksPlugin.js +21 -0
  101. package/dist/query/react/index.d.ts +3 -0
  102. package/dist/query/react/index.js +3 -0
  103. package/dist/query/react/useCommand.d.ts +2 -0
  104. package/dist/query/react/useCommand.js +14 -0
  105. package/dist/query/react/useResource.d.ts +2 -0
  106. package/dist/query/react/useResource.js +16 -0
  107. package/dist/query/types/api.d.ts +39 -0
  108. package/dist/query/types/cache.d.ts +51 -0
  109. package/dist/query/types/command.d.ts +52 -0
  110. package/dist/query/types/common.d.ts +65 -0
  111. package/dist/query/types/index.d.ts +8 -4
  112. package/dist/query/types/index.js +8 -5
  113. package/dist/query/types/plugin-hkt.d.ts +64 -0
  114. package/dist/query/types/resource.d.ts +49 -0
  115. package/dist/query/types/snapshot.d.ts +27 -0
  116. package/dist/query/types/snapshot.js +2 -0
  117. package/dist/query/types/state.d.ts +24 -0
  118. package/dist/signals/base/ComputeCache.js +1 -1
  119. package/dist/signals/base/Devtools.js +2 -6
  120. package/dist/signals/signals/Computed.d.ts +1 -0
  121. package/dist/signals/signals/Computed.js +5 -1
  122. package/dist/signals/signals/Effect.d.ts +0 -4
  123. package/dist/signals/signals/Effect.js +0 -6
  124. package/dist/signals/signals/LocalState.d.ts +1 -10
  125. package/dist/signals/signals/LocalState.js +0 -12
  126. package/dist/signals/signals/Signal.d.ts +2 -8
  127. package/dist/signals/signals/Signal.js +1 -10
  128. package/dist/signals/signals/State.d.ts +2 -1
  129. package/dist/signals/signals/State.js +9 -0
  130. package/dist/signals/types/SignalOptions.d.ts +0 -2
  131. package/dist/signals/types/normalizeSignalOptions.js +0 -3
  132. package/dist/signals/types/signals.types.d.ts +3 -1
  133. package/docs/CHANGELOG.md +48 -2
  134. package/docs/migrations/0.6.0.md +224 -0
  135. package/docs/query/README.md +52 -562
  136. package/docs/query/api/README.md +59 -0
  137. package/docs/query/api/_CacheEntry.md +39 -0
  138. package/docs/query/api/_CacheMap.md +30 -0
  139. package/docs/query/api/_QueryCacheEntry.md +81 -0
  140. package/docs/query/api/command-agent.md +60 -0
  141. package/docs/query/api/command.md +76 -0
  142. package/docs/query/api/resource-agent.md +68 -0
  143. package/docs/query/api/resource.md +77 -0
  144. package/docs/query/concepts/agent.md +70 -0
  145. package/docs/query/concepts/architecture.md +139 -0
  146. package/docs/query/concepts/cache.md +81 -0
  147. package/docs/query/concepts/dataflows.md +473 -0
  148. package/docs/query/concepts/keyed.md +42 -0
  149. package/docs/query/concepts/machine.md +106 -0
  150. package/docs/query/concepts/patching.md +85 -0
  151. package/docs/query/usage/broadcast.md +188 -0
  152. package/docs/query/usage/command.md +203 -0
  153. package/docs/query/usage/lifecycle.md +114 -0
  154. package/docs/query/usage/links.md +125 -0
  155. package/docs/query/usage/plugins.md +96 -0
  156. package/docs/query/usage/resource.md +206 -0
  157. package/docs/query/usage/snapshot.md +80 -0
  158. package/docs/usage/react/README.md +45 -91
  159. package/package.json +5 -7
  160. package/dist/query/SKIP_TOKEN.d.ts +0 -1
  161. package/dist/query/SKIP_TOKEN.js +0 -1
  162. package/dist/query/api/createCommand.d.ts +0 -21
  163. package/dist/query/api/createCommand.js +0 -20
  164. package/dist/query/api/createOperation.d.ts +0 -5
  165. package/dist/query/api/createOperation.js +0 -6
  166. package/dist/query/api/createResource.d.ts +0 -3
  167. package/dist/query/api/createResource.js +0 -2
  168. package/dist/query/api/createResourceDuplicator.d.ts +0 -4
  169. package/dist/query/api/createResourceDuplicator.js +0 -2
  170. package/dist/query/api/resetAllQueriesCache.d.ts +0 -1
  171. package/dist/query/api/resetAllQueriesCache.js +0 -4
  172. package/dist/query/core/Command/Command.d.ts +0 -35
  173. package/dist/query/core/Command/Command.js +0 -210
  174. package/dist/query/core/Command/CommandAgent.d.ts +0 -19
  175. package/dist/query/core/Command/CommandAgent.js +0 -54
  176. package/dist/query/core/Command/index.d.ts +0 -2
  177. package/dist/query/core/Command/index.js +0 -2
  178. package/dist/query/core/Operation/Operation.d.ts +0 -8
  179. package/dist/query/core/Operation/Operation.js +0 -4
  180. package/dist/query/core/Operation/OperationAgent.d.ts +0 -4
  181. package/dist/query/core/Operation/OperationAgent.js +0 -4
  182. package/dist/query/core/QueriesCache.d.ts +0 -9
  183. package/dist/query/core/QueriesCache.js +0 -28
  184. package/dist/query/core/QueriesLifetimeHooks.d.ts +0 -22
  185. package/dist/query/core/QueriesLifetimeHooks.js +0 -86
  186. package/dist/query/core/ResetAllQueriesSignal.d.ts +0 -6
  187. package/dist/query/core/ResetAllQueriesSignal.js +0 -11
  188. package/dist/query/core/Resource/Resource.d.ts +0 -51
  189. package/dist/query/core/Resource/Resource.js +0 -232
  190. package/dist/query/core/Resource/ResourceAgent.d.ts +0 -35
  191. package/dist/query/core/Resource/ResourceAgent.js +0 -110
  192. package/dist/query/core/Resource/ResourceDuplicator.d.ts +0 -73
  193. package/dist/query/core/Resource/ResourceDuplicator.js +0 -227
  194. package/dist/query/core/Resource/ResourceDuplicatorAgent.d.ts +0 -35
  195. package/dist/query/core/Resource/ResourceDuplicatorAgent.js +0 -110
  196. package/dist/query/core/Resource/ResourceRef.d.ts +0 -16
  197. package/dist/query/core/Resource/ResourceRef.js +0 -136
  198. package/dist/query/lib/IndirectMap.d.ts +0 -19
  199. package/dist/query/lib/IndirectMap.js +0 -88
  200. package/dist/query/lib/ReactiveCache.d.ts +0 -62
  201. package/dist/query/lib/ReactiveCache.js +0 -80
  202. package/dist/query/react/useCommandAgent.d.ts +0 -24
  203. package/dist/query/react/useCommandAgent.js +0 -39
  204. package/dist/query/react/useOperationAgent.d.ts +0 -6
  205. package/dist/query/react/useOperationAgent.js +0 -6
  206. package/dist/query/react/useResourceAgent.d.ts +0 -6
  207. package/dist/query/react/useResourceAgent.js +0 -31
  208. package/dist/query/react/useResourceRef.d.ts +0 -5
  209. package/dist/query/react/useResourceRef.js +0 -13
  210. package/dist/query/types/Command.types.d.ts +0 -154
  211. package/dist/query/types/Command.types.js +0 -1
  212. package/dist/query/types/Operation.types.d.ts +0 -13
  213. package/dist/query/types/Operation.types.js +0 -1
  214. package/dist/query/types/Resource.types.d.ts +0 -129
  215. package/dist/query/types/Resource.types.js +0 -1
  216. package/dist/query/types/shared.types.d.ts +0 -26
  217. package/dist/query/types/shared.types.js +0 -1
  218. package/dist/query-v2/api/createApi.d.ts +0 -10
  219. package/dist/query-v2/api/createApi.js +0 -83
  220. package/dist/query-v2/core/common/CacheEntry.d.ts +0 -29
  221. package/dist/query-v2/core/common/CacheEntry.js +0 -71
  222. package/dist/query-v2/core/common/CacheMap.d.ts +0 -38
  223. package/dist/query-v2/core/common/CacheMap.js +0 -127
  224. package/dist/query-v2/core/common/LifecycleHooks.d.ts +0 -22
  225. package/dist/query-v2/core/common/LifecycleHooks.js +0 -104
  226. package/dist/query-v2/core/common/index.d.ts +0 -3
  227. package/dist/query-v2/core/common/index.js +0 -3
  228. package/dist/query-v2/core/index.d.ts +0 -3
  229. package/dist/query-v2/core/index.js +0 -3
  230. package/dist/query-v2/core/machines/Machine.d.ts +0 -14
  231. package/dist/query-v2/core/machines/Machine.js +0 -33
  232. package/dist/query-v2/core/machines/MachineError.d.ts +0 -11
  233. package/dist/query-v2/core/machines/MachineError.js +0 -26
  234. package/dist/query-v2/core/machines/MachineIdle.d.ts +0 -8
  235. package/dist/query-v2/core/machines/MachineIdle.js +0 -19
  236. package/dist/query-v2/core/machines/MachinePending.d.ts +0 -12
  237. package/dist/query-v2/core/machines/MachinePending.js +0 -29
  238. package/dist/query-v2/core/machines/MachineRefreshing.d.ts +0 -14
  239. package/dist/query-v2/core/machines/MachineRefreshing.js +0 -46
  240. package/dist/query-v2/core/machines/MachineSuccess.d.ts +0 -16
  241. package/dist/query-v2/core/machines/MachineSuccess.js +0 -42
  242. package/dist/query-v2/core/machines/MachineWithData.d.ts +0 -18
  243. package/dist/query-v2/core/machines/MachineWithData.js +0 -40
  244. package/dist/query-v2/core/machines/Patcher.d.ts +0 -20
  245. package/dist/query-v2/core/machines/Patcher.js +0 -104
  246. package/dist/query-v2/core/machines/index.d.ts +0 -8
  247. package/dist/query-v2/core/machines/index.js +0 -8
  248. package/dist/query-v2/core/resource/ResourceV2.d.ts +0 -120
  249. package/dist/query-v2/core/resource/ResourceV2.js +0 -464
  250. package/dist/query-v2/core/resource/ResourceV2Agent.d.ts +0 -26
  251. package/dist/query-v2/core/resource/ResourceV2Agent.js +0 -132
  252. package/dist/query-v2/core/resource/index.d.ts +0 -2
  253. package/dist/query-v2/core/resource/index.js +0 -2
  254. package/dist/query-v2/index.d.ts +0 -11
  255. package/dist/query-v2/index.js +0 -17
  256. package/dist/query-v2/lib/NO_VALUE.d.ts +0 -2
  257. package/dist/query-v2/lib/NO_VALUE.js +0 -1
  258. package/dist/query-v2/lib/SKIP_TOKEN.d.ts +0 -2
  259. package/dist/query-v2/lib/SKIP_TOKEN.js +0 -1
  260. package/dist/query-v2/lib/index.d.ts +0 -4
  261. package/dist/query-v2/lib/index.js +0 -3
  262. package/dist/query-v2/plugins/ReactHooksPlugin.d.ts +0 -25
  263. package/dist/query-v2/plugins/ReactHooksPlugin.js +0 -19
  264. package/dist/query-v2/plugins/types.d.ts +0 -1
  265. package/dist/query-v2/react/__tests__/helpers.d.ts +0 -12
  266. package/dist/query-v2/react/__tests__/helpers.js +0 -33
  267. package/dist/query-v2/react/index.d.ts +0 -2
  268. package/dist/query-v2/react/index.js +0 -2
  269. package/dist/query-v2/react/useResourceV2Agent.d.ts +0 -12
  270. package/dist/query-v2/react/useResourceV2Agent.js +0 -36
  271. package/dist/query-v2/react/useResourceV2Ref.d.ts +0 -12
  272. package/dist/query-v2/react/useResourceV2Ref.js +0 -57
  273. package/dist/query-v2/snapshot/Snapshot.d.ts +0 -13
  274. package/dist/query-v2/snapshot/Snapshot.js +0 -76
  275. package/dist/query-v2/types/agent.types.d.ts +0 -54
  276. package/dist/query-v2/types/api.types.d.ts +0 -22
  277. package/dist/query-v2/types/cache.types.d.ts +0 -37
  278. package/dist/query-v2/types/index.d.ts +0 -9
  279. package/dist/query-v2/types/index.js +0 -9
  280. package/dist/query-v2/types/lifecycle.types.d.ts +0 -25
  281. package/dist/query-v2/types/machine.types.d.ts +0 -67
  282. package/dist/query-v2/types/plugin.types.d.ts +0 -38
  283. package/dist/query-v2/types/resource.types.d.ts +0 -35
  284. package/dist/query-v2/types/resource.types.js +0 -1
  285. package/dist/query-v2/types/shared.types.d.ts +0 -20
  286. package/dist/query-v2/types/shared.types.js +0 -1
  287. package/dist/query-v2/types/snapshot.types.d.ts +0 -21
  288. package/dist/query-v2/types/snapshot.types.js +0 -1
  289. package/docs/contributing/query-v2/README.md +0 -379
  290. package/docs/migrations/query-v2.md +0 -171
  291. package/docs/query-v2/README.md +0 -280
  292. package/docs/query-v2/api-reference.md +0 -235
  293. package/docs/query-v2/optimistic-updates.md +0 -148
  294. package/docs/query-v2/ssr.md +0 -130
  295. /package/dist/{query-v2 → query}/lib/stableStringify.d.ts +0 -0
  296. /package/dist/{query-v2/plugins/types.js → query/types/api.js} +0 -0
  297. /package/dist/{query-v2/types/agent.types.js → query/types/cache.js} +0 -0
  298. /package/dist/{query-v2/types/api.types.js → query/types/command.js} +0 -0
  299. /package/dist/{query-v2/types/cache.types.js → query/types/common.js} +0 -0
  300. /package/dist/{query-v2/types/lifecycle.types.js → query/types/plugin-hkt.js} +0 -0
  301. /package/dist/{query-v2/types/machine.types.js → query/types/resource.js} +0 -0
  302. /package/dist/{query-v2/types/plugin.types.js → query/types/state.js} +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Vladimir Panev
3
+ Copyright (c) 2025-2026 Vladimir Panev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RxToolkit
2
2
 
3
- > Фреймворк агностик набор инструментов для **реактивного** управления состоянием, построенный поверх RxJS.
3
+ > Фреймворк-агностик набор инструментов для **реактивного** управления состоянием, построенный поверх RxJS.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/%40fozy-labs%2Frx-toolkit.svg)](https://badge.fury.io/js/%40fozy-labs%2Frx-toolkit)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
@@ -14,7 +14,7 @@ npm install @fozy-labs/rx-toolkit rxjs
14
14
  ## 🎯 Цель
15
15
 
16
16
  RxJS действительно мощный инструмент реактивного программирования,
17
- он удобен когда мы работаем с потоком событий, но когда речь заходит о состоянии приложения,
17
+ он удобен, когда мы работаем с потоком событий, но когда речь заходит о состоянии приложения,
18
18
  из-за асинхронной природы rx'а, его использование становится сложным и громоздким, не говоря уже о кешировании данных
19
19
  (хотя некоторые разработчики "продают" rxjs, как альтернативу Query библиотекам,
20
20
  на самом деле реализация подобного функционала выльется в создание отдельной библиотеки).
@@ -27,7 +27,7 @@ RxToolkit решает эти проблемы, предоставляя сво
27
27
  - 🔧 **Framework-agnostic** — Стройте систему и описывайте логику в изолированном месте.
28
28
  - ⚡ **Built on RxJS** — Наследует всю мощь RxJS.
29
29
  - 💾 **Кеш-менеджер** — Предоставляет Query реализацию для работы с данными.
30
- - 🧪 **Query v2** *(experimental)* Переработанный кеш-менеджер с machine states, плагинами и SSR snapshots.
30
+ - 🧪 **Query** — Кеш-менеджер с machine states, плагинами и SSR snapshots.
31
31
  - 🔷 **TypeScript-first** — Полная типизация.
32
32
  - 🔗 **Интеграция с фреймворками** — Как и RxJS напрямую работает в Angular, Svelte и SolidJS.
33
33
  Поставляется с React-хуками из коробки.
@@ -35,7 +35,6 @@ RxToolkit решает эти проблемы, предоставляя сво
35
35
  ## 📚 Документация
36
36
  - [**RxSignals**](./docs/signals/README.md) - реактивные примитивы
37
37
  - [**RxQuery**](./docs/query/README.md) - кеш-менеджер для работы с данными
38
- - [**RxQuery v2**](./docs/query-v2/README.md) - кеш-менеджер v2 *(experimental)*
39
38
  - [**React**](./docs/usage/react/README.md) - интеграция с React
40
39
  - [**Devtools**](./docs/devtools/README.md) - инструменты разработчика
41
40
  - [**DefaultOptions**](./docs/options/README.md) - глобальные настройки
@@ -96,7 +95,7 @@ const on10click$ = doubled$.obs.pipe(
96
95
  );
97
96
 
98
97
  const sub = on10click$.subscribe(() => {
99
- console.log('Great! That you first reached 10 clicks!');
98
+ console.log('Great! You first reached 10 clicks!');
100
99
  });
101
100
  // Не забываем отписаться
102
101
  sub.unsubscribe();
@@ -104,17 +103,27 @@ sub.unsubscribe();
104
103
 
105
104
  ###### RxQuery (Корзина покупок)
106
105
  ```tsx
107
- const getCart = createResource({
106
+ import {
107
+ createApi,
108
+ reactHooksPlugin,
109
+ } from '@fozy-labs/rx-toolkit';
110
+
111
+ const api = createApi({
112
+ plugins: [reactHooksPlugin()],
113
+ });
114
+
115
+ const getCart = api.createResource({
116
+ key: 'cart',
108
117
  queryFn: fetchCart,
109
118
  });
110
119
 
111
- const toggleCardItem = createCommand({
112
- queryFn: fetchToggleCardItem,
113
- link(add) {
114
- add({
120
+ const toggleCartItem = api.createCommand({
121
+ queryFn: fetchToggleCartItem,
122
+ links(link) {
123
+ link({
115
124
  resource: getCart,
116
125
  forwardArgs: () => undefined,
117
- optimisticUpdate: ({ draft, args }) => {
126
+ optimisticUpdate: (draft, args) => {
118
127
  const item = draft.items.find(i => i.id === args.id);
119
128
  if (!item) return;
120
129
  item.enabled = args.enabled;
@@ -124,8 +133,8 @@ const toggleCardItem = createCommand({
124
133
  });
125
134
 
126
135
  function ShoppingCart() {
127
- const cartQuery = useResourceAgent(getCart);
128
- const [toggleItem] = useCommandAgent(toggleCardItem);
136
+ const cartQuery = getCart.useResource();
137
+ const [toggleItem] = toggleCartItem.useCommand();
129
138
  const cart = cartQuery.data;
130
139
 
131
140
  return (
@@ -98,7 +98,7 @@ export function reduxDevtools(options = {}) {
98
98
  return {
99
99
  state(name, initState) {
100
100
  const keys = name.split("/");
101
- state = applyState(keys, initState, state);
101
+ state = applyState(keys, initState, state, existConsoleWarning);
102
102
  pendingActionType = "create";
103
103
  scheduler.schedule(flushToDevtools);
104
104
  return (newState) => {
@@ -118,11 +118,26 @@ export function reduxDevtools(options = {}) {
118
118
  },
119
119
  };
120
120
  }
121
- function applyState(keys, newState, state) {
121
+ function existConsoleWarning(paths) {
122
+ if (typeof console === "undefined" || typeof console.warn !== "function") {
123
+ return false;
124
+ }
125
+ const path = paths.join("/");
126
+ console.warn(`
127
+ [RxToolkit Redux Devtools] Warning: ${path} is already defined in the state.
128
+ This may lead to unexpected behavior in Redux Devtools.
129
+ Consider using a unique path for each state or ensure that states are properly clearedwhen completed.
130
+ `);
131
+ return true;
132
+ }
133
+ function applyState(keys, newState, state, warnFn) {
122
134
  const acc = { ...state };
123
135
  let current = acc;
124
136
  keys.forEach((key, i, arr) => {
125
137
  if (i === arr.length - 1) {
138
+ if (key in current && warnFn) {
139
+ warnFn(keys);
140
+ }
126
141
  current[key] = newState;
127
142
  }
128
143
  else {
@@ -1,2 +1,3 @@
1
1
  export * from "./useConstant";
2
2
  export * from "./useEventHandler";
3
+ export * from "./useIsomorphicLayoutEffect";
@@ -1,2 +1,3 @@
1
1
  export * from "./useConstant";
2
2
  export * from "./useEventHandler";
3
+ export * from "./useIsomorphicLayoutEffect";
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ /**
3
+ * A hook that resolves to `useLayoutEffect` on the client and `useEffect` on the server.
4
+ *
5
+ * Used to prevent React hydration warnings when using layout effects with
6
+ * Server-Side Rendering (SSR).
7
+ *
8
+ * @param {React.EffectCallback} effect - Imperative function that can return a cleanup function.
9
+ * @param {React.DependencyList} [deps] - If present, effect will only activate if the values in the list change.
10
+ *
11
+ * @see {@link https://react.dev React Docs: useLayoutEffect}
12
+ * @example
13
+ * useIsomorphicLayoutEffect(() => {
14
+ * console.log("Synchronous on client, standard on server");
15
+ * }, [data]);
16
+ */
17
+ export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ /**
3
+ * A hook that resolves to `useLayoutEffect` on the client and `useEffect` on the server.
4
+ *
5
+ * Used to prevent React hydration warnings when using layout effects with
6
+ * Server-Side Rendering (SSR).
7
+ *
8
+ * @param {React.EffectCallback} effect - Imperative function that can return a cleanup function.
9
+ * @param {React.DependencyList} [deps] - If present, effect will only activate if the values in the list change.
10
+ *
11
+ * @see {@link https://react.dev React Docs: useLayoutEffect}
12
+ * @example
13
+ * useIsomorphicLayoutEffect(() => {
14
+ * console.log("Synchronous on client, standard on server");
15
+ * }, [data]);
16
+ */
17
+ export const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,5 @@ export * from "./common/options";
3
3
  export * from "./common/react";
4
4
  export * from "./common/utils/deepEqual";
5
5
  export * from "./common/utils/shallowEqual";
6
- export * from "./query";
7
6
  export * from "./signals";
8
- export * as unstable_queryV2 from "./query-v2";
7
+ export * from "./query";
package/dist/index.js CHANGED
@@ -3,6 +3,5 @@ export * from "./common/options";
3
3
  export * from "./common/react";
4
4
  export * from "./common/utils/deepEqual";
5
5
  export * from "./common/utils/shallowEqual";
6
- export * from "./query";
7
6
  export * from "./signals";
8
- export * as unstable_queryV2 from "./query-v2";
7
+ export * from "./query";
@@ -0,0 +1,4 @@
1
+ import type { IApi, IPlugin, TCreateApiOptions } from "../../query/types";
2
+ export declare function createApi<const TPlugins extends readonly IPlugin[] = readonly IPlugin[]>(options?: TCreateApiOptions<TPlugins>): IApi<TPlugins>;
3
+ /** @internal — re-exported for unit testing only */
4
+ export { mergeHooks } from "../core/api";
@@ -0,0 +1,9 @@
1
+ import { Api } from "../core/api";
2
+ export function createApi(options) {
3
+ // Safe cast: Api implements IApi (with default plugins). At runtime,
4
+ // plugin augmentations are applied via Object.assign in Api.createResource/createCommand.
5
+ // The generic TPlugins only affects the compile-time type of the returned object.
6
+ return new Api(options);
7
+ }
8
+ /** @internal — re-exported for unit testing only */
9
+ export { mergeHooks } from "../core/api";
@@ -0,0 +1 @@
1
+ export { createApi } from "./createApi";
@@ -0,0 +1 @@
1
+ export { createApi } from "./createApi";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Sentinel value passed as resource arguments to indicate that the query
3
+ * should be skipped (not executed). Useful for conditional fetching.
4
+ */
5
+ export declare const SKIP: unique symbol;
6
+ /**
7
+ * Unique brand symbol used to distinguish {@link Keyed} wrappers
8
+ * from plain argument objects at runtime.
9
+ */
10
+ export declare const KEYED_BRAND: unique symbol;
11
+ /** Current serialization version used by the snapshot/restore mechanism. */
12
+ export declare const CURRENT_SNAPSHOT_VERSION = 1;
@@ -0,0 +1,15 @@
1
+ // ==================== SKIP Sentinel ==
2
+ /**
3
+ * Sentinel value passed as resource arguments to indicate that the query
4
+ * should be skipped (not executed). Useful for conditional fetching.
5
+ */
6
+ export const SKIP = Symbol("SKIP");
7
+ // ==================== Keyed Brand ====================
8
+ /**
9
+ * Unique brand symbol used to distinguish {@link Keyed} wrappers
10
+ * from plain argument objects at runtime.
11
+ */
12
+ export const KEYED_BRAND = Symbol("KEYED_BRAND");
13
+ // ==================== Snapshot Version ====================
14
+ /** Current serialization version used by the snapshot/restore mechanism. */
15
+ export const CURRENT_SNAPSHOT_VERSION = 1;
@@ -0,0 +1,20 @@
1
+ import type { IApi, ICommand, IResource, TApiSnapshot, TCommandOptions, TCreateApiOptions, TResourceOptions } from "../../../query/types";
2
+ export declare class Api implements IApi {
3
+ private readonly resources;
4
+ private readonly commands;
5
+ private readonly resourcesByKey;
6
+ private readonly keyPrefix;
7
+ private readonly plugins;
8
+ private readonly apiSerializeArgs;
9
+ private readonly apiResourceRetentionTime;
10
+ private readonly apiCommandRetentionTime;
11
+ private readonly snapshoter;
12
+ private readonly apiOnCacheEntryAdded;
13
+ private readonly apiOnQueryStarted;
14
+ private readonly syncer;
15
+ constructor(options?: TCreateApiOptions);
16
+ createResource: <TArgs = void, TData = unknown>(opts: TResourceOptions<TArgs, TData>) => IResource<TArgs, TData>;
17
+ createCommand: <TArgs = void, TData = unknown>(opts: TCommandOptions<TArgs, TData>) => ICommand<TArgs, TData>;
18
+ getSnapshot: () => TApiSnapshot;
19
+ resetAll: () => void;
20
+ }
@@ -0,0 +1,129 @@
1
+ import { stableStringify } from "../../../query/lib/stableStringify";
2
+ import { Command } from "../command/Command";
3
+ import { Resource } from "../resource/Resource";
4
+ import { Snapshoter } from "../snapshoter";
5
+ import { Syncer } from "../syncer";
6
+ import { DEFAULT_COMMAND_RETENTION_TIME, DEFAULT_RESOURCE_RETENTION_TIME } from "./constants";
7
+ import { mergeHooks } from "./mergeHooks";
8
+ import { normalizeLinks } from "./normalizeLinks";
9
+ export class Api {
10
+ resources = [];
11
+ commands = [];
12
+ resourcesByKey = new Map();
13
+ keyPrefix;
14
+ plugins;
15
+ apiSerializeArgs;
16
+ apiResourceRetentionTime;
17
+ apiCommandRetentionTime;
18
+ snapshoter;
19
+ apiOnCacheEntryAdded;
20
+ apiOnQueryStarted;
21
+ syncer;
22
+ constructor(options) {
23
+ this.keyPrefix = options?.keyPrefix ?? null;
24
+ this.plugins = options?.plugins ?? [];
25
+ this.apiSerializeArgs = options?.serializeArgs ?? stableStringify;
26
+ this.apiResourceRetentionTime = options?.resourceRetentionTime ?? DEFAULT_RESOURCE_RETENTION_TIME;
27
+ this.apiCommandRetentionTime = options?.commandRetentionTime ?? DEFAULT_COMMAND_RETENTION_TIME;
28
+ this.snapshoter = new Snapshoter({
29
+ initialSnapshot: options?.initialSnapshot ?? null,
30
+ snapshotValidTime: options?.snapshotValidTime ?? false,
31
+ keyPrefix: this.keyPrefix,
32
+ });
33
+ this.apiOnCacheEntryAdded = options?.onCacheEntryAdded;
34
+ this.apiOnQueryStarted = options?.onQueryStarted;
35
+ const syncDriver = options?.syncDriver;
36
+ const defaultSync = options?.defaultSync ?? "none";
37
+ this.syncer = syncDriver
38
+ ? new Syncer({ syncDriver, keyPrefix: this.keyPrefix, defaultSync, resourcesByKey: this.resourcesByKey })
39
+ : null;
40
+ // Install plugins
41
+ for (const plugin of this.plugins) {
42
+ plugin.install({ keyPrefix: this.keyPrefix ?? "" });
43
+ }
44
+ // Connect sync driver after setup
45
+ this.syncer?.connect();
46
+ }
47
+ createResource = (opts) => {
48
+ const effectiveRetentionTime = opts.retentionTime !== undefined ? opts.retentionTime : this.apiResourceRetentionTime;
49
+ const effectiveSerializeArgs = opts.serializeArgs ?? this.apiSerializeArgs;
50
+ const effectiveKey = this.keyPrefix != null && opts.key != null ? `${this.keyPrefix}/${opts.key}` : opts.key;
51
+ // Merge lifecycle hooks: API-level + resource-level
52
+ const mergedOnCacheEntryAdded = mergeHooks(this.apiOnCacheEntryAdded, opts.onCacheEntryAdded);
53
+ const mergedOnQueryStarted = mergeHooks(this.apiOnQueryStarted, opts.onQueryStarted);
54
+ // Snapshot hydration: build initialEntries if snapshot has matching resource data
55
+ const initialEntries = this.snapshoter.hydrateResource(opts.key, opts.snapshotValidTime);
56
+ const syncEnabled = this.syncer && this.syncer.isResourceSyncEnabled(opts);
57
+ const config = {
58
+ queryFn: opts.queryFn,
59
+ key: effectiveKey,
60
+ retentionTime: effectiveRetentionTime,
61
+ serializeArgs: effectiveSerializeArgs,
62
+ onCacheEntryAdded: mergedOnCacheEntryAdded,
63
+ onQueryStarted: mergedOnQueryStarted,
64
+ getDevtoolsKey: opts.getDevtoolsKey,
65
+ snapshot: initialEntries,
66
+ beforeQuery: syncEnabled
67
+ ? this.syncer.beforeQuery
68
+ : undefined,
69
+ };
70
+ const resource = new Resource(config);
71
+ // Track for resetAll / getSnapshot
72
+ this.resources.push(resource);
73
+ if (effectiveKey) {
74
+ this.resourcesByKey.set(effectiveKey, resource);
75
+ }
76
+ // Plugin augmentation
77
+ let augmented = {};
78
+ for (const plugin of this.plugins) {
79
+ if (plugin.augmentResource) {
80
+ const additions = plugin.augmentResource(resource, opts);
81
+ augmented = { ...augmented, ...additions };
82
+ }
83
+ }
84
+ // Spread augmented properties onto the resource object
85
+ Object.assign(resource, augmented);
86
+ return resource;
87
+ };
88
+ createCommand = (opts) => {
89
+ const effectiveRetentionTime = opts.retentionTime !== undefined ? opts.retentionTime : this.apiCommandRetentionTime;
90
+ const effectiveKey = this.keyPrefix != null && opts.key != null ? `${this.keyPrefix}/${opts.key}` : opts.key;
91
+ // Merge lifecycle hooks: API-level + command-level
92
+ const mergedOnCacheEntryAdded = mergeHooks(this.apiOnCacheEntryAdded, opts.onCacheEntryAdded);
93
+ const mergedOnQueryStarted = mergeHooks(this.apiOnQueryStarted, opts.onQueryStarted);
94
+ const config = {
95
+ queryFn: opts.queryFn,
96
+ key: effectiveKey,
97
+ links: normalizeLinks(opts.links),
98
+ retentionTime: effectiveRetentionTime,
99
+ onCacheEntryAdded: mergedOnCacheEntryAdded,
100
+ onQueryStarted: mergedOnQueryStarted,
101
+ };
102
+ const command = new Command(config);
103
+ // Track for resetAll
104
+ this.commands.push(command);
105
+ // Plugin augmentation
106
+ let augmented = {};
107
+ for (const plugin of this.plugins) {
108
+ if (plugin.augmentCommand) {
109
+ const additions = plugin.augmentCommand(command, opts);
110
+ augmented = { ...augmented, ...additions };
111
+ }
112
+ }
113
+ Object.assign(command, augmented);
114
+ return command;
115
+ };
116
+ getSnapshot = () => {
117
+ return this.snapshoter.getSnapshot(this.resources);
118
+ };
119
+ resetAll = () => {
120
+ for (const resource of this.resources) {
121
+ resource.reset();
122
+ }
123
+ for (const command of this.commands) {
124
+ command.reset();
125
+ }
126
+ // Clean up sync state and reconnect
127
+ this.syncer?.cleanup();
128
+ };
129
+ }
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_RESOURCE_RETENTION_TIME = 60000;
2
+ export declare const DEFAULT_COMMAND_RETENTION_TIME = 0;
@@ -0,0 +1,3 @@
1
+ // Default retention times (in milliseconds)
2
+ export const DEFAULT_RESOURCE_RETENTION_TIME = 60_000;
3
+ export const DEFAULT_COMMAND_RETENTION_TIME = 0;
@@ -0,0 +1,4 @@
1
+ export { Api } from "./Api";
2
+ export { mergeHooks } from "./mergeHooks";
3
+ export { normalizeLinks } from "./normalizeLinks";
4
+ export { DEFAULT_RESOURCE_RETENTION_TIME, DEFAULT_COMMAND_RETENTION_TIME } from "./constants";
@@ -0,0 +1,4 @@
1
+ export { Api } from "./Api";
2
+ export { mergeHooks } from "./mergeHooks";
3
+ export { normalizeLinks } from "./normalizeLinks";
4
+ export { DEFAULT_RESOURCE_RETENTION_TIME, DEFAULT_COMMAND_RETENTION_TIME } from "./constants";
@@ -0,0 +1,2 @@
1
+ /** @internal — exported for unit testing only */
2
+ export declare function mergeHooks<TFn extends ((...args: any[]) => any) | undefined>(apiHook: TFn | undefined, localHook: TFn | undefined): TFn | undefined;
@@ -0,0 +1,26 @@
1
+ /** @internal — exported for unit testing only */
2
+ export function mergeHooks(apiHook, localHook) {
3
+ if (!apiHook && !localHook)
4
+ return undefined;
5
+ if (!apiHook)
6
+ return localHook;
7
+ if (!localHook)
8
+ return apiHook;
9
+ // Both hooks may be async. The callers use sync try/catch and suppress
10
+ // lifecycle errors, so the merged function must never produce an unhandled
11
+ // rejection — catch each hook independently.
12
+ return (async (...args) => {
13
+ try {
14
+ await apiHook(...args);
15
+ }
16
+ catch {
17
+ /* lifecycle error suppressed */
18
+ }
19
+ try {
20
+ await localHook(...args);
21
+ }
22
+ catch {
23
+ /* lifecycle error suppressed */
24
+ }
25
+ });
26
+ }
@@ -0,0 +1,2 @@
1
+ import type { TLinkConfig, TLinksInput } from "../../../query/types";
2
+ export declare function normalizeLinks<TArgs, TData>(input: TLinksInput<TArgs, TData> | undefined): TLinkConfig<TArgs, TData, any, any>[];
@@ -0,0 +1,11 @@
1
+ export function normalizeLinks(input) {
2
+ if (!input)
3
+ return [];
4
+ if (Array.isArray(input))
5
+ return input;
6
+ const collected = [];
7
+ input((config) => {
8
+ collected.push(config);
9
+ });
10
+ return collected;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { Observable, Subject } from "rxjs";
2
+ import type { ICacheEntry, ICacheEntryOptions } from "../../../query/types";
3
+ /**
4
+ * Internal reactive container wrapping a Signal.state<TState>.
5
+ * Implements ICacheEntry<TState>.
6
+ */
7
+ export declare class CacheEntry<TState> implements ICacheEntry<TState> {
8
+ private _state$;
9
+ private _isCompleted;
10
+ readonly completed$: Subject<void>;
11
+ readonly obs: Observable<TState>;
12
+ readonly state$: import("../../../signals").ReadableSignalFnLike<TState>;
13
+ constructor(initialState: TState, options: ICacheEntryOptions<TState>);
14
+ /** Non-reactive read */
15
+ peek(): TState;
16
+ /** Update stored state (no-op if completed) */
17
+ set(state: TState): void;
18
+ /** Fire onClean$ and mark completed. Subsequent set() calls are no-ops. */
19
+ complete(): void;
20
+ private _getResetOnRefCountZero;
21
+ }
@@ -0,0 +1,54 @@
1
+ import { finalize, ReplaySubject, share, Subject, timer } from "rxjs";
2
+ import { signalize, State } from "../../../signals";
3
+ /**
4
+ * Internal reactive container wrapping a Signal.state<TState>.
5
+ * Implements ICacheEntry<TState>.
6
+ */
7
+ export class CacheEntry {
8
+ _state$;
9
+ _isCompleted = false;
10
+ completed$ = new Subject();
11
+ obs;
12
+ state$;
13
+ constructor(initialState, options) {
14
+ this._state$ = new State(initialState, {
15
+ key: options?.devtoolsKey,
16
+ beforeDevtoolsPush: options?.beforeDevtoolsPush,
17
+ });
18
+ this.obs = this._state$.obs.pipe(finalize(() => {
19
+ this.complete();
20
+ }), share({
21
+ connector: () => new ReplaySubject(1),
22
+ resetOnRefCountZero: this._getResetOnRefCountZero(options.retentionTime),
23
+ resetOnComplete: true,
24
+ }));
25
+ this.state$ = signalize(this.obs);
26
+ }
27
+ /** Non-reactive read */
28
+ peek() {
29
+ return this._state$.peek();
30
+ }
31
+ /** Update stored state (no-op if completed) */
32
+ set(state) {
33
+ if (this._isCompleted)
34
+ return;
35
+ this._state$.set(state);
36
+ }
37
+ /** Fire onClean$ and mark completed. Subsequent set() calls are no-ops. */
38
+ complete() {
39
+ if (this._isCompleted)
40
+ return;
41
+ this._isCompleted = true;
42
+ this.completed$.next();
43
+ this.completed$.complete();
44
+ this._state$.complete();
45
+ }
46
+ _getResetOnRefCountZero(retentionTime) {
47
+ if (retentionTime === false)
48
+ return false;
49
+ if (retentionTime <= 0)
50
+ return true;
51
+ const lifetime = retentionTime;
52
+ return () => timer(lifetime);
53
+ }
54
+ }
@@ -0,0 +1,19 @@
1
+ import type { ICacheMap } from "../../../query/types";
2
+ /** Simple key→value container mapping string keys to cache entries. */
3
+ export declare class CacheMap<TValue> implements ICacheMap<TValue> {
4
+ private readonly _map;
5
+ /** Number of entries currently stored. */
6
+ get size(): number;
7
+ /** Return entry by key, or `undefined` if absent. */
8
+ get(key: string): TValue | undefined;
9
+ /** Store an entry under the given key. */
10
+ set(key: string, value: TValue): void;
11
+ /** Remove an entry. Returns `true` if the entry existed. */
12
+ delete(key: string): boolean;
13
+ /** Check whether an entry with the given key exists. */
14
+ has(key: string): boolean;
15
+ /** Remove all entries. */
16
+ clear(): void;
17
+ /** Iterate over all stored values. */
18
+ values(): IterableIterator<TValue>;
19
+ }
@@ -0,0 +1,32 @@
1
+ /** Simple key→value container mapping string keys to cache entries. */
2
+ export class CacheMap {
3
+ _map = new Map();
4
+ /** Number of entries currently stored. */
5
+ get size() {
6
+ return this._map.size;
7
+ }
8
+ /** Return entry by key, or `undefined` if absent. */
9
+ get(key) {
10
+ return this._map.get(key);
11
+ }
12
+ /** Store an entry under the given key. */
13
+ set(key, value) {
14
+ this._map.set(key, value);
15
+ }
16
+ /** Remove an entry. Returns `true` if the entry existed. */
17
+ delete(key) {
18
+ return this._map.delete(key);
19
+ }
20
+ /** Check whether an entry with the given key exists. */
21
+ has(key) {
22
+ return this._map.has(key);
23
+ }
24
+ /** Remove all entries. */
25
+ clear() {
26
+ this._map.clear();
27
+ }
28
+ /** Iterate over all stored values. */
29
+ values() {
30
+ return this._map.values();
31
+ }
32
+ }
@@ -0,0 +1,21 @@
1
+ import type { IPatchHandle, IQueryCacheEntry, IQueryCacheEntryOptions, Keyed } from "../../../query/types";
2
+ import type { ReadableSignalFnLike } from "../../../signals/types";
3
+ import { Machine } from "../machine/Machine";
4
+ import { CacheEntry } from "./CacheEntry";
5
+ export declare class QueryCacheEntry<TArgs, TData> extends CacheEntry<Machine<TArgs, TData>> implements IQueryCacheEntry<TArgs, TData> {
6
+ readonly keyedArgs: Keyed<TArgs>;
7
+ readonly machine$: ReadableSignalFnLike<Machine<TArgs, TData>>;
8
+ private _queryFn;
9
+ private _abortController;
10
+ constructor(options: IQueryCacheEntryOptions<TArgs, TData>);
11
+ /** Transition to refreshing and re-fetch data. Valid from success or refresh-error. */
12
+ refresh(): void;
13
+ /** Re-execute query after error. Valid from error state only. */
14
+ retry(): void;
15
+ /** Create an optimistic patch. Returns null if state has no data. */
16
+ createPatch(patchFn: (data: TData) => void): IPatchHandle | null;
17
+ /** Abort any in-flight request before completing the entry. */
18
+ complete(): void;
19
+ /** @internal Called by Resource when beforeQuery intercept needs to trigger the query. */
20
+ _execute(): void;
21
+ }