@trpc/server 11.0.0-rc.643 → 11.0.0-rc.645

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.
Files changed (43) hide show
  1. package/dist/adapters/node-http/writeResponse.d.ts.map +1 -1
  2. package/dist/adapters/node-http/writeResponse.js +2 -0
  3. package/dist/adapters/node-http/writeResponse.mjs +2 -0
  4. package/dist/adapters/ws.js +1 -1
  5. package/dist/adapters/ws.mjs +1 -1
  6. package/dist/bundle-analysis.json +73 -87
  7. package/dist/observable/observable.d.ts +1 -1
  8. package/dist/observable/observable.d.ts.map +1 -1
  9. package/dist/observable/observable.js +16 -4
  10. package/dist/observable/observable.mjs +16 -4
  11. package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
  12. package/dist/unstable-core-do-not-import/http/resolveResponse.js +4 -9
  13. package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +5 -10
  14. package/dist/unstable-core-do-not-import/stream/jsonl.d.ts +41 -4
  15. package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +1 -1
  16. package/dist/unstable-core-do-not-import/stream/jsonl.js +223 -213
  17. package/dist/unstable-core-do-not-import/stream/jsonl.mjs +224 -214
  18. package/dist/unstable-core-do-not-import/stream/sse.d.ts +1 -1
  19. package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +1 -1
  20. package/dist/unstable-core-do-not-import/stream/sse.js +46 -54
  21. package/dist/unstable-core-do-not-import/stream/sse.mjs +47 -55
  22. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts +8 -0
  23. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.d.ts.map +1 -0
  24. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.js +25 -0
  25. package/dist/unstable-core-do-not-import/stream/utils/readableStreamFrom.mjs +23 -0
  26. package/package.json +2 -2
  27. package/src/adapters/node-http/writeResponse.ts +3 -0
  28. package/src/adapters/ws.ts +1 -1
  29. package/src/observable/observable.ts +17 -2
  30. package/src/unstable-core-do-not-import/http/resolveResponse.ts +5 -12
  31. package/src/unstable-core-do-not-import/stream/jsonl.ts +271 -226
  32. package/src/unstable-core-do-not-import/stream/sse.ts +59 -64
  33. package/src/unstable-core-do-not-import/stream/utils/readableStreamFrom.ts +28 -0
  34. package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.d.ts +0 -9
  35. package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.d.ts.map +0 -1
  36. package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.js +0 -25
  37. package/dist/unstable-core-do-not-import/stream/utils/createReadableStream.mjs +0 -23
  38. package/dist/unstable-core-do-not-import/stream/utils/withRefCount.d.ts +0 -17
  39. package/dist/unstable-core-do-not-import/stream/utils/withRefCount.d.ts.map +0 -1
  40. package/dist/unstable-core-do-not-import/stream/utils/withRefCount.js +0 -59
  41. package/dist/unstable-core-do-not-import/stream/utils/withRefCount.mjs +0 -57
  42. package/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts +0 -25
  43. package/src/unstable-core-do-not-import/stream/utils/withRefCount.ts +0 -93
