@nkzw/fate 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +1220 -147
  2. package/docs/api/classes/FateClient.md +134 -40
  3. package/docs/api/functions/clientRoot.md +1 -1
  4. package/docs/api/functions/createClient.md +8 -4
  5. package/docs/api/functions/createGraphQLTransport.md +21 -0
  6. package/docs/api/functions/createHTTPTransport.md +1 -1
  7. package/docs/api/functions/createTRPCTransport.md +1 -1
  8. package/docs/api/functions/defer.md +21 -0
  9. package/docs/api/functions/getDeferredMetadata.md +21 -0
  10. package/docs/api/functions/getListEntries.md +1 -1
  11. package/docs/api/functions/getSelectionPlan.md +1 -1
  12. package/docs/api/functions/graphqlMutation.md +39 -0
  13. package/docs/api/functions/isDeferred.md +15 -0
  14. package/docs/api/functions/isRecord.md +1 -1
  15. package/docs/api/functions/isViewTag.md +1 -1
  16. package/docs/api/functions/liveConnectionTopic.md +1 -1
  17. package/docs/api/functions/liveEntityTopic.md +1 -1
  18. package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
  19. package/docs/api/functions/mutation.md +1 -1
  20. package/docs/api/functions/toEntityId.md +1 -1
  21. package/docs/api/functions/view.md +1 -1
  22. package/docs/api/index.md +19 -0
  23. package/docs/api/interfaces/FateThenable.md +3 -3
  24. package/docs/api/interfaces/Transport.md +7 -7
  25. package/docs/api/server/classes/FateRequestError.md +5 -5
  26. package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
  27. package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
  28. package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
  29. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
  30. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
  31. package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
  32. package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
  33. package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
  34. package/docs/api/server/functions/bindSourceProcedures.md +1 -1
  35. package/docs/api/server/functions/computed.md +1 -1
  36. package/docs/api/server/functions/count.md +1 -1
  37. package/docs/api/server/functions/createFateFetchHandler.md +1 -1
  38. package/docs/api/server/functions/createFateServer.md +1 -1
  39. package/docs/api/server/functions/createHonoFateHandler.md +1 -1
  40. package/docs/api/server/functions/createLiveEventBus.md +1 -1
  41. package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
  42. package/docs/api/server/functions/createResolver.md +1 -1
  43. package/docs/api/server/functions/createSourcePlan.md +1 -1
  44. package/docs/api/server/functions/createSourceProcedures.md +1 -1
  45. package/docs/api/server/functions/dataView.md +1 -1
  46. package/docs/api/server/functions/field.md +1 -1
  47. package/docs/api/server/functions/getNestedSelection.md +1 -1
  48. package/docs/api/server/functions/getScopedArgs.md +1 -1
  49. package/docs/api/server/functions/hasNestedSelection.md +1 -1
  50. package/docs/api/server/functions/list.md +1 -1
  51. package/docs/api/server/functions/refetchSourceById.md +1 -1
  52. package/docs/api/server/functions/resolveSourceById.md +1 -1
  53. package/docs/api/server/functions/resolveSourceByIds.md +1 -1
  54. package/docs/api/server/functions/resolveSourceConnection.md +1 -1
  55. package/docs/api/server/functions/resolver.md +1 -1
  56. package/docs/api/server/functions/toPrismaSelect.md +1 -1
  57. package/docs/api/server/functions/withConnection.md +1 -1
  58. package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
  59. package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
  60. package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
  61. package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
  62. package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
  63. package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
  64. package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
  65. package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
  66. package/docs/api/server/type-aliases/ComputedField.md +5 -5
  67. package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
  68. package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
  69. package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
  70. package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
  71. package/docs/api/server/type-aliases/CountSelection.md +4 -4
  72. package/docs/api/server/type-aliases/CountWhere.md +1 -1
  73. package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
  74. package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
  75. package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
  76. package/docs/api/server/type-aliases/DataViewResult.md +1 -1
  77. package/docs/api/server/type-aliases/Entity.md +1 -1
  78. package/docs/api/server/type-aliases/FateServer.md +5 -5
  79. package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
  80. package/docs/api/server/type-aliases/FieldSelection.md +3 -3
  81. package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
  82. package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
  83. package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
  84. package/docs/api/server/type-aliases/LiveEventType.md +1 -1
  85. package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
  86. package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
  87. package/docs/api/server/type-aliases/OrderDirection.md +1 -1
  88. package/docs/api/server/type-aliases/SourceConfig.md +6 -6
  89. package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
  90. package/docs/api/server/type-aliases/SourceOrder.md +1 -1
  91. package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
  92. package/docs/api/server/type-aliases/SourcePlan.md +1 -1
  93. package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
  94. package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
  95. package/docs/api/server/type-aliases/SourceRelation.md +1 -1
  96. package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
  97. package/docs/api/server/variables/byIdInput.md +1 -1
  98. package/docs/api/server/variables/connectionArgs.md +1 -1
  99. package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
  100. package/docs/api/type-aliases/ConnectionRef.md +1 -1
  101. package/docs/api/type-aliases/Deferred.md +19 -0
  102. package/docs/api/type-aliases/DeferredMetadata.md +7 -0
  103. package/docs/api/type-aliases/DeferredSelection.md +13 -0
  104. package/docs/api/type-aliases/DeferredSnapshot.md +11 -0
  105. package/docs/api/type-aliases/Entity.md +2 -2
  106. package/docs/api/type-aliases/EntityId.md +1 -1
  107. package/docs/api/type-aliases/FateDehydratedState.md +11 -0
  108. package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
  109. package/docs/api/type-aliases/FateLiveEvent.md +1 -1
  110. package/docs/api/type-aliases/FateMutations.md +1 -1
  111. package/docs/api/type-aliases/FateOperation.md +1 -1
  112. package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
  113. package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
  114. package/docs/api/type-aliases/FateRecord.md +1 -1
  115. package/docs/api/type-aliases/FateRoots.md +1 -1
  116. package/docs/api/type-aliases/GraphQLMutationDefinition.md +19 -0
  117. package/docs/api/type-aliases/GraphQLMutationInput.md +11 -0
  118. package/docs/api/type-aliases/GraphQLMutationMap.md +11 -0
  119. package/docs/api/type-aliases/GraphQLMutationOutput.md +11 -0
  120. package/docs/api/type-aliases/GraphQLTransportOptions.md +119 -0
  121. package/docs/api/type-aliases/HydrateOptions.md +7 -0
  122. package/docs/api/type-aliases/HydrationLimits.md +7 -0
  123. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  124. package/docs/api/type-aliases/List.md +1 -1
  125. package/docs/api/type-aliases/ListEntry.md +1 -1
  126. package/docs/api/type-aliases/ListItem.md +1 -1
  127. package/docs/api/type-aliases/Mask.md +1 -1
  128. package/docs/api/type-aliases/MutationDefinition.md +1 -1
  129. package/docs/api/type-aliases/MutationEntity.md +1 -1
  130. package/docs/api/type-aliases/MutationIdentifier.md +1 -1
  131. package/docs/api/type-aliases/MutationInput.md +1 -1
  132. package/docs/api/type-aliases/MutationResult.md +1 -1
  133. package/docs/api/type-aliases/NodesItem.md +1 -1
  134. package/docs/api/type-aliases/Pagination.md +5 -5
  135. package/docs/api/type-aliases/Request.md +1 -1
  136. package/docs/api/type-aliases/RequestMode.md +1 -1
  137. package/docs/api/type-aliases/RequestOptions.md +1 -1
  138. package/docs/api/type-aliases/RequestResult.md +1 -1
  139. package/docs/api/type-aliases/Selection.md +1 -1
  140. package/docs/api/type-aliases/Snapshot.md +1 -1
  141. package/docs/api/type-aliases/TypeConfig.md +4 -4
  142. package/docs/api/type-aliases/View.md +1 -1
  143. package/docs/api/type-aliases/ViewData.md +1 -1
  144. package/docs/api/type-aliases/ViewEntity.md +1 -1
  145. package/docs/api/type-aliases/ViewEntityName.md +1 -1
  146. package/docs/api/type-aliases/ViewRef.md +1 -1
  147. package/docs/api/type-aliases/ViewSelection.md +1 -1
  148. package/docs/api/type-aliases/ViewSnapshot.md +1 -1
  149. package/docs/api/type-aliases/ViewTag.md +1 -1
  150. package/docs/api/variables/ConnectionTag.md +1 -1
  151. package/docs/api/variables/DeferTag.md +7 -0
  152. package/docs/api/variables/DeferredTag.md +7 -0
  153. package/docs/guide/actions.md +7 -7
  154. package/docs/guide/deferred-views.md +62 -0
  155. package/docs/guide/getting-started.md +21 -3
  156. package/docs/guide/requests.md +52 -0
  157. package/docs/guide/vue.md +256 -0
  158. package/docs/index.md +1 -0
  159. package/docs/integrations/graphql.md +345 -0
  160. package/docs/{guide/server-integration.md → integrations/server.md} +94 -7
  161. package/docs/{guide/void-integration.md → integrations/void.md} +94 -12
  162. package/lib/{executor-BqwHdN3n.d.mts → executor-Dh-MLUXc.d.mts} +1 -1
  163. package/lib/graphqlTransport-B3cbhvJX.d.mts +74 -0
  164. package/lib/graphqlTransport-IFgmY-Qq.mjs +499 -0
  165. package/lib/graphqlTransport.d.mts +2 -0
  166. package/lib/graphqlTransport.mjs +2 -0
  167. package/lib/index.d.mts +10 -4
  168. package/lib/index.mjs +619 -91
  169. package/lib/{list-4wRNSVgI.d.mts → list-BrL6PD_6.d.mts} +1 -1
  170. package/lib/list.d.mts +1 -1
  171. package/lib/list.mjs +1 -1
  172. package/lib/{liveTopics-DzNtJaBD.mjs → liveTopics-JIDh3t3P.mjs} +1 -1
  173. package/lib/{record-CirbfZWX.d.mts → record-BkvZwvFk.d.mts} +2 -2
  174. package/lib/server/drizzle.d.mts +6 -8
  175. package/lib/server/drizzle.mjs +2 -2
  176. package/lib/server/prisma.d.mts +6 -8
  177. package/lib/server/prisma.mjs +2 -2
  178. package/lib/server.d.mts +3 -3
  179. package/lib/server.mjs +3 -3
  180. package/lib/{sourceRouter-C22uFcZg.mjs → sourceRouter-N9Vp0Cj6.mjs} +1 -1
  181. package/lib/{types-Dz46PXr3.d.mts → transport-BjGm__3t.d.mts} +246 -145
  182. package/lib/vite.d.mts +2 -2
  183. package/lib/vite.mjs +150 -3
  184. package/package.json +11 -3
  185. /package/lib/{list-C_mi6GnE.mjs → list-_6fXYLtJ.mjs} +0 -0
  186. /package/lib/{record-AeZJC9fd.mjs → record-B07VwXd-.mjs} +0 -0
