@nkzw/fate 1.0.3 → 1.2.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 (186) hide show
  1. package/README.md +1220 -147
  2. package/docs/api/classes/FateClient.md +134 -40
  3. package/docs/api/functions/clientRoot.md +1 -1
  4. package/docs/api/functions/createClient.md +8 -4
  5. package/docs/api/functions/createGraphQLTransport.md +21 -0
  6. package/docs/api/functions/createHTTPTransport.md +1 -1
  7. package/docs/api/functions/createTRPCTransport.md +1 -1
  8. package/docs/api/functions/defer.md +21 -0
  9. package/docs/api/functions/getDeferredMetadata.md +21 -0
  10. package/docs/api/functions/getListEntries.md +1 -1
  11. package/docs/api/functions/getSelectionPlan.md +1 -1
  12. package/docs/api/functions/graphqlMutation.md +39 -0
  13. package/docs/api/functions/isDeferred.md +15 -0
  14. package/docs/api/functions/isRecord.md +1 -1
  15. package/docs/api/functions/isViewTag.md +1 -1
  16. package/docs/api/functions/liveConnectionTopic.md +1 -1
  17. package/docs/api/functions/liveEntityTopic.md +1 -1
  18. package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
  19. package/docs/api/functions/mutation.md +1 -1
  20. package/docs/api/functions/toEntityId.md +1 -1
  21. package/docs/api/functions/view.md +1 -1
  22. package/docs/api/index.md +19 -0
  23. package/docs/api/interfaces/FateThenable.md +3 -3
  24. package/docs/api/interfaces/Transport.md +7 -7
  25. package/docs/api/server/classes/FateRequestError.md +5 -5
  26. package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
  27. package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
  28. package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
  29. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
  30. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
  31. package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
  32. package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
  33. package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
  34. package/docs/api/server/functions/bindSourceProcedures.md +1 -1
  35. package/docs/api/server/functions/computed.md +1 -1
  36. package/docs/api/server/functions/count.md +1 -1
  37. package/docs/api/server/functions/createFateFetchHandler.md +1 -1
  38. package/docs/api/server/functions/createFateServer.md +1 -1
  39. package/docs/api/server/functions/createHonoFateHandler.md +1 -1
  40. package/docs/api/server/functions/createLiveEventBus.md +1 -1
  41. package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
  42. package/docs/api/server/functions/createResolver.md +1 -1
  43. package/docs/api/server/functions/createSourcePlan.md +1 -1
  44. package/docs/api/server/functions/createSourceProcedures.md +1 -1
  45. package/docs/api/server/functions/dataView.md +1 -1
  46. package/docs/api/server/functions/field.md +1 -1
  47. package/docs/api/server/functions/getNestedSelection.md +1 -1
  48. package/docs/api/server/functions/getScopedArgs.md +1 -1
  49. package/docs/api/server/functions/hasNestedSelection.md +1 -1
  50. package/docs/api/server/functions/list.md +1 -1
  51. package/docs/api/server/functions/refetchSourceById.md +1 -1
  52. package/docs/api/server/functions/resolveSourceById.md +1 -1
  53. package/docs/api/server/functions/resolveSourceByIds.md +1 -1
  54. package/docs/api/server/functions/resolveSourceConnection.md +1 -1
  55. package/docs/api/server/functions/resolver.md +1 -1
  56. package/docs/api/server/functions/toPrismaSelect.md +1 -1
  57. package/docs/api/server/functions/withConnection.md +1 -1
  58. package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
  59. package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
  60. package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
  61. package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
  62. package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
  63. package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
  64. package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
  65. package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
  66. package/docs/api/server/type-aliases/ComputedField.md +5 -5
  67. package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
  68. package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
  69. package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
  70. package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
  71. package/docs/api/server/type-aliases/CountSelection.md +4 -4
  72. package/docs/api/server/type-aliases/CountWhere.md +1 -1
  73. package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
  74. package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
  75. package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
  76. package/docs/api/server/type-aliases/DataViewResult.md +1 -1
  77. package/docs/api/server/type-aliases/Entity.md +1 -1
  78. package/docs/api/server/type-aliases/FateServer.md +5 -5
  79. package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
  80. package/docs/api/server/type-aliases/FieldSelection.md +3 -3
  81. package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
  82. package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
  83. package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
  84. package/docs/api/server/type-aliases/LiveEventType.md +1 -1
  85. package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
  86. package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
  87. package/docs/api/server/type-aliases/OrderDirection.md +1 -1
  88. package/docs/api/server/type-aliases/SourceConfig.md +6 -6
  89. package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
  90. package/docs/api/server/type-aliases/SourceOrder.md +1 -1
  91. package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
  92. package/docs/api/server/type-aliases/SourcePlan.md +1 -1
  93. package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
  94. package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
  95. package/docs/api/server/type-aliases/SourceRelation.md +1 -1
  96. package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
  97. package/docs/api/server/variables/byIdInput.md +1 -1
  98. package/docs/api/server/variables/connectionArgs.md +1 -1
  99. package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
  100. package/docs/api/type-aliases/ConnectionRef.md +1 -1
  101. package/docs/api/type-aliases/Deferred.md +19 -0
  102. package/docs/api/type-aliases/DeferredMetadata.md +7 -0
  103. package/docs/api/type-aliases/DeferredSelection.md +13 -0
  104. package/docs/api/type-aliases/DeferredSnapshot.md +11 -0
  105. package/docs/api/type-aliases/Entity.md +2 -2
  106. package/docs/api/type-aliases/EntityId.md +1 -1
  107. package/docs/api/type-aliases/FateDehydratedState.md +11 -0
  108. package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
  109. package/docs/api/type-aliases/FateLiveEvent.md +1 -1
  110. package/docs/api/type-aliases/FateMutations.md +1 -1
  111. package/docs/api/type-aliases/FateOperation.md +1 -1
  112. package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
  113. package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
  114. package/docs/api/type-aliases/FateRecord.md +1 -1
  115. package/docs/api/type-aliases/FateRoots.md +1 -1
  116. package/docs/api/type-aliases/GraphQLMutationDefinition.md +19 -0
  117. package/docs/api/type-aliases/GraphQLMutationInput.md +11 -0
  118. package/docs/api/type-aliases/GraphQLMutationMap.md +11 -0
  119. package/docs/api/type-aliases/GraphQLMutationOutput.md +11 -0
  120. package/docs/api/type-aliases/GraphQLTransportOptions.md +119 -0
  121. package/docs/api/type-aliases/HydrateOptions.md +7 -0
  122. package/docs/api/type-aliases/HydrationLimits.md +7 -0
  123. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  124. package/docs/api/type-aliases/List.md +1 -1
  125. package/docs/api/type-aliases/ListEntry.md +1 -1
  126. package/docs/api/type-aliases/ListItem.md +1 -1
  127. package/docs/api/type-aliases/Mask.md +1 -1
  128. package/docs/api/type-aliases/MutationDefinition.md +1 -1
  129. package/docs/api/type-aliases/MutationEntity.md +1 -1
  130. package/docs/api/type-aliases/MutationIdentifier.md +1 -1
  131. package/docs/api/type-aliases/MutationInput.md +1 -1
  132. package/docs/api/type-aliases/MutationResult.md +1 -1
  133. package/docs/api/type-aliases/NodesItem.md +1 -1
  134. package/docs/api/type-aliases/Pagination.md +5 -5
  135. package/docs/api/type-aliases/Request.md +1 -1
  136. package/docs/api/type-aliases/RequestMode.md +1 -1
  137. package/docs/api/type-aliases/RequestOptions.md +1 -1
  138. package/docs/api/type-aliases/RequestResult.md +1 -1
  139. package/docs/api/type-aliases/Selection.md +1 -1
  140. package/docs/api/type-aliases/Snapshot.md +1 -1
  141. package/docs/api/type-aliases/TypeConfig.md +4 -4
  142. package/docs/api/type-aliases/View.md +1 -1
  143. package/docs/api/type-aliases/ViewData.md +1 -1
  144. package/docs/api/type-aliases/ViewEntity.md +1 -1
  145. package/docs/api/type-aliases/ViewEntityName.md +1 -1
  146. package/docs/api/type-aliases/ViewRef.md +1 -1
  147. package/docs/api/type-aliases/ViewSelection.md +1 -1
  148. package/docs/api/type-aliases/ViewSnapshot.md +1 -1
  149. package/docs/api/type-aliases/ViewTag.md +1 -1
  150. package/docs/api/variables/ConnectionTag.md +1 -1
  151. package/docs/api/variables/DeferTag.md +7 -0
  152. package/docs/api/variables/DeferredTag.md +7 -0
  153. package/docs/guide/actions.md +7 -7
  154. package/docs/guide/deferred-views.md +62 -0
  155. package/docs/guide/getting-started.md +21 -3
  156. package/docs/guide/requests.md +52 -0
  157. package/docs/guide/vue.md +256 -0
  158. package/docs/index.md +1 -0
  159. package/docs/integrations/graphql.md +345 -0
  160. package/docs/{guide/server-integration.md → integrations/server.md} +94 -7
  161. package/docs/{guide/void-integration.md → integrations/void.md} +94 -12
  162. package/lib/{executor-BqwHdN3n.d.mts → executor-Dh-MLUXc.d.mts} +1 -1
  163. package/lib/graphqlTransport-B3cbhvJX.d.mts +74 -0
  164. package/lib/graphqlTransport-IFgmY-Qq.mjs +499 -0
  165. package/lib/graphqlTransport.d.mts +2 -0
  166. package/lib/graphqlTransport.mjs +2 -0
  167. package/lib/index.d.mts +10 -4
  168. package/lib/index.mjs +619 -91
  169. package/lib/{list-4wRNSVgI.d.mts → list-BrL6PD_6.d.mts} +1 -1
  170. package/lib/list.d.mts +1 -1
  171. package/lib/list.mjs +1 -1
  172. package/lib/{liveTopics-DzNtJaBD.mjs → liveTopics-JIDh3t3P.mjs} +1 -1
  173. package/lib/{record-CirbfZWX.d.mts → record-BkvZwvFk.d.mts} +2 -2
  174. package/lib/server/drizzle.d.mts +6 -8
  175. package/lib/server/drizzle.mjs +2 -2
  176. package/lib/server/prisma.d.mts +6 -8
  177. package/lib/server/prisma.mjs +2 -2
  178. package/lib/server.d.mts +3 -3
  179. package/lib/server.mjs +3 -3
  180. package/lib/{sourceRouter-C22uFcZg.mjs → sourceRouter-N9Vp0Cj6.mjs} +1 -1
  181. package/lib/{types-Dz46PXr3.d.mts → transport-BjGm__3t.d.mts} +246 -145
  182. package/lib/vite.d.mts +2 -2
  183. package/lib/vite.mjs +150 -3
  184. package/package.json +11 -3
  185. /package/lib/{list-C_mi6GnE.mjs → list-_6fXYLtJ.mjs} +0 -0
  186. /package/lib/{record-AeZJC9fd.mjs → record-B07VwXd-.mjs} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **InferFateAPI**\<`Server`\> = `Server` *extends* `object` ? `API` : `never`
