@nkzw/fate 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -168
- package/docs/api/classes/FateClient.md +35 -35
- package/docs/api/functions/clientRoot.md +1 -1
- package/docs/api/functions/createClient.md +1 -1
- package/docs/api/functions/createGraphQLTransport.md +1 -1
- package/docs/api/functions/createHTTPTransport.md +1 -1
- package/docs/api/functions/createTRPCTransport.md +1 -1
- package/docs/api/functions/defer.md +1 -1
- package/docs/api/functions/getDeferredMetadata.md +1 -1
- package/docs/api/functions/getListEntries.md +1 -1
- package/docs/api/functions/getSelectionPlan.md +1 -1
- package/docs/api/functions/graphqlMutation.md +1 -1
- package/docs/api/functions/isDeferred.md +1 -1
- package/docs/api/functions/isRecord.md +1 -1
- package/docs/api/functions/isViewTag.md +1 -1
- package/docs/api/functions/liveConnectionTopic.md +1 -1
- package/docs/api/functions/liveEntityTopic.md +1 -1
- package/docs/api/functions/liveGlobalConnectionTopic.md +1 -1
- package/docs/api/functions/mutation.md +1 -1
- package/docs/api/functions/toEntityId.md +1 -1
- package/docs/api/functions/view.md +1 -1
- package/docs/api/interfaces/FateThenable.md +3 -3
- package/docs/api/interfaces/Persistence.md +1 -1
- package/docs/api/interfaces/PersistenceSession.md +9 -9
- package/docs/api/interfaces/Transport.md +8 -8
- package/docs/api/server/classes/FateRequestError.md +5 -5
- package/docs/api/server/drizzle/functions/createDrizzleFate.md +1 -1
- package/docs/api/server/drizzle/functions/createDrizzleSourceAdapter.md +1 -1
- package/docs/api/server/drizzle/functions/createDrizzleSourceRegistry.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyConfig.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleManyToManyInput.md +1 -1
- package/docs/api/server/drizzle/type-aliases/DrizzleQueryExtra.md +3 -3
- package/docs/api/server/drizzle/type-aliases/DrizzleSourceAdapter.md +9 -9
- package/docs/api/server/drizzle/type-aliases/DrizzleViewConfig.md +1 -1
- package/docs/api/server/functions/bindSourceProcedures.md +1 -1
- package/docs/api/server/functions/computed.md +1 -1
- package/docs/api/server/functions/count.md +1 -1
- package/docs/api/server/functions/createFateFetchHandler.md +1 -1
- package/docs/api/server/functions/createFateServer.md +1 -1
- package/docs/api/server/functions/createHonoFateHandler.md +1 -1
- package/docs/api/server/functions/createLiveEventBus.md +1 -1
- package/docs/api/server/functions/createNestedSourcePlan.md +1 -1
- package/docs/api/server/functions/createResolver.md +1 -1
- package/docs/api/server/functions/createSourcePlan.md +1 -1
- package/docs/api/server/functions/createSourceProcedures.md +1 -1
- package/docs/api/server/functions/dataView.md +1 -1
- package/docs/api/server/functions/field.md +1 -1
- package/docs/api/server/functions/getNestedSelection.md +1 -1
- package/docs/api/server/functions/getScopedArgs.md +1 -1
- package/docs/api/server/functions/hasNestedSelection.md +1 -1
- package/docs/api/server/functions/list.md +1 -1
- package/docs/api/server/functions/refetchSourceById.md +1 -1
- package/docs/api/server/functions/resolveSourceById.md +1 -1
- package/docs/api/server/functions/resolveSourceByIds.md +1 -1
- package/docs/api/server/functions/resolveSourceConnection.md +1 -1
- package/docs/api/server/functions/resolver.md +1 -1
- package/docs/api/server/functions/toPrismaSelect.md +1 -1
- package/docs/api/server/functions/withConnection.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaFate.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaSourceAdapter.md +1 -1
- package/docs/api/server/prisma/functions/createPrismaSourceRegistry.md +1 -1
- package/docs/api/server/prisma/functions/prismaConnectionArgs.md +1 -1
- package/docs/api/server/prisma/type-aliases/PrismaDelegate.md +4 -4
- package/docs/api/server/prisma/type-aliases/PrismaQueryExtra.md +1 -1
- package/docs/api/server/prisma/type-aliases/PrismaSourceAdapter.md +9 -9
- package/docs/api/server/prisma/type-aliases/PrismaViewConfig.md +1 -1
- package/docs/api/server/type-aliases/ComputedField.md +5 -5
- package/docs/api/server/type-aliases/ComputedSelection.md +1 -1
- package/docs/api/server/type-aliases/ConnectionItem.md +3 -3
- package/docs/api/server/type-aliases/ConnectionPagination.md +5 -5
- package/docs/api/server/type-aliases/ConnectionResult.md +3 -3
- package/docs/api/server/type-aliases/CountSelection.md +4 -4
- package/docs/api/server/type-aliases/CountWhere.md +1 -1
- package/docs/api/server/type-aliases/DataViewListOptions.md +2 -2
- package/docs/api/server/type-aliases/DataViewOrderBy.md +1 -1
- package/docs/api/server/type-aliases/DataViewOrderDirection.md +1 -1
- package/docs/api/server/type-aliases/DataViewResult.md +1 -1
- package/docs/api/server/type-aliases/Entity.md +1 -1
- package/docs/api/server/type-aliases/FateServer.md +5 -5
- package/docs/api/server/type-aliases/FateServerManifest.md +1 -1
- package/docs/api/server/type-aliases/FieldSelection.md +3 -3
- package/docs/api/server/type-aliases/LiveConnectionEventType.md +1 -1
- package/docs/api/server/type-aliases/LiveConnectionSourceEvent.md +1 -1
- package/docs/api/server/type-aliases/LiveEventBus.md +1 -1
- package/docs/api/server/type-aliases/LiveEventType.md +1 -1
- package/docs/api/server/type-aliases/LiveSourceEvent.md +1 -1
- package/docs/api/server/type-aliases/NativeFateAPI.md +4 -4
- package/docs/api/server/type-aliases/OrderDirection.md +1 -1
- package/docs/api/server/type-aliases/SourceConfig.md +6 -6
- package/docs/api/server/type-aliases/SourceDefinition.md +6 -6
- package/docs/api/server/type-aliases/SourceOrder.md +1 -1
- package/docs/api/server/type-aliases/SourceOrderField.md +3 -3
- package/docs/api/server/type-aliases/SourcePlan.md +1 -1
- package/docs/api/server/type-aliases/SourcePlanNode.md +1 -1
- package/docs/api/server/type-aliases/SourceRegistry.md +1 -1
- package/docs/api/server/type-aliases/SourceRelation.md +1 -1
- package/docs/api/server/type-aliases/SourceRelationConfig.md +1 -1
- package/docs/api/server/variables/byIdInput.md +1 -1
- package/docs/api/server/variables/connectionArgs.md +1 -1
- package/docs/api/type-aliases/ConnectionMetadata.md +1 -1
- package/docs/api/type-aliases/ConnectionRef.md +1 -1
- package/docs/api/type-aliases/Deferred.md +1 -1
- package/docs/api/type-aliases/DeferredMetadata.md +1 -1
- package/docs/api/type-aliases/DeferredSelection.md +1 -1
- package/docs/api/type-aliases/DeferredSnapshot.md +1 -1
- package/docs/api/type-aliases/Entity.md +2 -2
- package/docs/api/type-aliases/EntityId.md +1 -1
- package/docs/api/type-aliases/FateDehydratedState.md +1 -1
- package/docs/api/type-aliases/FateLiveConnectionEvent.md +1 -1
- package/docs/api/type-aliases/FateLiveEvent.md +1 -1
- package/docs/api/type-aliases/FateMutations.md +1 -1
- package/docs/api/type-aliases/FateOperation.md +1 -1
- package/docs/api/type-aliases/FateProtocolRequest.md +1 -1
- package/docs/api/type-aliases/FateProtocolResponse.md +1 -1
- package/docs/api/type-aliases/FateRecord.md +1 -1
- package/docs/api/type-aliases/FateRoots.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationDefinition.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationInput.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationMap.md +1 -1
- package/docs/api/type-aliases/GraphQLMutationOutput.md +1 -1
- package/docs/api/type-aliases/GraphQLTransportOptions.md +12 -12
- package/docs/api/type-aliases/HydrateOptions.md +1 -1
- package/docs/api/type-aliases/HydrationLimits.md +1 -1
- package/docs/api/type-aliases/InferFateAPI.md +1 -1
- package/docs/api/type-aliases/List.md +1 -1
- package/docs/api/type-aliases/ListEntry.md +1 -1
- package/docs/api/type-aliases/ListItem.md +1 -1
- package/docs/api/type-aliases/Mask.md +1 -1
- package/docs/api/type-aliases/MutationDefinition.md +1 -1
- package/docs/api/type-aliases/MutationEntity.md +1 -1
- package/docs/api/type-aliases/MutationIdentifier.md +1 -1
- package/docs/api/type-aliases/MutationIdentity.md +1 -1
- package/docs/api/type-aliases/MutationInput.md +1 -1
- package/docs/api/type-aliases/MutationResult.md +1 -1
- package/docs/api/type-aliases/NodesItem.md +1 -1
- package/docs/api/type-aliases/Pagination.md +5 -5
- package/docs/api/type-aliases/PersistedMutationStatus.md +1 -1
- package/docs/api/type-aliases/PersistenceSnapshot.md +1 -1
- package/docs/api/type-aliases/Request.md +1 -1
- package/docs/api/type-aliases/RequestMode.md +1 -1
- package/docs/api/type-aliases/RequestOptions.md +1 -1
- package/docs/api/type-aliases/RequestPersistenceOptions.md +1 -1
- package/docs/api/type-aliases/RequestResult.md +1 -1
- package/docs/api/type-aliases/Selection.md +1 -1
- package/docs/api/type-aliases/TypeConfig.md +4 -4
- package/docs/api/type-aliases/View.md +1 -1
- package/docs/api/type-aliases/ViewData.md +1 -1
- package/docs/api/type-aliases/ViewEntity.md +1 -1
- package/docs/api/type-aliases/ViewEntityName.md +1 -1
- package/docs/api/type-aliases/ViewRef.md +1 -1
- package/docs/api/type-aliases/ViewSelection.md +1 -1
- package/docs/api/type-aliases/ViewSnapshot.md +1 -1
- package/docs/api/type-aliases/ViewTag.md +1 -1
- package/docs/api/variables/ConnectionTag.md +1 -1
- package/docs/api/variables/DeferTag.md +1 -1
- package/docs/api/variables/DeferredTag.md +1 -1
- package/docs/guide/getting-started.md +1 -9
- package/docs/integrations/cloudflare.md +21 -139
- package/docs/integrations/graphql.md +2 -2
- package/docs/integrations/void.md +35 -21
- package/lib/{executor-oPTYqgQV.d.mts → executor-C3JLgeJ_.d.mts} +1 -1
- package/lib/{graphqlTransport-CGYE4NdD.d.mts → graphqlTransport-D7IPm9wQ.d.mts} +1 -1
- package/lib/graphqlTransport.d.mts +1 -1
- package/lib/{idempotency-types-DuqJ7KSd.d.mts → idempotency-types-jgGOlHFl.d.mts} +1 -1
- package/lib/idempotency.d.mts +2 -2
- package/lib/index.d.mts +4 -4
- package/lib/index.mjs +1 -1
- package/lib/{list-5hrTVoiB.d.mts → list-Dj7P-fay.d.mts} +1 -1
- package/lib/list.d.mts +1 -1
- package/lib/persistence.d.mts +1 -1
- package/lib/persistence.mjs +1 -1
- package/lib/{record-Dxjvpsep.d.mts → record-DmyMlWdZ.d.mts} +3 -3
- package/lib/server/drizzle.d.mts +2 -2
- package/lib/server/prisma.d.mts +2 -2
- package/lib/server.d.mts +3 -3
- package/lib/{store-CakBBzWG.mjs → store-Dl_OPES3.mjs} +1 -95
- package/lib/{transport-DR0fwleU.d.mts → transport-c5vvbtDC.d.mts} +4 -4
- package/lib/vite.d.mts +1 -1
- package/lib/vite.mjs +7 -27
- package/package.json +4 -4
package/lib/vite.mjs
CHANGED
|
@@ -83,20 +83,11 @@ const createClientSource = ({ clientModule = "react-fate", moduleExports, module
|
|
|
83
83
|
});
|
|
84
84
|
if (transport === "native" || transport === "void") return createNativeClientSource({
|
|
85
85
|
clientModule,
|
|
86
|
-
cloudflareTransport: false,
|
|
87
86
|
moduleExports,
|
|
88
87
|
moduleName,
|
|
89
88
|
runtimeModuleName,
|
|
90
89
|
voidTransport: transport === "void"
|
|
91
90
|
});
|
|
92
|
-
if (transport === "cloudflare") return createNativeClientSource({
|
|
93
|
-
clientModule,
|
|
94
|
-
cloudflareTransport: true,
|
|
95
|
-
moduleExports,
|
|
96
|
-
moduleName,
|
|
97
|
-
runtimeModuleName,
|
|
98
|
-
voidTransport: false
|
|
99
|
-
});
|
|
100
91
|
const { appRouter, Root } = moduleExports;
|
|
101
92
|
const { roots, types } = createSchema(Object.values(moduleExports).filter(isDataView), Root ?? {});
|
|
102
93
|
const routerRecord = appRouter._def?.record ?? {};
|
|
@@ -426,7 +417,7 @@ type GeneratedCreateFateClient = typeof createFateClient;
|
|
|
426
417
|
${generatedClientTypes}
|
|
427
418
|
`;
|
|
428
419
|
};
|
|
429
|
-
const createNativeClientSource = ({ clientModule,
|
|
420
|
+
const createNativeClientSource = ({ clientModule, moduleExports, moduleName, runtimeModuleName, voidTransport }) => {
|
|
430
421
|
const { Root } = moduleExports;
|
|
431
422
|
const fateExportName = moduleExports.fate?.manifest ? "fate" : moduleExports.fateServer?.manifest ? "fateServer" : null;
|
|
432
423
|
const fateServer = fateExportName ? moduleExports[fateExportName] : null;
|
|
@@ -524,17 +515,7 @@ const createVoidFetch = (options: {
|
|
|
524
515
|
});
|
|
525
516
|
};
|
|
526
517
|
` : "";
|
|
527
|
-
const
|
|
528
|
-
const defaultCloudflareFateRpcPath = '/fate';
|
|
529
|
-
const defaultCloudflareFateLivePath = '/fate-live';
|
|
530
|
-
|
|
531
|
-
const getDefaultOrigin = () =>
|
|
532
|
-
typeof window === 'undefined' ? 'http://localhost' : window.location.origin;
|
|
533
|
-
|
|
534
|
-
const toEndpointUrl = (url: string | URL | undefined, path: string, origin: string | URL) =>
|
|
535
|
-
url ?? new URL(path, origin);
|
|
536
|
-
` : "";
|
|
537
|
-
const createClientOptions = voidTransport || cloudflareTransport ? `options: {
|
|
518
|
+
const createClientOptions = voidTransport ? `options: {
|
|
538
519
|
fetch?: typeof fetch;
|
|
539
520
|
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
540
521
|
livePath?: string;
|
|
@@ -555,7 +536,7 @@ const toEndpointUrl = (url: string | URL | undefined, path: string, origin: stri
|
|
|
555
536
|
persistence?: import("@nkzw/fate").Persistence;
|
|
556
537
|
url: string | URL;
|
|
557
538
|
}`;
|
|
558
|
-
const clientSetup = voidTransport
|
|
539
|
+
const clientSetup = voidTransport ? ` => {
|
|
559
540
|
const origin = options.origin ?? getDefaultOrigin();
|
|
560
541
|
|
|
561
542
|
return createClient<[GeneratedClientRoots, GeneratedClientMutations], typeof hydrationScope>({
|
|
@@ -565,16 +546,16 @@ const toEndpointUrl = (url: string | URL | undefined, path: string, origin: stri
|
|
|
565
546
|
persistence: options.persistence,
|
|
566
547
|
roots,
|
|
567
548
|
transport: createHTTPTransport<FateAPI>({
|
|
568
|
-
fetch:
|
|
549
|
+
fetch: createVoidFetch(options),
|
|
569
550
|
headers: options.headers,
|
|
570
|
-
live: ${hasLive ?
|
|
551
|
+
live: ${hasLive ? "connectLiveStream" : "false"},
|
|
571
552
|
liveRetryMs: options.liveRetryMs,
|
|
572
553
|
liveUrl: toEndpointUrl(
|
|
573
554
|
options.liveUrl,
|
|
574
|
-
options.livePath ??
|
|
555
|
+
options.livePath ?? defaultVoidFateLivePath,
|
|
575
556
|
origin,
|
|
576
557
|
),
|
|
577
|
-
url: toEndpointUrl(options.url, options.rpcPath ??
|
|
558
|
+
url: toEndpointUrl(options.url, options.rpcPath ?? defaultVoidFateRpcPath, origin),
|
|
578
559
|
}),
|
|
579
560
|
types: ${typesBlock.trimStart()},
|
|
580
561
|
});
|
|
@@ -609,7 +590,6 @@ declare module '${clientDeclarationModule}' {
|
|
|
609
590
|
import type { ${importedTypes.join(", ")} } from '${moduleName}';
|
|
610
591
|
import { clientRoot, createClient, createHTTPTransport, mutation, type InferFateAPI } from '${clientModule}';
|
|
611
592
|
${voidTransport && hasLive ? "import { connectLiveStream } from 'void/live/client';\n" : ""}${voidServerFetch}
|
|
612
|
-
${cloudflareTransport && hasLive ? "import { connectCloudflareFateStream } from 'cf-fate/client';\n" : ""}${cloudflareHelpers}
|
|
613
593
|
|
|
614
594
|
type FateAPI = InferFateAPI<typeof fateServer>;
|
|
615
595
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkzw/fate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "fate is a modern data client for React.",
|
|
5
5
|
"homepage": "https://github.com/nkzw-tech/fate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"zod": "^4.6.5"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@trpc/client": "^11.
|
|
83
|
-
"@trpc/server": "^11.
|
|
82
|
+
"@trpc/client": "^11.19.0",
|
|
83
|
+
"@trpc/server": "^11.19.0",
|
|
84
84
|
"drizzle-orm": "^0.45.2",
|
|
85
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.
|
|
85
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.3"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@trpc/client": "^11.6.0",
|