@nkzw/fate 1.5.2 → 1.6.1

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 (180) hide show
  1. package/README.md +56 -168
  2. package/docs/api/classes/FateClient.md +35 -35
  3. package/docs/api/functions/clientRoot.md +1 -1
  4. package/docs/api/functions/createClient.md +1 -1
  5. package/docs/api/functions/createGraphQLTransport.md +1 -1
  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 +1 -1
  9. package/docs/api/functions/getDeferredMetadata.md +1 -1
  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 +1 -1
  13. package/docs/api/functions/isDeferred.md +1 -1
  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/interfaces/FateThenable.md +3 -3
  23. package/docs/api/interfaces/Persistence.md +1 -1
  24. package/docs/api/interfaces/PersistenceSession.md +9 -9
  25. package/docs/api/interfaces/Transport.md +8 -8
  26. package/docs/api/server/classes/FateRequestError.md +5 -5
  27. package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
  28. package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
  29. package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
  30. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
  31. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
  32. package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
  33. package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
  34. package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
  35. package/docs/api/server/functions/bindSourceProcedures.md +1 -1
  36. package/docs/api/server/functions/computed.md +1 -1
  37. package/docs/api/server/functions/count.md +1 -1
  38. package/docs/api/server/functions/createFateFetchHandler.md +1 -1
  39. package/docs/api/server/functions/createFateServer.md +1 -1
  40. package/docs/api/server/functions/createHonoFateHandler.md +1 -1
  41. package/docs/api/server/functions/createLiveEventBus.md +1 -1
  42. package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
  43. package/docs/api/server/functions/createResolver.md +1 -1
  44. package/docs/api/server/functions/createSourcePlan.md +1 -1
  45. package/docs/api/server/functions/createSourceProcedures.md +1 -1
  46. package/docs/api/server/functions/dataView.md +1 -1
  47. package/docs/api/server/functions/field.md +1 -1
  48. package/docs/api/server/functions/getNestedSelection.md +1 -1
  49. package/docs/api/server/functions/getScopedArgs.md +1 -1
  50. package/docs/api/server/functions/hasNestedSelection.md +1 -1
  51. package/docs/api/server/functions/list.md +1 -1
  52. package/docs/api/server/functions/refetchSourceById.md +1 -1
  53. package/docs/api/server/functions/resolveSourceById.md +1 -1
  54. package/docs/api/server/functions/resolveSourceByIds.md +1 -1
  55. package/docs/api/server/functions/resolveSourceConnection.md +1 -1
  56. package/docs/api/server/functions/resolver.md +1 -1
  57. package/docs/api/server/functions/toPrismaSelect.md +1 -1
  58. package/docs/api/server/functions/withConnection.md +1 -1
  59. package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
  60. package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
  61. package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
  62. package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
  63. package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
  64. package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
  65. package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
  66. package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
  67. package/docs/api/server/type-aliases/ComputedField.md +5 -5
  68. package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
  69. package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
  70. package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
  71. package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
  72. package/docs/api/server/type-aliases/CountSelection.md +4 -4
  73. package/docs/api/server/type-aliases/CountWhere.md +1 -1
  74. package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
  75. package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
  76. package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
  77. package/docs/api/server/type-aliases/DataViewResult.md +1 -1
  78. package/docs/api/server/type-aliases/Entity.md +1 -1
  79. package/docs/api/server/type-aliases/FateServer.md +5 -5
  80. package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
  81. package/docs/api/server/type-aliases/FieldSelection.md +3 -3
  82. package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
  83. package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
  84. package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
  85. package/docs/api/server/type-aliases/LiveEventType.md +1 -1
  86. package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
  87. package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
  88. package/docs/api/server/type-aliases/OrderDirection.md +1 -1
  89. package/docs/api/server/type-aliases/SourceConfig.md +6 -6
  90. package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
  91. package/docs/api/server/type-aliases/SourceOrder.md +1 -1
  92. package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
  93. package/docs/api/server/type-aliases/SourcePlan.md +1 -1
  94. package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
  95. package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
  96. package/docs/api/server/type-aliases/SourceRelation.md +1 -1
  97. package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
  98. package/docs/api/server/variables/byIdInput.md +1 -1
  99. package/docs/api/server/variables/connectionArgs.md +1 -1
  100. package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
  101. package/docs/api/type-aliases/ConnectionRef.md +1 -1
  102. package/docs/api/type-aliases/Deferred.md +1 -1
  103. package/docs/api/type-aliases/DeferredMetadata.md +1 -1
  104. package/docs/api/type-aliases/DeferredSelection.md +1 -1
  105. package/docs/api/type-aliases/DeferredSnapshot.md +1 -1
  106. package/docs/api/type-aliases/Entity.md +2 -2
  107. package/docs/api/type-aliases/EntityId.md +1 -1
  108. package/docs/api/type-aliases/FateDehydratedState.md +1 -1
  109. package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
  110. package/docs/api/type-aliases/FateLiveEvent.md +1 -1
  111. package/docs/api/type-aliases/FateMutations.md +1 -1
  112. package/docs/api/type-aliases/FateOperation.md +1 -1
  113. package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
  114. package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
  115. package/docs/api/type-aliases/FateRecord.md +1 -1
  116. package/docs/api/type-aliases/FateRoots.md +1 -1
  117. package/docs/api/type-aliases/GraphQLMutationDefinition.md +1 -1
  118. package/docs/api/type-aliases/GraphQLMutationInput.md +1 -1
  119. package/docs/api/type-aliases/GraphQLMutationMap.md +1 -1
  120. package/docs/api/type-aliases/GraphQLMutationOutput.md +1 -1
  121. package/docs/api/type-aliases/GraphQLTransportOptions.md +12 -12
  122. package/docs/api/type-aliases/HydrateOptions.md +1 -1
  123. package/docs/api/type-aliases/HydrationLimits.md +1 -1
  124. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  125. package/docs/api/type-aliases/List.md +1 -1
  126. package/docs/api/type-aliases/ListEntry.md +1 -1
  127. package/docs/api/type-aliases/ListItem.md +1 -1
  128. package/docs/api/type-aliases/Mask.md +1 -1
  129. package/docs/api/type-aliases/MutationDefinition.md +1 -1
  130. package/docs/api/type-aliases/MutationEntity.md +1 -1
  131. package/docs/api/type-aliases/MutationIdentifier.md +1 -1
  132. package/docs/api/type-aliases/MutationIdentity.md +1 -1
  133. package/docs/api/type-aliases/MutationInput.md +1 -1
  134. package/docs/api/type-aliases/MutationResult.md +1 -1
  135. package/docs/api/type-aliases/NodesItem.md +1 -1
  136. package/docs/api/type-aliases/Pagination.md +5 -5
  137. package/docs/api/type-aliases/PersistedMutationStatus.md +1 -1
  138. package/docs/api/type-aliases/PersistenceSnapshot.md +1 -1
  139. package/docs/api/type-aliases/Request.md +1 -1
  140. package/docs/api/type-aliases/RequestMode.md +1 -1
  141. package/docs/api/type-aliases/RequestOptions.md +1 -1
  142. package/docs/api/type-aliases/RequestPersistenceOptions.md +1 -1
  143. package/docs/api/type-aliases/RequestResult.md +1 -1
  144. package/docs/api/type-aliases/Selection.md +1 -1
  145. package/docs/api/type-aliases/TypeConfig.md +4 -4
  146. package/docs/api/type-aliases/View.md +1 -1
  147. package/docs/api/type-aliases/ViewData.md +1 -1
  148. package/docs/api/type-aliases/ViewEntity.md +1 -1
  149. package/docs/api/type-aliases/ViewEntityName.md +1 -1
  150. package/docs/api/type-aliases/ViewRef.md +1 -1
  151. package/docs/api/type-aliases/ViewSelection.md +1 -1
  152. package/docs/api/type-aliases/ViewSnapshot.md +1 -1
  153. package/docs/api/type-aliases/ViewTag.md +1 -1
  154. package/docs/api/variables/ConnectionTag.md +1 -1
  155. package/docs/api/variables/DeferTag.md +1 -1
  156. package/docs/api/variables/DeferredTag.md +1 -1
  157. package/docs/guide/getting-started.md +1 -9
  158. package/docs/integrations/cloudflare.md +21 -139
  159. package/docs/integrations/graphql.md +2 -2
  160. package/docs/integrations/void.md +35 -21
  161. package/lib/{executor-oPTYqgQV.d.mts → executor-C3JLgeJ_.d.mts} +1 -1
  162. package/lib/{graphqlTransport-CGYE4NdD.d.mts → graphqlTransport-D7IPm9wQ.d.mts} +1 -1
  163. package/lib/graphqlTransport.d.mts +1 -1
  164. package/lib/{idempotency-types-DuqJ7KSd.d.mts → idempotency-types-jgGOlHFl.d.mts} +1 -1
  165. package/lib/idempotency.d.mts +2 -2
  166. package/lib/index.d.mts +4 -4
  167. package/lib/index.mjs +1 -1
  168. package/lib/{list-5hrTVoiB.d.mts → list-Dj7P-fay.d.mts} +1 -1
  169. package/lib/list.d.mts +1 -1
  170. package/lib/persistence.d.mts +1 -1
  171. package/lib/persistence.mjs +1 -1
  172. package/lib/{record-Dxjvpsep.d.mts → record-DmyMlWdZ.d.mts} +3 -3
  173. package/lib/server/drizzle.d.mts +2 -2
  174. package/lib/server/prisma.d.mts +2 -2
  175. package/lib/server.d.mts +3 -3
  176. package/lib/{store-CakBBzWG.mjs → store-Dl_OPES3.mjs} +1 -95
  177. package/lib/{transport-DR0fwleU.d.mts → transport-c5vvbtDC.d.mts} +4 -4
  178. package/lib/vite.d.mts +1 -1
  179. package/lib/vite.mjs +7 -27
  180. package/package.json +4 -4
