@trpc/server 11.0.0-rc.678 → 11.0.0-rc.688
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/bundle-analysis.json +21 -21
- package/dist/unstable-core-do-not-import/stream/sse.d.ts +1 -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 +7 -3
- package/dist/unstable-core-do-not-import/stream/sse.mjs +7 -3
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/stream/sse.ts +28 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 14.
|
|
2
|
+
"bundleSize": 187247,
|
|
3
|
+
"bundleOrigSize": 219578,
|
|
4
|
+
"bundleReduction": 14.72,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"/src/unstable-core-do-not-import.ts",
|
|
18
18
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
19
19
|
],
|
|
20
|
-
"percent": 11.
|
|
20
|
+
"percent": 11.71,
|
|
21
21
|
"reduction": 0
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependents": [
|
|
32
32
|
"/src/unstable-core-do-not-import.ts"
|
|
33
33
|
],
|
|
34
|
-
"percent": 11.
|
|
34
|
+
"percent": 11.28,
|
|
35
35
|
"reduction": 0
|
|
36
36
|
},
|
|
37
37
|
{
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"dependents": [
|
|
48
48
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
49
49
|
],
|
|
50
|
-
"percent": 10.
|
|
50
|
+
"percent": 10.75,
|
|
51
51
|
"reduction": 0
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"id": "/src/unstable-core-do-not-import/stream/sse.ts",
|
|
55
|
-
"size":
|
|
56
|
-
"origSize":
|
|
55
|
+
"size": 12627,
|
|
56
|
+
"origSize": 12452,
|
|
57
57
|
"renderedExports": [
|
|
58
58
|
"sseStreamProducer",
|
|
59
59
|
"sseStreamConsumer",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"/src/unstable-core-do-not-import.ts",
|
|
65
65
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
66
66
|
],
|
|
67
|
-
"percent": 6.
|
|
67
|
+
"percent": 6.74,
|
|
68
68
|
"reduction": 0
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
],
|
|
78
78
|
"removedExports": [],
|
|
79
79
|
"dependents": [],
|
|
80
|
-
"percent": 6.
|
|
80
|
+
"percent": 6.49,
|
|
81
81
|
"reduction": 11.62
|
|
82
82
|
},
|
|
83
83
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"/src/unstable-core-do-not-import.ts",
|
|
93
93
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
94
94
|
],
|
|
95
|
-
"percent": 4.
|
|
95
|
+
"percent": 4.1,
|
|
96
96
|
"reduction": 0
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
130
130
|
"/src/unstable-core-do-not-import/stream/utils/withPing.ts"
|
|
131
131
|
],
|
|
132
|
-
"percent": 3.
|
|
132
|
+
"percent": 3.11,
|
|
133
133
|
"reduction": 0
|
|
134
134
|
},
|
|
135
135
|
{
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"/src/unstable-core-do-not-import.ts",
|
|
145
145
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
146
146
|
],
|
|
147
|
-
"percent": 3.
|
|
147
|
+
"percent": 3.09,
|
|
148
148
|
"reduction": 65.01
|
|
149
149
|
},
|
|
150
150
|
{
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"/src/observable/operators.ts",
|
|
179
179
|
"/src/observable/behaviorSubject.ts"
|
|
180
180
|
],
|
|
181
|
-
"percent": 2.
|
|
181
|
+
"percent": 2.58,
|
|
182
182
|
"reduction": 0
|
|
183
183
|
},
|
|
184
184
|
{
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
"dependents": [
|
|
257
257
|
"/src/adapters/node-http/index.ts"
|
|
258
258
|
],
|
|
259
|
-
"percent": 1.
|
|
259
|
+
"percent": 1.46,
|
|
260
260
|
"reduction": 16.3
|
|
261
261
|
},
|
|
262
262
|
{
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
349
349
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
350
350
|
],
|
|
351
|
-
"percent": 1.
|
|
351
|
+
"percent": 1.31,
|
|
352
352
|
"reduction": 17.51
|
|
353
353
|
},
|
|
354
354
|
{
|
|
@@ -436,7 +436,7 @@
|
|
|
436
436
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
437
437
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
438
438
|
],
|
|
439
|
-
"percent": 1.
|
|
439
|
+
"percent": 1.11,
|
|
440
440
|
"reduction": 18.54
|
|
441
441
|
},
|
|
442
442
|
{
|
|
@@ -903,9 +903,9 @@
|
|
|
903
903
|
"reduction": 100
|
|
904
904
|
},
|
|
905
905
|
{
|
|
906
|
-
"id": "/src/adapters/
|
|
906
|
+
"id": "/src/adapters/fastify/index.ts",
|
|
907
907
|
"size": 0,
|
|
908
|
-
"origSize":
|
|
908
|
+
"origSize": 78,
|
|
909
909
|
"renderedExports": [],
|
|
910
910
|
"removedExports": [],
|
|
911
911
|
"dependents": [],
|
|
@@ -913,9 +913,9 @@
|
|
|
913
913
|
"reduction": 100
|
|
914
914
|
},
|
|
915
915
|
{
|
|
916
|
-
"id": "/src/adapters/
|
|
916
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
917
917
|
"size": 0,
|
|
918
|
-
"origSize":
|
|
918
|
+
"origSize": 64,
|
|
919
919
|
"renderedExports": [],
|
|
920
920
|
"removedExports": [],
|
|
921
921
|
"dependents": [],
|
|
@@ -54,7 +54,7 @@ export interface SSEStreamProducerOptions<TValue = unknown> {
|
|
|
54
54
|
*
|
|
55
55
|
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
56
56
|
*/
|
|
57
|
-
export declare function sseStreamProducer<TValue = unknown>(opts: SSEStreamProducerOptions<TValue>): ReadableStream<
|
|
57
|
+
export declare function sseStreamProducer<TValue = unknown>(opts: SSEStreamProducerOptions<TValue>): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
58
58
|
interface ConsumerStreamResultBase<TConfig extends ConsumerConfig> {
|
|
59
59
|
eventSource: InstanceType<TConfig['EventSource']> | null;
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/stream/sse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAWpD,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,cAAc;IAC7B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IA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O,SAAS,cAAc,EAC9D,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,GACtC,aAAa,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAiK9C;AAED,eAAO,MAAM,UAAU;;;;;CAKb,CAAC"}
|
|
@@ -174,7 +174,7 @@ const CONNECTED_EVENT = 'connected';
|
|
|
174
174
|
}
|
|
175
175
|
controller.enqueue('\n\n');
|
|
176
176
|
}
|
|
177
|
-
}));
|
|
177
|
+
})).pipeThrough(new TextEncoderStream());
|
|
178
178
|
}
|
|
179
179
|
async function withTimeout(opts) {
|
|
180
180
|
const env = {
|
|
@@ -270,8 +270,12 @@ async function withTimeout(opts) {
|
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
272
|
const onAbort = ()=>{
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
try {
|
|
274
|
+
eventSource.close();
|
|
275
|
+
controller.close();
|
|
276
|
+
} catch {
|
|
277
|
+
// ignore errors in case the controller is already closed
|
|
278
|
+
}
|
|
275
279
|
};
|
|
276
280
|
if (signal.aborted) {
|
|
277
281
|
onAbort();
|
|
@@ -172,7 +172,7 @@ const CONNECTED_EVENT = 'connected';
|
|
|
172
172
|
}
|
|
173
173
|
controller.enqueue('\n\n');
|
|
174
174
|
}
|
|
175
|
-
}));
|
|
175
|
+
})).pipeThrough(new TextEncoderStream());
|
|
176
176
|
}
|
|
177
177
|
async function withTimeout(opts) {
|
|
178
178
|
const env = {
|
|
@@ -268,8 +268,12 @@ async function withTimeout(opts) {
|
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
270
|
const onAbort = ()=>{
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
try {
|
|
272
|
+
eventSource.close();
|
|
273
|
+
controller.close();
|
|
274
|
+
} catch {
|
|
275
|
+
// ignore errors in case the controller is already closed
|
|
276
|
+
}
|
|
273
277
|
};
|
|
274
278
|
if (signal.aborted) {
|
|
275
279
|
onAbort();
|
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.688+87ea49ed1",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"peerDependencies": {
|
|
153
153
|
"typescript": ">=5.7.2"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "87ea49ed1da187e72669ce6f638500369b16b749"
|
|
156
156
|
}
|
|
@@ -176,27 +176,30 @@ export function sseStreamProducer<TValue = unknown>(
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
+
|
|
179
180
|
const stream = readableStreamFrom(generatorWithErrorHandling());
|
|
180
181
|
|
|
181
|
-
return stream
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
182
|
+
return stream
|
|
183
|
+
.pipeThrough(
|
|
184
|
+
new TransformStream({
|
|
185
|
+
transform(chunk, controller: TransformStreamDefaultController<string>) {
|
|
186
|
+
if ('event' in chunk) {
|
|
187
|
+
controller.enqueue(`event: ${chunk.event}\n`);
|
|
188
|
+
}
|
|
189
|
+
if ('data' in chunk) {
|
|
190
|
+
controller.enqueue(`data: ${chunk.data}\n`);
|
|
191
|
+
}
|
|
192
|
+
if ('id' in chunk) {
|
|
193
|
+
controller.enqueue(`id: ${chunk.id}\n`);
|
|
194
|
+
}
|
|
195
|
+
if ('comment' in chunk) {
|
|
196
|
+
controller.enqueue(`: ${chunk.comment}\n`);
|
|
197
|
+
}
|
|
198
|
+
controller.enqueue('\n\n');
|
|
199
|
+
},
|
|
200
|
+
}),
|
|
201
|
+
)
|
|
202
|
+
.pipeThrough(new TextEncoderStream());
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
interface ConsumerStreamResultBase<TConfig extends ConsumerConfig> {
|
|
@@ -361,8 +364,12 @@ export function sseStreamConsumer<TConfig extends ConsumerConfig>(
|
|
|
361
364
|
});
|
|
362
365
|
|
|
363
366
|
const onAbort = () => {
|
|
364
|
-
|
|
365
|
-
|
|
367
|
+
try {
|
|
368
|
+
eventSource.close();
|
|
369
|
+
controller.close();
|
|
370
|
+
} catch {
|
|
371
|
+
// ignore errors in case the controller is already closed
|
|
372
|
+
}
|
|
366
373
|
};
|
|
367
374
|
if (signal.aborted) {
|
|
368
375
|
onAbort();
|