@trpc/server 11.0.0-rc.746 → 11.0.0-rc.747

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 195415,
3
- "bundleOrigSize": 226915,
4
- "bundleReduction": 13.88,
2
+ "bundleSize": 194848,
3
+ "bundleOrigSize": 226299,
4
+ "bundleReduction": 13.9,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -14,40 +14,40 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 10.78,
17
+ "percent": 10.81,
18
18
  "reduction": 0
19
19
  },
20
20
  {
21
- "id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
22
- "size": 20511,
23
- "origSize": 17610,
21
+ "id": "/src/adapters/ws.ts",
22
+ "size": 20168,
23
+ "origSize": 15955,
24
24
  "renderedExports": [
25
- "isPromise",
26
- "jsonlStreamProducer",
27
- "jsonlStreamConsumer"
25
+ "getWSConnectionHandler",
26
+ "handleKeepAlive",
27
+ "applyWSSHandler"
28
28
  ],
29
29
  "removedExports": [],
30
30
  "dependents": [
31
- "/src/unstable-core-do-not-import.ts",
32
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
31
+ "/src/adapters/fastify/fastifyTRPCPlugin.ts"
33
32
  ],
34
- "percent": 10.5,
33
+ "percent": 10.35,
35
34
  "reduction": 0
36
35
  },
37
36
  {
38
- "id": "/src/adapters/ws.ts",
39
- "size": 20168,
40
- "origSize": 15955,
37
+ "id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
38
+ "size": 19944,
39
+ "origSize": 16994,
41
40
  "renderedExports": [
42
- "getWSConnectionHandler",
43
- "handleKeepAlive",
44
- "applyWSSHandler"
41
+ "isPromise",
42
+ "jsonlStreamProducer",
43
+ "jsonlStreamConsumer"
45
44
  ],
46
45
  "removedExports": [],
47
46
  "dependents": [
48
- "/src/adapters/fastify/fastifyTRPCPlugin.ts"
47
+ "/src/unstable-core-do-not-import.ts",
48
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts"
49
49
  ],
50
- "percent": 10.32,
50
+ "percent": 10.24,
51
51
  "reduction": 0
52
52
  },
53
53
  {
@@ -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.46,
67
+ "percent": 6.48,
68
68
  "reduction": 0
69
69
  },
70
70
  {
@@ -77,7 +77,7 @@
77
77
  ],
78
78
  "removedExports": [],
79
79
  "dependents": [],
80
- "percent": 6.22,
80
+ "percent": 6.24,
81
81
  "reduction": 11.62
82
82
  },
83
83
  {
@@ -91,7 +91,7 @@
91
91
  "dependents": [
92
92
  "/src/unstable-core-do-not-import/stream/jsonl.ts"
93
93
  ],
94
- "percent": 4.16,
94
+ "percent": 4.17,
95
95
  "reduction": 0
96
96
  },
97
97
  {
@@ -106,7 +106,7 @@
106
106
  "/src/unstable-core-do-not-import.ts",
107
107
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
108
108
  ],
109
- "percent": 3.97,
109
+ "percent": 3.99,
110
110
  "reduction": 0
111
111
  },
112
112
  {
@@ -124,7 +124,7 @@
124
124
  "/src/unstable-core-do-not-import.ts",
125
125
  "/src/unstable-core-do-not-import/initTRPC.ts"
126
126
  ],
127
- "percent": 3.3,
127
+ "percent": 3.31,
128
128
  "reduction": 39.41
129
129
  },
130
130
  {
@@ -144,7 +144,7 @@
144
144
  "/src/unstable-core-do-not-import/stream/sse.ts",
145
145
  "/src/unstable-core-do-not-import/stream/utils/withPing.ts"
146
146
  ],
147
- "percent": 2.98,
147
+ "percent": 2.99,
148
148
  "reduction": 0
149
149
  },
150
150
  {
@@ -159,7 +159,7 @@
159
159
  "/src/unstable-core-do-not-import.ts",
160
160
  "/src/unstable-core-do-not-import/initTRPC.ts"
161
161
  ],