4
4
 
5
- Defined in: [packages/fate/src/server/http.ts:235](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/server/http.ts#L235)
5
+ Defined in: [packages/fate/src/server/http.ts:235](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/server/http.ts#L235)
6
6
 
7
7
  ## Type Parameters
8
8
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  > **List** = `Readonly`\<\{ `backwardPageLimit?`: `number`; `cursors?`: `ReadonlyArray`\<`string` \| `undefined`\>; `forwardPageLimit?`: `number`; `ids`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `liveAfterIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `liveBeforeIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `pagination?`: [`Pagination`](Pagination.md); `pendingAfterIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `pendingBeforeIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; \}\>
4
4
 
5
- Defined in: [packages/fate/src/store.ts:14](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/store.ts#L14)
5
+ Defined in: [packages/fate/src/store.ts:15](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/store.ts#L15)
@@ -2,4 +2,4 @@
2
2
 
3
3
  > **ListEntry** = `Readonly`\<\{ `cursor?`: `string`; `id`: [`EntityId`](EntityId.md); \}\>
4
4
 
5
- Defined in: [packages/fate/src/list.ts:4](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/list.ts#L4)
5
+ Defined in: [packages/fate/src/list.ts:4](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/list.ts#L4)
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ListItem**\<`V`\> = `Readonly`\<\{ `args?`: `Record`\<`string`, `unknown`\>; `list`: `V`; \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:316](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L316)
5
+ Defined in: [packages/fate/src/types.ts:348](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L348)
6
6
 
7
7
  Definition of a list request for fetching data from the backend.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Mask**\<`T`, `S`\> = `WithNullish`\<`T`, `MaskNonNullish`\<`NonNullish`\<`T`\>, `S`\>\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:300](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L300)
5
+ Defined in: [packages/fate/src/types.ts:332](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L332)
6
6
 
7
7
  ## Type Parameters
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **MutationDefinition**\<`T`, `I`, `R`\> = `Readonly`\<\{ `__fate__mutation`: `true`; `entity`: `T`\[`"__typename"`\]; \}\> & `__MutationEntityAnchor`\<`T`\> & `__MutationInputAnchor`\<`I`\> & `__MutationResultAnchor`\<`R`\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:434](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L434)
5
+ Defined in: [packages/fate/src/types.ts:466](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L466)
6
6
 
7
7
  Metadata describing a mutation for a particular entity, input, and output.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **MutationEntity**\<`M`\> = `M` *extends* `__MutationEntityAnchor`\<infer E\> ? `E` : `never`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:452](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L452)
5
+ Defined in: [packages/fate/src/types.ts:484](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L484)
6
6
 
7
7
  Extracts the entity type from a mutation definition or identifier.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **MutationIdentifier**\<`T`, `I`, `R`\> = [`MutationDefinition`](MutationDefinition.md)\<`T`, `I`, `R`\> & `Readonly`\<\{ `key`: `string`; \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:442](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L442)
5
+ Defined in: [packages/fate/src/types.ts:474](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L474)
6
6
 
7
7
  ## Type Parameters
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **MutationInput**\<`M`\> = `M` *extends* `__MutationInputAnchor`\<infer I\> ? `I` : `never`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:446](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L446)
5
+ Defined in: [packages/fate/src/types.ts:478](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L478)
6
6
 
7
7
  Extracts the input type from a mutation definition or identifier.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **MutationResult**\<`M`\> = `M` *extends* `__MutationResultAnchor`\<infer R\> ? `R` : `never`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:449](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L449)
5
+ Defined in: [packages/fate/src/types.ts:481](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L481)
6
6
 
7
7
  Extracts the result type from a mutation definition or identifier.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **NodesItem**\<`V`\> = `Readonly`\<\{ `ids`: `ReadonlyArray`\<`string` \| `number`\>; `view`: `V`; \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:334](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L334)
5
+ Defined in: [packages/fate/src/types.ts:366](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L366)
6
6
 
7
7
  Definition of a node request with explicit IDs for fetching data from the backend.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Pagination** = `object`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:124](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L124)
