@nkzw/fate 1.3.3 → 1.4.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 (169) hide show
  1. package/docs/api/classes/FateClient.md +40 -40
  2. package/docs/api/functions/clientRoot.md +1 -1
  3. package/docs/api/functions/createClient.md +1 -1
  4. package/docs/api/functions/createGraphQLTransport.md +1 -1
  5. package/docs/api/functions/createHTTPTransport.md +1 -1
  6. package/docs/api/functions/createTRPCTransport.md +1 -1
  7. package/docs/api/functions/defer.md +1 -1
  8. package/docs/api/functions/getDeferredMetadata.md +1 -1
  9. package/docs/api/functions/getListEntries.md +1 -1
  10. package/docs/api/functions/getSelectionPlan.md +1 -1
  11. package/docs/api/functions/graphqlMutation.md +1 -1
  12. package/docs/api/functions/isDeferred.md +1 -1
  13. package/docs/api/functions/isRecord.md +1 -1
  14. package/docs/api/functions/isViewTag.md +1 -1
  15. package/docs/api/functions/liveConnectionTopic.md +1 -1
  16. package/docs/api/functions/liveEntityTopic.md +1 -1
  17. package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
  18. package/docs/api/functions/mutation.md +1 -1
  19. package/docs/api/functions/toEntityId.md +1 -1
  20. package/docs/api/functions/view.md +1 -1
  21. package/docs/api/interfaces/FateThenable.md +3 -3
  22. package/docs/api/interfaces/Transport.md +7 -7
  23. package/docs/api/server/classes/FateRequestError.md +5 -5
  24. package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
  25. package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
  26. package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
  27. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
  28. package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
  29. package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
  30. package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
  31. package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
  32. package/docs/api/server/functions/bindSourceProcedures.md +1 -1
  33. package/docs/api/server/functions/computed.md +1 -1
  34. package/docs/api/server/functions/count.md +1 -1
  35. package/docs/api/server/functions/createFateFetchHandler.md +1 -1
  36. package/docs/api/server/functions/createFateServer.md +1 -1
  37. package/docs/api/server/functions/createHonoFateHandler.md +1 -1
  38. package/docs/api/server/functions/createLiveEventBus.md +1 -1
  39. package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
  40. package/docs/api/server/functions/createResolver.md +1 -1
  41. package/docs/api/server/functions/createSourcePlan.md +1 -1
  42. package/docs/api/server/functions/createSourceProcedures.md +1 -1
  43. package/docs/api/server/functions/dataView.md +1 -1
  44. package/docs/api/server/functions/field.md +1 -1
  45. package/docs/api/server/functions/getNestedSelection.md +1 -1
  46. package/docs/api/server/functions/getScopedArgs.md +1 -1
  47. package/docs/api/server/functions/hasNestedSelection.md +1 -1
  48. package/docs/api/server/functions/list.md +1 -1
  49. package/docs/api/server/functions/refetchSourceById.md +1 -1
  50. package/docs/api/server/functions/resolveSourceById.md +1 -1
  51. package/docs/api/server/functions/resolveSourceByIds.md +1 -1
  52. package/docs/api/server/functions/resolveSourceConnection.md +1 -1
  53. package/docs/api/server/functions/resolver.md +1 -1
  54. package/docs/api/server/functions/toPrismaSelect.md +1 -1
  55. package/docs/api/server/functions/withConnection.md +1 -1
  56. package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
  57. package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
  58. package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
  59. package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
  60. package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
  61. package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
  62. package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
  63. package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
  64. package/docs/api/server/type-aliases/ComputedField.md +5 -5
  65. package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
  66. package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
  67. package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
  68. package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
  69. package/docs/api/server/type-aliases/CountSelection.md +4 -4
  70. package/docs/api/server/type-aliases/CountWhere.md +1 -1
  71. package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
  72. package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
  73. package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
  74. package/docs/api/server/type-aliases/DataViewResult.md +1 -1
  75. package/docs/api/server/type-aliases/Entity.md +1 -1
  76. package/docs/api/server/type-aliases/FateServer.md +5 -5
  77. package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
  78. package/docs/api/server/type-aliases/FieldSelection.md +3 -3
  79. package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
  80. package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
  81. package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
  82. package/docs/api/server/type-aliases/LiveEventType.md +1 -1
  83. package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
  84. package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
  85. package/docs/api/server/type-aliases/OrderDirection.md +1 -1
  86. package/docs/api/server/type-aliases/SourceConfig.md +6 -6
  87. package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
  88. package/docs/api/server/type-aliases/SourceOrder.md +1 -1
  89. package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
  90. package/docs/api/server/type-aliases/SourcePlan.md +1 -1
  91. package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
  92. package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
  93. package/docs/api/server/type-aliases/SourceRelation.md +1 -1
  94. package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
  95. package/docs/api/server/variables/byIdInput.md +1 -1
  96. package/docs/api/server/variables/connectionArgs.md +1 -1
  97. package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
  98. package/docs/api/type-aliases/ConnectionRef.md +1 -1
  99. package/docs/api/type-aliases/Deferred.md +1 -1
  100. package/docs/api/type-aliases/DeferredMetadata.md +1 -1
  101. package/docs/api/type-aliases/DeferredSelection.md +1 -1
  102. package/docs/api/type-aliases/DeferredSnapshot.md +1 -1
  103. package/docs/api/type-aliases/Entity.md +2 -2
  104. package/docs/api/type-aliases/EntityId.md +1 -1
  105. package/docs/api/type-aliases/FateDehydratedState.md +1 -1
  106. package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
  107. package/docs/api/type-aliases/FateLiveEvent.md +1 -1
  108. package/docs/api/type-aliases/FateMutations.md +1 -1
  109. package/docs/api/type-aliases/FateOperation.md +1 -1
  110. package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
  111. package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
  112. package/docs/api/type-aliases/FateRecord.md +1 -1
  113. package/docs/api/type-aliases/FateRoots.md +1 -1
  114. package/docs/api/type-aliases/GraphQLMutationDefinition.md +1 -1
  115. package/docs/api/type-aliases/GraphQLMutationInput.md +1 -1
  116. package/docs/api/type-aliases/GraphQLMutationMap.md +1 -1
  117. package/docs/api/type-aliases/GraphQLMutationOutput.md +1 -1
  118. package/docs/api/type-aliases/GraphQLTransportOptions.md +11 -11
  119. package/docs/api/type-aliases/HydrateOptions.md +1 -1
  120. package/docs/api/type-aliases/HydrationLimits.md +1 -1
  121. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  122. package/docs/api/type-aliases/List.md +1 -1
  123. package/docs/api/type-aliases/ListEntry.md +1 -1
  124. package/docs/api/type-aliases/ListItem.md +1 -1
  125. package/docs/api/type-aliases/Mask.md +1 -1
  126. package/docs/api/type-aliases/MutationDefinition.md +1 -1
  127. package/docs/api/type-aliases/MutationEntity.md +1 -1
  128. package/docs/api/type-aliases/MutationIdentifier.md +1 -1
  129. package/docs/api/type-aliases/MutationInput.md +1 -1
  130. package/docs/api/type-aliases/MutationResult.md +1 -1
  131. package/docs/api/type-aliases/NodesItem.md +1 -1
  132. package/docs/api/type-aliases/Pagination.md +5 -5
  133. package/docs/api/type-aliases/Request.md +1 -1
  134. package/docs/api/type-aliases/RequestMode.md +1 -1
  135. package/docs/api/type-aliases/RequestOptions.md +1 -1
  136. package/docs/api/type-aliases/RequestResult.md +1 -1
  137. package/docs/api/type-aliases/Selection.md +1 -1
  138. package/docs/api/type-aliases/Snapshot.md +1 -1
  139. package/docs/api/type-aliases/TypeConfig.md +4 -4
  140. package/docs/api/type-aliases/View.md +1 -1
  141. package/docs/api/type-aliases/ViewData.md +1 -1
  142. package/docs/api/type-aliases/ViewEntity.md +1 -1
  143. package/docs/api/type-aliases/ViewEntityName.md +1 -1
  144. package/docs/api/type-aliases/ViewRef.md +1 -1
  145. package/docs/api/type-aliases/ViewSelection.md +1 -1
  146. package/docs/api/type-aliases/ViewSnapshot.md +1 -1
  147. package/docs/api/type-aliases/ViewTag.md +1 -1
  148. package/docs/api/variables/ConnectionTag.md +1 -1
  149. package/docs/api/variables/DeferTag.md +1 -1
  150. package/docs/api/variables/DeferredTag.md +1 -1
  151. package/lib/cli.d.mts +1 -1
  152. package/lib/{executor-C8HNogYG.d.mts → executor-BRudKWDY.d.mts} +18 -65
  153. package/lib/{graphqlTransport-DskuXeUP.d.mts → graphqlTransport-BDR1pnUQ.d.mts} +3 -14
  154. package/lib/graphqlTransport.d.mts +1 -1
  155. package/lib/index.d.mts +6 -15
  156. package/lib/index.mjs +711 -623
  157. package/lib/{list-sI2UPhHc.d.mts → list-Bb1SeABn.d.mts} +1 -2
  158. package/lib/list.d.mts +1 -1
  159. package/lib/{record-CZyyeLa3.d.mts → record-BTUXkHQU.d.mts} +9 -18
  160. package/lib/server/drizzle.d.mts +45 -114
  161. package/lib/server/drizzle.mjs +1 -1
  162. package/lib/server/prisma.d.mts +52 -127
  163. package/lib/server/prisma.mjs +8 -2
  164. package/lib/server.d.mts +4 -16
  165. package/lib/server.mjs +2 -28
  166. package/lib/{transport-DhaVVq4P.d.mts → transport-Bo1Jgo9R.d.mts} +76 -103
  167. package/lib/vite.d.mts +0 -1
  168. package/lib/vite.mjs +1 -1
  169. package/package.json +5 -5