162
- "percent": 2.96,
162
+ "percent": 2.97,
163
163
  "reduction": 65.01
164
164
  },
165
165
  {
@@ -173,7 +173,7 @@
173
173
  "dependents": [
174
174
  "/src/adapters/aws-lambda/index.ts"
175
175
  ],
176
- "percent": 2.77,
176
+ "percent": 2.78,
177
177
  "reduction": 11.51
178
178
  },
179
179
  {
@@ -193,7 +193,7 @@
193
193
  "/src/observable/operators.ts",
194
194
  "/src/observable/behaviorSubject.ts"
195
195
  ],
196
- "percent": 2.47,
196
+ "percent": 2.48,
197
197
  "reduction": 0
198
198
  },
199
199
  {
@@ -209,7 +209,7 @@
209
209
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
210
210
  "/src/unstable-core-do-not-import/stream/sse.ts"
211
211
  ],
212
- "percent": 2.27,
212
+ "percent": 2.28,
213
213
  "reduction": 0
214
214
  },
215
215
  {
@@ -225,7 +225,7 @@
225
225
  "/src/adapters/node-http/index.ts",
226
226
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
227
227
  ],
228
- "percent": 2.07,
228
+ "percent": 2.08,
229
229
  "reduction": 6.82
230
230
  },
231
231
  {
@@ -243,7 +243,7 @@
243
243
  "dependents": [
244
244
  "/src/observable/index.ts"
245
245
  ],
246
- "percent": 2,
246
+ "percent": 2.01,
247
247
  "reduction": 1.66
248
248
  },
249
249
  {
@@ -272,7 +272,7 @@
272
272
  "dependents": [
273
273
  "/src/adapters/node-http/index.ts"
274
274
  ],
275
- "percent": 1.4,
275
+ "percent": 1.41,
276
276
  "reduction": 16.3
277
277
  },
278
278
  {
@@ -288,11 +288,11 @@
288
288
  "removedExports": [],
289
289
  "dependents": [
290
290
  "/src/unstable-core-do-not-import.ts",
291
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
291
292
  "/src/unstable-core-do-not-import/initTRPC.ts",
292
- "/src/unstable-core-do-not-import/router.ts",
293
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
293
+ "/src/unstable-core-do-not-import/router.ts"
294
294
  ],
295
- "percent": 1.4,
295
+ "percent": 1.41,
296
296
  "reduction": 45.98
297
297
  },
298
298
  {
@@ -306,7 +306,7 @@
306
306
  "dependents": [
307
307
  "/src/unstable-core-do-not-import.ts"
308
308
  ],
309
- "percent": 1.36,
309
+ "percent": 1.37,
310
310
  "reduction": 40.81
311
311
  },
312
312
  {
@@ -326,7 +326,7 @@
326
326
  "/src/unstable-core-do-not-import/initTRPC.ts",
327
327
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
328
328
  ],
329
- "percent": 1.34,
329
+ "percent": 1.35,
330
330
  "reduction": 55.79
331
331
  },