@@ -1 +1 @@
1
- {"version":3,"file":"writeResponse.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/writeResponse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyBhD;;GAEG;AAEH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,iBAoBA;AACD;;GAEG;AAEH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,iBA0BA"}
1
+ {"version":3,"file":"writeResponse.d.ts","sourceRoot":"","sources":["../../../src/adapters/node-http/writeResponse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA4BhD;;GAEG;AAEH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,gBAAgB,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,iBAoBA;AACD;;GAEG;AAEH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,iBA0BA"}
@@ -7,6 +7,8 @@ require('../../unstable-core-do-not-import/rootConfig.js');
7
7
 
8
8
  // eslint-disable-next-line no-restricted-imports
9
9
  async function writeResponseBodyChunk(res, chunk) {
10
+ // useful for debugging 🙃
11
+ // console.debug('writing', new TextDecoder().decode(chunk));
10
12
  if (res.write(chunk) === false) {
11
13
  await new Promise((resolve, reject)=>{
12
14
  const onError = (err)=>{
@@ -5,6 +5,8 @@ import '../../unstable-core-do-not-import/rootConfig.mjs';
5
5
 
6
6
  // eslint-disable-next-line no-restricted-imports
7
7
  async function writeResponseBodyChunk(res, chunk) {
8
+ // useful for debugging 🙃
9
+ // console.debug('writing', new TextDecoder().decode(chunk));
8
10
  if (res.write(chunk) === false) {
9
11
  await new Promise((resolve, reject)=>{
10
12
  const onError = (err)=>{
@@ -157,7 +157,7 @@ function getWSConnectionHandler(opts) {
157
157
  code: 'BAD_REQUEST'
158
158
  });
159
159
  }
160
- const iterable = observable.isObservable(result) ? observable.observableToAsyncIterable(result) : result;
160
+ const iterable = observable.isObservable(result) ? observable.observableToAsyncIterable(result, abortController.signal) : result;
161
161
  const iterator = iterable[Symbol.asyncIterator]();
162
162
  const abortPromise = new Promise((resolve)=>{
163
163
  abortController.signal.onabort = ()=>resolve('abort');
@@ -155,7 +155,7 @@ function getWSConnectionHandler(opts) {
155
155
  code: 'BAD_REQUEST'
156
156
  });
157
157
  }
158
- const iterable = isObservable(result) ? observableToAsyncIterable(result) : result;
158
+ const iterable = isObservable(result) ? observableToAsyncIterable(result, abortController.signal) : result;
159
159
  const iterator = iterable[Symbol.asyncIterator]();
160
160
  const abortPromise = new Promise((resolve)=>{
161
161
  abortController.signal.onabort = ()=>resolve('abort');
@@ -1,12 +1,12 @@
1
1
  {
2
- "bundleSize": 168625,
3
- "bundleOrigSize": 220104,
4
- "bundleReduction": 23.39,
2
+ "bundleSize": 167183,
3
+ "bundleOrigSize": 218853,
4
+ "bundleReduction": 23.61,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
8
- "size": 21420,
9
- "origSize": 19724,
8
+ "size": 21241,
9
+ "origSize": 19585,
10
10
  "renderedExports": [
11
11
  "resolveResponse"
12
12
  ],
@@ -14,13 +14,13 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 12.7,
17
+ "percent": 12.71,
18
18
  "reduction": 0
19
19
  },
20
20
  {
21
21
  "id": "/src/adapters/ws.ts",
22
- "size": 16774,
23
- "origSize": 15828,
22
+ "size": 16798,
23
+ "origSize": 15852,
24
24
  "renderedExports": [
25
25
  "getWSConnectionHandler",
26
26
  "handleKeepAlive",
@@ -30,13 +30,13 @@
30
30
  "dependents": [
31
31
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
32
32
  ],
33
- "percent": 9.95,
33
+ "percent": 10.05,
34
34
  "reduction": 0
35
35
  },
36
36
  {
37
37
  "id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
38
- "size": 16412,
39
- "origSize": 17477,
38
+ "size": 16710,
39
+ "origSize": 18547,
40
40
  "renderedExports": [
41
41
  "isPromise",
42
42
  "jsonlStreamProducer",
@@ -47,8 +47,8 @@
47
47
  "/src/unstable-core-do-not-import.ts",
48
48
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
49
49
  ],
50
- "percent": 9.73,
51
- "reduction": 6.09
50
+ "percent": 10,
51
+ "reduction": 9.9
52
52
  },
53
53
  {
54
54
  "id": "/src/vendor/unpromise/unpromise.ts",
@@ -60,13 +60,13 @@
60
60
  ],
61
61
  "removedExports": [],
62
62
  "dependents": [],
63
- "percent": 7,
63
+ "percent": 7.06,
64
64
  "reduction": 14.14
65
65
  },
66
66
  {
67
67
  "id": "/src/unstable-core-do-not-import/stream/sse.ts",
68
- "size": 10408,
69
- "origSize": 12991,
68
+ "size": 9990,
69
+ "origSize": 12782,
70
70
  "renderedExports": [
71
71
  "sseStreamProducer",
72
72
  "sseStreamConsumer",
@@ -77,8 +77,8 @@
77
77
  "/src/unstable-core-do-not-import.ts",
78
78
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
79
79
  ],
80
- "percent": 6.17,
81
- "reduction": 19.88
80
+ "percent": 5.98,
81
+ "reduction": 21.84
82
82
  },
83
83
  {
84
84
  "id": "/src/unstable-core-do-not-import/http/contentType.ts",
@@ -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.56,
95
+ "percent": 4.6,
96
96
  "reduction": 0
97
97
  },
98
98
  {
@@ -110,7 +110,7 @@
110
110
  "/src/unstable-core-do-not-import.ts",
111
111
  "/src/unstable-core-do-not-import/initTRPC.ts"
112
112
  ],
113
- "percent": 3.81,
113
+ "percent": 3.84,
114
114
  "reduction": 39.89
115
115
  },
116
116
  {
@@ -125,7 +125,7 @@
125
125
  "/src/unstable-core-do-not-import.ts",
126
126
  "/src/unstable-core-do-not-import/initTRPC.ts"
127
127
  ],
128
- "percent": 3.44,
128
+ "percent": 3.47,
129
129
  "reduction": 65.01
130
130
  },
131
131
  {
@@ -139,13 +139,13 @@
139
139
  "dependents": [
140
140
  "/src/adapters/aws-lambda/index.ts"
141
141
  ],
142
- "percent": 3.21,
142
+ "percent": 3.24,
143
143
  "reduction": 11.51
144
144
  },
145
145
  {
146
146
  "id": "/src/observable/observable.ts",
147
- "size": 4477,
148
- "origSize": 4352,
147
+ "size": 4836,
148
+ "origSize": 4660,
149
149
  "renderedExports": [
150
150
  "isObservable",
151
151
  "observable",
@@ -159,7 +159,7 @@
159
159
  "/src/observable/operators.ts",
160
160
  "/src/observable/behaviorSubject.ts"
161
161
  ],
162
- "percent": 2.66,
162
+ "percent": 2.89,
163
163
  "reduction": 0
164
164
  },
165
165
  {
@@ -177,7 +177,7 @@
177
177
  "dependents": [
178
178
  "/src/observable/index.ts"
179
179
  ],
180
- "percent": 2.32,
180
+ "percent": 2.34,
181
181
  "reduction": 1.66
182
182
  },
183
183
  {
@@ -193,7 +193,7 @@
193
193
  "/src/adapters/node-http/index.ts",
194
194
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
195
195
  ],
196
- "percent": 2.28,
196
+ "percent": 2.3,
197
197
  "reduction": 11.87
198
198
  },
199
199
  {
@@ -207,7 +207,7 @@
207
207
  "dependents": [
208
208
  "/src/adapters/next-app-dir.ts"
209
209
  ],
210
- "percent": 1.92,
210
+ "percent": 1.94,
211
211
  "reduction": 22.52
212
212
  },
213
213
  {
@@ -222,7 +222,7 @@
222
222
  "dependents": [
223
223
  "/src/adapters/node-http/index.ts"
224
224
  ],
225
- "percent": 1.63,
225
+ "percent": 1.64,
226
226
  "reduction": 16.3
227
227
  },
228
228
  {
@@ -242,7 +242,7 @@
242
242
  "/src/unstable-core-do-not-import/initTRPC.ts",
243
243
  "/src/unstable-core-do-not-import/router.ts"
244
244
  ],
245
- "percent": 1.62,
245
+ "percent": 1.64,
246
246
  "reduction": 45.98
247
247
  },
248
248
  {
@@ -256,7 +256,7 @@
256
256
  "dependents": [
257
257
  "/src/unstable-core-do-not-import.ts"
258
258
  ],
259
- "percent": 1.58,
259
+ "percent": 1.59,
260
260
  "reduction": 40.81
261
261
  },
262
262
  {
@@ -276,7 +276,7 @@
276
276
  "/src/unstable-core-do-not-import/initTRPC.ts",
277
277
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
278
278
  ],
279
- "percent": 1.56,
279
+ "percent": 1.57,
280
280
  "reduction": 55.79
281
281
  },
282
282
  {
@@ -291,7 +291,7 @@
291
291
  "dependents": [
292
292
  "/src/unstable-core-do-not-import/stream/sse.ts"
293
293
  ],
294
- "percent": 1.5,
294
+ "percent": 1.52,
295
295
  "reduction": 2.91
296
296
  },
297
297
  {
@@ -329,7 +329,7 @@
329
329
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
330
330
  "/src/unstable-core-do-not-import/stream/sse.ts"
331
331
  ],
332
- "percent": 1.46,
332
+ "percent": 1.47,
333
333
  "reduction": 17.51
334
334
  },
335
335
  {
@@ -345,7 +345,7 @@
345
345
  "/src/unstable-core-do-not-import.ts",
346
346
  "/src/unstable-core-do-not-import/router.ts"
347
347
  ],
348
- "percent": 1.38,
348
+ "percent": 1.4,
349
349
  "reduction": 0
350
350
  },
351
351
  {
@@ -359,7 +359,7 @@
359
359
  "dependents": [
360
360
  "/src/adapters/fetch/index.ts"
361
361
  ],
362
- "percent": 1.33,
362
+ "percent": 1.34,
363
363
  "reduction": 2.48
364
364
  },
365
365
  {
@@ -373,7 +373,7 @@
373
373
  "dependents": [
374
374
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
375
375
  ],
376
- "percent": 1.26,
376
+ "percent": 1.27,
377
377
  "reduction": 5.4
378
378
  },
379
379
  {
@@ -394,7 +394,7 @@
394
394
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
395
395
  "/src/unstable-core-do-not-import/error/getErrorShape.ts"
396
396
  ],
397
- "percent": 1.24,
397
+ "percent": 1.25,
398
398
  "reduction": 18.54
399
399
  },
400
400
  {
@@ -417,13 +417,13 @@
417
417
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
418
418
  "/src/unstable-core-do-not-import/stream/sse.ts"
419
419
  ],
420
- "percent": 1.22,
420
+ "percent": 1.23,
421
421
  "reduction": 4.23
422
422
  },
423
423
  {
424
424
  "id": "/src/adapters/node-http/writeResponse.ts",
425
- "size": 1930,
426
- "origSize": 2011,
425
+ "size": 2027,
426
+ "origSize": 2105,
427
427
  "renderedExports": [
428
428
  "writeResponseBody",
429
429
  "writeResponse"
@@ -432,22 +432,8 @@
432
432
  "dependents": [
433
433
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
434
434
  ],
435
- "percent": 1.14,
436
- "reduction": 4.03
437
- },
438
- {
439
- "id": "/src/unstable-core-do-not-import/stream/utils/withRefCount.ts",
440
- "size": 1860,
441
- "origSize": 2564,
442
- "renderedExports": [
443
- "withRefCount"
444
- ],
445
- "removedExports": [],
446
- "dependents": [
447
- "/src/unstable-core-do-not-import/stream/jsonl.ts"
448
- ],
449
- "percent": 1.1,
450
- "reduction": 27.46
435
+ "percent": 1.21,
436
+ "reduction": 3.71
451
437
  },
452
438
  {
453
439
  "id": "/src/adapters/fastify/fastifyTRPCPlugin.ts",
@@ -460,7 +446,7 @@
460
446
  "dependents": [
461
447
  "/src/adapters/fastify/index.ts"
462
448
  ],
463
- "percent": 1.05,
449
+ "percent": 1.06,
464
450
  "reduction": 30.2
465
451
  },
466
452
  {
@@ -472,7 +458,7 @@
472
458
  ],
473
459
  "removedExports": [],
474
460
  "dependents": [],
475
- "percent": 1,
461
+ "percent": 1.01,
476
462
  "reduction": 19.62
477
463
  },
478
464
  {
@@ -512,7 +498,7 @@
512
498
  "/src/unstable-core-do-not-import.ts",
513
499
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
514
500
  ],
515
- "percent": 0.77,
501
+ "percent": 0.78,
516
502
  "reduction": 55.37
517
503
  },
518
504
  {
@@ -527,7 +513,7 @@
527
513
  "dependents": [
528
514
  "/src/unstable-core-do-not-import/stream/sse.ts"
529
515
  ],
530
- "percent": 0.69,
516
+ "percent": 0.7,
531
517
  "reduction": 9.9
532
518
  },
533
519
  {
@@ -542,7 +528,7 @@
542
528
  "/src/adapters/fastify/index.ts",
543
529
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
544
530
  ],
545
- "percent": 0.68,
531
+ "percent": 0.69,
546
532
  "reduction": 47.29
547
533
  },
