@nkzw/fate 1.3.0 → 1.3.2
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 +179 -1
- package/docs/api/classes/FateClient.md +40 -40
- 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 +1 -1
- package/docs/api/functions/getDeferredMetadata.md +1 -1
- package/docs/api/functions/getListEntries.md +1 -1
- package/docs/api/functions/getSelectionPlan.md +1 -1
- package/docs/api/functions/graphqlMutation.md +1 -1
- package/docs/api/functions/isDeferred.md +1 -1
- package/docs/api/functions/isRecord.md +1 -1
- package/docs/api/functions/isViewTag.md +1 -1
- package/docs/api/functions/liveConnectionTopic.md +1 -1
- package/docs/api/functions/liveEntityTopic.md +1 -1
- package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
- package/docs/api/functions/mutation.md +1 -1
- package/docs/api/functions/toEntityId.md +1 -1
- package/docs/api/functions/view.md +1 -1
- package/docs/api/interfaces/FateThenable.md +3 -3
- package/docs/api/interfaces/Transport.md +7 -7
- package/docs/api/server/classes/FateRequestError.md +5 -5
- package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
- package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
- package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
- package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
- package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
- package/docs/api/server/functions/bindSourceProcedures.md +1 -1
- package/docs/api/server/functions/computed.md +1 -1
- package/docs/api/server/functions/count.md +1 -1
- package/docs/api/server/functions/createFateFetchHandler.md +1 -1
- package/docs/api/server/functions/createFateServer.md +1 -1
- package/docs/api/server/functions/createHonoFateHandler.md +1 -1
- package/docs/api/server/functions/createLiveEventBus.md +1 -1
- package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
- package/docs/api/server/functions/createResolver.md +1 -1
- package/docs/api/server/functions/createSourcePlan.md +1 -1
- package/docs/api/server/functions/createSourceProcedures.md +1 -1
- package/docs/api/server/functions/dataView.md +1 -1
- package/docs/api/server/functions/field.md +1 -1
- package/docs/api/server/functions/getNestedSelection.md +1 -1
- package/docs/api/server/functions/getScopedArgs.md +1 -1
- package/docs/api/server/functions/hasNestedSelection.md +1 -1
- package/docs/api/server/functions/list.md +1 -1
- package/docs/api/server/functions/refetchSourceById.md +1 -1
- package/docs/api/server/functions/resolveSourceById.md +1 -1
- package/docs/api/server/functions/resolveSourceByIds.md +1 -1
- package/docs/api/server/functions/resolveSourceConnection.md +1 -1
- package/docs/api/server/functions/resolver.md +1 -1
- package/docs/api/server/functions/toPrismaSelect.md +1 -1
- package/docs/api/server/functions/withConnection.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
- package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
- package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
- package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
- package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
- package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
- package/docs/api/server/type-aliases/ComputedField.md +5 -5
- package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
- package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
- package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
- package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
- package/docs/api/server/type-aliases/CountSelection.md +4 -4
- package/docs/api/server/type-aliases/CountWhere.md +1 -1
- package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
- package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
- package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
- package/docs/api/server/type-aliases/DataViewResult.md +1 -1
- package/docs/api/server/type-aliases/Entity.md +1 -1
- package/docs/api/server/type-aliases/FateServer.md +5 -5
- package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
- package/docs/api/server/type-aliases/FieldSelection.md +3 -3
- package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
- package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
- package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
- package/docs/api/server/type-aliases/LiveEventType.md +1 -1
- package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
- package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
- package/docs/api/server/type-aliases/OrderDirection.md +1 -1
- package/docs/api/server/type-aliases/SourceConfig.md +6 -6
- package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
- package/docs/api/server/type-aliases/SourceOrder.md +1 -1
- package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
- package/docs/api/server/type-aliases/SourcePlan.md +1 -1
- package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
- package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
- package/docs/api/server/type-aliases/SourceRelation.md +1 -1
- package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
- package/docs/api/server/variables/byIdInput.md +1 -1
- package/docs/api/server/variables/connectionArgs.md +1 -1
- package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
- package/docs/api/type-aliases/ConnectionRef.md +1 -1
- package/docs/api/type-aliases/Deferred.md +1 -1
- package/docs/api/type-aliases/DeferredMetadata.md +1 -1
- package/docs/api/type-aliases/DeferredSelection.md +1 -1
- package/docs/api/type-aliases/DeferredSnapshot.md +1 -1
- package/docs/api/type-aliases/Entity.md +2 -2
- package/docs/api/type-aliases/EntityId.md +1 -1
- package/docs/api/type-aliases/FateDehydratedState.md +1 -1
- package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
- package/docs/api/type-aliases/FateLiveEvent.md +1 -1
- package/docs/api/type-aliases/FateMutations.md +1 -1
- package/docs/api/type-aliases/FateOperation.md +1 -1
- package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
- package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
- package/docs/api/type-aliases/FateRecord.md +1 -1
- package/docs/api/type-aliases/FateRoots.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/List.md +1 -1
- package/docs/api/type-aliases/ListEntry.md +1 -1
- package/docs/api/type-aliases/ListItem.md +1 -1
- package/docs/api/type-aliases/Mask.md +1 -1
- package/docs/api/type-aliases/MutationDefinition.md +1 -1
- package/docs/api/type-aliases/MutationEntity.md +1 -1
- package/docs/api/type-aliases/MutationIdentifier.md +1 -1
- package/docs/api/type-aliases/MutationInput.md +1 -1
- package/docs/api/type-aliases/MutationResult.md +1 -1
- package/docs/api/type-aliases/NodesItem.md +1 -1
- package/docs/api/type-aliases/Pagination.md +5 -5
- package/docs/api/type-aliases/Request.md +1 -1
- package/docs/api/type-aliases/RequestMode.md +1 -1
- package/docs/api/type-aliases/RequestOptions.md +1 -1
- package/docs/api/type-aliases/RequestResult.md +1 -1
- package/docs/api/type-aliases/Selection.md +1 -1
- package/docs/api/type-aliases/Snapshot.md +1 -1
- package/docs/api/type-aliases/TypeConfig.md +4 -4
- package/docs/api/type-aliases/View.md +1 -1
- package/docs/api/type-aliases/ViewData.md +1 -1
- package/docs/api/type-aliases/ViewEntity.md +1 -1
- package/docs/api/type-aliases/ViewEntityName.md +1 -1
- package/docs/api/type-aliases/ViewRef.md +1 -1
- package/docs/api/type-aliases/ViewSelection.md +1 -1
- package/docs/api/type-aliases/ViewSnapshot.md +1 -1
- package/docs/api/type-aliases/ViewTag.md +1 -1
- package/docs/api/variables/ConnectionTag.md +1 -1
- package/docs/api/variables/DeferTag.md +1 -1
- package/docs/api/variables/DeferredTag.md +1 -1
- package/docs/integrations/cloudflare.md +19 -1
- package/docs/integrations/void.md +17 -1
- package/lib/{executor-Dh-MLUXc.d.mts → executor-C8HNogYG.d.mts} +1 -1
- package/lib/{graphqlTransport-IFgmY-Qq.mjs → graphqlTransport-DSBVS2Fq.mjs} +20 -15
- package/lib/{graphqlTransport-B3cbhvJX.d.mts → graphqlTransport-DskuXeUP.d.mts} +1 -1
- package/lib/graphqlTransport.d.mts +1 -1
- package/lib/graphqlTransport.mjs +1 -1
- package/lib/index.d.mts +4 -4
- package/lib/index.mjs +36 -25
- package/lib/{list-BrL6PD_6.d.mts → list-sI2UPhHc.d.mts} +1 -1
- package/lib/list.d.mts +1 -1
- package/lib/{liveTopics-JIDh3t3P.mjs → liveTopics-uVP0LG-Q.mjs} +1 -1
- package/lib/{record-BkvZwvFk.d.mts → record-CZyyeLa3.d.mts} +2 -2
- package/lib/server/drizzle.d.mts +2 -2
- package/lib/server/drizzle.mjs +43 -31
- package/lib/server/prisma.d.mts +2 -2
- package/lib/server/prisma.mjs +10 -8
- package/lib/server.d.mts +3 -3
- package/lib/server.mjs +23 -20
- package/lib/{sourceRouter-N9Vp0Cj6.mjs → sourceRouter-DSaADXSf.mjs} +8 -4
- package/lib/{transport-BjGm__3t.d.mts → transport-DhaVVq4P.d.mts} +3 -2
- package/lib/vite.mjs +6 -5
- package/package.json +4 -4
|
@@ -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:478](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:478](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:481](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:481](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:366](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:366](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:131](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:131](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:132](https://github.com/nkzw-tech/fate/blob/
|
|
15
|
+
Defined in: [packages/fate/src/types.ts:132](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L132)
|
|
16
16
|
|
|
17
17
|
***
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ Defined in: [packages/fate/src/types.ts:132](https://github.com/nkzw-tech/fate/b
|
|
|
20
20
|
|
|
21
21
|
> **hasPrevious**: `boolean`
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/fate/src/types.ts:133](https://github.com/nkzw-tech/fate/blob/
|
|
23
|
+
Defined in: [packages/fate/src/types.ts:133](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L133)
|
|
24
24
|
|
|
25
25
|
***
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ Defined in: [packages/fate/src/types.ts:133](https://github.com/nkzw-tech/fate/b
|
|
|
28
28
|
|
|
29
29
|
> `optional` **nextCursor?**: `string`
|
|
30
30
|
|
|
31
|
-
Defined in: [packages/fate/src/types.ts:134](https://github.com/nkzw-tech/fate/blob/
|
|
31
|
+
Defined in: [packages/fate/src/types.ts:134](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L134)
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
@@ -36,4 +36,4 @@ Defined in: [packages/fate/src/types.ts:134](https://github.com/nkzw-tech/fate/b
|
|
|
36
36
|
|
|
37
37
|
> `optional` **previousCursor?**: `string`
|
|
38
38
|
|
|
39
|
-
Defined in: [packages/fate/src/types.ts:135](https://github.com/nkzw-tech/fate/blob/
|
|
39
|
+
Defined in: [packages/fate/src/types.ts:135](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:378](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:378](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:89](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/client.ts:89](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:100](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/client.ts:100](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:424](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:424](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:229](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:229](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:513](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:513](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:124](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:124](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:125](https://github.com/nkzw-tech/fate/blob/
|
|
15
|
+
Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L125)
|
|
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
|
> **getId**: (`record`) => `string` \| `number`
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/blob/
|
|
23
|
+
Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L126)
|
|
24
24
|
|
|
25
25
|
#### Parameters
|
|
26
26
|
|
|
@@ -38,4 +38,4 @@ Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/b
|
|
|
38
38
|
|
|
39
39
|
> **type**: `string`
|
|
40
40
|
|
|
41
|
-
Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/
|
|
41
|
+
Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:245](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:245](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:261](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:261](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:335](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:335](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:338](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:338](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:108](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:108](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:341](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:341](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:271](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:271](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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:56](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:56](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/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/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:20](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L20)
|
|
6
6
|
|
|
7
7
|
Symbol attached to connection results so pagination helpers can find their metadata.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> `const` **DeferTag**: *typeof* `DeferTag`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:23](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:23](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L23)
|
|
6
6
|
|
|
7
7
|
Symbol used to mark a selection as deferred.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> `const` **DeferredTag**: *typeof* `DeferredTag`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:26](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:26](https://github.com/nkzw-tech/fate/blob/bdff68417591ff0372c03c214bbc7c722cdf13a2/packages/fate/src/types.ts#L26)
|
|
6
6
|
|
|
7
7
|
Symbol attached to deferred values returned from masked views.
|
|
@@ -4,13 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
Use it when your backend runs directly on Cloudflare Workers and you want fate live views without adopting the Void platform.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## New Project
|
|
8
|
+
|
|
9
|
+
For a new Cloudflare Workers app, start from the Cloudflare template. It includes the client, Worker server, D1 migrations, Wrangler config, Durable Object live transport, auth wiring, and generated fate client setup.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
vp create fate my-app --template cloudflare
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use Vue instead of React with:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
vp create fate my-app --template cloudflare --framework vue
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Existing Project
|
|
22
|
+
|
|
23
|
+
For an existing Cloudflare Workers project, add the packages directly:
|
|
8
24
|
|
|
9
25
|
```sh
|
|
10
26
|
pnpm add @nkzw/fate react-fate cf-fate drizzle-orm
|
|
11
27
|
pnpm add -D wrangler
|
|
12
28
|
```
|
|
13
29
|
|
|
30
|
+
For Vue clients, replace `react-fate` with `vue-fate`.
|
|
31
|
+
|
|
14
32
|
## Server Setup
|
|
15
33
|
|
|
16
34
|
Create a Cloudflare live stream and pass its Fate live facade to `createFateServer`.
|
|
@@ -5,7 +5,23 @@
|
|
|
5
5
|
Use this integration when your app runs on Void and you want the example app's
|
|
6
6
|
setup without copying its adapter glue.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## New Project
|
|
9
|
+
|
|
10
|
+
For a new Void app, start from the Void template. It includes the client, Void routes, Drizzle setup, live transport, auth wiring, and generated fate client setup.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
vp create fate my-app --template void
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use Vue instead of React with:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
vp create fate my-app --template void --framework vue
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Existing Project
|
|
23
|
+
|
|
24
|
+
For an existing Void project, add the packages directly:
|
|
9
25
|
|
|
10
26
|
::: code-group
|
|
11
27
|
|
|
@@ -82,10 +82,11 @@ const getTypeConfig = (types, type) => {
|
|
|
82
82
|
const rootArgsToGraphQL = ({ args, type, types }) => {
|
|
83
83
|
if (!args) return "";
|
|
84
84
|
const fields = getTypeConfig(types, type).fields ?? {};
|
|
85
|
-
|
|
85
|
+
const rootArgs = Object.fromEntries(Object.entries(args).filter(([key]) => {
|
|
86
86
|
const descriptor = fields[key];
|
|
87
87
|
return !(descriptor && typeof descriptor === "object" && ("listOf" in descriptor || "type" in descriptor));
|
|
88
|
-
}))
|
|
88
|
+
}));
|
|
89
|
+
return argsToGraphQL(rootArgs);
|
|
89
90
|
};
|
|
90
91
|
const buildSelectionTree = (select) => {
|
|
91
92
|
const root = /* @__PURE__ */ new Map();
|
|
@@ -107,7 +108,7 @@ const buildRecordSelection = ({ args, path, select, type, types }) => {
|
|
|
107
108
|
const tree = buildSelectionTree(select);
|
|
108
109
|
const walk = (currentType, currentTree, currentPath) => {
|
|
109
110
|
const config = getTypeConfig(types, currentType);
|
|
110
|
-
const fields = new Set([
|
|
111
|
+
const fields = /* @__PURE__ */ new Set([
|
|
111
112
|
...currentTree.keys(),
|
|
112
113
|
"id",
|
|
113
114
|
"__typename"
|
|
@@ -321,13 +322,14 @@ function createGraphQLTransport({ decodeNodeId = defaultDecodeNodeId, encodeNode
|
|
|
321
322
|
type: root.type,
|
|
322
323
|
types
|
|
323
324
|
});
|
|
325
|
+
const rootArgs = rootArgsToGraphQL({
|
|
326
|
+
args,
|
|
327
|
+
type: root.type,
|
|
328
|
+
types
|
|
329
|
+
});
|
|
324
330
|
return enqueue({
|
|
325
331
|
kind: "query",
|
|
326
|
-
selection: `${field}${
|
|
327
|
-
args,
|
|
328
|
-
type: root.type,
|
|
329
|
-
types
|
|
330
|
-
})} { edges { cursor node { ${selection} } } pageInfo { endCursor hasNextPage hasPreviousPage startCursor } }`,
|
|
332
|
+
selection: `${field}${rootArgs} { edges { cursor node { ${selection} } } pageInfo { endCursor hasNextPage hasPreviousPage startCursor } }`,
|
|
331
333
|
transform: (value) => normalizeGraphQLValue({
|
|
332
334
|
decodeNodeId,
|
|
333
335
|
type: root.type,
|
|
@@ -347,13 +349,14 @@ function createGraphQLTransport({ decodeNodeId = defaultDecodeNodeId, encodeNode
|
|
|
347
349
|
type: root.type,
|
|
348
350
|
types
|
|
349
351
|
});
|
|
352
|
+
const rootArgs = rootArgsToGraphQL({
|
|
353
|
+
args,
|
|
354
|
+
type: root.type,
|
|
355
|
+
types
|
|
356
|
+
});
|
|
350
357
|
return enqueue({
|
|
351
358
|
kind: "query",
|
|
352
|
-
selection: `${field}${
|
|
353
|
-
args,
|
|
354
|
-
type: root.type,
|
|
355
|
-
types
|
|
356
|
-
})} { ${selection} }`,
|
|
359
|
+
selection: `${field}${rootArgs} { ${selection} }`,
|
|
357
360
|
transform: (value) => normalizeGraphQLValue({
|
|
358
361
|
decodeNodeId,
|
|
359
362
|
type: root.type,
|
|
@@ -424,7 +427,8 @@ function createGraphQLTransport({ decodeNodeId = defaultDecodeNodeId, encodeNode
|
|
|
424
427
|
};
|
|
425
428
|
transport.subscribeById = (type, id, select, args, handlers) => {
|
|
426
429
|
const field = assertIdentifier(liveOptions.entityField ?? "fateLiveNode", "subscription");
|
|
427
|
-
|
|
430
|
+
const query = `subscription FateLiveNode { ${field}(type: ${graphQLLiteral(type)}, id: ${graphQLLiteral(encodeNodeId(type, id))}, select: ${graphQLLiteral([...select])}, args: ${graphQLLiteral(args ?? null)}) { data delete id select } }`;
|
|
431
|
+
return subscribeLive(query, {
|
|
428
432
|
complete() {},
|
|
429
433
|
error: (error) => handlers.onError?.(error),
|
|
430
434
|
next(result) {
|
|
@@ -451,7 +455,8 @@ function createGraphQLTransport({ decodeNodeId = defaultDecodeNodeId, encodeNode
|
|
|
451
455
|
};
|
|
452
456
|
transport.subscribeConnection = (procedure, type, args, select, selectionArgs, handlers) => {
|
|
453
457
|
const field = assertIdentifier(liveOptions.connectionField ?? "fateLiveConnection", "subscription");
|
|
454
|
-
|
|
458
|
+
const query = `subscription FateLiveConnection { ${field}(procedure: ${graphQLLiteral(procedure)}, type: ${graphQLLiteral(type)}, args: ${graphQLLiteral(args ?? null)}, select: ${graphQLLiteral([...select])}, selectionArgs: ${graphQLLiteral(selectionArgs ?? null)}) { cursor id node nodeType targetCursor type } }`;
|
|
459
|
+
return subscribeLive(query, {
|
|
455
460
|
complete() {},
|
|
456
461
|
error: (error) => handlers.onError?.(error),
|
|
457
462
|
next(result) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as MutationShape, f as Entity, j as TypeConfig, t as Transport } from "./transport-
|
|
1
|
+
import { C as MutationShape, f as Entity, j as TypeConfig, t as Transport } from "./transport-DhaVVq4P.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/graphqlTransport.d.ts
|
|
4
4
|
type TransportMutations = Record<string, MutationShape>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-
|
|
1
|
+
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-DskuXeUP.mjs";
|
|
2
2
|
export { GraphQLMutationDefinition, GraphQLMutationInput, GraphQLMutationMap, GraphQLMutationOutput, GraphQLTransportOptions, createGraphQLTransport, graphqlMutation };
|
package/lib/graphqlTransport.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as graphqlMutation, t as createGraphQLTransport } from "./graphqlTransport-
|
|
1
|
+
import { n as graphqlMutation, t as createGraphQLTransport } from "./graphqlTransport-DSBVS2Fq.mjs";
|
|
2
2
|
export { createGraphQLTransport, graphqlMutation };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as HydrateOptions, A as Snapshot, B as ViewTag, C as MutationShape, D as RequestResult, E as Request$1, F as ViewEntity, G as mutation, H as __FateSelectionBrand, I as ViewEntityName, J as RequestMode, K as DeferredSnapshot, L as ViewRef, M as TypeName, N as View, O as RootDefinition, P as ViewData, Q as FateDehydratedState, R as ViewSelection, S as MutationResult, T as Pagination, U as isViewTag, V as __FateEntityBrand, W as FateMutations, X as createClient, Y as RequestOptions, Z as getSelectionPlan, _ as Mask, a as ConnectionRef, b as MutationIdentifier, c as Deferred, d as DeferredTag, et as HydrationLimits, f as Entity, g as ListItem, h as FateThenable, i as ConnectionMetadata, j as TypeConfig, k as Selection, l as DeferredMetadata, m as FateRoots, n as createTRPCTransport, o as ConnectionTag, p as EntityId, q as FateClient, r as AnyRecord, s as DeferTag, t as Transport, tt as List, u as DeferredSelection, v as MutationDefinition, w as NodesItem, x as MutationInput, y as MutationEntity, z as ViewSnapshot } from "./transport-
|
|
2
|
-
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-
|
|
3
|
-
import { C as liveGlobalConnectionTopic, S as liveEntityTopic, a as FateProtocolRequest, i as FateOperation, n as FateLiveConnectionEvent, o as FateProtocolResponse, r as FateLiveEvent, t as isRecord, u as InferFateAPI, x as liveConnectionTopic } from "./record-
|
|
4
|
-
import { n as getListEntries, t as ListEntry } from "./list-
|
|
1
|
+
import { $ as HydrateOptions, A as Snapshot, B as ViewTag, C as MutationShape, D as RequestResult, E as Request$1, F as ViewEntity, G as mutation, H as __FateSelectionBrand, I as ViewEntityName, J as RequestMode, K as DeferredSnapshot, L as ViewRef, M as TypeName, N as View, O as RootDefinition, P as ViewData, Q as FateDehydratedState, R as ViewSelection, S as MutationResult, T as Pagination, U as isViewTag, V as __FateEntityBrand, W as FateMutations, X as createClient, Y as RequestOptions, Z as getSelectionPlan, _ as Mask, a as ConnectionRef, b as MutationIdentifier, c as Deferred, d as DeferredTag, et as HydrationLimits, f as Entity, g as ListItem, h as FateThenable, i as ConnectionMetadata, j as TypeConfig, k as Selection, l as DeferredMetadata, m as FateRoots, n as createTRPCTransport, o as ConnectionTag, p as EntityId, q as FateClient, r as AnyRecord, s as DeferTag, t as Transport, tt as List, u as DeferredSelection, v as MutationDefinition, w as NodesItem, x as MutationInput, y as MutationEntity, z as ViewSnapshot } from "./transport-DhaVVq4P.mjs";
|
|
2
|
+
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-DskuXeUP.mjs";
|
|
3
|
+
import { C as liveGlobalConnectionTopic, S as liveEntityTopic, a as FateProtocolRequest, i as FateOperation, n as FateLiveConnectionEvent, o as FateProtocolResponse, r as FateLiveEvent, t as isRecord, u as InferFateAPI, x as liveConnectionTopic } from "./record-CZyyeLa3.mjs";
|
|
4
|
+
import { n as getListEntries, t as ListEntry } from "./list-sI2UPhHc.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/defer.d.ts
|
|
7
7
|
declare function defer<S>(selection: S): DeferredSelection<S>;
|