332
332
  {
@@ -350,13 +350,13 @@
350
350
  "removedExports": [],
351
351
  "dependents": [
352
352
  "/src/unstable-core-do-not-import.ts",
353
+ "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
354
+ "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
355
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
353
356
  "/src/unstable-core-do-not-import/error/TRPCError.ts",
354
357
  "/src/unstable-core-do-not-import/transformer.ts",
355
358
  "/src/unstable-core-do-not-import/middleware.ts",
356
359
  "/src/unstable-core-do-not-import/router.ts",
357
- "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
358
- "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
359
- "/src/unstable-core-do-not-import/http/resolveResponse.ts",
360
360
  "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
361
361
  "/src/unstable-core-do-not-import/http/contentType.ts",
362
362
  "/src/unstable-core-do-not-import/http/isAbortError.ts",
@@ -379,10 +379,10 @@
379
379
  "removedExports": [],
380
380
  "dependents": [
381
381
  "/src/unstable-core-do-not-import.ts",
382
- "/src/unstable-core-do-not-import/middleware.ts",
383
- "/src/unstable-core-do-not-import/router.ts",
384
382
  "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
385
383
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
384
+ "/src/unstable-core-do-not-import/middleware.ts",
385
+ "/src/unstable-core-do-not-import/router.ts",
386
386
  "/src/unstable-core-do-not-import/http/contentType.ts",
387
387
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
388
388
  "/src/unstable-core-do-not-import/stream/sse.ts"
@@ -403,7 +403,7 @@
403
403
  "/src/unstable-core-do-not-import.ts",
404
404
  "/src/unstable-core-do-not-import/router.ts"
405
405
  ],
406
- "percent": 1.19,
406
+ "percent": 1.2,
407
407
  "reduction": 0
408
408
  },
409
409
  {
@@ -431,7 +431,7 @@
431
431
  "dependents": [
432
432
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
433
433
  ],
434
- "percent": 1.08,
434
+ "percent": 1.09,
435
435
  "reduction": 5.4
436
436
  },
437
437
  {
@@ -449,8 +449,8 @@
449
449
  "removedExports": [],
450
450
  "dependents": [
451
451
  "/src/unstable-core-do-not-import.ts",
452
- "/src/unstable-core-do-not-import/error/getErrorShape.ts",
453
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
452
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
453
+ "/src/unstable-core-do-not-import/error/getErrorShape.ts"
454
454
  ],
455
455
  "percent": 1.07,
456
456
  "reduction": 18.54
@@ -526,7 +526,7 @@
526
526
  ],
527
527
  "removedExports": [],
528
528
  "dependents": [],
529
- "percent": 0.82,
529
+ "percent": 0.83,
530
530
  "reduction": 17.81
531
531
  },
532
532
  {
@@ -541,7 +541,7 @@
541
541
  "/src/unstable-core-do-not-import.ts",
542
542
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
543
543
  ],
544
- "percent": 0.82,
544
+ "percent": 0.83,
545
545
  "reduction": 54.01
546
546
  },
547
547
  {
@@ -601,7 +601,7 @@
601
601
  "/src/unstable-core-do-not-import.ts",
602
602
  "/src/unstable-core-do-not-import/http/contentType.ts"
603
603
  ],
604
- "percent": 0.56,
604
+ "percent": 0.57,
605
605
  "reduction": 15.08
606
606
  },
607
607
  {
@@ -629,7 +629,7 @@
629
629
  "dependents": [
630
630
  "/src/observable/index.ts"
631
631
  ],
632
- "percent": 0.49,
632
+ "percent": 0.5,
633
633
  "reduction": 32.89
634
634
  },
635
635
  {
@@ -655,7 +655,7 @@
655
655
  ],
656
656
  "removedExports": [],
657
657
  "dependents": [],
658
- "percent": 0.45,
658
+ "percent": 0.46,
659
659
  "reduction": 34
660
660
  },
661
661
  {
@@ -855,24 +855,24 @@
855
855
  "reduction": 93.9
856
856
  },
857
857
  {
858
- "id": "/src/index.ts",
858
+ "id": "/src/http.ts",
859
859
  "size": 0,
860
- "origSize": 32,
860
+ "origSize": 37,
861
861
  "renderedExports": [],
862
862
  "removedExports": [],
863
- "dependents": [],
863
+ "dependents": [
864
+ "/src/adapters/ws.ts"
865
+ ],
864
866
  "percent": 0,
865
867
  "reduction": 100
866
868
  },
867
869
  {
868
- "id": "/src/http.ts",
870
+ "id": "/src/index.ts",
869
871
  "size": 0,
870
- "origSize": 37,
872
+ "origSize": 32,
871
873
  "renderedExports": [],
872
874
  "removedExports": [],
873
- "dependents": [
874
- "/src/adapters/ws.ts"
875
- ],
875
+ "dependents": [],
876
876
  "percent": 0,
877
877
  "reduction": 100
878
878
  },