5
+ Defined in: [packages/fate/src/types.ts:131](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L131)
6
6
 
7
7
  Pagination state returned alongside connection lists.
8
8
 
@@ -12,7 +12,7 @@ Pagination state returned alongside connection lists.
12
12
 
13
13
  > **hasNext**: `boolean`
14
14
 
15
- Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L125)
15
+ Defined in: [packages/fate/src/types.ts:132](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L132)
16
16
 
17
17
  ***
18
18
 
@@ -20,7 +20,7 @@ Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/b
20
20
 
21
21
  > **hasPrevious**: `boolean`
22
22
 
23
- Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L126)
23
+ Defined in: [packages/fate/src/types.ts:133](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L133)
24
24
 
25
25
  ***
26
26
 
@@ -28,7 +28,7 @@ Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/b
28
28
 
29
29
  > `optional` **nextCursor?**: `string`
30
30
 
31
- Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L127)
31
+ Defined in: [packages/fate/src/types.ts:134](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L134)
32
32
 
33
33
  ***
34
34
 
@@ -36,4 +36,4 @@ Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/b
36
36
 
37
37
  > `optional` **previousCursor?**: `string`
38
38
 
39
- Defined in: [packages/fate/src/types.ts:128](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L128)
39
+ Defined in: [packages/fate/src/types.ts:135](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L135)
@@ -2,6 +2,6 @@
2
2
 