@@ -187,7 +187,10 @@ function createPrismaSourceAdapter({ prisma, views }) {
187
187
  items: await delegate.findMany({
188
188
  ...extra,
189
189
  select: toPrismaSelect(plan),
190
- where: { id: { in: ids } }
190
+ where: {
191
+ ...extra?.where ? { AND: [extra.where] } : {},
192
+ id: { in: ids }
193
+ }
191
194
  }),
192
195
  plan
193
196
  });
@@ -199,7 +202,10 @@ function createPrismaSourceAdapter({ prisma, views }) {
199
202
  items: (await Promise.all([delegate.findUnique({
200
203
  ...extra,
201
204
  select: toPrismaSelect(plan),
202
- where: { id }
205
+ where: {
206
+ ...extra?.where ? { AND: [extra.where] } : {},
207
+ id
208
+ }
203
209
  })])).flatMap((item) => item ? [item] : []),
204
210
  plan
205
211
  }))[0] ?? null;
package/lib/server.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import { nt as AnyProcedure, r as AnyRecord$1 } from "./transport-DhaVVq4P.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-CZyyeLa3.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-C8HNogYG.mjs";
1
+ import { r as AnyRecord$1, tt as AnyProcedure } from "./transport-Bo1Jgo9R.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-BTUXkHQU.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-BRudKWDY.mjs";
4
4
  import { z } from "zod";
5
-
6
5
  //#region src/server/input.d.ts