package/lib/vite.mjs CHANGED
@@ -83,20 +83,11 @@ const createClientSource = ({ clientModule = "react-fate", moduleExports, module
83
83
  });
84
84
  if (transport === "native" || transport === "void") return createNativeClientSource({
85
85
  clientModule,
86
- cloudflareTransport: false,
87
86
  moduleExports,
88
87
  moduleName,
89
88
  runtimeModuleName,
90
89
  voidTransport: transport === "void"
91
90
  });
92
- if (transport === "cloudflare") return createNativeClientSource({
93
- clientModule,
94
- cloudflareTransport: true,
95
- moduleExports,
96
- moduleName,
97
- runtimeModuleName,
98
- voidTransport: false
99
- });
100
91
  const { appRouter, Root } = moduleExports;
101
92
  const { roots, types } = createSchema(Object.values(moduleExports).filter(isDataView), Root ?? {});
102
93
  const routerRecord = appRouter._def?.record ?? {};
@@ -426,7 +417,7 @@ type GeneratedCreateFateClient = typeof createFateClient;
426
417
  ${generatedClientTypes}
427
418
  `;
428
419
  };
429
- const createNativeClientSource = ({ clientModule, cloudflareTransport, moduleExports, moduleName, runtimeModuleName, voidTransport }) => {
420
+ const createNativeClientSource = ({ clientModule, moduleExports, moduleName, runtimeModuleName, voidTransport }) => {
430
421
  const { Root } = moduleExports;
431
422
  const fateExportName = moduleExports.fate?.manifest ? "fate" : moduleExports.fateServer?.manifest ? "fateServer" : null;
432
423
  const fateServer = fateExportName ? moduleExports[fateExportName] : null;
@@ -524,17 +515,7 @@ const createVoidFetch = (options: {
524
515
  });
525
516
  };
526
517
  ` : "";
