@trpc/server 11.0.0-rc.480 → 11.0.0-rc.485

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 +1 @@
1
- {"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7E,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,sBAAsB,CAC1C,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,EAClC,IAAI,EAAE,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,iBAwElE"}
1
+ {"version":3,"file":"nodeHTTPRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7E,OAAO,KAAK,EACV,eAAe,EACf,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,sBAAsB,CAC1C,OAAO,SAAS,SAAS,EACzB,QAAQ,SAAS,eAAe,EAChC,SAAS,SAAS,gBAAgB,EAClC,IAAI,EAAE,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,iBA4ElE"}
@@ -71,6 +71,8 @@ async function nodeHTTPRequestHandler(opts) {
71
71
  res.once('drain', resolve);
72
72
  });
73
73
  }
74
+ // useful for debugging chunked responses:
75
+ // console.log('wrote', Buffer.from(value).toString());
74
76
  // IMPORTANT - flush the response buffer, otherwise the client will not receive the data until `.end()`
75
77
  res.flush?.();
76
78
  }
@@ -69,6 +69,8 @@ async function nodeHTTPRequestHandler(opts) {
69
69
  res.once('drain', resolve);
70
70
  });
71
71
  }
72
+ // useful for debugging chunked responses:
73
+ // console.log('wrote', Buffer.from(value).toString());
72
74
  // IMPORTANT - flush the response buffer, otherwise the client will not receive the data until `.end()`
73
75
  res.flush?.();
74
76
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 135062,
3
- "bundleOrigSize": 183958,
4
- "bundleReduction": 26.58,
2
+ "bundleSize": 135515,
3
+ "bundleOrigSize": 184418,
4
+ "bundleReduction": 26.52,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -14,13 +14,13 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 13.15,
17
+ "percent": 13.11,
18
18
  "reduction": 0
19
19
  },
20
20
  {
21
21
  "id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
22
- "size": 17400,
23
- "origSize": 18243,
22
+ "size": 17567,
23
+ "origSize": 18359,
24
24
  "renderedExports": [
25
25
  "isPromise",
26
26
  "jsonlStreamProducer",
@@ -31,8 +31,8 @@
31
31
  "/src/unstable-core-do-not-import.ts",
32
32
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
33
33
  ],
34
- "percent": 12.88,
35
- "reduction": 4.62
34
+ "percent": 12.96,
35
+ "reduction": 4.31
36
36
  },
37
37
  {
38
38
  "id": "/src/adapters/ws.ts",
@@ -47,7 +47,7 @@
47
47
  "dependents": [
48
48
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
49
49
  ],
50
- "percent": 11.65,
50
+ "percent": 11.61,
51
51
  "reduction": 0
52
52
  },
53
53
  {
@@ -62,7 +62,7 @@
62
62
  "/src/unstable-core-do-not-import.ts",
63
63
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
64
64
  ],
65
- "percent": 5.69,
65
+ "percent": 5.67,
66
66
  "reduction": 0
67
67
  },
68
68
  {
@@ -80,7 +80,7 @@
80
80
  "/src/unstable-core-do-not-import.ts",
81
81
  "/src/unstable-core-do-not-import/initTRPC.ts"
82
82
  ],
83
- "percent": 4.72,
83
+ "percent": 4.71,
84
84
  "reduction": 39.77
85
85
  },
86
86
  {
@@ -95,7 +95,7 @@
95
95
  "/src/unstable-core-do-not-import.ts",
96
96
  "/src/unstable-core-do-not-import/initTRPC.ts"
97
97
  ],
98
- "percent": 4.68,
98
+ "percent": 4.67,
99
99
  "reduction": 60.09
100
100
  },
101
101
  {
@@ -112,7 +112,7 @@
112
112
  "/src/unstable-core-do-not-import.ts",
113
113
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
114
114
  ],
115
- "percent": 4.38,
115
+ "percent": 4.36,
116
116
  "reduction": 15.22
117
117
  },
118
118
  {
@@ -126,7 +126,7 @@
126
126
  "dependents": [
127
127
  "/src/adapters/aws-lambda/index.ts"
128
128
  ],
129
- "percent": 4.01,
129
+ "percent": 4,
130
130
  "reduction": 11.38
131
131
  },
132
132
  {
@@ -146,7 +146,7 @@
146
146
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
147
147
  "/src/observable/operators.ts"
148
148
  ],
