@trpc/server 11.0.0-next.320 → 11.0.0-next.322
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 +69 -69
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +1 -1
- package/dist/unstable-core-do-not-import/procedure.d.ts +2 -1
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +46 -13
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.js +20 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.mjs +20 -1
- package/dist/unstable-core-do-not-import/router.d.ts +1 -1
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/procedure.ts +9 -1
- package/src/unstable-core-do-not-import/procedureBuilder.ts +107 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 93049,
|
|
3
|
+
"bundleOrigSize": 150142,
|
|
4
|
+
"bundleReduction": 38.03,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/adapters/ws.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependents": [
|
|
16
16
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
17
17
|
],
|
|
18
|
-
"percent": 10.
|
|
18
|
+
"percent": 10.93,
|
|
19
19
|
"reduction": 0
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -27,43 +27,43 @@
|
|
|
27
27
|
],
|
|
28
28
|
"removedExports": [],
|
|
29
29
|
"dependents": [],
|
|
30
|
-
"percent": 10.
|
|
30
|
+
"percent": 10.18,
|
|
31
31
|
"reduction": 20.86
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
"id": "/src/unstable-core-do-not-import/
|
|
35
|
-
"size":
|
|
36
|
-
"origSize":
|
|
34
|
+
"id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
35
|
+
"size": 6215,
|
|
36
|
+
"origSize": 15774,
|
|
37
37
|
"renderedExports": [
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"createCallerFactory",
|
|
41
|
-
"mergeRouters"
|
|
38
|
+
"unsetMarker",
|
|
39
|
+
"createBuilder"
|
|
42
40
|
],
|
|
43
41
|
"removedExports": [],
|
|
44
42
|
"dependents": [
|
|
45
43
|
"/src/unstable-core-do-not-import.ts",
|
|
46
|
-
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
47
|
-
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
44
|
+
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
48
45
|
],
|
|
49
|
-
"percent": 6.
|
|
50
|
-
"reduction":
|
|
46
|
+
"percent": 6.68,
|
|
47
|
+
"reduction": 60.6
|
|
51
48
|
},
|
|
52
49
|
{
|
|
53
|
-
"id": "/src/unstable-core-do-not-import/
|
|
54
|
-
"size":
|
|
55
|
-
"origSize":
|
|
50
|
+
"id": "/src/unstable-core-do-not-import/router.ts",
|
|
51
|
+
"size": 6069,
|
|
52
|
+
"origSize": 9881,
|
|
56
53
|
"renderedExports": [
|
|
57
|
-
"
|
|
58
|
-
"
|
|
54
|
+
"createRouterFactory",
|
|
55
|
+
"callProcedure",
|
|
56
|
+
"createCallerFactory",
|
|
57
|
+
"mergeRouters"
|
|
59
58
|
],
|
|
60
59
|
"removedExports": [],
|
|
61
60
|
"dependents": [
|
|
62
61
|
"/src/unstable-core-do-not-import.ts",
|
|
62
|
+
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
63
63
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
64
64
|
],
|
|
65
|
-
"percent": 6.
|
|
66
|
-
"reduction": 58
|
|
65
|
+
"percent": 6.52,
|
|
66
|
+
"reduction": 38.58
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"id": "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"dependents": [
|
|
79
79
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
80
80
|
],
|
|
81
|
-
"percent": 5.
|
|
81
|
+
"percent": 5.35,
|
|
82
82
|
"reduction": 38
|
|
83
83
|
},
|
|
84
84
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
],
|
|
93
93
|
"removedExports": [],
|
|
94
94
|
"dependents": [],
|
|
95
|
-
"percent": 4.
|
|
95
|
+
"percent": 4.75,
|
|
96
96
|
"reduction": 32.71
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"dependents": [
|
|
107
107
|
"/src/adapters/node-http/index.ts"
|
|
108
108
|
],
|
|
109
|
-
"percent": 4.
|
|
109
|
+
"percent": 4.23,
|
|
110
110
|
"reduction": 13.56
|
|
111
111
|
},
|
|
112
112
|
{
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"dependents": [
|
|
121
121
|
"/src/adapters/fetch/index.ts"
|
|
122
122
|
],
|
|
123
|
-
"percent": 3.
|
|
123
|
+
"percent": 3.73,
|
|
124
124
|
"reduction": 9.9
|
|
125
125
|
},
|
|
126
126
|
{
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"dependents": [
|
|
140
140
|
"/src/adapters/aws-lambda/index.ts"
|
|
141
141
|
],
|
|
142
|
-
"percent": 3.
|
|
142
|
+
"percent": 3.56,
|
|
143
143
|
"reduction": 34.98
|
|
144
144
|
},
|
|
145
145
|
{
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"/src/observable/index.ts",
|
|
157
157
|
"/src/observable/operators.ts"
|
|
158
158
|
],
|
|
159
|
-
"percent": 3.
|
|
159
|
+
"percent": 3.36,
|
|
160
160
|
"reduction": 0.67
|
|
161
161
|
},
|
|
162
162
|
{
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"dependents": [
|
|
171
171
|
"/src/unstable-core-do-not-import.ts"
|
|
172
172
|
],
|
|
173
|
-
"percent": 3.
|
|
173
|
+
"percent": 3.01,
|
|
174
174
|
"reduction": 40.26
|
|
175
175
|
},
|
|
176
176
|
{
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"dependents": [
|
|
187
187
|
"/src/observable/index.ts"
|
|
188
188
|
],
|
|
189
|
-
"percent": 2.
|
|
189
|
+
"percent": 2.96,
|
|
190
190
|
"reduction": 0
|
|
191
191
|
},
|
|
192
192
|
{
|
|
@@ -202,11 +202,11 @@
|
|
|
202
202
|
"removedExports": [],
|
|
203
203
|
"dependents": [
|
|
204
204
|
"/src/unstable-core-do-not-import.ts",
|
|
205
|
+
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
205
206
|
"/src/unstable-core-do-not-import/router.ts",
|
|
206
|
-
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
207
|
-
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
207
|
+
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
208
208
|
],
|
|
209
|
-
"percent": 2.
|
|
209
|
+
"percent": 2.95,
|
|
210
210
|
"reduction": 45.94
|
|
211
211
|
},
|
|
212
212
|
{
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
227
227
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
228
228
|
],
|
|
229
|
-
"percent": 2.
|
|
229
|
+
"percent": 2.82,
|
|
230
230
|
"reduction": 55.5
|
|
231
231
|
},
|
|
232
232
|
{
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"/src/adapters/fastify/index.ts",
|
|
242
242
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
243
243
|
],
|
|
244
|
-
"percent": 2.
|
|
244
|
+
"percent": 2.66,
|
|
245
245
|
"reduction": 36.53
|
|
246
246
|
},
|
|
247
247
|
{
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
],
|
|
254
254
|
"removedExports": [],
|
|
255
255
|
"dependents": [],
|
|
256
|
-
"percent": 2.
|
|
256
|
+
"percent": 2.63,
|
|
257
257
|
"reduction": 32.42
|
|
258
258
|
},
|
|
259
259
|
{
|
|
@@ -268,13 +268,13 @@
|
|
|
268
268
|
"removedExports": [],
|
|
269
269
|
"dependents": [
|
|
270
270
|
"/src/unstable-core-do-not-import.ts",
|
|
271
|
-
"/src/unstable-core-do-not-import/router.ts",
|
|
272
|
-
"/src/unstable-core-do-not-import/middleware.ts",
|
|
273
271
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
274
272
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
273
|
+
"/src/unstable-core-do-not-import/router.ts",
|
|
274
|
+
"/src/unstable-core-do-not-import/middleware.ts",
|
|
275
275
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
276
276
|
],
|
|
277
|
-
"percent": 1.
|
|
277
|
+
"percent": 1.86,
|
|
278
278
|
"reduction": 19.47
|
|
279
279
|
},
|
|
280
280
|
{
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"dependents": [
|
|
289
289
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
290
290
|
],
|
|
291
|
-
"percent": 1.
|
|
291
|
+
"percent": 1.76,
|
|
292
292
|
"reduction": 34.79
|
|
293
293
|
},
|
|
294
294
|
{
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
],
|
|
301
301
|
"removedExports": [],
|
|
302
302
|
"dependents": [],
|
|
303
|
-
"percent": 1.
|
|
303
|
+
"percent": 1.72,
|
|
304
304
|
"reduction": 29.12
|
|
305
305
|
},
|
|
306
306
|
{
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
"dependents": [
|
|
315
315
|
"/src/adapters/node-http/content-type/json/index.ts"
|
|
316
316
|
],
|
|
317
|
-
"percent": 1.
|
|
317
|
+
"percent": 1.71,
|
|
318
318
|
"reduction": 0.19
|
|
319
319
|
},
|
|
320
320
|
{
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
],
|
|
327
327
|
"removedExports": [],
|
|
328
328
|
"dependents": [],
|
|
329
|
-
"percent": 1.
|
|
329
|
+
"percent": 1.7,
|
|
330
330
|
"reduction": 21.04
|
|
331
331
|
},
|
|
332
332
|
{
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
],
|
|
340
340
|
"removedExports": [],
|
|
341
341
|
"dependents": [],
|
|
342
|
-
"percent": 1.
|
|
342
|
+
"percent": 1.64,
|
|
343
343
|
"reduction": 27.6
|
|
344
344
|
},
|
|
345
345
|
{
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
"/src/unstable-core-do-not-import/router.ts",
|
|
357
357
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
358
358
|
],
|
|
359
|
-
"percent": 1.
|
|
359
|
+
"percent": 1.62,
|
|
360
360
|
"reduction": 5.58
|
|
361
361
|
},
|
|
362
362
|
{
|
|
@@ -370,7 +370,7 @@
|
|
|
370
370
|
"dependents": [
|
|
371
371
|
"/src/adapters/fastify/index.ts"
|
|
372
372
|
],
|
|
373
|
-
"percent": 1.
|
|
373
|
+
"percent": 1.6,
|
|
374
374
|
"reduction": 34.33
|
|
375
375
|
},
|
|
376
376
|
{
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
"dependents": [
|
|
385
385
|
"/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts"
|
|
386
386
|
],
|
|
387
|
-
"percent": 1.
|
|
387
|
+
"percent": 1.5,
|
|
388
388
|
"reduction": 0
|
|
389
389
|
},
|
|
390
390
|
{
|
|
@@ -397,10 +397,10 @@
|
|
|
397
397
|
],
|
|
398
398
|
"removedExports": [],
|
|
399
399
|
"dependents": [
|
|
400
|
-
"/src/unstable-core-do-not-import/
|
|
401
|
-
"/src/unstable-core-do-not-import/
|
|
400
|
+
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
401
|
+
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
402
402
|
],
|
|
403
|
-
"percent": 1.
|
|
403
|
+
"percent": 1.36,
|
|
404
404
|
"reduction": 22.76
|
|
405
405
|
},
|
|
406
406
|
{
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
"dependents": [
|
|
472
472
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
473
473
|
],
|
|
474
|
-
"percent": 0.
|
|
474
|
+
"percent": 0.75,
|
|
475
475
|
"reduction": 71.21
|
|
476
476
|
},
|
|
477
477
|
{
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
"/src/unstable-core-do-not-import.ts",
|
|
499
499
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
500
500
|
],
|
|
501
|
-
"percent": 0.
|
|
501
|
+
"percent": 0.67,
|
|
502
502
|
"reduction": 43.49
|
|
503
503
|
},
|
|
504
504
|
{
|
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
],
|
|
512
512
|
"removedExports": [],
|
|
513
513
|
"dependents": [],
|
|
514
|
-
"percent": 0.
|
|
514
|
+
"percent": 0.62,
|
|
515
515
|
"reduction": 65.23
|
|
516
516
|
},
|
|
517
517
|
{
|
|
@@ -538,7 +538,7 @@
|
|
|
538
538
|
],
|
|
539
539
|
"removedExports": [],
|
|
540
540
|
"dependents": [],
|
|
541
|
-
"percent": 0.
|
|
541
|
+
"percent": 0.36,
|
|
542
542
|
"reduction": 71.37
|
|
543
543
|
},
|
|
544
544
|
{
|
|
@@ -552,7 +552,7 @@
|
|
|
552
552
|
"dependents": [
|
|
553
553
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
554
554
|
],
|
|
555
|
-
"percent": 0.
|
|
555
|
+
"percent": 0.31,
|
|
556
556
|
"reduction": 35.11
|
|
557
557
|
},
|
|
558
558
|
{
|
|
@@ -593,13 +593,13 @@
|
|
|
593
593
|
"/src/adapters/node-http/content-type/json/index.ts",
|
|
594
594
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
595
595
|
],
|
|
596
|
-
"percent": 0.
|
|
596
|
+
"percent": 0.12,
|
|
597
597
|
"reduction": 86.68
|
|
598
598
|
},
|
|
599
599
|
{
|
|
600
600
|
"id": "/src/unstable-core-do-not-import/procedure.ts",
|
|
601
601
|
"size": 75,
|
|
602
|
-
"origSize":
|
|
602
|
+
"origSize": 2135,
|
|
603
603
|
"renderedExports": [
|
|
604
604
|
"procedureTypes"
|
|
605
605
|
],
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts"
|
|
610
610
|
],
|
|
611
611
|
"percent": 0.08,
|
|
612
|
-
"reduction": 96.
|
|
612
|
+
"reduction": 96.49
|
|
613
613
|
},
|
|
614
614
|
{
|
|
615
615
|
"id": "/src/unstable-core-do-not-import/error/formatter.ts",
|
|
@@ -628,9 +628,9 @@
|
|
|
628
628
|
"reduction": 93.8
|
|
629
629
|
},
|
|
630
630
|
{
|
|
631
|
-
"id": "/src/
|
|
631
|
+
"id": "/src/http.ts",
|
|
632
632
|
"size": 0,
|
|
633
|
-
"origSize":
|
|
633
|
+
"origSize": 37,
|
|
634
634
|
"renderedExports": [],
|
|
635
635
|
"removedExports": [],
|
|
636
636
|
"dependents": [],
|
|
@@ -638,9 +638,9 @@
|
|
|
638
638
|
"reduction": 100
|
|
639
639
|
},
|
|
640
640
|
{
|
|
641
|
-
"id": "/src/
|
|
641
|
+
"id": "/src/index.ts",
|
|
642
642
|
"size": 0,
|
|
643
|
-
"origSize":
|
|
643
|
+
"origSize": 32,
|
|
644
644
|
"renderedExports": [],
|
|
645
645
|
"removedExports": [],
|
|
646
646
|
"dependents": [],
|
|
@@ -690,9 +690,9 @@
|
|
|
690
690
|
"reduction": 100
|
|
691
691
|
},
|
|
692
692
|
{
|
|
693
|
-
"id": "/src/adapters/
|
|
693
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
694
694
|
"size": 0,
|
|
695
|
-
"origSize":
|
|
695
|
+
"origSize": 64,
|
|
696
696
|
"renderedExports": [],
|
|
697
697
|
"removedExports": [],
|
|
698
698
|
"dependents": [],
|
|
@@ -700,9 +700,9 @@
|
|
|
700
700
|
"reduction": 100
|
|
701
701
|
},
|
|
702
702
|
{
|
|
703
|
-
"id": "/src/adapters/
|
|
703
|
+
"id": "/src/adapters/fastify/index.ts",
|
|
704
704
|
"size": 0,
|
|
705
|
-
"origSize":
|
|
705
|
+
"origSize": 78,
|
|
706
706
|
"renderedExports": [],
|
|
707
707
|
"removedExports": [],
|
|
708
708
|
"dependents": [],
|
|
@@ -716,9 +716,9 @@
|
|
|
716
716
|
"renderedExports": [],
|
|
717
717
|
"removedExports": [],
|
|
718
718
|
"dependents": [
|
|
719
|
+
"/src/adapters/next.ts",
|
|
719
720
|
"/src/adapters/express.ts",
|
|
720
|
-
"/src/adapters/standalone.ts"
|
|
721
|
-
"/src/adapters/next.ts"
|
|
721
|
+
"/src/adapters/standalone.ts"
|
|
722
722
|
],
|
|
723
723
|
"percent": 0,
|
|
724
724
|
"reduction": 100
|
|
@@ -47,7 +47,7 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
|
|
|
47
47
|
* Builder object for creating procedures
|
|
48
48
|
* @link https://trpc.io/docs/v11/server/procedures
|
|
49
49
|
*/
|
|
50
|
-
procedure: import("./procedureBuilder").ProcedureBuilder<TContext, TMeta, object, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker>;
|
|
50
|
+
procedure: import("./procedureBuilder").ProcedureBuilder<TContext, TMeta, object, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker, typeof import("./procedureBuilder").unsetMarker, false>;
|
|
51
51
|
/**
|
|
52
52
|
* Create reusable middlewares
|
|
53
53
|
* @link https://trpc.io/docs/v11/server/middlewares
|
|
@@ -18,6 +18,7 @@ export interface ProcedureOptions {
|
|
|
18
18
|
interface BuiltProcedureDef {
|
|
19
19
|
input: unknown;
|
|
20
20
|
output: unknown;
|
|
21
|
+
experimental_caller?: true;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
*
|
|
@@ -38,7 +39,7 @@ export interface Procedure<TType extends ProcedureType, TDef extends BuiltProced
|
|
|
38
39
|
/**
|
|
39
40
|
* @internal
|
|
40
41
|
*/
|
|
41
|
-
(opts: ProcedureCallOptions): Promise<unknown>;
|
|
42
|
+
(opts: TDef['experimental_caller'] extends true ? TDef['input'] : ProcedureCallOptions): Promise<TDef['experimental_caller'] extends true ? TDef['output'] : unknown>;
|
|
42
43
|
}
|
|
43
44
|
export interface QueryProcedure<TDef extends BuiltProcedureDef> extends Procedure<'query', TDef> {
|
|
44
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,eAAO,MAAM,cAAc,gDAAiD,CAAC;AAC7E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE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AI,SAAS,iBAAiB,CAC5D,SAAQ,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC;CAAG;AAErC,MAAM,WAAW,iBAAiB,CAAC,IAAI,SAAS,iBAAiB,CAC/D,SAAQ,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;CAAG;AAExC,MAAM,WAAW,qBAAqB,CAAC,IAAI,SAAS,iBAAiB,CACnE,SAAQ,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC;CAAG;AAE5C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAC1D,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAEzD,MAAM,MAAM,mBAAmB,CAAC,UAAU,SAAS,YAAY,IAC7D,SAAS,SAAS,oBAAoB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,GAC3D,IAAI,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,GACpD,oBAAoB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;AAEpD,MAAM,MAAM,oBAAoB,CAAC,UAAU,IAAI,UAAU,SAAS,YAAY,GAC1E,UAAU,CAAC,MAAM,CAAC,GAClB,KAAK,CAAC;AACV,MAAM,MAAM,oBAAoB,CAAC,UAAU,IACzC,oBAAoB,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { inferObservableValue } from '../observable';
|
|
2
2
|
import type { AnyMiddlewareFunction, MiddlewareBuilder, MiddlewareFunction } from './middleware';
|
|
3
3
|
import type { inferParser, Parser } from './parser';
|
|
4
|
-
import type { MutationProcedure, ProcedureType, QueryProcedure, SubscriptionProcedure } from './procedure';
|
|
4
|
+
import type { AnyProcedure, MutationProcedure, ProcedureType, QueryProcedure, SubscriptionProcedure } from './procedure';
|
|
5
5
|
import type { GetRawInputFn, MaybePromise, Overwrite, Simplify, TypeError } from './types';
|
|
6
6
|
type IntersectIfDefined<TType, TWith> = TType extends UnsetMarker ? TWith : TWith extends UnsetMarker ? TType : Simplify<TType & TWith>;
|
|
7
7
|
/** @internal */
|
|
8
8
|
export declare const unsetMarker: unique symbol;
|
|
9
9
|
type UnsetMarker = typeof unsetMarker;
|
|
10
10
|
type DefaultValue<TValue, TFallback> = TValue extends UnsetMarker ? TFallback : TValue;
|
|
11
|
+
export type CallerOverride = (opts: {
|
|
12
|
+
args: unknown[];
|
|
13
|
+
invoke: (opts: ProcedureCallOptions) => Promise<unknown>;
|
|
14
|
+
_def: AnyProcedure['_def'];
|
|
15
|
+
}) => Promise<unknown>;
|
|
11
16
|
type ProcedureBuilderDef<TMeta> = {
|
|
12
17
|
procedure: true;
|
|
13
18
|
inputs: Parser[];
|
|
@@ -15,9 +20,20 @@ type ProcedureBuilderDef<TMeta> = {
|
|
|
15
20
|
meta?: TMeta;
|
|
16
21
|
resolver?: ProcedureBuilderResolver;
|
|
17
22
|
middlewares: AnyMiddlewareFunction[];
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated use `type` instead
|
|
25
|
+
*/
|
|
18
26
|
mutation?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated use `type` instead
|
|
29
|
+
*/
|
|
19
30
|
query?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use `type` instead
|
|
33
|
+
*/
|
|
20
34
|
subscription?: boolean;
|
|
35
|
+
type?: ProcedureType;
|
|
36
|
+
caller?: CallerOverride;
|
|
21
37
|
};
|
|
22
38
|
type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
|
|
23
39
|
/**
|
|
@@ -32,47 +48,51 @@ export interface ProcedureResolverOptions<TContext, _TMeta, TContextOverridesIn,
|
|
|
32
48
|
* A procedure resolver
|
|
33
49
|
*/
|
|
34
50
|
type ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputParserIn, $Output> = (opts: ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut>) => MaybePromise<DefaultValue<TOutputParserIn, $Output>>;
|
|
35
|
-
export type AnyProcedureBuilder = ProcedureBuilder<any, any, any, any, any, any, any>;
|
|
51
|
+
export type AnyProcedureBuilder = ProcedureBuilder<any, any, any, any, any, any, any, any>;
|
|
36
52
|
/**
|
|
37
53
|
* Infer the context type from a procedure builder
|
|
38
54
|
* Useful to create common helper functions for different procedures
|
|
39
55
|
*/
|
|
40
|
-
export type inferProcedureBuilderResolverOptions<TProcedureBuilder extends AnyProcedureBuilder> = TProcedureBuilder extends ProcedureBuilder<infer TContext, infer TMeta, infer TContextOverrides, infer _TInputIn, infer TInputOut, infer _TOutputIn, infer _TOutputOut> ? ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut extends UnsetMarker ? unknown : TInputOut extends object ? Simplify<TInputOut & {
|
|
56
|
+
export type inferProcedureBuilderResolverOptions<TProcedureBuilder extends AnyProcedureBuilder> = TProcedureBuilder extends ProcedureBuilder<infer TContext, infer TMeta, infer TContextOverrides, infer _TInputIn, infer TInputOut, infer _TOutputIn, infer _TOutputOut, infer _TCaller> ? ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut extends UnsetMarker ? unknown : TInputOut extends object ? Simplify<TInputOut & {
|
|
41
57
|
/**
|
|
42
58
|
* Extra input params might have been added by a `.input()` further down the chain
|
|
43
59
|
*/
|
|
44
60
|
[keyAddedByInputCallFurtherDown: string]: unknown;
|
|
45
61
|
}> : TInputOut> : never;
|
|
46
|
-
export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut> {
|
|
62
|
+
export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller extends boolean> {
|
|
47
63
|
/**
|
|
48
64
|
* Add an input parser to the procedure.
|
|
49
65
|
* @link https://trpc.io/docs/v11/server/validators
|
|
50
66
|
*/
|
|
51
|
-
input<$Parser extends Parser>(schema: TInputOut extends UnsetMarker ? $Parser : inferParser<$Parser>['out'] extends Record<string, unknown> | undefined ? TInputOut extends Record<string, unknown> | undefined ? undefined extends inferParser<$Parser>['out'] ? undefined extends TInputOut ? $Parser : TypeError<'Cannot chain an optional parser to a required parser'> : $Parser : TypeError<'All input parsers did not resolve to an object'> : TypeError<'All input parsers did not resolve to an object'>): ProcedureBuilder<TContext, TMeta, TContextOverrides, IntersectIfDefined<TInputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TInputOut, inferParser<$Parser>['out']>, TOutputIn, TOutputOut>;
|
|
67
|
+
input<$Parser extends Parser>(schema: TInputOut extends UnsetMarker ? $Parser : inferParser<$Parser>['out'] extends Record<string, unknown> | undefined ? TInputOut extends Record<string, unknown> | undefined ? undefined extends inferParser<$Parser>['out'] ? undefined extends TInputOut ? $Parser : TypeError<'Cannot chain an optional parser to a required parser'> : $Parser : TypeError<'All input parsers did not resolve to an object'> : TypeError<'All input parsers did not resolve to an object'>): ProcedureBuilder<TContext, TMeta, TContextOverrides, IntersectIfDefined<TInputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TInputOut, inferParser<$Parser>['out']>, TOutputIn, TOutputOut, TCaller>;
|
|
52
68
|
/**
|
|
53
69
|
* Add an output parser to the procedure.
|
|
54
70
|
* @link https://trpc.io/docs/v11/server/validators
|
|
55
71
|
*/
|
|
56
|
-
output<$Parser extends Parser>(schema: $Parser): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, IntersectIfDefined<TOutputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TOutputOut, inferParser<$Parser>['out']
|
|
72
|
+
output<$Parser extends Parser>(schema: $Parser): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, IntersectIfDefined<TOutputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TOutputOut, inferParser<$Parser>['out']>, TCaller>;
|
|
57
73
|
/**
|
|
58
74
|
* Add a meta data to the procedure.
|
|
59
75
|
* @link https://trpc.io/docs/v11/server/metadata
|
|
60
76
|
*/
|
|
61
|
-
meta(meta: TMeta): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut>;
|
|
77
|
+
meta(meta: TMeta): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller>;
|
|
62
78
|
/**
|
|
63
79
|
* Add a middleware to the procedure.
|
|
64
80
|
* @link https://trpc.io/docs/v11/server/middlewares
|
|
65
81
|
*/
|
|
66
|
-
use<$ContextOverridesOut>(fn: MiddlewareBuilder<Overwrite<TContext, TContextOverrides>, TMeta, $ContextOverridesOut, TInputOut> | MiddlewareFunction<TContext, TMeta, TContextOverrides, $ContextOverridesOut, TInputOut>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverridesOut>, TInputIn, TInputOut, TOutputIn, TOutputOut>;
|
|
82
|
+
use<$ContextOverridesOut>(fn: MiddlewareBuilder<Overwrite<TContext, TContextOverrides>, TMeta, $ContextOverridesOut, TInputOut> | MiddlewareFunction<TContext, TMeta, TContextOverrides, $ContextOverridesOut, TInputOut>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverridesOut>, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller>;
|
|
67
83
|
/**
|
|
68
84
|
* Combine two procedure builders
|
|
69
85
|
*/
|
|
70
|
-
unstable_concat<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut>(builder: Overwrite<TContext, TContextOverrides> extends $Context ? TMeta extends $Meta ? ProcedureBuilder<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut> : TypeError<'Meta mismatch'> : TypeError<'Context mismatch'>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverrides>, IntersectIfDefined<TInputIn, $InputIn>, IntersectIfDefined<TInputIn, $InputOut>, IntersectIfDefined<TOutputIn, $OutputIn>, IntersectIfDefined<TOutputOut, $OutputOut
|
|
86
|
+
unstable_concat<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut>(builder: Overwrite<TContext, TContextOverrides> extends $Context ? TMeta extends $Meta ? ProcedureBuilder<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut, TCaller> : TypeError<'Meta mismatch'> : TypeError<'Context mismatch'>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverrides>, IntersectIfDefined<TInputIn, $InputIn>, IntersectIfDefined<TInputIn, $InputOut>, IntersectIfDefined<TOutputIn, $OutputIn>, IntersectIfDefined<TOutputOut, $OutputOut>, TCaller>;
|
|
71
87
|
/**
|
|
72
88
|
* Query procedure
|
|
73
89
|
* @link https://trpc.io/docs/v11/concepts#vocabulary
|
|
74
90
|
*/
|
|
75
|
-
query<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): QueryProcedure<{
|
|
91
|
+
query<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): QueryProcedure<TCaller extends true ? {
|
|
92
|
+
experimental_caller: true;
|
|
93
|
+
input: DefaultValue<TInputIn, void>;
|
|
94
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
95
|
+
} : {
|
|
76
96
|
input: DefaultValue<TInputIn, void>;
|
|
77
97
|
output: DefaultValue<TOutputOut, $Output>;
|
|
78
98
|
}>;
|
|
@@ -80,7 +100,11 @@ export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn,
|
|
|
80
100
|
* Mutation procedure
|
|
81
101
|
* @link https://trpc.io/docs/v11/concepts#vocabulary
|
|
82
102
|
*/
|
|
83
|
-
mutation<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): MutationProcedure<{
|
|
103
|
+
mutation<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): MutationProcedure<TCaller extends true ? {
|
|
104
|
+
experimental_caller: true;
|
|
105
|
+
input: DefaultValue<TInputIn, void>;
|
|
106
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
107
|
+
} : {
|
|
84
108
|
input: DefaultValue<TInputIn, void>;
|
|
85
109
|
output: DefaultValue<TOutputOut, $Output>;
|
|
86
110
|
}>;
|
|
@@ -88,17 +112,26 @@ export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn,
|
|
|
88
112
|
* Subscription procedure
|
|
89
113
|
* @link https://trpc.io/docs/v11/concepts#vocabulary
|
|
90
114
|
*/
|
|
91
|
-
subscription<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): SubscriptionProcedure<{
|
|
115
|
+
subscription<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): SubscriptionProcedure<TCaller extends true ? {
|
|
116
|
+
experimental_caller: true;
|
|
117
|
+
input: DefaultValue<TInputIn, void>;
|
|
118
|
+
output: DefaultValue<TOutputOut, inferObservableValue<$Output>>;
|
|
119
|
+
} : {
|
|
92
120
|
input: DefaultValue<TInputIn, void>;
|
|
93
121
|
output: DefaultValue<TOutputOut, inferObservableValue<$Output>>;
|
|
94
122
|
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Overrides the way a procedure is invoked
|
|
125
|
+
* Do not use this unless you know what you're doing - this is an experimental API
|
|
126
|
+
*/
|
|
127
|
+
experimental_caller(caller: CallerOverride): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, true>;
|
|
95
128
|
/**
|
|
96
129
|
* @internal
|
|
97
130
|
*/
|
|
98
131
|
_def: ProcedureBuilderDef<TMeta>;
|
|
99
132
|
}
|
|
100
133
|
type ProcedureBuilderResolver = (opts: ProcedureResolverOptions<any, any, any, any>) => Promise<unknown>;
|
|
101
|
-
export declare function createBuilder<TContext, TMeta>(initDef?: Partial<AnyProcedureBuilderDef>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker>;
|
|
134
|
+
export declare function createBuilder<TContext, TMeta>(initDef?: Partial<AnyProcedureBuilderDef>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
|
|
102
135
|
/**
|
|
103
136
|
* @internal
|
|
104
137
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,KAAK,EAEV,YAAY,EAGZ,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,E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C,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;KACjE,CACN,CAAC;IAEF;;;OAGG;IACH,mBAAmB,CACjB,MAAM,EAAE,cAAc,GACrB,gBAAgB,CACjB,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,IAAI,CACL,CAAC;IACF;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;CAClC;AAED,KAAK,wBAAwB,GAAG,CAC9B,IAAI,EAAE,wBAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAC/C,OAAO,CAAC,OAAO,CAAC,CAAC;AAiBtB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,EAC3C,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC5C,gBAAgB,CACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,KAAK,CACN,CAqEA;AAsCD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;CACrB"}
|
|
@@ -88,12 +88,18 @@ function createBuilder(initDef = {}) {
|
|
|
88
88
|
..._def,
|
|
89
89
|
type: 'subscription'
|
|
90
90
|
}, resolver);
|
|
91
|
+
},
|
|
92
|
+
experimental_caller (caller) {
|
|
93
|
+
return createNewBuilder(_def, {
|
|
94
|
+
caller
|
|
95
|
+
});
|
|
91
96
|
}
|
|
92
97
|
};
|
|
93
98
|
return builder;
|
|
94
99
|
}
|
|
95
100
|
function createResolver(_def, resolver) {
|
|
96
101
|
const finalBuilder = createNewBuilder(_def, {
|
|
102
|
+
type: _def.type,
|
|
97
103
|
resolver,
|
|
98
104
|
middlewares: [
|
|
99
105
|
async function resolveMiddleware(opts) {
|
|
@@ -107,7 +113,20 @@ function createResolver(_def, resolver) {
|
|
|
107
113
|
}
|
|
108
114
|
]
|
|
109
115
|
});
|
|
110
|
-
|
|
116
|
+
const invoke = createProcedureCaller(finalBuilder._def);
|
|
117
|
+
const callerOverride = finalBuilder._def.caller;
|
|
118
|
+
if (!callerOverride) {
|
|
119
|
+
return invoke;
|
|
120
|
+
}
|
|
121
|
+
const callerWrapper = (...args)=>{
|
|
122
|
+
return callerOverride({
|
|
123
|
+
args,
|
|
124
|
+
invoke,
|
|
125
|
+
_def: finalBuilder._def
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
callerWrapper._def = finalBuilder._def;
|
|
129
|
+
return callerWrapper;
|
|
111
130
|
}
|
|
112
131
|
const codeblock = `
|
|
113
132
|
This is a client-only function.
|
|
@@ -86,12 +86,18 @@ function createBuilder(initDef = {}) {
|
|
|
86
86
|
..._def,
|
|
87
87
|
type: 'subscription'
|
|
88
88
|
}, resolver);
|
|
89
|
+
},
|
|
90
|
+
experimental_caller (caller) {
|
|
91
|
+
return createNewBuilder(_def, {
|
|
92
|
+
caller
|
|
93
|
+
});
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
return builder;
|
|
92
97
|
}
|
|
93
98
|
function createResolver(_def, resolver) {
|
|
94
99
|
const finalBuilder = createNewBuilder(_def, {
|
|
100
|
+
type: _def.type,
|
|
95
101
|
resolver,
|
|
96
102
|
middlewares: [
|
|
97
103
|
async function resolveMiddleware(opts) {
|
|
@@ -105,7 +111,20 @@ function createResolver(_def, resolver) {
|
|
|
105
111
|
}
|
|
106
112
|
]
|
|
107
113
|
});
|
|
108
|
-
|
|
114
|
+
const invoke = createProcedureCaller(finalBuilder._def);
|
|
115
|
+
const callerOverride = finalBuilder._def.caller;
|
|
116
|
+
if (!callerOverride) {
|
|
117
|
+
return invoke;
|
|
118
|
+
}
|
|
119
|
+
const callerWrapper = (...args)=>{
|
|
120
|
+
return callerOverride({
|
|
121
|
+
args,
|
|
122
|
+
invoke,
|
|
123
|
+
_def: finalBuilder._def
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
callerWrapper._def = finalBuilder._def;
|
|
127
|
+
return callerWrapper;
|
|
109
128
|
}
|
|
110
129
|
const codeblock = `
|
|
111
130
|
This is a client-only function.
|
|
@@ -63,7 +63,7 @@ export declare function createRouterFactory<TRoot extends AnyRootTypes>(config:
|
|
|
63
63
|
export declare function callProcedure(opts: ProcedureCallOptions & {
|
|
64
64
|
procedures: RouterRecord;
|
|
65
65
|
allowMethodOverride?: boolean;
|
|
66
|
-
}): Promise<
|
|
66
|
+
}): Promise<any>;
|
|
67
67
|
export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRecord extends RouterRecord>(router: Router<TRoot, TRecord>) => RouterCaller<TRoot, TRecord>;
|
|
68
68
|
/** @internal */
|
|
69
69
|
type MergeRouters<TRouters extends AnyRouter[], TRoot extends AnyRootTypes = TRouters[0]['_def']['_config']['$types'], TRecord extends RouterRecord = {}> = TRouters extends [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,SAAS,CAAC;AAGrD,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAA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AC,QAAQ,CAAC,EAErE,OAAO,SAAS,YAAY,GAAG,EAAE,IAC/B,QAAQ,SAAS;IACnB,MAAM,IAAI,SAAS,SAAS;IAC5B,GAAG,MAAM,IAAI,SAAS,SAAS,EAAE;CAClC,GACG,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,GAC3D,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAEhC,wBAAgB,YAAY,CAAC,QAAQ,SAAS,SAAS,EAAE,EACvD,GAAG,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,GAC3B,YAAY,CAAC,QAAQ,CAAC,CAoDxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-next.
|
|
3
|
+
"version": "11.0.0-next.322+13be792bf",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"funding": [
|
|
157
157
|
"https://trpc.io/sponsor"
|
|
158
158
|
],
|
|
159
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "13be792bf876b2f54973fbe3f1f70b68e2787582"
|
|
160
160
|
}
|
|
@@ -22,7 +22,9 @@ export interface ProcedureOptions {
|
|
|
22
22
|
interface BuiltProcedureDef {
|
|
23
23
|
input: unknown;
|
|
24
24
|
output: unknown;
|
|
25
|
+
experimental_caller?: true;
|
|
25
26
|
}
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
*
|
|
28
30
|
* @internal
|
|
@@ -45,7 +47,13 @@ export interface Procedure<
|
|
|
45
47
|
/**
|
|
46
48
|
* @internal
|
|
47
49
|
*/
|
|
48
|
-
(
|
|
50
|
+
(
|
|
51
|
+
opts: TDef['experimental_caller'] extends true
|
|
52
|
+
? TDef['input']
|
|
53
|
+
: ProcedureCallOptions,
|
|
54
|
+
): Promise<
|
|
55
|
+
TDef['experimental_caller'] extends true ? TDef['output'] : unknown
|
|
56
|
+
>;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
export interface QueryProcedure<TDef extends BuiltProcedureDef>
|
|
@@ -45,6 +45,11 @@ type DefaultValue<TValue, TFallback> = TValue extends UnsetMarker
|
|
|
45
45
|
? TFallback
|
|
46
46
|
: TValue;
|
|
47
47
|
|
|
48
|
+
export type CallerOverride = (opts: {
|
|
49
|
+
args: unknown[];
|
|
50
|
+
invoke: (opts: ProcedureCallOptions) => Promise<unknown>;
|
|
51
|
+
_def: AnyProcedure['_def'];
|
|
52
|
+
}) => Promise<unknown>;
|
|
48
53
|
type ProcedureBuilderDef<TMeta> = {
|
|
49
54
|
procedure: true;
|
|
50
55
|
inputs: Parser[];
|
|
@@ -52,9 +57,20 @@ type ProcedureBuilderDef<TMeta> = {
|
|
|
52
57
|
meta?: TMeta;
|
|
53
58
|
resolver?: ProcedureBuilderResolver;
|
|
54
59
|
middlewares: AnyMiddlewareFunction[];
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated use `type` instead
|
|
62
|
+
*/
|
|
55
63
|
mutation?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated use `type` instead
|
|
66
|
+
*/
|
|
56
67
|
query?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated use `type` instead
|
|
70
|
+
*/
|
|
57
71
|
subscription?: boolean;
|
|
72
|
+
type?: ProcedureType;
|
|
73
|
+
caller?: CallerOverride;
|
|
58
74
|
};
|
|
59
75
|
|
|
60
76
|
type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
|
|
@@ -98,6 +114,7 @@ export type AnyProcedureBuilder = ProcedureBuilder<
|
|
|
98
114
|
any,
|
|
99
115
|
any,
|
|
100
116
|
any,
|
|
117
|
+
any,
|
|
101
118
|
any
|
|
102
119
|
>;
|
|
103
120
|
|
|
@@ -114,7 +131,8 @@ export type inferProcedureBuilderResolverOptions<
|
|
|
114
131
|
infer _TInputIn,
|
|
115
132
|
infer TInputOut,
|
|
116
133
|
infer _TOutputIn,
|
|
117
|
-
infer _TOutputOut
|
|
134
|
+
infer _TOutputOut,
|
|
135
|
+
infer _TCaller
|
|
118
136
|
>
|
|
119
137
|
? ProcedureResolverOptions<
|
|
120
138
|
TContext,
|
|
@@ -144,6 +162,7 @@ export interface ProcedureBuilder<
|
|
|
144
162
|
TInputOut,
|
|
145
163
|
TOutputIn,
|
|
146
164
|
TOutputOut,
|
|
165
|
+
TCaller extends boolean,
|
|
147
166
|
> {
|
|
148
167
|
/**
|
|
149
168
|
* Add an input parser to the procedure.
|
|
@@ -168,7 +187,8 @@ export interface ProcedureBuilder<
|
|
|
168
187
|
IntersectIfDefined<TInputIn, inferParser<$Parser>['in']>,
|
|
169
188
|
IntersectIfDefined<TInputOut, inferParser<$Parser>['out']>,
|
|
170
189
|
TOutputIn,
|
|
171
|
-
TOutputOut
|
|
190
|
+
TOutputOut,
|
|
191
|
+
TCaller
|
|
172
192
|
>;
|
|
173
193
|
/**
|
|
174
194
|
* Add an output parser to the procedure.
|
|
@@ -183,7 +203,8 @@ export interface ProcedureBuilder<
|
|
|
183
203
|
TInputIn,
|
|
184
204
|
TInputOut,
|
|
185
205
|
IntersectIfDefined<TOutputIn, inferParser<$Parser>['in']>,
|
|
186
|
-
IntersectIfDefined<TOutputOut, inferParser<$Parser>['out']
|
|
206
|
+
IntersectIfDefined<TOutputOut, inferParser<$Parser>['out']>,
|
|
207
|
+
TCaller
|
|
187
208
|
>;
|
|
188
209
|
/**
|
|
189
210
|
* Add a meta data to the procedure.
|
|
@@ -198,7 +219,8 @@ export interface ProcedureBuilder<
|
|
|
198
219
|
TInputIn,
|
|
199
220
|
TInputOut,
|
|
200
221
|
TOutputIn,
|
|
201
|
-
TOutputOut
|
|
222
|
+
TOutputOut,
|
|
223
|
+
TCaller
|
|
202
224
|
>;
|
|
203
225
|
/**
|
|
204
226
|
* Add a middleware to the procedure.
|
|
@@ -226,7 +248,8 @@ export interface ProcedureBuilder<
|
|
|
226
248
|
TInputIn,
|
|
227
249
|
TInputOut,
|
|
228
250
|
TOutputIn,
|
|
229
|
-
TOutputOut
|
|
251
|
+
TOutputOut,
|
|
252
|
+
TCaller
|
|
230
253
|
>;
|
|
231
254
|
|
|
232
255
|
/**
|
|
@@ -250,7 +273,8 @@ export interface ProcedureBuilder<
|
|
|
250
273
|
$InputIn,
|
|
251
274
|
$InputOut,
|
|
252
275
|
$OutputIn,
|
|
253
|
-
$OutputOut
|
|
276
|
+
$OutputOut,
|
|
277
|
+
TCaller
|
|
254
278
|
>
|
|
255
279
|
: TypeError<'Meta mismatch'>
|
|
256
280
|
: TypeError<'Context mismatch'>,
|
|
@@ -261,7 +285,8 @@ export interface ProcedureBuilder<
|
|
|
261
285
|
IntersectIfDefined<TInputIn, $InputIn>,
|
|
262
286
|
IntersectIfDefined<TInputIn, $InputOut>,
|
|
263
287
|
IntersectIfDefined<TOutputIn, $OutputIn>,
|
|
264
|
-
IntersectIfDefined<TOutputOut, $OutputOut
|
|
288
|
+
IntersectIfDefined<TOutputOut, $OutputOut>,
|
|
289
|
+
TCaller
|
|
265
290
|
>;
|
|
266
291
|
/**
|
|
267
292
|
* Query procedure
|
|
@@ -276,10 +301,18 @@ export interface ProcedureBuilder<
|
|
|
276
301
|
TOutputIn,
|
|
277
302
|
$Output
|
|
278
303
|
>,
|
|
279
|
-
): QueryProcedure<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
304
|
+
): QueryProcedure<
|
|
305
|
+
TCaller extends true
|
|
306
|
+
? {
|
|
307
|
+
experimental_caller: true;
|
|
308
|
+
input: DefaultValue<TInputIn, void>;
|
|
309
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
310
|
+
}
|
|
311
|
+
: {
|
|
312
|
+
input: DefaultValue<TInputIn, void>;
|
|
313
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
314
|
+
}
|
|
315
|
+
>;
|
|
283
316
|
|
|
284
317
|
/**
|
|
285
318
|
* Mutation procedure
|
|
@@ -294,10 +327,18 @@ export interface ProcedureBuilder<
|
|
|
294
327
|
TOutputIn,
|
|
295
328
|
$Output
|
|
296
329
|
>,
|
|
297
|
-
): MutationProcedure<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
330
|
+
): MutationProcedure<
|
|
331
|
+
TCaller extends true
|
|
332
|
+
? {
|
|
333
|
+
experimental_caller: true;
|
|
334
|
+
input: DefaultValue<TInputIn, void>;
|
|
335
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
336
|
+
}
|
|
337
|
+
: {
|
|
338
|
+
input: DefaultValue<TInputIn, void>;
|
|
339
|
+
output: DefaultValue<TOutputOut, $Output>;
|
|
340
|
+
}
|
|
341
|
+
>;
|
|
301
342
|
|
|
302
343
|
/**
|
|
303
344
|
* Subscription procedure
|
|
@@ -312,10 +353,35 @@ export interface ProcedureBuilder<
|
|
|
312
353
|
TOutputIn,
|
|
313
354
|
$Output
|
|
314
355
|
>,
|
|
315
|
-
): SubscriptionProcedure<
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
356
|
+
): SubscriptionProcedure<
|
|
357
|
+
TCaller extends true
|
|
358
|
+
? {
|
|
359
|
+
experimental_caller: true;
|
|
360
|
+
input: DefaultValue<TInputIn, void>;
|
|
361
|
+
output: DefaultValue<TOutputOut, inferObservableValue<$Output>>;
|
|
362
|
+
}
|
|
363
|
+
: {
|
|
364
|
+
input: DefaultValue<TInputIn, void>;
|
|
365
|
+
output: DefaultValue<TOutputOut, inferObservableValue<$Output>>;
|
|
366
|
+
}
|
|
367
|
+
>;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Overrides the way a procedure is invoked
|
|
371
|
+
* Do not use this unless you know what you're doing - this is an experimental API
|
|
372
|
+
*/
|
|
373
|
+
experimental_caller(
|
|
374
|
+
caller: CallerOverride,
|
|
375
|
+
): ProcedureBuilder<
|
|
376
|
+
TContext,
|
|
377
|
+
TMeta,
|
|
378
|
+
TContextOverrides,
|
|
379
|
+
TInputIn,
|
|
380
|
+
TInputOut,
|
|
381
|
+
TOutputIn,
|
|
382
|
+
TOutputOut,
|
|
383
|
+
true
|
|
384
|
+
>;
|
|
319
385
|
/**
|
|
320
386
|
* @internal
|
|
321
387
|
*/
|
|
@@ -350,7 +416,8 @@ export function createBuilder<TContext, TMeta>(
|
|
|
350
416
|
UnsetMarker,
|
|
351
417
|
UnsetMarker,
|
|
352
418
|
UnsetMarker,
|
|
353
|
-
UnsetMarker
|
|
419
|
+
UnsetMarker,
|
|
420
|
+
false
|
|
354
421
|
> {
|
|
355
422
|
const _def: AnyProcedureBuilderDef = {
|
|
356
423
|
procedure: true,
|
|
@@ -412,6 +479,11 @@ export function createBuilder<TContext, TMeta>(
|
|
|
412
479
|
resolver,
|
|
413
480
|
) as AnySubscriptionProcedure;
|
|
414
481
|
},
|
|
482
|
+
experimental_caller(caller) {
|
|
483
|
+
return createNewBuilder(_def, {
|
|
484
|
+
caller,
|
|
485
|
+
}) as any;
|
|
486
|
+
},
|
|
415
487
|
};
|
|
416
488
|
|
|
417
489
|
return builder;
|
|
@@ -422,6 +494,7 @@ function createResolver(
|
|
|
422
494
|
resolver: AnyResolver,
|
|
423
495
|
) {
|
|
424
496
|
const finalBuilder = createNewBuilder(_def, {
|
|
497
|
+
type: _def.type,
|
|
425
498
|
resolver,
|
|
426
499
|
middlewares: [
|
|
427
500
|
async function resolveMiddleware(opts) {
|
|
@@ -435,8 +508,21 @@ function createResolver(
|
|
|
435
508
|
},
|
|
436
509
|
],
|
|
437
510
|
});
|
|
511
|
+
const invoke = createProcedureCaller(finalBuilder._def);
|
|
512
|
+
const callerOverride = finalBuilder._def.caller;
|
|
513
|
+
if (!callerOverride) {
|
|
514
|
+
return invoke;
|
|
515
|
+
}
|
|
516
|
+
const callerWrapper = (...args: unknown[]) => {
|
|
517
|
+
return callerOverride({
|
|
518
|
+
args,
|
|
519
|
+
invoke,
|
|
520
|
+
_def: finalBuilder._def as unknown as AnyProcedure['_def'],
|
|
521
|
+
});
|
|
522
|
+
};
|
|
438
523
|
|
|
439
|
-
|
|
524
|
+
callerWrapper._def = finalBuilder._def;
|
|
525
|
+
return callerWrapper;
|
|
440
526
|
}
|
|
441
527
|
|
|
442
528
|
/**
|