@@ -903,10 +903,10 @@
903
903
  "renderedExports": [],
904
904
  "removedExports": [],
905
905
  "dependents": [
906
- "/src/adapters/express.ts",
907
906
  "/src/adapters/next.ts",
908
- "/src/adapters/standalone.ts",
907
+ "/src/adapters/express.ts",
909
908
  "/src/adapters/ws.ts",
909
+ "/src/adapters/standalone.ts",
910
910
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
911
911
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
912
912
  "/src/adapters/node-http/writeResponse.ts"
@@ -947,28 +947,28 @@
947
947
  "reduction": 100
948
948
  },
949
949
  {
950
- "id": "/src/adapters/node-http/index.ts",
950
+ "id": "/src/adapters/fetch/index.ts",
951
951
  "size": 0,
952
- "origSize": 111,
952
+ "origSize": 64,
953
953
  "renderedExports": [],
954
954
  "removedExports": [],
955
- "dependents": [
956
- "/src/adapters/express.ts",
957
- "/src/adapters/next.ts",
958
- "/src/adapters/standalone.ts",
959
- "/src/adapters/ws.ts",
960
- "/src/adapters/fastify/fastifyRequestHandler.ts"
961
- ],
955
+ "dependents": [],
962
956
  "percent": 0,
963
957
  "reduction": 100
964
958
  },
965
959
  {
966
- "id": "/src/adapters/fetch/index.ts",
960
+ "id": "/src/adapters/node-http/index.ts",
967
961
  "size": 0,
968
- "origSize": 64,
962
+ "origSize": 111,
969
963
  "renderedExports": [],
970
964
  "removedExports": [],
971
- "dependents": [],
965
+ "dependents": [
966
+ "/src/adapters/next.ts",
967
+ "/src/adapters/express.ts",
968
+ "/src/adapters/ws.ts",
969
+ "/src/adapters/standalone.ts",
970
+ "/src/adapters/fastify/fastifyRequestHandler.ts"
971
+ ],
972
972
  "percent": 0,
973
973
  "reduction": 100
974
974
  }