149
- "percent": 3.05,
149
+ "percent": 3.04,
150
150
  "reduction": 0
151
151
  },
152
152
  {
@@ -160,9 +160,23 @@
160
160
  "dependents": [
161
161
  "/src/adapters/next-app-dir.ts"
162
162
  ],
163
- "percent": 2.32,
163
+ "percent": 2.31,
164
164
  "reduction": 23.5
165
165
  },
166
+ {
167
+ "id": "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
168
+ "size": 2863,
169
+ "origSize": 3048,
170
+ "renderedExports": [
171
+ "nodeHTTPRequestHandler"
172
+ ],
173
+ "removedExports": [],
174
+ "dependents": [
175
+ "/src/adapters/node-http/index.ts"
176
+ ],
177
+ "percent": 2.11,
178
+ "reduction": 6.07
179
+ },
166
180
  {
167
181
  "id": "/src/observable/operators.ts",
168
182
  "size": 2756,
@@ -176,7 +190,7 @@
176
190
  "dependents": [
177
191
  "/src/observable/index.ts"
178
192
  ],
179
- "percent": 2.04,
193
+ "percent": 2.03,
180
194
  "reduction": 0
181
195
  },
182
196
  {
@@ -196,22 +210,8 @@
196
210
  "/src/unstable-core-do-not-import/initTRPC.ts",
197
211
  "/src/unstable-core-do-not-import/router.ts"
198
212
  ],
199
- "percent": 2.03,
200
- "reduction": 45.94
201
- },
202
- {
203
- "id": "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
204
- "size": 2732,
205
- "origSize": 2931,
206
- "renderedExports": [
207
- "nodeHTTPRequestHandler"
208
- ],
209
- "removedExports": [],
210
- "dependents": [
211
- "/src/adapters/node-http/index.ts"
212
- ],
213
213
  "percent": 2.02,
214
- "reduction": 6.79
214
+ "reduction": 45.94
215
215
  },
216
216
  {
217
217
  "id": "/src/unstable-core-do-not-import/initTRPC.ts",
@@ -244,7 +244,7 @@
244
244
  "/src/unstable-core-do-not-import/initTRPC.ts",
245
245
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
246
246
  ],
247
- "percent": 1.95,
247
+ "percent": 1.94,
248
248
  "reduction": 55.5
249
249
  },
250
250
  {
@@ -274,7 +274,7 @@
274
274
  "dependents": [
275
275
  "/src/adapters/fetch/index.ts"
276
276
  ],
277
- "percent": 1.67,
277
+ "percent": 1.66,
278
278
  "reduction": 2.17
279
279
  },
280
280
  {
@@ -303,7 +303,7 @@
303
303
  "dependents": [
304
304
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
305
305
  ],
306
- "percent": 1.52,
306
+ "percent": 1.51,
307
307
  "reduction": 5.79
308
308
  },
309
309
  {
@@ -317,7 +317,7 @@
317
317
  "dependents": [
318
318
  "/src/adapters/fastify/index.ts"
319
319
  ],
320
- "percent": 1.32,
320
+ "percent": 1.31,
321
321
  "reduction": 29.88
322
322
  },
323
323
  {
@@ -353,7 +353,7 @@
353
353
  ],
354
354
  "removedExports": [],
355
355
  "dependents": [],
356
- "percent": 1.26,
356
+ "percent": 1.25,
357
357
  "reduction": 19.29
358
358
  },
359
359
  {
@@ -427,7 +427,7 @@
427
427
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
428
428
  "/src/unstable-core-do-not-import/stream/sse.ts"
429
429
  ],
430
- "percent": 0.89,
430
+ "percent": 0.88,
431
431
  "reduction": 28.12
432
432
  },
433
433
  {
@@ -458,7 +458,7 @@
458
458
  "/src/unstable-core-do-not-import.ts",
459
459
  "/src/unstable-core-do-not-import/http/contentType.ts"
460
460
  ],
461
- "percent": 0.82,
461
+ "percent": 0.81,
462
462
  "reduction": 15.08
463
463
  },
464
464
  {
@@ -487,7 +487,7 @@
487
487
  "/src/unstable-core-do-not-import.ts",
488
488
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
489
489
  ],
490
- "percent": 0.77,
490
+ "percent": 0.76,
491
491
  "reduction": 58.57
492
492
  },
493
493
  {
@@ -554,6 +554,22 @@
554
554
  "percent": 0.56,
555
555
  "reduction": 66.9
556
556
  },
