@nkzw/fate 1.0.3 → 1.1.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 (172) hide show
  1. package/README.md +354 -2
  2. package/docs/api/classes/FateClient.md +110 -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/getListEntries.md +1 -1
  9. package/docs/api/functions/getSelectionPlan.md +1 -1
  10. package/docs/api/functions/graphqlMutation.md +39 -0
  11. package/docs/api/functions/isRecord.md +1 -1
  12. package/docs/api/functions/isViewTag.md +1 -1
  13. package/docs/api/functions/liveConnectionTopic.md +1 -1
  14. package/docs/api/functions/liveEntityTopic.md +1 -1
  15. package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
  16. package/docs/api/functions/mutation.md +1 -1
  17. package/docs/api/functions/toEntityId.md +1 -1
  18. package/docs/api/functions/view.md +1 -1
  19. package/docs/api/index.md +10 -0
  20. package/docs/api/interfaces/FateThenable.md +3 -3
  21. package/docs/api/interfaces/Transport.md +7 -7
  22. package/docs/api/server/classes/FateRequestError.md +5 -5
  23. package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
  24. package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
  25. package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
  26. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
  27. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
  28. package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
  29. package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
  30. package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
  31. package/docs/api/server/functions/bindSourceProcedures.md +1 -1
  32. package/docs/api/server/functions/computed.md +1 -1
  33. package/docs/api/server/functions/count.md +1 -1
  34. package/docs/api/server/functions/createFateFetchHandler.md +1 -1
  35. package/docs/api/server/functions/createFateServer.md +1 -1
  36. package/docs/api/server/functions/createHonoFateHandler.md +1 -1
  37. package/docs/api/server/functions/createLiveEventBus.md +1 -1
  38. package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
  39. package/docs/api/server/functions/createResolver.md +1 -1
  40. package/docs/api/server/functions/createSourcePlan.md +1 -1
  41. package/docs/api/server/functions/createSourceProcedures.md +1 -1
  42. package/docs/api/server/functions/dataView.md +1 -1
  43. package/docs/api/server/functions/field.md +1 -1
  44. package/docs/api/server/functions/getNestedSelection.md +1 -1
  45. package/docs/api/server/functions/getScopedArgs.md +1 -1
  46. package/docs/api/server/functions/hasNestedSelection.md +1 -1
  47. package/docs/api/server/functions/list.md +1 -1
  48. package/docs/api/server/functions/refetchSourceById.md +1 -1
  49. package/docs/api/server/functions/resolveSourceById.md +1 -1
  50. package/docs/api/server/functions/resolveSourceByIds.md +1 -1
  51. package/docs/api/server/functions/resolveSourceConnection.md +1 -1
  52. package/docs/api/server/functions/resolver.md +1 -1
  53. package/docs/api/server/functions/toPrismaSelect.md +1 -1
  54. package/docs/api/server/functions/withConnection.md +1 -1
  55. package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
  56. package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
  57. package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
  58. package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
  59. package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
  60. package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
  61. package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
  62. package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
  63. package/docs/api/server/type-aliases/ComputedField.md +5 -5
  64. package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
  65. package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
  66. package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
  67. package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
  68. package/docs/api/server/type-aliases/CountSelection.md +4 -4
  69. package/docs/api/server/type-aliases/CountWhere.md +1 -1
  70. package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
  71. package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
  72. package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
  73. package/docs/api/server/type-aliases/DataViewResult.md +1 -1
  74. package/docs/api/server/type-aliases/Entity.md +1 -1
  75. package/docs/api/server/type-aliases/FateServer.md +5 -5
  76. package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
  77. package/docs/api/server/type-aliases/FieldSelection.md +3 -3
  78. package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
  79. package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
  80. package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
  81. package/docs/api/server/type-aliases/LiveEventType.md +1 -1
  82. package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
  83. package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
  84. package/docs/api/server/type-aliases/OrderDirection.md +1 -1
  85. package/docs/api/server/type-aliases/SourceConfig.md +6 -6
  86. package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
  87. package/docs/api/server/type-aliases/SourceOrder.md +1 -1
  88. package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
  89. package/docs/api/server/type-aliases/SourcePlan.md +1 -1
  90. package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
  91. package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
  92. package/docs/api/server/type-aliases/SourceRelation.md +1 -1
  93. package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
  94. package/docs/api/server/variables/byIdInput.md +1 -1
  95. package/docs/api/server/variables/connectionArgs.md +1 -1
  96. package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
  97. package/docs/api/type-aliases/ConnectionRef.md +1 -1
  98. package/docs/api/type-aliases/Entity.md +2 -2
  99. package/docs/api/type-aliases/EntityId.md +1 -1
  100. package/docs/api/type-aliases/FateDehydratedState.md +11 -0
  101. package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
  102. package/docs/api/type-aliases/FateLiveEvent.md +1 -1
  103. package/docs/api/type-aliases/FateMutations.md +1 -1
  104. package/docs/api/type-aliases/FateOperation.md +1 -1
  105. package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
  106. package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
  107. package/docs/api/type-aliases/FateRecord.md +1 -1
  108. package/docs/api/type-aliases/FateRoots.md +1 -1
  109. package/docs/api/type-aliases/GraphQLMutationDefinition.md +19 -0
  110. package/docs/api/type-aliases/GraphQLMutationInput.md +11 -0
  111. package/docs/api/type-aliases/GraphQLMutationMap.md +11 -0
  112. package/docs/api/type-aliases/GraphQLMutationOutput.md +11 -0
  113. package/docs/api/type-aliases/GraphQLTransportOptions.md +119 -0
  114. package/docs/api/type-aliases/HydrateOptions.md +7 -0
  115. package/docs/api/type-aliases/HydrationLimits.md +7 -0
  116. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  117. package/docs/api/type-aliases/List.md +1 -1
  118. package/docs/api/type-aliases/ListEntry.md +1 -1
  119. package/docs/api/type-aliases/ListItem.md +1 -1
  120. package/docs/api/type-aliases/Mask.md +1 -1
  121. package/docs/api/type-aliases/MutationDefinition.md +1 -1
  122. package/docs/api/type-aliases/MutationEntity.md +1 -1
  123. package/docs/api/type-aliases/MutationIdentifier.md +1 -1
  124. package/docs/api/type-aliases/MutationInput.md +1 -1
  125. package/docs/api/type-aliases/MutationResult.md +1 -1
  126. package/docs/api/type-aliases/NodesItem.md +1 -1
  127. package/docs/api/type-aliases/Pagination.md +5 -5
  128. package/docs/api/type-aliases/Request.md +1 -1
  129. package/docs/api/type-aliases/RequestMode.md +1 -1
  130. package/docs/api/type-aliases/RequestOptions.md +1 -1
  131. package/docs/api/type-aliases/RequestResult.md +1 -1
  132. package/docs/api/type-aliases/Selection.md +1 -1
  133. package/docs/api/type-aliases/Snapshot.md +1 -1
  134. package/docs/api/type-aliases/TypeConfig.md +4 -4
  135. package/docs/api/type-aliases/View.md +1 -1
  136. package/docs/api/type-aliases/ViewData.md +1 -1
  137. package/docs/api/type-aliases/ViewEntity.md +1 -1
  138. package/docs/api/type-aliases/ViewEntityName.md +1 -1
  139. package/docs/api/type-aliases/ViewRef.md +1 -1
  140. package/docs/api/type-aliases/ViewSelection.md +1 -1
  141. package/docs/api/type-aliases/ViewSnapshot.md +1 -1
  142. package/docs/api/type-aliases/ViewTag.md +1 -1
  143. package/docs/api/variables/ConnectionTag.md +1 -1
  144. package/docs/guide/getting-started.md +1 -1
  145. package/docs/guide/graphql-integration.md +298 -0
  146. package/docs/guide/requests.md +52 -0
  147. package/docs/guide/server-integration.md +2 -1
  148. package/lib/{executor-BqwHdN3n.d.mts → executor-sLcAqDMs.d.mts} +1 -1
  149. package/lib/graphqlTransport-DbRHbYtb.d.mts +74 -0
  150. package/lib/graphqlTransport-IFgmY-Qq.mjs +499 -0
  151. package/lib/graphqlTransport.d.mts +2 -0
  152. package/lib/graphqlTransport.mjs +2 -0
  153. package/lib/index.d.mts +5 -4
  154. package/lib/index.mjs +501 -89
  155. package/lib/{list-4wRNSVgI.d.mts → list-CMQOQGdn.d.mts} +1 -1
  156. package/lib/list.d.mts +1 -1
  157. package/lib/list.mjs +1 -1
  158. package/lib/{liveTopics-DzNtJaBD.mjs → liveTopics-JIDh3t3P.mjs} +1 -1
  159. package/lib/{record-CirbfZWX.d.mts → record-BtdKzEGI.d.mts} +2 -2
  160. package/lib/server/drizzle.d.mts +6 -8
  161. package/lib/server/drizzle.mjs +2 -2
  162. package/lib/server/prisma.d.mts +6 -8
  163. package/lib/server/prisma.mjs +2 -2
  164. package/lib/server.d.mts +3 -3
  165. package/lib/server.mjs +3 -3
  166. package/lib/{sourceRouter-C22uFcZg.mjs → sourceRouter-N9Vp0Cj6.mjs} +1 -1
  167. package/lib/{types-Dz46PXr3.d.mts → transport-BTgtSwOM.d.mts} +211 -143
  168. package/lib/vite.d.mts +1 -1
  169. package/lib/vite.mjs +150 -3
  170. package/package.json +11 -3
  171. /package/lib/{list-C_mi6GnE.mjs → list-_6fXYLtJ.mjs} +0 -0
  172. /package/lib/{record-AeZJC9fd.mjs → record-B07VwXd-.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { U as List, o as EntityId } from "./types-Dz46PXr3.mjs";
1
+ import { Y as List, c as EntityId } from "./transport-BTgtSwOM.mjs";
2
2
 
3
3
  //#region src/list.d.ts
4
4
  type ListEntry = Readonly<{
package/lib/list.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as getListEntries, t as ListEntry } from "./list-4wRNSVgI.mjs";
1
+ import { n as getListEntries, t as ListEntry } from "./list-CMQOQGdn.mjs";
2
2
  export { ListEntry, getListEntries };
package/lib/list.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as getListEntries } from "./list-C_mi6GnE.mjs";
1
+ import { t as getListEntries } from "./list-_6fXYLtJ.mjs";
2
2
  export { getListEntries };