548
534
  {
@@ -558,7 +544,7 @@
558
544
  "/src/unstable-core-do-not-import.ts",
559
545
  "/src/unstable-core-do-not-import/http/contentType.ts"
560
546
  ],
561
- "percent": 0.65,
547
+ "percent": 0.66,
562
548
  "reduction": 15.08
563
549
  },
564
550
  {
@@ -589,7 +575,7 @@
589
575
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
590
576
  "/src/adapters/next-app-dir/rethrowNextErrors.ts"
591
577
  ],
592
- "percent": 0.61,
578
+ "percent": 0.62,
593
579
  "reduction": 9.97
594
580
  },
595
581
  {
@@ -603,7 +589,7 @@
603
589
  "dependents": [
604
590
  "/src/observable/index.ts"
605
591
  ],
606
- "percent": 0.57,
592
+ "percent": 0.58,
607
593
  "reduction": 32.89
608
594
  },
609
595
  {
@@ -632,7 +618,7 @@
632
618
  "/src/unstable-core-do-not-import.ts",
633
619
  "/src/unstable-core-do-not-import/stream/sse.ts"
634
620
  ],
635
- "percent": 0.46,
621
+ "percent": 0.47,
636
622
  "reduction": 44.13
637
623
  },
638
624
  {
@@ -645,7 +631,7 @@
645
631
  ],