557
+ {
558
+ "id": "/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts",
559
+ "size": 730,
560
+ "origSize": 921,
561
+ "renderedExports": [
562
+ "createReadableStream",
563
+ "isCancelledStreamResult"
564
+ ],
565
+ "removedExports": [],
566
+ "dependents": [
567
+ "/src/unstable-core-do-not-import/stream/jsonl.ts",
568
+ "/src/unstable-core-do-not-import/stream/sse.ts"
569
+ ],
570
+ "percent": 0.54,
571
+ "reduction": 20.74
572
+ },
557
573
  {
558
574
  "id": "/src/unstable-core-do-not-import/http/batchStreamFormatter.ts",
559
575
  "size": 667,
@@ -583,21 +599,6 @@
583
599
  "percent": 0.46,
584
600
  "reduction": 43.49
585
601
  },
586
- {
587
- "id": "/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts",
588
- "size": 575,
589
- "origSize": 694,
590
- "renderedExports": [
591
- "createReadableStream"
592
- ],
593
- "removedExports": [],
594
- "dependents": [
595
- "/src/unstable-core-do-not-import/stream/jsonl.ts",
596
- "/src/unstable-core-do-not-import/stream/sse.ts"
597
- ],
598
- "percent": 0.43,
599
- "reduction": 17.15
600
- },
601
602
  {
602
603
  "id": "/src/adapters/standalone.ts",
603
604
  "size": 520,
@@ -608,7 +609,7 @@
608
609
  ],
609
610
  "removedExports": [],
610
611
  "dependents": [],
611
- "percent": 0.39,
612
+ "percent": 0.38,
612
613
  "reduction": 67.09
613
614
  },
614
615
  {
@@ -649,7 +650,7 @@
649
650
  "dependents": [
650
651
  "/src/unstable-core-do-not-import.ts"
651
652
  ],
652
- "percent": 0.21,
653
+ "percent": 0.2,
653
654
  "reduction": 68.45
654
655
  },
655
656
  {
@@ -747,6 +748,16 @@
747
748
  "percent": 0,
748
749
  "reduction": 100
749
750
  },
