@nkzw/fate 1.0.1 → 1.0.3
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/docs/api/classes/FateClient.md +36 -36
- package/docs/api/functions/clientRoot.md +1 -1
- package/docs/api/functions/createClient.md +1 -1
- package/docs/api/functions/createHTTPTransport.md +1 -1
- package/docs/api/functions/createTRPCTransport.md +1 -1
- package/docs/api/functions/getListEntries.md +1 -1
- package/docs/api/functions/getSelectionPlan.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/Entity.md +2 -2
- package/docs/api/type-aliases/EntityId.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/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/lib/server/drizzle.mjs +68 -1
- package/package.json +2 -2
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateLiveConnectionEvent** = `Readonly`\<\{ `edge`: \{ `cursor?`: `string`; `node`: `unknown`; \}; `nodeType`: `string`; `targetCursor?`: `string`; `type`: `"appendEdge"` \| `"appendNode"` \| `"insertEdgeAfter"` \| `"insertEdgeBefore"` \| `"prependEdge"` \| `"prependNode"`; \}\> \| `Readonly`\<\{ `id`: `string` \| `number`; `nodeType`: `string`; `type`: `"deleteEdge"`; \}\> \| `Readonly`\<\{ `type`: `"invalidate"`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/protocol.ts:55](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/protocol.ts:55](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/protocol.ts#L55)
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateLiveEvent** = `FateLiveDataEvent` \| `FateLiveDeleteEvent`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/protocol.ts:53](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/protocol.ts:53](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/protocol.ts#L53)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateMutations** = `Record`\<`string`, [`MutationDefinition`](MutationDefinition.md)\<`any`, `any`, `any`\>\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/mutation.ts:94](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/mutation.ts:94](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/mutation.ts#L94)
|
|
6
6
|
|
|
7
7
|
Base type for client mutations.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateOperation** = `Readonly`\<\{ `args?`: `Record`\<`string`, `unknown`\>; `id`: `string`; `ids?`: (`string` \| `number`)[]; `input?`: `unknown`; `kind`: `FateOperationKind`; `name?`: `string`; `select`: `string`[]; `type?`: `string`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/protocol.ts:7](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/protocol.ts:7](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/protocol.ts#L7)
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateProtocolRequest** = `Readonly`\<\{ `operations`: [`FateOperation`](FateOperation.md)[]; `version`: `FateProtocolVersion`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/protocol.ts:30](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/protocol.ts:30](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/protocol.ts#L30)
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateProtocolResponse** = `Readonly`\<\{ `results`: `FateOperationResult`[]; `version`: `FateProtocolVersion`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/protocol.ts:35](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/protocol.ts:35](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/protocol.ts#L35)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateRecord** = `Record`\<`string`, `unknown`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:64](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:64](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L64)
|
|
6
6
|
|
|
7
7
|
Alias for a loose record used throughout the fate's internals.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **FateRoots** = `Record`\<`string`, `RootDefinition`\<`TypeName`, `unknown`\>\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:425](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:425](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L425)
|
|
6
6
|
|
|
7
7
|
Minimal root description used for typing root maps.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **InferFateAPI**\<`Server`\> = `Server` *extends* `object` ? `API` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/server/http.ts:235](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/server/http.ts:235](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/server/http.ts#L235)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **List** = `Readonly`\<\{ `backwardPageLimit?`: `number`; `cursors?`: `ReadonlyArray`\<`string` \| `undefined`\>; `forwardPageLimit?`: `number`; `ids`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `liveAfterIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `liveBeforeIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `pagination?`: [`Pagination`](Pagination.md); `pendingAfterIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; `pendingBeforeIds?`: `ReadonlyArray`\<[`EntityId`](EntityId.md)\>; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/store.ts:14](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/store.ts:14](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/store.ts#L14)
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
> **ListEntry** = `Readonly`\<\{ `cursor?`: `string`; `id`: [`EntityId`](EntityId.md); \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/list.ts:4](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/list.ts:4](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/list.ts#L4)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ListItem**\<`V`\> = `Readonly`\<\{ `args?`: `Record`\<`string`, `unknown`\>; `list`: `V`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:316](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:316](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L316)
|
|
6
6
|
|
|
7
7
|
Definition of a list request for fetching data from the backend.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Mask**\<`T`, `S`\> = `WithNullish`\<`T`, `MaskNonNullish`\<`NonNullish`\<`T`\>, `S`\>\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:300](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:300](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L300)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **MutationDefinition**\<`T`, `I`, `R`\> = `Readonly`\<\{ `__fate__mutation`: `true`; `entity`: `T`\[`"__typename"`\]; \}\> & `__MutationEntityAnchor`\<`T`\> & `__MutationInputAnchor`\<`I`\> & `__MutationResultAnchor`\<`R`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:434](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:434](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L434)
|
|
6
6
|
|
|
7
7
|
Metadata describing a mutation for a particular entity, input, and output.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **MutationEntity**\<`M`\> = `M` *extends* `__MutationEntityAnchor`\<infer E\> ? `E` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:452](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:452](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L452)
|
|
6
6
|
|
|
7
7
|
Extracts the entity type from a mutation definition or identifier.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **MutationIdentifier**\<`T`, `I`, `R`\> = [`MutationDefinition`](MutationDefinition.md)\<`T`, `I`, `R`\> & `Readonly`\<\{ `key`: `string`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:442](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:442](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L442)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **MutationInput**\<`M`\> = `M` *extends* `__MutationInputAnchor`\<infer I\> ? `I` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:446](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:446](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L446)
|
|
6
6
|
|
|
7
7
|
Extracts the input type from a mutation definition or identifier.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **MutationResult**\<`M`\> = `M` *extends* `__MutationResultAnchor`\<infer R\> ? `R` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:449](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:449](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L449)
|
|
6
6
|
|
|
7
7
|
Extracts the result type from a mutation definition or identifier.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **NodesItem**\<`V`\> = `Readonly`\<\{ `ids`: `ReadonlyArray`\<`string` \| `number`\>; `view`: `V`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:334](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:334](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L334)
|
|
6
6
|
|
|
7
7
|
Definition of a node request with explicit IDs for fetching data from the backend.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Pagination** = `object`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:124](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:124](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L124)
|
|
6
6
|
|
|
7
7
|
Pagination state returned alongside connection lists.
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ Pagination state returned alongside connection lists.
|
|
|
12
12
|
|
|
13
13
|
> **hasNext**: `boolean`
|
|
14
14
|
|
|
15
|
-
Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/blob/
|
|
15
|
+
Defined in: [packages/fate/src/types.ts:125](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/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
|
> **hasPrevious**: `boolean`
|
|
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/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L126)
|
|
24
24
|
|
|
25
25
|
***
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ Defined in: [packages/fate/src/types.ts:126](https://github.com/nkzw-tech/fate/b
|
|
|
28
28
|
|
|
29
29
|
> `optional` **nextCursor?**: `string`
|
|
30
30
|
|
|
31
|
-
Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/
|
|
31
|
+
Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L127)
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
@@ -36,4 +36,4 @@ Defined in: [packages/fate/src/types.ts:127](https://github.com/nkzw-tech/fate/b
|
|
|
36
36
|
|
|
37
37
|
> `optional` **previousCursor?**: `string`
|
|
38
38
|
|
|
39
|
-
Defined in: [packages/fate/src/types.ts:128](https://github.com/nkzw-tech/fate/blob/
|
|
39
|
+
Defined in: [packages/fate/src/types.ts:128](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L128)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **Request** = `Record`\<`string`, `RequestItem`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:346](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:346](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L346)
|
|
6
6
|
|
|
7
7
|
Collection of node and list requests describing the data a screen needs.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **RequestMode** = `"cache-first"` \| `"stale-while-revalidate"` \| `"network-only"`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/client.ts:73](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/client.ts:73](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/client.ts#L73)
|
|
6
6
|
|
|
7
7
|
Strategy used when resolving a request.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **RequestOptions** = `Readonly`\<\{ `mode?`: [`RequestMode`](RequestMode.md); \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/client.ts:84](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/client.ts:84](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/client.ts#L84)
|
|
6
6
|
|
|
7
7
|
Request options that affect how requests are fetched and retained.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **RequestResult**\<`R`, `Q`\> = `{ [K in keyof Q]: K extends keyof R ? ListResult<Q[K], RootType<R[K]>, RootResult<R[K]>> : never }`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:392](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:392](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L392)
|
|
6
6
|
|
|
7
7
|
The result of a `FateClient.request` and `useRequest` call, mapping each
|
|
8
8
|
request key to its corresponding result.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Selection**\<`T`\> = `SelectionShape`\<`T`\> & `SelectionViewSpread`\<`T`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:199](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:199](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L199)
|
|
6
6
|
|
|
7
7
|
Declarative selection of the fields a view needs from an entity.
|
|
8
8
|
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **Snapshot** = `Readonly`\<\{ `mask?`: `FieldMask`; `record?`: [`FateRecord`](FateRecord.md); \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:481](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:481](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L481)
|
|
6
6
|
|
|
7
7
|
Snapshot captured before mutating the cache, used to roll back on errors.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **TypeConfig** = `object`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:117](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:117](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L117)
|
|
6
6
|
|
|
7
7
|
Configuration for a server entity type used by the client cache.
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ Configuration for a server entity type used by the client cache.
|
|
|
12
12
|
|
|
13
13
|
> `optional` **fields?**: `Record`\<`string`, `RelationDescriptor`\>
|
|
14
14
|
|
|
15
|
-
Defined in: [packages/fate/src/types.ts:118](https://github.com/nkzw-tech/fate/blob/
|
|
15
|
+
Defined in: [packages/fate/src/types.ts:118](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L118)
|
|
16
16
|
|
|
17
17
|
***
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ Defined in: [packages/fate/src/types.ts:118](https://github.com/nkzw-tech/fate/b
|
|
|
20
20
|
|
|
21
21
|
> **getId**: (`record`) => `string` \| `number`
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/fate/src/types.ts:119](https://github.com/nkzw-tech/fate/blob/
|
|
23
|
+
Defined in: [packages/fate/src/types.ts:119](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L119)
|
|
24
24
|
|
|
25
25
|
#### Parameters
|
|
26
26
|
|
|
@@ -38,4 +38,4 @@ Defined in: [packages/fate/src/types.ts:119](https://github.com/nkzw-tech/fate/b
|
|
|
38
38
|
|
|
39
39
|
> **type**: `string`
|
|
40
40
|
|
|
41
|
-
Defined in: [packages/fate/src/types.ts:120](https://github.com/nkzw-tech/fate/blob/
|
|
41
|
+
Defined in: [packages/fate/src/types.ts:120](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L120)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **View**\<`T`, `S`\> = `Readonly`\<\{\[`viewTag`: `` `__fate-view__${string}` ``\]: `Readonly`\<\{ `[ViewKind]`: `true`; `select`: `S`; \}\>; \}\> & `__ViewEntityAnchor`\<`T`\> & `__ViewSelectionAnchor`\<`S`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:215](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:215](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L215)
|
|
6
6
|
|
|
7
7
|
Definition of a view over an entity type, including the selection of fields.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewData**\<`T`, `S`\> = `Readonly`\<`S` *extends* [`Selection`](Selection.md)\<`T`\> ? [`Mask`](Mask.md)\<`T`, `S`\> : `T` & `object`\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:231](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:231](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L231)
|
|
6
6
|
|
|
7
7
|
Data returned from a resolved view with masking applied and view tags
|
|
8
8
|
attached for downstream composition.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewEntity**\<`V`\> = `V` *extends* [`View`](View.md)\<infer T, `any`\> ? `T` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:303](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:303](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L303)
|
|
6
6
|
|
|
7
7
|
Entity type captured from a view definition.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewEntityName**\<`V`\> = [`ViewEntity`](ViewEntity.md)\<`V`\>\[`"__typename"`\] & `string`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:306](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:306](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L306)
|
|
6
6
|
|
|
7
7
|
Name of the entity type captured from a view definition.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewRef**\<`TName`\> = `Readonly`\<\{ `__typename`: `TName`; `[ViewsTag]`: `Set`\<`string`\>; `id`: `string` \| `number`; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:101](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:101](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L101)
|
|
6
6
|
|
|
7
7
|
Reference to a normalized entity instance that can be resolved against one or more view tags.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewSelection**\<`V`\> = `V` *extends* `object` ? `S` : `never`
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:309](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:309](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L309)
|
|
6
6
|
|
|
7
7
|
Selection captured from a view definition.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewSnapshot**\<`T`, `S`\> = `Readonly`\<\{ `coverage`: `ReadonlyArray`\<readonly \[[`EntityId`](EntityId.md), `ReadonlySet`\<`string`\>\]\>; `data`: [`ViewData`](ViewData.md)\<`T`, `S`\>; \}\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:241](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:241](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L241)
|
|
6
6
|
|
|
7
7
|
Snapshot returned by the cache for a view, including the masked data and all
|
|
8
8
|
referenced entity IDs.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> **ViewTag** = `` `__fate-view__${string}` ``
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/fate/src/types.ts:49](https://github.com/nkzw-tech/fate/blob/
|
|
5
|
+
Defined in: [packages/fate/src/types.ts:49](https://github.com/nkzw-tech/fate/blob/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L49)
|
|
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/a371a1ba3412f80c3471be587e73a3b0df92d690/packages/fate/src/types.ts#L20)
|
|
6
6
|
|
|
7
7
|
Symbol attached to connection results so pagination helpers can find their metadata.
|
package/lib/server/drizzle.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as isRecord } from "../record-AeZJC9fd.mjs";
|
|
2
2
|
import { O as withConnection, S as isDataView, c as resolveSourceConnection, d as createSourceDefinitions, f as createSourcePlan, g as attachComputedState, i as createSourceRegistry, l as collectDataViewConfigs, o as resolveSourceById, p as getDataViewSourceConfig, s as resolveSourceByIds, t as bindSourceProcedures } from "../sourceRouter-C22uFcZg.mjs";
|
|
3
|
-
import { and, asc, createTableRelationsHelpers, desc, eq, extractTablesRelationalConfig, getTableColumns, gt, inArray, isTable, lt, normalizeRelation, or, sql } from "drizzle-orm";
|
|
3
|
+
import { Many, and, asc, createTableRelationsHelpers, desc, eq, extractTablesRelationalConfig, getTableColumns, gt, inArray, is, isTable, lt, normalizeRelation, or, sql } from "drizzle-orm";
|
|
4
4
|
//#region src/server/drizzle.ts
|
|
5
5
|
/**
|
|
6
6
|
* fate's Drizzle integration.
|
|
@@ -201,6 +201,51 @@ const inferDirectRelation = ({ field, metadata, sourceConfig, targetConfig }) =>
|
|
|
201
201
|
localKey: getColumnKey(sourceTableConfig.columns, normalized.fields[0])
|
|
202
202
|
};
|
|
203
203
|
};
|
|
204
|
+
const getComputedCountRelations = (view) => {
|
|
205
|
+
const relations = /* @__PURE__ */ new Set();
|
|
206
|
+
for (const field of Object.values(view.fields)) {
|
|
207
|
+
if (!isRecord(field) || field.kind !== "computed" || !isRecord(field.select)) continue;
|
|
208
|
+
for (const selection of Object.values(field.select)) if (isRecord(selection) && selection.kind === "count" && typeof selection.relation === "string") relations.add(selection.relation);
|
|
209
|
+
}
|
|
210
|
+
return relations;
|
|
211
|
+
};
|
|
212
|
+
const getTableConfigIfAvailable = ({ config, metadata }) => {
|
|
213
|
+
try {
|
|
214
|
+
return getTableConfig({
|
|
215
|
+
config,
|
|
216
|
+
metadata
|
|
217
|
+
});
|
|
218
|
+
} catch {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const inferHiddenCountRelation = ({ field, metadata, sourceConfig, viewConfigs }) => {
|
|
223
|
+
const sourceTableConfig = getTableConfigIfAvailable({
|
|
224
|
+
config: sourceConfig,
|
|
225
|
+
metadata
|
|
226
|
+
});
|
|
227
|
+
const relation = sourceTableConfig?.relations[field];
|
|
228
|
+
if (!sourceTableConfig || !relation || !is(relation, Many)) return null;
|
|
229
|
+
const normalized = normalizeRelation(metadata.schema, metadata.tableNamesMap, relation);
|
|
230
|
+
const localColumn = normalized.fields[0];
|
|
231
|
+
const foreignColumn = normalized.references[0];
|
|
232
|
+
if (!localColumn || !foreignColumn) return null;
|
|
233
|
+
for (const [index, targetConfig] of viewConfigs.entries()) {
|
|
234
|
+
const targetTableConfig = getTableConfigIfAvailable({
|
|
235
|
+
config: targetConfig,
|
|
236
|
+
metadata
|
|
237
|
+
});
|
|
238
|
+
if (!targetTableConfig || !includesColumn(targetTableConfig.columns, foreignColumn)) continue;
|
|
239
|
+
return {
|
|
240
|
+
index,
|
|
241
|
+
relation: {
|
|
242
|
+
foreignKey: getColumnKey(targetTableConfig.columns, foreignColumn),
|
|
243
|
+
localKey: getColumnKey(sourceTableConfig.columns, localColumn)
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return null;
|
|
248
|
+
};
|
|
204
249
|
const inferManyToManyRelation = ({ field, metadata, sourceConfig, targetConfig }) => {
|
|
205
250
|
const sourceTableConfig = getTableConfig({
|
|
206
251
|
config: sourceConfig,
|
|
@@ -298,6 +343,28 @@ function createDrizzleSourceAdapter({ db, nestedPaginationConcurrency, schema, v
|
|
|
298
343
|
targetConfig
|
|
299
344
|
}) : void 0) ?? void 0;
|
|
300
345
|
} });
|
|
346
|
+
if (metadata) for (const [index, config] of viewConfigs.entries()) {
|
|
347
|
+
const source = sourceDefinitions[index];
|
|
348
|
+
for (const field of getComputedCountRelations(config.view)) {
|
|
349
|
+
if (source.relations?.[field]) continue;
|
|
350
|
+
const hidden = inferHiddenCountRelation({
|
|
351
|
+
field,
|
|
352
|
+
metadata,
|
|
353
|
+
sourceConfig: config,
|
|
354
|
+
viewConfigs
|
|
355
|
+
});
|
|
356
|
+
const targetSource = hidden && sourceDefinitions[hidden.index];
|
|
357
|
+
if (!hidden || !targetSource) continue;
|
|
358
|
+
source.relations = {
|
|
359
|
+
...source.relations,
|
|
360
|
+
[field]: {
|
|
361
|
+
...hidden.relation,
|
|
362
|
+
kind: "many",
|
|
363
|
+
source: targetSource
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
301
368
|
const sourcesByView = new Map(sourceDefinitions.map((source) => [source.view, source]));
|
|
302
369
|
const sourcesByFields = new Map(sourceDefinitions.map((source) => [source.view.fields, source]));
|
|
303
370
|
const sourceConfigs = new Map(viewConfigs.map((config, index) => [sourceDefinitions[index], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkzw/fate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "fate is a modern data client for React.",
|
|
5
5
|
"homepage": "https://github.com/nkzw-tech/fate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@trpc/client": "^11.17.0",
|
|
73
73
|
"@trpc/server": "^11.17.0",
|
|
74
74
|
"drizzle-orm": "^0.45.2",
|
|
75
|
-
"vite": "^8.0.
|
|
75
|
+
"vite": "^8.0.13"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@trpc/client": "^11.6.0",
|