react-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 (44) hide show
  1. package/README.md +1220 -147
  2. package/docs/api/functions/FateClient.md +1 -1
  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/graphqlMutation.md +39 -0
  10. package/docs/api/functions/mutation.md +1 -1
  11. package/docs/api/functions/useFateClient.md +1 -1
  12. package/docs/api/functions/useListView.md +4 -4
  13. package/docs/api/functions/useLiveListView.md +4 -4
  14. package/docs/api/functions/useLiveView.md +52 -11
  15. package/docs/api/functions/useRequest.md +1 -1
  16. package/docs/api/functions/useView.md +85 -11
  17. package/docs/api/functions/view.md +1 -1
  18. package/docs/api/index.md +13 -0
  19. package/docs/api/type-aliases/ConnectionRef.md +2 -2
  20. package/docs/api/type-aliases/Deferred.md +19 -0
  21. package/docs/api/type-aliases/FateDehydratedState.md +11 -0
  22. package/docs/api/type-aliases/GraphQLMutationDefinition.md +19 -0
  23. package/docs/api/type-aliases/GraphQLMutationInput.md +11 -0
  24. package/docs/api/type-aliases/GraphQLMutationMap.md +11 -0
  25. package/docs/api/type-aliases/GraphQLMutationOutput.md +11 -0
  26. package/docs/api/type-aliases/GraphQLTransportOptions.md +119 -0
  27. package/docs/api/type-aliases/HydrateOptions.md +7 -0
  28. package/docs/api/type-aliases/HydrationLimits.md +7 -0
  29. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  30. package/docs/api/type-aliases/Pagination.md +39 -0
  31. package/docs/api/type-aliases/ViewRef.md +1 -1
  32. package/docs/api/variables/toEntityId.md +1 -1
  33. package/docs/guide/actions.md +7 -7
  34. package/docs/guide/deferred-views.md +62 -0
  35. package/docs/guide/getting-started.md +21 -3
  36. package/docs/guide/requests.md +52 -0
  37. package/docs/guide/vue.md +256 -0
  38. package/docs/index.md +1 -0
  39. package/docs/integrations/graphql.md +345 -0
  40. package/docs/{guide/server-integration.md → integrations/server.md} +94 -7
  41. package/docs/{guide/void-integration.md → integrations/void.md} +94 -12
  42. package/lib/index.d.mts +20 -15
  43. package/lib/index.mjs +110 -16
  44. package/package.json +5 -5
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **FateClient**(`__namedParameters`): `Element`
4
4
 