@@ -86,16 +86,9 @@ export interface JSONLProducerOptions {
86
86
  * @see https://jsonlines.org/
87
87
  */
88
88
  export declare function jsonlStreamProducer(opts: JSONLProducerOptions): ReadableStream<Uint8Array<ArrayBufferLike>>;
89
- declare class StreamInterruptedError extends Error {
90
- constructor(cause?: unknown);
91
- }
92
89
  export type ConsumerOnError = (opts: {
93
90
  error: unknown;
94
91
  }) => void;
95
- /**
96
- * Represents a chunk of data or stream interruption error that can be enqueued to a controller
97
- */
98
- type ControllerChunk = ChunkData | StreamInterruptedError;
99
92
  /**
100
93
  * JSON Lines stream consumer
101
94
  * @see https://jsonlines.org/
@@ -113,10 +106,11 @@ export declare function jsonlStreamConsumer<THead>(opts: {
113
106
  abortController: AbortController;
114
107
  }): Promise<readonly [Awaited<THead>, {
115
108
  getOrCreate: (chunkId: ChunkIndex) => {
116
- enqueue: (v: ControllerChunk) => void;
109
+ enqueue: (v: ChunkData) => void;
117
110
  close: () => void;
118
111
  closed: boolean;
119
- getReaderResource: () => ReadableStreamDefaultReader<ControllerChunk> & Disposable;
112
+ getReaderResource: () => ReadableStreamDefaultReader<ChunkData> & Disposable;
113
+ error: (reason: unknown) => void;
120
114
  };
121
115
  isEmpty: () => boolean;
122
116
  cancelAll: (reason: unknown) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/stream/jsonl.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,2BAA2B,CAAC,UAAU,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CACA,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GACjC,yBAAyB,CAAC;CAC9B,CAAC;AAOF,QAAA,MAAM,wBAAwB,IAAI,CAAC;AACnC,KAAK,wBAAwB,GAAG,OAAO,wBAAwB,CAAC;AAChE,QAAA,MAAM,+BAA+B,IAAI,CAAC;AAC1C,KAAK,+BAA+B,GAAG,OAAO,+BAA+B,CAAC;AAE9E,QAAA,MAAM,wBAAwB,IAAI,CAAC;AACnC,KAAK,wBAAwB,GAAG,OAAO,wBAAwB,CAAC;AAChE,QAAA,MAAM,uBAAuB,IAAI,CAAC;AAClC,KAAK,uBAAuB,GAAG,OAAO,uBAAuB,CAAC;AAE9D,QAAA,MAAM,4BAA4B,IAAI,CAAC;AACvC,KAAK,4BAA4B,GAAG,OAAO,4BAA4B,CAAC;AACxE,QAAA,MAAM,2BAA2B,IAAI,CAAC;AACtC,KAAK,2BAA2B,GAAG,OAAO,2BAA2B,CAAC;AACtE,QAAA,MAAM,2BAA2B,IAAI,CAAC;AACtC,KAAK,2BAA2B,GAAG,OAAO,2BAA2B,CAAC;AAEtE,KAAK,kBAAkB,GAEnB,IAAI,GAEJ,MAAM,GAEN,MAAM,CAAC;AAEX,KAAK,UAAU,GAAG,MAAM,GAAG;IAAE,YAAY,EAAE,IAAI,CAAA;CAAE,C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SAAS,CAAA;KAAE,KAAK,OAAO,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsJD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,+CA+B7D;AAOD,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,CAAC;AAsLjE;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE;IACrD,IAAI,EAAE,yBAAyB,GAAG,sBAAsB,CAAC;IACzD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC;IAClD;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;CAClC;2BAtC+B,UAAU;qBA9CvB,SAAS;;;;wBAmBN,OAAO;;;wBAuCA,OAAO;IAgJnC"}
@@ -322,15 +322,6 @@ async function* createBatchStreamProducer(opts) {
322
322
  }
323
323
  })).pipeThrough(new TextEncoderStream());
324
324
  }
325
- class StreamInterruptedError extends Error {
326
- constructor(cause){
327
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
328
- // @ts-ignore https://github.com/tc39/proposal-error-cause
329
- super('Invalid response or stream interrupted', {
330
- cause
331
- });
332
- }
333
- }
334
325
  class AsyncError extends Error {
335
326
  constructor(data){
336
327
  super('Received error from server'), _define_property(this, "data", void 0), this.data = data;
@@ -420,17 +411,7 @@ function createConsumerStream(from) {
420
411
  enqueue: (v)=>originalController.enqueue(v),
421
412
  close: ()=>{
422
413
  originalController.close();
423
- // mark as closed and remove methods
424
- Object.assign(streamController, {
425
- closed: true,
426
- close: ()=>{
427
- // noop
428
- },
429
- enqueue: ()=>{
430
- // noop
431
- },
432
- getReaderResource: null
433
- });
414
+ clear();
434
415
  if (isEmpty()) {
435
416
  abortController.abort();
436
417
  }
@@ -442,8 +423,27 @@ function createConsumerStream(from) {
442
423
  reader.releaseLock();
443
424
  streamController.close();
444
425
  });
426
+ },
427
+ error: (reason)=>{
428
+ originalController.error(reason);
429
+ clear();
445
430
  }
446
431
  };
432
+ function clear() {
433
+ Object.assign(streamController, {
434
+ closed: true,
435
+ close: ()=>{
436
+ // noop
437
+ },
438
+ enqueue: ()=>{
439
+ // noop
440
+ },
441
+ getReaderResource: null,
442
+ error: ()=>{
443
+ // noop
444
+ }
445
+ });
446
+ }
447
447
  return streamController;
448
448
  }
449
449
  /**
@@ -459,10 +459,8 @@ function createConsumerStream(from) {
459
459
  /**
460
460
  * Cancels all pending controllers and rejects deferred promises
461
461
  */ function cancelAll(reason) {
462
- const error = new StreamInterruptedError(reason);
463
462
  for (const controller of controllerMap.values()){
464
- controller.enqueue(error);
465
- controller.close();
463
+ controller.error(reason);
466
464
  }
467
465
  }
468
466
  return {
@@ -502,9 +500,6 @@ function createConsumerStream(from) {
502
500
  const reader = _ts_add_disposable_resource(env, controller.getReaderResource(), false);
503
501
  ;
504
502
  const { value } = await reader.read();
505
- if (value instanceof StreamInterruptedError) {
506
- throw value;
507
- }
508
503
  const [_chunkId, status, data] = value;
509
504
  switch(status){
510
505
  case PROMISE_STATUS_FULFILLED:
@@ -535,9 +530,6 @@ function createConsumerStream(from) {
535
530
  ;
536
531
  while(true){
537
532
  const { value } = await reader.read();
538
- if (value instanceof StreamInterruptedError) {
539
- throw value;
540
- }
541
533
  const [_chunkId, status, data] = value;
542
534
  switch(status){
543
535
  case ASYNC_ITERABLE_STATUS_YIELD:
@@ -574,9 +566,8 @@ function createConsumerStream(from) {
574
566
  return data;
575
567
  }
576
568
  const closeOrAbort = (reason)=>{
577
- const error = new StreamInterruptedError(reason);
578
- headDeferred?.reject(error);
579
- streamManager.cancelAll(error);
569
+ headDeferred?.reject(reason);
570
+ streamManager.cancelAll(reason);
580
571
  };
581
572
  source.pipeTo(new WritableStream({
582
573
  write (chunkOrHead) {
@@ -595,7 +586,7 @@ function createConsumerStream(from) {
595
586
  const controller = streamManager.getOrCreate(idx);
596
587
  controller.enqueue(chunk);
597
588
  },
598
- close: closeOrAbort,
589
+ close: ()=>closeOrAbort(new Error('Stream closed')),
599
590
  abort: closeOrAbort
600
591
  }), {
601
592
  signal: opts.abortController.signal
@@ -320,15 +320,6 @@ async function* createBatchStreamProducer(opts) {
320
320
  }
321
321
  })).pipeThrough(new TextEncoderStream());
322
322
  }
323
- class StreamInterruptedError extends Error {
324
- constructor(cause){
325
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
326
- // @ts-ignore https://github.com/tc39/proposal-error-cause
327
- super('Invalid response or stream interrupted', {
328
- cause
329
- });
330
- }
331
- }
332
323
  class AsyncError extends Error {
333
324
  constructor(data){
334
325
  super('Received error from server'), _define_property(this, "data", void 0), this.data = data;
@@ -418,17 +409,7 @@ function createConsumerStream(from) {
418
409
  enqueue: (v)=>originalController.enqueue(v),
419
410
  close: ()=>{
420
411
  originalController.close();
421
- // mark as closed and remove methods
422
- Object.assign(streamController, {
423
- closed: true,
424
- close: ()=>{
425
- // noop
426
- },
427
- enqueue: ()=>{
428
- // noop
429
- },
430
- getReaderResource: null
431
- });
412
+ clear();
432
413
  if (isEmpty()) {
433
414
  abortController.abort();
434
415
  }
@@ -440,8 +421,27 @@ function createConsumerStream(from) {
440
421
  reader.releaseLock();
441
422
  streamController.close();
442
423
  });
424
+ },
425
+ error: (reason)=>{
426
+ originalController.error(reason);
427
+ clear();
443
428
  }
444
429
  };
430
+ function clear() {
431
+ Object.assign(streamController, {
432
+ closed: true,
433
+ close: ()=>{
434
+ // noop
435
+ },
436
+ enqueue: ()=>{
437
+ // noop
438
+ },
439
+ getReaderResource: null,
440
+ error: ()=>{
441
+ // noop
442
+ }
443
+ });
444
+ }
445
445
  return streamController;
446
446
  }
447
447
  /**
@@ -457,10 +457,8 @@ function createConsumerStream(from) {
457
457
  /**
458
458
  * Cancels all pending controllers and rejects deferred promises
459
459
  */ function cancelAll(reason) {
460
- const error = new StreamInterruptedError(reason);
461
460
  for (const controller of controllerMap.values()){
462
- controller.enqueue(error);
463
- controller.close();
461
+ controller.error(reason);
464
462
  }
465
463
  }
466
464
  return {
@@ -500,9 +498,6 @@ function createConsumerStream(from) {
500
498
  const reader = _ts_add_disposable_resource(env, controller.getReaderResource(), false);
501
499
  ;
502
500
  const { value } = await reader.read();
503
- if (value instanceof StreamInterruptedError) {
504
- throw value;
505
- }
506
501
  const [_chunkId, status, data] = value;
507
502
  switch(status){
508
503
  case PROMISE_STATUS_FULFILLED:
@@ -533,9 +528,6 @@ function createConsumerStream(from) {
533
528
  ;
534
529
  while(true){
535
530
  const { value } = await reader.read();
536
- if (value instanceof StreamInterruptedError) {
537
- throw value;
538
- }
539
531
  const [_chunkId, status, data] = value;
540
532
  switch(status){
541
533
  case ASYNC_ITERABLE_STATUS_YIELD:
@@ -572,9 +564,8 @@ function createConsumerStream(from) {
572
564
  return data;
573
565
  }
574
566
  const closeOrAbort = (reason)=>{
575
- const error = new StreamInterruptedError(reason);
576
- headDeferred?.reject(error);
577
- streamManager.cancelAll(error);
567
+ headDeferred?.reject(reason);
568
+ streamManager.cancelAll(reason);
578
569
  };
579
570
  source.pipeTo(new WritableStream({
580
571
  write (chunkOrHead) {
@@ -593,7 +584,7 @@ function createConsumerStream(from) {
593
584
  const controller = streamManager.getOrCreate(idx);
594
585
  controller.enqueue(chunk);
595
586
  },
596
- close: closeOrAbort,
587
+ close: ()=>closeOrAbort(new Error('Stream closed')),
597
588
  abort: closeOrAbort
598
589
  }), {
599
590
  signal: opts.abortController.signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.746+6c15b0575",
3
+ "version": "11.0.0-rc.747+64714681c",
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": "6c15b0575d18179ddf964d89d8295aabad39f2cc"
155
+ "gitHead": "64714681ca127cd859a819d61ce8a990b928baf9"
156
156
  }
@@ -309,13 +309,6 @@ export function jsonlStreamProducer(opts: JSONLProducerOptions) {
309
309
  .pipeThrough(new TextEncoderStream());
310
310
  }
311
311
 
312
- class StreamInterruptedError extends Error {
313
- constructor(cause?: unknown) {
314
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
315
- // @ts-ignore https://github.com/tc39/proposal-error-cause
316
- super('Invalid response or stream interrupted', { cause });
317
- }
318
- }
319
312
  class AsyncError extends Error {
320
313
  constructor(public readonly data: unknown) {
321
314
  super('Received error from server');
@@ -403,10 +396,6 @@ function createConsumerStream<THead>(
403
396
  }),
404
397
  );
405
398
  }
406
- /**
407
- * Represents a chunk of data or stream interruption error that can be enqueued to a controller
408
- */
409
- type ControllerChunk = ChunkData | StreamInterruptedError;
410
399
 
411
400
  /**
412
401
  * Creates a handler for managing stream controllers and their lifecycle
@@ -428,29 +417,19 @@ function createStreamsManager(abortController: AbortController) {
428
417
  * Creates a stream controller
429
418
  */
430
419
  function createStreamController() {
431
- let originalController: ReadableStreamDefaultController<ControllerChunk>;
432
- const stream = new ReadableStream<ControllerChunk>({
420
+ let originalController: ReadableStreamDefaultController<ChunkData>;
421
+ const stream = new ReadableStream<ChunkData>({
433
422
  start(controller) {
434
423
  originalController = controller;
435
424
  },
436
425
  });
437
426
 
438
427
  const streamController = {
439
- enqueue: (v: ControllerChunk) => originalController.enqueue(v),
428
+ enqueue: (v: ChunkData) => originalController.enqueue(v),
440
429
  close: () => {
441
430
  originalController.close();
442
431
 
443
- // mark as closed and remove methods
444
- Object.assign(streamController, {
445
- closed: true,
446
- close: () => {
447
- // noop
448
- },
449
- enqueue: () => {
450
- // noop
451
- },
452
- getReaderResource: null,
453
- });
432
+ clear();
454
433
 
455
434
  if (isEmpty()) {
456
435
  abortController.abort();
@@ -465,7 +444,26 @@ function createStreamsManager(abortController: AbortController) {
465
444
  streamController.close();
466
445
  });
467
446
  },
447
+ error: (reason: unknown) => {
448
+ originalController.error(reason);
449
+ clear();
450
+ },
468
451
  };
452
+ function clear() {
453
+ Object.assign(streamController, {
454
+ closed: true,
455
+ close: () => {
456
+ // noop
457
+ },
458
+ enqueue: () => {
459
+ // noop
460
+ },
461
+ getReaderResource: null,
462
+ error: () => {
463
+ // noop
464
+ },
465
+ });
466
+ }
469
467
 
470
468
  return streamController;
471
469
  }
@@ -486,10 +484,8 @@ function createStreamsManager(abortController: AbortController) {
486
484
  * Cancels all pending controllers and rejects deferred promises
487
485
  */
488
486
  function cancelAll(reason: unknown) {
489
- const error = new StreamInterruptedError(reason);
490
487
  for (const controller of controllerMap.values()) {
491
- controller.enqueue(error);
492
- controller.close();
488
+ controller.error(reason);
493
489
  }
494
490
  }
495
491
 
@@ -541,9 +537,6 @@ export async function jsonlStreamConsumer<THead>(opts: {
541
537
  using reader = controller.getReaderResource();
542
538
 
543
539
  const { value } = await reader.read();
544
- if (value instanceof StreamInterruptedError) {
545
- throw value;
546
- }
547
540
  const [_chunkId, status, data] = value as PromiseChunk;
548
541
  switch (status) {
549
542
  case PROMISE_STATUS_FULFILLED:
@@ -559,9 +552,6 @@ export async function jsonlStreamConsumer<THead>(opts: {
559
552
 
560
553
  while (true) {
561
554
  const { value } = await reader.read();
562
- if (value instanceof StreamInterruptedError) {
563
- throw value;
564
- }
565
555
 
566
556
  const [_chunkId, status, data] = value as IterableChunk;
567
557
 
@@ -598,11 +588,9 @@ export async function jsonlStreamConsumer<THead>(opts: {
598
588
  return data;
599
589
  }
600
590
 
601
- const closeOrAbort = (reason?: unknown) => {
602
- const error = new StreamInterruptedError(reason);
603
-
604
- headDeferred?.reject(error);
605
- streamManager.cancelAll(error);
591
+ const closeOrAbort = (reason: unknown) => {
592
+ headDeferred?.reject(reason);
593
+ streamManager.cancelAll(reason);
606
594
  };
607
595
  source
608
596
  .pipeTo(
@@ -626,7 +614,7 @@ export async function jsonlStreamConsumer<THead>(opts: {
626
614
  const controller = streamManager.getOrCreate(idx);
627
615
  controller.enqueue(chunk);
628
616
  },
629
- close: closeOrAbort,
617
+ close: () => closeOrAbort(new Error('Stream closed')),
630
618
  abort: closeOrAbort,
631
619
  }),
632
620
  {