@nkzw/fate 0.1.3 → 1.0.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 +810 -129
- package/docs/api/classes/FateClient.md +832 -0
- package/docs/api/functions/clientRoot.md +27 -0
- package/docs/api/functions/createClient.md +21 -0
- package/docs/api/functions/createHTTPTransport.md +51 -0
- package/docs/api/functions/createTRPCTransport.md +46 -0
- package/docs/api/functions/getListEntries.md +15 -0
- package/docs/api/functions/getSelectionPlan.md +36 -0
- package/docs/api/functions/isRecord.md +15 -0
- package/docs/api/functions/isViewTag.md +17 -0
- package/docs/api/functions/liveConnectionTopic.md +19 -0
- package/docs/api/functions/liveEntityTopic.md +19 -0
- package/docs/api/functions/liveGlobalConnectionTopic.md +15 -0
- package/docs/api/functions/mutation.md +32 -0
- package/docs/api/functions/toEntityId.md +21 -0
- package/docs/api/functions/view.md +26 -0
- package/docs/api/index.md +81 -0
- package/docs/api/interfaces/FateThenable.md +31 -0
- package/docs/api/interfaces/Transport.md +199 -0
- package/docs/api/server/classes/FateRequestError.md +67 -0
- package/docs/api/server/drizzle/functions/createDrizzleFate.md +431 -0
- package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +21 -0
- package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +21 -0
- package/docs/api/server/drizzle/index.md +23 -0
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +15 -0
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +5 -0
- package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +21 -0
- package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +337 -0
- package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +29 -0
- package/docs/api/server/functions/bindSourceProcedures.md +32 -0
- package/docs/api/server/functions/computed.md +43 -0
- package/docs/api/server/functions/count.md +21 -0
- package/docs/api/server/functions/createFateFetchHandler.md +21 -0
- package/docs/api/server/functions/createFateServer.md +41 -0
- package/docs/api/server/functions/createHonoFateHandler.md +21 -0
- package/docs/api/server/functions/createLiveEventBus.md +17 -0
- package/docs/api/server/functions/createNestedSourcePlan.md +103 -0
- package/docs/api/server/functions/createResolver.md +74 -0
- package/docs/api/server/functions/createSourcePlan.md +95 -0
- package/docs/api/server/functions/createSourceProcedures.md +46 -0
- package/docs/api/server/functions/dataView.md +32 -0
- package/docs/api/server/functions/field.md +15 -0
- package/docs/api/server/functions/getNestedSelection.md +19 -0
- package/docs/api/server/functions/getScopedArgs.md +21 -0
- package/docs/api/server/functions/hasNestedSelection.md +19 -0
- package/docs/api/server/functions/list.md +28 -0
- package/docs/api/server/functions/refetchSourceById.md +55 -0
- package/docs/api/server/functions/resolveSourceById.md +55 -0
- package/docs/api/server/functions/resolveSourceByIds.md +55 -0
- package/docs/api/server/functions/resolveSourceConnection.md +67 -0
- package/docs/api/server/functions/resolver.md +42 -0
- package/docs/api/server/functions/toPrismaSelect.md +25 -0
- package/docs/api/server/functions/withConnection.md +24 -0
- package/docs/api/server/index.md +109 -0
- package/docs/api/server/prisma/functions/createPrismaFate.md +435 -0
- package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +21 -0
- package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +21 -0
- package/docs/api/server/prisma/functions/prismaConnectionArgs.md +57 -0
- package/docs/api/server/prisma/index.md +23 -0
- package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +59 -0
- package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +5 -0
- package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +343 -0
- package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +31 -0
- package/docs/api/server/type-aliases/ComputedField.md +55 -0
- package/docs/api/server/type-aliases/ComputedSelection.md +5 -0
- package/docs/api/server/type-aliases/ConnectionItem.md +29 -0
- package/docs/api/server/type-aliases/ConnectionPagination.md +39 -0
- package/docs/api/server/type-aliases/ConnectionResult.md +29 -0
- package/docs/api/server/type-aliases/CountSelection.md +29 -0
- package/docs/api/server/type-aliases/CountWhere.md +5 -0
- package/docs/api/server/type-aliases/DataViewListOptions.md +13 -0
- package/docs/api/server/type-aliases/DataViewOrderBy.md +5 -0
- package/docs/api/server/type-aliases/DataViewOrderDirection.md +5 -0
- package/docs/api/server/type-aliases/DataViewResult.md +11 -0
- package/docs/api/server/type-aliases/Entity.md +21 -0
- package/docs/api/server/type-aliases/FateServer.md +75 -0
- package/docs/api/server/type-aliases/FateServerManifest.md +5 -0
- package/docs/api/server/type-aliases/FieldSelection.md +21 -0
- package/docs/api/server/type-aliases/LiveConnectionEventType.md +5 -0
- package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +5 -0
- package/docs/api/server/type-aliases/LiveEventBus.md +5 -0
- package/docs/api/server/type-aliases/LiveEventType.md +5 -0
- package/docs/api/server/type-aliases/LiveSourceEvent.md +5 -0
- package/docs/api/server/type-aliases/NativeFateAPI.md +47 -0
- package/docs/api/server/type-aliases/OrderDirection.md +5 -0
- package/docs/api/server/type-aliases/SourceConfig.md +55 -0
- package/docs/api/server/type-aliases/SourceDefinition.md +55 -0
- package/docs/api/server/type-aliases/SourceOrder.md +5 -0
- package/docs/api/server/type-aliases/SourceOrderField.md +21 -0
- package/docs/api/server/type-aliases/SourcePlan.md +29 -0
- package/docs/api/server/type-aliases/SourcePlanNode.md +29 -0
- package/docs/api/server/type-aliases/SourceRegistry.md +11 -0
- package/docs/api/server/type-aliases/SourceRelation.md +15 -0
- package/docs/api/server/type-aliases/SourceRelationConfig.md +23 -0
- package/docs/api/server/variables/byIdInput.md +5 -0
- package/docs/api/server/variables/connectionArgs.md +7 -0
- package/docs/api/type-aliases/ConnectionMetadata.md +7 -0
- package/docs/api/type-aliases/ConnectionRef.md +13 -0
- package/docs/api/type-aliases/Entity.md +15 -0
- package/docs/api/type-aliases/EntityId.md +7 -0
- package/docs/api/type-aliases/FateLiveConnectionEvent.md +5 -0
- package/docs/api/type-aliases/FateLiveEvent.md +5 -0
- package/docs/api/type-aliases/FateMutations.md +7 -0
- package/docs/api/type-aliases/FateOperation.md +5 -0
- package/docs/api/type-aliases/FateProtocolRequest.md +5 -0
- package/docs/api/type-aliases/FateProtocolResponse.md +5 -0
- package/docs/api/type-aliases/FateRecord.md +7 -0
- package/docs/api/type-aliases/FateRoots.md +7 -0
- package/docs/api/type-aliases/InferFateAPI.md +11 -0
- package/docs/api/type-aliases/List.md +5 -0
- package/docs/api/type-aliases/ListEntry.md +5 -0
- package/docs/api/type-aliases/ListItem.md +13 -0
- package/docs/api/type-aliases/Mask.md +15 -0
- package/docs/api/type-aliases/MutationDefinition.md +21 -0
- package/docs/api/type-aliases/MutationEntity.md +13 -0
- package/docs/api/type-aliases/MutationIdentifier.md +19 -0
- package/docs/api/type-aliases/MutationInput.md +13 -0
- package/docs/api/type-aliases/MutationResult.md +13 -0
- package/docs/api/type-aliases/NodesItem.md +13 -0
- package/docs/api/type-aliases/Pagination.md +39 -0
- package/docs/api/type-aliases/Request.md +7 -0
- package/docs/api/type-aliases/RequestMode.md +7 -0
- package/docs/api/type-aliases/RequestOptions.md +7 -0
- package/docs/api/type-aliases/RequestResult.md +18 -0
- package/docs/api/type-aliases/Selection.md +13 -0
- package/docs/api/type-aliases/Snapshot.md +7 -0
- package/docs/api/type-aliases/TypeConfig.md +41 -0
- package/docs/api/type-aliases/View.md +17 -0
- package/docs/api/type-aliases/ViewData.md +18 -0
- package/docs/api/type-aliases/ViewEntity.md +13 -0
- package/docs/api/type-aliases/ViewEntityName.md +13 -0
- package/docs/api/type-aliases/ViewRef.md +13 -0
- package/docs/api/type-aliases/ViewSelection.md +13 -0
- package/docs/api/type-aliases/ViewSnapshot.md +18 -0
- package/docs/api/type-aliases/ViewTag.md +7 -0
- package/docs/api/variables/ConnectionTag.md +7 -0
- package/docs/guide/actions.md +263 -0
- package/docs/guide/core-concepts.md +22 -0
- package/docs/guide/getting-started.md +57 -0
- package/docs/guide/list-views.md +86 -0
- package/docs/guide/live-views.md +245 -0
- package/docs/guide/requests.md +130 -0
- package/docs/guide/server-integration.md +630 -0
- package/docs/guide/views.md +278 -0
- package/docs/guide/void-integration.md +167 -0
- package/docs/index.md +4 -0
- package/lib/cli.mjs +17 -250
- package/lib/clientStub.d.mts +6 -0
- package/lib/clientStub.mjs +6 -0
- package/lib/executor-BqwHdN3n.d.mts +468 -0
- package/lib/index.d.mts +64 -2
- package/lib/index.mjs +1961 -555
- package/lib/list-4wRNSVgI.d.mts +10 -0
- package/lib/list-C_mi6GnE.mjs +16 -0
- package/lib/list.d.mts +2 -0
- package/lib/list.mjs +2 -0
- package/lib/liveTopics-DzNtJaBD.mjs +197 -0
- package/lib/{record-DnhZuvUe.mjs → record-AeZJC9fd.mjs} +1 -2
- package/lib/record-ENh92gyb.d.mts +315 -0
- package/lib/server/drizzle.d.mts +304 -0
- package/lib/server/drizzle.mjs +688 -0
- package/lib/server/prisma.d.mts +309 -0
- package/lib/server/prisma.mjs +345 -0
- package/lib/server.d.mts +82 -183
- package/lib/server.mjs +870 -416
- package/lib/sourceRouter-Bwpkr062.mjs +972 -0
- package/lib/{types-HECWvGpd.d.mts → types-Dz46PXr3.d.mts} +215 -63
- package/lib/vite.d.mts +17 -0
- package/lib/vite.mjs +593 -0
- package/package.json +44 -6
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Function: clientRoot()
|
|
2
|
+
|
|
3
|
+
> **clientRoot**\<`Result`, `Type`\>(`type`): `RootDefinition`\<`Type`, `Result`\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/root.ts:7](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/root.ts#L7)
|
|
6
|
+
|
|
7
|
+
Defines a root query for an entity type, capturing the response shape.
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
### Result
|
|
12
|
+
|
|
13
|
+
`Result`
|
|
14
|
+
|
|
15
|
+
### Type
|
|
16
|
+
|
|
17
|
+
`Type` *extends* `string`
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
### type
|
|
22
|
+
|
|
23
|
+
`Type`
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
`RootDefinition`\<`Type`, `Result`\>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Function: createClient()
|
|
2
|
+
|
|
3
|
+
> **createClient**\<`T`\>(`options`): [`FateClient`](../classes/FateClient.md)\<`T`\[`0`\], `T`\[`1`\]\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/client.ts:3006](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/client.ts#L3006)
|
|
6
|
+
|
|
7
|
+
## Type Parameters
|
|
8
|
+
|
|
9
|
+
### T
|
|
10
|
+
|
|
11
|
+
`T` *extends* \[[`FateRoots`](../type-aliases/FateRoots.md), [`FateMutations`](../type-aliases/FateMutations.md)\] = \[`Record`\<`never`, `RootDefinition`\<`any`, `any`\>\>, `Record`\<`never`, [`MutationDefinition`](../type-aliases/MutationDefinition.md)\<`any`, `any`, `any`\>\>\]
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### options
|
|
16
|
+
|
|
17
|
+
`FateClientOptions`\<`T`\[`0`\], `T`\[`1`\]\>
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[`FateClient`](../classes/FateClient.md)\<`T`\[`0`\], `T`\[`1`\]\>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Function: createHTTPTransport()
|
|
2
|
+
|
|
3
|
+
> **createHTTPTransport**\<`API`, `Mutations`\>(`__namedParameters`): [`Transport`](../interfaces/Transport.md)\<`Mutations`\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/httpTransport.ts:265](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/httpTransport.ts#L265)
|
|
6
|
+
|
|
7
|
+
## Type Parameters
|
|
8
|
+
|
|
9
|
+
### API
|
|
10
|
+
|
|
11
|
+
`API` *extends* `FateAPIShape`
|
|
12
|
+
|
|
13
|
+
### Mutations
|
|
14
|
+
|
|
15
|
+
`Mutations` *extends* `TransportMutations` = `MutationMapFromAPI`\<`API`\>
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
### \_\_namedParameters
|
|
20
|
+
|
|
21
|
+
#### eventSource?
|
|
22
|
+
|
|
23
|
+
`EventSourceConstructor`
|
|
24
|
+
|
|
25
|
+
#### fetch?
|
|
26
|
+
|
|
27
|
+
`FetchLike` = `defaultFetch`
|
|
28
|
+
|
|
29
|
+
#### headers?
|
|
30
|
+
|
|
31
|
+
`HeadersFactory`
|
|
32
|
+
|
|
33
|
+
#### live?
|
|
34
|
+
|
|
35
|
+
`boolean` \| `LiveConnector` = `true`
|
|
36
|
+
|
|
37
|
+
#### liveRetryMs?
|
|
38
|
+
|
|
39
|
+
`number` = `1000`
|
|
40
|
+
|
|
41
|
+
#### liveUrl?
|
|
42
|
+
|
|
43
|
+
`string` \| `URL`
|
|
44
|
+
|
|
45
|
+
#### url
|
|
46
|
+
|
|
47
|
+
`string` \| `URL`
|
|
48
|
+
|
|
49
|
+
## Returns
|
|
50
|
+
|
|
51
|
+
[`Transport`](../interfaces/Transport.md)\<`Mutations`\>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Function: createTRPCTransport()
|
|
2
|
+
|
|
3
|
+
> **createTRPCTransport**\<`AppRouter`, `Mutations`\>(`__namedParameters`): [`Transport`](../interfaces/Transport.md)\<`MutationMapFromResolvers`\<`Mutations`\>\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/transport.ts:149](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L149)
|
|
6
|
+
|
|
7
|
+
Builds a `Transport` backed by a tRPC client using the configured resolvers
|
|
8
|
+
for by-id queries, lists, and mutations.
|
|
9
|
+
|
|
10
|
+
## Type Parameters
|
|
11
|
+
|
|
12
|
+
### AppRouter
|
|
13
|
+
|
|
14
|
+
`AppRouter` *extends* `AnyRouter`
|
|
15
|
+
|
|
16
|
+
### Mutations
|
|
17
|
+
|
|
18
|
+
`Mutations` *extends* `TRPCMutationResolvers`\<`AppRouter`\> = `EmptyMutationResolvers`\<`AppRouter`\>
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
### \_\_namedParameters
|
|
23
|
+
|
|
24
|
+
#### byId
|
|
25
|
+
|
|
26
|
+
`TRPCByIdResolvers`\<`AppRouter`\>
|
|
27
|
+
|
|
28
|
+
#### client
|
|
29
|
+
|
|
30
|
+
`TRPCClient`\<`AppRouter`\>
|
|
31
|
+
|
|
32
|
+
#### lists?
|
|
33
|
+
|
|
34
|
+
`TRPCListResolvers`\<`AppRouter`\>
|
|
35
|
+
|
|
36
|
+
#### mutations?
|
|
37
|
+
|
|
38
|
+
`Mutations`
|
|
39
|
+
|
|
40
|
+
#### queries?
|
|
41
|
+
|
|
42
|
+
`TRPCQueryResolvers`\<`AppRouter`\>
|
|
43
|
+
|
|
44
|
+
## Returns
|
|
45
|
+
|
|
46
|
+
[`Transport`](../interfaces/Transport.md)\<`MutationMapFromResolvers`\<`Mutations`\>\>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: getListEntries()
|
|
2
|
+
|
|
3
|
+
> **getListEntries**(`listState`): `Readonly`\<\{ `cursor?`: `string`; `id`: `string`; \}\>[]
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/list.ts:6](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/list.ts#L6)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### listState
|
|
10
|
+
|
|
11
|
+
`Readonly`\<\{ `backwardPageLimit?`: `number`; `cursors?`: readonly (`string` \| `undefined`)[]; `forwardPageLimit?`: `number`; `ids`: readonly `string`[]; `liveAfterIds?`: readonly `string`[]; `liveBeforeIds?`: readonly `string`[]; `pagination?`: [`Pagination`](../type-aliases/Pagination.md); `pendingAfterIds?`: readonly `string`[]; `pendingBeforeIds?`: readonly `string`[]; \}\> \| `undefined`
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Readonly`\<\{ `cursor?`: `string`; `id`: `string`; \}\>[]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Function: getSelectionPlan()
|
|
2
|
+
|
|
3
|
+
> **getSelectionPlan**\<`T`, `S`, `V`\>(`viewComposition`, `ref`): `SelectionPlan`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/selection.ts:37](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/selection.ts#L37)
|
|
6
|
+
|
|
7
|
+
Flattens a view into a `SelectionPlan`, expanding composed views and
|
|
8
|
+
partitioning nested args so the client can fetch exactly what is declared.
|
|
9
|
+
|
|
10
|
+
## Type Parameters
|
|
11
|
+
|
|
12
|
+
### T
|
|
13
|
+
|
|
14
|
+
`T` *extends* [`Entity`](../type-aliases/Entity.md)
|
|
15
|
+
|
|
16
|
+
### S
|
|
17
|
+
|
|
18
|
+
`S` *extends* [`Selection`](../type-aliases/Selection.md)\<`T`\>
|
|
19
|
+
|
|
20
|
+
### V
|
|
21
|
+
|
|
22
|
+
`V` *extends* [`View`](../type-aliases/View.md)\<`T`, `S`\>
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
### viewComposition
|
|
27
|
+
|
|
28
|
+
`V`
|
|
29
|
+
|
|
30
|
+
### ref
|
|
31
|
+
|
|
32
|
+
`Readonly`\<\{ `__typename`: `T`\[`"__typename"`\]; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\> \| `null`
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
`SelectionPlan`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: isRecord()
|
|
2
|
+
|
|
3
|
+
> **isRecord**(`value`): `value is FateRecord`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/record.ts:3](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/record.ts#L3)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### value
|
|
10
|
+
|
|
11
|
+
`unknown`
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`value is FateRecord`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Function: isViewTag()
|
|
2
|
+
|
|
3
|
+
> **isViewTag**(`key`): `` key is `__fate-view__${string}` ``
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:59](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/types.ts#L59)
|
|
6
|
+
|
|
7
|
+
Determines whether a property key is a fate view tag.
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
### key
|
|
12
|
+
|
|
13
|
+
`string`
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`` key is `__fate-view__${string}` ``
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: liveConnectionTopic()
|
|
2
|
+
|
|
3
|
+
> **liveConnectionTopic**(`procedure`, `args?`): `string`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/liveTopics.ts:20](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/liveTopics.ts#L20)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### procedure
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
### args?
|
|
14
|
+
|
|
15
|
+
`Record`\<`string`, `unknown`\>
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`string`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: liveEntityTopic()
|
|
2
|
+
|
|
3
|
+
> **liveEntityTopic**(`type`, `id`): `string`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/liveTopics.ts:17](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/liveTopics.ts#L17)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### type
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
### id
|
|
14
|
+
|
|
15
|
+
`string` \| `number`
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`string`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: liveGlobalConnectionTopic()
|
|
2
|
+
|
|
3
|
+
> **liveGlobalConnectionTopic**(`procedure`): `string`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/liveTopics.ts:25](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/liveTopics.ts#L25)
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### procedure
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`string`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Function: mutation()
|
|
2
|
+
|
|
3
|
+
> **mutation**\<`T`, `I`, `R`\>(`entity`): [`MutationDefinition`](../type-aliases/MutationDefinition.md)\<`T`, `I`, `R`\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/mutation.ts:28](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/mutation.ts#L28)
|
|
6
|
+
|
|
7
|
+
Defines a mutation for a given entity type, preserving the input and output
|
|
8
|
+
types for transports.
|
|
9
|
+
|
|
10
|
+
## Type Parameters
|
|
11
|
+
|
|
12
|
+
### T
|
|
13
|
+
|
|
14
|
+
`T` *extends* [`Entity`](../type-aliases/Entity.md)
|
|
15
|
+
|
|
16
|
+
### I
|
|
17
|
+
|
|
18
|
+
`I`
|
|
19
|
+
|
|
20
|
+
### R
|
|
21
|
+
|
|
22
|
+
`R`
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
### entity
|
|
27
|
+
|
|
28
|
+
`T`\[`"__typename"`\]
|
|
29
|
+
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
[`MutationDefinition`](../type-aliases/MutationDefinition.md)\<`T`, `I`, `R`\>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Function: toEntityId()
|
|
2
|
+
|
|
3
|
+
> **toEntityId**(`type`, `rawId`): `string`
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/ref.ts:16](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/ref.ts#L16)
|
|
6
|
+
|
|
7
|
+
Builds the canonical cache ID for an entity.
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
### type
|
|
12
|
+
|
|
13
|
+
`string`
|
|
14
|
+
|
|
15
|
+
### rawId
|
|
16
|
+
|
|
17
|
+
`string` \| `number`
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`string`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Function: view()
|
|
2
|
+
|
|
3
|
+
> **view**\<`T`\>(): \<`S`\>(`select`) => [`View`](../type-aliases/View.md)\<`T`, `S`\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/fate/src/view.ts:111](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/view.ts#L111)
|
|
6
|
+
|
|
7
|
+
Creates a reusable view for an object using the declared selection.
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
### T
|
|
12
|
+
|
|
13
|
+
`T` *extends* [`Entity`](../type-aliases/Entity.md)
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
\<`S`\>(`select`) => [`View`](../type-aliases/View.md)\<`T`, `S`\>
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const PostView = view<Post>()({
|
|
23
|
+
id: true,
|
|
24
|
+
title: true,
|
|
25
|
+
});
|
|
26
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @nkzw/fate
|
|
2
|
+
|
|
3
|
+
The fate core library.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { view } from '@nkzw/fate';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Classes
|
|
12
|
+
|
|
13
|
+
- [FateClient](classes/FateClient.md)
|
|
14
|
+
|
|
15
|
+
## Interfaces
|
|
16
|
+
|
|
17
|
+
- [FateThenable](interfaces/FateThenable.md)
|
|
18
|
+
- [Transport](interfaces/Transport.md)
|
|
19
|
+
|
|
20
|
+
## Type Aliases
|
|
21
|
+
|
|
22
|
+
- [ConnectionMetadata](type-aliases/ConnectionMetadata.md)
|
|
23
|
+
- [ConnectionRef](type-aliases/ConnectionRef.md)
|
|
24
|
+
- [Entity](type-aliases/Entity.md)
|
|
25
|
+
- [EntityId](type-aliases/EntityId.md)
|
|
26
|
+
- [FateLiveConnectionEvent](type-aliases/FateLiveConnectionEvent.md)
|
|
27
|
+
- [FateLiveEvent](type-aliases/FateLiveEvent.md)
|
|
28
|
+
- [FateMutations](type-aliases/FateMutations.md)
|
|
29
|
+
- [FateOperation](type-aliases/FateOperation.md)
|
|
30
|
+
- [FateProtocolRequest](type-aliases/FateProtocolRequest.md)
|
|
31
|
+
- [FateProtocolResponse](type-aliases/FateProtocolResponse.md)
|
|
32
|
+
- [FateRecord](type-aliases/FateRecord.md)
|
|
33
|
+
- [FateRoots](type-aliases/FateRoots.md)
|
|
34
|
+
- [InferFateAPI](type-aliases/InferFateAPI.md)
|
|
35
|
+
- [List](type-aliases/List.md)
|
|
36
|
+
- [ListEntry](type-aliases/ListEntry.md)
|
|
37
|
+
- [ListItem](type-aliases/ListItem.md)
|
|
38
|
+
- [Mask](type-aliases/Mask.md)
|
|
39
|
+
- [MutationDefinition](type-aliases/MutationDefinition.md)
|
|
40
|
+
- [MutationEntity](type-aliases/MutationEntity.md)
|
|
41
|
+
- [MutationIdentifier](type-aliases/MutationIdentifier.md)
|
|
42
|
+
- [MutationInput](type-aliases/MutationInput.md)
|
|
43
|
+
- [MutationResult](type-aliases/MutationResult.md)
|
|
44
|
+
- [NodesItem](type-aliases/NodesItem.md)
|
|
45
|
+
- [Pagination](type-aliases/Pagination.md)
|
|
46
|
+
- [Request](type-aliases/Request.md)
|
|
47
|
+
- [RequestMode](type-aliases/RequestMode.md)
|
|
48
|
+
- [RequestOptions](type-aliases/RequestOptions.md)
|
|
49
|
+
- [RequestResult](type-aliases/RequestResult.md)
|
|
50
|
+
- [Selection](type-aliases/Selection.md)
|
|
51
|
+
- [Snapshot](type-aliases/Snapshot.md)
|
|
52
|
+
- [TypeConfig](type-aliases/TypeConfig.md)
|
|
53
|
+
- [View](type-aliases/View.md)
|
|
54
|
+
- [ViewData](type-aliases/ViewData.md)
|
|
55
|
+
- [ViewEntity](type-aliases/ViewEntity.md)
|
|
56
|
+
- [ViewEntityName](type-aliases/ViewEntityName.md)
|
|
57
|
+
- [ViewRef](type-aliases/ViewRef.md)
|
|
58
|
+
- [ViewSelection](type-aliases/ViewSelection.md)
|
|
59
|
+
- [ViewSnapshot](type-aliases/ViewSnapshot.md)
|
|
60
|
+
- [ViewTag](type-aliases/ViewTag.md)
|
|
61
|
+
|
|
62
|
+
## Variables
|
|
63
|
+
|
|
64
|
+
- [ConnectionTag](variables/ConnectionTag.md)
|
|
65
|
+
|
|
66
|
+
## Functions
|
|
67
|
+
|
|
68
|
+
- [clientRoot](functions/clientRoot.md)
|
|
69
|
+
- [createClient](functions/createClient.md)
|
|
70
|
+
- [createHTTPTransport](functions/createHTTPTransport.md)
|
|
71
|
+
- [createTRPCTransport](functions/createTRPCTransport.md)
|
|
72
|
+
- [getListEntries](functions/getListEntries.md)
|
|
73
|
+
- [getSelectionPlan](functions/getSelectionPlan.md)
|
|
74
|
+
- [isRecord](functions/isRecord.md)
|
|
75
|
+
- [isViewTag](functions/isViewTag.md)
|
|
76
|
+
- [liveConnectionTopic](functions/liveConnectionTopic.md)
|
|
77
|
+
- [liveEntityTopic](functions/liveEntityTopic.md)
|
|
78
|
+
- [liveGlobalConnectionTopic](functions/liveGlobalConnectionTopic.md)
|
|
79
|
+
- [mutation](functions/mutation.md)
|
|
80
|
+
- [toEntityId](functions/toEntityId.md)
|
|
81
|
+
- [view](functions/view.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface: FateThenable\<T\>
|
|
2
|
+
|
|
3
|
+
Defined in: [packages/fate/src/types.ts:484](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/types.ts#L484)
|
|
4
|
+
|
|
5
|
+
Promise-like value returned by cache reads that already have a resolved payload for React `use`.
|
|
6
|
+
|
|
7
|
+
## Extends
|
|
8
|
+
|
|
9
|
+
- `PromiseLike`\<`T`\>
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
### T
|
|
14
|
+
|
|
15
|
+
`T`
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
### status
|
|
20
|
+
|
|
21
|
+
> **status**: `"fulfilled"`
|
|
22
|
+
|
|
23
|
+
Defined in: [packages/fate/src/types.ts:485](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/types.ts#L485)
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### value
|
|
28
|
+
|
|
29
|
+
> **value**: `T`
|
|
30
|
+
|
|
31
|
+
Defined in: [packages/fate/src/types.ts:486](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/types.ts#L486)
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Interface: Transport\<Mutations\>
|
|
2
|
+
|
|
3
|
+
Defined in: [packages/fate/src/transport.ts:52](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L52)
|
|
4
|
+
|
|
5
|
+
Contract the fate client expects from a network transport. The transport is
|
|
6
|
+
responsible for fetching records by ID, fetching lists, and executing
|
|
7
|
+
mutations with the provided selections.
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
### Mutations
|
|
12
|
+
|
|
13
|
+
`Mutations` *extends* `TransportMutations` = `EmptyTransportMutations`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### fetchById()
|
|
18
|
+
|
|
19
|
+
> **fetchById**(`type`, `ids`, `select`, `args?`): `Promise`\<`unknown`[]\>
|
|
20
|
+
|
|
21
|
+
Defined in: [packages/fate/src/transport.ts:53](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L53)
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### type
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
##### ids
|
|
30
|
+
|
|
31
|
+
(`string` \| `number`)[]
|
|
32
|
+
|
|
33
|
+
##### select
|
|
34
|
+
|
|
35
|
+
`Iterable`\<`string`\>
|
|
36
|
+
|
|
37
|
+
##### args?
|
|
38
|
+
|
|
39
|
+
[`FateRecord`](../type-aliases/FateRecord.md)
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
`Promise`\<`unknown`[]\>
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### fetchList()?
|
|
48
|
+
|
|
49
|
+
> `optional` **fetchList**(`proc`, `select`, `args?`): `Promise`\<\{ `items`: `object`[]; `pagination`: [`Pagination`](../type-aliases/Pagination.md); \}\>
|
|
50
|
+
|
|
51
|
+
Defined in: [packages/fate/src/transport.ts:59](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L59)
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### proc
|
|
56
|
+
|
|
57
|
+
`string`
|
|
58
|
+
|
|
59
|
+
##### select
|
|
60
|
+
|
|
61
|
+
`Iterable`\<`string`\>
|
|
62
|
+
|
|
63
|
+
##### args?
|
|
64
|
+
|
|
65
|
+
[`FateRecord`](../type-aliases/FateRecord.md)
|
|
66
|
+
|
|
67
|
+
#### Returns
|
|
68
|
+
|
|
69
|
+
`Promise`\<\{ `items`: `object`[]; `pagination`: [`Pagination`](../type-aliases/Pagination.md); \}\>
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
### fetchQuery()?
|
|
74
|
+
|
|
75
|
+
> `optional` **fetchQuery**(`proc`, `select`, `args?`): `Promise`\<`unknown`\>
|
|
76
|
+
|
|
77
|
+
Defined in: [packages/fate/src/transport.ts:67](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L67)
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
##### proc
|
|
82
|
+
|
|
83
|
+
`string`
|
|
84
|
+
|
|
85
|
+
##### select
|
|
86
|
+
|
|
87
|
+
`Iterable`\<`string`\>
|
|
88
|
+
|
|
89
|
+
##### args?
|
|
90
|
+
|
|
91
|
+
[`FateRecord`](../type-aliases/FateRecord.md)
|
|
92
|
+
|
|
93
|
+
#### Returns
|
|
94
|
+
|
|
95
|
+
`Promise`\<`unknown`\>
|
|
96
|
+
|
|
97
|
+
***
|
|
98
|
+
|
|
99
|
+
### mutate()?
|
|
100
|
+
|
|
101
|
+
> `optional` **mutate**\<`K`\>(`proc`, `input`, `select`): `Promise`\<`Mutations`\[`K`\]\[`"output"`\]\>
|
|
102
|
+
|
|
103
|
+
Defined in: [packages/fate/src/transport.ts:68](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L68)
|
|
104
|
+
|
|
105
|
+
#### Type Parameters
|
|
106
|
+
|
|
107
|
+
##### K
|
|
108
|
+
|
|
109
|
+
`K` *extends* `string`
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
##### proc
|
|
114
|
+
|
|
115
|
+
`K`
|
|
116
|
+
|
|
117
|
+
##### input
|
|
118
|
+
|
|
119
|
+
`Mutations`\[`K`\]\[`"input"`\]
|
|
120
|
+
|
|
121
|
+
##### select
|
|
122
|
+
|
|
123
|
+
`Set`\<`string`\>
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
`Promise`\<`Mutations`\[`K`\]\[`"output"`\]\>
|
|
128
|
+
|
|
129
|
+
***
|
|
130
|
+
|
|
131
|
+
### subscribeById()?
|
|
132
|
+
|
|
133
|
+
> `optional` **subscribeById**(`type`, `id`, `select`, `args`, `handlers`): () => `void`
|
|
134
|
+
|
|
135
|
+
Defined in: [packages/fate/src/transport.ts:73](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L73)
|
|
136
|
+
|
|
137
|
+
#### Parameters
|
|
138
|
+
|
|
139
|
+
##### type
|
|
140
|
+
|
|
141
|
+
`string`
|
|
142
|
+
|
|
143
|
+
##### id
|
|
144
|
+
|
|
145
|
+
`string` \| `number`
|
|
146
|
+
|
|
147
|
+
##### select
|
|
148
|
+
|
|
149
|
+
`Iterable`\<`string`\>
|
|
150
|
+
|
|
151
|
+
##### args
|
|
152
|
+
|
|
153
|
+
[`FateRecord`](../type-aliases/FateRecord.md) \| `undefined`
|
|
154
|
+
|
|
155
|
+
##### handlers
|
|
156
|
+
|
|
157
|
+
`LiveEventHandlers`
|
|
158
|
+
|
|
159
|
+
#### Returns
|
|
160
|
+
|
|
161
|
+
() => `void`
|
|
162
|
+
|
|
163
|
+
***
|
|
164
|
+
|
|
165
|
+
### subscribeConnection()?
|
|
166
|
+
|
|
167
|
+
> `optional` **subscribeConnection**(`procedure`, `type`, `args`, `select`, `selectionArgs`, `handlers`): () => `void`
|
|
168
|
+
|
|
169
|
+
Defined in: [packages/fate/src/transport.ts:80](https://github.com/nkzw-tech/fate/blob/17081c4f677e224e55b75d9a31bd6e0a7ee94af1/packages/fate/src/transport.ts#L80)
|
|
170
|
+
|
|
171
|
+
#### Parameters
|
|
172
|
+
|
|
173
|
+
##### procedure
|
|
174
|
+
|
|
175
|
+
`string`
|
|
176
|
+
|
|
177
|
+
##### type
|
|
178
|
+
|
|
179
|
+
`string`
|
|
180
|
+
|
|
181
|
+
##### args
|
|
182
|
+
|
|
183
|
+
[`FateRecord`](../type-aliases/FateRecord.md) \| `undefined`
|
|
184
|
+
|
|
185
|
+
##### select
|
|
186
|
+
|
|
187
|
+
`Iterable`\<`string`\>
|
|
188
|
+
|
|
189
|
+
##### selectionArgs
|
|
190
|
+
|
|
191
|
+
[`FateRecord`](../type-aliases/FateRecord.md) \| `undefined`
|
|
192
|
+
|
|
193
|
+
##### handlers
|
|
194
|
+
|
|
195
|
+
`LiveConnectionEventHandlers`
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
|
|
199
|
+
() => `void`
|