7
6
  declare const byIdInput: z.ZodObject<{
8
7
  args: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
@@ -12,10 +11,6 @@ declare const byIdInput: z.ZodObject<{
12
11
  //#endregion
13
12
  //#region src/server/prismaSelect.d.ts
14
13
  type AnyRecord = Record<string, unknown>;
15
- /**
16
- * Builds a Prisma `select` object from flattened selection paths and optional
17
- * scoped args, always including the `id` field.
18
- */
19
14
  declare function toPrismaSelect<Item extends AnyRecord, Context = unknown>(plan: ViewPlan<Item, Context>): AnyRecord;
20
15
  //#endregion
21
16
  //#region src/server/queryArgs.d.ts
@@ -79,14 +74,7 @@ type SourceProcedureResult<ById extends boolean | undefined, List extends boolea
79
74
  * Use this when a router also has custom mutations or custom queries and you
80
75
  * want to spread the generated source procedures into that router.
81
76
  */
82
- declare function createSourceProcedures<Context, Item extends AnyRecord$1, Procedure extends ProcedureLike, ConnectionProcedure extends ConnectionProcedureLike | undefined = ConnectionProcedureLike | undefined, ById extends boolean | undefined = undefined, List extends boolean | ListConfig | undefined = undefined>({
83
- byId,
84
- createConnectionProcedure,
85
- list,
86
- procedure,
87
- registry,
88
- source
89
- }: SourceProcedureOptions<Context, Item, Procedure, ConnectionProcedure> & {
77
+ declare function createSourceProcedures<Context, Item extends AnyRecord$1, Procedure extends ProcedureLike, ConnectionProcedure extends ConnectionProcedureLike | undefined = ConnectionProcedureLike | undefined, ById extends boolean | undefined = undefined, List extends boolean | ListConfig | undefined = undefined>({ byId, createConnectionProcedure, list, procedure, registry, source }: SourceProcedureOptions<Context, Item, Procedure, ConnectionProcedure> & {
90
78
  byId?: ById;
91
79
  list?: List;
92
80
  }): SourceProcedureResult<ById, List, Procedure, ConnectionProcedure>;
package/lib/server.mjs CHANGED
@@ -315,8 +315,7 @@ const assertLiveControlRequest = (value) => {
315
315
  const sse = (message, eventId) => {
316
316
  const lines = [];
317
317
  if (eventId) lines.push(`id: ${eventId}`);
318
- lines.push(`event: ${message.kind}`);
319
- lines.push(`data: ${JSON.stringify(message)}`);
318
+ lines.push(`event: ${message.kind}`, `data: ${JSON.stringify(message)}`);
320
319
  return `${lines.join("\n")}\n\n`;
321
320
  };
322
321
  const sseComment = (message) => `: ${message}\n\n`;
@@ -343,28 +342,7 @@ const filterLiveSelection = (source, select, changed) => {
343
342
  }
344
343
  return [...result];
345
344
  };
346
- const hasSelectedDataPath = (value, segments) => {
347
- if (segments.length === 0) return true;
348
- if (Array.isArray(value)) return value.every((entry) => hasSelectedDataPath(entry, segments));
349
- if (!isRecord(value)) return false;
350
- const [field, ...rest] = segments;
351
- return field in value && hasSelectedDataPath(value[field], rest);
352
- };
353
- const canUseLiveEventData = (data, selectedPaths) => {
354
- if (!isRecord(data)) return false;
355
- for (const path of selectedPaths) if (!hasSelectedDataPath(data, path.split("."))) return false;
356
- return true;
357
- };
358
- const resolveLiveSourceData = async ({ ctx, data, id, input, registry, source }) => {
359
- if (data !== void 0) {
360
- if (data == null) return data;
361
- const plan = createSourcePlan({
362
- ...input,
363
- ctx,
364
- source
365
- });
366
- if (canUseLiveEventData(data, plan.selectedPaths)) return await plan.resolve(data);
367
- }
345
+ const resolveLiveSourceData = async ({ ctx, id, input, registry, source }) => {
368
346
  return id == null ? null : await resolveSourceById({
369
347
  ctx,
370
348
  id: String(id),
@@ -591,7 +569,6 @@ function createFateServer({ context, lists, live, mutations, queries, roots, sou
591
569
  };
592
570
  const data = event.type === "delete" ? null : await resolveLiveSourceData({
593
571
  ctx: connection.ctx,
594
- data: event.data,
595
572
  id: event.id,
596
573
  input,
597
574
  registry: sources.registry,
@@ -609,7 +586,6 @@ function createFateServer({ context, lists, live, mutations, queries, roots, sou
609
586
  const source = nodeType ? sourcesByType.get(nodeType) : null;
610
587
  const node = event.type === "deleteEdge" || event.type === "invalidate" ? null : source ? await resolveLiveSourceData({
611
588
  ctx: connection.ctx,
612
- data: event.node,
613
589
  id: event.id,
614
590
  input: {
615
591
  args: operation.selectionArgs,
@@ -670,7 +646,6 @@ function createFateServer({ context, lists, live, mutations, queries, roots, sou
670
646
  };
671
647
  const data = event.type === "delete" ? null : await resolveLiveSourceData({
672
648
  ctx: connection.ctx,
673
- data: event.data,
674
649
  id: event.id,
675
650
  input,
676
651
  registry: sources.registry,
@@ -747,7 +722,6 @@ function createFateServer({ context, lists, live, mutations, queries, roots, sou
747
722
  const source = nodeType ? sourcesByType.get(nodeType) : null;
748
723
  const node = event.type === "deleteEdge" || event.type === "invalidate" ? null : source ? await resolveLiveSourceData({
749
724
  ctx: connection.ctx,
750
- data: event.node,
751
725
  id: event.id,
752
726
  input: {
753
727
  args: operation.selectionArgs,
@@ -1,6 +1,5 @@
1
1
  import { TRPCClient } from "@trpc/client";
2
-
3
- //#region ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/index.d-D4qZxQJh.d.mts
2
+ //#region ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@7.0.2/node_modules/@trpc/server/dist/index.d-D4qZxQJh.d.mts
4
3
  //#region src/observable/types.d.ts
5
4
  interface Unsubscribable {
6
5
  unsubscribe(): void;
@@ -24,7 +23,7 @@ interface Observer<TValue, TError> {
24
23
  type UnaryFunction<TSource, TReturn> = (source: TSource) => TReturn;
25
24
  type OperatorFunction<TValueBefore, TErrorBefore, TValueAfter, TErrorAfter> = UnaryFunction<Subscribable<TValueBefore, TErrorBefore>, Subscribable<TValueAfter, TErrorAfter>>;
26
25
  //#endregion
27
- //#region ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@6.0.3/node_modules/@trpc/server/dist/unstable-core-do-not-import.d-BdVSvUCr.d.mts
26
+ //#region ../../node_modules/.pnpm/@trpc+server@11.18.0_typescript@7.0.2/node_modules/@trpc/server/dist/unstable-core-do-not-import.d-BdVSvUCr.d.mts
28
27
  /**
29
28
  * @public
30
29
  */
@@ -75,10 +74,6 @@ declare const TRPC_ERROR_CODES_BY_KEY: {
75
74
  };
76
75
  type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
77
76
  type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
78
- /**
79
- * tRPC error codes that are considered retryable
80
- * With out of the box SSE, the client will reconnect when these errors are encountered
81
- */
82
77
  declare class TRPCError extends Error {
83
78
  readonly cause?: Error;
84
79
  readonly code: "PARSE_ERROR" | "BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_SUPPORTED" | "TIMEOUT" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "UNPROCESSABLE_CONTENT" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST";
@@ -87,7 +82,7 @@ declare class TRPCError extends Error {
87
82
  code: TRPC_ERROR_CODE_KEY;
88
83
  cause?: unknown;
89
84
  });
90
- } //# sourceMappingURL=TRPCError.d.ts.map
85
+ }
91
86
  //#endregion
92
87
  //#region src/vendor/standard-schema-v1/spec.d.ts
93
88
  /**
@@ -148,7 +143,7 @@ declare namespace StandardSchemaV1 {
148
143
  type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
149
144
  /** Infers the output type of a Standard Schema. */
150
145
  type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
151
- } //# sourceMappingURL=spec.d.ts.map
146
+ }
152
147
  //#endregion
153
148
  //#region src/unstable-core-do-not-import/parser.d.ts
154
149
  type ParserZodEsque<TInput, TParsedInput> = {
@@ -198,7 +193,8 @@ interface ProcedureCallOptions<TContext> {
198
193
  * The index of this call in a batch request.
199
194
  */
200
195
  batchIndex: number;
201
- } //#endregion
196
+ }
197
+ //#endregion
202
198
  //#region src/unstable-core-do-not-import/procedure.d.ts
203
199
  declare const procedureTypes: readonly ["query", "mutation", "subscription"];
204
200
  /**
@@ -268,11 +264,7 @@ interface ErrorHandlerOptions<TContext> {
268
264
  path: string | undefined;
269
265
  input: unknown;
270
266
  ctx: TContext | undefined;
271
- } //#endregion
272
- //#region src/unstable-core-do-not-import/http/types.d.ts
273
- /**
274
- * @deprecated use `Headers` instead, this will be removed in v12
275
- */
267
+ }
276
268
  //#endregion
277
269
  //#region src/unstable-core-do-not-import/rpc/envelopes.d.ts
278
270
  /**
@@ -283,10 +275,6 @@ interface TRPCErrorShape<TData extends object = object> {
283
275
  message: string;
284
276
  data: TData;
285
277
  }
286
- /**
287
- * JSON-RPC 2.0 Specification
288
- */
289
- //# sourceMappingURL=envelopes.d.ts.map
290
278
  //#endregion
291
279
  //#region src/unstable-core-do-not-import/transformer.d.ts
292
280
  /**
@@ -329,10 +317,6 @@ interface CombinedDataTransformer {
329
317
  */
330
318
  output: OutputDataTransformer;
331
319
  }
332
- /**
333
- * @public
334
- */
335
- //# sourceMappingURL=parseTRPCMessage.d.ts.map
336
320
  //#endregion
337
321
  //#region src/unstable-core-do-not-import/error/formatter.d.ts
338
322
  /**
@@ -390,11 +374,6 @@ interface JSONLProducerOptions {
390
374
  */
391
375
  pingMs?: number;
392
376
  }
393
- /**
394
- * JSON Lines stream producer
395
- * @see https://jsonlines.org/
396
- */
397
- //# sourceMappingURL=sse.types.d.ts.map
398
377
  //#endregion
399
378
  //#region src/unstable-core-do-not-import/stream/sse.d.ts
400
379
  type Serialize$1 = (value: any) => any;
@@ -445,10 +424,6 @@ interface SSEStreamProducerOptions<TValue = unknown> {
445
424
  */
446
425
  client?: SSEClientOptions;
447
426
  }
448
- /**
449
- *
450
- * @see https://html.spec.whatwg.org/multipage/server-sent-events.html
451
- */
452
427
  //#endregion
453
428
  //#region src/unstable-core-do-not-import/rootConfig.d.ts
454
429
  /**
@@ -461,9 +436,6 @@ interface RootTypes {
461
436
  errorShape: DefaultErrorShape;
462
437
  transformer: boolean;
463
438
  }
464
- /**
465
- * The default check to see if we're in a server
466
- */
467
439
  /**
468
440
  * The tRPC root config
469
441
  * @internal
@@ -540,7 +512,7 @@ type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedure
540
512
  /**
541
513
  * @internal
542
514
  */
543
- type DecorateRouterRecord<TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedure<$Value> : $Value extends RouterRecord ? DecorateRouterRecord<$Value> : never : never };
515
+ type DecorateRouterRecord<TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends (infer $Value) ? $Value extends AnyProcedure ? DecorateProcedure<$Value> : $Value extends RouterRecord ? DecorateRouterRecord<$Value> : never : never; };
544
516
  /**
545
517
  * @internal
546
518
  */
@@ -563,10 +535,6 @@ type LazyLoader<TAny> = {
563
535
  load: () => Promise<void>;
564
536
  ref: Lazy<TAny>;
565
537
  };
566
- /**
567
- * Lazy load a router
568
- * @see https://trpc.io/docs/server/merging-routers#lazy-load
569
- */
570
538
  /**
571
539
  * @internal
572
540
  */
@@ -587,14 +555,10 @@ interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
587
555
  }
588
556
  type AnyRouter = Router<any, any>;
589
557
  //#endregion
590
- //#region src/mask.d.ts
591
- type FieldMask = {
592
- all: boolean;
593
- children: Map<string, FieldMask>;
594
- };
595
- //#endregion
596
558
  //#region src/cache.d.ts
597
559
  declare class ViewDataCache {
560
+ private readonly isEnabled;
561
+ constructor(isEnabled?: () => boolean);
598
562
  private cache;
599
563
  private rootDependencies;
600
564
  private dependencyIndex;
@@ -624,6 +588,7 @@ type StoreHydrationState = Readonly<{
624
588
  records: ReadonlyArray<readonly [EntityId, AnyRecord]>;
625
589
  }>;
626
590
  declare class Store {
591
+ private readonly onRebase?;
627
592
  private coverage;
628
593
  private listKeysByOwnerField;
629
594
  private listKeysByReferencedEntity;
@@ -633,6 +598,21 @@ declare class Store {
633
598
  private records;
634
599
  private subscriptions;
635
600
  private listSubscriptions;
601
+ private readonly optimisticLayers;
602
+ private readonly optimisticBase;
603
+ private recordingLayer;
604
+ private rebase;
605
+ constructor(onRebase?: ((ids: ReadonlySet<EntityId>) => void) | undefined);
606
+ get hasOptimisticUpdates(): boolean;
607
+ get isRebasing(): boolean;
608
+ /** Apply a synchronous cache update beneath the pending optimistic layers. */
609
+ update<T>(apply: () => T): T;
610
+ private getRebaseChanges;
611
+ /** Returns an idempotent settlement function; omit its update to roll back. */
612
+ optimisticUpdate(apply: () => void): (commit?: () => void) => void;
613
+ private getPendingOverlap;
614
+ private captureRecord;
615
+ private captureList;
636
616
  dehydrate(): StoreHydrationState;
637
617
  hydrate(state: StoreHydrationState, mode: 'preserve-existing' | 'replace', options?: {
638
618
  deferNotifications?: boolean;
@@ -661,9 +641,8 @@ declare class Store {
661
641
  };
662
642
  private deleteList;
663
643
  subscribeList(key: string, fn: () => void): () => void;
664
- removeReferencesTo(targetId: EntityId, viewDataCache: ViewDataCache, snapshots?: Map<EntityId, Snapshot>, listSnapshots?: Map<string, List>): void;
665
- snapshot(id: EntityId): Snapshot;
666
- restore(id: EntityId, snapshot: Snapshot): void;
644
+ removeReferencesTo(targetId: EntityId, viewDataCache: ViewDataCache): void;
645
+ private restore;
667
646
  private addListIndexes;
668
647
  private removeListIndexes;
669
648
  private getListReferencedEntityIds;
@@ -700,8 +679,11 @@ type HydrateOptions = Readonly<{
700
679
  }>;
701
680
  /** Resource limits applied while encoding and decoding hydration snapshots. */
702
681
  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. */
682
+ /** Maximum number of entries in any encoded array or object. */
683
+ maxCollectionLength: number;
684
+ /** Maximum number of encoded values in a hydration snapshot. */
685
+ maxNodes: number;
686
+ /** Maximum length of an encoded string, object key, or bigint payload. */
705
687
  maxStringLength: number;
706
688
  }>;
707
689
  //#endregion
@@ -723,7 +705,7 @@ type SelectionPlan = {
723
705
  * Flattens a view into a `SelectionPlan`, expanding composed views and
724
706
  * partitioning nested args so the client can fetch exactly what is declared.
725
707
  */
726
- declare const getSelectionPlan: <T extends Entity, S extends Selection<T>, V extends View<T, S>>(viewComposition: V, ref: ViewRef<T["__typename"]> | null) => SelectionPlan;
708
+ declare const getSelectionPlan: <T extends Entity, S extends Selection<T>, V extends View<T, S>>(viewComposition: V, ref: ViewRef<T['__typename']> | null) => SelectionPlan;
727
709
  //#endregion
728
710
  //#region src/operation-lifetime.d.ts
729
711
  type RetainHandle = Readonly<{
@@ -734,7 +716,13 @@ type RetainHandle = Readonly<{
734
716
  /**
735
717
  * Strategy used when resolving a request.
736
718
  */
737
- type RequestMode = /** (default) Use cached data if present, otherwise fetch. */'cache-first' /** Show cached data immediately and refresh in the background. */ | 'stale-while-revalidate' /** Always fetch from the network and ignore cached entries. */ | 'network-only';
719
+ type RequestMode =
720
+ /** (default) Use cached data if present, otherwise fetch. */
721
+ 'cache-first' |
722
+ /** Show cached data immediately and refresh in the background. */
723
+ 'stale-while-revalidate' |
724
+ /** Always fetch from the network and ignore cached entries. */
725
+ 'network-only';
738
726
  /**
739
727
  * Request options that affect how requests are fetched and retained.
740
728
  */
@@ -781,10 +769,7 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
781
769
  private readonly pending;
782
770
  private readonly pendingDeferred;
783
771
  private readonly pendingOptimisticMutations;
784
- private readonly optimisticMasks;
785
- private readonly optimisticByEntity;
786
772
  private readonly optimisticEntityResolutions;
787
- private optimisticTokenCounter;
788
773
  private readonly onLiveError;
789
774
  private readonly liveSubscriptions;
790
775
  private readonly liveConnectionInvalidations;
@@ -821,7 +806,6 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
821
806
  */
822
807
  hydrate(state: FateDehydratedState<HydrationScope>, options?: HydrateOptions): void;
823
808
  private registerRootList;
824
- private snapshotList;
825
809
  private applyListInsert;
826
810
  private insertIntoRootLists;
827
811
  getTypeConfig(type: string): TypeConfig;
@@ -830,10 +814,8 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
830
814
  args?: AnyRecord;
831
815
  plan?: SelectionPlan;
832
816
  }): Promise<unknown>;
833
- write(type: string, data: AnyRecord, select: ReadonlySet<string>, snapshots?: Map<EntityId, Snapshot>, plan?: SelectionPlan, pathPrefix?: string | null, blockedMask?: FieldMask | null, insert?: InsertPosition, listSnapshots?: Map<string, List>): string;
834
- deleteRecord(type: string, id: string | number, snapshots?: Map<EntityId, Snapshot>, listSnapshots?: Map<string, List>): void;
835
- restore(id: EntityId, snapshot: Snapshot): void;
836
- restoreList(name: string, list?: List): void;
817
+ write(type: string, data: AnyRecord, select: ReadonlySet<string>, plan?: SelectionPlan, insert?: InsertPosition): string;
818
+ deleteRecord(type: string, id: string | number): void;
837
819
  private stableRefWithViewNames;
838
820
  ref<T extends Entity>(type: T['__typename'], id: string | number, view: View<T, Selection<T>>): ViewRef<T['__typename']>;
839
821
  rootListRef(entityId: EntityId, rootView: View<any, any>): Readonly<{
@@ -857,15 +839,7 @@ declare class FateClient<Roots extends FateRoots, Mutations extends FateMutation
857
839
  private mergeListState;
858
840
  registerPendingOptimisticMutation(entityId: EntityId, promise: Promise<unknown>): void;
859
841
  resolveOptimisticEntity(optimisticEntityId: EntityId, resolvedEntityId: EntityId): void;
860
- registerOptimisticUpdate(entityId: EntityId | null, select: ReadonlySet<string>): number | null;
861
- clearOptimisticUpdate(token: number | null): void;
862
- getPendingOptimisticMask(entityId: EntityId | null, options?: {
863
- excludeToken?: number | null;
864
- }): FieldMask | null;
865
842
  private getPendingOptimisticMutations;
866
- filterSelectionForPendingOptimistics(entityId: EntityId | null, select: Set<string>, options?: {
867
- excludeToken?: number | null;
868
- }): Set<string>;
869
843
  loadConnection<V extends View<any, any>>(view: V, connection: ConnectionMetadata, args: Record<string, unknown>, options?: {
870
844
  direction?: 'forward' | 'backward';
871
845
  }): Promise<Readonly<{
@@ -956,11 +930,16 @@ type InsertPosition = 'after' | 'before' | 'none';
956
930
  * optional selection for the returned payload.
957
931
  */
958
932
  type MutationOptions<Identifier extends MutationIdentifier<any, any, any>> = {
959
- /** Optional arguments to pass to the mutation resolver. */args?: Record<string, unknown>; /** If true, deletes the record with the ID specified in the input. */
960
- delete?: boolean; /** Input data for the mutation. */
933
+ /** Optional arguments to pass to the mutation resolver. */
934
+ args?: Record<string, unknown>;
935
+ /** If true, deletes the record with the ID specified in the input. */
936
+ delete?: boolean;
937
+ /** Input data for the mutation. */
961
938
  input: Omit<MutationInput<Identifier>, 'select'>;
962
- insert?: InsertPosition; /** Optional optimistic update to apply immediately. */
963
- optimistic?: OptimisticUpdate<MutationResult<Identifier>>; /** Optional view specifying which fields to select from the server. */
939
+ insert?: InsertPosition;
940
+ /** Optional optimistic update to apply immediately. */
941
+ optimistic?: OptimisticUpdate<MutationResult<Identifier>>;
942
+ /** Optional view specifying which fields to select from the server. */
964
943
  view?: View<MutationEntity<Identifier>, Selection<MutationEntity<Identifier>>>;
965
944
  };
966
945
  /**
@@ -982,7 +961,6 @@ type MutationAction<I extends MutationIdentifier<any, any, any>> = (previousStat
982
961
  /**
983
962
  * Mutation options or 'reset' to reset the action state.
984
963
  */
985
-
986
964
  options: MutationOptions<I> | 'reset') => Promise<{
987
965
  error: undefined;
988
966
  result: MutationResult<I>;
@@ -994,14 +972,14 @@ type MutationIdentifierFor<K extends string, Def extends MutationDefinition<any,
994
972
  key: K;
995
973
  }> : never;
996
974
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
997
- type NestedValue<Path extends string, Value> = Path extends `${infer Head}.${infer Tail}` ? { [K in Head]: NestedValue<Tail, Value> } : { [K in Path]: Value };
975
+ type NestedValue<Path extends string, Value> = Path extends `${infer Head}.${infer Tail}` ? { [K in Head]: NestedValue<Tail, Value>; } : { [K in Path]: Value; };
998
976
  /**
999
977
  * Base type for client mutations.
1000
978
  */
1001
979
  type FateMutations = Record<string, MutationDefinition<any, any, any>>;
1002
- type MutationTreeFromRecord<Mutations extends FateMutations, ValueMap extends Record<string, unknown>> = [keyof Mutations] extends [never] ? object : UnionToIntersection<{ [K in keyof Mutations & string]: NestedValue<K, ValueMap[K]> }[keyof Mutations & string]>;
1003
- type MutationFunctionsFor<Mutations extends FateMutations> = MutationTreeFromRecord<Mutations, { [K in keyof Mutations & string]: MutationFunction<MutationIdentifierFor<K, Mutations[K]>> }>;
1004
- type MutationActionsFor<Mutations extends FateMutations> = MutationTreeFromRecord<Mutations, { [K in keyof Mutations & string]: MutationAction<MutationIdentifierFor<K, Mutations[K]>> }>;
980
+ type MutationTreeFromRecord<Mutations extends FateMutations, ValueMap extends Record<string, unknown>> = [keyof Mutations] extends [never] ? object : UnionToIntersection<{ [K in keyof Mutations & string]: NestedValue<K, ValueMap[K]>; }[keyof Mutations & string]>;
981
+ type MutationFunctionsFor<Mutations extends FateMutations> = MutationTreeFromRecord<Mutations, { [K in keyof Mutations & string]: MutationFunction<MutationIdentifierFor<K, Mutations[K]>>; }>;
982
+ type MutationActionsFor<Mutations extends FateMutations> = MutationTreeFromRecord<Mutations, { [K in keyof Mutations & string]: MutationAction<MutationIdentifierFor<K, Mutations[K]>>; }>;
1005
983
  //#endregion
1006
984
  //#region src/types.d.ts
1007
985
  /** Canonical runtime name for an entity type as returned by the server. */
@@ -1086,9 +1064,15 @@ type ViewRef<TName extends string> = Readonly<{
1086
1064
  [ViewsTag]: Set<string>;
1087
1065
  }>;
1088
1066
  /** Describes how a field relates to another entity for normalization. */
1089
- type RelationDescriptor = /** Field stores a scalar value that does not link to another type. */'scalar' /** Field points to a single entity of the given type. */ | {
1067
+ type RelationDescriptor =
1068
+ /** Field stores a scalar value that does not link to another type. */
1069
+ 'scalar' |
1070
+ /** Field points to a single entity of the given type. */
1071
+ {
1090
1072
  type: string;
1091
- } /** Field holds a list of entities of the given type. */ | {
1073
+ } |
1074
+ /** Field holds a list of entities of the given type. */
1075
+ {
1092
1076
  listOf: string;
1093
1077
  };
1094
1078
  /** Configuration for a server entity type used by the client cache. */
@@ -1135,7 +1119,7 @@ type Entity = {
1135
1119
  __typename: string;
1136
1120
  };
1137
1121
  type PlainObjectSelectionField<V> = V extends Array<infer U> ? PlainObjectSelectionField<U> | true : V extends AnyRecord ? PlainObjectSelection<V> | true : true;
1138
- type PlainObjectSelection<T> = { [K in keyof T]?: PlainObjectSelectionField<T[K]> };
1122
+ type PlainObjectSelection<T> = { [K in keyof T]?: PlainObjectSelectionField<T[K]>; };
1139
1123
  type ConnectionSelectionBase<T extends Entity> = Readonly<{
1140
1124
  items: Readonly<{
1141
1125
  cursor?: true;
@@ -1154,13 +1138,13 @@ type ConnectionSelection<T extends Entity> = ConnectionSelectionBase<T> | (Selec
1154
1138
  type BaseSelectionFieldValue<T extends Entity, K extends keyof T> = NonNullable<T[K]> extends Array<infer U extends Entity> ? true | Selection<U> | ConnectionSelection<U> | View<U, Selection<U>> : NonNullable<T[K]> extends Entity ? true | Selection<NonNullable<T[K]>> | View<NonNullable<T[K]>, Selection<NonNullable<T[K]>>> : NonNullable<T[K]> extends AnyRecord ? PlainObjectSelection<NonNullable<T[K]>> : true;
1155
1139
  type SelectionFieldValue<T extends Entity, K extends keyof T> = BaseSelectionFieldValue<T, K> | SelectionArgs | (SelectionArgs & Extract<BaseSelectionFieldValue<T, K>, object>);
1156
1140
  type DeferrableSelectionFieldValue<T extends Entity, K extends keyof T> = SelectionFieldValue<T, K> | DeferredSelection<SelectionFieldValue<T, K>>;
1157
- type SelectionShape<T extends Entity> = { [K in keyof T as K extends '__typename' ? never : K]?: DeferrableSelectionFieldValue<T, K> } & {
1141
+ type SelectionShape<T extends Entity> = { [K in keyof T as K extends '__typename' ? never : K]?: DeferrableSelectionFieldValue<T, K>; } & {
1158
1142
  __typename?: true;
1159
1143
  };
1160
1144
  type SelectionViewSpread<T extends Entity> = { readonly [K in ViewTag]?: Readonly<{
1161
1145
  select: Selection<T>;
1162
1146
  [ViewKind]: true;
1163
- }> };
1147
+ }>; };
1164
1148
  /** Declarative selection of the fields a view needs from an entity. */
1165
1149
  type Selection<T extends Entity> = SelectionShape<T> & SelectionViewSpread<T>;
1166
1150
  /** View payload stored on a view tag containing the raw selection used to mask data. */
@@ -1172,7 +1156,7 @@ type ViewPayload<T extends Entity, S extends Selection<T> = Selection<T>> = Read
1172
1156
  type View<T extends Entity, S extends Selection<T> = Selection<T>> = Readonly<{
1173
1157
  [viewTag: ViewTag]: ViewPayload<T, S>;
1174
1158
  }> & __ViewEntityAnchor<T> & __ViewSelectionAnchor<S>;
1175
- type HasViewTag<S> = S extends { [K in ViewTag]?: infer P } ? P extends {
1159
+ type HasViewTag<S> = S extends { [K in ViewTag]?: infer P; } ? P extends {
1176
1160
  [ViewKind]: true;
1177
1161
  } ? true : false : false;
1178
1162
  /**
@@ -1210,13 +1194,13 @@ type ConnectionMask<T extends Entity, S> = S extends {
1210
1194
  node: ViewRef<T['__typename']>;
1211
1195
  }>;
1212
1196
  } & (PaginationSelection extends object ? {
1213
- pagination: { [K in keyof PaginationSelection]: Pagination[K & keyof Pagination] };
1197
+ pagination: { [K in keyof PaginationSelection]: Pagination[K & keyof Pagination]; };
1214
1198
  } : Record<string, never>) : Array<T>;
1215
1199
  type EntityName<T> = T extends {
1216
1200
  __typename: infer N extends string;
1217
1201
  } ? N : never;
1218
1202
  /** Recursively applies a view selection to an entity to mask fields that aren't selected. */
1219
- type MaskNonNullish<T, S> = T extends Array<infer U extends Entity> ? S extends true ? Array<U> : S extends ConnectionLikeSelection ? ConnectionMask<U, S> : HasViewTag<S> extends true ? Array<ViewRef<U['__typename']>> : Array<Mask<U, S>> : S extends true ? T : S extends object ? HasViewTag<S> extends true ? NonNullish<T> extends Entity ? ViewRef<EntityName<NonNullish<T>>> : ViewRef<EntityName<NonNullable<T>>> : { [K in keyof S as K extends 'args' ? never : K]: S[K] extends true ? NonNullish<T>[Extract<K, keyof T>] : S[K] extends DeferredSelection<infer DeferredSelectionValue> ? Deferred<Mask<NonNullish<T>[Extract<K, keyof T>], DeferredSelectionValue>> : Mask<NonNullish<T>[Extract<K, keyof T>], Extract<S[K], object>> } & (T extends Entity ? Pick<NonNullish<T>, '__typename'> : Record<never, never>) : T;
1203
+ type MaskNonNullish<T, S> = T extends Array<infer U extends Entity> ? S extends true ? Array<U> : S extends ConnectionLikeSelection ? ConnectionMask<U, S> : HasViewTag<S> extends true ? Array<ViewRef<U['__typename']>> : Array<Mask<U, S>> : S extends true ? T : S extends object ? HasViewTag<S> extends true ? NonNullish<T> extends Entity ? ViewRef<EntityName<NonNullish<T>>> : ViewRef<EntityName<NonNullable<T>>> : { [K in keyof S as K extends 'args' ? never : K]: S[K] extends true ? NonNullish<T>[Extract<K, keyof T>] : S[K] extends DeferredSelection<infer DeferredSelectionValue> ? Deferred<Mask<NonNullish<T>[Extract<K, keyof T>], DeferredSelectionValue>> : Mask<NonNullish<T>[Extract<K, keyof T>], Extract<S[K], object>>; } & (T extends Entity ? Pick<NonNullish<T>, '__typename'> : Record<never, never>) : T;
1220
1204
  type Mask<T, S> = WithNullish<T, MaskNonNullish<NonNullish<T>, S>>;
1221
1205
  /** Entity type captured from a view definition. */
1222
1206
  type ViewEntity<V> = V extends View<infer T, any> ? T : never;
@@ -1280,7 +1264,7 @@ type ListResult<Item extends AnyRequestItem, Type extends TypeName, Result> = It
1280
1264
  * The result of a `FateClient.request` and `useRequest` call, mapping each
1281
1265
  * request key to its corresponding result.
1282
1266
  */
1283
- type RequestResult<R extends FateRoots, Q extends AnyRequest> = { [K in keyof Q]: K extends keyof R ? ListResult<Q[K], RootType<R[K]>, RootResult<R[K]>> : never };
1267
+ type RequestResult<R extends FateRoots, Q extends AnyRequest> = { [K in keyof Q]: K extends keyof R ? ListResult<Q[K], RootType<R[K]>, RootResult<R[K]>> : never; };
1284
1268
  /** Brand used on root definitions to mark their identity in the d.ts output. */
1285
1269
  declare const RootKind = "__fate__root";
1286
1270
  /** Brand used on mutation definitions to mark their identity in the d.ts output. */
@@ -1322,15 +1306,10 @@ type MutationShape = {
1322
1306
  type MutationMapFromDefinitions<D extends FateMutations> = { [K in keyof D]: {
1323
1307
  input: MutationInput<D[K]>;
1324
1308
  output: MutationResult<D[K]>;
1325
- } };
1309
+ }; };
1326
1310
  type OptimisticUpdateValue<T> = T extends ReadonlyArray<infer U> ? Array<OptimisticUpdateValue<U>> : NonNullish<T> extends AnyRecord ? OptimisticUpdate<NonNullish<T>> | Nullish<T> : NonNullish<T> | Nullish<T>;
1327
1311
  /** Shape used to describe optimistic updates for mutations. */
1328
- type OptimisticUpdate<T> = { [K in keyof T]?: OptimisticUpdateValue<T[K]> };
1329
- /** Snapshot captured before mutating the cache, used to roll back on errors. */
1330
- type Snapshot = Readonly<{
1331
- mask?: FieldMask;
1332
- record?: AnyRecord;
1333
- }>;
1312
+ type OptimisticUpdate<T> = { [K in keyof T]?: OptimisticUpdateValue<T[K]>; };
1334
1313
  /** Promise-like value returned by cache reads that already have a resolved payload for React `use`. */
1335
1314
  interface FateThenable<T> extends PromiseLike<T> {
1336
1315
  status: 'fulfilled';
@@ -1424,19 +1403,13 @@ type TRPCMutationResolvers<AppRouter extends AnyRouter> = Record<string, Mutatio
1424
1403
  type MutationMapFromResolvers<R extends Record<string, MutationResolver<any>>> = { [K in keyof R]: R[K] extends ((client: any) => (input: infer Input) => Promise<infer Output>) ? {
1425
1404
  input: Input;
1426
1405
  output: Output;
1427
- } : never };
1406
+ } : never; };
1428
1407
  type EmptyMutationResolvers<AppRouter extends AnyRouter> = Record<never, MutationResolver<AppRouter>>;
1429
1408
  /**
1430
1409
  * Builds a `Transport` backed by a tRPC client using the configured resolvers
1431
1410
  * for by-id queries, lists, and mutations.
1432
1411
  */
1433
- declare function createTRPCTransport<AppRouter extends AnyRouter, Mutations extends TRPCMutationResolvers<AppRouter> = EmptyMutationResolvers<AppRouter>>({
1434
- byId,
1435
- client,
1436
- lists,
1437
- mutations,
1438
- queries
1439
- }: {
1412
+ declare function createTRPCTransport<AppRouter extends AnyRouter, Mutations extends TRPCMutationResolvers<AppRouter> = EmptyMutationResolvers<AppRouter>>({ byId, client, lists, mutations, queries }: {
1440
1413
  byId: TRPCByIdResolvers<AppRouter>;
1441
1414
  client: TRPCClient<AppRouter>;
1442
1415
  lists?: TRPCListResolvers<AppRouter>;
@@ -1444,4 +1417,4 @@ declare function createTRPCTransport<AppRouter extends AnyRouter, Mutations exte
1444
1417
  queries?: TRPCQueryResolvers<AppRouter>;
1445
1418
  }): Transport<MutationMapFromResolvers<Mutations>>;
1446
1419
  //#endregion
1447
- export { HydrateOptions as $, Snapshot as A, ViewTag as B, MutationShape as C, RequestResult as D, Request$1 as E, ViewEntity as F, mutation as G, __FateSelectionBrand as H, ViewEntityName as I, RequestMode as J, DeferredSnapshot as K, ViewRef as L, TypeName as M, View as N, RootDefinition as O, ViewData as P, FateDehydratedState as Q, ViewSelection as R, MutationResult as S, Pagination as T, isViewTag as U, __FateEntityBrand as V, FateMutations as W, createClient as X, RequestOptions as Y, getSelectionPlan as Z, Mask as _, ConnectionRef as a, MutationIdentifier as b, Deferred as c, DeferredTag as d, HydrationLimits as et, Entity as f, ListItem as g, FateThenable as h, ConnectionMetadata as i, TypeConfig as j, Selection as k, DeferredMetadata as l, FateRoots as m, createTRPCTransport as n, AnyProcedure as nt, ConnectionTag as o, EntityId as p, FateClient as q, AnyRecord as r, QueryProcedure as rt, DeferTag as s, Transport as t, List as tt, DeferredSelection as u, MutationDefinition as v, NodesItem as w, MutationInput as x, MutationEntity as y, ViewSnapshot as z };
1420
+ export { HydrationLimits as $, TypeConfig as A, __FateEntityBrand as B, MutationShape as C, RequestResult as D, Request$1 as E, ViewEntityName as F, DeferredSnapshot as G, isViewTag as H, ViewRef as I, RequestOptions as J, FateClient as K, ViewSelection as L, View as M, ViewData as N, RootDefinition as O, ViewEntity as P, HydrateOptions as Q, ViewSnapshot as R, MutationResult as S, Pagination as T, FateMutations as U, __FateSelectionBrand as V, mutation as W, getSelectionPlan as X, createClient as Y, FateDehydratedState as Z, Mask as _, ConnectionRef as a, MutationIdentifier as b, Deferred as c, DeferredTag as d, List as et, Entity as f, ListItem as g, FateThenable as h, ConnectionMetadata as i, TypeName as j, Selection as k, DeferredMetadata as l, FateRoots as m, createTRPCTransport as n, QueryProcedure as nt, ConnectionTag as o, EntityId as p, RequestMode as q, AnyRecord as r, DeferTag as s, Transport as t, AnyProcedure as tt, DeferredSelection as u, MutationDefinition as v, NodesItem as w, MutationInput as x, MutationEntity as y, ViewTag as z };
package/lib/vite.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
-
3
2
  //#region src/viteTypes.d.ts
4
3
  type FateViteTransport = 'cloudflare' | 'graphql' | 'native' | 'trpc' | 'void';
5
4
  //#endregion
package/lib/vite.mjs CHANGED
@@ -725,7 +725,7 @@ const fate = (options) => {
725
725
  return generationPromise;
726
726
  };
727
727
  return {
728
- buildStart: async function() {
728
+ async buildStart() {
729
729
  await ensureGenerated();
730
730
  const resolvedServerModule = await this.resolve(options.module);
731
731
  if (resolvedServerModule) dependencies.add(path.normalize(resolvedServerModule.id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/fate",
3
- "version": "1.3.3",
3
+ "version": "1.4.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",
@@ -66,18 +66,18 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "superjson": "^2.2.6",
69
- "zod": "^4.4.3"
69
+ "zod": "^4.5.4"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@trpc/client": "^11.18.0",
73
73
  "@trpc/server": "^11.18.0",
74
74
  "drizzle-orm": "^0.45.2",
75
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4"
75
+ "vite": "^8.2.2"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@trpc/client": "^11.6.0",
79
79
  "drizzle-orm": "^0.45.0",
80
- "graphql": "^16.0.0",
80
+ "graphql": "^16.0.0 || ^17.0.0",
81
81
  "graphql-sse": "^2.6.0",
82
82
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
83
83
  },
@@ -96,6 +96,6 @@
96
96
  }
97
97
  },
98
98
  "scripts": {
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"
99
+ "build": "vp pack --tsconfig tsconfig.json -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"
100
100
  }
101
101
  }