5
- Defined in: [packages/react-fate/src/context.tsx:17](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/context.tsx#L17)
5
+ Defined in: [packages/react-fate/src/context.tsx:17](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/context.tsx#L17)
6
6
 
7
7
  Provider component that supplies a configured `FateClient` to React hooks.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **clientRoot**\<`Result`, `Type`\>(`type`): `RootDefinition`\<`Type`, `Result`\>
4
4
 
5
- Defined in: packages/fate/lib/index.d.mts:69
5
+ Defined in: packages/fate/lib/index.d.mts:75
6
6
 
7
7
  Defines a root query for an entity type, capturing the response shape.
8
8
 
@@ -1,8 +1,8 @@
1
1
  # Function: createClient()
2
2
 
3
- > **createClient**\<`T`\>(`options`): `FateClient`\<`T`\[`0`\], `T`\[`1`\]\>
3
+ > **createClient**\<`T`, `HydrationScope`\>(`options`): `FateClient`\<`T`\[`0`\], `T`\[`1`\], `HydrationScope`\>
4
4
 
5
- Defined in: packages/fate/lib/types-Dz46PXr3.d.mts:973
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:943
6
6
 
7
7
  ## Type Parameters
8
8
 
@@ -10,12 +10,16 @@ Defined in: packages/fate/lib/types-Dz46PXr3.d.mts:973
10
10
 
11
11
  `T` *extends* \[`FateRoots`, `FateMutations`\] = \[`Record`\<`never`, `RootDefinition`\<`any`, `any`\>\>, `Record`\<`never`, `MutationDefinition`\<`any`, `any`, `any`\>\>\]
12
12
 
13
+ ### HydrationScope
14
+
15
+ `HydrationScope` *extends* `string` = `string`
16
+
13
17
  ## Parameters
14
18
 
15
19
  ### options
16
20
 
17
- `FateClientOptions`\<`T`\[`0`\], `T`\[`1`\]\>
21
+ `FateClientOptions`\<`T`\[`0`\], `T`\[`1`\], `HydrationScope`\>
18
22
 
19
23
  ## Returns
20
24
 
21
- `FateClient`\<`T`\[`0`\], `T`\[`1`\]\>
25
+ `FateClient`\<`T`\[`0`\], `T`\[`1`\], `HydrationScope`\>
@@ -0,0 +1,21 @@
1
+ # Function: createGraphQLTransport()
2
+
3
+ > **createGraphQLTransport**\<`Mutations`\>(`__namedParameters`): `Transport`\<`Mutations`\>
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:62
6
+
7
+ ## Type Parameters
8
+
9
+ ### Mutations
10
+
11
+ `Mutations` *extends* `TransportMutations` = `EmptyTransportMutations`
12
+
13
+ ## Parameters
14
+
15
+ ### \_\_namedParameters
16
+
17
+ [`GraphQLTransportOptions`](../type-aliases/GraphQLTransportOptions.md)\<`Mutations`\>
18
+
19
+ ## Returns
20
+
21
+ `Transport`\<`Mutations`\>
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **createHTTPTransport**\<`API`, `Mutations`\>(`__namedParameters`): `Transport`\<`Mutations`\>
4
4
 
5
- Defined in: packages/fate/lib/index.d.mts:47
5
+ Defined in: packages/fate/lib/index.d.mts:53
6
6
 
7
7
  ## Type Parameters
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **createTRPCTransport**\<`AppRouter`, `Mutations`\>(`__namedParameters`): `Transport`\<`MutationMapFromResolvers`\<`Mutations`\>\>
4
4
 
5
- Defined in: packages/fate/lib/types-Dz46PXr3.d.mts:709
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:1432
6
6
 
7
7
  Builds a `Transport` backed by a tRPC client using the configured resolvers
8
8
  for by-id queries, lists, and mutations.
@@ -0,0 +1,21 @@
1
+ # Function: defer()
2
+
3
+ > **defer**\<`S`\>(`selection`): `DeferredSelection`\<`S`\>
4
+
5
+ Defined in: packages/fate/lib/index.d.mts:7
6
+
7
+ ## Type Parameters
8
+
9
+ ### S
10
+
11
+ `S`
12
+
13
+ ## Parameters
14
+
15
+ ### selection
16
+
17
+ `S`
18
+
19
+ ## Returns
20
+
21
+ `DeferredSelection`\<`S`\>
@@ -0,0 +1,39 @@
1
+ # Function: graphqlMutation()
2
+
3
+ > **graphqlMutation**\<`T`, `Input`, `Output`\>(`entity`, `options`): [`GraphQLMutationDefinition`](../type-aliases/GraphQLMutationDefinition.md)\<`T`, `Input`, `Output`\>
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:58
6
+
7
+ ## Type Parameters
8
+
9
+ ### T
10
+
11
+ `T` *extends* `Entity`
12
+
13
+ ### Input
14
+
15
+ `Input`
16
+
17
+ ### Output
18
+
19
+ `Output`
20
+
21
+ ## Parameters
22
+
23
+ ### entity
24
+
25
+ `T`\[`"__typename"`\]
26
+
27
+ ### options
28
+
29
+ #### field
30
+
31
+ `string`
32
+
33
+ #### inputArg?
34
+
35
+ `string` \| `false`
36
+
37
+ ## Returns
38
+
39
+ [`GraphQLMutationDefinition`](../type-aliases/GraphQLMutationDefinition.md)\<`T`, `Input`, `Output`\>
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **mutation**\<`T`, `I`, `R`\>(`entity`): `MutationDefinition`\<`T`, `I`, `R`\>
4
4
 
5
- Defined in: packages/fate/lib/types-Dz46PXr3.d.mts:980
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:950
6
6
 
7
7
  Defines a mutation for a given entity type, preserving the input and output
8
8
  types for transports.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **useFateClient**\<`T`\>(): `FateClient`\<`T`\[`0`\], `T`\[`1`\]\>
4
4
 
5
- Defined in: [packages/react-fate/src/context.tsx:30](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/context.tsx#L30)
5
+ Defined in: [packages/react-fate/src/context.tsx:30](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/context.tsx#L30)
6
6
 
7
7
  Returns the nearest `FateClient` from context.
8
8
 
@@ -1,8 +1,8 @@
1
1
  # Function: useListView()
2
2
 
3
- > **useListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`NonNullable`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
3
+ > **useListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
4
4
 
5
- Defined in: [packages/react-fate/src/useListView.tsx:16](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/useListView.tsx#L16)
5
+ Defined in: [packages/react-fate/src/useListView.tsx:19](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useListView.tsx#L19)
6
6
 
7
7
  Subscribes to a connection field, returning the current items and pagination
8
8
  helpers to load the next or previous page.
@@ -11,7 +11,7 @@ helpers to load the next or previous page.
11
11
 
12
12
  ### C
13
13
 
14
- `C` *extends* \{ `items?`: readonly `any`[]; `pagination?`: `Pagination`; \} \| `null` \| `undefined`
14
+ `C` *extends* `ConnectionValue` \| [`Deferred`](../type-aliases/Deferred.md)\<`ConnectionValue`\> \| `null` \| `undefined`
15
15
 
16
16
  ## Parameters
17
17
 
@@ -25,4 +25,4 @@ helpers to load the next or previous page.
25
25
 
26
26
  ## Returns
27
27
 
28
- \[`ConnectionItems`\<`NonNullable`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
28
+ \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
@@ -1,8 +1,8 @@
1
1
  # Function: useLiveListView()
2
2
 
3
- > **useLiveListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`NonNullable`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
3
+ > **useLiveListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
4
4
 
5
- Defined in: [packages/react-fate/src/useLiveListView.tsx:16](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/useLiveListView.tsx#L16)
5
+ Defined in: [packages/react-fate/src/useLiveListView.tsx:19](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useLiveListView.tsx#L19)
6
6
 
7
7
  Subscribes to a connection field, returning live-updating items and pagination
8
8
  helpers to load the next or previous page.
@@ -11,7 +11,7 @@ helpers to load the next or previous page.
11
11
 
12
12
  ### C
13
13
 
14
- `C` *extends* \{ `items?`: readonly `any`[]; `pagination?`: `Pagination`; \} \| `null` \| `undefined`
14
+ `C` *extends* `ConnectionValue` \| [`Deferred`](../type-aliases/Deferred.md)\<`ConnectionValue`\> \| `null` \| `undefined`
15
15
 
16
16
  ## Parameters
17
17
 
@@ -25,4 +25,4 @@ helpers to load the next or previous page.
25
25
 
26
26
  ## Returns
27
27
 
28
- \[`ConnectionItems`\<`NonNullable`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
28
+ \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
@@ -1,37 +1,78 @@
1
1
  # Function: useLiveView()
2
2
 
3
- > **useLiveView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: SelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
3
+ ## Call Signature
4
4
 
5
- Defined in: [packages/react-fate/src/useLiveView.tsx:17](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/useLiveView.tsx#L17)
5
+ > **useLiveView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
6
+
7
+ Defined in: [packages/react-fate/src/useLiveView.tsx:27](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useLiveView.tsx#L27)
6
8
 
7
9
  Resolves a reference against a view and subscribes to live server updates for
8
10
  that selection.
9
11
 
10
- ## Type Parameters
12
+ ### Type Parameters
11
13
 
12
- ### V
14
+ #### V
13
15
 
14
16
  `V` *extends* `View`\<`any`, `any`\>
15
17
 
16
- ### R
18
+ #### R
17
19
 
18
20
  `R` *extends* `Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| `null`
19
21
 
20
- ## Parameters
22
+ ### Parameters
23
+
24
+ #### view
25
+
26
+ `V`
27
+
28
+ #### ref
29
+
30
+ `R`
31
+
32
+ ### Returns
33
+
34
+ `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
35
+
36
+ ### Example
37
+
38
+ ```ts
39
+ const post = useLiveView(PostView, postRef);
40
+ ```
41
+
42
+ ## Call Signature
43
+
44
+ > **useLiveView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
45
+
46
+ Defined in: [packages/react-fate/src/useLiveView.tsx:31](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useLiveView.tsx#L31)
47
+
48
+ Resolves a reference against a view and subscribes to live server updates for
49
+ that selection.
50
+
51
+ ### Type Parameters
52
+
53
+ #### V
54
+
55
+ `V` *extends* `View`\<`any`, `any`\>
56
+
57
+ #### R
58
+
59
+ `R` *extends* [`Deferred`](../type-aliases/Deferred.md)\<`Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\>\> \| `null`
60
+
61
+ ### Parameters
21
62
 
22
- ### view
63
+ #### view
23
64
 
24
65
  `V`
25
66
 
26
- ### ref
67
+ #### ref
27
68
 
28
69
  `R`
29
70
 
30
- ## Returns
71
+ ### Returns
31
72
 
32
- `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: SelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
73
+ `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
33
74
 
34
- ## Example
75
+ ### Example
35
76
 
36
77
  ```ts
37
78
  const post = useLiveView(PostView, postRef);
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **useRequest**\<`R`, `O`\>(`request`, `options?`): `RequestResult`\<`O`, `R`\>
4
4
 
5
- Defined in: [packages/react-fate/src/useRequest.tsx:25](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/useRequest.tsx#L25)
5
+ Defined in: [packages/react-fate/src/useRequest.tsx:25](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useRequest.tsx#L25)
6
6
 
7
7
  Declares the data a screen needs and kicks off fetching, suspending while the
8
8
  request resolves.
@@ -1,36 +1,110 @@
1
1
  # Function: useView()
2
2
 
3
- > **useView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: SelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
3
+ ## Call Signature
4
4
 
5
- Defined in: [packages/react-fate/src/useView.tsx:37](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/react-fate/src/useView.tsx#L37)
5
+ > **useView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
6
+
7
+ Defined in: [packages/react-fate/src/useView.tsx:40](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useView.tsx#L40)
6
8
 
7
9
  Resolves a reference against a view and subscribes to updates for that selection.
8
10
 
9
- ## Type Parameters
11
+ ### Type Parameters
10
12
 
11
- ### V
13
+ #### V
12
14
 
13
15
  `V` *extends* `View`\<`any`, `any`\>
14
16
 
15
- ### R
17
+ #### R
16
18
 
17
19
  `R` *extends* `Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| `null`
18
20
 
19
- ## Parameters
21
+ ### Parameters
22
+
23
+ #### view
24
+
25
+ `V`
26
+
27
+ #### ref
28
+
29
+ `R`
30
+
31
+ ### Returns
32
+
33
+ `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
34
+
35
+ ### Example
36
+
37
+ ```ts
38
+ const post = useView(PostView, postRef);
39
+ ```
40
+
41
+ ## Call Signature
42
+
43
+ > **useView**\<`V`, `R`\>(`view`, `ref`): `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
44
+
45
+ Defined in: [packages/react-fate/src/useView.tsx:44](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useView.tsx#L44)
46
+
47
+ Resolves a reference against a view and subscribes to updates for that selection.
48
+
49
+ ### Type Parameters
50
+
51
+ #### V
52
+
53
+ `V` *extends* `View`\<`any`, `any`\>
54
+
55
+ #### R
20
56
 
21
- ### view
57
+ `R` *extends* [`Deferred`](../type-aliases/Deferred.md)\<`Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\>\> \| `null`
58
+
59
+ ### Parameters
60
+
61
+ #### view
22
62
 
23
63
  `V`
24
64
 
25
- ### ref
65
+ #### ref
26
66
 
27
67
  `R`
28
68
 
29
- ## Returns
69
+ ### Returns
70
+
71
+ `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
72
+
73
+ ### Example
74
+
75
+ ```ts
76
+ const post = useView(PostView, postRef);
77
+ ```
78
+
79
+ ## Call Signature
80
+
81
+ > **useView**\<`V`\>(`view`, `ref`): `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\> \| `null`
82
+
83
+ Defined in: [packages/react-fate/src/useView.tsx:48](https://github.com/nkzw-tech/fate/blob/92f28ac4263e4f242ab8546c3bc2123a24b18461/packages/react-fate/src/useView.tsx#L48)
84
+
85
+ Resolves a reference against a view and subscribes to updates for that selection.
86
+
87
+ ### Type Parameters
88
+
89
+ #### V
90
+
91
+ `V` *extends* `View`\<`any`, `any`\>
92
+
93
+ ### Parameters
94
+
95
+ #### view
96
+
97
+ `V`
98
+
99
+ #### ref
100
+
101
+ `Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| [`Deferred`](../type-aliases/Deferred.md)\<`Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\>\> \| `null`
102
+
103
+ ### Returns
30
104
 
31
- `R` *extends* `null` ? `null` : `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: SelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\>
105
+ `Readonly`\<`ViewSelection`\<`V`\> *extends* `Selection`\<`ViewEntityWithTypename`\<`V`\>\> ? `Mask`\<`ViewEntityWithTypename`\<`V`\>, \{ \[K in string \| number \| symbol as K extends "\_\_typename" ? never : K\]?: DeferrableSelectionFieldValue\<ViewEntityWithTypename\<V\>, K\> \} & `object` & `SelectionViewSpread`\<`ViewEntityWithTypename`\<`V`\>\> & `ViewSelection`\<`V`\>\> : `ViewEntityWithTypename`\<`V`\> & `object`\> \| `null`
32
106
 
33
- ## Example
107
+ ### Example
34
108
 
35
109
  ```ts
36
110
  const post = useView(PostView, postRef);
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **view**\<`T`\>(): \<`S`\>(`select`) => `View`\<`T`, `S`\>
4
4
 
5
- Defined in: packages/fate/lib/index.d.mts:88
5
+ Defined in: packages/fate/lib/index.d.mts:94
6
6
 
7
7
  Creates a reusable view for an object using the declared selection.
8
8
 
package/docs/api/index.md CHANGED
@@ -11,7 +11,17 @@ import { useView, view } from 'react-fate';
11
11
  ## Type Aliases
12
12
 
13
13
  - [ConnectionRef](type-aliases/ConnectionRef.md)
14
+ - [Deferred](type-aliases/Deferred.md)
15
+ - [FateDehydratedState](type-aliases/FateDehydratedState.md)
16
+ - [GraphQLMutationDefinition](type-aliases/GraphQLMutationDefinition.md)
17
+ - [GraphQLMutationInput](type-aliases/GraphQLMutationInput.md)
18
+ - [GraphQLMutationMap](type-aliases/GraphQLMutationMap.md)
19
+ - [GraphQLMutationOutput](type-aliases/GraphQLMutationOutput.md)
20
+ - [GraphQLTransportOptions](type-aliases/GraphQLTransportOptions.md)
21
+ - [HydrateOptions](type-aliases/HydrateOptions.md)
22
+ - [HydrationLimits](type-aliases/HydrationLimits.md)
14
23
  - [InferFateAPI](type-aliases/InferFateAPI.md)
24
+ - [Pagination](type-aliases/Pagination.md)
15
25
  - [ViewRef](type-aliases/ViewRef.md)
16
26
 
17
27
  ## Variables
@@ -22,9 +32,12 @@ import { useView, view } from 'react-fate';
22
32
 
23
33
  - [clientRoot](functions/clientRoot.md)
24
34
  - [createClient](functions/createClient.md)
35
+ - [createGraphQLTransport](functions/createGraphQLTransport.md)
25
36
  - [createHTTPTransport](functions/createHTTPTransport.md)
26
37
  - [createTRPCTransport](functions/createTRPCTransport.md)
38
+ - [defer](functions/defer.md)
27
39
  - [FateClient](functions/FateClient.md)
40
+ - [graphqlMutation](functions/graphqlMutation.md)
28
41
  - [mutation](functions/mutation.md)
29
42
  - [useFateClient](functions/useFateClient.md)
30
43
  - [useListView](functions/useListView.md)
@@ -1,8 +1,8 @@
1
1
  # Type Alias: ConnectionRef\<TName\>
2
2
 
3
- > **ConnectionRef**\<`TName`\> = `Readonly`\<\{ `items`: `ReadonlyArray`\<\{ `cursor?`: `string`; `node`: [`ViewRef`](ViewRef.md)\<`TName`\>; \}\>; `pagination?`: `Pagination`; \}\>
3
+ > **ConnectionRef**\<`TName`\> = `Readonly`\<\{ `items`: `ReadonlyArray`\<\{ `cursor?`: `string`; `node`: [`ViewRef`](ViewRef.md)\<`TName`\>; \}\>; `pagination?`: [`Pagination`](Pagination.md); \}\>
4
4
 
5
- Defined in: packages/fate/lib/types-Dz46PXr3.d.mts:1132
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:1107
6
6
 
7
7
  Ref for a connection, including pagination metadata.
8
8
 
@@ -0,0 +1,19 @@
1
+ # Type Alias: Deferred\<T\>
2
+
3
+ > **Deferred**\<`T`\> = `Readonly`\<\{ `[DeferredTag]`: `DeferredMetadata`; \}\> & `object`
4
+
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:1127
6
+
7
+ A deferred value returned from a masked view. Existing view hooks resolve it when read.
8
+
9
+ ## Type Declaration
10
+
11
+ ### \[\_\_\_FateDeferredBrand\]
12
+
13
+ > `readonly` **\[\_\_\_FateDeferredBrand\]**: `T`
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T`
@@ -0,0 +1,11 @@
1
+ # Type Alias: FateDehydratedState\<Scope\>
2
+
3
+ > **FateDehydratedState**\<`Scope`\> = `Readonly`\<\{ `[hydrationScopeBrand]?`: `Scope`; `data`: `FateSerializedValue`; `scope`: `Scope`; `version`: `1`; \}\>
4
+
5
+ Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:685
6
+
7
+ ## Type Parameters
8
+
9
+ ### Scope
10
+
11
+ `Scope` *extends* `string` = `string`
@@ -0,0 +1,19 @@
1
+ # Type Alias: GraphQLMutationDefinition\<T, Input, Output\>
2
+
3
+ > **GraphQLMutationDefinition**\<`T`, `Input`, `Output`\> = `Readonly`\<\{ `__fateGraphQLMutation?`: \{ `input`: `Input`; `output`: `Output`; \}; `entity`: `T`\[`"__typename"`\]; `field`: `string`; `inputArg?`: `false` \| `string`; \}\>
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:20
6
+
7
+ ## Type Parameters
8
+
9
+ ### T
10
+
11
+ `T` *extends* `Entity` = `Entity`
12
+
13
+ ### Input
14
+
15
+ `Input` = `unknown`
16
+
17
+ ### Output
18
+
19
+ `Output` = `unknown`
@@ -0,0 +1,11 @@
1
+ # Type Alias: GraphQLMutationInput\<Definition\>
2
+
3
+ > **GraphQLMutationInput**\<`Definition`\> = `Definition` *extends* [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\<`any`, infer Input, `any`\> ? `Input` : `never`
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:29
6
+
7
+ ## Type Parameters
8
+
9
+ ### Definition
10
+
11
+ `Definition`
@@ -0,0 +1,11 @@
1
+ # Type Alias: GraphQLMutationMap\<Mutations\>
2
+
3
+ > **GraphQLMutationMap**\<`Mutations`\> = `Mutations` *extends* `Record`\<`string`, [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\> ? `{ [K in keyof Mutations]: { input: GraphQLMutationInput<Mutations[K]>; output: GraphQLMutationOutput<Mutations[K]> } }` : `EmptyTransportMutations`
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:31
6
+
7
+ ## Type Parameters
8
+
9
+ ### Mutations
10
+
11
+ `Mutations`
@@ -0,0 +1,11 @@
1
+ # Type Alias: GraphQLMutationOutput\<Definition\>
2
+
3
+ > **GraphQLMutationOutput**\<`Definition`\> = `Definition` *extends* [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\<`any`, `any`, infer Output\> ? `Output` : `never`
4
+
5
+ Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:30
6
+
7
+ ## Type Parameters
8
+
9
+ ### Definition
10
+
11
+ `Definition`