@nkzw/fate 1.5.1 → 1.6.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.
- package/README.md +51 -155
- package/docs/api/classes/FateClient.md +36 -36
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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/integrations/cloudflare.md +21 -139
- package/docs/integrations/void.md +33 -19
- package/lib/clientStub.d.mts +4 -5
- 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 +6 -6
- package/lib/index.d.mts +12 -12
- 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 +7 -7
- package/lib/persistence.mjs +1 -1
- package/lib/{record-Dxjvpsep.d.mts → record-DmyMlWdZ.d.mts} +3 -3
- package/lib/server/drizzle.d.mts +14 -13
- package/lib/server/prisma.d.mts +14 -13
- package/lib/server.d.mts +9 -9
- 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 +4 -4
- package/lib/vite.mjs +7 -27
- package/package.json +5 -5
|
@@ -1,161 +1,43 @@
|
|
|
1
1
|
# Cloudflare Integration
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Use it when your backend runs directly on Cloudflare Workers and you want fate live views without adopting the Void platform.
|
|
3
|
+
Deploy fate directly to your own Cloudflare account with [Void](void.md). The Void template includes the app, D1 database, Drizzle migrations, Better Auth, and live updates through `void-fate` and `void/live`.
|
|
6
4
|
|
|
7
5
|
## New Project
|
|
8
6
|
|
|
9
|
-
For a new Cloudflare Workers app, start from the Cloudflare template. It includes the client, Worker server, D1 migrations, Wrangler config, Durable Object live transport, auth wiring, and generated fate client setup.
|
|
10
|
-
|
|
11
7
|
```sh
|
|
12
|
-
vp create fate my-app --template
|
|
8
|
+
vp create fate my-app --template void
|
|
9
|
+
cd my-app
|
|
10
|
+
vp run dev:setup
|
|
11
|
+
vp run dev
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
Add `--framework vue` to the create command to use Vue instead of React.
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
vp create fate my-app --template cloudflare --framework vue
|
|
19
|
-
```
|
|
16
|
+
## Deploy
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
For an existing Cloudflare Workers project, add the packages directly:
|
|
18
|
+
From the project root:
|
|
24
19
|
|
|
25
20
|
```sh
|
|
26
|
-
|
|
27
|
-
pnpm add -D wrangler
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
For Vue clients, replace `react-fate` with `vue-fate`.
|
|
31
|
-
|
|
32
|
-
## Server Setup
|
|
33
|
-
|
|
34
|
-
Create a Cloudflare live stream and pass its Fate live facade to `createFateServer`.
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
// src/fate/live.ts
|
|
38
|
-
import { defineCloudflareFateLiveStream } from 'cf-fate/server';
|
|
39
|
-
|
|
40
|
-
export const fateStream = defineCloudflareFateLiveStream({
|
|
41
|
-
allowAnonymousControl: true,
|
|
42
|
-
binding: 'FATE_LIVE',
|
|
43
|
-
id: 'fate',
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
// src/fate/server.ts
|
|
49
|
-
import { createFateServer } from '@nkzw/fate/server';
|
|
50
|
-
import { createCloudflareFateLive } from 'cf-fate/server';
|
|
51
|
-
|
|
52
|
-
export const fateLive = createCloudflareFateLive();
|
|
53
|
-
export const { live } = fateLive;
|
|
54
|
-
|
|
55
|
-
export const fateServer = createFateServer({
|
|
56
|
-
live,
|
|
57
|
-
// context,
|
|
58
|
-
// roots,
|
|
59
|
-
// sources,
|
|
60
|
-
});
|
|
21
|
+
vp exec void deploy --platform cloudflare
|
|
61
22
|
```
|
|
62
23
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
live.update('Post', postId, { changed: ['likes'] });
|
|
67
|
-
live.connection('Post.comments', { id: postId }).appendNode('Comment', commentId);
|
|
68
|
-
```
|
|
24
|
+
Void signs you into Cloudflare when needed, lets you select your account, provisions resources, applies checked-in database migrations, and deploys the app. It saves resource IDs in the root `wrangler.jsonc`; commit that updated config for subsequent deployments. A Void platform account is not required.
|
|
69
25
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Expose one route for Fate RPC and one route for the SSE live stream.
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
import {
|
|
76
|
-
createCloudflareFateLiveDurableObject,
|
|
77
|
-
defineCloudflareFateLiveRoute,
|
|
78
|
-
defineCloudflareFateRoute,
|
|
79
|
-
} from 'cf-fate/server';
|
|
80
|
-
import { fateStream } from './fate/live';
|
|
81
|
-
import { fateLive, fateServer } from './fate/server';
|
|
82
|
-
|
|
83
|
-
const fateRoute = defineCloudflareFateRoute(fateServer, fateLive, { stream: fateStream });
|
|
84
|
-
const fateLiveRoute = defineCloudflareFateLiveRoute(fateStream);
|
|
85
|
-
|
|
86
|
-
export const FateLiveDurableObject = createCloudflareFateLiveDurableObject({
|
|
87
|
-
binding: 'FATE_LIVE',
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
export default {
|
|
91
|
-
fetch(request, env, ctx) {
|
|
92
|
-
const url = new URL(request.url);
|
|
93
|
-
if (url.pathname === '/fate') {
|
|
94
|
-
return fateRoute.fetch(request, env, ctx);
|
|
95
|
-
}
|
|
96
|
-
if (url.pathname === '/fate-live') {
|
|
97
|
-
return fateLiveRoute.fetch(request, env, ctx);
|
|
98
|
-
}
|
|
99
|
-
return new Response('Not Found', { status: 404 });
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Wrangler
|
|
105
|
-
|
|
106
|
-
Add a Durable Object binding and migration. `cf-fate` uses `node:async_hooks`, so the Worker must enable Node compatibility.
|
|
107
|
-
|
|
108
|
-
```jsonc
|
|
109
|
-
{
|
|
110
|
-
"compatibility_flags": ["nodejs_compat"],
|
|
111
|
-
"durable_objects": {
|
|
112
|
-
"bindings": [
|
|
113
|
-
{
|
|
114
|
-
"name": "FATE_LIVE",
|
|
115
|
-
"class_name": "FateLiveDurableObject",
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
"migrations": [
|
|
120
|
-
{
|
|
121
|
-
"tag": "fate-live-v1",
|
|
122
|
-
"new_sqlite_classes": ["FateLiveDurableObject"],
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
}
|
|
126
|
-
```
|
|
26
|
+
The template includes the `VOID_LIVE` Durable Object binding and its class migration. Keep them in `wrangler.jsonc` so live subscriptions can receive updates across requests. RPC requests use `/fate`, and live updates use `/fate-live`.
|
|
127
27
|
|
|
128
|
-
|
|
28
|
+
After changing your database schema or auth configuration, run `vp run db:generate`, review and commit the generated migrations, then deploy. The migrations must include the Better Auth schema used in production.
|
|
129
29
|
|
|
130
|
-
|
|
30
|
+
See [Void's Cloudflare deployment guide](https://void.cloud/integrations/cloudflare) for custom domains, secrets, and CI configuration.
|
|
131
31
|
|
|
132
|
-
|
|
133
|
-
import { fate } from 'react-fate/vite';
|
|
32
|
+
## Migrating from cf-fate
|
|
134
33
|
|
|
135
|
-
fate
|
|
136
|
-
module: './src/fate/server.ts',
|
|
137
|
-
transport: 'cloudflare',
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Then point the generated client at the Worker endpoints:
|
|
142
|
-
|
|
143
|
-
```tsx
|
|
144
|
-
import { FateClient } from 'react-fate';
|
|
145
|
-
import { createFateClient } from 'react-fate/client';
|
|
146
|
-
|
|
147
|
-
const fate = createFateClient({
|
|
148
|
-
liveUrl: 'http://localhost:8787/fate-live',
|
|
149
|
-
url: 'http://localhost:8787/fate',
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
export function App({ children }) {
|
|
153
|
-
return <FateClient client={fate}>{children}</FateClient>;
|
|
154
|
-
}
|
|
155
|
-
```
|
|
34
|
+
Fate 1.6 replaces the standalone Cloudflare adapter and template with the Void integration. Use `--template void` for new projects and `transport: 'void'` in the fate Vite plugin.
|
|
156
35
|
|
|
157
|
-
|
|
36
|
+
For an existing app, move the Worker routes into Void's `routes/` directory and follow the [Void integration](void.md) for the complete setup:
|
|
158
37
|
|
|
159
|
-
|
|
38
|
+
- Define the live stream with `defineLiveStream` from `void/live`.
|
|
39
|
+
- Use `createVoidFateLive`, `defineVoidFateRoute`, and `defineVoidFateLiveRoute` from `void-fate/server`.
|
|
40
|
+
- Let the generated client use `void/live/client` for live connections.
|
|
41
|
+
- Remove the `cf-fate` dependency and the custom Worker entry point.
|
|
160
42
|
|
|
161
|
-
|
|
43
|
+
Deploy the Void app as a new Worker with its `VOID_LIVE` binding and class migration. The old `FATE_LIVE` Durable Object class and its active connections are not migrated. Preserve existing database IDs and migration history when reusing your database, and reconnect clients to the new app after deployment.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Void Integration
|
|
2
2
|
|
|
3
|
-
`void-fate` is the
|
|
3
|
+
`void-fate` is the [Void](https://void.cloud) adapter for fate. Deploy your app directly to your own Cloudflare account or to the Void platform with the same integration.
|
|
4
4
|
|
|
5
5
|
Use this integration when your app runs on Void and you want the example app's
|
|
6
6
|
setup without copying its adapter glue.
|
|
@@ -127,14 +127,29 @@ live.connection('Post.comments', { id: postId }).appendNode('Comment', commentId
|
|
|
127
127
|
|
|
128
128
|
## Routes
|
|
129
129
|
|
|
130
|
+
Define a live stream once in a server-only module:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// src/fate/live.ts
|
|
134
|
+
import { defineLiveStream } from 'void/live';
|
|
135
|
+
|
|
136
|
+
export const fateStream = defineLiveStream({
|
|
137
|
+
allowAnonymousControl: true,
|
|
138
|
+
id: 'fate',
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
130
142
|
Add one route for fate RPC requests:
|
|
131
143
|
|
|
132
144
|
```tsx
|
|
133
145
|
// routes/fate.ts
|
|
134
146
|
import { defineVoidFateRoute } from 'void-fate/server';
|
|
147
|
+
import { fateStream } from '../src/fate/live.ts';
|
|
135
148
|
import { fateLive, fateServer } from '../src/fate/server.ts';
|
|
136
149
|
|
|
137
|
-
export const { GET, POST } = defineVoidFateRoute(fateServer, fateLive
|
|
150
|
+
export const { GET, POST } = defineVoidFateRoute(fateServer, fateLive, {
|
|
151
|
+
stream: fateStream,
|
|
152
|
+
});
|
|
138
153
|
```
|
|
139
154
|
|
|
140
155
|
Add a second route for the live SSE transport:
|
|
@@ -142,9 +157,9 @@ Add a second route for the live SSE transport:
|
|
|
142
157
|
```tsx
|
|
143
158
|
// routes/fate-live.ts
|
|
144
159
|
import { defineVoidFateLiveRoute } from 'void-fate/server';
|
|
145
|
-
import {
|
|
160
|
+
import { fateStream } from '../src/fate/live.ts';
|
|
146
161
|
|
|
147
|
-
export const { GET, POST } = defineVoidFateLiveRoute(
|
|
162
|
+
export const { GET, POST } = defineVoidFateLiveRoute(fateStream);
|
|
148
163
|
```
|
|
149
164
|
|
|
150
165
|
The live route handles `GET /fate-live` SSE connections and `POST /fate-live`
|
|
@@ -210,13 +225,7 @@ present.
|
|
|
210
225
|
## Custom Paths
|
|
211
226
|
|
|
212
227
|
The default route pair is `/fate` and `/fate-live`. If your Void app uses
|
|
213
|
-
different paths,
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
export const fateLive = createVoidFateLive({
|
|
217
|
-
livePath: '/custom-fate-live',
|
|
218
|
-
});
|
|
219
|
-
```
|
|
228
|
+
different paths, update your route filenames and configure the matching client paths.
|
|
220
229
|
|
|
221
230
|
::: code-group
|
|
222
231
|
|
|
@@ -252,14 +261,19 @@ or router configuration matches the paths you pass to the client.
|
|
|
252
261
|
|
|
253
262
|
## Live Transport
|
|
254
263
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
In local development, `void-fate` uses a development token for that internal
|
|
260
|
-
publish request. Outside local development, Void must provide `__VOID_PROXY_TOKEN`
|
|
261
|
-
in the route environment. If no internal publish token is available, the adapter
|
|
262
|
-
falls back to the in-memory live bus for the current request context.
|
|
264
|
+
`createVoidFateLive` publishes entity and connection events through the `void/live`
|
|
265
|
+
stream associated with the current request. Void manages the Durable Object
|
|
266
|
+
transport that distributes events to connected clients across requests.
|
|
263
267
|
|
|
264
268
|
The live transport is best-effort and does not replay missed events after a
|
|
265
269
|
client reconnects. This matches fate's default in-memory live event bus.
|
|
270
|
+
|
|
271
|
+
## Cloudflare Deployment
|
|
272
|
+
|
|
273
|
+
From your project root, run:
|
|
274
|
+
|
|
275
|
+
```sh
|
|
276
|
+
vp exec void deploy --platform cloudflare
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Void provisions resources and deploys directly to your Cloudflare account. See the [Cloudflare integration](cloudflare.md) for setup and migration instructions.
|
package/lib/clientStub.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/clientStub.d.ts
|
|
2
|
-
declare function createFateClient(..._args: Array<never>): never;
|
|
3
|
-
interface ClientMutations {}
|
|
4
|
-
interface ClientRoots {}
|
|
5
|
-
//#endregion
|
|
6
|
-
export { ClientMutations, ClientRoots, createFateClient };
|
|
2
|
+
export declare function createFateClient(..._args: Array<never>): never;
|
|
3
|
+
export interface ClientMutations {}
|
|
4
|
+
export interface ClientRoots {}
|
|
5
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AnyRecord, lt as QueryProcedure } from "./transport-
|
|
1
|
+
import { b as AnyRecord, lt as QueryProcedure } from "./transport-c5vvbtDC.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/server/dataView.d.ts
|
|
4
4
|
declare const dataViewFieldsKey: unique symbol;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as MutationShape, k as Entity, q as TypeConfig, t as Transport } from "./transport-
|
|
1
|
+
import { B as MutationShape, k as Entity, q as TypeConfig, t as Transport } from "./transport-c5vvbtDC.mjs";
|
|
2
2
|
//#region src/graphqlTransport.d.ts
|
|
3
3
|
type TransportMutations = Record<string, MutationShape>;
|
|
4
4
|
type EmptyTransportMutations = Record<never, MutationShape>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-
|
|
1
|
+
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-D7IPm9wQ.mjs";
|
|
2
2
|
export { GraphQLMutationDefinition, GraphQLMutationInput, GraphQLMutationMap, GraphQLMutationOutput, GraphQLTransportOptions, createGraphQLTransport, graphqlMutation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as MutationIdentity } from "./transport-
|
|
1
|
+
import { r as MutationIdentity } from "./transport-c5vvbtDC.mjs";
|
|
2
2
|
//#region src/server/idempotency-types.d.ts
|
|
3
3
|
/** Server enforcement for a durable mutation. The resolver must use the supplied context. */
|
|
4
4
|
interface MutationIdempotency<Context> {
|
package/lib/idempotency.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as encodeHydrationValue } from "./transport-
|
|
2
|
-
import { n as MutationIdempotencyOptions, t as MutationIdempotency } from "./idempotency-types-
|
|
1
|
+
import { _ as encodeHydrationValue } from "./transport-c5vvbtDC.mjs";
|
|
2
|
+
import { n as MutationIdempotencyOptions, t as MutationIdempotency } from "./idempotency-types-jgGOlHFl.mjs";
|
|
3
3
|
//#region src/idempotency.d.ts
|
|
4
|
-
type MutationReceipt = Readonly<{
|
|
4
|
+
export type MutationReceipt = Readonly<{
|
|
5
5
|
fingerprint: string;
|
|
6
6
|
result: ReturnType<typeof encodeHydrationValue>;
|
|
7
7
|
}>;
|
|
@@ -10,7 +10,7 @@ type MutationReceipt = Readonly<{
|
|
|
10
10
|
* The adapter must serialize concurrent calls for the same scope and ID,
|
|
11
11
|
* including calls from different processes. Receipts must not expire.
|
|
12
12
|
*/
|
|
13
|
-
interface IdempotencyStore<Context, TransactionContext extends Context = Context> {
|
|
13
|
+
export interface IdempotencyStore<Context, TransactionContext extends Context = Context> {
|
|
14
14
|
transaction<T>(context: Context, scope: string, id: string, run: (transaction: {
|
|
15
15
|
context: TransactionContext;
|
|
16
16
|
read(): Promise<MutationReceipt | undefined>;
|
|
@@ -18,9 +18,9 @@ interface IdempotencyStore<Context, TransactionContext extends Context = Context
|
|
|
18
18
|
}) => Promise<T>): Promise<T>;
|
|
19
19
|
}
|
|
20
20
|
/** Enforces durable deduplication using the application's own transaction adapter. */
|
|
21
|
-
declare function createMutationIdempotency<Context, TransactionContext extends Context = Context>(options: {
|
|
21
|
+
export declare function createMutationIdempotency<Context, TransactionContext extends Context = Context>(options: {
|
|
22
22
|
scope(context: Context): string | Promise<string>;
|
|
23
23
|
store: IdempotencyStore<Context, TransactionContext>;
|
|
24
24
|
}): MutationIdempotency<Context>;
|
|
25
25
|
//#endregion
|
|
26
|
-
export {
|
|
26
|
+
export type { MutationIdempotency, MutationIdempotencyOptions };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { $ as ViewRef, A as EntityId, B as MutationShape, C as ConnectionTag, D as DeferredSelection, E as DeferredMetadata, F as MutationDefinition, G as RootDefinition, H as Pagination, I as MutationEntity, J as TypeName, K as Selection, L as MutationIdentifier, M as FateThenable, N as ListItem, O as DeferredTag, P as Mask, Q as ViewEntityName, R as MutationInput, S as ConnectionRef, T as Deferred, U as Request$1, V as NodesItem, W as RequestResult, X as ViewData, Y as View, Z as ViewEntity, a as Persistence, at as isViewTag, b as AnyRecord, c as RequestPersistenceOptions, d as RequestMode, et as ViewSelection, f as RequestOptions, g as HydrationLimits, h as HydrateOptions, i as PersistedMutationStatus, it as __FateSelectionBrand, j as FateRoots, k as Entity, l as DeferredSnapshot, m as FateDehydratedState, n as createTRPCTransport, nt as ViewTag, o as PersistenceSession, ot as FateMutations, p as createClient, q as TypeConfig, r as MutationIdentity, rt as __FateEntityBrand, s as PersistenceSnapshot, st as mutation, t as Transport, tt as ViewSnapshot, u as FateClient, v as List, w as DeferTag, x as ConnectionMetadata, y as getSelectionPlan, z as MutationResult } from "./transport-
|
|
2
|
-
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-
|
|
3
|
-
import { C as liveGlobalConnectionTopic, S as liveEntityTopic, a as FateProtocolRequest, i as FateOperation, n as FateLiveConnectionEvent, o as FateProtocolResponse, r as FateLiveEvent, t as isRecord, u as InferFateAPI, x as liveConnectionTopic } from "./record-
|
|
4
|
-
import { n as getListEntries, t as ListEntry } from "./list-
|
|
1
|
+
import { $ as ViewRef, A as EntityId, B as MutationShape, C as ConnectionTag, D as DeferredSelection, E as DeferredMetadata, F as MutationDefinition, G as RootDefinition, H as Pagination, I as MutationEntity, J as TypeName, K as Selection, L as MutationIdentifier, M as FateThenable, N as ListItem, O as DeferredTag, P as Mask, Q as ViewEntityName, R as MutationInput, S as ConnectionRef, T as Deferred, U as Request$1, V as NodesItem, W as RequestResult, X as ViewData, Y as View, Z as ViewEntity, a as Persistence, at as isViewTag, b as AnyRecord, c as RequestPersistenceOptions, d as RequestMode, et as ViewSelection, f as RequestOptions, g as HydrationLimits, h as HydrateOptions, i as PersistedMutationStatus, it as __FateSelectionBrand, j as FateRoots, k as Entity, l as DeferredSnapshot, m as FateDehydratedState, n as createTRPCTransport, nt as ViewTag, o as PersistenceSession, ot as FateMutations, p as createClient, q as TypeConfig, r as MutationIdentity, rt as __FateEntityBrand, s as PersistenceSnapshot, st as mutation, t as Transport, tt as ViewSnapshot, u as FateClient, v as List, w as DeferTag, x as ConnectionMetadata, y as getSelectionPlan, z as MutationResult } from "./transport-c5vvbtDC.mjs";
|
|
2
|
+
import { a as GraphQLTransportOptions, i as GraphQLMutationOutput, n as GraphQLMutationInput, o as createGraphQLTransport, r as GraphQLMutationMap, s as graphqlMutation, t as GraphQLMutationDefinition } from "./graphqlTransport-D7IPm9wQ.mjs";
|
|
3
|
+
import { C as liveGlobalConnectionTopic, S as liveEntityTopic, a as FateProtocolRequest, i as FateOperation, n as FateLiveConnectionEvent, o as FateProtocolResponse, r as FateLiveEvent, t as isRecord, u as InferFateAPI, x as liveConnectionTopic } from "./record-DmyMlWdZ.mjs";
|
|
4
|
+
import { n as getListEntries, t as ListEntry } from "./list-Dj7P-fay.mjs";
|
|
5
5
|
//#region src/defer.d.ts
|
|
6
|
-
declare function defer<S>(selection: S): DeferredSelection<S>;
|
|
7
|
-
declare const isDeferred: (value: unknown) => value is Deferred<unknown>;
|
|
8
|
-
declare const getDeferredMetadata: <T>(deferred: Deferred<T>) => DeferredMetadata;
|
|
6
|
+
export declare function defer<S>(selection: S): DeferredSelection<S>;
|
|
7
|
+
export declare const isDeferred: (value: unknown) => value is Deferred<unknown>;
|
|
8
|
+
export declare const getDeferredMetadata: <T>(deferred: Deferred<T>) => DeferredMetadata;
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/httpTransport.d.ts
|
|
11
11
|
type TransportMutations = Record<string, MutationShape>;
|
|
@@ -49,7 +49,7 @@ type VoidLiveClientEvent<Data = unknown> = {
|
|
|
49
49
|
topic: string;
|
|
50
50
|
type?: string;
|
|
51
51
|
};
|
|
52
|
-
declare function createHTTPTransport<API extends FateAPIShape, Mutations extends TransportMutations = MutationMapFromAPI<API>>({ eventSource, fetch: fetchImpl, headers, live, liveRetryMs, liveUrl, url }: {
|
|
52
|
+
export declare function createHTTPTransport<API extends FateAPIShape, Mutations extends TransportMutations = MutationMapFromAPI<API>>({ eventSource, fetch: fetchImpl, headers, live, liveRetryMs, liveUrl, url }: {
|
|
53
53
|
eventSource?: EventSourceConstructor;
|
|
54
54
|
fetch?: FetchLike;
|
|
55
55
|
headers?: HeadersFactory;
|
|
@@ -63,13 +63,13 @@ declare function createHTTPTransport<API extends FateAPIShape, Mutations extends
|
|
|
63
63
|
/**
|
|
64
64
|
* Defines a root query for an entity type, capturing the response shape.
|
|
65
65
|
*/
|
|
66
|
-
declare function clientRoot<Result, Type extends TypeName>(type: Type): RootDefinition<Type, Result>;
|
|
66
|
+
export declare function clientRoot<Result, Type extends TypeName>(type: Type): RootDefinition<Type, Result>;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/ref.d.ts
|
|
69
69
|
/**
|
|
70
70
|
* Builds the canonical cache ID for an entity.
|
|
71
71
|
*/
|
|
72
|
-
declare const toEntityId: (type: TypeName, rawId: string | number) => EntityId;
|
|
72
|
+
export declare const toEntityId: (type: TypeName, rawId: string | number) => EntityId;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/view.d.ts
|
|
75
75
|
type SelectionValidation<T extends Entity, S extends Selection<T>> = Exclude<keyof Omit<S, typeof __FateEntityBrand | typeof __FateSelectionBrand>, keyof Selection<T>> extends never ? unknown : never;
|
|
@@ -82,6 +82,6 @@ type SelectionValidation<T extends Entity, S extends Selection<T>> = Exclude<key
|
|
|
82
82
|
* title: true,
|
|
83
83
|
* });
|
|
84
84
|
*/
|
|
85
|
-
declare function view<T extends Entity>(): <S extends Selection<T>>(select: S & SelectionValidation<T, S>) => View<T, S>;
|
|
85
|
+
export declare function view<T extends Entity>(): <S extends Selection<T>>(select: S & SelectionValidation<T, S>) => View<T, S>;
|
|
86
86
|
//#endregion
|
|
87
|
-
export { type ConnectionMetadata, type ConnectionRef, ConnectionTag, DeferTag, type Deferred, type DeferredMetadata, type DeferredSelection, type DeferredSnapshot, DeferredTag, type Entity, type EntityId, FateClient, type FateDehydratedState, type FateLiveConnectionEvent, type FateLiveEvent, type FateMutations, type FateOperation, type FateProtocolRequest, type FateProtocolResponse, type AnyRecord as FateRecord, type FateRoots, type FateThenable, type GraphQLMutationDefinition, type GraphQLMutationInput, type GraphQLMutationMap, type GraphQLMutationOutput, type GraphQLTransportOptions, type HydrateOptions, type HydrationLimits, type InferFateAPI, type List, type ListEntry, type ListItem, type Mask, type MutationDefinition, type MutationEntity, type MutationIdentifier, type MutationIdentity, type MutationInput, type MutationResult, type NodesItem, type Pagination, type PersistedMutationStatus, type Persistence, type PersistenceSession, type PersistenceSnapshot, type Request$1 as Request, type RequestMode, type RequestOptions, type RequestPersistenceOptions, type RequestResult, type Selection, type Transport, type TypeConfig, type View, type ViewData, type ViewEntity, type ViewEntityName, type ViewRef, type ViewSelection, type ViewSnapshot, type ViewTag,
|
|
87
|
+
export { type ConnectionMetadata, type ConnectionRef, ConnectionTag, DeferTag, type Deferred, type DeferredMetadata, type DeferredSelection, type DeferredSnapshot, DeferredTag, type Entity, type EntityId, FateClient, type FateDehydratedState, type FateLiveConnectionEvent, type FateLiveEvent, type FateMutations, type FateOperation, type FateProtocolRequest, type FateProtocolResponse, type AnyRecord as FateRecord, type FateRoots, type FateThenable, type GraphQLMutationDefinition, type GraphQLMutationInput, type GraphQLMutationMap, type GraphQLMutationOutput, type GraphQLTransportOptions, type HydrateOptions, type HydrationLimits, type InferFateAPI, type List, type ListEntry, type ListItem, type Mask, type MutationDefinition, type MutationEntity, type MutationIdentifier, type MutationIdentity, type MutationInput, type MutationResult, type NodesItem, type Pagination, type PersistedMutationStatus, type Persistence, type PersistenceSession, type PersistenceSnapshot, type Request$1 as Request, type RequestMode, type RequestOptions, type RequestPersistenceOptions, type RequestResult, type Selection, type Transport, type TypeConfig, type View, type ViewData, type ViewEntity, type ViewEntityName, type ViewRef, type ViewSelection, type ViewSnapshot, type ViewTag, createClient, createGraphQLTransport, createTRPCTransport, getListEntries, getSelectionPlan, graphqlMutation, isRecord, isViewTag, liveConnectionTopic, liveEntityTopic, liveGlobalConnectionTopic, mutation };
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as isRecord } from "./record-B07VwXd-.mjs";
|
|
2
2
|
import { a as hashArgs, c as scopeArgsPayload, i as filterConnectionArgs, r as combineArgsPayload, s as resolvedArgsFromPlan, t as applyArgsPayloadToPlan } from "./args-CRLIRl_v.mjs";
|
|
3
3
|
import { _ as isNodesItem, a as createNodeRef, c as ConnectionTag, f as RootKind, g as isNodeItem, i as resolveHydrationLimits, l as DeferTag, m as ViewsTag, o as getNodeRefId, r as encodeHydrationValue, s as isNodeRef, t as decodeClientHydrationState, u as DeferredTag, v as isQueryItem, y as isViewTag } from "./hydration-DPZRJgnu.mjs";
|
|
4
|
-
import { C as isDeferredSelection, S as isDeferred, _ as view, a as mutation, b as getDeferredMetadata, c as getDeferredSelectionPlan, d as createRefWithViewNames, f as getRootViewNames, g as getViewPayloads, h as getViewNames, l as getSelectionPlan, m as toEntityId, n as getListKey, p as parseEntityId, r as mergePreservingExisting, s as wrapMutation, t as Store, u as assignViewTag, v as createDeferred, x as getDeferredSelection, y as defer } from "./store-
|
|
4
|
+
import { C as isDeferredSelection, S as isDeferred, _ as view, a as mutation, b as getDeferredMetadata, c as getDeferredSelectionPlan, d as createRefWithViewNames, f as getRootViewNames, g as getViewPayloads, h as getViewNames, l as getSelectionPlan, m as toEntityId, n as getListKey, p as parseEntityId, r as mergePreservingExisting, s as wrapMutation, t as Store, u as assignViewTag, v as createDeferred, x as getDeferredSelection, y as defer } from "./store-Dl_OPES3.mjs";
|
|
5
5
|
import { t as getListEntries } from "./list-_6fXYLtJ.mjs";
|
|
6
6
|
import { n as errorCodeFromStatus, t as FateRequestError } from "./protocol-DS5sf6sd.mjs";
|
|
7
7
|
import { n as graphqlMutation, t as createGraphQLTransport } from "./graphqlTransport-DmheG3AO.mjs";
|
package/lib/list.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getListEntries, t as ListEntry } from "./list-
|
|
1
|
+
import { n as getListEntries, t as ListEntry } from "./list-Dj7P-fay.mjs";
|
|
2
2
|
export { ListEntry, getListEntries };
|
package/lib/persistence.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { a as Persistence, c as RequestPersistenceOptions, i as PersistedMutationStatus, o as PersistenceSession, s as PersistenceSnapshot } from "./transport-
|
|
1
|
+
import { a as Persistence, c as RequestPersistenceOptions, i as PersistedMutationStatus, o as PersistenceSession, s as PersistenceSnapshot } from "./transport-c5vvbtDC.mjs";
|
|
2
2
|
//#region src/persistence.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Backend-neutral durable storage. Batches apply atomically and resolve only after
|
|
5
5
|
* commit. Exclusive sections must coordinate ALL instances using this key
|
|
6
6
|
* (including other tabs/processes). Use distinct lock names independently.
|
|
7
7
|
*/
|
|
8
|
-
type PersistenceStorageEntry = Readonly<{
|
|
8
|
+
export type PersistenceStorageEntry = Readonly<{
|
|
9
9
|
key: string;
|
|
10
10
|
value: unknown;
|
|
11
11
|
}>;
|
|
12
|
-
type PersistenceStorageWrite = readonly [key: string, value: unknown];
|
|
13
|
-
interface PersistenceStorage {
|
|
12
|
+
export type PersistenceStorageWrite = readonly [key: string, value: unknown];
|
|
13
|
+
export interface PersistenceStorage {
|
|
14
14
|
exclusive<T>(key: string, run: () => Promise<T>): Promise<T>;
|
|
15
15
|
read(key: string): Promise<unknown>;
|
|
16
16
|
/** Ordered, bounded scan. Return keys strictly after `after`, under `prefix`. */
|
|
@@ -19,7 +19,7 @@ interface PersistenceStorage {
|
|
|
19
19
|
/** Atomically apply a batch. Undefined deletes the key. */
|
|
20
20
|
writeBatch(entries: ReadonlyArray<PersistenceStorageWrite>): Promise<void>;
|
|
21
21
|
}
|
|
22
|
-
type PersistenceOptions = Readonly<{
|
|
22
|
+
export type PersistenceOptions = Readonly<{
|
|
23
23
|
key: string;
|
|
24
24
|
/** Maximum disk retention since a successful fetch, in milliseconds. Defaults to one day. */
|
|
25
25
|
maxAge?: number;
|
|
@@ -35,6 +35,6 @@ type PersistenceOptions = Readonly<{
|
|
|
35
35
|
* Import this entry point only in applications using persistence. Storage keys must
|
|
36
36
|
* isolate authenticated accounts/workspaces and match the server's identity scope.
|
|
37
37
|
*/
|
|
38
|
-
declare function createPersistence({ key, maxAge, maxBytes, online, retryDelay, storage }: PersistenceOptions): Persistence;
|
|
38
|
+
export declare function createPersistence({ key, maxAge, maxBytes, online, retryDelay, storage }: PersistenceOptions): Persistence;
|
|
39
39
|
//#endregion
|
|
40
|
-
export {
|
|
40
|
+
export type { PersistedMutationStatus, Persistence, PersistenceSession, PersistenceSnapshot, RequestPersistenceOptions };
|
package/lib/persistence.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as isRecord } from "./record-B07VwXd-.mjs";
|
|
2
2
|
import { i as filterConnectionArgs } from "./args-CRLIRl_v.mjs";
|
|
3
3
|
import { a as createNodeRef, n as decodeHydrationValue, o as getNodeRefId, r as encodeHydrationValue, s as isNodeRef, t as decodeClientHydrationState } from "./hydration-DPZRJgnu.mjs";
|
|
4
|
-
import { i as getErrorStatusCode, m as toEntityId, n as getListKey, o as prepareMutation } from "./store-
|
|
4
|
+
import { i as getErrorStatusCode, m as toEntityId, n as getListKey, o as prepareMutation } from "./store-Dl_OPES3.mjs";
|
|
5
5
|
import { t as FateRequestError } from "./protocol-DS5sf6sd.mjs";
|
|
6
6
|
//#region src/persistence-codec.ts
|
|
7
7
|
const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as AnyRecord, r as MutationIdentity } from "./transport-
|
|
2
|
-
import { t as MutationIdempotency } from "./idempotency-types-
|
|
3
|
-
import { N as DataViewResult, S as ConnectionResult, k as DataView, l as SourceDefinition, t as SourceRegistry } from "./executor-
|
|
1
|
+
import { b as AnyRecord, r as MutationIdentity } from "./transport-c5vvbtDC.mjs";
|
|
2
|
+
import { t as MutationIdempotency } from "./idempotency-types-jgGOlHFl.mjs";
|
|
3
|
+
import { N as DataViewResult, S as ConnectionResult, k as DataView, l as SourceDefinition, t as SourceRegistry } from "./executor-C3JLgeJ_.mjs";
|
|
4
4
|
//#region src/liveTopics.d.ts
|
|
5
5
|
declare const liveEntityTopic: (type: string, id: string | number) => string;
|
|
6
6
|
declare const liveConnectionTopic: (procedure: string, args?: Record<string, unknown>) => string;
|
package/lib/server/drizzle.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AnyRecord, lt as QueryProcedure } from "../transport-
|
|
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-
|
|
1
|
+
import { b as AnyRecord, lt as QueryProcedure } from "../transport-c5vvbtDC.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-C3JLgeJ_.mjs";
|
|
3
3
|
import { AnyColumn, SQLWrapper, Table } from "drizzle-orm";
|
|
4
4
|
//#region src/server/drizzle.d.ts
|
|
5
5
|
type SourceTarget<Item extends AnyRecord = AnyRecord> = DataView<Item> | SourceDefinition<Item, unknown>;
|
|
@@ -18,7 +18,7 @@ type DrizzleDatabase = {
|
|
|
18
18
|
select: (fields?: Record<string, unknown>) => any;
|
|
19
19
|
};
|
|
20
20
|
type DrizzleDatabaseInput<Context> = DrizzleDatabase | ((ctx: Context) => DrizzleDatabase);
|
|
21
|
-
type DrizzleQueryExtra = {
|
|
21
|
+
export type DrizzleQueryExtra = {
|
|
22
22
|
extraFields?: Array<string>;
|
|
23
23
|
where?: SQLWrapper;
|
|
24
24
|
};
|
|
@@ -29,12 +29,12 @@ type DrizzleManyToManyColumns = {
|
|
|
29
29
|
foreignColumn?: never;
|
|
30
30
|
localColumn?: never;
|
|
31
31
|
};
|
|
32
|
-
type DrizzleManyToManyConfig = DrizzleManyToManyColumns & {
|
|
32
|
+
export type DrizzleManyToManyConfig = DrizzleManyToManyColumns & {
|
|
33
33
|
columns?: ColumnMap;
|
|
34
34
|
table: DrizzleTable;
|
|
35
35
|
};
|
|
36
|
-
type DrizzleManyToManyInput = DrizzleManyToManyConfig | DrizzleTable;
|
|
37
|
-
type DrizzleViewConfig<Item extends AnyRecord = AnyRecord, TTable extends DrizzleTable = DrizzleTable> = SourceConfig<Item, unknown> & {
|
|
36
|
+
export type DrizzleManyToManyInput = DrizzleManyToManyConfig | DrizzleTable;
|
|
37
|
+
export type DrizzleViewConfig<Item extends AnyRecord = AnyRecord, TTable extends DrizzleTable = DrizzleTable> = SourceConfig<Item, unknown> & {
|
|
38
38
|
columns?: ColumnMap;
|
|
39
39
|
manyToMany?: Record<string, DrizzleManyToManyInput>;
|
|
40
40
|
table: TTable;
|
|
@@ -46,7 +46,7 @@ type DrizzleSourceAdapterOptions<Context> = {
|
|
|
46
46
|
schema?: Record<string, unknown>;
|
|
47
47
|
views: DrizzleViewsInput;
|
|
48
48
|
};
|
|
49
|
-
type DrizzleSourceAdapter<Context> = {
|
|
49
|
+
export type DrizzleSourceAdapter<Context> = {
|
|
50
50
|
fetchById: <Item extends AnyRecord = AnyRecord>({ ctx, extra, id, plan }: {
|
|
51
51
|
ctx?: Context;
|
|
52
52
|
extra?: DrizzleQueryExtra;
|
|
@@ -103,9 +103,9 @@ type SourceInput = {
|
|
|
103
103
|
args?: Record<string, unknown>;
|
|
104
104
|
select: Iterable<string>;
|
|
105
105
|
};
|
|
106
|
-
declare function createDrizzleSourceAdapter<Context>({ db, nestedPaginationConcurrency, schema, views }: DrizzleSourceAdapterOptions<Context>): DrizzleSourceAdapter<Context>;
|
|
107
|
-
declare const createDrizzleSourceRegistry: <Context>(options: Parameters<typeof createDrizzleSourceAdapter<Context>>[0]) => SourceRegistry<Context>;
|
|
108
|
-
declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({ procedure, ...options }: Parameters<typeof createDrizzleSourceAdapter<Context>>[0] & {
|
|
106
|
+
export declare function createDrizzleSourceAdapter<Context>({ db, nestedPaginationConcurrency, schema, views }: DrizzleSourceAdapterOptions<Context>): DrizzleSourceAdapter<Context>;
|
|
107
|
+
export declare const createDrizzleSourceRegistry: <Context>(options: Parameters<typeof createDrizzleSourceAdapter<Context>>[0]) => SourceRegistry<Context>;
|
|
108
|
+
export declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({ procedure, ...options }: Parameters<typeof createDrizzleSourceAdapter<Context>>[0] & {
|
|
109
109
|
procedure: Procedure;
|
|
110
110
|
}): {
|
|
111
111
|
fetchById: <Item extends AnyRecord = AnyRecord>({ ctx, extra, id, plan }: {
|
|
@@ -200,7 +200,9 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({ p
|
|
|
200
200
|
args?: Record<string, unknown> | undefined;
|
|
201
201
|
select: string[];
|
|
202
202
|
} & {
|
|
203
|
-
args?: Record<string, unknown> | (Record<string, unknown> &
|
|
203
|
+
args?: (Record<string, unknown> & object) | (Record<string, unknown> & {
|
|
204
|
+
[x: string]: unknown;
|
|
205
|
+
}) | undefined;
|
|
204
206
|
};
|
|
205
207
|
meta: unknown;
|
|
206
208
|
output: ConnectionResult<unknown>;
|
|
@@ -231,5 +233,4 @@ declare function createDrizzleFate<Context, Procedure extends ProcedureLike>({ p
|
|
|
231
233
|
view: ViewTarget<Item>;
|
|
232
234
|
}) => Promise<AnyRecord[]>;
|
|
233
235
|
};
|
|
234
|
-
//#endregion
|
|
235
|
-
export { DrizzleManyToManyConfig, DrizzleManyToManyInput, DrizzleQueryExtra, DrizzleSourceAdapter, DrizzleViewConfig, createDrizzleFate, createDrizzleSourceAdapter, createDrizzleSourceRegistry };
|
|
236
|
+
//#endregion
|
package/lib/server/prisma.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { b as AnyRecord, lt as QueryProcedure } from "../transport-
|
|
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-
|
|
1
|
+
import { b as AnyRecord, lt as QueryProcedure } from "../transport-c5vvbtDC.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-C3JLgeJ_.mjs";
|
|
3
3
|
//#region src/server/prisma.d.ts
|
|
4
|
-
type PrismaDelegate = {
|
|
4
|
+
export type PrismaDelegate = {
|
|
5
5
|
findMany?: (args: any) => Promise<Array<AnyRecord>>;
|
|
6
6
|
findUnique?: (args: any) => Promise<AnyRecord | null>;
|
|
7
7
|
groupBy?: (args: any) => Promise<Array<AnyRecord>>;
|
|
8
8
|
};
|
|
9
|
-
type PrismaQueryExtra = AnyRecord;
|
|
10
|
-
type PrismaViewConfig<Context, Item extends AnyRecord = AnyRecord> = {
|
|
9
|
+
export type PrismaQueryExtra = AnyRecord;
|
|
10
|
+
export type PrismaViewConfig<Context, Item extends AnyRecord = AnyRecord> = {
|
|
11
11
|
delegate: (ctx: Context) => unknown;
|
|
12
12
|
} & SourceConfig<Item, unknown>;
|
|
13
13
|
type PrismaViewsInput<Context> = Array<DataView<AnyRecord> | PrismaViewConfig<Context, AnyRecord>> | DataViewModule;
|
|
@@ -25,7 +25,7 @@ type ViewProcedureInput<Item extends AnyRecord, ById extends boolean | undefined
|
|
|
25
25
|
list?: List;
|
|
26
26
|
view: ViewTarget<Item>;
|
|
27
27
|
};
|
|
28
|
-
type PrismaSourceAdapter<Context> = {
|
|
28
|
+
export type PrismaSourceAdapter<Context> = {
|
|
29
29
|
fetchById: <Item extends AnyRecord = AnyRecord>({ ctx, extra, id, plan }: {
|
|
30
30
|
ctx: Context;
|
|
31
31
|
extra?: PrismaQueryExtra;
|
|
@@ -83,7 +83,7 @@ type SourceInput = {
|
|
|
83
83
|
args?: Record<string, unknown>;
|
|
84
84
|
select: Iterable<string>;
|
|
85
85
|
};
|
|
86
|
-
declare const prismaConnectionArgs: ({ cursor, direction, node, skip, take }: {
|
|
86
|
+
export declare const prismaConnectionArgs: ({ cursor, direction, node, skip, take }: {
|
|
87
87
|
cursor?: string;
|
|
88
88
|
direction: 'backward' | 'forward';
|
|
89
89
|
node: SourcePlanNode<any, any>;
|
|
@@ -99,9 +99,9 @@ declare const prismaConnectionArgs: ({ cursor, direction, node, skip, take }: {
|
|
|
99
99
|
}[];
|
|
100
100
|
take: number;
|
|
101
101
|
};
|
|
102
|
-
declare function createPrismaSourceAdapter<Context>({ prisma, views }: PrismaSourceAdapterOptions<Context>): PrismaSourceAdapter<Context>;
|
|
103
|
-
declare const createPrismaSourceRegistry: <Context>(options: Parameters<typeof createPrismaSourceAdapter<Context>>[0]) => SourceRegistry<Context>;
|
|
104
|
-
declare function createPrismaFate<Context, Procedure extends ProcedureLike>({ procedure, ...options }: Parameters<typeof createPrismaSourceAdapter<Context>>[0] & {
|
|
102
|
+
export declare function createPrismaSourceAdapter<Context>({ prisma, views }: PrismaSourceAdapterOptions<Context>): PrismaSourceAdapter<Context>;
|
|
103
|
+
export declare const createPrismaSourceRegistry: <Context>(options: Parameters<typeof createPrismaSourceAdapter<Context>>[0]) => SourceRegistry<Context>;
|
|
104
|
+
export declare function createPrismaFate<Context, Procedure extends ProcedureLike>({ procedure, ...options }: Parameters<typeof createPrismaSourceAdapter<Context>>[0] & {
|
|
105
105
|
procedure: Procedure;
|
|
106
106
|
}): {
|
|
107
107
|
fetchById: <Item extends AnyRecord = AnyRecord>({ ctx, extra, id, plan }: {
|
|
@@ -197,7 +197,9 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({ pr
|
|
|
197
197
|
args?: Record<string, unknown> | undefined;
|
|
198
198
|
select: string[];
|
|
199
199
|
} & {
|
|
200
|
-
args?: Record<string, unknown> | (Record<string, unknown> &
|
|
200
|
+
args?: (Record<string, unknown> & object) | (Record<string, unknown> & {
|
|
201
|
+
[x: string]: unknown;
|
|
202
|
+
}) | undefined;
|
|
201
203
|
};
|
|
202
204
|
meta: unknown;
|
|
203
205
|
output: ConnectionResult<unknown>;
|
|
@@ -228,5 +230,4 @@ declare function createPrismaFate<Context, Procedure extends ProcedureLike>({ pr
|
|
|
228
230
|
view: ViewTarget<Item>;
|
|
229
231
|
}) => Promise<AnyRecord[]>;
|
|
230
232
|
};
|
|
231
|
-
//#endregion
|
|
232
|
-
export { PrismaDelegate, PrismaQueryExtra, PrismaSourceAdapter, PrismaViewConfig, createPrismaFate, createPrismaSourceAdapter, createPrismaSourceRegistry, prismaConnectionArgs };
|
|
233
|
+
//#endregion
|