3
3
  > **Request** = `Record`\<`string`, `RequestItem`\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:346](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L346)
5
+ Defined in: [packages/fate/src/types.ts:378](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L378)
6
6
 
7
7
  Collection of node and list requests describing the data a screen needs.
@@ -2,6 +2,6 @@
2
2
 
3
3
  > **RequestMode** = `"cache-first"` \| `"stale-while-revalidate"` \| `"network-only"`
4
4
 
5
- Defined in: [packages/fate/src/client.ts:73](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/client.ts#L73)
5
+ Defined in: [packages/fate/src/client.ts:89](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/client.ts#L89)
6
6
 
7
7
  Strategy used when resolving a request.
@@ -2,6 +2,6 @@
2
2
 
3
3
  > **RequestOptions** = `Readonly`\<\{ `mode?`: [`RequestMode`](RequestMode.md); \}\>
4
4
 
5
- Defined in: [packages/fate/src/client.ts:84](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/client.ts#L84)
5
+ Defined in: [packages/fate/src/client.ts:100](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/client.ts#L100)
6
6
 
7
7
  Request options that affect how requests are fetched and retained.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **RequestResult**\<`R`, `Q`\> = `{ [K in keyof Q]: K extends keyof R ? ListResult<Q[K], RootType<R[K]>, RootResult<R[K]>> : never }`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:392](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L392)
5
+ Defined in: [packages/fate/src/types.ts:424](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L424)
6
6
 
7
7
  The result of a `FateClient.request` and `useRequest` call, mapping each
8
8
  request key to its corresponding result.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Selection**\<`T`\> = `SelectionShape`\<`T`\> & `SelectionViewSpread`\<`T`\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:199](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L199)
5
+ Defined in: [packages/fate/src/types.ts:229](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L229)
6
6
 
7
7
  Declarative selection of the fields a view needs from an entity.
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  > **Snapshot** = `Readonly`\<\{ `mask?`: `FieldMask`; `record?`: [`FateRecord`](FateRecord.md); \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:481](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L481)
5
+ Defined in: [packages/fate/src/types.ts:513](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L513)
6
6
 
7
7
  Snapshot captured before mutating the cache, used to roll back on errors.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **TypeConfig** = `object`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:117](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L117)
5
+ Defined in: [packages/fate/src/types.ts:124](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L124)
6
6
 
7
7
  Configuration for a server entity type used by the client cache.
8
8
 
@@ -12,7 +12,7 @@ Configuration for a server entity type used by the client cache.
12
12
 
13
13
  > `optional` **fields?**: `Record`\<`string`, `RelationDescriptor`\>
14
14
 
15
- Defined in: [packages/fate/src/types.ts:118](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L118)
15
+ Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L125)
16
16
 
