@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
package/lib/vite.mjs CHANGED
@@ -68,7 +68,23 @@ const formatTypes = (types) => {
68
68
  return lines.join("\n");
69
69
  };
70
70
  const indentBlock = (value, spaces) => value.split("\n").map((line) => line.length ? `${" ".repeat(spaces)}${line}` : line).join("\n");
71
+ const compareStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
72
+ const canonicalizeHydrationScopeValue = (value) => {
73
+ if (Array.isArray(value)) return value.map(canonicalizeHydrationScopeValue);
74
+ if (!value || typeof value !== "object") return value;
75
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareStrings(left, right)).map(([key, entry]) => [key, canonicalizeHydrationScopeValue(entry)]));
76
+ };
77
+ const getHydrationScope = (moduleName, roots, types) => JSON.stringify(canonicalizeHydrationScopeValue({
78
+ moduleName,
79
+ roots,
80
+ types: [...types].sort((left, right) => compareStrings(left.type, right.type))
81
+ }));
71
82
  const createClientSource = ({ clientModule = "react-fate", moduleExports, moduleName, runtimeModuleName = moduleName, transport = "trpc" }) => {
83
+ if (transport === "graphql") return createGraphQLClientSource({
84
+ clientModule,
85
+ moduleExports,
86
+ moduleName
87
+ });
72
88
  if (transport === "native" || transport === "void") return createNativeClientSource({
73
89
  clientModule,
74
90
  moduleExports,
@@ -232,6 +248,7 @@ ${rootsBlock}
232
248
 
233
249
  export type GeneratedClientMutations = typeof mutations;
234
250
  export type GeneratedClientRoots = typeof roots;
251
+ const hydrationScope = ${JSON.stringify(getHydrationScope(moduleName, roots, types))} as const;
235
252
 
236
253
  export const createFateClient = (options: {
237
254
  links: Parameters<typeof createTRPCProxyClient>[0]['links'];
@@ -254,7 +271,8 @@ ${queriesBlock}${listsBlock} mutations: trpcMutations,
254
271
  });
255
272
  ${liveTransportAssignment}
256
273
 
257
- return createClient<[GeneratedClientRoots, GeneratedClientMutations]>({
274
+ return createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
275
+ hydrationScope,
258
276
  mutations,
259
277
  onLiveError: options.onLiveError,
260
278
  roots,
@@ -268,6 +286,132 @@ ${generatedClientTypes}
268
286
  `;
269
287
  };
270
288
  const lowerTypeName = (type) => type[0]?.toLowerCase() + type.slice(1);
289
+ const graphQLConfigExportName = "fateGraphQL";
290
+ const formatGraphQLObject = (value, depth = 0) => {
291
+ const indent = " ".repeat(depth);
292
+ const nextIndent = " ".repeat(depth + 1);
293
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
294
+ if (Array.isArray(value)) return `[${value.map((entry) => formatGraphQLObject(entry, depth)).join(", ")}]`;
295
+ const entries = Object.entries(value).filter(([, entry]) => entry !== void 0);
296
+ if (entries.length === 0) return "{}";
297
+ return `{\n${entries.map(([key, entry]) => `${nextIndent}${JSON.stringify(key)}: ${formatGraphQLObject(entry, depth + 1)},`).join("\n")}\n${indent}}`;
298
+ };
299
+ const createGraphQLClientSource = ({ clientModule, moduleExports, moduleName }) => {
300
+ const { Root } = moduleExports;
301
+ const { roots, types } = createSchema(Object.values(moduleExports).filter(isDataView), Root ?? {});
302
+ const graphQLConfig = moduleExports[graphQLConfigExportName] ?? {};
303
+ const byIdEntries = types.map((entry) => ({
304
+ name: lowerTypeName(entry.type),
305
+ type: entry.type
306
+ }));
307
+ const mutationEntries = Object.entries(graphQLConfig.mutations ?? {}).map(([name, config]) => ({
308
+ entity: config.entity,
309
+ field: config.field,
310
+ inputArg: config.inputArg,
311
+ name
312
+ }));
313
+ const rootEntries = [...byIdEntries.map(({ name, type }) => ({
314
+ name,
315
+ type,
316
+ value: `'${name}': clientRoot<Array<${type}>, '${type}'>('${type}'),`
317
+ })), ...Object.entries(roots).map(([name, root]) => ({
318
+ name,
319
+ type: root.type,
320
+ value: `'${name}': clientRoot<${root.kind === "list" ? `{
321
+ items: Array<{ cursor?: string; node: ${root.type} }>;
322
+ pagination: import('${clientModule}').Pagination;
323
+ }` : `${root.type} | null`}, '${root.type}'>('${root.type}'),`
324
+ }))].sort((a, b) => a.name.localeCompare(b.name));
325
+ const importedTypes = Array.from(new Set([
326
+ ...types.map((type) => type.type),
327
+ ...mutationEntries.map((entry) => entry.entity),
328
+ ...graphQLConfig.mutations ? [graphQLConfigExportName] : []
329
+ ])).sort((a, b) => a.localeCompare(b));
330
+ const mutationConfigLines = mutationEntries.map(({ entity, name }) => `'${name}': mutation<
331
+ ${entity},
332
+ GraphQLMutationInput<typeof ${graphQLConfigExportName}.mutations['${name}']>,
333
+ GraphQLMutationOutput<typeof ${graphQLConfigExportName}.mutations['${name}']>
334
+ >('${entity}'),`);
335
+ const graphQLRoots = Object.fromEntries(Object.entries(roots).map(([name, root]) => [name, {
336
+ connection: root.kind === "list" ? "relay" : void 0,
337
+ field: graphQLConfig.roots?.[name]?.field,
338
+ type: root.type
339
+ }]));
340
+ const graphQLRuntimeConfig = {
341
+ mutations: Object.fromEntries(mutationEntries.map(({ entity, field, inputArg, name }) => [name, {
342
+ entity,
343
+ field,
344
+ ...inputArg !== void 0 ? { inputArg } : null
345
+ }])),
346
+ roots: graphQLRoots
347
+ };
348
+ const typesBlock = indentBlock(formatTypes(types), 6);
349
+ const rootBlock = indentBlock(rootEntries.map((entry) => entry.value).join("\n"), 2);
350
+ const mutationConfigBlock = indentBlock(mutationConfigLines.join("\n"), 2);
351
+ const generatedClientTypes = `
352
+ declare module '${`${clientModule}/client`}' {
353
+ interface ClientMutations extends GeneratedClientMutations {}
354
+ interface ClientRoots extends GeneratedClientRoots {}
355
+
356
+ export function createFateClient(
357
+ ...args: Parameters<GeneratedCreateFateClient>
358
+ ): ReturnType<GeneratedCreateFateClient>;
359
+ }
360
+ `;
361
+ const mutationMapType = graphQLConfig.mutations ? `GraphQLMutationMap<typeof ${graphQLConfigExportName}.mutations>` : "Record<never, never>";
362
+ return `// @generated by @nkzw/fate/vite
363
+ ${importedTypes.length ? `import type { ${importedTypes.join(", ")} } from '${moduleName}';\n` : ""}import { clientRoot, createClient, createGraphQLTransport, mutation, type GraphQLMutationInput, type GraphQLMutationMap, type GraphQLMutationOutput } from '${clientModule}';
364
+
365
+ type GraphQLTransportMutations = ${mutationMapType};
366
+
367
+ const graphQL = ${formatGraphQLObject(graphQLRuntimeConfig)} as const;
368
+
369
+ const mutations = {
370
+ ${mutationConfigBlock}
371
+ } as const;
372
+
373
+ const roots = {
374
+ ${rootBlock}
375
+ } as const;
376
+
377
+ export type GeneratedClientMutations = typeof mutations;
378
+ export type GeneratedClientRoots = typeof roots;
379
+ const hydrationScope = ${JSON.stringify(getHydrationScope(moduleName, roots, types))} as const;
380
+
381
+ export const createFateClient = (options: {
382
+ decodeNodeId?: (type: string, id: string | number) => string | number;
383
+ encodeNodeId?: (type: string, id: string | number) => string | number;
384
+ eventSource?: Parameters<typeof createGraphQLTransport>[0]['eventSource'];
385
+ fetch?: typeof fetch;
386
+ headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
387
+ live?: Parameters<typeof createGraphQLTransport>[0]['live'];
388
+ onLiveError?: (error: unknown) => void;
389
+ url: string | URL;
390
+ }) =>
391
+ createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
392
+ hydrationScope,
393
+ mutations,
394
+ onLiveError: options.onLiveError,
395
+ roots,
396
+ transport: createGraphQLTransport<GraphQLTransportMutations>({
397
+ decodeNodeId: options.decodeNodeId,
398
+ encodeNodeId: options.encodeNodeId,
399
+ eventSource: options.eventSource,
400
+ fetch: options.fetch,
401
+ headers: options.headers,
402
+ live: options.live,
403
+ mutations: graphQL.mutations,
404
+ roots: graphQL.roots,
405
+ types: ${typesBlock.trimStart()},
406
+ url: options.url,
407
+ }),
408
+ types: ${typesBlock.trimStart()},
409
+ });
410
+
411
+ type GeneratedCreateFateClient = typeof createFateClient;
412
+ ${generatedClientTypes}
413
+ `;
414
+ };
271
415
  const createNativeClientSource = ({ clientModule, moduleExports, moduleName, runtimeModuleName, voidTransport }) => {
272
416
  const { Root } = moduleExports;
273
417
  const fateExportName = moduleExports.fate?.manifest ? "fate" : moduleExports.fateServer?.manifest ? "fateServer" : null;
@@ -388,7 +532,8 @@ const createVoidFetch = (options: {
388
532
  const clientSetup = voidTransport ? ` => {
389
533
  const origin = options.origin ?? getDefaultOrigin();
390
534
 
391
- return createClient<[GeneratedClientRoots, GeneratedClientMutations]>({
535
+ return createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
536
+ hydrationScope,
392
537
  mutations,
393
538
  onLiveError: options.onLiveError,
394
539
  roots,
@@ -407,7 +552,8 @@ const createVoidFetch = (options: {
407
552
  types: ${typesBlock.trimStart()},
408
553
  });
409
554
  }` : ` =>
410
- createClient<[GeneratedClientRoots, GeneratedClientMutations]>({
555
+ createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
556
+ hydrationScope,
411
557
  mutations,
412
558
  onLiveError: options.onLiveError,
413
559
  roots,
@@ -448,6 +594,7 @@ ${rootBlock}
448
594
 
449
595
  export type GeneratedClientMutations = typeof mutations;
450
596
  export type GeneratedClientRoots = typeof roots;
597
+ const hydrationScope = ${JSON.stringify(getHydrationScope(moduleName, roots, types))} as const;
451
598
 
452
599
  export const createFateClient = (${createClientOptions})${clientSetup};
453
600
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/fate",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
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,22 +72,30 @@
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.13"
75
+ "vite": "^8.0.16"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@trpc/client": "^11.6.0",
79
79
  "drizzle-orm": "^0.45.0",
80
+ "graphql": "^16.0.0",
81
+ "graphql-sse": "^2.6.0",
80
82
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
81
83
  },
82
84
  "peerDependenciesMeta": {
83
85
  "drizzle-orm": {
84
86
  "optional": true
85
87
  },
88
+ "graphql": {
89
+ "optional": true
90
+ },
91
+ "graphql-sse": {
92
+ "optional": true
93
+ },
86
94
  "vite": {
87
95
  "optional": true
88
96
  }
89
97
  },
90
98
  "scripts": {
91
- "build": "vp pack -d lib --target=node24 src/index.ts src/clientStub.ts src/list.ts src/cli.ts src/server.ts src/server/drizzle.ts src/server/prisma.ts src/vite.ts"
99
+ "build": "vp pack -d lib --target=node24 src/index.ts src/clientStub.ts src/list.ts src/cli.ts src/server.ts src/server/drizzle.ts src/server/prisma.ts src/graphqlTransport.ts src/vite.ts"
92
100
  }
93
101
  }
File without changes