@@ -1,9 +1,10 @@
1
1
  # Server Integration
2
2
 
3
- Until now, we have focused on the client-side API of fate. You'll need a backend that follows fate's data protocol so the Vite plugin can wire the typed fate APIs into your app. _fate_ currently ships two server paths:
3
+ Until now, we have focused on the client-side API of fate. You'll need a backend that can be wired into fate's typed request model so the Vite plugin can connect the typed fate APIs to your app. _fate_ currently ships three integration paths:
4
4
 
5
5
  - The native fate protocol, which is transport-agnostic and can be hosted by any Fetch-compatible server.
6
6
  - The tRPC adapter, which keeps compatibility with existing tRPC backends.
7
+ - The [GraphQL transport](graphql.md), which maps fate views and roots to an existing GraphQL schema.
7
8
 
8
9
  _fate_ currently provides database adapters for Prisma and Drizzle, but the framework itself is not coupled to a particular ORM. The adapters plug into the same source execution runtime and can be exposed through the native protocol or through tRPC.
9
10
 
@@ -184,7 +185,9 @@ app.post('/fate/live', handler);
184
185
 
185
186
  Configure the Vite plugin with the native transport:
186
187
 
187
- ```tsx
188
+ ::: code-group
189
+
190
+ ```tsx [React]
188
191
  import { fate } from 'react-fate/vite';
