@trpc/server 11.0.0-alpha-tmp-02-12-response-types-idea.844 → 11.0.0-alpha-tmp-issues-6554.823
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/adapters/fetch/types.d.ts +2 -8
- package/dist/adapters/fetch/types.d.ts.map +1 -1
- package/dist/bundle-analysis.json +69 -69
- package/dist/unstable-core-do-not-import/clientish/inference.d.ts +1 -1
- package/dist/unstable-core-do-not-import/clientish/inference.d.ts.map +1 -1
- 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 -20
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +1 -20
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/initTRPC.js +0 -1
- package/dist/unstable-core-do-not-import/initTRPC.mjs +0 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +2 -4
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.js +3 -9
- package/dist/unstable-core-do-not-import/procedureBuilder.mjs +3 -9
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +1 -3
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/transformer.d.ts +1 -1
- package/package.json +182 -47
- package/src/adapters/fetch/types.ts +2 -8
- package/src/unstable-core-do-not-import/clientish/inference.ts +3 -8
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +4 -31
- package/src/unstable-core-do-not-import/initTRPC.ts +0 -1
- package/src/unstable-core-do-not-import/procedureBuilder.ts +2 -15
- package/src/unstable-core-do-not-import/rootConfig.ts +1 -3
|
@@ -9,17 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { AnyRouter, CreateContextCallback, inferRouterContext } from '../../@trpc/server';
|
|
11
11
|
import type { HTTPBaseHandlerOptions, TRPCRequestInfo } from '../../@trpc/server/http';
|
|
12
|
-
export
|
|
12
|
+
export type FetchCreateContextFnOptions = {
|
|
13
13
|
req: Request;
|
|
14
|
-
/**
|
|
15
|
-
* Used for setting headers on the `Response`
|
|
16
|
-
*/
|
|
17
14
|
resHeaders: Headers;
|
|
18
|
-
/**
|
|
19
|
-
* Info about the request
|
|
20
|
-
*/
|
|
21
15
|
info: TRPCRequestInfo;
|
|
22
|
-
}
|
|
16
|
+
};
|
|
23
17
|
export type FetchCreateContextFn<TRouter extends AnyRouter> = (opts: FetchCreateContextFnOptions) => inferRouterContext<TRouter> | Promise<inferRouterContext<TRouter>>;
|
|
24
18
|
export type FetchCreateContextOption<TRouter extends AnyRouter> = CreateContextCallback<inferRouterContext<TRouter>, FetchCreateContextFn<TRouter>>;
|
|
25
19
|
export type FetchHandlerOptions<TRouter extends AnyRouter> = FetchCreateContextOption<TRouter> & HTTPBaseHandlerOptions<TRouter, Request> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,SAAS,IAAI,CAC5D,IAAI,EAAE,2BAA2B,KAC9B,kBAAkB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,qBAAqB,CACnB,kBAAkB,CAAC,OAAO,CAAC,EAC3B,oBAAoB,CAAC,OAAO,CAAC,CAC9B,CAAC;AAEJ,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,SAAS,IACvD,wBAAwB,CAAC,OAAO,CAAC,GAC/B,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG;IACzC,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GACtC,qBAAqB,CACnB,kBAAkB,CAAC,OAAO,CAAC,EAC3B,oBAAoB,CAAC,OAAO,CAAC,CAC9B,GAAG;IACF,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 13.
|
|
2
|
+
"bundleSize": 201851,
|
|
3
|
+
"bundleOrigSize": 233664,
|
|
4
|
+
"bundleReduction": 13.61,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 21089,
|
|
9
|
+
"origSize": 19447,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"resolveResponse"
|
|
12
12
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/unstable-core-do-not-import.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 10.
|
|
17
|
+
"percent": 10.45,
|
|
18
18
|
"reduction": 0
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependents": [
|
|
31
31
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
32
32
|
],
|
|
33
|
-
"percent": 9.
|
|
33
|
+
"percent": 9.98,
|
|
34
34
|
"reduction": 0
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -47,7 +47,7 @@
|
|
|
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.
|
|
50
|
+
"percent": 9.88,
|
|
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.42,
|
|
68
68
|
"reduction": 0
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
],
|
|
78
78
|
"removedExports": [],
|
|
79
79
|
"dependents": [],
|
|
80
|
-
"percent":
|
|
80
|
+
"percent": 6.02,
|
|
81
81
|
"reduction": 11.62
|
|
82
82
|
},
|
|
83
83
|
{
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
99
99
|
"/src/unstable-core-do-not-import/http/contentType.ts"
|
|
100
100
|
],
|
|
101
|
-
"percent": 5.
|
|
101
|
+
"percent": 5.04,
|
|
102
102
|
"reduction": 29.51
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"dependents": [
|
|
113
113
|
"/src/unstable-core-do-not-import/stream/jsonl.ts"
|
|
114
114
|
],
|
|
115
|
-
"percent": 4,
|
|
115
|
+
"percent": 4.02,
|
|
116
116
|
"reduction": 0
|
|
117
117
|
},
|
|
118
118
|
{
|
|
@@ -127,13 +127,13 @@
|
|
|
127
127
|
"/src/unstable-core-do-not-import.ts",
|
|
128
128
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
129
129
|
],
|
|
130
|
-
"percent": 3.
|
|
130
|
+
"percent": 3.9,
|
|
131
131
|
"reduction": 0.83
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
135
|
-
"size":
|
|
136
|
-
"origSize":
|
|
135
|
+
"size": 5825,
|
|
136
|
+
"origSize": 16584,
|
|
137
137
|
"renderedExports": [
|
|
138
138
|
"createBuilder"
|
|
139
139
|
],
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
"/src/unstable-core-do-not-import.ts",
|
|
143
143
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
144
144
|
],
|
|
145
|
-
"percent": 2.
|
|
146
|
-
"reduction": 64.
|
|
145
|
+
"percent": 2.89,
|
|
146
|
+
"reduction": 64.88
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
"id": "/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
163
163
|
"/src/unstable-core-do-not-import/stream/utils/withPing.ts"
|
|
164
164
|
],
|
|
165
|
-
"percent": 2.
|
|
165
|
+
"percent": 2.83,
|
|
166
166
|
"reduction": 0
|
|
167
167
|
},
|
|
168
168
|
{
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"dependents": [
|
|
177
177
|
"/src/adapters/aws-lambda/index.ts"
|
|
178
178
|
],
|
|
179
|
-
"percent": 2.
|
|
179
|
+
"percent": 2.68,
|
|
180
180
|
"reduction": 12.47
|
|
181
181
|
},
|
|
182
182
|
{
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"/src/observable/operators.ts",
|
|
197
197
|
"/src/observable/behaviorSubject.ts"
|
|
198
198
|
],
|
|
199
|
-
"percent": 2.
|
|
199
|
+
"percent": 2.4,
|
|
200
200
|
"reduction": 0
|
|
201
201
|
},
|
|
202
202
|
{
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
213
213
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
214
214
|
],
|
|
215
|
-
"percent": 2.
|
|
215
|
+
"percent": 2.2,
|
|
216
216
|
"reduction": 0
|
|
217
217
|
},
|
|
218
218
|
{
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"/src/adapters/node-http/index.ts",
|
|
229
229
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
230
230
|
],
|
|
231
|
-
"percent":
|
|
231
|
+
"percent": 2.01,
|
|
232
232
|
"reduction": 6.81
|
|
233
233
|
},
|
|
234
234
|
{
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"dependents": [
|
|
247
247
|
"/src/observable/index.ts"
|
|
248
248
|
],
|
|
249
|
-
"percent": 1.
|
|
249
|
+
"percent": 1.94,
|
|
250
250
|
"reduction": 1.66
|
|
251
251
|
},
|
|
252
252
|
{
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"dependents": [
|
|
261
261
|
"/src/adapters/next-app-dir.ts"
|
|
262
262
|
],
|
|
263
|
-
"percent": 1.
|
|
263
|
+
"percent": 1.61,
|
|
264
264
|
"reduction": 22.52
|
|
265
265
|
},
|
|
266
266
|
{
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
"dependents": [
|
|
275
275
|
"/src/adapters/aws-lambda/getPlanner.ts"
|
|
276
276
|
],
|
|
277
|
-
"percent": 1.
|
|
277
|
+
"percent": 1.39,
|
|
278
278
|
"reduction": 0
|
|
279
279
|
},
|
|
280
280
|
{
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"dependents": [
|
|
290
290
|
"/src/adapters/node-http/index.ts"
|
|
291
291
|
],
|
|
292
|
-
"percent": 1.
|
|
292
|
+
"percent": 1.36,
|
|
293
293
|
"reduction": 16.3
|
|
294
294
|
},
|
|
295
295
|
{
|
|
@@ -305,17 +305,17 @@
|
|
|
305
305
|
"removedExports": [],
|
|
306
306
|
"dependents": [
|
|
307
307
|
"/src/unstable-core-do-not-import.ts",
|
|
308
|
-
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
309
308
|
"/src/unstable-core-do-not-import/router.ts",
|
|
310
|
-
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
309
|
+
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
310
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
311
311
|
],
|
|
312
|
-
"percent": 1.
|
|
312
|
+
"percent": 1.36,
|
|
313
313
|
"reduction": 45.98
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
"id": "/src/unstable-core-do-not-import/initTRPC.ts",
|
|
317
|
-
"size":
|
|
318
|
-
"origSize":
|
|
317
|
+
"size": 2664,
|
|
318
|
+
"origSize": 4501,
|
|
319
319
|
"renderedExports": [
|
|
320
320
|
"initTRPC"
|
|
321
321
|
],
|
|
@@ -323,8 +323,8 @@
|
|
|
323
323
|
"dependents": [
|
|
324
324
|
"/src/unstable-core-do-not-import.ts"
|
|
325
325
|
],
|
|
326
|
-
"percent": 1.
|
|
327
|
-
"reduction": 40.
|
|
326
|
+
"percent": 1.32,
|
|
327
|
+
"reduction": 40.81
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
330
|
"id": "/src/unstable-core-do-not-import/middleware.ts",
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
344
344
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
345
345
|
],
|
|
346
|
-
"percent": 1.
|
|
346
|
+
"percent": 1.3,
|
|
347
347
|
"reduction": 55.79
|
|
348
348
|
},
|
|
349
349
|
{
|
|
@@ -367,13 +367,13 @@
|
|
|
367
367
|
"removedExports": [],
|
|
368
368
|
"dependents": [
|
|
369
369
|
"/src/unstable-core-do-not-import.ts",
|
|
370
|
-
"/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
371
|
-
"/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
|
|
372
|
-
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
373
370
|
"/src/unstable-core-do-not-import/error/TRPCError.ts",
|
|
374
371
|
"/src/unstable-core-do-not-import/router.ts",
|
|
375
372
|
"/src/unstable-core-do-not-import/transformer.ts",
|
|
376
373
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
374
|
+
"/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
375
|
+
"/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
|
|
376
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
377
377
|
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
378
378
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
379
379
|
"/src/unstable-core-do-not-import/http/abortError.ts",
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
382
382
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
383
383
|
],
|
|
384
|
-
"percent": 1.
|
|
384
|
+
"percent": 1.22,
|
|
385
385
|
"reduction": 17.51
|
|
386
386
|
},
|
|
387
387
|
{
|
|
@@ -396,10 +396,10 @@
|
|
|
396
396
|
"removedExports": [],
|
|
397
397
|
"dependents": [
|
|
398
398
|
"/src/unstable-core-do-not-import.ts",
|
|
399
|
-
"/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
|
|
400
|
-
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
401
399
|
"/src/unstable-core-do-not-import/router.ts",
|
|
402
400
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
401
|
+
"/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
|
|
402
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
403
403
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
404
404
|
"/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
405
405
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"dependents": [
|
|
435
435
|
"/src/adapters/fetch/index.ts"
|
|
436
436
|
],
|
|
437
|
-
"percent": 1.
|
|
437
|
+
"percent": 1.11,
|
|
438
438
|
"reduction": 2.48
|
|
439
439
|
},
|
|
440
440
|
{
|
|
@@ -449,7 +449,7 @@
|
|
|
449
449
|
"/src/adapters/next-app-dir.ts",
|
|
450
450
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
451
451
|
],
|
|
452
|
-
"percent": 1.
|
|
452
|
+
"percent": 1.05,
|
|
453
453
|
"reduction": 5.4
|
|
454
454
|
},
|
|
455
455
|
{
|
|
@@ -467,8 +467,8 @@
|
|
|
467
467
|
"removedExports": [],
|
|
468
468
|
"dependents": [
|
|
469
469
|
"/src/unstable-core-do-not-import.ts",
|
|
470
|
-
"/src/unstable-core-do-not-import/
|
|
471
|
-
"/src/unstable-core-do-not-import/
|
|
470
|
+
"/src/unstable-core-do-not-import/error/getErrorShape.ts",
|
|
471
|
+
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
472
472
|
],
|
|
473
473
|
"percent": 1.03,
|
|
474
474
|
"reduction": 18.54
|
|
@@ -519,7 +519,7 @@
|
|
|
519
519
|
"/src/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.ts",
|
|
520
520
|
"/src/unstable-core-do-not-import/stream/utils/timerResource.ts"
|
|
521
521
|
],
|
|
522
|
-
"percent": 0.
|
|
522
|
+
"percent": 0.87,
|
|
523
523
|
"reduction": 4.41
|
|
524
524
|
},
|
|
525
525
|
{
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
],
|
|
532
532
|
"removedExports": [],
|
|
533
533
|
"dependents": [],
|
|
534
|
-
"percent": 0.
|
|
534
|
+
"percent": 0.84,
|
|
535
535
|
"reduction": 19.62
|
|
536
536
|
},
|
|
537
537
|
{
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
],
|
|
545
545
|
"removedExports": [],
|
|
546
546
|
"dependents": [],
|
|
547
|
-
"percent": 0.
|
|
547
|
+
"percent": 0.8,
|
|
548
548
|
"reduction": 17.81
|
|
549
549
|
},
|
|
550
550
|
{
|
|
@@ -559,7 +559,7 @@
|
|
|
559
559
|
"/src/unstable-core-do-not-import.ts",
|
|
560
560
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
561
561
|
],
|
|
562
|
-
"percent": 0.
|
|
562
|
+
"percent": 0.8,
|
|
563
563
|
"reduction": 54.01
|
|
564
564
|
},
|
|
565
565
|
{
|
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
],
|
|
572
572
|
"removedExports": [],
|
|
573
573
|
"dependents": [],
|
|
574
|
-
"percent": 0.
|
|
574
|
+
"percent": 0.66,
|
|
575
575
|
"reduction": 35.1
|
|
576
576
|
},
|
|
577
577
|
{
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
589
589
|
"/src/adapters/next-app-dir/rethrowNextErrors.ts"
|
|
590
590
|
],
|
|
591
|
-
"percent": 0.
|
|
591
|
+
"percent": 0.66,
|
|
592
592
|
"reduction": 0
|
|
593
593
|
},
|
|
594
594
|
{
|
|
@@ -603,7 +603,7 @@
|
|
|
603
603
|
"/src/adapters/fastify/index.ts",
|
|
604
604
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
605
605
|
],
|
|
606
|
-
"percent": 0.
|
|
606
|
+
"percent": 0.57,
|
|
607
607
|
"reduction": 47.55
|
|
608
608
|
},
|
|
609
609
|
{
|
|
@@ -619,7 +619,7 @@
|
|
|
619
619
|
"/src/unstable-core-do-not-import.ts",
|
|
620
620
|
"/src/unstable-core-do-not-import/http/contentType.ts"
|
|
621
621
|
],
|
|
622
|
-
"percent": 0.
|
|
622
|
+
"percent": 0.55,
|
|
623
623
|
"reduction": 15.08
|
|
624
624
|
},
|
|
625
625
|
{
|
|
@@ -633,7 +633,7 @@
|
|
|
633
633
|
"dependents": [
|
|
634
634
|
"/src/unstable-core-do-not-import.ts"
|
|
635
635
|
],
|
|
636
|
-
"percent": 0.
|
|
636
|
+
"percent": 0.53,
|
|
637
637
|
"reduction": 0
|
|
638
638
|
},
|
|
639
639
|
{
|
|
@@ -690,7 +690,7 @@
|
|
|
690
690
|
"/src/unstable-core-do-not-import.ts",
|
|
691
691
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
692
692
|
],
|
|
693
|
-
"percent": 0.
|
|
693
|
+
"percent": 0.39,
|
|
694
694
|
"reduction": 44.13
|
|
695
695
|
},
|
|
696
696
|
{
|
|
@@ -702,7 +702,7 @@
|
|
|
702
702
|
],
|
|
703
703
|
"removedExports": [],
|
|
704
704
|
"dependents": [],
|
|
705
|
-
"percent": 0.
|
|
705
|
+
"percent": 0.38,
|
|
706
706
|
"reduction": 66.61
|
|
707
707
|
},
|
|
708
708
|
{
|
|
@@ -770,7 +770,7 @@
|
|
|
770
770
|
{
|
|
771
771
|
"id": "/src/unstable-core-do-not-import/rootConfig.ts",
|
|
772
772
|
"size": 343,
|
|
773
|
-
"origSize":
|
|
773
|
+
"origSize": 3318,
|
|
774
774
|
"renderedExports": [
|
|
775
775
|
"isServerDefault"
|
|
776
776
|
],
|
|
@@ -780,7 +780,7 @@
|
|
|
780
780
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
781
781
|
],
|
|
782
782
|
"percent": 0.17,
|
|
783
|
-
"reduction": 89.
|
|
783
|
+
"reduction": 89.66
|
|
784
784
|
},
|
|
785
785
|
{
|
|
786
786
|
"id": "/src/unstable-core-do-not-import/stream/utils/createDeferred.ts",
|
|
@@ -875,31 +875,31 @@
|
|
|
875
875
|
"reduction": 93.9
|
|
876
876
|
},
|
|
877
877
|
{
|
|
878
|
-
"id": "/src/
|
|
878
|
+
"id": "/src/index.ts",
|
|
879
879
|
"size": 0,
|
|
880
|
-
"origSize":
|
|
880
|
+
"origSize": 32,
|
|
881
881
|
"renderedExports": [],
|
|
882
882
|
"removedExports": [],
|
|
883
|
-
"dependents": [
|
|
884
|
-
"/src/adapters/ws.ts"
|
|
885
|
-
],
|
|
883
|
+
"dependents": [],
|
|
886
884
|
"percent": 0,
|
|
887
885
|
"reduction": 100
|
|
888
886
|
},
|
|
889
887
|
{
|
|
890
|
-
"id": "/src/
|
|
888
|
+
"id": "/src/http.ts",
|
|
891
889
|
"size": 0,
|
|
892
|
-
"origSize":
|
|
890
|
+
"origSize": 37,
|
|
893
891
|
"renderedExports": [],
|
|
894
892
|
"removedExports": [],
|
|
895
|
-
"dependents": [
|
|
893
|
+
"dependents": [
|
|
894
|
+
"/src/adapters/ws.ts"
|
|
895
|
+
],
|
|
896
896
|
"percent": 0,
|
|
897
897
|
"reduction": 100
|
|
898
898
|
},
|
|
899
899
|
{
|
|
900
|
-
"id": "/src/
|
|
900
|
+
"id": "/src/shared.ts",
|
|
901
901
|
"size": 0,
|
|
902
|
-
"origSize":
|
|
902
|
+
"origSize": 653,
|
|
903
903
|
"renderedExports": [],
|
|
904
904
|
"removedExports": [],
|
|
905
905
|
"dependents": [],
|
|
@@ -907,9 +907,9 @@
|
|
|
907
907
|
"reduction": 100
|
|
908
908
|
},
|
|
909
909
|
{
|
|
910
|
-
"id": "/src/
|
|
910
|
+
"id": "/src/rpc.ts",
|
|
911
911
|
"size": 0,
|
|
912
|
-
"origSize":
|
|
912
|
+
"origSize": 36,
|
|
913
913
|
"renderedExports": [],
|
|
914
914
|
"removedExports": [],
|
|
915
915
|
"dependents": [],
|
|
@@ -6,7 +6,7 @@ import type { Serialize } from './serialize';
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export type inferTransformedProcedureOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> =
|
|
9
|
+
export type inferTransformedProcedureOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = inferClientTypes<TInferrable>['transformer'] extends false ? Serialize<inferProcedureOutput<TProcedure>> : inferProcedureOutput<TProcedure>;
|
|
10
10
|
/** @internal */
|
|
11
11
|
export type inferTransformedSubscriptionOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = inferClientTypes<TInferrable>['transformer'] extends false ? Serialize<inferObservableValue<inferProcedureOutput<TProcedure>>> : inferObservableValue<inferProcedureOutput<TProcedure>>;
|
|
12
12
|
export type GetInferenceHelpers<TType extends 'input' | 'output', TRoot extends AnyClientTypes, TRecord extends RouterRecord> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/clientish/inference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AAEH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,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"}
|
|
@@ -255,12 +255,6 @@ async function resolveResponse(opts) {
|
|
|
255
255
|
type: proc._def.type,
|
|
256
256
|
signal: opts.req.signal
|
|
257
257
|
});
|
|
258
|
-
if (info.isBatchCall && data instanceof Response) {
|
|
259
|
-
throw new TRPCError.TRPCError({
|
|
260
|
-
code: 'BAD_REQUEST',
|
|
261
|
-
message: 'This procedure cannot be batched - use httpLink instead'
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
258
|
return [
|
|
265
259
|
undefined,
|
|
266
260
|
{
|
|
@@ -286,21 +280,8 @@ async function resolveResponse(opts) {
|
|
|
286
280
|
});
|
|
287
281
|
// ----------- response handlers -----------
|
|
288
282
|
if (!info.isBatchCall) {
|
|
289
|
-
const call = info.calls
|
|
283
|
+
const [call] = info.calls;
|
|
290
284
|
const [error, result] = await rpcCalls[0];
|
|
291
|
-
if (!error && result?.data instanceof Response) {
|
|
292
|
-
const response = result.data;
|
|
293
|
-
if (!config.experimental?.outputResponse) {
|
|
294
|
-
throw new Error('You need to activate outputResponse in the root config to use this feature - e.g. `initTRPC.create({ experimental: { outputResponse: true } })`');
|
|
295
|
-
}
|
|
296
|
-
const headers = new Headers(response.headers);
|
|
297
|
-
headers.set('trpc-response-output', '1');
|
|
298
|
-
return new Response(response.body, {
|
|
299
|
-
status: response.status,
|
|
300
|
-
statusText: response.statusText,
|
|
301
|
-
headers
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
285
|
switch(info.type){
|
|
305
286
|
case 'unknown':
|
|
306
287
|
case 'mutation':
|
|
@@ -253,12 +253,6 @@ async function resolveResponse(opts) {
|
|
|
253
253
|
type: proc._def.type,
|
|
254
254
|
signal: opts.req.signal
|
|
255
255
|
});
|
|
256
|
-
if (info.isBatchCall && data instanceof Response) {
|
|
257
|
-
throw new TRPCError({
|
|
258
|
-
code: 'BAD_REQUEST',
|
|
259
|
-
message: 'This procedure cannot be batched - use httpLink instead'
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
256
|
return [
|
|
263
257
|
undefined,
|
|
264
258
|
{
|
|
@@ -284,21 +278,8 @@ async function resolveResponse(opts) {
|
|
|
284
278
|
});
|
|
285
279
|
// ----------- response handlers -----------
|
|
286
280
|
if (!info.isBatchCall) {
|
|
287
|
-
const call = info.calls
|
|
281
|
+
const [call] = info.calls;
|
|
288
282
|
const [error, result] = await rpcCalls[0];
|
|
289
|
-
if (!error && result?.data instanceof Response) {
|
|
290
|
-
const response = result.data;
|
|
291
|
-
if (!config.experimental?.outputResponse) {
|
|
292
|
-
throw new Error('You need to activate outputResponse in the root config to use this feature - e.g. `initTRPC.create({ experimental: { outputResponse: true } })`');
|
|
293
|
-
}
|
|
294
|
-
const headers = new Headers(response.headers);
|
|
295
|
-
headers.set('trpc-response-output', '1');
|
|
296
|
-
return new Response(response.body, {
|
|
297
|
-
status: response.status,
|
|
298
|
-
statusText: response.statusText,
|
|
299
|
-
headers
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
283
|
switch(info.type){
|
|
303
284
|
case 'unknown':
|
|
304
285
|
case 'mutation':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTRPC.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/initTRPC.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAGL,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErD,KAAK,wBAAwB,CAAC,KAAK,IACjC,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAC/E,UAAU,oBAAoB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,CAC1E,SAAQ,OAAO,CACb,IAAI,CACF,UAAU,CAAC;IACT,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC,EACF,QAAQ,GAAG,aAAa,CACzB,CACF;IACD;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC;AAED,KAAK,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,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;WAGG;;QAEH;;;WAGG;;iBAlEE,QAAQ;kBACP,KAAK;wBACC,SAAS,SAAS,QAAQ,CAAC,gBAAgB,CAAC,GACpD,iBAAiB,GACjB,wBAAwB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;yBAC3C,SAAS,SAAS,QAAQ,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG,IAAI;;iBALhE,QAAQ;kBACP,KAAK;wBACC,SAAS,SAAS,QAAQ,CAAC,gBAAgB,CAAC,GACpD,iBAAiB,GACjB,wBAAwB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;yBAC3C,SAAS,SAAS,QAAQ,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG,IAAI;;;CAiE1E;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,6BAAoB,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -2,7 +2,6 @@ import type { inferObservableValue, Observable } from '../observable';
|
|
|
2
2
|
import type { AnyMiddlewareFunction, MiddlewareBuilder, MiddlewareFunction } from './middleware';
|
|
3
3
|
import type { inferParser, Parser } from './parser';
|
|
4
4
|
import type { AnyProcedure, LegacyObservableSubscriptionProcedure, MutationProcedure, ProcedureType, QueryProcedure, SubscriptionProcedure } from './procedure';
|
|
5
|
-
import type { RootConfig } from './rootConfig';
|
|
6
5
|
import type { inferTrackedOutput } from './stream/tracked';
|
|
7
6
|
import type { GetRawInputFn, MaybePromise, Overwrite, Simplify, TypeError } from './types';
|
|
8
7
|
import type { UnsetMarker } from './utils';
|
|
@@ -20,7 +19,6 @@ export type CallerOverride<TContext> = (opts: {
|
|
|
20
19
|
_def: AnyProcedure['_def'];
|
|
21
20
|
}) => Promise<unknown>;
|
|
22
21
|
type ProcedureBuilderDef<TMeta> = {
|
|
23
|
-
_config: Partial<Pick<RootConfig<any>, 'experimental'>>;
|
|
24
22
|
procedure: true;
|
|
25
23
|
inputs: Parser[];
|
|
26
24
|
output?: Parser;
|
|
@@ -42,6 +40,7 @@ type ProcedureBuilderDef<TMeta> = {
|
|
|
42
40
|
type?: ProcedureType;
|
|
43
41
|
caller?: CallerOverride<unknown>;
|
|
44
42
|
};
|
|
43
|
+
type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
|
|
45
44
|
/**
|
|
46
45
|
* Procedure resolver options (what the `.query()`, `.mutation()`, and `.subscription()` functions receive)
|
|
47
46
|
* @internal
|
|
@@ -138,8 +137,7 @@ export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn,
|
|
|
138
137
|
_def: ProcedureBuilderDef<TMeta>;
|
|
139
138
|
}
|
|
140
139
|
type ProcedureBuilderResolver = (opts: ProcedureResolverOptions<any, any, any, any>) => Promise<unknown>;
|
|
141
|
-
|
|
142
|
-
export declare function createBuilder<TContext, TMeta>(initDef: SetRequired<Partial<ProcedureBuilderDef<TMeta>>, '_config'>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
|
|
140
|
+
export declare function createBuilder<TContext, TMeta>(initDef?: Partial<AnyProcedureBuilderDef>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false>;
|
|
143
141
|
/**
|
|
144
142
|
* @internal
|
|
145
143
|
*/
|
|
@@ -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,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtE,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,EAEZ,qCAAqC,EACrC,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,
|
|
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,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtE,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,EAEZ,qCAAqC,EACrC,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,KAAK,kBAAkB,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,SAAS,WAAW,GAC7D,KAAK,GACL,KAAK,SAAS,WAAW,GACvB,KAAK,GACL,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAE9B,KAAK,YAAY,CAAC,MAAM,EAAE,SAAS,IAAI,MAAM,SAAS,WAAW,GAC7D,SAAS,GACT,MAAM,CAAC;AAEX,KAAK,kBAAkB,CAAC,OAAO,IAC7B,OAAO,SAAS,aAAa,CAAC,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,MAAM,KAAK,CAAC,GACnE;IACE,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;CACb,GACD,KAAK,CAAC;AACZ,KAAK,u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= require('./parser.js');
|
|
|
6
6
|
var utils = require('./utils.js');
|
|
7
7
|
|
|
8
8
|
function createNewBuilder(def1, def2) {
|
|
9
|
-
const { middlewares = [], inputs, meta,
|
|
9
|
+
const { middlewares = [], inputs, meta, ...rest } = def2;
|
|
10
10
|
// TODO: maybe have a fn here to warn about calls
|
|
11
11
|
return createBuilder({
|
|
12
12
|
...utils.mergeWithoutOverrides(def1, rest),
|
|
@@ -21,16 +21,10 @@ function createNewBuilder(def1, def2) {
|
|
|
21
21
|
meta: def1.meta && meta ? {
|
|
22
22
|
...def1.meta,
|
|
23
23
|
...meta
|
|
24
|
-
} : meta ?? def1.meta
|
|
25
|
-
_config: !_config ? def1._config : {
|
|
26
|
-
experimental: {
|
|
27
|
-
...def1._config.experimental,
|
|
28
|
-
..._config.experimental
|
|
29
|
-
}
|
|
30
|
-
}
|
|
24
|
+
} : meta ?? def1.meta
|
|
31
25
|
});
|
|
32
26
|
}
|
|
33
|
-
function createBuilder(initDef) {
|
|
27
|
+
function createBuilder(initDef = {}) {
|
|
34
28
|
const _def = {
|
|
35
29
|
procedure: true,
|
|
36
30
|
inputs: [],
|
|
@@ -4,7 +4,7 @@ import { getParseFn } from './parser.mjs';
|
|
|
4
4
|
import { mergeWithoutOverrides } from './utils.mjs';
|
|
5
5
|
|
|
6
6
|
function createNewBuilder(def1, def2) {
|
|
7
|
-
const { middlewares = [], inputs, meta,
|
|
7
|
+
const { middlewares = [], inputs, meta, ...rest } = def2;
|
|
8
8
|
// TODO: maybe have a fn here to warn about calls
|
|
9
9
|
return createBuilder({
|
|
10
10
|
...mergeWithoutOverrides(def1, rest),
|
|
@@ -19,16 +19,10 @@ function createNewBuilder(def1, def2) {
|
|
|
19
19
|
meta: def1.meta && meta ? {
|
|
20
20
|
...def1.meta,
|
|
21
21
|
...meta
|
|
22
|
-
} : meta ?? def1.meta
|
|
23
|
-
_config: !_config ? def1._config : {
|
|
24
|
-
experimental: {
|
|
25
|
-
...def1._config.experimental,
|
|
26
|
-
..._config.experimental
|
|
27
|
-
}
|
|
28
|
-
}
|
|
22
|
+
} : meta ?? def1.meta
|
|
29
23
|
});
|
|
30
24
|
}
|
|
31
|
-
function createBuilder(initDef) {
|
|
25
|
+
function createBuilder(initDef = {}) {
|
|
32
26
|
const _def = {
|
|
33
27
|
procedure: true,
|
|
34
28
|
inputs: [],
|
|
@@ -71,9 +71,7 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
71
71
|
* @see https://trpc.io/docs/client/links/httpBatchStreamLink
|
|
72
72
|
*/
|
|
73
73
|
jsonl?: Pick<JSONLProducerOptions, 'pingMs'>;
|
|
74
|
-
experimental?: {
|
|
75
|
-
outputResponse?: boolean;
|
|
76
|
-
};
|
|
74
|
+
experimental?: {};
|
|
77
75
|
}
|
|
78
76
|
/**
|
|
79
77
|
* @internal
|
|
@@ -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,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,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,WAA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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"}
|
|
@@ -63,7 +63,7 @@ export declare const defaultTransformer: CombinedDataTransformer;
|
|
|
63
63
|
/**
|
|
64
64
|
* Takes a unserialized `TRPCResponse` and serializes it with the router's transformers
|
|
65
65
|
**/
|
|
66
|
-
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").
|
|
66
|
+
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").TRPCSuccessResponse<unknown> | import("./rpc").TRPCErrorResponse<import("./rpc").TRPCErrorShape<object>> | ({
|
|
67
67
|
id: import("./rpc").JSONRPC2.RequestId;
|
|
68
68
|
} & TRPCResultMessage<unknown>) | (TRPCResponse | TRPCResponseMessage)[];
|
|
69
69
|
/** @internal */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-
|
|
3
|
+
"version": "11.0.0-alpha-tmp-issues-6554.823+c4943c9f2",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,79 +24,214 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
"./package.json": "./package.json",
|
|
26
26
|
".": {
|
|
27
|
-
"import":
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"default": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
}
|
|
30
39
|
},
|
|
31
40
|
"./adapters/aws-lambda": {
|
|
32
|
-
"import":
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/adapters/aws-lambda/index.ts",
|
|
43
|
+
"default": "./dist/adapters/aws-lambda/index.mjs"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/adapters/aws-lambda/index.ts",
|
|
47
|
+
"default": "./dist/adapters/aws-lambda/index.js"
|
|
48
|
+
},
|
|
49
|
+
"default": {
|
|
50
|
+
"types": "./dist/adapters/aws-lambda/index.ts",
|
|
51
|
+
"default": "./dist/adapters/aws-lambda/index.js"
|
|
52
|
+
}
|
|
35
53
|
},
|
|
36
54
|
"./adapters/express": {
|
|
37
|
-
"import":
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
"import": {
|
|
56
|
+
"types": "./dist/adapters/express.ts",
|
|
57
|
+
"default": "./dist/adapters/express.mjs"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"types": "./dist/adapters/express.ts",
|
|
61
|
+
"default": "./dist/adapters/express.js"
|
|
62
|
+
},
|
|
63
|
+
"default": {
|
|
64
|
+
"types": "./dist/adapters/express.ts",
|
|
65
|
+
"default": "./dist/adapters/express.js"
|
|
66
|
+
}
|
|
40
67
|
},
|
|
41
68
|
"./adapters/fastify": {
|
|
42
|
-
"import":
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
"import": {
|
|
70
|
+
"types": "./dist/adapters/fastify/index.ts",
|
|
71
|
+
"default": "./dist/adapters/fastify/index.mjs"
|
|
72
|
+
},
|
|
73
|
+
"require": {
|
|
74
|
+
"types": "./dist/adapters/fastify/index.ts",
|
|
75
|
+
"default": "./dist/adapters/fastify/index.js"
|
|
76
|
+
},
|
|
77
|
+
"default": {
|
|
78
|
+
"types": "./dist/adapters/fastify/index.ts",
|
|
79
|
+
"default": "./dist/adapters/fastify/index.js"
|
|
80
|
+
}
|
|
45
81
|
},
|
|
46
82
|
"./adapters/fetch": {
|
|
47
|
-
"import":
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/adapters/fetch/index.ts",
|
|
85
|
+
"default": "./dist/adapters/fetch/index.mjs"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./dist/adapters/fetch/index.ts",
|
|
89
|
+
"default": "./dist/adapters/fetch/index.js"
|
|
90
|
+
},
|
|
91
|
+
"default": {
|
|
92
|
+
"types": "./dist/adapters/fetch/index.ts",
|
|
93
|
+
"default": "./dist/adapters/fetch/index.js"
|
|
94
|
+
}
|
|
50
95
|
},
|
|
51
96
|
"./adapters/next-app-dir": {
|
|
52
|
-
"import":
|
|
53
|
-
|
|
54
|
-
|
|
97
|
+
"import": {
|
|
98
|
+
"types": "./dist/adapters/next-app-dir.ts",
|
|
99
|
+
"default": "./dist/adapters/next-app-dir.mjs"
|
|
100
|
+
},
|
|
101
|
+
"require": {
|
|
102
|
+
"types": "./dist/adapters/next-app-dir.ts",
|
|
103
|
+
"default": "./dist/adapters/next-app-dir.js"
|
|
104
|
+
},
|
|
105
|
+
"default": {
|
|
106
|
+
"types": "./dist/adapters/next-app-dir.ts",
|
|
107
|
+
"default": "./dist/adapters/next-app-dir.js"
|
|
108
|
+
}
|
|
55
109
|
},
|
|
56
110
|
"./adapters/next": {
|
|
57
|
-
"import":
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
"import": {
|
|
112
|
+
"types": "./dist/adapters/next.ts",
|
|
113
|
+
"default": "./dist/adapters/next.mjs"
|
|
114
|
+
},
|
|
115
|
+
"require": {
|
|
116
|
+
"types": "./dist/adapters/next.ts",
|
|
117
|
+
"default": "./dist/adapters/next.js"
|
|
118
|
+
},
|
|
119
|
+
"default": {
|
|
120
|
+
"types": "./dist/adapters/next.ts",
|
|
121
|
+
"default": "./dist/adapters/next.js"
|
|
122
|
+
}
|
|
60
123
|
},
|
|
61
124
|
"./adapters/node-http": {
|
|
62
|
-
"import":
|
|
63
|
-
|
|
64
|
-
|
|
125
|
+
"import": {
|
|
126
|
+
"types": "./dist/adapters/node-http/index.ts",
|
|
127
|
+
"default": "./dist/adapters/node-http/index.mjs"
|
|
128
|
+
},
|
|
129
|
+
"require": {
|
|
130
|
+
"types": "./dist/adapters/node-http/index.ts",
|
|
131
|
+
"default": "./dist/adapters/node-http/index.js"
|
|
132
|
+
},
|
|
133
|
+
"default": {
|
|
134
|
+
"types": "./dist/adapters/node-http/index.ts",
|
|
135
|
+
"default": "./dist/adapters/node-http/index.js"
|
|
136
|
+
}
|
|
65
137
|
},
|
|
66
138
|
"./adapters/standalone": {
|
|
67
|
-
"import":
|
|
68
|
-
|
|
69
|
-
|
|
139
|
+
"import": {
|
|
140
|
+
"types": "./dist/adapters/standalone.ts",
|
|
141
|
+
"default": "./dist/adapters/standalone.mjs"
|
|
142
|
+
},
|
|
143
|
+
"require": {
|
|
144
|
+
"types": "./dist/adapters/standalone.ts",
|
|
145
|
+
"default": "./dist/adapters/standalone.js"
|
|
146
|
+
},
|
|
147
|
+
"default": {
|
|
148
|
+
"types": "./dist/adapters/standalone.ts",
|
|
149
|
+
"default": "./dist/adapters/standalone.js"
|
|
150
|
+
}
|
|
70
151
|
},
|
|
71
152
|
"./adapters/ws": {
|
|
72
|
-
"import":
|
|
73
|
-
|
|
74
|
-
|
|
153
|
+
"import": {
|
|
154
|
+
"types": "./dist/adapters/ws.ts",
|
|
155
|
+
"default": "./dist/adapters/ws.mjs"
|
|
156
|
+
},
|
|
157
|
+
"require": {
|
|
158
|
+
"types": "./dist/adapters/ws.ts",
|
|
159
|
+
"default": "./dist/adapters/ws.js"
|
|
160
|
+
},
|
|
161
|
+
"default": {
|
|
162
|
+
"types": "./dist/adapters/ws.ts",
|
|
163
|
+
"default": "./dist/adapters/ws.js"
|
|
164
|
+
}
|
|
75
165
|
},
|
|
76
166
|
"./http": {
|
|
77
|
-
"import":
|
|
78
|
-
|
|
79
|
-
|
|
167
|
+
"import": {
|
|
168
|
+
"types": "./dist/http.ts",
|
|
169
|
+
"default": "./dist/http.mjs"
|
|
170
|
+
},
|
|
171
|
+
"require": {
|
|
172
|
+
"types": "./dist/http.ts",
|
|
173
|
+
"default": "./dist/http.js"
|
|
174
|
+
},
|
|
175
|
+
"default": {
|
|
176
|
+
"types": "./dist/http.ts",
|
|
177
|
+
"default": "./dist/http.js"
|
|
178
|
+
}
|
|
80
179
|
},
|
|
81
180
|
"./observable": {
|
|
82
|
-
"import":
|
|
83
|
-
|
|
84
|
-
|
|
181
|
+
"import": {
|
|
182
|
+
"types": "./dist/observable/index.ts",
|
|
183
|
+
"default": "./dist/observable/index.mjs"
|
|
184
|
+
},
|
|
185
|
+
"require": {
|
|
186
|
+
"types": "./dist/observable/index.ts",
|
|
187
|
+
"default": "./dist/observable/index.js"
|
|
188
|
+
},
|
|
189
|
+
"default": {
|
|
190
|
+
"types": "./dist/observable/index.ts",
|
|
191
|
+
"default": "./dist/observable/index.js"
|
|
192
|
+
}
|
|
85
193
|
},
|
|
86
194
|
"./rpc": {
|
|
87
|
-
"import":
|
|
88
|
-
|
|
89
|
-
|
|
195
|
+
"import": {
|
|
196
|
+
"types": "./dist/rpc.ts",
|
|
197
|
+
"default": "./dist/rpc.mjs"
|
|
198
|
+
},
|
|
199
|
+
"require": {
|
|
200
|
+
"types": "./dist/rpc.ts",
|
|
201
|
+
"default": "./dist/rpc.js"
|
|
202
|
+
},
|
|
203
|
+
"default": {
|
|
204
|
+
"types": "./dist/rpc.ts",
|
|
205
|
+
"default": "./dist/rpc.js"
|
|
206
|
+
}
|
|
90
207
|
},
|
|
91
208
|
"./shared": {
|
|
92
|
-
"import":
|
|
93
|
-
|
|
94
|
-
|
|
209
|
+
"import": {
|
|
210
|
+
"types": "./dist/shared.ts",
|
|
211
|
+
"default": "./dist/shared.mjs"
|
|
212
|
+
},
|
|
213
|
+
"require": {
|
|
214
|
+
"types": "./dist/shared.ts",
|
|
215
|
+
"default": "./dist/shared.js"
|
|
216
|
+
},
|
|
217
|
+
"default": {
|
|
218
|
+
"types": "./dist/shared.ts",
|
|
219
|
+
"default": "./dist/shared.js"
|
|
220
|
+
}
|
|
95
221
|
},
|
|
96
222
|
"./unstable-core-do-not-import": {
|
|
97
|
-
"import":
|
|
98
|
-
|
|
99
|
-
|
|
223
|
+
"import": {
|
|
224
|
+
"types": "./dist/unstable-core-do-not-import.ts",
|
|
225
|
+
"default": "./dist/unstable-core-do-not-import.mjs"
|
|
226
|
+
},
|
|
227
|
+
"require": {
|
|
228
|
+
"types": "./dist/unstable-core-do-not-import.ts",
|
|
229
|
+
"default": "./dist/unstable-core-do-not-import.js"
|
|
230
|
+
},
|
|
231
|
+
"default": {
|
|
232
|
+
"types": "./dist/unstable-core-do-not-import.ts",
|
|
233
|
+
"default": "./dist/unstable-core-do-not-import.js"
|
|
234
|
+
}
|
|
100
235
|
}
|
|
101
236
|
},
|
|
102
237
|
"files": [
|
|
@@ -152,5 +287,5 @@
|
|
|
152
287
|
"peerDependencies": {
|
|
153
288
|
"typescript": ">=5.7.2"
|
|
154
289
|
},
|
|
155
|
-
"gitHead": "
|
|
290
|
+
"gitHead": "c4943c9f2d2aa2211ad98b4696c09f82535d8c58"
|
|
156
291
|
}
|
|
@@ -19,17 +19,11 @@ import type {
|
|
|
19
19
|
TRPCRequestInfo,
|
|
20
20
|
} from '../../@trpc/server/http';
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export type FetchCreateContextFnOptions = {
|
|
23
23
|
req: Request;
|
|
24
|
-
/**
|
|
25
|
-
* Used for setting headers on the `Response`
|
|
26
|
-
*/
|
|
27
24
|
resHeaders: Headers;
|
|
28
|
-
/**
|
|
29
|
-
* Info about the request
|
|
30
|
-
*/
|
|
31
25
|
info: TRPCRequestInfo;
|
|
32
|
-
}
|
|
26
|
+
};
|
|
33
27
|
|
|
34
28
|
export type FetchCreateContextFn<TRouter extends AnyRouter> = (
|
|
35
29
|
opts: FetchCreateContextFnOptions,
|
|
@@ -19,14 +19,9 @@ import type { Serialize } from './serialize';
|
|
|
19
19
|
export type inferTransformedProcedureOutput<
|
|
20
20
|
TInferrable extends InferrableClientTypes,
|
|
21
21
|
TProcedure extends AnyProcedure,
|
|
22
|
-
> =
|
|
23
|
-
inferProcedureOutput<TProcedure
|
|
24
|
-
|
|
25
|
-
? $Output
|
|
26
|
-
: inferClientTypes<TInferrable>['transformer'] extends false
|
|
27
|
-
? Serialize<$Output>
|
|
28
|
-
: $Output
|
|
29
|
-
: inferProcedureOutput<TProcedure>;
|
|
22
|
+
> = inferClientTypes<TInferrable>['transformer'] extends false
|
|
23
|
+
? Serialize<inferProcedureOutput<TProcedure>>
|
|
24
|
+
: inferProcedureOutput<TProcedure>;
|
|
30
25
|
/** @internal */
|
|
31
26
|
|
|
32
27
|
export type inferTransformedSubscriptionOutput<
|
|
@@ -351,14 +351,6 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
351
351
|
type: proc._def.type,
|
|
352
352
|
signal: opts.req.signal,
|
|
353
353
|
});
|
|
354
|
-
|
|
355
|
-
if (info.isBatchCall && data instanceof Response) {
|
|
356
|
-
throw new TRPCError({
|
|
357
|
-
code: 'BAD_REQUEST',
|
|
358
|
-
message: 'This procedure cannot be batched - use httpLink instead',
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
354
|
return [undefined, { data }];
|
|
363
355
|
} catch (cause) {
|
|
364
356
|
const error = getTRPCErrorFromUnknown(cause);
|
|
@@ -379,27 +371,9 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
379
371
|
|
|
380
372
|
// ----------- response handlers -----------
|
|
381
373
|
if (!info.isBatchCall) {
|
|
382
|
-
const call = info.calls
|
|
374
|
+
const [call] = info.calls;
|
|
383
375
|
const [error, result] = await rpcCalls[0]!;
|
|
384
376
|
|
|
385
|
-
if (!error && result?.data instanceof Response) {
|
|
386
|
-
const response = result.data;
|
|
387
|
-
if (!config.experimental?.outputResponse) {
|
|
388
|
-
throw new Error(
|
|
389
|
-
'You need to activate outputResponse in the root config to use this feature - e.g. `initTRPC.create({ experimental: { outputResponse: true } })`',
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const headers = new Headers(response.headers);
|
|
394
|
-
headers.set('trpc-response-output', '1');
|
|
395
|
-
|
|
396
|
-
return new Response(response.body, {
|
|
397
|
-
status: response.status,
|
|
398
|
-
statusText: response.statusText,
|
|
399
|
-
headers,
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
|
|
403
377
|
switch (info.type) {
|
|
404
378
|
case 'unknown':
|
|
405
379
|
case 'mutation':
|
|
@@ -420,8 +394,8 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
420
394
|
config,
|
|
421
395
|
ctx: ctxManager.valueOrUndefined(),
|
|
422
396
|
error,
|
|
423
|
-
input: call
|
|
424
|
-
path: call
|
|
397
|
+
input: call!.result(),
|
|
398
|
+
path: call!.path,
|
|
425
399
|
type: info.type,
|
|
426
400
|
}),
|
|
427
401
|
}
|
|
@@ -435,7 +409,6 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
435
409
|
headers,
|
|
436
410
|
untransformedJSON: [res],
|
|
437
411
|
});
|
|
438
|
-
|
|
439
412
|
return new Response(
|
|
440
413
|
JSON.stringify(transformTRPCResponse(config, res)),
|
|
441
414
|
{
|
|
@@ -464,7 +437,7 @@ export async function resolveResponse<TRouter extends AnyRouter>(
|
|
|
464
437
|
return errorToAsyncIterable(
|
|
465
438
|
new TRPCError({
|
|
466
439
|
message: `Subscription ${
|
|
467
|
-
call
|
|
440
|
+
call!.path
|
|
468
441
|
} did not return an observable or a AsyncGenerator`,
|
|
469
442
|
code: 'INTERNAL_SERVER_ERROR',
|
|
470
443
|
}),
|
|
@@ -23,7 +23,6 @@ import type {
|
|
|
23
23
|
QueryProcedure,
|
|
24
24
|
SubscriptionProcedure,
|
|
25
25
|
} from './procedure';
|
|
26
|
-
import type { RootConfig } from './rootConfig';
|
|
27
26
|
import type { inferTrackedOutput } from './stream/tracked';
|
|
28
27
|
import type {
|
|
29
28
|
GetRawInputFn,
|
|
@@ -68,7 +67,6 @@ export type CallerOverride<TContext> = (opts: {
|
|
|
68
67
|
_def: AnyProcedure['_def'];
|
|
69
68
|
}) => Promise<unknown>;
|
|
70
69
|
type ProcedureBuilderDef<TMeta> = {
|
|
71
|
-
_config: Partial<Pick<RootConfig<any>, 'experimental'>>;
|
|
72
70
|
procedure: true;
|
|
73
71
|
inputs: Parser[];
|
|
74
72
|
output?: Parser;
|
|
@@ -424,7 +422,7 @@ function createNewBuilder(
|
|
|
424
422
|
def1: AnyProcedureBuilderDef,
|
|
425
423
|
def2: Partial<AnyProcedureBuilderDef>,
|
|
426
424
|
): AnyProcedureBuilder {
|
|
427
|
-
const { middlewares = [], inputs, meta,
|
|
425
|
+
const { middlewares = [], inputs, meta, ...rest } = def2;
|
|
428
426
|
|
|
429
427
|
// TODO: maybe have a fn here to warn about calls
|
|
430
428
|
return createBuilder({
|
|
@@ -432,22 +430,11 @@ function createNewBuilder(
|
|
|
432
430
|
inputs: [...def1.inputs, ...(inputs ?? [])],
|
|
433
431
|
middlewares: [...def1.middlewares, ...middlewares],
|
|
434
432
|
meta: def1.meta && meta ? { ...def1.meta, ...meta } : (meta ?? def1.meta),
|
|
435
|
-
_config: !_config
|
|
436
|
-
? def1._config
|
|
437
|
-
: {
|
|
438
|
-
experimental: {
|
|
439
|
-
...def1._config.experimental,
|
|
440
|
-
..._config.experimental,
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
433
|
});
|
|
444
434
|
}
|
|
445
435
|
|
|
446
|
-
type SetRequired<TType, TKey extends keyof TType> = TType &
|
|
447
|
-
Required<Pick<TType, TKey>>;
|
|
448
|
-
|
|
449
436
|
export function createBuilder<TContext, TMeta>(
|
|
450
|
-
initDef:
|
|
437
|
+
initDef: Partial<AnyProcedureBuilderDef> = {},
|
|
451
438
|
): ProcedureBuilder<
|
|
452
439
|
TContext,
|
|
453
440
|
TMeta,
|
|
@@ -86,9 +86,7 @@ export interface RootConfig<TTypes extends RootTypes> {
|
|
|
86
86
|
* @see https://trpc.io/docs/client/links/httpBatchStreamLink
|
|
87
87
|
*/
|
|
88
88
|
jsonl?: Pick<JSONLProducerOptions, 'pingMs'>;
|
|
89
|
-
experimental?: {
|
|
90
|
-
outputResponse?: boolean;
|
|
91
|
-
};
|
|
89
|
+
experimental?: {};
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
/**
|