646
632
  "removedExports": [],
647
633
  "dependents": [],
648
- "percent": 0.45,
634
+ "percent": 0.46,
649
635
  "reduction": 56.66
650
636
  },
651
637
  {
@@ -660,6 +646,21 @@
660
646
  "percent": 0.45,
661
647
  "reduction": 66.61
662
648
  },
649
+ {
650
+ "id": "/src/unstable-core-do-not-import/stream/utils/readableStreamFrom.ts",
651
+ "size": 651,
652
+ "origSize": 660,
653
+ "renderedExports": [
654
+ "readableStreamFrom"
655
+ ],
656
+ "removedExports": [],
657
+ "dependents": [
658
+ "/src/unstable-core-do-not-import/stream/jsonl.ts",
659
+ "/src/unstable-core-do-not-import/stream/sse.ts"
660
+ ],
661
+ "percent": 0.39,
662
+ "reduction": 1.36
663
+ },
663
664
  {
664
665
  "id": "/src/unstable-core-do-not-import/stream/utils/timerResource.ts",
665
666
  "size": 646,
@@ -673,7 +674,7 @@
673
674
  "/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts",
674
675
  "/src/unstable-core-do-not-import/stream/utils/withPing.ts"
675
676
  ],
676
- "percent": 0.38,
677
+ "percent": 0.39,
677
678
  "reduction": 0