189
192
  import { defineConfig } from 'vite';
190
193
 
@@ -198,9 +201,29 @@ export default defineConfig({
198
201
  });
199
202
  ```
200
203
 
204
+ ```ts [Vue]
205
+ import vue from '@vitejs/plugin-vue';
206
+ import { fate } from 'vue-fate/vite';
207
+ import { defineConfig } from 'vite';
208
+
209
+ export default defineConfig({
210
+ plugins: [
211
+ vue(),
212
+ fate({
213
+ module: '@your-org/server/fate.ts',
214
+ transport: 'native',
215
+ }),
216
+ ],
217
+ });
218
+ ```
219
+
220
+ :::
221
+
201
222
  With the native transport, the Vite plugin handles the HTTP transport setup. If you need to create a client manually, use `createFateClient` with the same route:
202
223
 
203
- ```tsx
224
+ ::: code-group
225
+
226
+ ```tsx [React]
204
227
  import { createFateClient } from 'react-fate/client';
205
228
 
206
229
  const client = createFateClient({
@@ -208,6 +231,16 @@ const client = createFateClient({
208
231
  });
209
232
  ```
210
233
 
234
+ ```ts [Vue]
235
+ import { createFateClient } from 'vue-fate/client';
236
+
237
+ const client = createFateClient({
238
+ url: '/fate',
239
+ });
240
+ ```
241
+
242
+ :::
243
+
211
244
  The HTTP transport batches operations issued in the same microtask into one `POST /fate` request. Live views use one `GET /fate/live` SSE stream per fate client and `POST /fate/live` control messages when views subscribe or unsubscribe.