527
- const cloudflareHelpers = cloudflareTransport ? `
528
- const defaultCloudflareFateRpcPath = '/fate';
529
- const defaultCloudflareFateLivePath = '/fate-live';
530
-
531
- const getDefaultOrigin = () =>
532
- typeof window === 'undefined' ? 'http://localhost' : window.location.origin;
533
-
534
- const toEndpointUrl = (url: string | URL | undefined, path: string, origin: string | URL) =>
535
- url ?? new URL(path, origin);
536
- ` : "";
537
- const createClientOptions = voidTransport || cloudflareTransport ? `options: {
518
+ const createClientOptions = voidTransport ? `options: {
538
519
  fetch?: typeof fetch;
539
520
  headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
540
521
  livePath?: string;
@@ -555,7 +536,7 @@ const toEndpointUrl = (url: string | URL | undefined, path: string, origin: stri
555
536
  persistence?: import("@nkzw/fate").Persistence;
556
537
  url: string | URL;
557
538
  }`;
558
- const clientSetup = voidTransport || cloudflareTransport ? ` => {
539
+ const clientSetup = voidTransport ? ` => {
559
540
  const origin = options.origin ?? getDefaultOrigin();
560
541
 
561
542
  return createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
@@ -565,16 +546,16 @@ const toEndpointUrl = (url: string | URL | undefined, path: string, origin: stri
565
546
  persistence: options.persistence,
566
547
  roots,
567
548
  transport: createHTTPTransport<FateAPI>({
568
- fetch: ${voidTransport ? "createVoidFetch(options)" : "options.fetch"},
549
+ fetch: createVoidFetch(options),
569
550
  headers: options.headers,
570
- live: ${hasLive ? voidTransport ? "connectLiveStream" : "connectCloudflareFateStream" : "false"},
551
+ live: ${hasLive ? "connectLiveStream" : "false"},
571
552
  liveRetryMs: options.liveRetryMs,
572
553
  liveUrl: toEndpointUrl(
573
554
  options.liveUrl,
574
- options.livePath ?? ${voidTransport ? "defaultVoidFateLivePath" : "defaultCloudflareFateLivePath"},
555
+ options.livePath ?? defaultVoidFateLivePath,
575
556
  origin,
576
557
  ),
577
- url: toEndpointUrl(options.url, options.rpcPath ?? ${voidTransport ? "defaultVoidFateRpcPath" : "defaultCloudflareFateRpcPath"}, origin),
558
+ url: toEndpointUrl(options.url, options.rpcPath ?? defaultVoidFateRpcPath, origin),
578
559
  }),
579
560
  types: ${typesBlock.trimStart()},
580
561
  });
@@ -609,7 +590,6 @@ declare module '${clientDeclarationModule}' {
609
590
  import type { ${importedTypes.join(", ")} } from '${moduleName}';
610
591
  import { clientRoot, createClient, createHTTPTransport, mutation, type InferFateAPI } from '${clientModule}';
611
592
  ${voidTransport && hasLive ? "import { connectLiveStream } from 'void/live/client';\n" : ""}${voidServerFetch}
612
- ${cloudflareTransport && hasLive ? "import { connectCloudflareFateStream } from 'cf-fate/client';\n" : ""}${cloudflareHelpers}
613
593
 
614
594
  type FateAPI = InferFateAPI<typeof fateServer>;
615
595
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/fate",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "description": "fate is a modern data client for React.",
5
5
  "homepage": "https://github.com/nkzw-tech/fate",
6
6
  "license": "MIT",
@@ -79,10 +79,10 @@
79
79
  "zod": "^4.6.5"
80
80
  },
81
81
  "devDependencies": {
82
- "@trpc/client": "^11.18.0",
83
- "@trpc/server": "^11.18.0",
82
+ "@trpc/client": "^11.19.0",
83
+ "@trpc/server": "^11.19.0",
84
84
  "drizzle-orm": "^0.45.2",
85
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.2"
85
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@trpc/client": "^11.6.0",