678
679
  },
679
680
  {
@@ -691,21 +692,6 @@
691
692
  "percent": 0.37,
692
693
  "reduction": 43.85
693
694
  },
694
- {
695
- "id": "/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts",
696
- "size": 414,
697
- "origSize": 495,
698
- "renderedExports": [
699
- "createReadableStream"
700
- ],
701
- "removedExports": [],
702
- "dependents": [
703
- "/src/unstable-core-do-not-import/stream/jsonl.ts",
704
- "/src/unstable-core-do-not-import/stream/sse.ts"
705
- ],
706
- "percent": 0.25,
707
- "reduction": 16.36
708
- },
709
695
  {
710
696
  "id": "/src/unstable-core-do-not-import/rootConfig.ts",
711
697
  "size": 343,
@@ -718,7 +704,7 @@
718
704
  "/src/unstable-core-do-not-import.ts",
719
705
  "/src/unstable-core-do-not-import/initTRPC.ts"
720
706
  ],
721
- "percent": 0.2,
707
+ "percent": 0.21,
722
708
  "reduction": 89.56
723
709
  },
724
710
  {
@@ -747,7 +733,7 @@
747
733
  "dependents": [
748
734
  "/src/unstable-core-do-not-import.ts"
749
735
  ],
750
- "percent": 0.16,
736
+ "percent": 0.17,
751
737
  "reduction": 68.45
752
738
  },
