@trpc/server 11.0.0-rc.475 → 11.0.0-rc.480
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/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.js +9 -2
- package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +10 -3
- package/dist/adapters/ws.d.ts +4 -0
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +1 -0
- package/dist/adapters/ws.mjs +1 -1
- package/dist/bundle-analysis.json +106 -105
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +13 -2
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +13 -2
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +1 -1
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/sse.d.ts +11 -1
- package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/sse.js +25 -3
- package/dist/unstable-core-do-not-import/stream/sse.mjs +25 -3
- package/package.json +2 -2
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +11 -5
- package/src/adapters/ws.ts +1 -1
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +13 -1
- package/src/unstable-core-do-not-import/rootConfig.ts +4 -1
- package/src/unstable-core-do-not-import/stream/sse.ts +42 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBA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YAAY,CACb,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,EACvC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,QAyC5B"}
|
|
@@ -36,12 +36,19 @@ function fastifyTRPCPlugin(fastify, opts, done) {
|
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
38
|
if (opts.useWSS) {
|
|
39
|
+
const trpcOptions = opts.trpcOptions;
|
|
39
40
|
const onConnection = ws.getWSConnectionHandler({
|
|
40
|
-
...
|
|
41
|
+
...trpcOptions
|
|
41
42
|
});
|
|
42
43
|
fastify.get(prefix ?? '/', {
|
|
43
44
|
websocket: true
|
|
44
|
-
}, (socket, req)=>
|
|
45
|
+
}, async (socket, req)=>{
|
|
46
|
+
await onConnection(socket, req.raw);
|
|
47
|
+
if (trpcOptions?.keepAlive?.enabled) {
|
|
48
|
+
const { pingMs , pongWaitMs } = trpcOptions.keepAlive;
|
|
49
|
+
ws.handleKeepAlive(socket, pingMs, pongWaitMs);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
45
52
|
}
|
|
46
53
|
done();
|
|
47
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getWSConnectionHandler } from '../ws.mjs';
|
|
1
|
+
import { getWSConnectionHandler, handleKeepAlive } from '../ws.mjs';
|
|
2
2
|
import { fastifyRequestHandler } from './fastifyRequestHandler.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -34,12 +34,19 @@ function fastifyTRPCPlugin(fastify, opts, done) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
if (opts.useWSS) {
|
|
37
|
+
const trpcOptions = opts.trpcOptions;
|
|
37
38
|
const onConnection = getWSConnectionHandler({
|
|
38
|
-
...
|
|
39
|
+
...trpcOptions
|
|
39
40
|
});
|
|
40
41
|
fastify.get(prefix ?? '/', {
|
|
41
42
|
websocket: true
|
|
42
|
-
}, (socket, req)=>
|
|
43
|
+
}, async (socket, req)=>{
|
|
44
|
+
await onConnection(socket, req.raw);
|
|
45
|
+
if (trpcOptions?.keepAlive?.enabled) {
|
|
46
|
+
const { pingMs , pongWaitMs } = trpcOptions.keepAlive;
|
|
47
|
+
handleKeepAlive(socket, pingMs, pongWaitMs);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
43
50
|
}
|
|
44
51
|
done();
|
|
45
52
|
}
|
package/dist/adapters/ws.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export type WSSHandlerOptions<TRouter extends AnyRouter> = WSConnectionHandlerOp
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
export declare function getWSConnectionHandler<TRouter extends AnyRouter>(opts: WSConnectionHandlerOptions<TRouter>): (client: ws.WebSocket, req: IncomingMessage) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Handle WebSocket keep-alive messages
|
|
43
|
+
*/
|
|
44
|
+
export declare function handleKeepAlive(client: ws.WebSocket, pingMs?: number, pongWaitMs?: number): void;
|
|
41
45
|
export declare function applyWSSHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): {
|
|
42
46
|
broadcastReconnectNotification: () => void;
|
|
43
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AActE,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,8BA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AAU,SAAO,QAuBlB;AAED,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EACvD,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;;EA+BjC"}
|
package/dist/adapters/ws.js
CHANGED
package/dist/adapters/ws.mjs
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 26.
|
|
2
|
+
"bundleSize": 135062,
|
|
3
|
+
"bundleOrigSize": 183958,
|
|
4
|
+
"bundleReduction": 26.58,
|
|
5
5
|
"modules": [
|
|
6
|
+
{
|
|
7
|
+
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
8
|
+
"size": 17762,
|
|
9
|
+
"origSize": 16670,
|
|
10
|
+
"renderedExports": [
|
|
11
|
+
"resolveResponse"
|
|
12
|
+
],
|
|
13
|
+
"removedExports": [],
|
|
14
|
+
"dependents": [
|
|
15
|
+
"/src/unstable-core-do-not-import.ts"
|
|
16
|
+
],
|
|
17
|
+
"percent": 13.15,
|
|
18
|
+
"reduction": 0
|
|
19
|
+
},
|
|
6
20
|
{
|
|
7
21
|
"id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
8
22
|
"size": 17400,
|
|
@@ -17,36 +31,23 @@
|
|
|
17
31
|
"/src/unstable-core-do-not-import.ts",
|
|
18
32
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
19
33
|
],
|
|
20
|
-
"percent":
|
|
34
|
+
"percent": 12.88,
|
|
21
35
|
"reduction": 4.62
|
|
22
36
|
},
|
|
23
|
-
{
|
|
24
|
-
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
25
|
-
"size": 17157,
|
|
26
|
-
"origSize": 16294,
|
|
27
|
-
"renderedExports": [
|
|
28
|
-
"resolveResponse"
|
|
29
|
-
],
|
|
30
|
-
"removedExports": [],
|
|
31
|
-
"dependents": [
|
|
32
|
-
"/src/unstable-core-do-not-import.ts"
|
|
33
|
-
],
|
|
34
|
-
"percent": 12.86,
|
|
35
|
-
"reduction": 0
|
|
36
|
-
},
|
|
37
37
|
{
|
|
38
38
|
"id": "/src/adapters/ws.ts",
|
|
39
39
|
"size": 15730,
|
|
40
|
-
"origSize":
|
|
40
|
+
"origSize": 14672,
|
|
41
41
|
"renderedExports": [
|
|
42
42
|
"getWSConnectionHandler",
|
|
43
|
+
"handleKeepAlive",
|
|
43
44
|
"applyWSSHandler"
|
|
44
45
|
],
|
|
45
46
|
"removedExports": [],
|
|
46
47
|
"dependents": [
|
|
47
48
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
48
49
|
],
|
|
49
|
-
"percent": 11.
|
|
50
|
+
"percent": 11.65,
|
|
50
51
|
"reduction": 0
|
|
51
52
|
},
|
|
52
53
|
{
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"/src/unstable-core-do-not-import.ts",
|
|
62
63
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
63
64
|
],
|
|
64
|
-
"percent": 5.
|
|
65
|
+
"percent": 5.69,
|
|
65
66
|
"reduction": 0
|
|
66
67
|
},
|
|
67
68
|
{
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
"/src/unstable-core-do-not-import.ts",
|
|
80
81
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
81
82
|
],
|
|
82
|
-
"percent": 4.
|
|
83
|
+
"percent": 4.72,
|
|
83
84
|
"reduction": 39.77
|
|
84
85
|
},
|
|
85
86
|
{
|
|
@@ -94,39 +95,39 @@
|
|
|
94
95
|
"/src/unstable-core-do-not-import.ts",
|
|
95
96
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
96
97
|
],
|
|
97
|
-
"percent": 4.
|
|
98
|
+
"percent": 4.68,
|
|
98
99
|
"reduction": 60.09
|
|
99
100
|
},
|
|
100
101
|
{
|
|
101
|
-
"id": "/src/
|
|
102
|
-
"size":
|
|
103
|
-
"origSize":
|
|
102
|
+
"id": "/src/unstable-core-do-not-import/stream/sse.ts",
|
|
103
|
+
"size": 5910,
|
|
104
|
+
"origSize": 6971,
|
|
104
105
|
"renderedExports": [
|
|
105
|
-
"
|
|
106
|
+
"sseStreamProducer",
|
|
107
|
+
"sseStreamConsumer",
|
|
108
|
+
"sseHeaders"
|
|
106
109
|
],
|
|
107
110
|
"removedExports": [],
|
|
108
111
|
"dependents": [
|
|
109
|
-
"/src/
|
|
112
|
+
"/src/unstable-core-do-not-import.ts",
|
|
113
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
110
114
|
],
|
|
111
|
-
"percent": 4.
|
|
112
|
-
"reduction":
|
|
115
|
+
"percent": 4.38,
|
|
116
|
+
"reduction": 15.22
|
|
113
117
|
},
|
|
114
118
|
{
|
|
115
|
-
"id": "/src/
|
|
116
|
-
"size":
|
|
117
|
-
"origSize":
|
|
119
|
+
"id": "/src/adapters/aws-lambda/getPlanner.ts",
|
|
120
|
+
"size": 5418,
|
|
121
|
+
"origSize": 6114,
|
|
118
122
|
"renderedExports": [
|
|
119
|
-
"
|
|
120
|
-
"sseStreamConsumer",
|
|
121
|
-
"sseHeaders"
|
|
123
|
+
"getPlanner"
|
|
122
124
|
],
|
|
123
125
|
"removedExports": [],
|
|
124
126
|
"dependents": [
|
|
125
|
-
"/src/
|
|
126
|
-
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
127
|
+
"/src/adapters/aws-lambda/index.ts"
|
|
127
128
|
],
|
|
128
|
-
"percent":
|
|
129
|
-
"reduction":
|
|
129
|
+
"percent": 4.01,
|
|
130
|
+
"reduction": 11.38
|
|
130
131
|
},
|
|
131
132
|
{
|
|
132
133
|
"id": "/src/observable/observable.ts",
|
|
@@ -145,7 +146,7 @@
|
|
|
145
146
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
146
147
|
"/src/observable/operators.ts"
|
|
147
148
|
],
|
|
148
|
-
"percent": 3.
|
|
149
|
+
"percent": 3.05,
|
|
149
150
|
"reduction": 0
|
|
150
151
|
},
|
|
151
152
|
{
|
|
@@ -159,7 +160,7 @@
|
|
|
159
160
|
"dependents": [
|
|
160
161
|
"/src/adapters/next-app-dir.ts"
|
|
161
162
|
],
|
|
162
|
-
"percent": 2.
|
|
163
|
+
"percent": 2.32,
|
|
163
164
|
"reduction": 23.5
|
|
164
165
|
},
|
|
165
166
|
{
|
|
@@ -175,7 +176,7 @@
|
|
|
175
176
|
"dependents": [
|
|
176
177
|
"/src/observable/index.ts"
|
|
177
178
|
],
|
|
178
|
-
"percent": 2.
|
|
179
|
+
"percent": 2.04,
|
|
179
180
|
"reduction": 0
|
|
180
181
|
},
|
|
181
182
|
{
|
|
@@ -195,7 +196,7 @@
|
|
|
195
196
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
196
197
|
"/src/unstable-core-do-not-import/router.ts"
|
|
197
198
|
],
|
|
198
|
-
"percent": 2.
|
|
199
|
+
"percent": 2.03,
|
|
199
200
|
"reduction": 45.94
|
|
200
201
|
},
|
|
201
202
|
{
|
|
@@ -209,7 +210,7 @@
|
|
|
209
210
|
"dependents": [
|
|
210
211
|
"/src/adapters/node-http/index.ts"
|
|
211
212
|
],
|
|
212
|
-
"percent": 2.
|
|
213
|
+
"percent": 2.02,
|
|
213
214
|
"reduction": 6.79
|
|
214
215
|
},
|
|
215
216
|
{
|
|
@@ -223,7 +224,7 @@
|
|
|
223
224
|
"dependents": [
|
|
224
225
|
"/src/unstable-core-do-not-import.ts"
|
|
225
226
|
],
|
|
226
|
-
"percent": 2
|
|
227
|
+
"percent": 2,
|
|
227
228
|
"reduction": 40.91
|
|
228
229
|
},
|
|
229
230
|
{
|
|
@@ -243,7 +244,7 @@
|
|
|
243
244
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
244
245
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
245
246
|
],
|
|
246
|
-
"percent": 1.
|
|
247
|
+
"percent": 1.95,
|
|
247
248
|
"reduction": 55.5
|
|
248
249
|
},
|
|
249
250
|
{
|
|
@@ -259,7 +260,7 @@
|
|
|
259
260
|
"/src/unstable-core-do-not-import.ts",
|
|
260
261
|
"/src/unstable-core-do-not-import/router.ts"
|
|
261
262
|
],
|
|
262
|
-
"percent": 1.
|
|
263
|
+
"percent": 1.72,
|
|
263
264
|
"reduction": 0
|
|
264
265
|
},
|
|
265
266
|
{
|
|
@@ -273,7 +274,7 @@
|
|
|
273
274
|
"dependents": [
|
|
274
275
|
"/src/adapters/fetch/index.ts"
|
|
275
276
|
],
|
|
276
|
-
"percent": 1.
|
|
277
|
+
"percent": 1.67,
|
|
277
278
|
"reduction": 2.17
|
|
278
279
|
},
|
|
279
280
|
{
|
|
@@ -288,7 +289,7 @@
|
|
|
288
289
|
"/src/adapters/node-http/index.ts",
|
|
289
290
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
290
291
|
],
|
|
291
|
-
"percent": 1.
|
|
292
|
+
"percent": 1.62,
|
|
292
293
|
"reduction": 13.79
|
|
293
294
|
},
|
|
294
295
|
{
|
|
@@ -302,9 +303,23 @@
|
|
|
302
303
|
"dependents": [
|
|
303
304
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
304
305
|
],
|
|
305
|
-
"percent": 1.
|
|
306
|
+
"percent": 1.52,
|
|
306
307
|
"reduction": 5.79
|
|
307
308
|
},
|
|
309
|
+
{
|
|
310
|
+
"id": "/src/adapters/fastify/fastifyTRPCPlugin.ts",
|
|
311
|
+
"size": 1779,
|
|
312
|
+
"origSize": 2537,
|
|
313
|
+
"renderedExports": [
|
|
314
|
+
"fastifyTRPCPlugin"
|
|
315
|
+
],
|
|
316
|
+
"removedExports": [],
|
|
317
|
+
"dependents": [
|
|
318
|
+
"/src/adapters/fastify/index.ts"
|
|
319
|
+
],
|
|
320
|
+
"percent": 1.32,
|
|
321
|
+
"reduction": 29.88
|
|
322
|
+
},
|
|
308
323
|
{
|
|
309
324
|
"id": "/src/unstable-core-do-not-import/error/TRPCError.ts",
|
|
310
325
|
"size": 1733,
|
|
@@ -326,7 +341,7 @@
|
|
|
326
341
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
327
342
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
328
343
|
],
|
|
329
|
-
"percent": 1.
|
|
344
|
+
"percent": 1.28,
|
|
330
345
|
"reduction": 19.47
|
|
331
346
|
},
|
|
332
347
|
{
|
|
@@ -338,7 +353,7 @@
|
|
|
338
353
|
],
|
|
339
354
|
"removedExports": [],
|
|
340
355
|
"dependents": [],
|
|
341
|
-
"percent": 1.
|
|
356
|
+
"percent": 1.26,
|
|
342
357
|
"reduction": 19.29
|
|
343
358
|
},
|
|
344
359
|
{
|
|
@@ -351,7 +366,7 @@
|
|
|
351
366
|
],
|
|
352
367
|
"removedExports": [],
|
|
353
368
|
"dependents": [],
|
|
354
|
-
"percent": 1.
|
|
369
|
+
"percent": 1.19,
|
|
355
370
|
"reduction": 27.47
|
|
356
371
|
},
|
|
357
372
|
{
|
|
@@ -363,23 +378,9 @@
|
|
|
363
378
|
],
|
|
364
379
|
"removedExports": [],
|
|
365
380
|
"dependents": [],
|
|
366
|
-
"percent": 1.
|
|
381
|
+
"percent": 1.14,
|
|
367
382
|
"reduction": 26.94
|
|
368
383
|
},
|
|
369
|
-
{
|
|
370
|
-
"id": "/src/adapters/fastify/fastifyTRPCPlugin.ts",
|
|
371
|
-
"size": 1500,
|
|
372
|
-
"origSize": 2297,
|
|
373
|
-
"renderedExports": [
|
|
374
|
-
"fastifyTRPCPlugin"
|
|
375
|
-
],
|
|
376
|
-
"removedExports": [],
|
|
377
|
-
"dependents": [
|
|
378
|
-
"/src/adapters/fastify/index.ts"
|
|
379
|
-
],
|
|
380
|
-
"percent": 1.12,
|
|
381
|
-
"reduction": 34.7
|
|
382
|
-
},
|
|
383
384
|
{
|
|
384
385
|
"id": "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
385
386
|
"size": 1365,
|
|
@@ -394,7 +395,7 @@
|
|
|
394
395
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
395
396
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
396
397
|
],
|
|
397
|
-
"percent": 1.
|
|
398
|
+
"percent": 1.01,
|
|
398
399
|
"reduction": 17.52
|
|
399
400
|
},
|
|
400
401
|
{
|
|
@@ -426,7 +427,7 @@
|
|
|
426
427
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
427
428
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
428
429
|
],
|
|
429
|
-
"percent": 0.
|
|
430
|
+
"percent": 0.89,
|
|
430
431
|
"reduction": 28.12
|
|
431
432
|
},
|
|
432
433
|
{
|
|
@@ -441,7 +442,7 @@
|
|
|
441
442
|
"/src/adapters/fastify/index.ts",
|
|
442
443
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
443
444
|
],
|
|
444
|
-
"percent": 0.
|
|
445
|
+
"percent": 0.84,
|
|
445
446
|
"reduction": 47.59
|
|
446
447
|
},
|
|
447
448
|
{
|
|
@@ -457,7 +458,7 @@
|
|
|
457
458
|
"/src/unstable-core-do-not-import.ts",
|
|
458
459
|
"/src/unstable-core-do-not-import/http/contentType.ts"
|
|
459
460
|
],
|
|
460
|
-
"percent": 0.
|
|
461
|
+
"percent": 0.82,
|
|
461
462
|
"reduction": 15.08
|
|
462
463
|
},
|
|
463
464
|
{
|
|
@@ -471,7 +472,7 @@
|
|
|
471
472
|
"dependents": [
|
|
472
473
|
"/src/unstable-core-do-not-import.ts"
|
|
473
474
|
],
|
|
474
|
-
"percent": 0.
|
|
475
|
+
"percent": 0.78,
|
|
475
476
|
"reduction": 0
|
|
476
477
|
},
|
|
477
478
|
{
|
|
@@ -486,7 +487,7 @@
|
|
|
486
487
|
"/src/unstable-core-do-not-import.ts",
|
|
487
488
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
488
489
|
],
|
|
489
|
-
"percent": 0.
|
|
490
|
+
"percent": 0.77,
|
|
490
491
|
"reduction": 58.57
|
|
491
492
|
},
|
|
492
493
|
{
|
|
@@ -503,7 +504,7 @@
|
|
|
503
504
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
504
505
|
"/src/adapters/next-app-dir/rethrowNextErrors.ts"
|
|
505
506
|
],
|
|
506
|
-
"percent": 0.
|
|
507
|
+
"percent": 0.73,
|
|
507
508
|
"reduction": 13.65
|
|
508
509
|
},
|
|
509
510
|
{
|
|
@@ -521,7 +522,7 @@
|
|
|
521
522
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
522
523
|
"/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts"
|
|
523
524
|
],
|
|
524
|
-
"percent": 0.
|
|
525
|
+
"percent": 0.73,
|
|
525
526
|
"reduction": 15.69
|
|
526
527
|
},
|
|
527
528
|
{
|
|
@@ -538,7 +539,7 @@
|
|
|
538
539
|
"/src/unstable-core-do-not-import.ts",
|
|
539
540
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
540
541
|
],
|
|
541
|
-
"percent": 0.
|
|
542
|
+
"percent": 0.59,
|
|
542
543
|
"reduction": 44.65
|
|
543
544
|
},
|
|
544
545
|
{
|
|
@@ -550,7 +551,7 @@
|
|
|
550
551
|
],
|
|
551
552
|
"removedExports": [],
|
|
552
553
|
"dependents": [],
|
|
553
|
-
"percent": 0.
|
|
554
|
+
"percent": 0.56,
|
|
554
555
|
"reduction": 66.9
|
|
555
556
|
},
|
|
556
557
|
{
|
|
@@ -564,7 +565,7 @@
|
|
|
564
565
|
"dependents": [
|
|
565
566
|
"/src/unstable-core-do-not-import.ts"
|
|
566
567
|
],
|
|
567
|
-
"percent": 0.
|
|
568
|
+
"percent": 0.49,
|
|
568
569
|
"reduction": 0.6
|
|
569
570
|
},
|
|
570
571
|
{
|
|
@@ -579,7 +580,7 @@
|
|
|
579
580
|
"/src/unstable-core-do-not-import.ts",
|
|
580
581
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
581
582
|
],
|
|
582
|
-
"percent": 0.
|
|
583
|
+
"percent": 0.46,
|
|
583
584
|
"reduction": 43.49
|
|
584
585
|
},
|
|
585
586
|
{
|
|
@@ -613,7 +614,7 @@
|
|
|
613
614
|
{
|
|
614
615
|
"id": "/src/unstable-core-do-not-import/rootConfig.ts",
|
|
615
616
|
"size": 343,
|
|
616
|
-
"origSize":
|
|
617
|
+
"origSize": 3270,
|
|
617
618
|
"renderedExports": [
|
|
618
619
|
"isServerDefault"
|
|
619
620
|
],
|
|
@@ -622,8 +623,8 @@
|
|
|
622
623
|
"/src/unstable-core-do-not-import.ts",
|
|
623
624
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
624
625
|
],
|
|
625
|
-
"percent": 0.
|
|
626
|
-
"reduction": 89.
|
|
626
|
+
"percent": 0.25,
|
|
627
|
+
"reduction": 89.51
|
|
627
628
|
},
|
|
628
629
|
{
|
|
629
630
|
"id": "/src/adapters/express.ts",
|
|
@@ -662,7 +663,7 @@
|
|
|
662
663
|
"dependents": [
|
|
663
664
|
"/src/unstable-core-do-not-import.ts"
|
|
664
665
|
],
|
|
665
|
-
"percent": 0.
|
|
666
|
+
"percent": 0.16,
|
|
666
667
|
"reduction": 94.55
|
|
667
668
|
},
|
|
668
669
|
{
|
|
@@ -746,16 +747,6 @@
|
|
|
746
747
|
"percent": 0,
|
|
747
748
|
"reduction": 100
|
|
748
749
|
},
|
|
749
|
-
{
|
|
750
|
-
"id": "/src/shared.ts",
|
|
751
|
-
"size": 0,
|
|
752
|
-
"origSize": 653,
|
|
753
|
-
"renderedExports": [],
|
|
754
|
-
"removedExports": [],
|
|
755
|
-
"dependents": [],
|
|
756
|
-
"percent": 0,
|
|
757
|
-
"reduction": 100
|
|
758
|
-
},
|
|
759
750
|
{
|
|
760
751
|
"id": "/src/rpc.ts",
|
|
761
752
|
"size": 0,
|
|
@@ -779,6 +770,16 @@
|
|
|
779
770
|
"percent": 0,
|
|
780
771
|
"reduction": 100
|
|
781
772
|
},
|
|
773
|
+
{
|
|
774
|
+
"id": "/src/shared.ts",
|
|
775
|
+
"size": 0,
|
|
776
|
+
"origSize": 653,
|
|
777
|
+
"renderedExports": [],
|
|
778
|
+
"removedExports": [],
|
|
779
|
+
"dependents": [],
|
|
780
|
+
"percent": 0,
|
|
781
|
+
"reduction": 100
|
|
782
|
+
},
|
|
782
783
|
{
|
|
783
784
|
"id": "/src/adapters/next-app-dir.ts",
|
|
784
785
|
"size": 0,
|
|
@@ -811,6 +812,16 @@
|
|
|
811
812
|
"percent": 0,
|
|
812
813
|
"reduction": 100
|
|
813
814
|
},
|
|
815
|
+
{
|
|
816
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
817
|
+
"size": 0,
|
|
818
|
+
"origSize": 64,
|
|
819
|
+
"renderedExports": [],
|
|
820
|
+
"removedExports": [],
|
|
821
|
+
"dependents": [],
|
|
822
|
+
"percent": 0,
|
|
823
|
+
"reduction": 100
|
|
824
|
+
},
|
|
814
825
|
{
|
|
815
826
|
"id": "/src/adapters/node-http/index.ts",
|
|
816
827
|
"size": 0,
|
|
@@ -825,16 +836,6 @@
|
|
|
825
836
|
],
|
|
826
837
|
"percent": 0,
|
|
827
838
|
"reduction": 100
|
|
828
|
-
},
|
|
829
|
-
{
|
|
830
|
-
"id": "/src/adapters/fetch/index.ts",
|
|
831
|
-
"size": 0,
|
|
832
|
-
"origSize": 64,
|
|
833
|
-
"renderedExports": [],
|
|
834
|
-
"removedExports": [],
|
|
835
|
-
"dependents": [],
|
|
836
|
-
"percent": 0,
|
|
837
|
-
"reduction": 100
|
|
838
839
|
}
|
|
839
840
|
],
|
|
840
841
|
"moduleCount": 56
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CA6ZnB"}
|
|
@@ -284,9 +284,20 @@ async function resolveResponse(opts) {
|
|
|
284
284
|
}
|
|
285
285
|
const dataAsIterable = observable.isObservable(data) ? observable.observableToAsyncIterable(data) : data;
|
|
286
286
|
const stream = sse.sseStreamProducer({
|
|
287
|
-
...
|
|
287
|
+
...config.experimental?.sseSubscriptions,
|
|
288
288
|
data: dataAsIterable,
|
|
289
|
-
serialize: (v)=>config.transformer.output.serialize(v)
|
|
289
|
+
serialize: (v)=>config.transformer.output.serialize(v),
|
|
290
|
+
formatError (errorOpts) {
|
|
291
|
+
const shape = getErrorShape.getErrorShape({
|
|
292
|
+
config,
|
|
293
|
+
ctx,
|
|
294
|
+
error: TRPCError.getTRPCErrorFromUnknown(errorOpts.error),
|
|
295
|
+
input: call?.result(),
|
|
296
|
+
path: call?.path,
|
|
297
|
+
type: call?.procedure?._def.type ?? 'unknown'
|
|
298
|
+
});
|
|
299
|
+
return shape;
|
|
300
|
+
}
|
|
290
301
|
});
|
|
291
302
|
for (const [key, value] of Object.entries(sse.sseHeaders)){
|
|
292
303
|
headers.set(key, value);
|
|
@@ -282,9 +282,20 @@ async function resolveResponse(opts) {
|
|
|
282
282
|
}
|
|
283
283
|
const dataAsIterable = isObservable(data) ? observableToAsyncIterable(data) : data;
|
|
284
284
|
const stream = sseStreamProducer({
|
|
285
|
-
...
|
|
285
|
+
...config.experimental?.sseSubscriptions,
|
|
286
286
|
data: dataAsIterable,
|
|
287
|
-
serialize: (v)=>config.transformer.output.serialize(v)
|
|
287
|
+
serialize: (v)=>config.transformer.output.serialize(v),
|
|
288
|
+
formatError (errorOpts) {
|
|
289
|
+
const shape = getErrorShape({
|
|
290
|
+
config,
|
|
291
|
+
ctx,
|
|
292
|
+
error: getTRPCErrorFromUnknown(errorOpts.error),
|
|
293
|
+
input: call?.result(),
|
|
294
|
+
path: call?.path,
|
|
295
|
+
type: call?.procedure?._def.type ?? 'unknown'
|
|
296
|
+
});
|
|
297
|
+
return shape;
|
|
298
|
+
}
|
|
288
299
|
});
|
|
289
300
|
for (const [key, value] of Object.entries(sseHeaders)){
|
|
290
301
|
headers.set(key, value);
|
|
@@ -69,7 +69,7 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
69
69
|
* @default true
|
|
70
70
|
*/
|
|
71
71
|
enabled?: boolean;
|
|
72
|
-
} &
|
|
72
|
+
} & Pick<SSEStreamProducerOptions, 'ping' | 'emitAndEndImmediately' | 'maxDurationMs'>;
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootConfig.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/rootConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAMmB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM,SAAS,SAAS;IAClD;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,EAAE,uBAAuB,CAAC;IACrC;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;I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AM,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IAErE,YAAY,CAAC,EAAE;QACb;;;WAGG;QACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC;;WAEG;QACH,gBAAgB,CAAC,EAAE;YACjB;;;eAGG;YACH,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,GAAG,IAAI,CACN,wBAAwB,EACxB,MAAM,GAAG,uBAAuB,GAAG,eAAe,CACnD,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,SAAS,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;IACzC,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,KAAK,SAAS,CAAC,UAAU,SAAS,OAAO,EAAE,KAAK,IAAI,UAAU,SAAS,IAAI,GACvE,OAAO,CAAC,KAAK,CAAC,GACd,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,EACR,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACvC,SAAS,CACX,MAAM,SAAS,QAAQ,GAAG,IAAI,GAAG,KAAK,EACtC;IACE;;QAEI;IACJ,aAAa,EAAE,SAAS,CAAC;CAC1B,CACF,CAAC"}
|
|
@@ -34,12 +34,22 @@ export interface SSEStreamProducerOptions {
|
|
|
34
34
|
* @default false
|
|
35
35
|
*/
|
|
36
36
|
emitAndEndImmediately?: boolean;
|
|
37
|
+
formatError?: (opts: {
|
|
38
|
+
error: unknown;
|
|
39
|
+
}) => unknown;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
*
|
|
40
43
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
41
44
|
*/
|
|
42
45
|
export declare function sseStreamProducer(opts: SSEStreamProducerOptions): ReadableStream<string>;
|
|
46
|
+
type ConsumerStreamResult<TData> = {
|
|
47
|
+
ok: true;
|
|
48
|
+
data: inferTrackedOutput<TData>;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
error: unknown;
|
|
52
|
+
};
|
|
43
53
|
/**
|
|
44
54
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
45
55
|
*/
|
|
@@ -47,7 +57,7 @@ export declare function sseStreamConsumer<TData>(opts: {
|
|
|
47
57
|
from: EventSource;
|
|
48
58
|
onError?: ConsumerOnError;
|
|
49
59
|
deserialize?: Deserialize;
|
|
50
|
-
}): AsyncIterable<
|
|
60
|
+
}): AsyncIterable<ConsumerStreamResult<TData>>;
|
|
51
61
|
export declare const sseHeaders: {
|
|
52
62
|
readonly 'Content-Type': "text/event-stream";
|
|
53
63
|
readonly 'Cache-Control': "no-cache, no-transform";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/stream/sse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAKpD,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AACrC,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7B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jC,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEN;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CA6E7C;AAED,eAAO,MAAM,UAAU;;;;;CAKb,CAAC"}
|
|
@@ -6,6 +6,7 @@ var tracked = require('./tracked.js');
|
|
|
6
6
|
var createDeferred = require('./utils/createDeferred.js');
|
|
7
7
|
var createReadableStream = require('./utils/createReadableStream.js');
|
|
8
8
|
|
|
9
|
+
const SERIALIZED_ERROR_EVENT = 'serialized-error';
|
|
9
10
|
/**
|
|
10
11
|
*
|
|
11
12
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
@@ -46,7 +47,13 @@ var createReadableStream = require('./utils/createReadableStream.js');
|
|
|
46
47
|
continue;
|
|
47
48
|
}
|
|
48
49
|
if (next instanceof Error) {
|
|
49
|
-
|
|
50
|
+
const data = opts.formatError ? opts.formatError({
|
|
51
|
+
error: next
|
|
52
|
+
}) : null;
|
|
53
|
+
stream.controller.enqueue({
|
|
54
|
+
event: SERIALIZED_ERROR_EVENT,
|
|
55
|
+
data: JSON.stringify(serialize(data))
|
|
56
|
+
});
|
|
50
57
|
break;
|
|
51
58
|
}
|
|
52
59
|
if (next.done) {
|
|
@@ -103,18 +110,33 @@ var createReadableStream = require('./utils/createReadableStream.js');
|
|
|
103
110
|
const stream = createReadableStream.createReadableStream();
|
|
104
111
|
const transform = new TransformStream({
|
|
105
112
|
async transform (chunk, controller) {
|
|
113
|
+
const data = deserialize(JSON.parse(chunk.data));
|
|
114
|
+
if (chunk.type === SERIALIZED_ERROR_EVENT) {
|
|
115
|
+
controller.enqueue({
|
|
116
|
+
ok: false,
|
|
117
|
+
error: data
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// console.debug('transforming', chunk.type, chunk.data);
|
|
106
122
|
const def = {
|
|
107
|
-
data
|
|
123
|
+
data
|
|
108
124
|
};
|
|
109
125
|
if (chunk.lastEventId) {
|
|
110
126
|
def.id = chunk.lastEventId;
|
|
111
127
|
}
|
|
112
|
-
controller.enqueue(
|
|
128
|
+
controller.enqueue({
|
|
129
|
+
ok: true,
|
|
130
|
+
data: def
|
|
131
|
+
});
|
|
113
132
|
}
|
|
114
133
|
});
|
|
115
134
|
eventSource.addEventListener('message', (msg)=>{
|
|
116
135
|
stream.controller.enqueue(msg);
|
|
117
136
|
});
|
|
137
|
+
eventSource.addEventListener(SERIALIZED_ERROR_EVENT, (msg)=>{
|
|
138
|
+
stream.controller.enqueue(msg);
|
|
139
|
+
});
|
|
118
140
|
eventSource.addEventListener('error', (cause)=>{
|
|
119
141
|
if (eventSource.readyState === EventSource.CLOSED) {
|
|
120
142
|
stream.controller.error(cause);
|
|
@@ -4,6 +4,7 @@ import { isTrackedEnvelope } from './tracked.mjs';
|
|
|
4
4
|
import { createTimeoutPromise } from './utils/createDeferred.mjs';
|
|
5
5
|
import { createReadableStream } from './utils/createReadableStream.mjs';
|
|
6
6
|
|
|
7
|
+
const SERIALIZED_ERROR_EVENT = 'serialized-error';
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
@@ -44,7 +45,13 @@ import { createReadableStream } from './utils/createReadableStream.mjs';
|
|
|
44
45
|
continue;
|
|
45
46
|
}
|
|
46
47
|
if (next instanceof Error) {
|
|
47
|
-
|
|
48
|
+
const data = opts.formatError ? opts.formatError({
|
|
49
|
+
error: next
|
|
50
|
+
}) : null;
|
|
51
|
+
stream.controller.enqueue({
|
|
52
|
+
event: SERIALIZED_ERROR_EVENT,
|
|
53
|
+
data: JSON.stringify(serialize(data))
|
|
54
|
+
});
|
|
48
55
|
break;
|
|
49
56
|
}
|
|
50
57
|
if (next.done) {
|
|
@@ -101,18 +108,33 @@ import { createReadableStream } from './utils/createReadableStream.mjs';
|
|
|
101
108
|
const stream = createReadableStream();
|
|
102
109
|
const transform = new TransformStream({
|
|
103
110
|
async transform (chunk, controller) {
|
|
111
|
+
const data = deserialize(JSON.parse(chunk.data));
|
|
112
|
+
if (chunk.type === SERIALIZED_ERROR_EVENT) {
|
|
113
|
+
controller.enqueue({
|
|
114
|
+
ok: false,
|
|
115
|
+
error: data
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// console.debug('transforming', chunk.type, chunk.data);
|
|
104
120
|
const def = {
|
|
105
|
-
data
|
|
121
|
+
data
|
|
106
122
|
};
|
|
107
123
|
if (chunk.lastEventId) {
|
|
108
124
|
def.id = chunk.lastEventId;
|
|
109
125
|
}
|
|
110
|
-
controller.enqueue(
|
|
126
|
+
controller.enqueue({
|
|
127
|
+
ok: true,
|
|
128
|
+
data: def
|
|
129
|
+
});
|
|
111
130
|
}
|
|
112
131
|
});
|
|
113
132
|
eventSource.addEventListener('message', (msg)=>{
|
|
114
133
|
stream.controller.enqueue(msg);
|
|
115
134
|
});
|
|
135
|
+
eventSource.addEventListener(SERIALIZED_ERROR_EVENT, (msg)=>{
|
|
136
|
+
stream.controller.enqueue(msg);
|
|
137
|
+
});
|
|
116
138
|
eventSource.addEventListener('error', (cause)=>{
|
|
117
139
|
if (eventSource.readyState === EventSource.CLOSED) {
|
|
118
140
|
stream.controller.error(cause);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.480+6dc84d9eb",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"funding": [
|
|
150
150
|
"https://trpc.io/sponsor"
|
|
151
151
|
],
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "6dc84d9ebef60539d4e835c17aff9ee22cbf204b"
|
|
153
153
|
}
|
|
@@ -14,7 +14,7 @@ import type { AnyRouter } from '../../@trpc/server';
|
|
|
14
14
|
// @trpc/server/http
|
|
15
15
|
import type { NodeHTTPCreateContextFnOptions } from '../node-http';
|
|
16
16
|
// @trpc/server/ws
|
|
17
|
-
import { getWSConnectionHandler, type WSSHandlerOptions } from '../ws';
|
|
17
|
+
import { getWSConnectionHandler, handleKeepAlive, type WSSHandlerOptions } from '../ws';
|
|
18
18
|
import type { FastifyHandlerOptions } from './fastifyRequestHandler';
|
|
19
19
|
import { fastifyRequestHandler } from './fastifyRequestHandler';
|
|
20
20
|
|
|
@@ -57,13 +57,19 @@ export function fastifyTRPCPlugin<TRouter extends AnyRouter>(
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
if (opts.useWSS) {
|
|
60
|
+
const trpcOptions = opts.trpcOptions as unknown as WSSHandlerOptions<TRouter>;
|
|
61
|
+
|
|
60
62
|
const onConnection = getWSConnectionHandler<TRouter>({
|
|
61
|
-
...
|
|
63
|
+
...trpcOptions,
|
|
62
64
|
});
|
|
63
65
|
|
|
64
|
-
fastify.get(prefix ?? '/', { websocket: true }, (socket, req) =>
|
|
65
|
-
onConnection(socket, req.raw)
|
|
66
|
-
|
|
66
|
+
fastify.get(prefix ?? '/', { websocket: true }, async (socket, req) => {
|
|
67
|
+
await onConnection(socket, req.raw);
|
|
68
|
+
if (trpcOptions?.keepAlive?.enabled) {
|
|
69
|
+
const { pingMs, pongWaitMs } = trpcOptions.keepAlive;
|
|
70
|
+
handleKeepAlive(socket, pingMs, pongWaitMs);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
done();
|
package/src/adapters/ws.ts
CHANGED
|
@@ -461,7 +461,7 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
|
|
|
461
461
|
/**
|
|
462
462
|
* Handle WebSocket keep-alive messages
|
|
463
463
|
*/
|
|
464
|
-
function handleKeepAlive(
|
|
464
|
+
export function handleKeepAlive(
|
|
465
465
|
client: ws.WebSocket,
|
|
466
466
|
pingMs = 30000,
|
|
467
467
|
pongWaitMs = 5000,
|
|
@@ -380,9 +380,21 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
380
380
|
? observableToAsyncIterable(data)
|
|
381
381
|
: data;
|
|
382
382
|
const stream = sseStreamProducer({
|
|
383
|
-
...
|
|
383
|
+
...config.experimental?.sseSubscriptions,
|
|
384
384
|
data: dataAsIterable,
|
|
385
385
|
serialize: (v) => config.transformer.output.serialize(v),
|
|
386
|
+
formatError(errorOpts) {
|
|
387
|
+
const shape = getErrorShape({
|
|
388
|
+
config,
|
|
389
|
+
ctx,
|
|
390
|
+
error: getTRPCErrorFromUnknown(errorOpts.error),
|
|
391
|
+
input: call?.result(),
|
|
392
|
+
path: call?.path,
|
|
393
|
+
type: call?.procedure?._def.type ?? 'unknown',
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
return shape;
|
|
397
|
+
},
|
|
386
398
|
});
|
|
387
399
|
for (const [key, value] of Object.entries(sseHeaders)) {
|
|
388
400
|
headers.set(key, value);
|
|
@@ -80,7 +80,10 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
80
80
|
* @default true
|
|
81
81
|
*/
|
|
82
82
|
enabled?: boolean;
|
|
83
|
-
} &
|
|
83
|
+
} & Pick<
|
|
84
|
+
SSEStreamProducerOptions,
|
|
85
|
+
'ping' | 'emitAndEndImmediately' | 'maxDurationMs'
|
|
86
|
+
>;
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -42,8 +42,11 @@ export interface SSEStreamProducerOptions {
|
|
|
42
42
|
* @default false
|
|
43
43
|
*/
|
|
44
44
|
emitAndEndImmediately?: boolean;
|
|
45
|
+
formatError?: (opts: { error: unknown }) => unknown;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
const SERIALIZED_ERROR_EVENT = 'serialized-error';
|
|
49
|
+
|
|
47
50
|
type SSEvent = Partial<{
|
|
48
51
|
id: string;
|
|
49
52
|
data: unknown;
|
|
@@ -106,7 +109,13 @@ export function sseStreamProducer(opts: SSEStreamProducerOptions) {
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
if (next instanceof Error) {
|
|
109
|
-
|
|
112
|
+
const data = opts.formatError
|
|
113
|
+
? opts.formatError({ error: next })
|
|
114
|
+
: null;
|
|
115
|
+
stream.controller.enqueue({
|
|
116
|
+
event: SERIALIZED_ERROR_EVENT,
|
|
117
|
+
data: JSON.stringify(serialize(data)),
|
|
118
|
+
});
|
|
110
119
|
break;
|
|
111
120
|
}
|
|
112
121
|
if (next.done) {
|
|
@@ -165,15 +174,25 @@ export function sseStreamProducer(opts: SSEStreamProducerOptions) {
|
|
|
165
174
|
}),
|
|
166
175
|
);
|
|
167
176
|
}
|
|
177
|
+
|
|
178
|
+
type ConsumerStreamResult<TData> =
|
|
179
|
+
| {
|
|
180
|
+
ok: true;
|
|
181
|
+
data: inferTrackedOutput<TData>;
|
|
182
|
+
}
|
|
183
|
+
| {
|
|
184
|
+
ok: false;
|
|
185
|
+
error: unknown;
|
|
186
|
+
};
|
|
187
|
+
|
|
168
188
|
/**
|
|
169
189
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
170
190
|
*/
|
|
171
|
-
|
|
172
191
|
export function sseStreamConsumer<TData>(opts: {
|
|
173
192
|
from: EventSource;
|
|
174
193
|
onError?: ConsumerOnError;
|
|
175
194
|
deserialize?: Deserialize;
|
|
176
|
-
}): AsyncIterable<
|
|
195
|
+
}): AsyncIterable<ConsumerStreamResult<TData>> {
|
|
177
196
|
const { deserialize = (v) => v } = opts;
|
|
178
197
|
const eventSource = opts.from;
|
|
179
198
|
|
|
@@ -181,23 +200,39 @@ export function sseStreamConsumer<TData>(opts: {
|
|
|
181
200
|
|
|
182
201
|
const transform = new TransformStream<
|
|
183
202
|
MessageEvent,
|
|
184
|
-
|
|
203
|
+
ConsumerStreamResult<TData>
|
|
185
204
|
>({
|
|
186
205
|
async transform(chunk, controller) {
|
|
206
|
+
const data = deserialize(JSON.parse(chunk.data));
|
|
207
|
+
if (chunk.type === SERIALIZED_ERROR_EVENT) {
|
|
208
|
+
controller.enqueue({
|
|
209
|
+
ok: false,
|
|
210
|
+
error: data,
|
|
211
|
+
});
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
// console.debug('transforming', chunk.type, chunk.data);
|
|
187
215
|
const def: SSEvent = {
|
|
188
|
-
data
|
|
216
|
+
data,
|
|
189
217
|
};
|
|
190
218
|
|
|
191
219
|
if (chunk.lastEventId) {
|
|
192
220
|
def.id = chunk.lastEventId;
|
|
193
221
|
}
|
|
194
|
-
|
|
222
|
+
|
|
223
|
+
controller.enqueue({
|
|
224
|
+
ok: true,
|
|
225
|
+
data: def as inferTrackedOutput<TData>,
|
|
226
|
+
});
|
|
195
227
|
},
|
|
196
228
|
});
|
|
197
229
|
|
|
198
230
|
eventSource.addEventListener('message', (msg) => {
|
|
199
231
|
stream.controller.enqueue(msg);
|
|
200
232
|
});
|
|
233
|
+
eventSource.addEventListener(SERIALIZED_ERROR_EVENT, (msg) => {
|
|
234
|
+
stream.controller.enqueue(msg);
|
|
235
|
+
});
|
|
201
236
|
eventSource.addEventListener('error', (cause) => {
|
|
202
237
|
if (eventSource.readyState === EventSource.CLOSED) {
|
|
203
238
|
stream.controller.error(cause);
|
|
@@ -209,7 +244,7 @@ export function sseStreamConsumer<TData>(opts: {
|
|
|
209
244
|
[Symbol.asyncIterator]() {
|
|
210
245
|
const reader = readable.getReader();
|
|
211
246
|
|
|
212
|
-
const iterator: AsyncIterator<
|
|
247
|
+
const iterator: AsyncIterator<ConsumerStreamResult<TData>> = {
|
|
213
248
|
async next() {
|
|
214
249
|
const value = await reader.read();
|
|
215
250
|
if (value.done) {
|