212
245
 
213
246
  ### Custom Queries
@@ -584,7 +617,9 @@ export * from './views.ts';
584
617
 
585
618
  Configure the fate Vite plugin with your server module:
586
619
 
587
- ```tsx
620
+ ::: code-group
621
+
622
+ ```tsx [React]
588
623
  import { fate } from 'react-fate/vite';
589
624
  import { defineConfig } from 'vite';
590
625
 
@@ -597,11 +632,28 @@ export default defineConfig({
597
632
  });
598
633
  ```
599
634
 
635
+ ```ts [Vue]
636
+ import vue from '@vitejs/plugin-vue';
637
+ import { fate } from 'vue-fate/vite';
638
+ import { defineConfig } from 'vite';
639
+
640
+ export default defineConfig({
641
+ plugins: [
642
+ vue(),
643
+ fate({
644
+ module: '@your-org/server/trpc/router.ts',
645
+ }),
646
+ ],
647
+ });
648
+ ```
649
+
650
+ :::
651
+
600
652
  _Note: fate uses the specified server module name to find the server types it needs. Make sure that the module is available to the client package's Vite config._
601
653
 
602
654
  During development, the plugin watches the server module and the files it imports. When one of those files changes, fate updates the internal client wiring and invalidates `@nkzw/fate/client` in Vite's module graph.
603
655
 
604
- For a barebones client without React, import the plugin from `@nkzw/fate/vite` and the client APIs from `@nkzw/fate/client`. The plugin wires the same server types for the selected import path.
656
+ For a barebones client without a framework adapter, import the plugin from `@nkzw/fate/vite` and the client APIs from `@nkzw/fate/client`. The plugin wires the same server types for the selected import path.
605
657
 
606
658
  The plugin writes project-local types under `.fate/`. If your TypeScript config does not already include dot-directories, extend the generated config:
607
659
 
@@ -613,9 +665,11 @@ The plugin writes project-local types under `.fate/`. If your TypeScript config
613
665
 
614
666
  ## Creating a _fate_ Client
615
667
 
616
- Now that the Vite plugin has connected the types, create a fate client instance and provide it to your React app with the `FateClient` context provider:
668
+ Now that the Vite plugin has connected the types, create a fate client instance and provide it to your app with the `FateClient` provider:
617
669
 
618
- ```tsx
670
+ ::: code-group
671
+
672
+ ```tsx [React]
619
673
  import { httpBatchLink } from '@trpc/client';
620
674
  import { FateClient } from 'react-fate';
621
675
  import { createFateClient } from 'react-fate/client';
@@ -641,4 +695,37 @@ export function App() {
641
695
  }
642
696
  ```