751
+ {
752
+ "id": "/src/shared.ts",
753
+ "size": 0,
754
+ "origSize": 653,
755
+ "renderedExports": [],
756
+ "removedExports": [],
757
+ "dependents": [],
758
+ "percent": 0,
759
+ "reduction": 100
760
+ },
750
761
  {
751
762
  "id": "/src/rpc.ts",
752
763
  "size": 0,
@@ -770,16 +781,6 @@
770
781
  "percent": 0,
771
782
  "reduction": 100
772
783
  },
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
- },
783
784
  {
784
785
  "id": "/src/adapters/next-app-dir.ts",
785
786
  "size": 0,
@@ -35,7 +35,7 @@ type ChunkDefinition = [
35
35
  type DehydratedValue = [
36
36
  [
37
37
  unknown
38
- ],
38
+ ] | [],
39
39
  ...ChunkDefinition[]
40
40
  ];
41
41
  type PromiseChunk = [
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/stream/jsonl.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,2BAA2B,CAAC,UAAU,CAAC,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C,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,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;CACzC;;;kBAmBa,OAAO;;IA6MpB"}
@@ -48,7 +48,7 @@ function createBatchStreamProducer(opts) {
48
48
  promise,
49
49
  stream.cancelledPromise
50
50
  ]).then((it)=>{
51
- if (it === null) {
51
+ if (createReadableStream.isCancelledStreamResult(it)) {
52
52
  return;
53
53
  }
54
54
  stream.controller.enqueue([
@@ -108,7 +108,7 @@ function createBatchStreamProducer(opts) {
108
108
  ]);
109
109
  return;
110
110
  }
111
- if (next === 'cancelled') {
111
+ if (createReadableStream.isCancelledStreamResult(next)) {
112
112
  await iterator.return?.();
113
113
  break;
114
114
  }
@@ -147,7 +147,7 @@ function createBatchStreamProducer(opts) {
147
147
  }
148
148
  return null;
149
149
  }
150
- function dehydrateChunk(value, path) {
150
+ function dehydrateAsync(value, path) {
151
151
  if (isPromise(value)) {
152
152
  return [
153
153
  CHUNK_VALUE_TYPE_PROMISE,
@@ -166,7 +166,19 @@ function createBatchStreamProducer(opts) {
166
166
  return null;
167
167
  }
168
168
  function dehydrate(value, path) {
169
- const reg = dehydrateChunk(value, path);
169
+ if (value === undefined) {
170
+ return [
171
+ []
172
+ ];
173
+ }
174
+ if (!utils.isObject(value)) {
175
+ return [
176
+ [
177
+ value
178
+ ]
179
+ ];
180
+ }
181
+ const reg = dehydrateAsync(value, path);
170
182
  if (reg) {
171
183
  return [
172
184
  [
@@ -178,17 +190,10 @@ function createBatchStreamProducer(opts) {
178
190
  ]
179
191
  ];
180
192
  }
181
- if (!utils.isObject(value)) {
182
- return [
183
- [
184
- value
185
- ]
186
- ];
187
- }
188
193
  const newObj = {};
189
194
  const asyncValues = [];
190
195
  for (const [key, item] of Object.entries(value)){
191
- const transformed = dehydrateChunk(item, [
196
+ const transformed = dehydrateAsync(item, [
192
197
  ...path,
193
198
  key
194
199
  ]);
@@ -1,7 +1,7 @@
1
1
  import { getTRPCErrorFromUnknown } from '../error/TRPCError.mjs';
2
2
  import { isObject, isFunction, isAsyncIterable, run } from '../utils.mjs';
3
3
  import { createDeferred } from './utils/createDeferred.mjs';
4
- import { createReadableStream } from './utils/createReadableStream.mjs';
4
+ import { createReadableStream, isCancelledStreamResult } from './utils/createReadableStream.mjs';
5
5
 
6
6
  // ---------- types
7
7
  const CHUNK_VALUE_TYPE_PROMISE = 0;
@@ -46,7 +46,7 @@ function createBatchStreamProducer(opts) {
46
46
  promise,
47
47
  stream.cancelledPromise
48
48
  ]).then((it)=>{
49
- if (it === null) {
49
+ if (isCancelledStreamResult(it)) {
50
50
  return;
51
51
  }
52
52
  stream.controller.enqueue([
@@ -106,7 +106,7 @@ function createBatchStreamProducer(opts) {
106
106
  ]);
107
107
  return;
108
108
  }
109
- if (next === 'cancelled') {
109
+ if (isCancelledStreamResult(next)) {
110
110
  await iterator.return?.();
111
111
  break;
112
112
  }
@@ -145,7 +145,7 @@ function createBatchStreamProducer(opts) {
145
145
  }
146
146
  return null;
147
147
  }
148
- function dehydrateChunk(value, path) {
148
+ function dehydrateAsync(value, path) {
149
149
  if (isPromise(value)) {
150
150
  return [
151
151
  CHUNK_VALUE_TYPE_PROMISE,
@@ -164,7 +164,19 @@ function createBatchStreamProducer(opts) {
164
164
  return null;
165
165
  }
166
166
  function dehydrate(value, path) {
167
- const reg = dehydrateChunk(value, path);
167
+ if (value === undefined) {
168
+ return [
169
+ []
170
+ ];
171
+ }
172
+ if (!isObject(value)) {
173
+ return [
174
+ [
175
+ value
176
+ ]
177
+ ];
178
+ }
179
+ const reg = dehydrateAsync(value, path);
168
180
  if (reg) {
169
181
  return [
170
182
  [
@@ -176,17 +188,10 @@ function createBatchStreamProducer(opts) {
176
188
  ]
177
189
  ];
178
190
  }
179
- if (!isObject(value)) {
180
- return [
181
- [
182
- value
183
- ]
184
- ];
185
- }
186
191
  const newObj = {};
187
192
  const asyncValues = [];
188
193
  for (const [key, item] of Object.entries(value)){
189
- const transformed = dehydrateChunk(item, [
194
+ const transformed = dehydrateAsync(item, [
190
195
  ...path,
191
196
  key
192
197
  ]);
@@ -1,10 +1,13 @@
1
+ declare const cancelledStreamSymbol: unique symbol;
1
2
  /**
2
3
  * One-off readable stream
3
4
  */
4
5
  export declare function createReadableStream<TValue = unknown>(): {
5
6
  readonly readable: ReadableStream<TValue>;
6
7
  readonly controller: ReadableStreamDefaultController<TValue>;
7
- readonly cancelledPromise: Promise<"cancelled">;
8
+ readonly cancelledPromise: Promise<typeof cancelledStreamSymbol>;
8
9
  readonly cancelled: () => boolean;
9
10
  };
11
+ export declare function isCancelledStreamResult(v: unknown): v is typeof cancelledStreamSymbol;
12
+ export {};
10
13
  //# sourceMappingURL=createReadableStream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createReadableStream.d.ts","sourceRoot":"","sources":["../../../../src/unstable-core-do-not-import/stream/utils/createReadableStream.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,GAAG,OAAO;;;;;EAwBpD"}
1
+ {"version":3,"file":"createReadableStream.d.ts","sourceRoot":"","sources":["../../../../src/unstable-core-do-not-import/stream/utils/createReadableStream.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,qBAAqB,eAAoC,CAAC;AAChE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,GAAG,OAAO;;;;;EAwBpD;AACD,wBAAgB,uBAAuB,CACrC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI,OAAO,qBAAqB,CAEnC"}
@@ -3,6 +3,7 @@
3
3
  var createDeferred = require('./createDeferred.js');
4
4
 
5
5
  // ---------- utils
6
+ const cancelledStreamSymbol = Symbol('cancelledReadableStream');
6
7
  /**
7
8
  * One-off readable stream
8
9
  */ function createReadableStream() {
@@ -14,7 +15,7 @@ var createDeferred = require('./createDeferred.js');
14
15
  controller = c;
15
16
  },
16
17
  cancel () {
17
- deferred.resolve('cancelled');
18
+ deferred.resolve(cancelledStreamSymbol);
18
19
  cancelled = true;
19
20
  }
20
21
  });
@@ -27,5 +28,9 @@ var createDeferred = require('./createDeferred.js');
27
28
  }
28
29
  };
29
30
  }
31
+ function isCancelledStreamResult(v) {
32
+ return v === cancelledStreamSymbol;
33
+ }
30
34
 
31
35
  exports.createReadableStream = createReadableStream;
36
+ exports.isCancelledStreamResult = isCancelledStreamResult;
@@ -1,6 +1,7 @@
1
1
  import { createDeferred } from './createDeferred.mjs';
2
2
 
3
3
  // ---------- utils
4
+ const cancelledStreamSymbol = Symbol('cancelledReadableStream');
4
5
  /**
5
6
  * One-off readable stream
6
7
  */ function createReadableStream() {
@@ -12,7 +13,7 @@ import { createDeferred } from './createDeferred.mjs';
12
13
  controller = c;
13
14
  },
14
15
  cancel () {
15
- deferred.resolve('cancelled');
16
+ deferred.resolve(cancelledStreamSymbol);
16
17
  cancelled = true;
17
18
  }
18
19
  });
@@ -25,5 +26,8 @@ import { createDeferred } from './createDeferred.mjs';
25
26
  }
26
27
  };
27
28
  }
29
+ function isCancelledStreamResult(v) {
30
+ return v === cancelledStreamSymbol;
31
+ }
28
32
 
29
- export { createReadableStream };
33
+ export { createReadableStream, isCancelledStreamResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.480+6dc84d9eb",
3
+ "version": "11.0.0-rc.485+1c1d824cd",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -141,7 +141,7 @@
141
141
  "tslib": "^2.5.0",
142
142
  "tsx": "^4.0.0",
143
143
  "typescript": "^5.5.3",
144
- "valibot": "^0.37.0",
144
+ "valibot": "^0.38.0",
145
145
  "ws": "^8.0.0",
146
146
  "yup": "^1.0.0",
147
147
  "zod": "^3.0.0"
@@ -149,5 +149,5 @@
149
149
  "funding": [
150
150
  "https://trpc.io/sponsor"
151
151
  ],
152
- "gitHead": "6dc84d9ebef60539d4e835c17aff9ee22cbf204b"
152
+ "gitHead": "1c1d824cd61bb00bf115c91010147f11fe026154"
153
153
  }
@@ -89,6 +89,10 @@ export async function nodeHTTPRequestHandler<
89
89
  res.once('drain', resolve);
90
90
  });
91
91
  }
92
+
93
+ // useful for debugging chunked responses:
94
+ // console.log('wrote', Buffer.from(value).toString());
95
+
92
96
  // IMPORTANT - flush the response buffer, otherwise the client will not receive the data until `.end()`
93
97
  res.flush?.();
94
98
  }
@@ -2,7 +2,10 @@ import { getTRPCErrorFromUnknown } from '../error/TRPCError';
2
2
  import { isAsyncIterable, isFunction, isObject, run } from '../utils';
3
3
  import type { Deferred } from './utils/createDeferred';
4
4
  import { createDeferred } from './utils/createDeferred';
5
- import { createReadableStream } from './utils/createReadableStream';
5
+ import {
6
+ createReadableStream,
7
+ isCancelledStreamResult,
8
+ } from './utils/createReadableStream';
6
9
 
7
10
  /**
8
11
  * A subset of the standard ReadableStream properties needed by tRPC internally.
@@ -56,7 +59,7 @@ type ChunkDefinition = [
56
59
  ];
57
60
  type DehydratedValue = [
58
61
  // data
59
- [unknown],
62
+ [unknown] | [],
60
63
  // chunk descriptions
61
64
  ...ChunkDefinition[],
62
65
  ];
@@ -147,7 +150,7 @@ function createBatchStreamProducer(opts: ProducerOptions) {
147
150
 
148
151
  Promise.race([promise, stream.cancelledPromise])
149
152
  .then((it) => {
150
- if (it === null) {
153
+ if (isCancelledStreamResult(it)) {
151
154
  return;
152
155
  }
153
156
  stream.controller.enqueue([
@@ -203,7 +206,7 @@ function createBatchStreamProducer(opts: ProducerOptions) {
203
206
  ]);
204
207
  return;
205
208
  }
206
- if (next === 'cancelled') {
209
+ if (isCancelledStreamResult(next)) {
207
210
  await iterator.return?.();
208
211
  break;
209
212
  }
@@ -246,7 +249,7 @@ function createBatchStreamProducer(opts: ProducerOptions) {
246
249
  }
247
250
  return null;
248
251
  }
249
- function dehydrateChunk(
252
+ function dehydrateAsync(
250
253
  value: unknown,
251
254
  path: (string | number)[],
252
255
  ): null | [type: ChunkValueType, chunkId: ChunkIndex] {
@@ -268,17 +271,20 @@ function createBatchStreamProducer(opts: ProducerOptions) {
268
271
  value: unknown,
269
272
  path: (string | number)[],
270
273
  ): DehydratedValue {
271
- const reg = dehydrateChunk(value, path);
272
- if (reg) {
273
- return [[placeholder], [null, ...reg]];
274
+ if (value === undefined) {
275
+ return [[]];
274
276
  }
275
277
  if (!isObject(value)) {
276
278
  return [[value]];
277
279
  }
280
+ const reg = dehydrateAsync(value, path);
281
+ if (reg) {
282
+ return [[placeholder], [null, ...reg]];
283
+ }
278
284
  const newObj = {} as Record<string, unknown>;
279
285
  const asyncValues: ChunkDefinition[] = [];
280
286
  for (const [key, item] of Object.entries(value)) {
281
- const transformed = dehydrateChunk(item, [...path, key]);
287
+ const transformed = dehydrateAsync(item, [...path, key]);
282
288
  if (!transformed) {
283
289
  newObj[key] = item;
284
290
  continue;
@@ -1,6 +1,8 @@
1
1
  import { createDeferred } from './createDeferred';
2
2
 
3
3
  // ---------- utils
4
+
5
+ const cancelledStreamSymbol = Symbol('cancelledReadableStream');
4
6
  /**
5
7
  * One-off readable stream
6
8
  */
@@ -8,14 +10,14 @@ export function createReadableStream<TValue = unknown>() {
8
10
  let controller: ReadableStreamDefaultController<TValue> =
9
11
  null as unknown as ReadableStreamDefaultController<TValue>;
10
12
 
11
- const deferred = createDeferred<'cancelled'>();
13
+ const deferred = createDeferred<typeof cancelledStreamSymbol>();
12
14
  let cancelled = false;
13
15
  const readable = new ReadableStream<TValue>({
14
16
  start(c) {
15
17
  controller = c;
16
18
  },
17
19
  cancel() {
18
- deferred.resolve('cancelled');
20
+ deferred.resolve(cancelledStreamSymbol);
19
21
  cancelled = true;
20
22
  },
21
23
  });
@@ -29,3 +31,8 @@ export function createReadableStream<TValue = unknown>() {
29
31
  },
30
32
  } as const;
31
33
  }
34
+ export function isCancelledStreamResult(
35
+ v: unknown,
36
+ ): v is typeof cancelledStreamSymbol {
37
+ return v === cancelledStreamSymbol;
38
+ }