17
17
  ***
18
18
 
@@ -20,7 +20,7 @@ Defined in: [packages/fate/src/types.ts:118](https://github.com/nkzw-tech/fate/b
20
20
 
21
21
  > **getId**: (`record`) => `string` \| `number`
22
22
 
23
- Defined in: [packages/fate/src/types.ts:119](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L119)
23
+ Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L126)
24
24
 
25
25
  #### Parameters
26
26
 
@@ -38,4 +38,4 @@ Defined in: [packages/fate/src/types.ts:119](https://github.com/nkzw-tech/fate/b
38
38
 
39
39
  > **type**: `string`
40
40
 
41
- Defined in: [packages/fate/src/types.ts:120](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L120)
41
+ Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L127)
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **View**\<`T`, `S`\> = `Readonly`\<\{\[`viewTag`: `` `__fate-view__${string}` ``\]: `Readonly`\<\{ `[ViewKind]`: `true`; `select`: `S`; \}\>; \}\> & `__ViewEntityAnchor`\<`T`\> & `__ViewSelectionAnchor`\<`S`\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:215](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L215)
5
+ Defined in: [packages/fate/src/types.ts:245](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L245)
6
6
 
7
7
  Definition of a view over an entity type, including the selection of fields.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewData**\<`T`, `S`\> = `Readonly`\<`S` *extends* [`Selection`](Selection.md)\<`T`\> ? [`Mask`](Mask.md)\<`T`, `S`\> : `T` & `object`\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:231](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L231)
5
+ Defined in: [packages/fate/src/types.ts:261](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L261)
6
6
 
7
7
  Data returned from a resolved view with masking applied and view tags
8
8
  attached for downstream composition.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewEntity**\<`V`\> = `V` *extends* [`View`](View.md)\<infer T, `any`\> ? `T` : `never`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:303](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L303)
5
+ Defined in: [packages/fate/src/types.ts:335](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L335)
6
6
 
7
7
  Entity type captured from a view definition.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewEntityName**\<`V`\> = [`ViewEntity`](ViewEntity.md)\<`V`\>\[`"__typename"`\] & `string`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:306](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L306)
5
+ Defined in: [packages/fate/src/types.ts:338](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L338)
6
6
 
