react-fate 1.1.0 → 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.
- package/README.md +745 -24
- package/docs/api/functions/FateClient.md +1 -1
- package/docs/api/functions/clientRoot.md +1 -1
- package/docs/api/functions/createClient.md +1 -1
- package/docs/api/functions/createGraphQLTransport.md +1 -1
- package/docs/api/functions/createHTTPTransport.md +1 -1
- package/docs/api/functions/createTRPCTransport.md +1 -1
- package/docs/api/functions/defer.md +21 -0
- package/docs/api/functions/graphqlMutation.md +1 -1
- package/docs/api/functions/mutation.md +1 -1
- package/docs/api/functions/useFateClient.md +1 -1
- package/docs/api/functions/useListView.md +4 -4
- package/docs/api/functions/useLiveListView.md +4 -4
- package/docs/api/functions/useLiveView.md +52 -11
- package/docs/api/functions/useRequest.md +1 -1
- package/docs/api/functions/useView.md +85 -11
- package/docs/api/functions/view.md +1 -1
- package/docs/api/index.md +2 -0
- package/docs/api/type-aliases/ConnectionRef.md +1 -1
- package/docs/api/type-aliases/Deferred.md +19 -0
- package/docs/api/type-aliases/FateDehydratedState.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationDefinition.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationInput.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationMap.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationOutput.md +1 -1
- package/docs/api/type-aliases/GraphQLTransportOptions.md +11 -11
- package/docs/api/type-aliases/HydrateOptions.md +1 -1
- package/docs/api/type-aliases/HydrationLimits.md +1 -1
- package/docs/api/type-aliases/InferFateAPI.md +1 -1
- package/docs/api/type-aliases/Pagination.md +5 -5
- package/docs/api/type-aliases/ViewRef.md +1 -1
- package/docs/api/variables/toEntityId.md +1 -1
- package/docs/guide/actions.md +7 -7
- package/docs/guide/deferred-views.md +62 -0
- package/docs/guide/getting-started.md +21 -3
- package/docs/guide/vue.md +256 -0
- package/docs/index.md +1 -0
- package/docs/{guide/graphql-integration.md → integrations/graphql.md} +53 -6
- package/docs/{guide/server-integration.md → integrations/server.md} +93 -7
- package/docs/{guide/void-integration.md → integrations/void.md} +94 -12
- package/lib/index.d.mts +17 -10
- package/lib/index.mjs +110 -16
- package/package.json +2 -2
|
@@ -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/
|
|
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
|
> **createTRPCTransport**\<`AppRouter`, `Mutations`\>(`__namedParameters`): `Transport`\<`MutationMapFromResolvers`\<`Mutations`\>\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/transport-
|
|
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`\>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **graphqlMutation**\<`T`, `Input`, `Output`\>(`entity`, `options`): [`GraphQLMutationDefinition`](../type-aliases/GraphQLMutationDefinition.md)\<`T`, `Input`, `Output`\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:58
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -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/transport-
|
|
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/
|
|
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`\<`
|
|
3
|
+
> **useListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/react-fate/src/useListView.tsx:
|
|
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*
|
|
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`\<`
|
|
28
|
+
\[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Function: useLiveListView()
|
|
2
2
|
|
|
3
|
-
> **useLiveListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`
|
|
3
|
+
> **useLiveListView**\<`C`\>(`selection`, `connection`): \[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/react-fate/src/useLiveListView.tsx:
|
|
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*
|
|
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`\<`
|
|
28
|
+
\[`ConnectionItems`\<`ResolvedConnection`\<`C`\>\>, `LoadMoreFn` \| `null`, `LoadMoreFn` \| `null`\]
|
|
@@ -1,37 +1,78 @@
|
|
|
1
1
|
# Function: useLiveView()
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Call Signature
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
12
|
+
### Type Parameters
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
#### V
|
|
13
15
|
|
|
14
16
|
`V` *extends* `View`\<`any`, `any`\>
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
#### R
|
|
17
19
|
|
|
18
20
|
`R` *extends* `Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| `null`
|
|
19
21
|
|
|
20
|
-
|
|
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
|
-
|
|
63
|
+
#### view
|
|
23
64
|
|
|
24
65
|
`V`
|
|
25
66
|
|
|
26
|
-
|
|
67
|
+
#### ref
|
|
27
68
|
|
|
28
69
|
`R`
|
|
29
70
|
|
|
30
|
-
|
|
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\]?:
|
|
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
|
-
|
|
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/
|
|
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
|
-
|
|
3
|
+
## Call Signature
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
11
|
+
### Type Parameters
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
#### V
|
|
12
14
|
|
|
13
15
|
`V` *extends* `View`\<`any`, `any`\>
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
#### R
|
|
16
18
|
|
|
17
19
|
`R` *extends* `Readonly`\<\{ `__typename`: `ViewEntityName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| `null`
|
|
18
20
|
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65
|
+
#### ref
|
|
26
66
|
|
|
27
67
|
`R`
|
|
28
68
|
|
|
29
|
-
|
|
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
|
-
`
|
|
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
|
-
|
|
107
|
+
### Example
|
|
34
108
|
|
|
35
109
|
```ts
|
|
36
110
|
const post = useView(PostView, postRef);
|
package/docs/api/index.md
CHANGED
|
@@ -11,6 +11,7 @@ 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)
|
|
14
15
|
- [FateDehydratedState](type-aliases/FateDehydratedState.md)
|
|
15
16
|
- [GraphQLMutationDefinition](type-aliases/GraphQLMutationDefinition.md)
|
|
16
17
|
- [GraphQLMutationInput](type-aliases/GraphQLMutationInput.md)
|
|
@@ -34,6 +35,7 @@ import { useView, view } from 'react-fate';
|
|
|
34
35
|
- [createGraphQLTransport](functions/createGraphQLTransport.md)
|
|
35
36
|
- [createHTTPTransport](functions/createHTTPTransport.md)
|
|
36
37
|
- [createTRPCTransport](functions/createTRPCTransport.md)
|
|
38
|
+
- [defer](functions/defer.md)
|
|
37
39
|
- [FateClient](functions/FateClient.md)
|
|
38
40
|
- [graphqlMutation](functions/graphqlMutation.md)
|
|
39
41
|
- [mutation](functions/mutation.md)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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/transport-
|
|
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`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateDehydratedState**\<`Scope`\> = `Readonly`\<\{ `[hydrationScopeBrand]?`: `Scope`; `data`: `FateSerializedValue`; `scope`: `Scope`; `version`: `1`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/transport-
|
|
5
|
+
Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:685
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **GraphQLMutationDefinition**\<`T`, `Input`, `Output`\> = `Readonly`\<\{ `__fateGraphQLMutation?`: \{ `input`: `Input`; `output`: `Output`; \}; `entity`: `T`\[`"__typename"`\]; `field`: `string`; `inputArg?`: `false` \| `string`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:20
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **GraphQLMutationInput**\<`Definition`\> = `Definition` *extends* [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\<`any`, infer Input, `any`\> ? `Input` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:29
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **GraphQLMutationMap**\<`Mutations`\> = `Mutations` *extends* `Record`\<`string`, [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\> ? `{ [K in keyof Mutations]: { input: GraphQLMutationInput<Mutations[K]>; output: GraphQLMutationOutput<Mutations[K]> } }` : `EmptyTransportMutations`
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:31
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **GraphQLMutationOutput**\<`Definition`\> = `Definition` *extends* [`GraphQLMutationDefinition`](GraphQLMutationDefinition.md)\<`any`, `any`, infer Output\> ? `Output` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:30
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **GraphQLTransportOptions**\<`Mutations`\> = `object`
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
5
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:46
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:46
|
|
|
16
16
|
|
|
17
17
|
> `optional` **decodeNodeId?**: (`type`, `id`) => `string` \| `number`
|
|
18
18
|
|
|
19
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
19
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:47
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
@@ -38,7 +38,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:47
|
|
|
38
38
|
|
|
39
39
|
> `optional` **encodeNodeId?**: (`type`, `id`) => `string` \| `number`
|
|
40
40
|
|
|
41
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
41
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:48
|
|
42
42
|
|
|
43
43
|
#### Parameters
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:48
|
|
|
60
60
|
|
|
61
61
|
> `optional` **eventSource?**: `EventSourceConstructor`
|
|
62
62
|
|
|
63
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
63
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:49
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
@@ -68,7 +68,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:49
|
|
|
68
68
|
|
|
69
69
|
> `optional` **fetch?**: `FetchLike`
|
|
70
70
|
|
|
71
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
71
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:50
|
|
72
72
|
|
|
73
73
|
***
|
|
74
74
|
|
|
@@ -76,7 +76,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:50
|
|
|
76
76
|
|
|
77
77
|
> `optional` **headers?**: `HeadersFactory`
|
|
78
78
|
|
|
79
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
79
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:51
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
@@ -84,7 +84,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:51
|
|
|
84
84
|
|
|
85
85
|
> `optional` **live?**: `boolean` \| `GraphQLLiveOptions`
|
|
86
86
|
|
|
87
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
87
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:52
|
|
88
88
|
|
|
89
89
|
***
|
|
90
90
|
|
|
@@ -92,7 +92,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:52
|
|
|
92
92
|
|
|
93
93
|
> `optional` **mutations?**: `Record`\<`Extract`\<keyof `Mutations`, `string`\>, `GraphQLMutationRuntimeConfig`\>
|
|
94
94
|
|
|
95
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
95
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:53
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:53
|
|
|
100
100
|
|
|
101
101
|
> `optional` **roots?**: `Record`\<`string`, `GraphQLRootConfig`\>
|
|
102
102
|
|
|
103
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
103
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:54
|
|
104
104
|
|
|
105
105
|
***
|
|
106
106
|
|
|
@@ -108,7 +108,7 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:54
|
|
|
108
108
|
|
|
109
109
|
> **types**: `ReadonlyArray`\<`Omit`\<`TypeConfig`, `"getId"`\> & `Partial`\<`Pick`\<`TypeConfig`, `"getId"`\>\>\>
|
|
110
110
|
|
|
111
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
111
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:55
|
|
112
112
|
|
|
113
113
|
***
|
|
114
114
|
|
|
@@ -116,4 +116,4 @@ Defined in: packages/fate/lib/graphqlTransport-DbRHbYtb.d.mts:55
|
|
|
116
116
|
|
|
117
117
|
> **url**: `string` \| `URL`
|
|
118
118
|
|
|
119
|
-
Defined in: packages/fate/lib/graphqlTransport-
|
|
119
|
+
Defined in: packages/fate/lib/graphqlTransport-B3cbhvJX.d.mts:56
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **HydrateOptions** = `Readonly`\<\{ `merge?`: `"preserve-existing"` \| `"replace"`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/transport-
|
|
5
|
+
Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:692
|
|
6
6
|
|
|
7
7
|
Controls how `FateClient.hydrate()` reconciles a snapshot with browser cache state.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **HydrationLimits** = `Readonly`\<\{ `maxCollectionLength`: `number`; `maxNodes`: `number`; `maxStringLength`: `number`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: packages/fate/lib/transport-
|
|
5
|
+
Defined in: packages/fate/lib/transport-BjGm\_\_3t.d.mts:702
|
|
6
6
|
|
|
7
7
|
Resource limits applied while encoding and decoding hydration snapshots.
|