643
697
 
698
+ ```vue [Vue]
699
+ <script setup lang="ts">
700
+ import { httpBatchLink } from '@trpc/client';
701
+ import { computed } from 'vue';
702
+ import { FateClient } from 'vue-fate';
703
+ import { createFateClient } from 'vue-fate/client';
704
+ import AppRoutes from './AppRoutes.vue';
705
+
706
+ const fate = computed(() =>
707
+ createFateClient({
708
+ links: [
709
+ httpBatchLink({
710
+ fetch: (input, init) =>
711
+ fetch(input, {
712
+ ...init,
713
+ credentials: 'include',
714
+ }),
715
+ url: `${env('SERVER_URL')}/trpc`,
716
+ }),
717
+ ],
718
+ }),
719
+ );
720
+ </script>
721
+
722
+ <template>
723
+ <FateClient :client="fate">
724
+ <AppRoutes />
725
+ </FateClient>
726
+ </template>
727
+ ```
728
+
729
+ :::
730
+
644
731
  _And you are all set. Happy building!_
@@ -7,15 +7,25 @@ setup without copying its adapter glue.
7
7
 
8
8
  ## Install
9
9
 
10
- ```sh
11
- pnpm add @nkzw/fate react-fate void-fate void
10
+ ::: code-group
11
+
12
+ ```sh [React]
13
+ pnpm add @nkzw/fate react-fate void-fate void @void/react
14
+ ```
15
+
16
+ ```sh [Vue]
17
+ pnpm add @nkzw/fate vue-fate void-fate void @void/vue
12
18
  ```
13
19
 
20
+ :::
21
+
14
22
  ## Vite
15
23
 
16
- Use the regular `react-fate` Vite plugin with the Void transport:
24
+ Use the framework adapter's Vite plugin with the Void transport:
17
25
 
18
- ```tsx
26
+ ::: code-group
27
+
28
+ ```tsx [React]
19
29
  import { voidReact } from '@void/react/plugin';
20
30
  import { fate } from 'react-fate/vite';
21
31
  import { defineConfig } from 'vite-plus';
@@ -33,6 +43,26 @@ export default defineConfig({
33
43
  });
34
44
  ```
35
45
 
46
+ ```ts [Vue]
47
+ import { voidVue } from '@void/vue/plugin';
48
+ import { fate } from 'vue-fate/vite';
49
+ import { defineConfig } from 'vite-plus';
50
+ import { voidPlugin } from 'void';
51
+
52
+ export default defineConfig({
53
+ plugins: [
54
+ voidPlugin(),
55
+ voidVue(),
56
+ fate({
57
+ module: './src/fate/server.ts',
58
+ transport: 'void',
59
+ }),
60
+ ],
61
+ });
62
+ ```
63
+
64
+ :::
65
+
36
66
  The Void transport uses `/fate` for RPC requests and `/fate-live` for live
