@trpc/server 11.0.0-rc.741 → 11.0.0-rc.743
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-analysis.json +67 -66
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +1 -0
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +1 -0
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +6 -0
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts +8 -2
- package/dist/unstable-core-do-not-import/stream/jsonl.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/stream/jsonl.js +16 -3
- package/dist/unstable-core-do-not-import/stream/jsonl.mjs +16 -3
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +1 -0
- package/src/unstable-core-do-not-import/rootConfig.ts +7 -0
- package/src/unstable-core-do-not-import/stream/jsonl.ts +28 -7
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 13.
|
|
2
|
+
"bundleSize": 195330,
|
|
3
|
+
"bundleOrigSize": 226680,
|
|
4
|
+
"bundleReduction": 13.83,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 21071,
|
|
9
|
+
"origSize": 19429,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"resolveResponse"
|
|
12
12
|
],
|
|
@@ -18,36 +18,36 @@
|
|
|
18
18
|
"reduction": 0
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
"id": "/src/
|
|
22
|
-
"size":
|
|
23
|
-
"origSize":
|
|
21
|
+
"id": "/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
22
|
+
"size": 20426,
|
|
23
|
+
"origSize": 17485,
|
|
24
24
|
"renderedExports": [
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"isPromise",
|
|
26
|
+
"jsonlStreamProducer",
|
|
27
|
+
"jsonlStreamConsumer"
|
|
28
28
|
],
|
|
29
29
|
"removedExports": [],
|
|
30
30
|
"dependents": [
|
|
31
|
-
"/src/
|
|
31
|
+
"/src/unstable-core-do-not-import.ts",
|
|
32
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
32
33
|
],
|
|
33
|
-
"percent": 10.
|
|
34
|
+
"percent": 10.46,
|
|
34
35
|
"reduction": 0
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
|
-
"id": "/src/
|
|
38
|
-
"size":
|
|
39
|
-
"origSize":
|
|
38
|
+
"id": "/src/adapters/ws.ts",
|
|
39
|
+
"size": 20168,
|
|
40
|
+
"origSize": 15955,
|
|
40
41
|
"renderedExports": [
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
42
|
+
"getWSConnectionHandler",
|
|
43
|
+
"handleKeepAlive",
|
|
44
|
+
"applyWSSHandler"
|
|
44
45
|
],
|
|
45
46
|
"removedExports": [],
|
|
46
47
|
"dependents": [
|
|
47
|
-
"/src/
|
|
48
|
-
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
48
|
+
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
49
49
|
],
|
|
50
|
-
"percent": 10.
|
|
50
|
+
"percent": 10.33,
|
|
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.
|
|
67
|
+
"percent": 6.46,
|
|
68
68
|
"reduction": 0
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
],
|
|
78
78
|
"removedExports": [],
|
|
79
79
|
"dependents": [],
|
|
80
|
-
"percent": 6.
|
|
80
|
+
"percent": 6.22,
|
|
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.
|
|
94
|
+
"percent": 4.16,
|
|
95
95
|
"reduction": 0
|
|
96
96
|
},
|
|
97
97
|
{
|
|
@@ -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.
|
|
127
|
+
"percent": 3.3,
|
|
128
128
|
"reduction": 39.41
|
|
129
129
|
},
|
|
130
130
|
{
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
144
144
|
"/src/unstable-core-do-not-import/stream/utils/withPing.ts"
|
|
145
145
|
],
|
|
146
|
-
"percent": 2.
|
|
146
|
+
"percent": 2.98,
|
|
147
147
|
"reduction": 0
|
|
148
148
|
},
|
|
149
149
|
{
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"dependents": [
|
|
173
173
|
"/src/adapters/aws-lambda/index.ts"
|
|
174
174
|
],
|
|
175
|
-
"percent": 2.
|
|
175
|
+
"percent": 2.77,
|
|
176
176
|
"reduction": 11.51
|
|
177
177
|
},
|
|
178
178
|
{
|
|
@@ -205,9 +205,10 @@
|
|
|
205
205
|
],
|
|
206
206
|
"removedExports": [],
|
|
207
207
|
"dependents": [
|
|
208
|
+
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
208
209
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
209
210
|
],
|
|
210
|
-
"percent": 2.
|
|
211
|
+
"percent": 2.27,
|
|
211
212
|
"reduction": 0
|
|
212
213
|
},
|
|
213
214
|
{
|
|
@@ -223,7 +224,7 @@
|
|
|
223
224
|
"/src/adapters/node-http/index.ts",
|
|
224
225
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
225
226
|
],
|
|
226
|
-
"percent": 2.
|
|
227
|
+
"percent": 2.07,
|
|
227
228
|
"reduction": 6.82
|
|
228
229
|
},
|
|
229
230
|
{
|
|
@@ -241,7 +242,7 @@
|
|
|
241
242
|
"dependents": [
|
|
242
243
|
"/src/observable/index.ts"
|
|
243
244
|
],
|
|
244
|
-
"percent": 2
|
|
245
|
+
"percent": 2,
|
|
245
246
|
"reduction": 1.66
|
|
246
247
|
},
|
|
247
248
|
{
|
|
@@ -270,7 +271,7 @@
|
|
|
270
271
|
"dependents": [
|
|
271
272
|
"/src/adapters/node-http/index.ts"
|
|
272
273
|
],
|
|
273
|
-
"percent": 1.
|
|
274
|
+
"percent": 1.4,
|
|
274
275
|
"reduction": 16.3
|
|
275
276
|
},
|
|
276
277
|
{
|
|
@@ -290,7 +291,7 @@
|
|
|
290
291
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
291
292
|
"/src/unstable-core-do-not-import/router.ts"
|
|
292
293
|
],
|
|
293
|
-
"percent": 1.
|
|
294
|
+
"percent": 1.4,
|
|
294
295
|
"reduction": 45.98
|
|
295
296
|
},
|
|
296
297
|
{
|
|
@@ -304,7 +305,7 @@
|
|
|
304
305
|
"dependents": [
|
|
305
306
|
"/src/unstable-core-do-not-import.ts"
|
|
306
307
|
],
|
|
307
|
-
"percent": 1.
|
|
308
|
+
"percent": 1.36,
|
|
308
309
|
"reduction": 40.81
|
|
309
310
|
},
|
|
310
311
|
{
|
|
@@ -324,7 +325,7 @@
|
|
|
324
325
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
325
326
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
326
327
|
],
|
|
327
|
-
"percent": 1.
|
|
328
|
+
"percent": 1.34,
|
|
328
329
|
"reduction": 55.79
|
|
329
330
|
},
|
|
330
331
|
{
|
|
@@ -355,10 +356,10 @@
|
|
|
355
356
|
"/src/unstable-core-do-not-import/transformer.ts",
|
|
356
357
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
357
358
|
"/src/unstable-core-do-not-import/router.ts",
|
|
358
|
-
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
359
359
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
360
360
|
"/src/unstable-core-do-not-import/http/isAbortError.ts",
|
|
361
361
|
"/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
362
|
+
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
362
363
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
363
364
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
364
365
|
],
|
|
@@ -401,7 +402,7 @@
|
|
|
401
402
|
"/src/unstable-core-do-not-import.ts",
|
|
402
403
|
"/src/unstable-core-do-not-import/router.ts"
|
|
403
404
|
],
|
|
404
|
-
"percent": 1.
|
|
405
|
+
"percent": 1.19,
|
|
405
406
|
"reduction": 0
|
|
406
407
|
},
|
|
407
408
|
{
|
|
@@ -524,7 +525,7 @@
|
|
|
524
525
|
],
|
|
525
526
|
"removedExports": [],
|
|
526
527
|
"dependents": [],
|
|
527
|
-
"percent": 0.
|
|
528
|
+
"percent": 0.82,
|
|
528
529
|
"reduction": 17.81
|
|
529
530
|
},
|
|
530
531
|
{
|
|
@@ -539,7 +540,7 @@
|
|
|
539
540
|
"/src/unstable-core-do-not-import.ts",
|
|
540
541
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
541
542
|
],
|
|
542
|
-
"percent": 0.
|
|
543
|
+
"percent": 0.82,
|
|
543
544
|
"reduction": 54.01
|
|
544
545
|
},
|
|
545
546
|
{
|
|
@@ -653,7 +654,7 @@
|
|
|
653
654
|
],
|
|
654
655
|
"removedExports": [],
|
|
655
656
|
"dependents": [],
|
|
656
|
-
"percent": 0.
|
|
657
|
+
"percent": 0.45,
|
|
657
658
|
"reduction": 34
|
|
658
659
|
},
|
|
659
660
|
{
|
|
@@ -750,7 +751,7 @@
|
|
|
750
751
|
{
|
|
751
752
|
"id": "/src/unstable-core-do-not-import/rootConfig.ts",
|
|
752
753
|
"size": 343,
|
|
753
|
-
"origSize":
|
|
754
|
+
"origSize": 3318,
|
|
754
755
|
"renderedExports": [
|
|
755
756
|
"isServerDefault"
|
|
756
757
|
],
|
|
@@ -760,7 +761,7 @@
|
|
|
760
761
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
761
762
|
],
|
|
762
763
|
"percent": 0.18,
|
|
763
|
-
"reduction":
|
|
764
|
+
"reduction": 89.66
|
|
764
765
|
},
|
|
765
766
|
{
|
|
766
767
|
"id": "/src/unstable-core-do-not-import/stream/utils/createDeferred.ts",
|
|
@@ -884,16 +885,6 @@
|
|
|
884
885
|
"percent": 0,
|
|
885
886
|
"reduction": 100
|
|
886
887
|
},
|
|
887
|
-
{
|
|
888
|
-
"id": "/src/rpc.ts",
|
|
889
|
-
"size": 0,
|
|
890
|
-
"origSize": 36,
|
|
891
|
-
"renderedExports": [],
|
|
892
|
-
"removedExports": [],
|
|
893
|
-
"dependents": [],
|
|
894
|
-
"percent": 0,
|
|
895
|
-
"reduction": 100
|
|
896
|
-
},
|
|
897
888
|
{
|
|
898
889
|
"id": "/src/unstable-core-do-not-import.ts",
|
|
899
890
|
"size": 0,
|
|
@@ -902,9 +893,9 @@
|
|
|
902
893
|
"removedExports": [],
|
|
903
894
|
"dependents": [
|
|
904
895
|
"/src/adapters/express.ts",
|
|
905
|
-
"/src/adapters/ws.ts",
|
|
906
|
-
"/src/adapters/standalone.ts",
|
|
907
896
|
"/src/adapters/next.ts",
|
|
897
|
+
"/src/adapters/standalone.ts",
|
|
898
|
+
"/src/adapters/ws.ts",
|
|
908
899
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts",
|
|
909
900
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
910
901
|
"/src/adapters/node-http/writeResponse.ts"
|
|
@@ -913,9 +904,9 @@
|
|
|
913
904
|
"reduction": 100
|
|
914
905
|
},
|
|
915
906
|
{
|
|
916
|
-
"id": "/src/
|
|
907
|
+
"id": "/src/rpc.ts",
|
|
917
908
|
"size": 0,
|
|
918
|
-
"origSize":
|
|
909
|
+
"origSize": 36,
|
|
919
910
|
"renderedExports": [],
|
|
920
911
|
"removedExports": [],
|
|
921
912
|
"dependents": [],
|
|
@@ -923,24 +914,24 @@
|
|
|
923
914
|
"reduction": 100
|
|
924
915
|
},
|
|
925
916
|
{
|
|
926
|
-
"id": "/src/
|
|
917
|
+
"id": "/src/adapters/next-app-dir.ts",
|
|
927
918
|
"size": 0,
|
|
928
|
-
"origSize":
|
|
919
|
+
"origSize": 255,
|
|
929
920
|
"renderedExports": [],
|
|
930
921
|
"removedExports": [],
|
|
931
|
-
"dependents": [
|
|
932
|
-
"/src/adapters/ws.ts"
|
|
933
|
-
],
|
|
922
|
+
"dependents": [],
|
|
934
923
|
"percent": 0,
|
|
935
924
|
"reduction": 100
|
|
936
925
|
},
|
|
937
926
|
{
|
|
938
|
-
"id": "/src/
|
|
927
|
+
"id": "/src/observable/index.ts",
|
|
939
928
|
"size": 0,
|
|
940
|
-
"origSize":
|
|
929
|
+
"origSize": 474,
|
|
941
930
|
"renderedExports": [],
|
|
942
931
|
"removedExports": [],
|
|
943
|
-
"dependents": [
|
|
932
|
+
"dependents": [
|
|
933
|
+
"/src/adapters/ws.ts"
|
|
934
|
+
],
|
|
944
935
|
"percent": 0,
|
|
945
936
|
"reduction": 100
|
|
946
937
|
},
|
|
@@ -962,13 +953,23 @@
|
|
|
962
953
|
"removedExports": [],
|
|
963
954
|
"dependents": [
|
|
964
955
|
"/src/adapters/express.ts",
|
|
965
|
-
"/src/adapters/ws.ts",
|
|
966
|
-
"/src/adapters/standalone.ts",
|
|
967
956
|
"/src/adapters/next.ts",
|
|
957
|
+
"/src/adapters/standalone.ts",
|
|
958
|
+
"/src/adapters/ws.ts",
|
|
968
959
|
"/src/adapters/fastify/fastifyRequestHandler.ts"
|
|
969
960
|
],
|
|
970
961
|
"percent": 0,
|
|
971
962
|
"reduction": 100
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
966
|
+
"size": 0,
|
|
967
|
+
"origSize": 64,
|
|
968
|
+
"renderedExports": [],
|
|
969
|
+
"removedExports": [],
|
|
970
|
+
"dependents": [],
|
|
971
|
+
"percent": 0,
|
|
972
|
+
"reduction": 100
|
|
972
973
|
}
|
|
973
974
|
],
|
|
974
975
|
"moduleCount": 63
|
|
@@ -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;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA+BjB,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,
|
|
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;AA+BjB,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CombinedDataTransformer } from '../unstable-core-do-not-import';
|
|
2
2
|
import type { DefaultErrorShape, ErrorFormatter } from './error/formatter';
|
|
3
|
+
import type { JSONLProducerOptions } from './stream/jsonl';
|
|
3
4
|
import type { SSEStreamProducerOptions } from './stream/sse';
|
|
4
5
|
/**
|
|
5
6
|
* The initial generics that are used in the init function
|
|
@@ -65,6 +66,11 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
65
66
|
*/
|
|
66
67
|
enabled?: boolean;
|
|
67
68
|
} & Pick<SSEStreamProducerOptions, 'ping' | 'emitAndEndImmediately' | 'maxDurationMs' | 'client'>;
|
|
69
|
+
/**
|
|
70
|
+
* Options for batch stream
|
|
71
|
+
* @see https://trpc.io/docs/client/links/httpBatchStreamLink
|
|
72
|
+
*/
|
|
73
|
+
jsonl?: Pick<JSONLProducerOptions, 'pingMs'>;
|
|
68
74
|
experimental?: {};
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootConfig.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/rootConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAMmB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM,SAAS,SAAS;IAClD;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,EAAE,uBAAuB,CAAC;IACrC;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IAErE;;;OAGG;IACH,GAAG,CAAC,EAAE;QACJ;;;WAGG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CACN,wBA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ACnB,GAAG,IAAI,CACN,wBAAwB,EACxB,MAAM,GAAG,uBAAuB,GAAG,eAAe,GAAG,QAAQ,CAC9D,CAAC;IAEF;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,SAAS,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;IACzC,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,KAAK,SAAS,CAAC,UAAU,SAAS,OAAO,EAAE,KAAK,IAAI,UAAU,SAAS,IAAI,GACvE,OAAO,CAAC,KAAK,CAAC,GACd,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,EACR,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACvC,SAAS,CACX,MAAM,SAAS,QAAQ,GAAG,IAAI,GAAG,KAAK,EACtC;IACE;;QAEI;IACJ,aAAa,EAAE,SAAS,CAAC;CAC1B,CACF,CAAC"}
|
|
@@ -65,7 +65,7 @@ export type ProducerOnError = (opts: {
|
|
|
65
65
|
error: unknown;
|
|
66
66
|
path: PathArray;
|
|
67
67
|
}) => void;
|
|
68
|
-
export interface
|
|
68
|
+
export interface JSONLProducerOptions {
|
|
69
69
|
serialize?: Serialize;
|
|
70
70
|
data: Record<string, unknown> | unknown[];
|
|
71
71
|
onError?: ProducerOnError;
|
|
@@ -74,12 +74,18 @@ export interface ProducerOptions {
|
|
|
74
74
|
path: PathArray;
|
|
75
75
|
}) => unknown;
|
|
76
76
|
maxDepth?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Interval in milliseconds to send a ping to the client to keep the connection alive
|
|
79
|
+
* This will be sent as a whitespace character
|
|
80
|
+
* @default undefined
|
|
81
|
+
*/
|
|
82
|
+
pingMs?: number;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
79
85
|
* JSON Lines stream producer
|
|
80
86
|
* @see https://jsonlines.org/
|
|
81
87
|
*/
|
|
82
|
-
export declare function jsonlStreamProducer(opts:
|
|
88
|
+
export declare function jsonlStreamProducer(opts: JSONLProducerOptions): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
83
89
|
declare class StreamInterruptedError extends Error {
|
|
84
90
|
constructor(cause?: unknown);
|
|
85
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/stream/jsonl.ts"],"names":[],"mappings":"
|
|
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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,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;2BAxC+B,UAAU;qBArCvB,eAAe;;;;;;wBAiDL,OAAO;IA0JnC"}
|
|
@@ -6,6 +6,7 @@ var createDeferred = require('./utils/createDeferred.js');
|
|
|
6
6
|
var disposable = require('./utils/disposable.js');
|
|
7
7
|
var mergeAsyncIterables = require('./utils/mergeAsyncIterables.js');
|
|
8
8
|
var readableStreamFrom = require('./utils/readableStreamFrom.js');
|
|
9
|
+
var withPing = require('./utils/withPing.js');
|
|
9
10
|
|
|
10
11
|
function _define_property(obj, key, value) {
|
|
11
12
|
if (key in obj) {
|
|
@@ -284,7 +285,11 @@ async function* createBatchStreamProducer(opts) {
|
|
|
284
285
|
]);
|
|
285
286
|
}
|
|
286
287
|
yield newHead;
|
|
287
|
-
|
|
288
|
+
let iterable = mergedIterables;
|
|
289
|
+
if (opts.pingMs) {
|
|
290
|
+
iterable = withPing.withPing(mergedIterables, opts.pingMs);
|
|
291
|
+
}
|
|
292
|
+
for await (const value of iterable){
|
|
288
293
|
yield value;
|
|
289
294
|
}
|
|
290
295
|
}
|
|
@@ -297,13 +302,21 @@ async function* createBatchStreamProducer(opts) {
|
|
|
297
302
|
if (serialize) {
|
|
298
303
|
stream = stream.pipeThrough(new TransformStream({
|
|
299
304
|
transform (chunk, controller) {
|
|
300
|
-
|
|
305
|
+
if (chunk === withPing.PING_SYM) {
|
|
306
|
+
controller.enqueue(withPing.PING_SYM);
|
|
307
|
+
} else {
|
|
308
|
+
controller.enqueue(serialize(chunk));
|
|
309
|
+
}
|
|
301
310
|
}
|
|
302
311
|
}));
|
|
303
312
|
}
|
|
304
313
|
return stream.pipeThrough(new TransformStream({
|
|
305
314
|
transform (chunk, controller) {
|
|
306
|
-
|
|
315
|
+
if (chunk === withPing.PING_SYM) {
|
|
316
|
+
controller.enqueue(' ');
|
|
317
|
+
} else {
|
|
318
|
+
controller.enqueue(JSON.stringify(chunk) + '\n');
|
|
319
|
+
}
|
|
307
320
|
}
|
|
308
321
|
})).pipeThrough(new TextEncoderStream());
|
|
309
322
|
}
|
|
@@ -4,6 +4,7 @@ import { createDeferred } from './utils/createDeferred.mjs';
|
|
|
4
4
|
import { makeResource } from './utils/disposable.mjs';
|
|
5
5
|
import { mergeAsyncIterables } from './utils/mergeAsyncIterables.mjs';
|
|
6
6
|
import { readableStreamFrom } from './utils/readableStreamFrom.mjs';
|
|
7
|
+
import { PING_SYM, withPing } from './utils/withPing.mjs';
|
|
7
8
|
|
|
8
9
|
function _define_property(obj, key, value) {
|
|
9
10
|
if (key in obj) {
|
|
@@ -282,7 +283,11 @@ async function* createBatchStreamProducer(opts) {
|
|
|
282
283
|
]);
|
|
283
284
|
}
|
|
284
285
|
yield newHead;
|
|
285
|
-
|
|
286
|
+
let iterable = mergedIterables;
|
|
287
|
+
if (opts.pingMs) {
|
|
288
|
+
iterable = withPing(mergedIterables, opts.pingMs);
|
|
289
|
+
}
|
|
290
|
+
for await (const value of iterable){
|
|
286
291
|
yield value;
|
|
287
292
|
}
|
|
288
293
|
}
|
|
@@ -295,13 +300,21 @@ async function* createBatchStreamProducer(opts) {
|
|
|
295
300
|
if (serialize) {
|
|
296
301
|
stream = stream.pipeThrough(new TransformStream({
|
|
297
302
|
transform (chunk, controller) {
|
|
298
|
-
|
|
303
|
+
if (chunk === PING_SYM) {
|
|
304
|
+
controller.enqueue(PING_SYM);
|
|
305
|
+
} else {
|
|
306
|
+
controller.enqueue(serialize(chunk));
|
|
307
|
+
}
|
|
299
308
|
}
|
|
300
309
|
}));
|
|
301
310
|
}
|
|
302
311
|
return stream.pipeThrough(new TransformStream({
|
|
303
312
|
transform (chunk, controller) {
|
|
304
|
-
|
|
313
|
+
if (chunk === PING_SYM) {
|
|
314
|
+
controller.enqueue(' ');
|
|
315
|
+
} else {
|
|
316
|
+
controller.enqueue(JSON.stringify(chunk) + '\n');
|
|
317
|
+
}
|
|
305
318
|
}
|
|
306
319
|
})).pipeThrough(new TextEncoderStream());
|
|
307
320
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.743+96fa581c4",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"peerDependencies": {
|
|
153
153
|
"typescript": ">=5.7.2"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "96fa581c4a53778dbb4272d728a010c64c8fecbe"
|
|
156
156
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CombinedDataTransformer } from '../unstable-core-do-not-import';
|
|
2
2
|
import type { DefaultErrorShape, ErrorFormatter } from './error/formatter';
|
|
3
|
+
import type { JSONLProducerOptions } from './stream/jsonl';
|
|
3
4
|
import type { SSEStreamProducerOptions } from './stream/sse';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -79,6 +80,12 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
79
80
|
SSEStreamProducerOptions,
|
|
80
81
|
'ping' | 'emitAndEndImmediately' | 'maxDurationMs' | 'client'
|
|
81
82
|
>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Options for batch stream
|
|
86
|
+
* @see https://trpc.io/docs/client/links/httpBatchStreamLink
|
|
87
|
+
*/
|
|
88
|
+
jsonl?: Pick<JSONLProducerOptions, 'pingMs'>;
|
|
82
89
|
experimental?: {};
|
|
83
90
|
}
|
|
84
91
|
|
|
@@ -5,6 +5,7 @@ import { createDeferred } from './utils/createDeferred';
|
|
|
5
5
|
import { makeResource } from './utils/disposable';
|
|
6
6
|
import { mergeAsyncIterables } from './utils/mergeAsyncIterables';
|
|
7
7
|
import { readableStreamFrom } from './utils/readableStreamFrom';
|
|
8
|
+
import { PING_SYM, withPing } from './utils/withPing';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* A subset of the standard ReadableStream properties needed by tRPC internally.
|
|
@@ -107,12 +108,18 @@ export type ProducerOnError = (opts: {
|
|
|
107
108
|
error: unknown;
|
|
108
109
|
path: PathArray;
|
|
109
110
|
}) => void;
|
|
110
|
-
export interface
|
|
111
|
+
export interface JSONLProducerOptions {
|
|
111
112
|
serialize?: Serialize;
|
|
112
113
|
data: Record<string, unknown> | unknown[];
|
|
113
114
|
onError?: ProducerOnError;
|
|
114
115
|
formatError?: (opts: { error: unknown; path: PathArray }) => unknown;
|
|
115
116
|
maxDepth?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Interval in milliseconds to send a ping to the client to keep the connection alive
|
|
119
|
+
* This will be sent as a whitespace character
|
|
120
|
+
* @default undefined
|
|
121
|
+
*/
|
|
122
|
+
pingMs?: number;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
class MaxDepthError extends Error {
|
|
@@ -122,8 +129,8 @@ class MaxDepthError extends Error {
|
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
async function* createBatchStreamProducer(
|
|
125
|
-
opts:
|
|
126
|
-
): AsyncIterable<Head | ChunkData, void> {
|
|
132
|
+
opts: JSONLProducerOptions,
|
|
133
|
+
): AsyncIterable<Head | ChunkData | typeof PING_SYM, void> {
|
|
127
134
|
const { data } = opts;
|
|
128
135
|
let counter = 0 as ChunkIndex;
|
|
129
136
|
const placeholder = 0 as PlaceholderValue;
|
|
@@ -251,7 +258,13 @@ async function* createBatchStreamProducer(
|
|
|
251
258
|
|
|
252
259
|
yield newHead;
|
|
253
260
|
|
|
254
|
-
|
|
261
|
+
let iterable: AsyncIterable<Head | ChunkData | typeof PING_SYM, void> =
|
|
262
|
+
mergedIterables;
|
|
263
|
+
if (opts.pingMs) {
|
|
264
|
+
iterable = withPing(mergedIterables, opts.pingMs);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
for await (const value of iterable) {
|
|
255
268
|
yield value;
|
|
256
269
|
}
|
|
257
270
|
}
|
|
@@ -259,7 +272,7 @@ async function* createBatchStreamProducer(
|
|
|
259
272
|
* JSON Lines stream producer
|
|
260
273
|
* @see https://jsonlines.org/
|
|
261
274
|
*/
|
|
262
|
-
export function jsonlStreamProducer(opts:
|
|
275
|
+
export function jsonlStreamProducer(opts: JSONLProducerOptions) {
|
|
263
276
|
let stream = readableStreamFrom(createBatchStreamProducer(opts));
|
|
264
277
|
|
|
265
278
|
const { serialize } = opts;
|
|
@@ -267,7 +280,11 @@ export function jsonlStreamProducer(opts: ProducerOptions) {
|
|
|
267
280
|
stream = stream.pipeThrough(
|
|
268
281
|
new TransformStream({
|
|
269
282
|
transform(chunk, controller) {
|
|
270
|
-
|
|
283
|
+
if (chunk === PING_SYM) {
|
|
284
|
+
controller.enqueue(PING_SYM);
|
|
285
|
+
} else {
|
|
286
|
+
controller.enqueue(serialize(chunk));
|
|
287
|
+
}
|
|
271
288
|
},
|
|
272
289
|
}),
|
|
273
290
|
);
|
|
@@ -277,7 +294,11 @@ export function jsonlStreamProducer(opts: ProducerOptions) {
|
|
|
277
294
|
.pipeThrough(
|
|
278
295
|
new TransformStream({
|
|
279
296
|
transform(chunk, controller) {
|
|
280
|
-
|
|
297
|
+
if (chunk === PING_SYM) {
|
|
298
|
+
controller.enqueue(' ');
|
|
299
|
+
} else {
|
|
300
|
+
controller.enqueue(JSON.stringify(chunk) + '\n');
|
|
301
|
+
}
|
|
281
302
|
},
|
|
282
303
|
}),
|
|
283
304
|
)
|