@shivaedev/react 0.52.0 → 0.54.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 (203) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +68 -21
  3. package/dist/Forbidden.d.ts.map +1 -0
  4. package/dist/Forbidden.js.map +1 -0
  5. package/dist/PermissionContext.d.ts.map +1 -0
  6. package/dist/PermissionContext.js.map +1 -0
  7. package/dist/RouterProvider.d.ts +3 -0
  8. package/dist/RouterProvider.d.ts.map +1 -0
  9. package/dist/RouterProvider.js +37 -0
  10. package/dist/RouterProvider.js.map +1 -0
  11. package/dist/adapters/permissionBoundary.js +1 -1
  12. package/dist/adapters/permissionBoundary.js.map +1 -1
  13. package/dist/adapters/permissionGuard.d.ts +1 -1
  14. package/dist/adapters/permissionGuard.d.ts.map +1 -1
  15. package/dist/adapters/permissionGuard.js.map +1 -1
  16. package/dist/client/FailureHostContext.d.ts +1 -1
  17. package/dist/client/FailureHostContext.d.ts.map +1 -1
  18. package/dist/client/FailureHostContext.js.map +1 -1
  19. package/dist/client/NoticeContext.d.ts +1 -1
  20. package/dist/client/{adapters/SessionSignOut.d.ts → SessionSignOut.d.ts} +2 -1
  21. package/dist/client/SessionSignOut.d.ts.map +1 -0
  22. package/dist/client/{adapters/SessionSignOut.js → SessionSignOut.js} +3 -2
  23. package/dist/client/SessionSignOut.js.map +1 -0
  24. package/dist/client/actionCompletion.d.ts.map +1 -1
  25. package/dist/client/actionCompletion.js +1 -1
  26. package/dist/client/actionCompletion.js.map +1 -1
  27. package/dist/client/adapters/SessionGeneration.d.ts +4 -1
  28. package/dist/client/adapters/SessionGeneration.d.ts.map +1 -1
  29. package/dist/client/adapters/SessionGeneration.js +7 -5
  30. package/dist/client/adapters/SessionGeneration.js.map +1 -1
  31. package/dist/client/adapters/queryRoute.d.ts +1 -1
  32. package/dist/client/adapters/queryRoute.d.ts.map +1 -1
  33. package/dist/client/adapters/queryRoute.js +1 -1
  34. package/dist/client/adapters/queryRoute.js.map +1 -1
  35. package/dist/client/adapters/useClock.js +1 -1
  36. package/dist/client/adapters/useClock.js.map +1 -1
  37. package/dist/client/adapters/useFirstSettled.d.ts.map +1 -1
  38. package/dist/client/adapters/useFirstSettled.js +12 -2
  39. package/dist/client/adapters/useFirstSettled.js.map +1 -1
  40. package/dist/client/adapters/useNewId.js +1 -1
  41. package/dist/client/adapters/useNewId.js.map +1 -1
  42. package/dist/client/adapters/usePermissionFailure.js +1 -1
  43. package/dist/client/adapters/usePermissionFailure.js.map +1 -1
  44. package/dist/client/adapters/useStoredQueries.d.ts +7 -0
  45. package/dist/client/adapters/useStoredQueries.d.ts.map +1 -0
  46. package/dist/client/adapters/useStoredQueries.js +52 -0
  47. package/dist/client/adapters/useStoredQueries.js.map +1 -0
  48. package/dist/client/create.d.ts.map +1 -1
  49. package/dist/client/create.js +2 -2
  50. package/dist/client/create.js.map +1 -1
  51. package/dist/client/crypto.d.ts.map +1 -0
  52. package/dist/client/crypto.js.map +1 -0
  53. package/dist/client/editor.d.ts.map +1 -1
  54. package/dist/client/editor.js +2 -2
  55. package/dist/client/editor.js.map +1 -1
  56. package/dist/client/handlerRuntime.d.ts.map +1 -0
  57. package/dist/client/{adapters/handlerRuntime.js → handlerRuntime.js} +1 -1
  58. package/dist/client/handlerRuntime.js.map +1 -0
  59. package/dist/client/notices.d.ts.map +1 -1
  60. package/dist/client/notices.js +1 -3
  61. package/dist/client/notices.js.map +1 -1
  62. package/dist/client/resultState.d.ts.map +1 -1
  63. package/dist/client/resultState.js +2 -2
  64. package/dist/client/resultState.js.map +1 -1
  65. package/dist/client/sessionBoundary.d.ts +4 -2
  66. package/dist/client/sessionBoundary.d.ts.map +1 -1
  67. package/dist/client/sessionBoundary.js +9 -5
  68. package/dist/client/sessionBoundary.js.map +1 -1
  69. package/dist/client/useActionResult.d.ts.map +1 -0
  70. package/dist/client/useActionResult.js.map +1 -0
  71. package/dist/client/useConnectionStatus.d.ts.map +1 -0
  72. package/dist/client/useConnectionStatus.js.map +1 -0
  73. package/dist/client/{adapters/useFeedback.d.ts → useFeedback.d.ts} +1 -1
  74. package/dist/client/useFeedback.d.ts.map +1 -0
  75. package/dist/client/useFeedback.js +53 -0
  76. package/dist/client/useFeedback.js.map +1 -0
  77. package/dist/client/useQueryNotice.d.ts.map +1 -0
  78. package/dist/client/useQueryNotice.js.map +1 -0
  79. package/dist/client/useSessionRetry.d.ts.map +1 -0
  80. package/dist/client/{adapters/useSessionRetry.js → useSessionRetry.js} +1 -1
  81. package/dist/client/useSessionRetry.js.map +1 -0
  82. package/dist/client/useSubmissionCallbacks.d.ts.map +1 -0
  83. package/dist/client/{adapters/useSubmissionCallbacks.js → useSubmissionCallbacks.js} +1 -1
  84. package/dist/client/useSubmissionCallbacks.js.map +1 -0
  85. package/dist/client/useUndoableChange.d.ts.map +1 -0
  86. package/dist/client/useUndoableChange.js.map +1 -0
  87. package/dist/client/useWarmQueries.d.ts.map +1 -0
  88. package/dist/client/useWarmQueries.js.map +1 -0
  89. package/dist/firstRoutesPending.d.ts +3 -0
  90. package/dist/firstRoutesPending.d.ts.map +1 -0
  91. package/dist/firstRoutesPending.js +4 -0
  92. package/dist/firstRoutesPending.js.map +1 -0
  93. package/dist/noticeStore.d.ts +2 -2
  94. package/dist/noticeStore.d.ts.map +1 -1
  95. package/dist/noticeStore.js +4 -3
  96. package/dist/noticeStore.js.map +1 -1
  97. package/dist/queryRouteFailure.d.ts.map +1 -0
  98. package/dist/queryRouteFailure.js.map +1 -0
  99. package/dist/screenPending.d.ts.map +1 -0
  100. package/dist/screenPending.js.map +1 -0
  101. package/dist/{adapters/signInRedirect.d.ts → signInRedirect.d.ts} +1 -1
  102. package/dist/signInRedirect.d.ts.map +1 -0
  103. package/dist/signInRedirect.js.map +1 -0
  104. package/dist/useLatestCallback.d.ts.map +1 -0
  105. package/dist/useLatestCallback.js.map +1 -0
  106. package/package.json +13 -13
  107. package/src/RouterProvider.ts +42 -0
  108. package/src/adapters/permissionBoundary.ts +1 -1
  109. package/src/adapters/permissionGuard.ts +1 -1
  110. package/src/client/FailureHostContext.ts +1 -1
  111. package/src/client/{adapters/SessionSignOut.ts → SessionSignOut.ts} +4 -1
  112. package/src/client/actionCompletion.ts +1 -1
  113. package/src/client/adapters/SessionGeneration.ts +10 -5
  114. package/src/client/adapters/queryRoute.ts +1 -1
  115. package/src/client/adapters/useClock.ts +1 -1
  116. package/src/client/adapters/useFirstSettled.ts +20 -2
  117. package/src/client/adapters/useNewId.ts +1 -1
  118. package/src/client/adapters/usePermissionFailure.ts +1 -1
  119. package/src/client/adapters/useStoredQueries.ts +67 -0
  120. package/src/client/create.ts +2 -2
  121. package/src/client/editor.ts +2 -2
  122. package/src/client/{adapters/handlerRuntime.ts → handlerRuntime.ts} +1 -1
  123. package/src/client/notices.ts +1 -3
  124. package/src/client/resultState.ts +2 -2
  125. package/src/client/sessionBoundary.ts +12 -5
  126. package/src/client/{adapters/useFeedback.ts → useFeedback.ts} +22 -10
  127. package/src/client/{adapters/useSessionRetry.ts → useSessionRetry.ts} +1 -1
  128. package/src/client/{adapters/useSubmissionCallbacks.ts → useSubmissionCallbacks.ts} +1 -1
  129. package/src/firstRoutesPending.ts +4 -0
  130. package/src/noticeStore.ts +4 -3
  131. package/src/{adapters/signInRedirect.ts → signInRedirect.ts} +1 -1
  132. package/dist/adapters/Forbidden.d.ts.map +0 -1
  133. package/dist/adapters/Forbidden.js.map +0 -1
  134. package/dist/adapters/PermissionContext.d.ts.map +0 -1
  135. package/dist/adapters/PermissionContext.js.map +0 -1
  136. package/dist/adapters/queryRouteFailure.d.ts.map +0 -1
  137. package/dist/adapters/queryRouteFailure.js.map +0 -1
  138. package/dist/adapters/screenPending.d.ts.map +0 -1
  139. package/dist/adapters/screenPending.js.map +0 -1
  140. package/dist/adapters/signInRedirect.d.ts.map +0 -1
  141. package/dist/adapters/signInRedirect.js.map +0 -1
  142. package/dist/adapters/useLatestCallback.d.ts.map +0 -1
  143. package/dist/adapters/useLatestCallback.js.map +0 -1
  144. package/dist/client/adapters/SessionSignOut.d.ts.map +0 -1
  145. package/dist/client/adapters/SessionSignOut.js.map +0 -1
  146. package/dist/client/adapters/crypto.d.ts.map +0 -1
  147. package/dist/client/adapters/crypto.js.map +0 -1
  148. package/dist/client/adapters/handlerRuntime.d.ts.map +0 -1
  149. package/dist/client/adapters/handlerRuntime.js.map +0 -1
  150. package/dist/client/adapters/useActionResult.d.ts.map +0 -1
  151. package/dist/client/adapters/useActionResult.js.map +0 -1
  152. package/dist/client/adapters/useConnectionStatus.d.ts.map +0 -1
  153. package/dist/client/adapters/useConnectionStatus.js.map +0 -1
  154. package/dist/client/adapters/useFeedback.d.ts.map +0 -1
  155. package/dist/client/adapters/useFeedback.js +0 -38
  156. package/dist/client/adapters/useFeedback.js.map +0 -1
  157. package/dist/client/adapters/useQueryNotice.d.ts.map +0 -1
  158. package/dist/client/adapters/useQueryNotice.js.map +0 -1
  159. package/dist/client/adapters/useSessionRetry.d.ts.map +0 -1
  160. package/dist/client/adapters/useSessionRetry.js.map +0 -1
  161. package/dist/client/adapters/useSubmissionCallbacks.d.ts.map +0 -1
  162. package/dist/client/adapters/useSubmissionCallbacks.js.map +0 -1
  163. package/dist/client/adapters/useUndoableChange.d.ts.map +0 -1
  164. package/dist/client/adapters/useUndoableChange.js.map +0 -1
  165. package/dist/client/adapters/useWarmQueries.d.ts.map +0 -1
  166. package/dist/client/adapters/useWarmQueries.js.map +0 -1
  167. /package/dist/{adapters/Forbidden.d.ts → Forbidden.d.ts} +0 -0
  168. /package/dist/{adapters/Forbidden.js → Forbidden.js} +0 -0
  169. /package/dist/{adapters/PermissionContext.d.ts → PermissionContext.d.ts} +0 -0
  170. /package/dist/{adapters/PermissionContext.js → PermissionContext.js} +0 -0
  171. /package/dist/client/{adapters/crypto.d.ts → crypto.d.ts} +0 -0
  172. /package/dist/client/{adapters/crypto.js → crypto.js} +0 -0
  173. /package/dist/client/{adapters/handlerRuntime.d.ts → handlerRuntime.d.ts} +0 -0
  174. /package/dist/client/{adapters/useActionResult.d.ts → useActionResult.d.ts} +0 -0
  175. /package/dist/client/{adapters/useActionResult.js → useActionResult.js} +0 -0
  176. /package/dist/client/{adapters/useConnectionStatus.d.ts → useConnectionStatus.d.ts} +0 -0
  177. /package/dist/client/{adapters/useConnectionStatus.js → useConnectionStatus.js} +0 -0
  178. /package/dist/client/{adapters/useQueryNotice.d.ts → useQueryNotice.d.ts} +0 -0
  179. /package/dist/client/{adapters/useQueryNotice.js → useQueryNotice.js} +0 -0
  180. /package/dist/client/{adapters/useSessionRetry.d.ts → useSessionRetry.d.ts} +0 -0
  181. /package/dist/client/{adapters/useSubmissionCallbacks.d.ts → useSubmissionCallbacks.d.ts} +0 -0
  182. /package/dist/client/{adapters/useUndoableChange.d.ts → useUndoableChange.d.ts} +0 -0
  183. /package/dist/client/{adapters/useUndoableChange.js → useUndoableChange.js} +0 -0
  184. /package/dist/client/{adapters/useWarmQueries.d.ts → useWarmQueries.d.ts} +0 -0
  185. /package/dist/client/{adapters/useWarmQueries.js → useWarmQueries.js} +0 -0
  186. /package/dist/{adapters/queryRouteFailure.d.ts → queryRouteFailure.d.ts} +0 -0
  187. /package/dist/{adapters/queryRouteFailure.js → queryRouteFailure.js} +0 -0
  188. /package/dist/{adapters/screenPending.d.ts → screenPending.d.ts} +0 -0
  189. /package/dist/{adapters/screenPending.js → screenPending.js} +0 -0
  190. /package/dist/{adapters/signInRedirect.js → signInRedirect.js} +0 -0
  191. /package/dist/{adapters/useLatestCallback.d.ts → useLatestCallback.d.ts} +0 -0
  192. /package/dist/{adapters/useLatestCallback.js → useLatestCallback.js} +0 -0
  193. /package/src/{adapters/Forbidden.ts → Forbidden.ts} +0 -0
  194. /package/src/{adapters/PermissionContext.ts → PermissionContext.ts} +0 -0
  195. /package/src/client/{adapters/crypto.ts → crypto.ts} +0 -0
  196. /package/src/client/{adapters/useActionResult.ts → useActionResult.ts} +0 -0
  197. /package/src/client/{adapters/useConnectionStatus.ts → useConnectionStatus.ts} +0 -0
  198. /package/src/client/{adapters/useQueryNotice.ts → useQueryNotice.ts} +0 -0
  199. /package/src/client/{adapters/useUndoableChange.ts → useUndoableChange.ts} +0 -0
  200. /package/src/client/{adapters/useWarmQueries.ts → useWarmQueries.ts} +0 -0
  201. /package/src/{adapters/queryRouteFailure.ts → queryRouteFailure.ts} +0 -0
  202. /package/src/{adapters/screenPending.ts → screenPending.ts} +0 -0
  203. /package/src/{adapters/useLatestCallback.ts → useLatestCallback.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.54.0 - 2026-11-21
4
+
5
+ ### Added
6
+
7
+ - `RouterProvider` from `@shivaedev/react/RouterProvider.ts` takes TanStack's `RouterProvider` props and renders it, and holds `useFirstSettled` until the first route has rendered, so the hook reveals a routed first screen in one step wherever it is called. Swap the import of TanStack's `RouterProvider` for this one; nothing else changes.
8
+
9
+ ### Changed
10
+
11
+ - `useFirstSettled(client)` turns `true` once the screen that calls it has rendered and nothing on the client is waiting, so a first screen that reads no query, such as a blank form or a welcome page, is revealed instead of waiting forever. A screen that reads queries is still revealed in one step after they answer, and a query that shows a stored or retained result does not hold the reveal back while it revalidates.
12
+
13
+ ### Breaking
14
+
15
+ - import from `@shivaedev/react/Forbidden.ts` instead of `@shivaedev/react/adapters/Forbidden.ts`, which moved out of `adapters/`.
16
+ - import from `@shivaedev/react/PermissionContext.ts` instead of `@shivaedev/react/adapters/PermissionContext.ts`, which moved out of `adapters/`.
17
+ - import from `@shivaedev/react/queryRouteFailure.ts` instead of `@shivaedev/react/adapters/queryRouteFailure.ts`, which moved out of `adapters/`.
18
+ - import from `@shivaedev/react/screenPending.ts` instead of `@shivaedev/react/adapters/screenPending.ts`, which moved out of `adapters/`.
19
+ - import from `@shivaedev/react/signInRedirect.ts` instead of `@shivaedev/react/adapters/signInRedirect.ts`, which moved out of `adapters/`.
20
+ - import from `@shivaedev/react/useLatestCallback.ts` instead of `@shivaedev/react/adapters/useLatestCallback.ts`, which moved out of `adapters/`.
21
+ - import from `@shivaedev/react/client/SessionSignOut.ts` instead of `@shivaedev/react/client/adapters/SessionSignOut.ts`, which moved out of `adapters/`.
22
+ - import from `@shivaedev/react/client/crypto.ts` instead of `@shivaedev/react/client/adapters/crypto.ts`, which moved out of `adapters/`.
23
+ - import from `@shivaedev/react/client/handlerRuntime.ts` instead of `@shivaedev/react/client/adapters/handlerRuntime.ts`, which moved out of `adapters/`.
24
+ - import from `@shivaedev/react/client/useActionResult.ts` instead of `@shivaedev/react/client/adapters/useActionResult.ts`, which moved out of `adapters/`.
25
+ - import from `@shivaedev/react/client/useConnectionStatus.ts` instead of `@shivaedev/react/client/adapters/useConnectionStatus.ts`, which moved out of `adapters/`.
26
+ - import from `@shivaedev/react/client/useFeedback.ts` instead of `@shivaedev/react/client/adapters/useFeedback.ts`, which moved out of `adapters/`.
27
+ - import from `@shivaedev/react/client/useQueryNotice.ts` instead of `@shivaedev/react/client/adapters/useQueryNotice.ts`, which moved out of `adapters/`.
28
+ - import from `@shivaedev/react/client/useSessionRetry.ts` instead of `@shivaedev/react/client/adapters/useSessionRetry.ts`, which moved out of `adapters/`.
29
+ - import from `@shivaedev/react/client/useSubmissionCallbacks.ts` instead of `@shivaedev/react/client/adapters/useSubmissionCallbacks.ts`, which moved out of `adapters/`.
30
+ - import from `@shivaedev/react/client/useUndoableChange.ts` instead of `@shivaedev/react/client/adapters/useUndoableChange.ts`, which moved out of `adapters/`.
31
+ - import from `@shivaedev/react/client/useWarmQueries.ts` instead of `@shivaedev/react/client/adapters/useWarmQueries.ts`, which moved out of `adapters/`.
32
+ - a `useFirstSettled` above TanStack's own `RouterProvider` now turns `true` at the first render, before the first route exists. Import `RouterProvider` from `@shivaedev/react/RouterProvider.ts` in place of TanStack's, with the same props, and the hook waits for the first route again.
33
+
34
+ ## 0.53.0 - 2026-11-20
35
+
36
+ ### Added
37
+
38
+ - `SessionBoundary` takes `persist`, a storage Layer such as `browserQueryStorage`. Every result retention keeps is written to the device for the user `identify` names, within a second of settling and at once when the page hides, bounded by `queryRetention.capacity` and `queryRetention.storedBytes` (about 5 MB by default). The next generation for that user reads them before its first screen, so a reload shows the last results at once, marked `stale` and `refreshing` like retained ones, and a route loader commits without waiting. The boundary wipes stored results when the session ends or comes back signed out, and the previous user's when another user signs in. The person's data then rests on the device, readable by anyone using that browser profile.
39
+ - a sign-out through `SessionBoundary`'s `signOut` action wipes the stored results as soon as the request succeeds, and the remembered session too when `persist` also supplies the session memory, such as `Layer.merge(browserSessionMemory, browserQueryStorage)`.
40
+
41
+ ### Changed
42
+
43
+ - when a command or form save succeeds, the failure notices that same hook published earlier go without Dismiss. A notice nobody resolves still stays until dismissed or expired.
44
+
45
+ ### Breaking
46
+
47
+ - a function provided to `FailureHostContext` returns the published notice's dismiss function, or `undefined` when it published nothing.
48
+
3
49
  ## 0.52.0 - 2026-11-20
4
50
 
5
51
  ### Added
package/README.md CHANGED
@@ -24,15 +24,15 @@ State belongs to an **atom in a registry**. A query hook reads that atom's nativ
24
24
 
25
25
  An **editor** joins a query atom, a form field schema and a save Effect. The query provides the row; `values(row)` converts it to input values; the schema decodes those values before the save runs. form owns the draft and the per-field merge. A **create form** uses the same submission rules without a query and starts a fresh form after success.
26
26
 
27
- Use `useConnectionStatus(client)` from `@shivaedev/react/client/adapters/useConnectionStatus.ts` with the client returned by contract's `makeClient`. It returns one `"live" | "reconnecting" | "waiting-for-connection"` value across mounted queries from every binding on that client's `Client` service. Live subscription status changes debounce for 300 ms on the client runtime's Clock. A bound command held for reconnection reports `"waiting-for-connection"` immediately, so the application can show Reconnecting while keeping the action pending. Contract holds unsent commands for up to 10 seconds and returns a typed `RpcClientError` on timeout; commands already sent are never replayed. The default socket probes Ping/Pong on browser or native resume and reconnects after 2.5 seconds without a Pong. A query refusal is separate from connectivity. Visible browser `online` and `visibilitychange` signals interrupt the live retry delay and reconnect immediately with a fresh backoff schedule.
27
+ Use `useConnectionStatus(client)` from `@shivaedev/react/client/useConnectionStatus.ts` with the client returned by contract's `makeClient`. It returns one `"live" | "reconnecting" | "waiting-for-connection"` value across mounted queries from every binding on that client's `Client` service. Live subscription status changes debounce for 300 ms on the client runtime's Clock. A bound command held for reconnection reports `"waiting-for-connection"` immediately, so the application can show Reconnecting while keeping the action pending. Contract holds unsent commands for up to 10 seconds and returns a typed `RpcClientError` on timeout; commands already sent are never replayed. The default socket probes Ping/Pong on browser or native resume and reconnects after 2.5 seconds without a Pong. A query refusal is separate from connectivity. Visible browser `online` and `visibilitychange` signals interrupt the live retry delay and reconnect immediately with a fresh backoff schedule.
28
28
 
29
- Use `useFirstSettled(client)` from `@shivaedev/react/client/adapters/useFirstSettled.ts` with the same client to reveal a session's first screen in one step instead of one loading state per query. It returns `false` until a query mounted on that client has delivered its first success or failure and, with that, no mounted query awaits a first result and no command is in flight. From then on it returns `true` for that client: a later command or a newly mounted query does not turn it back. The signal belongs to the client, so a new session generation whose `connect` makes a new client starts at `false` again. A client whose screen mounts no query stays at `false`; gate only screens that read through the client. A query that only the session's [warm list](#keep-queries-warm-for-the-session) mounts does not hold it back while it awaits its first result.
29
+ Use `useFirstSettled(client)` from `@shivaedev/react/client/adapters/useFirstSettled.ts` with the same client to reveal a session's first screen in one step instead of one loading state per query. It returns `false` until the screen that calls it has rendered once and, with that, no query mounted on the client awaits a first result and no command is in flight, so a first screen that reads no query, such as a blank form, turns it `true` as soon as it has rendered. From then on it returns `true` for that client: a later command or a newly mounted query does not turn it back. A query the screen mounts only after its first render, from an effect or a state change, is not waited for: the reveal shows that query's own loading state. Render TanStack routes with `RouterProvider` from `@shivaedev/react/RouterProvider.ts`, which takes TanStack's props and renders TanStack's provider: it holds `useFirstSettled` until the first route has rendered, so the hook gives the right answer above the router too. Above TanStack's own `RouterProvider` the hook turns `true` before the first route exists. The signal belongs to the client, so a new session generation whose `connect` makes a new client starts at `false` again. A query that only the session's [warm list](#keep-queries-warm-for-the-session) mounts does not hold it back while it awaits its first result, and a query that shows a [stored](#keep-query-results-across-a-reload) or retained result does not hold it back while it revalidates, so a reload with stored results is revealed at once.
30
30
 
31
31
  A **session generation** is the string returned by `identify(session)`. `SessionBoundary` owns its client, registry and React subtree. Your auth owner supplies the session and decides when to replace or end it. The boundary automatically mounts live connections on bound contract APIs returned by `connect`, directly or as client properties such as `api`. Use a Platform database host and the default shared WebSocket client; the application needs no subscribe handler or `live()` call. The process holding the socket reloads the session and runs the read policy and handler for each subscriber independently. It stores one encoded-result hash per subscribed query in memory and pushes changed values; equal reads acknowledge completion without replacing the screen. Each subscription has at most one rerun in flight and one pending, merging further changes while busy. Other subscriptions run independently in parallel. Backlog overflow triggers a server `Resync`: the server reruns queries itself, and the client sends no follow-up reads. Query results stay in their native registry; RPC declarations and transport stay with native Effect and the application; this package supplies their React state and lifecycle boundary.
32
32
 
33
33
  An explicit query refresh keeps the current data visible while reporting pending until the new subscription result arrives. Retryable connection failures keep that data visible during reconnection. Render read denials before retained data; replacing or ending the session disposes its registry.
34
34
 
35
- Bound contract queries keep their last successful result for five minutes after the last reader leaves. Opening the same query in that window shows the kept value immediately with `stale: true` and `refreshing: true`, then replaces it when revalidation answers. Query execution and subscriptions stop while nobody reads. At most 100 idle results are kept per registry; the least recently left query is evicted first. Active readers do not consume that allowance. Set `queryRetention={{ timeToLive: "1 minute", capacity: 50 }}` on `SessionBoundary` to change these bounds; zero for either disables idle retention. Settings apply when a query becomes idle. Expiry uses the query runtime’s Effect Clock. Signing out or changing `identify(session)` disposes every kept result with the session registry. Results belong to individual queries, with no record sharing between them.
35
+ Bound contract queries keep their last successful result for five minutes after the last reader leaves. Opening the same query in that window shows the kept value immediately with `stale: true` and `refreshing: true`, then replaces it when revalidation answers. Query execution and subscriptions stop while nobody reads. At most 100 idle results are kept per registry; the least recently left query is evicted first. Active readers do not consume that allowance. Set `queryRetention={{ timeToLive: "1 minute", capacity: 50 }}` on `SessionBoundary` to change these bounds; zero for either disables idle retention. To keep results across a reload, see [`persist`](#keep-query-results-across-a-reload). Settings apply when a query becomes idle. Expiry uses the query runtime’s Effect Clock. Signing out or changing `identify(session)` disposes every kept result with the session registry. Results belong to individual queries, with no record sharing between them.
36
36
 
37
37
  `useEditor` and `useCreate` opt into persisted input with `persistedDraft: { key, ...persistence }`. Choose a stable key for the record or create request, independent of its server revision. Acquire `persistence` with `draftPersistence` from `@shivaedev/form/adapters/draftPersistence.ts`, provided with `browserDraftStorage` from `@shivaedev/form/adapters/browserDraftStorage.ts`. The setup reads the storage provider and Clock from the Effect environment; timestamps and expiry use that captured clock. The hooks inherit ownership from `SessionBoundary`: reload and query refresh preserve edits, successful submission clears accepted input, and a committed session replacement drops tracked drafts. A suspended replacement that is canceled keeps the visible session's draft and future writes. Later edits made during a save remain persisted. Observed draft storage shares changes across editors while preserving locally edited fields; a completed older save cannot clear a newer stored draft. Supply `DraftStorageProvider` for custom storage; optional `maxBytes` and `maxAgeMs` customize the bounds, which default to 256 KiB of UTF-8 JSON and seven days. See [form's persisted input API](https://github.com/ShivaeDev/platform/tree/main/packages/form#persist-input-across-reloads) for direct form hooks and limits.
38
38
 
@@ -109,6 +109,37 @@ A screen's first visit, and a return after retention let its result go, wait one
109
109
 
110
110
  Each warm query holds one subscription on the host for the whole session, with its stored result hash and a rerun on each matching change, whether a screen shows it or not. The list must name the payload the screen reads: a query whose payload no screen asks for subscribes for nothing, and that screen stays cold.
111
111
 
112
+ #### Keep query results across a reload
113
+
114
+ A reload or relaunch starts with an empty registry, so the first screen waits for the session check, the socket and the first read. Pass a storage Layer as `persist`, and the last results show at once instead:
115
+
116
+ ```tsx
117
+ import { browserQueryStorage } from "@shivaedev/contract/adapters/browserQueryStorage.ts";
118
+
119
+ <SessionBoundary session={session} identify={(current) => current.user.id} connect={connect} recheck={recheck} persist={browserQueryStorage}>
120
+ {(client) => <Screens client={client} />}
121
+ </SessionBoundary>;
122
+ ```
123
+
124
+ Every bound query result that retention keeps is also written to the device under the user that `identify` names, in IndexedDB with `browserQueryStorage`. A result is written within a second of settling on the query runtime's Clock, and at once when the page hides. Storage keeps at most `queryRetention.capacity` results (100 by default) and about 5 MB of encoded results (`queryRetention={{ storedBytes }}` changes it), and drops the least recently settled first. When a generation starts, the boundary reads that user's stored results before it renders the first screen, and they seed retention: `useQuery`, a route's `useQuery()`, `QueryView` and `loadQuery` see a stored result as they see a retained one, with `stale: true` and `refreshing: true`, and a route loader commits at once while the subscription revalidates it. Each result is encoded with its operation's success schema; nothing is declared per query. Every result of a query the session reads is stored on the device, whatever its model marks. Fields a model keeps server-only never reach the client, so they are never stored. An application that does not want results at rest leaves `persist` off.
125
+
126
+ The boundary wipes stored results when `session` becomes `undefined` (a sign-out or a signed-out answer of the session check, including at launch) and the previous user's results when another user signs in. A query that answers `QueryReadDenied` or `NotFound`, or whose stored value no longer decodes, loses its entry. Storage the browser refuses leaves the generation without stored results.
127
+
128
+ With a [remembered session](#better-auth-actions), give `authSession`'s `remember` and `persist` one Layer, so the two are wiped together:
129
+
130
+ ```ts
131
+ import { Layer } from "effect";
132
+ import { browserQueryStorage } from "@shivaedev/contract/adapters/browserQueryStorage.ts";
133
+ import { browserSessionMemory } from "@shivaedev/identity/client/adapters/browserSessionMemory.ts";
134
+
135
+ export const deviceStorage = Layer.merge(browserSessionMemory, browserQueryStorage);
136
+ // authSession(read, { remember: deviceStorage }) and <SessionBoundary persist={deviceStorage} …>
137
+ ```
138
+
139
+ Identity's `forgetSession` then wipes the stored results with the memory, which covers a passed expiry at launch as well. A sign-out through `SessionBoundary`'s `signOut` action wipes both as soon as the sign-out request succeeds, even when the session check after it never answers. Dispatch that action with [`useSignOut`](#better-auth-actions), which runs it in the auth owner's registry where the boundary watches it.
140
+
141
+ What this means for the person using the application: their data rests on the device, readable by anyone using that browser profile. Signing out on another device cannot erase it until the application next runs online here. A stored result can be days old; it shows as updating until the live result arrives, one subscription round trip after the socket opens.
142
+
112
143
  #### Session-scoped bindings
113
144
 
114
145
  A contract declared with `keyScope: "session"` binds to the registry that owns the session's queries. In the browser, `bind` prefixes every client read and invalidation key of that contract with an opaque id of its registry, so a successful command in one session refreshes none of another session's queries on the page, even when both registries share one runtime. The server adds no prefix: its subscriptions and committed writes use plain keys, and each query's read policy decides what a viewer receives. The [contract guide](https://github.com/ShivaeDev/platform/blob/main/packages/contract/README.md#session-owned-keys) describes the declaration and its handlers. `SessionBoundary` passes that registry to `connect` as its second argument:
@@ -315,7 +346,7 @@ The next module assumes a sibling `invoice-lines-client.ts` exports a contract-b
315
346
  import { useCreate } from "@shivaedev/react/client/create.ts";
316
347
  import { useEditor } from "@shivaedev/react/client/editor.ts";
317
348
  import { QueryView } from "@shivaedev/react/client/QueryView.ts";
318
- import { useField } from "@shivaedev/form/adapters/react.ts";
349
+ import { useField } from "@shivaedev/form/react.ts";
319
350
  import type { Form } from "@shivaedev/form/shape.ts";
320
351
  import { Option, Schema } from "effect";
321
352
  import { api } from "./invoice-lines-client.ts";
@@ -467,6 +498,8 @@ A bound command given to `useAction`, `usePendingCommand` or `useUndoableChange`
467
498
  - A rejection the app declared for itself has no default. The call does not compile until `failures` says what it shows.
468
499
  - Interrupted work shows nothing.
469
500
 
501
+ The framework words every shared rejection it raises for the person using the application, so its message shows as it arrives: a missing session says `Sign in to continue` and a missing permission `You do not have permission to do this.`, with no `failures` handler to undo developer wording. When the same hook's command or save later succeeds, the failure notices it published go without Dismiss; a notice nobody resolves stays until dismissed or expired.
502
+
470
503
  `failureKind` from `@shivaedev/contract/failureKind.ts` holds that classification, `AppRejection<E>` names the app's own rejections in an error type, and `RequestRejection` and `ServerFailure` in `@shivaedev/errors/taxonomy.ts` name the shared ones.
471
504
 
472
505
  ```tsx
@@ -557,11 +590,11 @@ A typed `Unauthorized` failure shows its message and asks the session owner to r
557
590
 
558
591
  #### Remove with a version-guarded Undo
559
592
 
560
- Use `useUndoableChange` from `@shivaedev/react/client/adapters/useUndoableChange.ts` when a versioned command also performs its inverse. Its payload includes `expectedVersion: number`, and its success includes `version: number`. Pass the bound command, and the application's `deployUpdate` as the `update` option:
593
+ Use `useUndoableChange` from `@shivaedev/react/client/useUndoableChange.ts` when a versioned command also performs its inverse. Its payload includes `expectedVersion: number`, and its success includes `version: number`. Pass the bound command, and the application's `deployUpdate` as the `update` option:
561
594
 
562
595
  ```tsx
563
596
  import { Option } from "effect";
564
- import { useUndoableChange } from "@shivaedev/react/client/adapters/useUndoableChange.ts";
597
+ import { useUndoableChange } from "@shivaedev/react/client/useUndoableChange.ts";
565
598
 
566
599
  function RemoveNote({ note }: { readonly note: { id: string; version: number } }) {
567
600
  const change = useUndoableChange(api.change, { describe: (saved) => `Removed ${saved.id}`, update });
@@ -657,18 +690,19 @@ With native `RpcClient.layerProtocolHttp` and `FetchHttpClient.layer` as the bro
657
690
 
658
691
  #### Route loaders with TanStack Router
659
692
 
660
- TanStack Router owns routes, navigation, search validation, loader data and screen components. Declare a route's query once with `queryRoute(buildQuery)` from `@shivaedev/react/client/adapters/queryRoute.ts`, spread the result into `createRoute`, and call its `useQuery()` in the route's component. The spread derives loader dependencies from validated search and loads the contract query atom in the router context’s registry; `useQuery()` reads the same atom, so the component names neither the operation nor its arguments. A `NotFound` instance from `@shivaedev/errors/taxonomy.ts` or a `QueryReadDenied` refusal enters TanStack's not-found handling with the original rejection in the not-found component's `data` prop, preserving its message. One root `notFoundComponent` can show that message for all query routes; a route's own `notFoundComponent` takes precedence. Other typed failures reach `errorComponent` unchanged. The atom runs through its native RPC runtime and shares its execution with React. The factory receives `{ context, params, search }`: `context` is the loader’s router context, including parent `beforeLoad` contributions. Annotate it with `typeof root.types.allContext` (or the parent route’s `types.allContext`) to keep client and viewer access checked against the route’s declaration.
693
+ TanStack Router owns routes, navigation, search validation, loader data and screen components. Mount the router with `RouterProvider` from `@shivaedev/react/RouterProvider.ts` in place of TanStack's: it renders TanStack's provider unchanged and tells the session's `useFirstSettled` when the first route has rendered. Declare a route's query once with `queryRoute(buildQuery)` from `@shivaedev/react/client/adapters/queryRoute.ts`, spread the result into `createRoute`, and call its `useQuery()` in the route's component. The spread derives loader dependencies from validated search and loads the contract query atom in the router context’s registry; `useQuery()` reads the same atom, so the component names neither the operation nor its arguments. A `NotFound` instance from `@shivaedev/errors/taxonomy.ts` or a `QueryReadDenied` refusal enters TanStack's not-found handling with the original rejection in the not-found component's `data` prop, preserving its message. One root `notFoundComponent` can show that message for all query routes; a route's own `notFoundComponent` takes precedence. Other typed failures reach `errorComponent` unchanged. The atom runs through its native RPC runtime and shares its execution with React. The factory receives `{ context, params, search }`: `context` is the loader’s router context, including parent `beforeLoad` contributions. Annotate it with `typeof root.types.allContext` (or the parent route’s `types.allContext`) to keep client and viewer access checked against the route’s declaration.
661
694
 
662
695
  This example assumes an application-owned `api.get.query({ id, page })` returning `{ id, title }`, with declared `NotFound` and `NoteMissing` rejections:
663
696
 
664
697
  ```tsx
665
698
  import { RegistryContext } from "@effect/atom-react";
666
- import { createRootRouteWithContext, createRoute, createRouter, RouterProvider, useRouterState } from "@tanstack/react-router";
699
+ import { createRootRouteWithContext, createRoute, createRouter, useRouterState } from "@tanstack/react-router";
667
700
  import type { ErrorComponentProps, NotFoundRouteProps } from "@tanstack/react-router";
668
701
  import { Effect, Option, Predicate, Schema } from "effect";
669
702
  import type { ReactNode } from "react";
670
703
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
671
704
  import { NotFound } from "@shivaedev/errors/taxonomy.ts";
705
+ import { RouterProvider } from "@shivaedev/react/RouterProvider.ts";
672
706
  import { queryRoute } from "@shivaedev/react/client/adapters/queryRoute.ts";
673
707
  import { api } from "./notes-client.ts";
674
708
 
@@ -749,13 +783,13 @@ export function App() {
749
783
 
750
784
  Keep the result of `queryRoute` to call its `useRetry()` hook inside that route's error component. The returned callback refreshes the query using the current match's params, decoded search dependencies and context, then invalidates that match. A successful retry renders the route again without replacing the surrounding shell or its draft inputs.
751
785
 
752
- State where a signed-out visitor goes once, as `redirects.signedOut` in the router's context. A query route whose query fails with the shared `Unauthorized` rejection redirects there, and `permissionGuard` takes the same callback. `signInRedirect(path)` from `@shivaedev/react/adapters/signInRedirect.ts` builds it: a TanStack redirect to `path` that carries the requested path, search and fragment in sign-in's `returnTo` search field. `redirects.refused` handles `Forbidden` and `QueryReadDenied` the same way, with a callback that returns TanStack's `redirect`. A route overrides either target for its own query with `queryRoute(buildQuery, { redirects })`, as `memberNote` does here:
786
+ State where a signed-out visitor goes once, as `redirects.signedOut` in the router's context. A query route whose query fails with the shared `Unauthorized` rejection redirects there, and `permissionGuard` takes the same callback. `signInRedirect(path)` from `@shivaedev/react/signInRedirect.ts` builds it: a TanStack redirect to `path` that carries the requested path, search and fragment in sign-in's `returnTo` search field. `redirects.refused` handles `Forbidden` and `QueryReadDenied` the same way, with a callback that returns TanStack's `redirect`. A route overrides either target for its own query with `queryRoute(buildQuery, { redirects })`, as `memberNote` does here:
753
787
 
754
788
  ```ts
755
789
  import { createRootRouteWithContext, createRoute, createRouter } from "@tanstack/react-router";
756
790
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
757
- import type { QueryRouteRedirects } from "@shivaedev/react/adapters/queryRouteFailure.ts";
758
- import { signInRedirect } from "@shivaedev/react/adapters/signInRedirect.ts";
791
+ import type { QueryRouteRedirects } from "@shivaedev/react/queryRouteFailure.ts";
792
+ import { signInRedirect } from "@shivaedev/react/signInRedirect.ts";
759
793
  import { queryRoute } from "@shivaedev/react/client/adapters/queryRoute.ts";
760
794
  import { api } from "./notes-client.ts";
761
795
 
@@ -798,20 +832,22 @@ Set `permissionGuard({ session, signedOut, hidden: true })` to hide refused rout
798
832
 
799
833
  ```tsx
800
834
  import { RegistryContext } from "@effect/atom-react";
801
- import { createRootRouteWithContext, createRoute, createRouter, Link, RouterProvider, useRouter } from "@tanstack/react-router";
835
+ import { createRootRouteWithContext, createRoute, createRouter, Link, useRouter } from "@tanstack/react-router";
836
+ import { RouterProvider } from "@shivaedev/react/RouterProvider.ts";
802
837
  import type { ReactNode } from "react";
803
838
  import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
804
839
  import { permission } from "@shivaedev/access/permission.ts";
805
- import { Forbidden } from "@shivaedev/react/adapters/Forbidden.ts";
840
+ import { Forbidden } from "@shivaedev/react/Forbidden.ts";
806
841
  import { PermissionBoundary, PermissionBoundaryError, useCan } from "@shivaedev/react/adapters/permissionBoundary.ts";
807
842
  import { permissionGuard } from "@shivaedev/react/adapters/permissionGuard.ts";
808
- import type { QueryRouteRedirects } from "@shivaedev/react/adapters/queryRouteFailure.ts";
809
- import { signInRedirect } from "@shivaedev/react/adapters/signInRedirect.ts";
843
+ import type { QueryRouteRedirects } from "@shivaedev/react/queryRouteFailure.ts";
844
+ import { signInRedirect } from "@shivaedev/react/signInRedirect.ts";
810
845
  import type { PermissionSession } from "@shivaedev/identity/PermissionSession.ts";
811
846
  import { can } from "@shivaedev/react/can.ts";
812
847
  import { queryRoute } from "@shivaedev/react/client/adapters/queryRoute.ts";
813
848
  import { api, registry } from "./notes-client.ts";
814
849
  import { auth, SignIn } from "./auth.tsx";
850
+ import { navigateTo } from "./adapters/navigateTo.ts";
815
851
 
816
852
  const ReadNotes = permission("notes.read");
817
853
  const root = createRootRouteWithContext<{
@@ -850,7 +886,7 @@ const login = createRoute({
850
886
  }),
851
887
  component: () => {
852
888
  const { returnTo } = login.useSearch();
853
- return <SignIn onSignedIn={() => router.navigate({ href: returnTo })} />;
889
+ return <SignIn onSignedIn={() => navigateTo(router, returnTo)} />;
854
890
  },
855
891
  });
856
892
  const router = createRouter({
@@ -896,13 +932,24 @@ export function App({ session }: { readonly session: PermissionSession | undefin
896
932
  const showNotes = can(auth.session, ReadNotes);
897
933
  ```
898
934
 
935
+ TanStack's `navigate` answers with a Promise, so the sign-in callback starts the navigation through a module in `adapters/`:
936
+
937
+ ```ts
938
+ // adapters/navigateTo.ts
939
+ import type { AnyRouter } from "@tanstack/react-router";
940
+
941
+ export function navigateTo(router: AnyRouter, href: string): void {
942
+ void router.navigate({ href });
943
+ }
944
+ ```
945
+
899
946
  `auth` owns the current session and passes it to `App`; `SignIn` updates that session before invoking `onSignedIn`. Use the session's registry for router context and React, as with other query routes. Importing `permissionGuard` augments TanStack's `StaticDataRouteOption`; route options and their inference remain native. The guard returns `void` explicitly, so `beforeLoad` needs no return annotation, including when it reads the session from route context.
900
947
 
901
948
  `PermissionBoundary` runs the guards again when the grants of its `session` change without a navigation, such as a remembered session whose check answers with fewer grants, so a screen that needs a removed grant is replaced by the refusal. The application writes nothing for it; the boundary invalidates the router it renders inside.
902
949
 
903
950
  `InnerWrap` puts `PermissionBoundary` inside the router, and the boundary's fallback can render `Link` and read route context. TanStack types `InnerWrap` as a component that returns an element, so `PermissionShell` leaves its return type to inference; annotated as returning `ReactNode`, it does not compile. Set `defaultErrorComponent: PermissionBoundaryError` so route and loader failures reach the boundary's fallback while TanStack keeps its navigation controller mounted. This lets a refused viewer follow the fallback link without reloading the page. Keep `disableGlobalCatchBoundary: true`; other errors propagate to an enclosing application boundary. A route-specific `errorComponent` owns any failures it consumes.
904
951
 
905
- `Forbidden` from `@shivaedev/react/adapters/Forbidden.ts` supplies the no-access heading, explanation and a router link. Set `to` to a route the viewer may open. Optional `title`, `children`, `backLabel` and `className` let the application choose wording and layout. The default heading is “Permission denied” and the link says “Go back”.
952
+ `Forbidden` from `@shivaedev/react/Forbidden.ts` supplies the no-access heading, explanation and a router link. Set `to` to a route the viewer may open. Optional `title`, `children`, `backLabel` and `className` let the application choose wording and layout. The default heading is “Permission denied” and the link says “Go back”.
906
953
 
907
954
  `PermissionBoundary` also catches component query failures containing the shared `Forbidden` class. Without a boundary, query failures keep their normal typed state. TanStack resets route failures when the viewer navigates away; remount a boundary to clear a failure it catches outside the route error path.
908
955
 
@@ -963,7 +1010,7 @@ The example uses `Option` from `effect` and the application's Better Auth client
963
1010
 
964
1011
  For other Better Auth reads, `authQuery` from `@shivaedev/react/client/authQuery.ts` creates an input-keyed query atom family. Pass an input-to-Effect function, such as the result of `authQuery` from `@shivaedev/identity/client/adapters/authQuery.ts`, then render its atom with `useQuery`. Releasing a pending read interrupts its Effect and aborts the supplied signal.
965
1012
 
966
- Pass the auth owner’s sign-out atom to `SessionBoundary` as `signOut={signOut}`. The boundary mounts it in the auth owner’s registry and unmounts the signed-in tree while sign-out is pending, including the following session refetch. A successful action keeps the tree held until the session clears; a failed action releases the hold. Supply an atom for the sign-out request itself, and give `recheck` the auth owner’s session refresh. After the request succeeds, the boundary starts that check and retries failures while holding the tree. A failed session check never releases a successful sign-out’s hold.
1013
+ Pass the auth owner’s sign-out atom to `SessionBoundary` as `signOut={signOut}` and dispatch it with `useSignOut` below. The boundary mounts it in the auth owner’s registry and unmounts the signed-in tree while sign-out is pending, including the following session refetch. A successful action keeps the tree held until the session clears; a failed action releases the hold. Supply an atom for the sign-out request itself, and give `recheck` the auth owner’s session refresh. After the request succeeds, the boundary starts that check and retries failures while holding the tree. A failed session check never releases a successful sign-out’s hold.
967
1014
 
968
1015
  For an explicit sign-out in a TanStack route, use `useSignOut(signOut, { signIn: "/sign-in" })` from `@shivaedev/react/client/adapters/useSignOut.ts` in place of `useAction`. It exposes the same state and a `dispatch()` handler. The hook records sign-out intent before the request and navigates to sign-in after success. A refused request clears that intent, including when the boundary remounts its route. Repeated clicks while pending share one request and follow-up. Unmounting the component or disposing its registry stops the follow-up navigation. If a session refresh replaces the component before the response, the replacement session’s route policy owns navigation to sign-in. `signInRedirect` and `signInSearch(location)` omit `returnTo` for that intent, including when the auth owner's session refresh reruns guards first. Use `signInSearch` for module sign-in links too; ordinary visits retain the full requested location. Applications do not need history markers or Better Auth completion timing hooks.
969
1016
 
@@ -1062,7 +1109,7 @@ const [createdAt] = useState(now);
1062
1109
  const stamp = () => ({ id: newId(), at: now() });
1063
1110
  ```
1064
1111
 
1065
- These lines belong inside a component; `client` is the application's atom client. Stories pass a runtime containing their test Clock and seeded `SecureRandom`. The hooks use native atom suspense while the runtime builds. `useNewId` reads `SecureRandom` from `effect/crypto`, whose UUID generation must be synchronous. Without a runtime, they use a shared native runtime with Effect's default Clock and `clientCrypto` from `@shivaedev/react/client/adapters/crypto.ts`, which merges Effect's Web Crypto `SecureRandom` and `Digest` Layers. Provide that Layer to an application's runtime when it needs browser crypto.
1112
+ These lines belong inside a component; `client` is the application's atom client. Stories pass a runtime containing their test Clock and seeded `SecureRandom`. The hooks use native atom suspense while the runtime builds. `useNewId` reads `SecureRandom` from `effect/crypto`, whose UUID generation must be synchronous. Without a runtime, they use a shared native runtime with Effect's default Clock and `clientCrypto` from `@shivaedev/react/client/crypto.ts`, which merges Effect's Web Crypto `SecureRandom` and `Digest` Layers. Provide that Layer to an application's runtime when it needs browser crypto.
1066
1113
 
1067
1114
  `usePromiseAction(() => promise, options?)` from `@shivaedev/react/client/adapters/usePromiseAction.ts` returns the same state as `useAction`, with `dispatch()` taking no input. It runs the callback on dispatch, keeps its atom across rerenders and calls the latest committed callback. A promise rejection or synchronous throw becomes `Cause.UnknownError` by default. Supply `catch` to map the unknown cause into an application's typed failure:
1068
1115
 
@@ -1127,7 +1174,7 @@ import { CurrentViewer } from "@shivaedev/contract/readPolicy.ts";
1127
1174
  import { Identity } from "@shivaedev/identity/identity.ts";
1128
1175
  import { Authenticated } from "@shivaedev/identity/middleware.ts";
1129
1176
  import { layerMemoryProtocol } from "@shivaedev/test-kits/contract/testing.ts";
1130
- import { screenPending } from "@shivaedev/react/adapters/screenPending.ts";
1177
+ import { screenPending } from "@shivaedev/react/screenPending.ts";
1131
1178
  import { useAction, useQuery } from "@shivaedev/react/client/resultState.ts";
1132
1179
  import { render } from "@shivaedev/test-story/client/adapters/react.ts";
1133
1180
  import { screenDriver } from "@shivaedev/test-story/server/screenDriver.ts";
@@ -1238,7 +1285,7 @@ screenStories.it("shows the route failure", [], async () => {
1238
1285
 
1239
1286
  Story kits can acquire `captureReactWarnings` from `@shivaedev/test-story/client/adapters/react.ts` in their `create` effect with `const warnings = yield* captureReactWarnings`. The scope owns the capture and restores `console.error` when it closes, including after a failed story. Pass `warnings.onCaughtError` to `render` to capture boundary errors, or `warnings.expectCaughtError(predicate)` to exclude a declared error. Both handlers silence caught errors; the capture also silences and records `console.error` calls. `warnings.read()` returns `{ consoleErrors, caughtErrors }`, with each console call's arguments and the unexpected caught errors. It asserts nothing, leaving the story spec to state its expectation. The Vitest guard uses the same capture mechanism and additionally checks that every declared error occurred.
1240
1287
 
1241
- A screen kit tells its screen driver when the screen has finished its work with `screenPending({ router })` from `@shivaedev/react/adapters/screenPending.ts`. The Effect reads the `AtomRegistry` from its environment and returns a function that reports `true` while a native `AsyncResult` that something still reads is waiting, or while the optional TanStack router loads a route, and `false` otherwise. A result left waiting by a component that has unmounted does not count, even while the registry's idle window keeps its atom. A mounted live query counts until its first answer arrives; after that its open subscription keeps nothing pending, so the screen settles while the live query stays mounted. Each call reads the registry and router at that moment, so pass it as the driver's `pending` option instead of listing the screen's queries by hand:
1288
+ A screen kit tells its screen driver when the screen has finished its work with `screenPending({ router })` from `@shivaedev/react/screenPending.ts`. The Effect reads the `AtomRegistry` from its environment and returns a function that reports `true` while a native `AsyncResult` that something still reads is waiting, or while the optional TanStack router loads a route, and `false` otherwise. A result left waiting by a component that has unmounted does not count, even while the registry's idle window keeps its atom. A mounted live query counts until its first answer arrives; after that its open subscription keeps nothing pending, so the screen settles while the live query stays mounted. Each call reads the registry and router at that moment, so pass it as the driver's `pending` option instead of listing the screen's queries by hand:
1242
1289
 
1243
1290
  ```ts
1244
1291
  const pending = yield* screenPending({ router }).pipe(Effect.provideService(AtomRegistry.AtomRegistry, view.registry));
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Forbidden.d.ts","sourceRoot":"","sources":["../src/Forbidden.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACzB,EAAE,EACF,KAA2B,EAC3B,QAAiD,EACjD,SAAqB,EACrB,SAAS,GACT,EAAE,cAAc,GAAG,SAAS,CAQ5B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Forbidden.js","sourceRoot":"","sources":["../src/Forbidden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAUtD,MAAM,UAAU,SAAS,CAAC,EACzB,EAAE,EACF,KAAK,GAAG,mBAAmB,EAC3B,QAAQ,GAAG,sCAAsC,EACjD,SAAS,GAAG,SAAS,EACrB,SAAS,GACO;IAChB,OAAO,aAAa,CACnB,MAAM,EACN,EAAE,SAAS,EAAE,EACb,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAChC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,EAClC,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,CACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionContext.d.ts","sourceRoot":"","sources":["../src/PermissionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAElF,eAAO,MAAM,iBAAiB;uBAAsC,SAAS;sBAAoB,iBAAiB,GAAG,IAAI,GAAG,SAAS;cAEpI,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionContext.js","sourceRoot":"","sources":["../src/PermissionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AAGtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC7C,SAAS,CACT,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type AnyRouter, type RegisteredRouter, type RouterProps } from "@tanstack/react-router";
2
+ export declare function RouterProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, unknown> = Record<string, unknown>>(props: RouterProps<TRouter, TDehydrated>): import("react").FunctionComponentElement<RouterProps<TRouter, TDehydrated>>;
3
+ //# sourceMappingURL=RouterProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouterProvider.d.ts","sourceRoot":"","sources":["../src/RouterProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAA4C,MAAM,wBAAwB,CAAC;AAI3I,wBAAgB,cAAc,CAAC,OAAO,SAAS,SAAS,GAAG,gBAAgB,EAAE,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjJ,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,+EAmCxC"}
@@ -0,0 +1,37 @@
1
+ import { RegistryContext } from "@effect/atom-react";
2
+ import { RouterProvider as TanStackRouterProvider } from "@tanstack/react-router";
3
+ import { createElement, useContext, useEffect, useLayoutEffect, useRef } from "react";
4
+ import { firstRoutesPending } from "#firstRoutesPending.ts";
5
+ export function RouterProvider(props) {
6
+ const registry = useContext(RegistryContext);
7
+ const { router } = props;
8
+ const holdRef = useRef(undefined);
9
+ // A layout effect holds the reveal before any passive effect of this commit, such as useFirstSettled's above this provider, runs.
10
+ useLayoutEffect(() => {
11
+ if (router.state.resolvedLocation !== undefined) {
12
+ return;
13
+ }
14
+ let held = true;
15
+ registry.update(firstRoutesPending, (pending) => pending + 1);
16
+ function release() {
17
+ if (held) {
18
+ held = false;
19
+ registry.update(firstRoutesPending, (pending) => pending - 1);
20
+ }
21
+ }
22
+ const stop = router.subscribe("onRendered", release);
23
+ const previous = holdRef.current;
24
+ holdRef.current = () => {
25
+ stop();
26
+ release();
27
+ };
28
+ previous?.();
29
+ }, [registry, router]);
30
+ // StrictMode replays every layout cleanup before any passive one; releasing in a passive cleanup, after useFirstSettled above has stopped listening, keeps the replay from revealing.
31
+ useEffect(() => () => {
32
+ holdRef.current?.();
33
+ holdRef.current = undefined;
34
+ }, []);
35
+ return createElement(TanStackRouterProvider, props);
36
+ }
37
+ //# sourceMappingURL=RouterProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouterProvider.js","sourceRoot":"","sources":["../src/RouterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAA2D,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3I,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,UAAU,cAAc,CAC7B,KAAwC;IAExC,MAAM,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,OAAO,GAAG,MAAM,CAAa,SAAS,CAAC,CAAC;IAC9C,kIAAkI;IAClI,eAAe,CAAC,GAAG,EAAE;QACpB,IAAI,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACjD,OAAO;QACR,CAAC;QACD,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QAC9D,SAAS,OAAO;YACf,IAAI,IAAI,EAAE,CAAC;gBACV,IAAI,GAAG,KAAK,CAAC;gBACb,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;YAC/D,CAAC;QACF,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE;YACtB,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,CAAC;QACX,CAAC,CAAC;QACF,QAAQ,EAAE,EAAE,CAAC;IACd,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACvB,sLAAsL;IACtL,SAAS,CACR,GAAG,EAAE,CAAC,GAAG,EAAE;QACV,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7B,CAAC,EACD,EAAE,CACF,CAAC;IACF,OAAO,aAAa,CAAC,sBAA4C,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { CatchBoundary, useRouter } from "@tanstack/react-router";
2
2
  import { createElement, useContext, useEffect, useRef } from "react";
3
3
  import { isForbidden } from "@shivaedev/errors/taxonomy.ts";
4
- import { PermissionContext } from "#adapters/PermissionContext.ts";
5
4
  import { can } from "#can.ts";
5
+ import { PermissionContext } from "#PermissionContext.ts";
6
6
  export function useCan() {
7
7
  const context = useContext(PermissionContext);
8
8
  return (permission) => can(context?.session, permission);
@@ -1 +1 @@
1
- {"version":3,"file":"permissionBoundary.js","sourceRoot":"","sources":["../../src/adapters/permissionBoundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,aA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E,CAAC,YAAY,EAAE,CAAC,CACpH,CAAC;AACH,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Permission } from "@shivaedev/access/permission.ts";
2
2
  import type { PermissionSession } from "@shivaedev/identity/PermissionSession.ts";
3
- import type { QueryRouteRedirect } from "#adapters/queryRouteFailure.ts";
3
+ import type { QueryRouteRedirect } from "#queryRouteFailure.ts";
4
4
  import type { SignInLocation } from "#signInSearch.ts";
5
5
  declare module "@tanstack/react-router" {
6
6
  interface StaticDataRouteOption {
@@ -1 +1 @@
1
- {"version":3,"file":"permissionGuard.d.ts","sourceRoot":"","sources":["../../src/adapters/permissionGuard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,QAAQ,wBAAwB,CAAC;IACvC,UAAU,qBAAqB;QAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;QACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;KAC5B;CACD;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,kBAAkB,CAAC;CACrE;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,UAAU,EAAE;YAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU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AAC;gBAC/B,MAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YACnD,CAAC;QACF,CAAC;IACF,CAAC,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { UnexpectedFailure } from "#client/unexpectedFailure.ts";
2
- export declare const FailureHostContext: import("react").Context<((failure: UnexpectedFailure) => void) | undefined>;
2
+ export declare const FailureHostContext: import("react").Context<((failure: UnexpectedFailure) => (() => void) | undefined) | undefined>;
3
3
  //# sourceMappingURL=FailureHostContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FailureHostContext.d.ts","sourceRoot":"","sources":["../../src/client/FailureHostContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,eAAO,MAAM,kBAAkB,qCAA4B,iBAAiB,KAAK,IAAI,cAAyB,CAAC"}
1
+ {"version":3,"file":"FailureHostContext.d.ts","sourceRoot":"","sources":["../../src/client/FailureHostContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,eAAO,MAAM,kBAAkB,qCAA4B,iBAAiB,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,cAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FailureHostContext.js","sourceRoot":"","sources":["../../src/client/FailureHostContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAqD,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"FailureHostContext.js","sourceRoot":"","sources":["../../src/client/FailureHostContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAyE,SAAS,CAAC,CAAC"}
@@ -3,6 +3,6 @@ export declare const NoticeContext: import("react").Context<{
3
3
  active: boolean;
4
4
  close: () => void;
5
5
  entries: import("effect/reactivity/Atom").Writable<readonly import("../noticeEntry.ts").NoticeEntry<ReactNode>[], readonly import("../noticeEntry.ts").NoticeEntry<ReactNode>[]>;
6
- publish: (descriptor: Pick<import("../noticeTypes.ts").NoticeDescriptor<never, ReactNode>, "expiresIn" | "message">, kind: import("../noticeEntry.ts").NoticeKind, action?: import("../noticeEntry.ts").NoticeAction<ReactNode> | undefined) => void;
6
+ publish: (descriptor: Pick<import("../noticeTypes.ts").NoticeDescriptor<never, ReactNode>, "expiresIn" | "message">, kind: import("../noticeEntry.ts").NoticeKind, action?: import("../noticeEntry.ts").NoticeAction<ReactNode> | undefined) => (() => void) | undefined;
7
7
  } | undefined>;
8
8
  //# sourceMappingURL=NoticeContext.d.ts.map
@@ -1,9 +1,10 @@
1
1
  import * as AsyncResult from "effect/reactivity/AsyncResult";
2
2
  import type * as Atom from "effect/reactivity/Atom";
3
3
  import { type ReactNode } from "react";
4
- export declare function SessionSignOut({ action, children, recheck, }: {
4
+ export declare function SessionSignOut({ action, children, recheck, wipe, }: {
5
5
  readonly action: Atom.Atom<AsyncResult.AsyncResult<unknown, unknown>>;
6
6
  readonly children?: ReactNode;
7
7
  readonly recheck: () => void;
8
+ readonly wipe: () => void;
8
9
  }): ReactNode;
9
10
  //# sourceMappingURL=SessionSignOut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionSignOut.d.ts","sourceRoot":"","sources":["../../src/client/SessionSignOut.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAE5D,wBAAgB,cAAc,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,GACJ,EAAE;IACF,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC1B,GAAG,SAAS,CAcZ"}
@@ -1,7 +1,7 @@
1
1
  import { useAtomValue } from "@effect/atom-react";
2
2
  import * as AsyncResult from "effect/reactivity/AsyncResult";
3
3
  import { useEffect, useState } from "react";
4
- export function SessionSignOut({ action, children, recheck, }) {
4
+ export function SessionSignOut({ action, children, recheck, wipe, }) {
5
5
  const result = useAtomValue(action);
6
6
  const [held, hold] = useState(false);
7
7
  const blocked = result.waiting || (held && !AsyncResult.isFailure(result));
@@ -10,9 +10,10 @@ export function SessionSignOut({ action, children, recheck, }) {
10
10
  }
11
11
  useEffect(() => {
12
12
  if (held && AsyncResult.isSuccess(result) && !result.waiting) {
13
+ wipe();
13
14
  recheck();
14
15
  }
15
- }, [held, result, recheck]);
16
+ }, [held, result, recheck, wipe]);
16
17
  return blocked ? null : children;
17
18
  }
18
19
  //# sourceMappingURL=SessionSignOut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionSignOut.js","sourceRoot":"","sources":["../../src/client/SessionSignOut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,UAAU,cAAc,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,GAMJ;IACA,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAA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AAC,CA+DjD"}
@@ -2,9 +2,9 @@ import { RegistryContext } from "@effect/atom-react";
2
2
  import { Cause, Effect, Option } from "effect";
3
3
  import { useContext, useInsertionEffect, useMemo, useRef } from "react";
4
4
  import { isUnauthorized } from "@shivaedev/errors/taxonomy.ts";
5
- import { useFeedback } from "#client/adapters/useFeedback.ts";
6
5
  import { useStableRun } from "#client/adapters/useStableRun.ts";
7
6
  import { useSessionRecheck } from "#client/sessionBoundary.ts";
7
+ import { useFeedback } from "#client/useFeedback.ts";
8
8
  export function useActionSource(source, options) {
9
9
  // The operation object may be written inline, so its `run` and `runtime`, not the object, are the action's identity.
10
10
  const { native, run, runtime } = "runtime" in source ? { native: undefined, run: source.run, runtime: source.runtime } : { native: source, run: undefined, runtime: undefined };
@@ -1 +1 @@
1
- {"version":3,"file":"actionCompletion.js","sourceRoot":"","sources":["../../src/client/actionCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiB/D,MAAM,UAAU,eAAe,CAC9B,MAAwF,EACxF,OAAwD;IAExD,qHAAqH;IACrH,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAC7B,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MA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CAAC,GAAG,EAAE,CAAC;oBACV,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;gBACxD,CAAC;gBACD,OAAO,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBAC1C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;oBAC5C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;iBAC7C,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QAClF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC3B,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3D,kBAAkB,CAAC,GAAG,EAAE;QACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QAC7B,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;QAC/B,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC,IAAI,CAAC;AACnB,CAAC"}
@@ -1,16 +1,19 @@
1
+ import { type Layer } from "effect";
1
2
  import type * as Atom from "effect/reactivity/Atom";
2
3
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
3
4
  import { type ReactNode } from "react";
5
+ import type { QueryStorageProvider } from "@shivaedev/contract/QueryStorage.ts";
4
6
  import { type QueryRetentionOptions } from "@shivaedev/contract/queryRetention.ts";
5
7
  interface SessionGenerationProps<TSession, TClient> {
6
8
  readonly children: (client: TClient) => ReactNode;
7
9
  readonly connect: (session: TSession, registry: AtomRegistry.AtomRegistry) => TClient;
8
10
  readonly identity: string | undefined;
11
+ readonly persist?: Layer.Layer<QueryStorageProvider> | undefined;
9
12
  readonly queryRetention?: QueryRetentionOptions | undefined;
10
13
  readonly recheck: () => void;
11
14
  readonly session: TSession;
12
15
  readonly warm?: ((client: TClient) => readonly Atom.Atom<unknown>[]) | undefined;
13
16
  }
14
- export declare function SessionGeneration<TSession, TClient>({ session, connect, recheck, children, identity, queryRetention: retention, warm, }: SessionGenerationProps<TSession, TClient>): ReactNode;
17
+ export declare function SessionGeneration<TSession, TClient>({ session, connect, recheck, children, identity, persist, queryRetention: retention, warm, }: SessionGenerationProps<TSession, TClient>): ReactNode;
15
18
  export {};
16
19
  //# sourceMappingURL=SessionGeneration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionGeneration.d.ts","sourceRoot":"","sources":["../../../src/client/adapters/SessionGeneration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAiB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAG3E,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,uCAAuC,CAAC;AA8DnG,UAAU,sBAAsB,CAAC,QAAQ,EAAE,OAAO;IACjD,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,YAAY,KAAK,OAAO,CAAC;IACtF,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,GAAG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