@@ -1,4 +1,4 @@
1
- import { t as isRecord } from "./record-AeZJC9fd.mjs";
1
+ import { t as isRecord } from "./record-B07VwXd-.mjs";
2
2
  //#region src/args.ts
3
3
  const ensureSerializable = (value, path) => {
4
4
  const type = typeof value;
@@ -1,5 +1,5 @@
1
- import { t as AnyRecord } from "./types-Dz46PXr3.mjs";
2
- import { N as DataViewResult, S as ConnectionResult, k as DataView, l as SourceDefinition, t as SourceRegistry } from "./executor-BqwHdN3n.mjs";
1
+ import { r as AnyRecord } from "./transport-BTgtSwOM.mjs";
2
+ import { N as DataViewResult, S as ConnectionResult, k as DataView, l as SourceDefinition, t as SourceRegistry } from "./executor-sLcAqDMs.mjs";
3
3
 
4
4
  //#region src/liveTopics.d.ts
5
5
  declare const liveEntityTopic: (type: string, id: string | number) => string;
@@ -1,8 +1,6 @@
1
- import { q as QueryProcedure, t as AnyRecord } from "../types-Dz46PXr3.mjs";
2
- import { S as ConnectionResult, c as SourceConfig, f as SourcePlan, k as DataView, l as SourceDefinition, o as DataViewModule, p as SourcePlanNode, t as SourceRegistry } from "../executor-BqwHdN3n.mjs";
3
- import * as _$zod from "zod";
1
+ import { Z as QueryProcedure, r as AnyRecord } from "../transport-BTgtSwOM.mjs";
2
+ import { S as ConnectionResult, c as SourceConfig, f as SourcePlan, k as DataView, l as SourceDefinition, o as DataViewModule, p as SourcePlanNode, t as SourceRegistry } from "../executor-sLcAqDMs.mjs";
4
3
  import { AnyColumn, SQLWrapper, Table } from "drizzle-orm";
5
- import * as _$zod_v4_core0 from "zod/v4/core";
6
4
 
7
5
  //#region src/server/drizzle.d.ts
8
6
  type SourceTarget<Item extends AnyRecord = AnyRecord> = DataView<Item> | SourceDefinition<Item, unknown>;
@@ -136,7 +134,7 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({
136
134
  }: Parameters<typeof createDrizzleSourceAdapter<Context>>[0] & {
137
135
  procedure: Procedure;
138
136
  }): {
139
- connection: <TItem, TNode = TItem, TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> | undefined = undefined>(options: {
137
+ connection: <TItem, TNode = TItem, TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> | undefined = undefined>(options: {
140
138
  defaultSize?: number;
141
139
  getCursor?: ((node: TNode) => string) | undefined;
142
140
  input?: TAdditionalInput | undefined;
@@ -152,7 +150,7 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({
152
150
  select: string[];
153
151
  args?: Record<string, unknown> | undefined;
154
152
  } & {
155
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
153
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
156
154
  };
157
155
  items: TItem[];
158
156
  }) => TNode[] | Promise<TNode[]>) | undefined;
@@ -170,7 +168,7 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({
170
168
  select: string[];
171
169
  args?: Record<string, unknown> | undefined;
172
170
  } & {
173
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
171
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
174
172
  };
175
173
  skip?: number;
176
174
  take: number;
@@ -180,7 +178,7 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({
180
178
  select: string[];
181
179
  args?: Record<string, unknown> | undefined;
182
180
  } & {
183
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
181
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
184
182
  };
185
183
  meta: unknown;
186
184
  output: ConnectionResult<TNode>;
@@ -1,5 +1,5 @@
1
- import { t as isRecord } from "../record-AeZJC9fd.mjs";
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";
1
+ import { t as isRecord } from "../record-B07VwXd-.mjs";
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-N9Vp0Cj6.mjs";
3
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
  /**
@@ -1,7 +1,5 @@
1
- import { q as QueryProcedure, t as AnyRecord } from "../types-Dz46PXr3.mjs";
2
- import { S as ConnectionResult, c as SourceConfig, f as SourcePlan, k as DataView, l as SourceDefinition, o as DataViewModule, p as SourcePlanNode, s as OrderDirection, t as SourceRegistry } from "../executor-BqwHdN3n.mjs";
3
- import * as _$zod from "zod";
4
- import * as _$zod_v4_core0 from "zod/v4/core";
1
+ import { Z as QueryProcedure, r as AnyRecord } from "../transport-BTgtSwOM.mjs";
2
+ import { S as ConnectionResult, c as SourceConfig, f as SourcePlan, k as DataView, l as SourceDefinition, o as DataViewModule, p as SourcePlanNode, s as OrderDirection, t as SourceRegistry } from "../executor-sLcAqDMs.mjs";
5
3
 
6
4
  //#region src/server/prisma.d.ts
7
5
  type PrismaDelegate = {
@@ -137,7 +135,7 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({
137
135
  }: Parameters<typeof createPrismaSourceAdapter<Context>>[0] & {
138
136
  procedure: Procedure;
139
137
  }): {
140
- connection: <TItem, TNode = TItem, TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> | undefined = undefined>(options: {
138
+ connection: <TItem, TNode = TItem, TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> | undefined = undefined>(options: {
141
139
  defaultSize?: number;
142
140
  getCursor?: ((node: TNode) => string) | undefined;
143
141
  input?: TAdditionalInput | undefined;
@@ -153,7 +151,7 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({
153
151
  select: string[];
154
152
  args?: Record<string, unknown> | undefined;
155
153
  } & {
156
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
154
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
157
155
  };
158
156
  items: TItem[];
159
157
  }) => TNode[] | Promise<TNode[]>) | undefined;
@@ -171,7 +169,7 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({
171
169
  select: string[];
172
170
  args?: Record<string, unknown> | undefined;
173
171
  } & {
174
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
172
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
175
173
  };
176
174
  skip?: number;
177
175
  take: number;
@@ -181,7 +179,7 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({
181
179
  select: string[];
182
180
  args?: Record<string, unknown> | undefined;
183
181
  } & {
184
- args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends _$zod.ZodObject<Record<string, _$zod.ZodType<unknown, unknown, _$zod_v4_core0.$ZodTypeInternals<unknown, unknown>>>, _$zod_v4_core0.$strip> ? _$zod.infer<TAdditionalInput> : object)) | undefined;
182
+ args?: ((Record<string, unknown> | undefined) & (TAdditionalInput extends import("zod").ZodObject<Record<string, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>, import("zod/v4/core").$strip> ? import("zod").infer<TAdditionalInput> : object)) | undefined;
185
183
  };
186
184
  meta: unknown;
187
185
  output: ConnectionResult<TNode>;
@@ -1,5 +1,5 @@
1
- import { t as isRecord } from "../record-AeZJC9fd.mjs";
2
- import { O as withConnection, S as isDataView, T as toPrismaSelect, 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";
1
+ import { t as isRecord } from "../record-B07VwXd-.mjs";
2
+ import { O as withConnection, S as isDataView, T as toPrismaSelect, 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-N9Vp0Cj6.mjs";
3
3
  //#region src/server/prisma.ts
4
4
  /**
5
5
  * fate's Prisma integration.
package/lib/server.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { K as AnyProcedure, t as AnyRecord$1 } from "./types-Dz46PXr3.mjs";
2
- import { C as liveGlobalConnectionTopic, S as liveEntityTopic, _ as LiveEventBus, b as createLiveEventBus, c as FateServer, d as NativeFateAPI, f as createFateFetchHandler, g as LiveConnectionSourceEvent, h as LiveConnectionEventType, l as FateServerManifest, m as createHonoFateHandler, p as createFateServer, s as FateRequestError, t as isRecord, u as InferFateAPI, v as LiveEventType, x as liveConnectionTopic, y as LiveSourceEvent } from "./record-CirbfZWX.mjs";
3
- import { A as DataViewListOptions, B as dataView, C as connectionArgs, D as CountSelection, E as ComputedSelection, F as FieldSelection, H as list$1, I as ViewPlan, L as computed, M as DataViewOrderDirection, N as DataViewResult, O as CountWhere, P as Entity, R as count, S as ConnectionResult, T as ComputedField, U as resolver, V as field, _ as createSourcePlan, a as resolveSourceConnection, b as ConnectionItem, c as SourceConfig, d as SourceOrderField, f as SourcePlan, g as createNestedSourcePlan, h as SourceRelationConfig, i as resolveSourceByIds, j as DataViewOrderBy, l as SourceDefinition, m as SourceRelation, n as refetchSourceById, p as SourcePlanNode, r as resolveSourceById, s as OrderDirection, t as SourceRegistry, u as SourceOrder, v as getNestedSelection, w as withConnection, x as ConnectionPagination, y as hasNestedSelection, z as createResolver } from "./executor-BqwHdN3n.mjs";
1
+ import { X as AnyProcedure, r as AnyRecord$1 } from "./transport-BTgtSwOM.mjs";
2
+ import { C as liveGlobalConnectionTopic, S as liveEntityTopic, _ as LiveEventBus, b as createLiveEventBus, c as FateServer, d as NativeFateAPI, f as createFateFetchHandler, g as LiveConnectionSourceEvent, h as LiveConnectionEventType, l as FateServerManifest, m as createHonoFateHandler, p as createFateServer, s as FateRequestError, t as isRecord, u as InferFateAPI, v as LiveEventType, x as liveConnectionTopic, y as LiveSourceEvent } from "./record-BtdKzEGI.mjs";
3
+ import { A as DataViewListOptions, B as dataView, C as connectionArgs, D as CountSelection, E as ComputedSelection, F as FieldSelection, H as list$1, I as ViewPlan, L as computed, M as DataViewOrderDirection, N as DataViewResult, O as CountWhere, P as Entity, R as count, S as ConnectionResult, T as ComputedField, U as resolver, V as field, _ as createSourcePlan, a as resolveSourceConnection, b as ConnectionItem, c as SourceConfig, d as SourceOrderField, f as SourcePlan, g as createNestedSourcePlan, h as SourceRelationConfig, i as resolveSourceByIds, j as DataViewOrderBy, l as SourceDefinition, m as SourceRelation, n as refetchSourceById, p as SourcePlanNode, r as resolveSourceById, s as OrderDirection, t as SourceRegistry, u as SourceOrder, v as getNestedSelection, w as withConnection, x as ConnectionPagination, y as hasNestedSelection, z as createResolver } from "./executor-sLcAqDMs.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/server/input.d.ts
package/lib/server.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { t as isRecord } from "./record-AeZJC9fd.mjs";
2
- import { d as hashArgs, i as FateRequestError, n as liveEntityTopic, o as toProtocolError, r as liveGlobalConnectionTopic, t as liveConnectionTopic, u as filterConnectionArgs } from "./liveTopics-DzNtJaBD.mjs";
3
- import { C as list, D as resolveConnection, E as connectionArgs, O as withConnection, S as isDataView, T as toPrismaSelect, _ as computed, a as refetchSourceById, b as dataView, c as resolveSourceConnection, f as createSourcePlan, h as hasNestedSelection, k as getScopedArgs, m as getNestedSelection, n as createSourceProcedures, o as resolveSourceById, r as byIdInput, s as resolveSourceByIds, t as bindSourceProcedures, u as createNestedSourcePlan, v as count, w as resolver, x as field, y as createResolver } from "./sourceRouter-C22uFcZg.mjs";
1
+ import { t as isRecord } from "./record-B07VwXd-.mjs";
2
+ import { d as hashArgs, i as FateRequestError, n as liveEntityTopic, o as toProtocolError, r as liveGlobalConnectionTopic, t as liveConnectionTopic, u as filterConnectionArgs } from "./liveTopics-JIDh3t3P.mjs";
3
+ import { C as list, D as resolveConnection, E as connectionArgs, O as withConnection, S as isDataView, T as toPrismaSelect, _ as computed, a as refetchSourceById, b as dataView, c as resolveSourceConnection, f as createSourcePlan, h as hasNestedSelection, k as getScopedArgs, m as getNestedSelection, n as createSourceProcedures, o as resolveSourceById, r as byIdInput, s as resolveSourceByIds, t as bindSourceProcedures, u as createNestedSourcePlan, v as count, w as resolver, x as field, y as createResolver } from "./sourceRouter-N9Vp0Cj6.mjs";
4
4
  import { EventEmitter, on } from "node:events";
5
5
  //#region src/server/live.ts
6
6
  const eventName = (type, id) => `${type}:${String(id)}`;
@@ -1,4 +1,4 @@
1
- import { t as isRecord } from "./record-AeZJC9fd.mjs";
1
+ import { t as isRecord } from "./record-B07VwXd-.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/server/queryArgs.ts
4
4
  const toPrismaArgs = (args) => {
@@ -1,32 +1,6 @@
1
1
  import { TRPCClient } from "@trpc/client";
2
2
 
3
- //#region src/mask.d.ts
4
- type FieldMask = {
5
- all: boolean;
6
- children: Map<string, FieldMask>;
7
- };
8
- //#endregion
9
- //#region src/selection.d.ts
10
- /**
11
- * Representation of a composed selection including hashed args and the
12
- * flat set of field paths to read or fetch.
13
- */
14
- type SelectionPlan = {
15
- readonly args: Map<string, Readonly<{
16
- hash: string;
17
- ignoreKeys?: ReadonlySet<string>;
18
- value: AnyRecord;
19
- }>>;
20
- readonly live: Map<string, ConnectionLivePolicy>;
21
- readonly paths: Set<string>;
22
- };
23
- /**
24
- * Flattens a view into a `SelectionPlan`, expanding composed views and
25
- * partitioning nested args so the client can fetch exactly what is declared.
26
- */
27
- declare const getSelectionPlan: <T extends Entity, S extends Selection<T>, V extends View<T, S>>(viewComposition: V, ref: ViewRef<T["__typename"]> | null) => SelectionPlan;
28
- //#endregion
29
- //#region ../../node_modules/.pnpm/@trpc+server@11.17.0_typescript@5.9.3/node_modules/@trpc/server/dist/index.d-D4qZxQJh.d.mts
3
+ //#region ../../node_modules/.pnpm/@trpc+server@11.17.0_typescript@6.0.3/node_modules/@trpc/server/dist/index.d-D4qZxQJh.d.mts
30
4
  //#region src/observable/types.d.ts
31
5
  interface Unsubscribable {
32
6
  unsubscribe(): void;
@@ -50,7 +24,7 @@ interface Observer<TValue, TError> {
50
24
  type UnaryFunction<TSource, TReturn> = (source: TSource) => TReturn;
51
25
  type OperatorFunction<TValueBefore, TErrorBefore, TValueAfter, TErrorAfter> = UnaryFunction<Subscribable<TValueBefore, TErrorBefore>, Subscribable<TValueAfter, TErrorAfter>>;
52
26
  //#endregion
53
- //#region ../../node_modules/.pnpm/@trpc+server@11.17.0_typescript@5.9.3/node_modules/@trpc/server/dist/unstable-core-do-not-import.d-BdVSvUCr.d.mts
27
+ //#region ../../node_modules/.pnpm/@trpc+server@11.17.0_typescript@6.0.3/node_modules/@trpc/server/dist/unstable-core-do-not-import.d-BdVSvUCr.d.mts
54
28
  /**
55
29
  * @public
56
30
  */
@@ -613,123 +587,18 @@ interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
613
587
  }
614
588
  type AnyRouter = Router<any, any>;
615
589
  //#endregion
616
- //#region src/transport.d.ts
617
- /**
618
- * Normalized representation of args passed to a transport.
619
- */
620
- type ResolvedArgsPayload = AnyRecord;
621
- type TransportMutations = Record<string, MutationShape>;
622
- type EmptyTransportMutations = Record<never, MutationShape>;
623
- type Bivariant<Fn extends (...args: Array<any>) => any> = {
624
- bivarianceHack: Fn;
625
- }['bivarianceHack'];
626
- type TRPCListResult = {
627
- items: Array<{
628
- cursor?: string;
629
- node?: unknown;
630
- }>;
631
- pagination: Pagination;
590
+ //#region src/mask.d.ts
591
+ type FieldMask = {
592
+ all: boolean;
593
+ children: Map<string, FieldMask>;
632
594
  };
633
- type LiveEventHandlers = Readonly<{
634
- onData: (record: unknown, select?: ReadonlyArray<string>) => void;
635
- onDelete?: (id?: string | number) => void;
636
- onError?: (error: unknown) => void;
637
- }>;
638
- type LiveConnectionEvent = Readonly<{
639
- edge: {
640
- cursor?: string;
641
- node: unknown;
642
- };
643
- nodeType: string;
644
- targetCursor?: string;
645
- type: 'appendEdge' | 'appendNode' | 'insertEdgeAfter' | 'insertEdgeBefore' | 'prependEdge' | 'prependNode';
646
- }> | Readonly<{
647
- id: string | number;
648
- nodeType: string;
649
- type: 'deleteEdge';
650
- }> | Readonly<{
651
- type: 'invalidate';
652
- }>;
653
- type LiveConnectionEventHandlers = Readonly<{
654
- onError?: (error: unknown) => void;
655
- onEvent: (event: LiveConnectionEvent) => void;
656
- }>;
657
- /**
658
- * Contract the fate client expects from a network transport. The transport is
659
- * responsible for fetching records by ID, fetching lists, and executing
660
- * mutations with the provided selections.
661
- */
662
- interface Transport<Mutations extends TransportMutations = EmptyTransportMutations> {
663
- fetchById(type: string, ids: Array<string | number>, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<Array<unknown>>;
664
- fetchList?(proc: string, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<{
665
- items: Array<{
666
- cursor: string | undefined;
667
- node: unknown;
668
- }>;
669
- pagination: Pagination;
670
- }>;
671
- fetchQuery?(proc: string, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<unknown>;
672
- mutate?<K extends Extract<keyof Mutations, string>>(proc: K, input: Mutations[K]['input'], select: Set<string>): Promise<Mutations[K]['output']>;
673
- subscribeById?(type: string, id: string | number, select: Iterable<string>, args: ResolvedArgsPayload | undefined, handlers: LiveEventHandlers): () => void;
674
- subscribeConnection?(procedure: string, type: string, args: ResolvedArgsPayload | undefined, select: Iterable<string>, selectionArgs: ResolvedArgsPayload | undefined, handlers: LiveConnectionEventHandlers): () => void;
675
- }
676
- /**
677
- * Mapping of entity type to tRPC procedures used for fetching entities by ID.
678
- */
679
- type TRPCByIdResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => (input: {
680
- args?: ResolvedArgsPayload;
681
- ids: Array<string | number>;
682
- select: Array<string>;
683
- }) => Promise<unknown>>;
684
- /**
685
- * Mapping of list procedure name to a tRPC resolver factory.
686
- */
687
- type TRPCListResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => Bivariant<(input: any) => Promise<TRPCListResult>>>;
688
- /**
689
- * Mapping of query procedure name to a tRPC resolver factory.
690
- */
691
- type TRPCQueryResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => (input: {
692
- args?: ResolvedArgsPayload;
693
- select: Array<string>;
694
- }) => Promise<unknown>>;
695
- /**
696
- * Mapping of a mutation procedure name to a tRPC resolver factory.
697
- */
698
- type MutationResolver<AppRouter extends AnyRouter> = (client: TRPCClient<AppRouter>) => (input: any) => Promise<any>;
699
- type TRPCMutationResolvers<AppRouter extends AnyRouter> = Record<string, MutationResolver<AppRouter>>;
700
- type MutationMapFromResolvers<R extends Record<string, MutationResolver<any>>> = { [K in keyof R]: R[K] extends ((client: any) => (input: infer Input) => Promise<infer Output>) ? {
701
- input: Input;
702
- output: Output;
703
- } : never };
704
- type EmptyMutationResolvers<AppRouter extends AnyRouter> = Record<never, MutationResolver<AppRouter>>;
705
- /**
706
- * Builds a `Transport` backed by a tRPC client using the configured resolvers
707
- * for by-id queries, lists, and mutations.
708
- */
709
- declare function createTRPCTransport<AppRouter extends AnyRouter, Mutations extends TRPCMutationResolvers<AppRouter> = EmptyMutationResolvers<AppRouter>>({
710
- byId,
711
- client,
712
- lists,
713
- mutations,
714
- queries
715
- }: {
716
- byId: TRPCByIdResolvers<AppRouter>;
717
- client: TRPCClient<AppRouter>;
718
- lists?: TRPCListResolvers<AppRouter>;
719
- mutations?: Mutations;
720
- queries?: TRPCQueryResolvers<AppRouter>;
721
- }): Transport<MutationMapFromResolvers<Mutations>>;
722
- //#endregion
723
- //#region src/operation-lifetime.d.ts
724
- type RetainHandle = Readonly<{
725
- dispose(): void;
726
- }>;
727
595
  //#endregion
728
596
  //#region src/cache.d.ts
729
597
  declare class ViewDataCache {
730
598
  private cache;
731
599
  private rootDependencies;
732
600
  private dependencyIndex;
601
+ clear(): void;
733
602
  get<T extends Entity, S extends Selection<T>, V extends View<T, S>>(entityId: EntityId, view: V, ref: ViewRef<T['__typename']>): FateThenable<ViewSnapshot<T, S>> | null;
734
603
  set<T extends Entity, S extends Selection<T>, V extends View<T, S>>(entityId: EntityId, view: V, ref: ViewRef<T['__typename']>, thenable: FateThenable<ViewSnapshot<T, S>>, dependencies: ReadonlySet<EntityId>): void;
735
604
  invalidate(entityId: EntityId): void;
@@ -749,6 +618,11 @@ type List = Readonly<{
749
618
  pendingAfterIds?: ReadonlyArray<EntityId>;
750
619
  pendingBeforeIds?: ReadonlyArray<EntityId>;
751
620
  }>;
621
+ type StoreHydrationState = Readonly<{
622
+ coverage: ReadonlyArray<readonly [EntityId, ReadonlyArray<string>]>;
623
+ lists: ReadonlyArray<readonly [string, List]>;
624
+ records: ReadonlyArray<readonly [EntityId, AnyRecord]>;
625
+ }>;
752
626
  declare class Store {
753
627
  private coverage;
754
628
  private listKeysByOwnerField;
@@ -759,6 +633,11 @@ declare class Store {
759
633
  private records;
760
634
  private subscriptions;
761
635
  private listSubscriptions;
636
+ dehydrate(): StoreHydrationState;
637
+ hydrate(state: StoreHydrationState, mode: 'preserve-existing' | 'replace', options?: {
638
+ deferNotifications?: boolean;
639
+ }): () => void;
640
+ private rebuildIndexes;
762
641
  read(id: EntityId): AnyRecord | undefined;
763
642
  merge(id: EntityId, partial: AnyRecord, paths: Iterable<string>): void;
764
643
  private mergeInternal;
@@ -796,6 +675,61 @@ declare class Store {
796
675
  private updateRecordReferenceIndexes;
797
676
  }
798
677
  //#endregion
678
+ //#region src/hydration.d.ts
679
+ /** JSON-safe opaque value contained in a dehydrated fate snapshot. */
680
+ type FateSerializedValue = null | boolean | number | string | ReadonlyArray<FateSerializedValue> | Readonly<{
681
+ [key: string]: FateSerializedValue;
682
+ }>;
683
+ /** Versioned, JSON-safe durable cache snapshot produced by `FateClient.dehydrate()`. */
684
+ declare const hydrationScopeBrand: unique symbol;
685
+ type FateDehydratedState<Scope extends string = string> = Readonly<{
686
+ data: FateSerializedValue;
687
+ readonly [hydrationScopeBrand]?: Scope;
688
+ scope: Scope;
689
+ version: 1;
690
+ }>;
691
+ /** Controls how `FateClient.hydrate()` reconciles a snapshot with browser cache state. */
692
+ type HydrateOptions = Readonly<{
693
+ /**
694
+ * `preserve-existing` keeps browser values and list windows when conflicts
695
+ * occur. `replace` treats the snapshot as authoritative.
696
+ *
697
+ * @defaultValue 'preserve-existing'
698
+ */
699
+ merge?: 'preserve-existing' | 'replace';
700
+ }>;
701
+ /** Resource limits applied while encoding and decoding hydration snapshots. */
702
+ type HydrationLimits = Readonly<{
703
+ /** Maximum number of entries in any encoded array or object. */maxCollectionLength: number; /** Maximum number of encoded values in a hydration snapshot. */
704
+ maxNodes: number; /** Maximum length of an encoded string, object key, or bigint payload. */
705
+ maxStringLength: number;
706
+ }>;
707
+ //#endregion
708
+ //#region src/selection.d.ts
709
+ /**
710
+ * Representation of a composed selection including hashed args and the
711
+ * flat set of field paths to read or fetch.
712
+ */
713
+ type SelectionPlan = {
714
+ readonly args: Map<string, Readonly<{
715
+ hash: string;
716
+ ignoreKeys?: ReadonlySet<string>;
717
+ value: AnyRecord;
718
+ }>>;
719
+ readonly live: Map<string, ConnectionLivePolicy>;
720
+ readonly paths: Set<string>;
721
+ };
722
+ /**
723
+ * Flattens a view into a `SelectionPlan`, expanding composed views and
724
+ * partitioning nested args so the client can fetch exactly what is declared.
725
+ */
726
+ declare const getSelectionPlan: <T extends Entity, S extends Selection<T>, V extends View<T, S>>(viewComposition: V, ref: ViewRef<T["__typename"]> | null) => SelectionPlan;
727
+ //#endregion
728
+ //#region src/operation-lifetime.d.ts
729
+ type RetainHandle = Readonly<{
730
+ dispose(): void;
731
+ }>;
732
+ //#endregion
799
733
  //#region src/client.d.ts
800
734
  /**
801
735
  * Strategy used when resolving a request.
@@ -807,7 +741,7 @@ type RequestMode = /** (default) Use cached data if present, otherwise fetch. */
807
741
  type RequestOptions = Readonly<{
808
742
  mode?: RequestMode;
809
743
  }>;
810
- type FateClientOptions<Roots extends FateRoots, Mutations extends FateMutations> = {
744
+ type FateClientOptions<Roots extends FateRoots, Mutations extends FateMutations, HydrationScope extends string> = {
811
745
  /**
812
746
  * Number of recently released requests to keep retained before their records
813
747
  * and lists are eligible for garbage collection.
@@ -815,6 +749,15 @@ type FateClientOptions<Roots extends FateRoots, Mutations extends FateMutations>
815
749
  * @defaultValue 10
816
750
  */
817
751
  gcReleaseBufferSize?: number;
752
+ /**
753
+ * Bounds hydration snapshot encoding and decoding work.
754
+ */
755
+ hydrationLimits?: Partial<HydrationLimits>;
756
+ /**
757
+ * Identifies snapshots compatible with this client. Change this value when
758
+ * deploying an incompatible cache schema or separating cache namespaces.
759
+ */
760
+ hydrationScope?: HydrationScope;
818
761
  mutations?: Mutations;
819
762
  onLiveError?: (error: unknown) => void;
820
763
  roots: Roots;
@@ -827,7 +770,7 @@ type FateClientOptions<Roots extends FateRoots, Mutations extends FateMutations>
827
770
  * Core client that normalizes records, manages the view cache, and coordinates
828
771
  * data fetching.
829
772
  */
830
- declare class FateClient<Roots extends FateRoots, Mutations extends FateMutations> {
773
+ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutations, HydrationScope extends string = string> {
831
774
  private readonly mutationMap;
832
775
  private readonly parentLists;
833
776
  private readonly rootLists;
@@ -846,8 +789,11 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
846
789
  private readonly stalledRequests;
847
790
  private gcPending;
848
791
  private gcScheduled;
792
+ private pendingNetworkRequests;
849
793
  readonly store: Store;
850
794
  private readonly operationLifetime;
795
+ private readonly hydrationLimits;
796
+ private readonly hydrationScope;
851
797
  private readonly types;
852
798
  private readonly transport;
853
799
  private readonly viewDataCache;
@@ -855,8 +801,20 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
855
801
  readonly actions: MutationActionsFor<Mutations>;
856
802
  readonly mutations: MutationFunctionsFor<Mutations>;
857
803
  readonly roots: Roots;
858
- constructor(options: FateClientOptions<Roots, Mutations>);
804
+ constructor(options: FateClientOptions<Roots, Mutations, HydrationScope>);
859
805
  private initializeParentLists;
806
+ /**
807
+ * Exports the durable normalized cache as an opaque JSON-safe value for SSR
808
+ * transfer or persistence. Runtime requests, subscriptions, retainers, and
809
+ * optimistic state are intentionally excluded.
810
+ */
811
+ dehydrate(): FateDehydratedState<HydrationScope>;
812
+ /**
813
+ * Restores a durable normalized cache snapshot without restoring runtime
814
+ * request handles, retainers, subscriptions, or optimistic update state.
815
+ * Hydrate before rendering SSR content. Replaying the same snapshot is safe.
816
+ */
817
+ hydrate(state: FateDehydratedState<HydrationScope>, options?: HydrateOptions): void;
860
818
  private registerRootList;
861
819
  private snapshotList;
862
820
  private applyListInsert;
@@ -914,6 +872,7 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
914
872
  pendingAfterIds?: ReadonlyArray<EntityId>;
915
873
  pendingBeforeIds?: ReadonlyArray<EntityId>;
916
874
  }> | undefined>;
875
+ private loadConnectionInternal;
917
876
  request<R extends Request$1>(request: R, options?: RequestOptions): Promise<RequestResult<Roots, R>>;
918
877
  requestForRender<R extends Request$1>(request: R, options?: RequestOptions): Promise<RequestResult<Roots, R>>;
919
878
  prepareRequestForRender<R extends Request$1>(request: R, options: RequestOptions | undefined): Readonly<{
@@ -946,6 +905,8 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
946
905
  private executeRequestHandle;
947
906
  private markRecordReferences;
948
907
  private hasActiveOptimisticUpdates;
908
+ private hasPendingRequests;
909
+ trackPendingRequest<T>(request: () => Promise<T>): Promise<T>;
949
910
  private runPendingGarbageCollection;
950
911
  private handleStoreAndNetworkRequest;
951
912
  private getRootType;
@@ -970,7 +931,7 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
970
931
  private releaseLiveSubscription;
971
932
  private reportLiveError;
972
933
  }
973
- declare function createClient<T extends [FateRoots, FateMutations] = [Record<never, RootDefinition<any, any>>, Record<never, MutationDefinition<any, any, any>>]>(options: FateClientOptions<T[0], T[1]>): FateClient<T[0], T[1]>;
934
+ declare function createClient<T extends [FateRoots, FateMutations] = [Record<never, RootDefinition<any, any>>, Record<never, MutationDefinition<any, any, any>>], HydrationScope extends string = string>(options: FateClientOptions<T[0], T[1], HydrationScope>): FateClient<T[0], T[1], HydrationScope>;
974
935
  //#endregion
975
936
  //#region src/mutation.d.ts
976
937
  /**
@@ -1342,4 +1303,111 @@ interface FateThenable<T> extends PromiseLike<T> {
1342
1303
  value: T;
1343
1304
  }
1344
1305
  //#endregion
1345
- export { ViewRef as A, RequestMode as B, Snapshot as C, ViewData as D, View as E, __FateSelectionBrand as F, createTRPCTransport as G, createClient as H, isViewTag as I, getSelectionPlan as J, AnyProcedure as K, FateMutations as L, ViewSnapshot as M, ViewTag as N, ViewEntity as O, __FateEntityBrand as P, mutation as R, Selection as S, TypeName as T, List as U, RequestOptions as V, Transport as W, NodesItem as _, Entity as a, RequestResult as b, FateThenable as c, MutationDefinition as d, MutationEntity as f, MutationShape as g, MutationResult as h, ConnectionTag as i, ViewSelection as j, ViewEntityName as k, ListItem as l, MutationInput as m, ConnectionMetadata as n, EntityId as o, MutationIdentifier as p, QueryProcedure as q, ConnectionRef as r, FateRoots as s, AnyRecord as t, Mask as u, Pagination as v, TypeConfig as w, RootDefinition as x, Request$1 as y, FateClient as z };
1306
+ //#region src/transport.d.ts
1307
+ /**
1308
+ * Normalized representation of args passed to a transport.
1309
+ */
1310
+ type ResolvedArgsPayload = AnyRecord;
1311
+ type TransportMutations = Record<string, MutationShape>;
1312
+ type EmptyTransportMutations = Record<never, MutationShape>;
1313
+ type Bivariant<Fn extends (...args: Array<any>) => any> = {
1314
+ bivarianceHack: Fn;
1315
+ }['bivarianceHack'];
1316
+ type TRPCListResult = {
1317
+ items: Array<{
1318
+ cursor?: string;
1319
+ node?: unknown;
1320
+ }>;
1321
+ pagination: Pagination;
1322
+ };
1323
+ type LiveEventHandlers = Readonly<{
1324
+ onData: (record: unknown, select?: ReadonlyArray<string>) => void;
1325
+ onDelete?: (id?: string | number) => void;
1326
+ onError?: (error: unknown) => void;
1327
+ }>;
1328
+ type LiveConnectionEvent = Readonly<{
1329
+ edge: {
1330
+ cursor?: string;
1331
+ node: unknown;
1332
+ };
1333
+ nodeType: string;
1334
+ targetCursor?: string;
1335
+ type: 'appendEdge' | 'appendNode' | 'insertEdgeAfter' | 'insertEdgeBefore' | 'prependEdge' | 'prependNode';
1336
+ }> | Readonly<{
1337
+ id: string | number;
1338
+ nodeType: string;
1339
+ type: 'deleteEdge';
1340
+ }> | Readonly<{
1341
+ type: 'invalidate';
1342
+ }>;
1343
+ type LiveConnectionEventHandlers = Readonly<{
1344
+ onError?: (error: unknown) => void;
1345
+ onEvent: (event: LiveConnectionEvent) => void;
1346
+ }>;
1347
+ /**
1348
+ * Contract the fate client expects from a network transport. The transport is
1349
+ * responsible for fetching records by ID, fetching lists, and executing
1350
+ * mutations with the provided selections.
1351
+ */
1352
+ interface Transport<Mutations extends TransportMutations = EmptyTransportMutations> {
1353
+ fetchById(type: string, ids: Array<string | number>, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<Array<unknown>>;
1354
+ fetchList?(proc: string, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<{
1355
+ items: Array<{
1356
+ cursor: string | undefined;
1357
+ node: unknown;
1358
+ }>;
1359
+ pagination: Pagination;
1360
+ }>;
1361
+ fetchQuery?(proc: string, select: Iterable<string>, args?: ResolvedArgsPayload): Promise<unknown>;
1362
+ mutate?<K extends Extract<keyof Mutations, string>>(proc: K, input: Mutations[K]['input'], select: Set<string>): Promise<Mutations[K]['output']>;
1363
+ subscribeById?(type: string, id: string | number, select: Iterable<string>, args: ResolvedArgsPayload | undefined, handlers: LiveEventHandlers): () => void;
1364
+ subscribeConnection?(procedure: string, type: string, args: ResolvedArgsPayload | undefined, select: Iterable<string>, selectionArgs: ResolvedArgsPayload | undefined, handlers: LiveConnectionEventHandlers): () => void;
1365
+ }
1366
+ /**
1367
+ * Mapping of entity type to tRPC procedures used for fetching entities by ID.
1368
+ */
1369
+ type TRPCByIdResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => (input: {
1370
+ args?: ResolvedArgsPayload;
1371
+ ids: Array<string | number>;
1372
+ select: Array<string>;
1373
+ }) => Promise<unknown>>;
1374
+ /**
1375
+ * Mapping of list procedure name to a tRPC resolver factory.
1376
+ */
1377
+ type TRPCListResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => Bivariant<(input: any) => Promise<TRPCListResult>>>;
1378
+ /**
1379
+ * Mapping of query procedure name to a tRPC resolver factory.
1380
+ */
1381
+ type TRPCQueryResolvers<AppRouter extends AnyRouter> = Record<string, (client: TRPCClient<AppRouter>) => (input: {
1382
+ args?: ResolvedArgsPayload;
1383
+ select: Array<string>;
1384
+ }) => Promise<unknown>>;
1385
+ /**
1386
+ * Mapping of a mutation procedure name to a tRPC resolver factory.
1387
+ */
1388
+ type MutationResolver<AppRouter extends AnyRouter> = (client: TRPCClient<AppRouter>) => (input: any) => Promise<any>;
1389
+ type TRPCMutationResolvers<AppRouter extends AnyRouter> = Record<string, MutationResolver<AppRouter>>;
1390
+ type MutationMapFromResolvers<R extends Record<string, MutationResolver<any>>> = { [K in keyof R]: R[K] extends ((client: any) => (input: infer Input) => Promise<infer Output>) ? {
1391
+ input: Input;
1392
+ output: Output;
1393
+ } : never };
1394
+ type EmptyMutationResolvers<AppRouter extends AnyRouter> = Record<never, MutationResolver<AppRouter>>;
1395
+ /**
1396
+ * Builds a `Transport` backed by a tRPC client using the configured resolvers
1397
+ * for by-id queries, lists, and mutations.
1398
+ */
1399
+ declare function createTRPCTransport<AppRouter extends AnyRouter, Mutations extends TRPCMutationResolvers<AppRouter> = EmptyMutationResolvers<AppRouter>>({
1400
+ byId,
1401
+ client,
1402
+ lists,
1403
+ mutations,
1404
+ queries
1405
+ }: {
1406
+ byId: TRPCByIdResolvers<AppRouter>;
1407
+ client: TRPCClient<AppRouter>;
1408
+ lists?: TRPCListResolvers<AppRouter>;
1409
+ mutations?: Mutations;
1410
+ queries?: TRPCQueryResolvers<AppRouter>;
1411
+ }): Transport<MutationMapFromResolvers<Mutations>>;
1412
+ //#endregion
1413
+ export { ViewEntity as A, mutation as B, RootDefinition as C, TypeName as D, TypeConfig as E, ViewTag as F, getSelectionPlan as G, RequestMode as H, __FateEntityBrand as I, HydrationLimits as J, FateDehydratedState as K, __FateSelectionBrand as L, ViewRef as M, ViewSelection as N, View as O, ViewSnapshot as P, isViewTag as R, RequestResult as S, Snapshot as T, RequestOptions as U, FateClient as V, createClient as W, AnyProcedure as X, List as Y, QueryProcedure as Z, MutationResult as _, ConnectionRef as a, Pagination as b, EntityId as c, ListItem as d, Mask as f, MutationInput as g, MutationIdentifier as h, ConnectionMetadata as i, ViewEntityName as j, ViewData as k, FateRoots as l, MutationEntity as m, createTRPCTransport as n, ConnectionTag as o, MutationDefinition as p, HydrateOptions as q, AnyRecord as r, Entity as s, Transport as t, FateThenable as u, MutationShape as v, Selection as w, Request$1 as x, NodesItem as y, FateMutations as z };