7
7
  Name of the entity type captured from a view definition.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewRef**\<`TName`\> = `Readonly`\<\{ `__typename`: `TName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:101](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L101)
5
+ Defined in: [packages/fate/src/types.ts:108](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L108)
6
6
 
7
7
  Reference to a normalized entity instance that can be resolved against one or more view tags.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewSelection**\<`V`\> = `V` *extends* `object` ? `S` : `never`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:309](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L309)
5
+ Defined in: [packages/fate/src/types.ts:341](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L341)
6
6
 
7
7
  Selection captured from a view definition.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **ViewSnapshot**\<`T`, `S`\> = `Readonly`\<\{ `coverage`: `ReadonlyArray`\<readonly \[[`EntityId`](EntityId.md), `ReadonlySet`\<`string`\>\]\>; `data`: [`ViewData`](ViewData.md)\<`T`, `S`\>; \}\>
4
4
 
5
- Defined in: [packages/fate/src/types.ts:241](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L241)
5
+ Defined in: [packages/fate/src/types.ts:271](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L271)
6
6
 
7
7
  Snapshot returned by the cache for a view, including the masked data and all
8
8
  referenced entity IDs.
@@ -2,6 +2,6 @@
2
2
 
3
3
  > **ViewTag** = `` `__fate-view__${string}` ``
4
4
 
5
- Defined in: [packages/fate/src/types.ts:49](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L49)
5
+ Defined in: [packages/fate/src/types.ts:56](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L56)
6
6
 
7
7
  Unique key that identifies a view composition entry inside a selection or reference.
@@ -2,6 +2,6 @@
2
2
 
3
3
  > `const` **ConnectionTag**: *typeof* `ConnectionTag`
4
4
 
5
- Defined in: [packages/fate/src/types.ts:20](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L20)
5
+ Defined in: [packages/fate/src/types.ts:20](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L20)
6
6
 
7
7
  Symbol attached to connection results so pagination helpers can find their metadata.
@@ -0,0 +1,7 @@
1
+ # Variable: DeferTag
2
+
3
+ > `const` **DeferTag**: *typeof* `DeferTag`
4
+
5
+ Defined in: [packages/fate/src/types.ts:23](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L23)
6
+
7
+ Symbol used to mark a selection as deferred.
@@ -0,0 +1,7 @@
1
+ # Variable: DeferredTag
2
+
3
+ > `const` **DeferredTag**: *typeof* `DeferredTag`
4
+
5
+ Defined in: [packages/fate/src/types.ts:26](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/fate/src/types.ts#L26)
6
+
7
+ Symbol attached to deferred values returned from masked views.
@@ -7,9 +7,9 @@ fate does not provide hooks for mutations like traditional data fetching librari
7
7
 
8
8
  Server mutations are exposed automatically as actions and mutations by fate's Vite plugin. The transport determines where those mutations are declared:
9
9
 
10
- - With the [native HTTP transport](server-integration.md#native-fate-protocol), mutations come from the `mutations` object passed to `createFateServer`.
11
- - With the [tRPC adapter](server-integration.md#trpc-fate-setup), mutations come from tRPC mutation procedures exposed through your fate-enabled router.
12
- - With [Void](void-integration.md), mutations use the same native fate server shape and are exposed through the Void route helpers.
10
+ - With the [native HTTP transport](../integrations/server.md#native-fate-protocol), mutations come from the `mutations` object passed to `createFateServer`.
11
+ - With the [tRPC adapter](../integrations/server.md#trpc-fate-setup), mutations come from tRPC mutation procedures exposed through your fate-enabled router.
12
+ - With [Void](../integrations/void.md), mutations use the same native fate server shape and are exposed through the Void route helpers.
13
13
 
14
14
  If you have a mutation named `post.like`, a `LikeButton` component using fate Actions and an async component library could look like this:
15
15
 
@@ -148,9 +148,9 @@ You can call mutations from anywhere, and without waiting for previous mutations
148
148
 
149
149
  fate Actions & Mutations are backed by regular server mutations. If you already know how your fate server is wired, the client-side API above is the same regardless of transport. If not, start with the server setup for your environment:
150
150
 
151
- - [Native HTTP custom mutations](server-integration.md#custom-mutations) use `createFateServer({ mutations })`.
152
- - [tRPC fate setup](server-integration.md#trpc-fate-setup) wires fate into your tRPC router; custom writes can use the same `fate.createPlan` and `fate.resolveById` helpers shown there.
153
- - [Void integration](void-integration.md) exposes a native fate server from Void routes; define mutations with the native `createFateServer({ mutations })` API and serve them through `defineVoidFateRoute`.
151
+ - [Native HTTP custom mutations](../integrations/server.md#custom-mutations) use `createFateServer({ mutations })`.
152
+ - [tRPC fate setup](../integrations/server.md#trpc-fate-setup) wires fate into your tRPC router; custom writes can use the same `fate.createPlan` and `fate.resolveById` helpers shown there.
153
+ - [Void integration](../integrations/void.md) exposes a native fate server from Void routes; define mutations with the native `createFateServer({ mutations })` API and serve them through `defineVoidFateRoute`.
154
154
 
155
155
  Here is a native HTTP mutation for `post.like`:
156
156
 
@@ -223,7 +223,7 @@ export const postRouter = router({
223
223
  });
224
224
  ```
225
225
 
226
- See [Server Integration](server-integration.md) for complete native HTTP and tRPC setup examples, and [Void Integration](void-integration.md) for route helpers when your app runs on Void.
226
+ See [Server Integration](../integrations/server.md) for complete native HTTP and tRPC setup examples, and [Void Integration](../integrations/void.md) for route helpers when your app runs on Void.
227
227
 
228
228
  ## Action & Mutation Error Handling
229
229
 
@@ -0,0 +1,62 @@
1
+ # Deferred Views
2
+
3
+ Use `defer` when a field should not block the parent view. The parent view receives a deferred handle immediately after the eager fields are available, and the component that reads that handle with `useView`, `useListView`, or `useLiveListView` decides which `Suspense` boundary handles the loading state.
4
+
5
+ ```tsx
6
+ import { Suspense } from 'react';
7
+ import { defer, useListView, useView, view, Deferred, ViewRef } from 'react-fate';
8
+
9
+ const CommentView = view<Comment>()({
10
+ content: true,
11
+ id: true,
12
+ });
13
+
14
+ const CommentConnectionView = {
15
+ args: { first: 3 },
16
+ items: { node: CommentView },
17
+ };
18
+
19
+ const PostView = view<Post>()({
20
+ comments: defer(CommentConnectionView),
21
+ content: true,
22
+ id: true,
23
+ title: true,
24
+ });
25
+
26
+ function PostCard({ post: postRef }: { post: ViewRef<'Post'> }) {
27
+ const post = useView(PostView, postRef);
28
+
29
+ return (
30
+ <article>
31
+ <h2>{post.title}</h2>
32
+ <p>{post.content}</p>
33
+ <Suspense fallback={<CommentsSkeleton />}>
34
+ <PostComments comments={post.comments} />
35
+ </Suspense>
36
+ </article>
37
+ );
38
+ }
39
+
40
+ function PostComments({
41
+ comments,
42
+ }: {
43
+ comments: Deferred<{ items: ReadonlyArray<{ node: ViewRef<'Comment'> }> }>;
44
+ }) {
45
+ const [items, loadNext] = useListView(CommentConnectionView, comments);
46
+
47
+ return (
48
+ <section>
49
+ {items.map(({ node }) => (
50
+ <CommentCard comment={node} key={node.id} />
51
+ ))}
52
+ {loadNext ? <button onClick={loadNext}>Load more</button> : null}
53
+ </section>
54
+ );
55
+ }
56
+ ```
57
+
58
+ Deferred fields are not optional data. They are explicit handles that existing view APIs can read. If the deferred selection is missing from the normalized cache, fate fetches only that missing selection and suspends the component that tried to resolve it.
59
+
60
+ This keeps parent components simple: eager fields like `title` and `content` are available when `useView(PostView, postRef)` returns, while slower or secondary fields such as `comments` can load under their own boundary.
61
+
62
+ GraphQL transports use the same client semantics today. The deferred field is omitted from the eager request and fetched when the deferred handle is resolved. GraphQL `@defer` is the natural transport representation for this feature, but consuming incremental multipart patches requires additional transport support before fate can safely normalize streamed patches from a single GraphQL response.
@@ -8,11 +8,11 @@ Create a new fate app with Vite+:
8
8
  vp create fate my-app
9
9
  ```
10
10
 
11
- The template selector can create a Void app with Drizzle, a tRPC app with Drizzle, or a tRPC app with Prisma. The template sources live in the fate repo under [`packages/create-fate/templates/fate`](https://github.com/nkzw-tech/fate/tree/main/packages/create-fate/templates/fate). They feature modern tools to deliver an incredibly fast development experience.
11
+ The template selector can create a React or Vue client for a Void app with Drizzle, a tRPC app with Drizzle or Prisma, a GraphQL app with Prisma, or a fate client for an existing GraphQL server. React is the default UI framework; pass `--framework vue` or choose Vue in the template selector to create a Vue app. The template sources live in the fate repo under [`packages/create-fate/templates/fate`](https://github.com/nkzw-tech/fate/tree/main/packages/create-fate/templates/fate). They feature modern tools to deliver an incredibly fast development experience.
12
12
 
13
13
  ## Manual Installation
14
14
 
15
- **_fate_** requires React 19.2+. For a React client, install `react-fate`:
15
+ For a React client, install `react-fate`. It requires React 19.2+:
16
16
 
17
17
  ::: code-group
18
18
 
@@ -30,7 +30,25 @@ yarn add react-fate
30
30
 
31
31
  :::
32
32
 
33
- If your server is a separate package, install `@nkzw/fate` there as a runtime dependency too. Install `@nkzw/fate` on the client only for a barebones integration without React:
33
+ For a Vue client, install `vue-fate`:
34
+
35
+ ::: code-group
36
+
37
+ ```bash [npm]
38
+ npm add vue-fate
39
+ ```
40
+
41
+ ```bash [pnpm]
42
+ pnpm add vue-fate
43
+ ```
44
+
45
+ ```bash [yarn]
46
+ yarn add vue-fate
47
+ ```
48
+
49
+ :::
50
+
51
+ If your server is a separate package, install `@nkzw/fate` there as a runtime dependency too. Install `@nkzw/fate` on the client only for a barebones integration without a framework adapter:
34
52
 
35
53
  ::: code-group
36
54
 
@@ -128,3 +128,55 @@ try {
128
128
  ```
129
129
 
130
130
  Garbage collection waits for active optimistic updates to settle before sweeping records. This keeps temporary optimistic records and their list positions stable while mutations are still pending.
131
+
132
+ ## SSR and Hydration
133
+
134
+ Create a request-scoped fate client on the server, preload the route data, and dehydrate its normalized cache:
135
+
136
+ ```tsx
137
+ const fate = createFateClient();
138
+ await fate.request({ post: { id: '12', view: PostView } });
139
+
140
+ return {
141
+ fate: fate.dehydrate(),
142
+ };
143
+ ```
144
+
145
+ Transport the returned value through your framework's loader serialization, React Server Component props, or a safely escaped JSON bootstrap script. The snapshot contains plain serializable values, so serializers such as Seroval can carry it without fate-specific integration. Treat the snapshot as opaque: hydrate it through fate rather than reading or editing its internal data.
146
+
147
+ On the browser, hydrate the new client before rendering components that call `useRequest`:
148
+
149
+ ```tsx
150
+ const fate = createFateClient();
151
+ fate.hydrate(loaderData.fate);
152
+
153
+ hydrateRoot(
154
+ document,
155
+ <FateClient client={fate}>
156
+ <App />
157
+ </FateClient>,
158
+ );
159
+ ```
160
+
161
+ Hydrated `cache-first` requests resolve from the normalized cache without refetching. Hydration restores records, selected-field coverage, root queries, and list pagination state. It intentionally does not restore active requests, subscriptions, retainers, timers, or optimistic mutation state.
162
+
163
+ Snapshots carry a hydration scope and are rejected by clients with a different scope. Generated clients set a stable scope automatically. When constructing a client directly, pass `hydrationScope` and rotate it when deploying an incompatible cache schema or when separating cache namespaces:
164
+
165
+ ```tsx
166
+ const fate = createClient({
167
+ hydrationScope: 'storefront-v2',
168
+ // ...
169
+ });
170
+ ```
171
+
172
+ Use `hydrationLimits` when an application needs stricter bootstrap payload limits. fate applies conservative defaults for total encoded values, collection sizes, and string lengths.
173
+
174
+ By default, hydration preserves values already present in the browser cache while adding missing server data. Pass `{ merge: 'replace' }` only when the snapshot should authoritatively reset the durable cache:
175
+
176
+ ```tsx
177
+ fate.hydrate(loaderData.fate, { merge: 'replace' });
178
+ ```
179
+
180
+ `preserve-existing` recursively combines plain scalar objects while keeping browser values on conflicts. Arrays, dates, entity references, and list windows are atomic: an existing browser value wins as a whole. Replaying a snapshot is safe and does not notify subscribers when durable cache state is unchanged.
181
+
182
+ Do not reuse request-scoped snapshots across users. Dehydrate after awaited route preloading: snapshots are point-in-time values and do not stream cache patches for data that resolves later. Hydration and dehydration reject clients with in-flight requests, so hydrate the initial snapshot before rendering.