37
67
  updates by default. In SSR, it calls the exported fate server directly. In the
38
68
  browser, it uses fetch and the SSE live endpoint.
@@ -104,12 +134,14 @@ export const { GET, POST } = defineVoidFateLiveRoute(fateServer, fateLive);
104
134
  The live route handles `GET /fate-live` SSE connections and `POST /fate-live`
105
135
  control messages. `void-fate` does not use WebSockets.
106
136
 
107
- ## React Layout
137
+ ## Layout
108
138
 
109
- Wrap your app with `VoidFateClient` from `void-fate/react`. It creates and
110
- provides the fate client through `react-fate`:
139
+ Wrap your app with the Void fate client for your framework. It creates and
140
+ provides the fate client through the matching adapter.
111
141
 
112
- ```tsx
142
+ ::: code-group
143
+
144
+ ```tsx [React]
113
145
  import { useShared } from '@void/react';
114
146
  import type { ReactNode } from 'react';
115
147
  import { VoidFateClient } from 'void-fate/react';
@@ -128,9 +160,36 @@ export default function Layout({ children }: { children: ReactNode }) {
128
160
  }
129
161
  ```
130
162
 
131
- `userId` is optional, but passing it lets `VoidFateClient` recreate the client
132
- when the signed-in user changes. Browser requests include credentials when a
133
- `userId` is present.
163
+ ```vue [Vue]
164
+ <script setup lang="ts">
165
+ import { useShared } from '@void/vue';
166
+ import { computed } from 'vue';
167
+ import { FateClient } from 'vue-fate';
168
+ import { createFateClient } from 'vue-fate/client';
169
+ import type { SharedData } from '../src/lib/shared.ts';
170
+
171
+ const shared = useShared<SharedData>();
172
+
173
+ const fate = computed(() =>
174
+ createFateClient({
175
+ origin: typeof window === 'undefined' ? shared.origin : window.location.origin,
176
+ userId: shared.auth.user?.id,
177
+ }),
178
+ );
179
+ </script>
180
+
181
+ <template>
182
+ <FateClient :client="fate">
183
+ <slot />
184
+ </FateClient>
185
+ </template>
186
+ ```
187
+
188
+ :::
189
+
190
+ `userId` is optional, but passing it lets the client be recreated when the
191
+ signed-in user changes. Browser requests include credentials when a `userId` is
192
+ present.
134
193
 
135
194
  ## Custom Paths
136
195
 
@@ -143,12 +202,35 @@ export const fateLive = createVoidFateLive({
143
202
  });
144
203
  ```
145
204
 
146
- ```tsx
205
+ ::: code-group
206
+
207
+ ```tsx [React]
147
208
  <VoidFateClient livePath="/custom-fate-live" origin={origin} rpcPath="/custom-fate" userId={userId}>
148
209
  {children}
149
210
  </VoidFateClient>
