@trpc/server 11.0.0-rc.745 → 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": 195513,
3
- "bundleOrigSize": 226893,
4
- "bundleReduction": 13.83,
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": 20609,
23
- "origSize": 17588,
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.54,
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
  {
@@ -292,7 +292,7 @@
292
292
  "/src/unstable-core-do-not-import/initTRPC.ts",
293
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
  {
@@ -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
  {
@@ -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
  {
@@ -877,9 +877,9 @@
877
877
  "reduction": 100
878
878
  },
879
879
  {
880
- "id": "/src/shared.ts",
880
+ "id": "/src/rpc.ts",
881
881
  "size": 0,
882
- "origSize": 653,
882
+ "origSize": 36,
883
883
  "renderedExports": [],
884
884
  "removedExports": [],
885
885
  "dependents": [],
@@ -887,9 +887,9 @@
887
887
  "reduction": 100
888
888
  },
889
889
  {
890
- "id": "/src/rpc.ts",
890
+ "id": "/src/shared.ts",
891
891
  "size": 0,
892
- "origSize": 36,
892
+ "origSize": 653,
893
893
  "renderedExports": [],
894
894
  "removedExports": [],
895
895
  "dependents": [],
@@ -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"
@@ -963,10 +963,10 @@
963
963
  "renderedExports": [],
964
964
  "removedExports": [],
965
965
  "dependents": [
966
- "/src/adapters/express.ts",
967
966
  "/src/adapters/next.ts",
968
- "/src/adapters/standalone.ts",
967
+ "/src/adapters/express.ts",
969
968
  "/src/adapters/ws.ts",
969
+ "/src/adapters/standalone.ts",
970
970
  "/src/adapters/fastify/fastifyRequestHandler.ts"
971
971
  ],
972
972
  "percent": 0,
@@ -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;AAKF,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,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
+ function isPlainObject(value) {
90
+ return Object.prototype.toString.call(value) === '[object Object]';
91
+ }
90
92
  // ---------- types
91
93
  const CHUNK_VALUE_TYPE_PROMISE = 0;
92
94
  const CHUNK_VALUE_TYPE_ASYNC_ITERABLE = 1;
@@ -235,13 +237,6 @@ async function* createBatchStreamProducer(opts) {
235
237
  []
236
238
  ];
237
239
  }
238
- if (!utils.isObject(value)) {
239
- return [
240
- [
241
- value
242
- ]
243
- ];
244
- }
245
240
  const reg = encodeAsync(value, path);
246
241
  if (reg) {
247
242
  return [
@@ -254,7 +249,7 @@ async function* createBatchStreamProducer(opts) {
254
249
  ]
255
250
  ];
256
251
  }
257
- if (Object.prototype.toString.call(value) !== '[object Object]') {
252
+ if (!isPlainObject(value)) {
258
253
  return [
259
254
  [
260
255
  value
@@ -327,15 +322,6 @@ async function* createBatchStreamProducer(opts) {
327
322
  }
328
323
  })).pipeThrough(new TextEncoderStream());
329
324
  }
330
- class StreamInterruptedError extends Error {
331
- constructor(cause){
332
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
333
- // @ts-ignore https://github.com/tc39/proposal-error-cause
334
- super('Invalid response or stream interrupted', {
335
- cause
336
- });
337
- }
338
- }
339
325
  class AsyncError extends Error {
340
326
  constructor(data){
341
327
  super('Received error from server'), _define_property(this, "data", void 0), this.data = data;
@@ -425,17 +411,7 @@ function createConsumerStream(from) {
425
411
  enqueue: (v)=>originalController.enqueue(v),
426
412
  close: ()=>{
427
413
  originalController.close();
428
- // mark as closed and remove methods
429
- Object.assign(streamController, {
430
- closed: true,
431
- close: ()=>{
432
- // noop
433
- },
434
- enqueue: ()=>{
435
- // noop
436
- },
437
- getReaderResource: null
438
- });
414
+ clear();
439
415
  if (isEmpty()) {
440
416
  abortController.abort();
441
417
  }
@@ -447,8 +423,27 @@ function createConsumerStream(from) {
447
423
  reader.releaseLock();
448
424
  streamController.close();
449
425
  });
426
+ },
427
+ error: (reason)=>{
428
+ originalController.error(reason);
429
+ clear();
450
430
  }
451
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
+ }
452
447
  return streamController;
453
448
  }
454
449
  /**
@@ -464,10 +459,8 @@ function createConsumerStream(from) {
464
459
  /**
465
460
  * Cancels all pending controllers and rejects deferred promises
466
461
  */ function cancelAll(reason) {
467
- const error = new StreamInterruptedError(reason);
468
462
  for (const controller of controllerMap.values()){
469
- controller.enqueue(error);
470
- controller.close();
463
+ controller.error(reason);
471
464
  }
472
465
  }
473
466
  return {
@@ -507,9 +500,6 @@ function createConsumerStream(from) {
507
500
  const reader = _ts_add_disposable_resource(env, controller.getReaderResource(), false);
508
501
  ;
509
502
  const { value } = await reader.read();
510
- if (value instanceof StreamInterruptedError) {
511
- throw value;
512
- }
513
503
  const [_chunkId, status, data] = value;
514
504
  switch(status){
515
505
  case PROMISE_STATUS_FULFILLED:
@@ -540,9 +530,6 @@ function createConsumerStream(from) {
540
530
  ;
541
531
  while(true){
542
532
  const { value } = await reader.read();
543
- if (value instanceof StreamInterruptedError) {
544
- throw value;
545
- }
546
533
  const [_chunkId, status, data] = value;
547
534
  switch(status){
548
535
  case ASYNC_ITERABLE_STATUS_YIELD:
@@ -579,9 +566,8 @@ function createConsumerStream(from) {
579
566
  return data;
580
567
  }
581
568
  const closeOrAbort = (reason)=>{
582
- const error = new StreamInterruptedError(reason);
583
- headDeferred?.reject(error);
584
- streamManager.cancelAll(error);
569
+ headDeferred?.reject(reason);
570
+ streamManager.cancelAll(reason);
585
571
  };
586
572
  source.pipeTo(new WritableStream({
587
573
  write (chunkOrHead) {
@@ -600,7 +586,7 @@ function createConsumerStream(from) {
600
586
  const controller = streamManager.getOrCreate(idx);
601
587
  controller.enqueue(chunk);
602
588
  },
603
- close: closeOrAbort,
589
+ close: ()=>closeOrAbort(new Error('Stream closed')),
604
590
  abort: closeOrAbort
605
591
  }), {
606
592
  signal: opts.abortController.signal
@@ -84,7 +84,9 @@ function _ts_dispose_resources(env) {
84
84
  return next();
85
85
  })(env);
86
86
  }
87
- // ---------- types
87
+ function isPlainObject(value) {
88
+ return Object.prototype.toString.call(value) === '[object Object]';
89
+ }
88
90
  // ---------- types
89
91
  const CHUNK_VALUE_TYPE_PROMISE = 0;
90
92
  const CHUNK_VALUE_TYPE_ASYNC_ITERABLE = 1;
@@ -233,13 +235,6 @@ async function* createBatchStreamProducer(opts) {
233
235
  []
234
236
  ];
235
237
  }
236
- if (!isObject(value)) {
237
- return [
238
- [
239
- value
240
- ]
241
- ];
242
- }
243
238
  const reg = encodeAsync(value, path);
244
239
  if (reg) {
245
240
  return [
@@ -252,7 +247,7 @@ async function* createBatchStreamProducer(opts) {
252
247
  ]
253
248
  ];
254
249
  }
255
- if (Object.prototype.toString.call(value) !== '[object Object]') {
250
+ if (!isPlainObject(value)) {
256
251
  return [
257
252
  [
258
253
  value
@@ -325,15 +320,6 @@ async function* createBatchStreamProducer(opts) {
325
320
  }
326
321
  })).pipeThrough(new TextEncoderStream());
327
322
  }
328
- class StreamInterruptedError extends Error {
329
- constructor(cause){
330
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
331
- // @ts-ignore https://github.com/tc39/proposal-error-cause
332
- super('Invalid response or stream interrupted', {
333
- cause
334
- });
335
- }
336
- }
337
323
  class AsyncError extends Error {
338
324
  constructor(data){
339
325
  super('Received error from server'), _define_property(this, "data", void 0), this.data = data;
@@ -423,17 +409,7 @@ function createConsumerStream(from) {
423
409
  enqueue: (v)=>originalController.enqueue(v),
424
410
  close: ()=>{
425
411
  originalController.close();
426
- // mark as closed and remove methods
427
- Object.assign(streamController, {
428
- closed: true,
429
- close: ()=>{
430
- // noop
431
- },
432
- enqueue: ()=>{
433
- // noop
434
- },
435
- getReaderResource: null
436
- });
412
+ clear();
437
413
  if (isEmpty()) {
438
414
  abortController.abort();
439
415
  }
@@ -445,8 +421,27 @@ function createConsumerStream(from) {
445
421
  reader.releaseLock();
446
422
  streamController.close();
447
423
  });
424
+ },
425
+ error: (reason)=>{
426
+ originalController.error(reason);
427
+ clear();
448
428
  }
449
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
+ }
450
445
  return streamController;
451
446
  }
452
447
  /**
@@ -462,10 +457,8 @@ function createConsumerStream(from) {
462
457
  /**
463
458
  * Cancels all pending controllers and rejects deferred promises
464
459
  */ function cancelAll(reason) {
465
- const error = new StreamInterruptedError(reason);
466
460
  for (const controller of controllerMap.values()){
467
- controller.enqueue(error);
468
- controller.close();
461
+ controller.error(reason);
469
462
  }
470
463
  }
471
464
  return {
@@ -505,9 +498,6 @@ function createConsumerStream(from) {
505
498
  const reader = _ts_add_disposable_resource(env, controller.getReaderResource(), false);
506
499
  ;
507
500
  const { value } = await reader.read();
508
- if (value instanceof StreamInterruptedError) {
509
- throw value;
510
- }
511
501
  const [_chunkId, status, data] = value;
512
502
  switch(status){
513
503
  case PROMISE_STATUS_FULFILLED:
@@ -538,9 +528,6 @@ function createConsumerStream(from) {
538
528
  ;
539
529
  while(true){
540
530
  const { value } = await reader.read();
541
- if (value instanceof StreamInterruptedError) {
542
- throw value;
543
- }
544
531
  const [_chunkId, status, data] = value;
545
532
  switch(status){
546
533
  case ASYNC_ITERABLE_STATUS_YIELD:
@@ -577,9 +564,8 @@ function createConsumerStream(from) {
577
564
  return data;
578
565
  }
579
566
  const closeOrAbort = (reason)=>{
580
- const error = new StreamInterruptedError(reason);
581
- headDeferred?.reject(error);
582
- streamManager.cancelAll(error);
567
+ headDeferred?.reject(reason);
568
+ streamManager.cancelAll(reason);
583
569
  };
584
570
  source.pipeTo(new WritableStream({
585
571
  write (chunkOrHead) {
@@ -598,7 +584,7 @@ function createConsumerStream(from) {
598
584
  const controller = streamManager.getOrCreate(idx);
599
585
  controller.enqueue(chunk);
600
586
  },
601
- close: closeOrAbort,
587
+ close: ()=>closeOrAbort(new Error('Stream closed')),
602
588
  abort: closeOrAbort
603
589
  }), {
604
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.745+6ab0f06e2",
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": "6ab0f06e288b19b2d40ff0fe483c15365a7699f0"
155
+ "gitHead": "64714681ca127cd859a819d61ce8a990b928baf9"
156
156
  }
@@ -22,7 +22,9 @@ export type NodeJSReadableStreamEsque = {
22
22
  ): NodeJSReadableStreamEsque;
23
23
  };
24
24
 
25
- // ---------- types
25
+ function isPlainObject(value: unknown): value is Record<string, unknown> {
26
+ return Object.prototype.toString.call(value) === '[object Object]';
27
+ }
26
28
 
27
29
  // ---------- types
28
30
  const CHUNK_VALUE_TYPE_PROMISE = 0;
@@ -230,19 +232,16 @@ async function* createBatchStreamProducer(
230
232
  if (value === undefined) {
231
233
  return [[]];
232
234
  }
233
- if (!isObject(value)) {
234
- return [[value]];
235
- }
236
-
237
235
  const reg = encodeAsync(value, path);
238
236
  if (reg) {
239
237
  return [[placeholder], [null, ...reg]];
240
238
  }
241
239
 
242
- if (Object.prototype.toString.call(value) !== '[object Object]') {
240
+ if (!isPlainObject(value)) {
243
241
  return [[value]];
244
242
  }
245
- const newObj = {} as Record<string, unknown>;
243
+
244
+ const newObj: Record<string, unknown> = {};
246
245
  const asyncValues: ChunkDefinition[] = [];
247
246
  for (const [key, item] of Object.entries(value)) {
248
247
  const transformed = encodeAsync(item, [...path, key]);
@@ -263,7 +262,7 @@ async function* createBatchStreamProducer(
263
262
 
264
263
  yield newHead;
265
264
 
266
- let iterable: AsyncIterable<Head | ChunkData | typeof PING_SYM, void> =
265
+ let iterable: AsyncIterable<ChunkData | typeof PING_SYM, void> =
267
266
  mergedIterables;
268
267
  if (opts.pingMs) {
269
268
  iterable = withPing(mergedIterables, opts.pingMs);
@@ -310,13 +309,6 @@ export function jsonlStreamProducer(opts: JSONLProducerOptions) {
310
309
  .pipeThrough(new TextEncoderStream());
311
310
  }
312
311
 
313
- class StreamInterruptedError extends Error {
314
- constructor(cause?: unknown) {
315
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
316
- // @ts-ignore https://github.com/tc39/proposal-error-cause
317
- super('Invalid response or stream interrupted', { cause });
318
- }
319
- }
320
312
  class AsyncError extends Error {
321
313
  constructor(public readonly data: unknown) {
322
314
  super('Received error from server');
@@ -404,10 +396,6 @@ function createConsumerStream<THead>(
404
396
  }),
405
397
  );
406
398
  }
407
- /**
408
- * Represents a chunk of data or stream interruption error that can be enqueued to a controller
409
- */
410
- type ControllerChunk = ChunkData | StreamInterruptedError;
411
399
 
412
400
  /**
413
401
  * Creates a handler for managing stream controllers and their lifecycle
@@ -429,29 +417,19 @@ function createStreamsManager(abortController: AbortController) {
429
417
  * Creates a stream controller
430
418
  */
431
419
  function createStreamController() {
432
- let originalController: ReadableStreamDefaultController<ControllerChunk>;
433
- const stream = new ReadableStream<ControllerChunk>({
420
+ let originalController: ReadableStreamDefaultController<ChunkData>;
421
+ const stream = new ReadableStream<ChunkData>({
434
422
  start(controller) {
435
423
  originalController = controller;
436
424
  },
437
425
  });
438
426
 
439
427
  const streamController = {
440
- enqueue: (v: ControllerChunk) => originalController.enqueue(v),
428
+ enqueue: (v: ChunkData) => originalController.enqueue(v),
441
429
  close: () => {
442
430
  originalController.close();
443
431
 
444
- // mark as closed and remove methods
445
- Object.assign(streamController, {
446
- closed: true,
447
- close: () => {
448
- // noop
449
- },
450
- enqueue: () => {
451
- // noop
452
- },
453
- getReaderResource: null,
454
- });
432
+ clear();
455
433
 
456
434
  if (isEmpty()) {
457
435
  abortController.abort();
@@ -466,7 +444,26 @@ function createStreamsManager(abortController: AbortController) {
466
444
  streamController.close();
467
445
  });
468
446
  },
447
+ error: (reason: unknown) => {
448
+ originalController.error(reason);
449
+ clear();
450
+ },
469
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
+ }
470
467
 
471
468
  return streamController;
472
469
  }
@@ -487,10 +484,8 @@ function createStreamsManager(abortController: AbortController) {
487
484
  * Cancels all pending controllers and rejects deferred promises
488
485
  */
489
486
  function cancelAll(reason: unknown) {
490
- const error = new StreamInterruptedError(reason);
491
487
  for (const controller of controllerMap.values()) {
492
- controller.enqueue(error);
493
- controller.close();
488
+ controller.error(reason);
494
489
  }
495
490
  }
496
491
 
@@ -542,9 +537,6 @@ export async function jsonlStreamConsumer<THead>(opts: {
542
537
  using reader = controller.getReaderResource();
543
538
 
544
539
  const { value } = await reader.read();
545
- if (value instanceof StreamInterruptedError) {
546
- throw value;
547
- }
548
540
  const [_chunkId, status, data] = value as PromiseChunk;
549
541
  switch (status) {
550
542
  case PROMISE_STATUS_FULFILLED:
@@ -560,9 +552,6 @@ export async function jsonlStreamConsumer<THead>(opts: {
560
552
 
561
553
  while (true) {
562
554
  const { value } = await reader.read();
563
- if (value instanceof StreamInterruptedError) {
564
- throw value;
565
- }
566
555
 
567
556
  const [_chunkId, status, data] = value as IterableChunk;
568
557
 
@@ -599,11 +588,9 @@ export async function jsonlStreamConsumer<THead>(opts: {
599
588
  return data;
600
589
  }
601
590
 
602
- const closeOrAbort = (reason?: unknown) => {
603
- const error = new StreamInterruptedError(reason);
604
-
605
- headDeferred?.reject(error);
606
- streamManager.cancelAll(error);
591
+ const closeOrAbort = (reason: unknown) => {
592
+ headDeferred?.reject(reason);
593
+ streamManager.cancelAll(reason);
607
594
  };
608
595
  source
609
596
  .pipeTo(
@@ -627,7 +614,7 @@ export async function jsonlStreamConsumer<THead>(opts: {
627
614
  const controller = streamManager.getOrCreate(idx);
628
615
  controller.enqueue(chunk);
629
616
  },
630
- close: closeOrAbort,
617
+ close: () => closeOrAbort(new Error('Stream closed')),
631
618
  abort: closeOrAbort,
632
619
  }),
633
620
  {