753
739
  {
@@ -764,7 +750,7 @@
764
750
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
765
751
  "/src/adapters/next-app-dir/redirect.ts"
766
752
  ],
767
- "percent": 0.13,
753
+ "percent": 0.14,
768
754
  "reduction": 13.36
769
755
  },
770
756
  {
@@ -946,5 +932,5 @@
946
932
  "reduction": 100
947
933
  }
948
934
  ],
949
- "moduleCount": 62
935
+ "moduleCount": 61
950
936
  }
@@ -8,5 +8,5 @@ export declare function observable<TValue, TError = unknown>(subscribe: (observe
8
8
  /** @internal */
9
9
  export declare function observableToPromise<TValue>(observable: Observable<TValue, unknown>): Promise<TValue>;
10
10
  /** @internal */
11
- export declare function observableToAsyncIterable<TValue>(observable: Observable<TValue, unknown>): AsyncIterable<TValue>;
11
+ export declare function observableToAsyncIterable<TValue>(observable: Observable<TValue, unknown>, signal: AbortSignal): AsyncIterable<TValue>;
12
12
  //# sourceMappingURL=observable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["../../src/observable/observable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EAER,aAAa,EAGd,MAAM,SAAS,CAAC;AAEjB,cAAc;AACd,MAAM,MAAM,oBAAoB,CAAC,WAAW,IAC1C,WAAW,SAAS,UAAU,CAAC,MAAM,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzE,cAAc;AACd,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAE1E;AAED,cAAc;AACd,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EACjD,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,aAAa,GAC/D,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CA6D5B;AAMD,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,mBA+BxC;AA8BD,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC,aAAa,CAAC,MAAM,CAAC,CAmCvB"}
1
+ {"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["../../src/observable/observable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EAER,aAAa,EAGd,MAAM,SAAS,CAAC;AAEjB,cAAc;AACd,MAAM,MAAM,oBAAoB,CAAC,WAAW,IAC1C,WAAW,SAAS,UAAU,CAAC,MAAM,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzE,cAAc;AACd,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAE1E;AAED,cAAc;AACd,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EACjD,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,aAAa,GAC/D,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CA6D5B;AAMD,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,mBA+BxC;AA4CD,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,MAAM,EAAE,WAAW,GAClB,aAAa,CAAC,MAAM,CAAC,CAmCvB"}
@@ -98,8 +98,13 @@ function pipeReducer(prev, fn) {
98
98
  }
99
99
  /**
100
100
  * @internal
101
- */ function observableToReadableStream(observable) {
101
+ */ function observableToReadableStream(observable, signal) {
102
102
  let unsub = null;
103
+ const onAbort = ()=>{
104
+ unsub?.unsubscribe();
105
+ unsub = null;
106
+ signal.removeEventListener('abort', onAbort);
107
+ };
103
108
  return new ReadableStream({
104
109
  start (controller) {
105
110
  unsub = observable.subscribe({
@@ -120,14 +125,21 @@ function pipeReducer(prev, fn) {
120
125
  controller.close();
121
126
  }
122
127
  });
128
+ if (signal.aborted) {
129
+ onAbort();
130
+ } else {
131
+ signal.addEventListener('abort', onAbort, {
132
+ once: true
133
+ });
134
+ }
123
135
  },
124
136
  cancel () {
125
- unsub?.unsubscribe();
137
+ onAbort();
126
138
  }
127
139
  });
128
140
  }
129
- /** @internal */ function observableToAsyncIterable(observable) {
130
- const stream = observableToReadableStream(observable);
141
+ /** @internal */ function observableToAsyncIterable(observable, signal) {
142
+ const stream = observableToReadableStream(observable, signal);
131
143
  const reader = stream.getReader();
132
144
  const iterator = {
133
145
  async next () {
@@ -96,8 +96,13 @@ function pipeReducer(prev, fn) {
96
96
  }
97
97
  /**
98
98
  * @internal
99
- */ function observableToReadableStream(observable) {
99
+ */ function observableToReadableStream(observable, signal) {
100
100
  let unsub = null;
101
+ const onAbort = ()=>{
102
+ unsub?.unsubscribe();
103
+ unsub = null;
104
+ signal.removeEventListener('abort', onAbort);
105
+ };
101
106
  return new ReadableStream({
102
107
  start (controller) {
103
108
  unsub = observable.subscribe({
@@ -118,14 +123,21 @@ function pipeReducer(prev, fn) {
118
123
  controller.close();
119
124
  }
120
125
  });
126
+ if (signal.aborted) {
127
+ onAbort();
128
+ } else {
129
+ signal.addEventListener('abort', onAbort, {
130
+ once: true
131
+ });
132
+ }
121
133
  },
122
134
  cancel () {
123
- unsub?.unsubscribe();
135
+ onAbort();
124
136
  }
125
137
  });
126
138
  }
127
- /** @internal */ function observableToAsyncIterable(observable) {
128
- const stream = observableToReadableStream(observable);
139
+ /** @internal */ function observableToAsyncIterable(observable, signal) {
140
+ const stream = observableToReadableStream(observable, signal);
129
141
  const reader = stream.getReader();
130
142
  const iterator = {
131
143
  async next () {
@@ -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;AAanB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AAqCjB,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;AA2ID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAufnB"}
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;AAqCjB,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;AA2ID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAqfnB"}
@@ -254,22 +254,17 @@ async function resolveResponse(opts) {
254
254
  });
255
255
  }
256
256
  }
257
- const abortCtrl = new AbortController();
258
257
  const data = await proc({
259
258
  path: call.path,
260
259
  getRawInput: call.getRawInput,
261
260
  ctx: ctxManager.value(),
262
261
  type: proc._def.type,
263
- signal: utils.abortSignalsAnyPonyfill([
264
- opts.req.signal,
265
- abortCtrl.signal
266
- ])
262
+ signal: opts.req.signal
267
263
  });
268
264
  return [
269
265
  undefined,
270
266
  {
271
- data,
272
- abortCtrl
267
+ data
273
268
  }
274
269
  ];
275
270
  } catch (cause) {
@@ -356,7 +351,7 @@ async function resolveResponse(opts) {
356
351
  code: 'INTERNAL_SERVER_ERROR'
357
352
  }));
358
353
  }
359
- const dataAsIterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data) : result.data;
354
+ const dataAsIterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data, opts.req.signal) : result.data;
360
355
  return dataAsIterable;
361
356
  });
362
357
  const stream = sse.sseStreamProducer({
@@ -450,7 +445,7 @@ async function resolveResponse(opts) {
450
445
  /**
451
446
  * Not very pretty, but we need to wrap nested data in promises
452
447
  * Our stream producer will only resolve top-level async values or async values that are directly nested in another async value
453
- */ const iterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data) : Promise.resolve(result.data);
448
+ */ const iterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data, opts.req.signal) : Promise.resolve(result.data);
454
449
  return {
455
450
  result: Promise.resolve({
456
451
  data: iterable