150
211
  ```
151
212
 
213
+ ```vue [Vue]
214
+ <script setup lang="ts">
215
+ const fate = computed(() =>
216
+ createFateClient({
217
+ livePath: '/custom-fate-live',
218
+ origin,
219
+ rpcPath: '/custom-fate',
220
+ userId,
221
+ }),
222
+ );
223
+ </script>
224
+
225
+ <template>
226
+ <FateClient :client="fate">
227
+ <slot />
228
+ </FateClient>
229
+ </template>
230
+ ```
231
+
232
+ :::
233
+
152
234
  The route helper does not own the route path. Make sure your Void route filename
153
235
  or router configuration matches the paths you pass to the client.
154
236
 
@@ -1,4 +1,4 @@
1
- import { q as QueryProcedure, t as AnyRecord } from "./types-Dz46PXr3.mjs";
1
+ import { r as AnyRecord, rt as QueryProcedure } from "./transport-BjGm__3t.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/server/dataView.d.ts
@@ -0,0 +1,74 @@
1
+ import { C as MutationShape, f as Entity, j as TypeConfig, t as Transport } from "./transport-BjGm__3t.mjs";
2
+
3
+ //#region src/graphqlTransport.d.ts
4
+ type TransportMutations = Record<string, MutationShape>;
5
+ type EmptyTransportMutations = Record<never, MutationShape>;
6
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
7
+ type HeadersFactory = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
8
+ type EventSourceConstructor = new (url: string, options?: {
9
+ withCredentials?: boolean;
10
+ }) => {
11
+ addEventListener(type: string, listener: (event: Event) => void): void;
12
+ close(): void;
13
+ removeEventListener(type: string, listener: (event: Event) => void): void;
14
+ };
15
+ type GraphQLRootConfig = {
16
+ connection?: 'relay';
17
+ field?: string;
18
+ type: string;
19
+ };
20
+ type GraphQLMutationDefinition<T extends Entity = Entity, Input = unknown, Output = unknown> = Readonly<{
21
+ __fateGraphQLMutation?: {
22
+ input: Input;
23
+ output: Output;
24
+ };
25
+ entity: T['__typename'];
26
+ field: string;
27
+ inputArg?: false | string;
28
+ }>;
29
+ type GraphQLMutationInput<Definition> = Definition extends GraphQLMutationDefinition<any, infer Input, any> ? Input : never;
30
+ type GraphQLMutationOutput<Definition> = Definition extends GraphQLMutationDefinition<any, any, infer Output> ? Output : never;
31
+ type GraphQLMutationMap<Mutations> = Mutations extends Record<string, GraphQLMutationDefinition> ? { [K in keyof Mutations]: {
32
+ input: GraphQLMutationInput<Mutations[K]>;
33
+ output: GraphQLMutationOutput<Mutations[K]>;
34
+ } } : EmptyTransportMutations;
35
+ type GraphQLMutationRuntimeConfig = {
36
+ entity: string;
37
+ field: string;
38
+ inputArg?: false | string;
39
+ };
40
+ type GraphQLLiveOptions = {
41
+ connectionField?: string;
42
+ entityField?: string;
43
+ url?: string | URL;
44
+ withCredentials?: boolean;
45
+ };
46
+ type GraphQLTransportOptions<Mutations extends TransportMutations = EmptyTransportMutations> = {
47
+ decodeNodeId?: (type: string, id: string | number) => string | number;
48
+ encodeNodeId?: (type: string, id: string | number) => string | number;
49
+ eventSource?: EventSourceConstructor;
50
+ fetch?: FetchLike;
51
+ headers?: HeadersFactory;
52
+ live?: boolean | GraphQLLiveOptions;
53
+ mutations?: Record<Extract<keyof Mutations, string>, GraphQLMutationRuntimeConfig>;
54
+ roots?: Record<string, GraphQLRootConfig>;
55
+ types: ReadonlyArray<Omit<TypeConfig, 'getId'> & Partial<Pick<TypeConfig, 'getId'>>>;
56
+ url: string | URL;
57
+ };
58
+ declare function graphqlMutation<T extends Entity, Input, Output>(entity: T['__typename'], options: {
59
+ field: string;
60
+ inputArg?: false | string;
61
+ }): GraphQLMutationDefinition<T, Input, Output>;
62
+ declare function createGraphQLTransport<Mutations extends TransportMutations = EmptyTransportMutations>({
63
+ decodeNodeId,
64
+ encodeNodeId,
65
+ fetch: fetchImpl,
66
+ headers,
67
+ live,
68
+ mutations,
69
+ roots,
70
+ types: typeConfigs,
71
+ url
72
+ }: GraphQLTransportOptions<Mutations>): Transport<Mutations>;
73
+ //#endregion
74
+ export { GraphQLTransportOptions as a, GraphQLMutationOutput as i, GraphQLMutationInput as n, createGraphQLTransport as o, GraphQLMutationMap as r, graphqlMutation as s, GraphQLMutationDefinition as t };