@trpc/server 11.0.0-rc.374 → 11.0.0-rc.382
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/next-app-dir/nextAppDirCaller.d.ts +7 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.d.ts.map +1 -1
- package/dist/adapters/next-app-dir/nextAppDirCaller.js +6 -3
- package/dist/adapters/next-app-dir/nextAppDirCaller.mjs +6 -3
- package/dist/bundle-analysis.json +63 -63
- package/dist/unstable-core-do-not-import/utils.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/utils.js +2 -1
- package/dist/unstable-core-do-not-import/utils.mjs +2 -1
- package/package.json +2 -2
- package/src/adapters/next-app-dir/nextAppDirCaller.ts +10 -4
- package/src/unstable-core-do-not-import/utils.ts +6 -1
|
@@ -5,7 +5,13 @@ import type { MaybePromise, Simplify } from '../../unstable-core-do-not-import/t
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a caller that works with Next.js React Server Components & Server Actions
|
|
7
7
|
*/
|
|
8
|
-
export declare function nextAppDirCaller<TContext>(config: Simplify<{
|
|
8
|
+
export declare function nextAppDirCaller<TContext, TMeta>(config: Simplify<{
|
|
9
|
+
/**
|
|
10
|
+
* Extract the path from the procedure metadata
|
|
11
|
+
*/
|
|
12
|
+
pathExtractor?: (opts: {
|
|
13
|
+
meta: TMeta;
|
|
14
|
+
}) => string;
|
|
9
15
|
/**
|
|
10
16
|
* Transform form data to a `Record` before passing it to the procedure
|
|
11
17
|
* @default true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextAppDirCaller.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/nextAppDirCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAIhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAGzF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,yCAAyC,CAAC;AAKjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"nextAppDirCaller.d.ts","sourceRoot":"","sources":["../../../src/adapters/next-app-dir/nextAppDirCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAIhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAGvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAGzF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,yCAAyC,CAAC;AAKjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAC9C,MAAM,EAAE,QAAQ,CACd;IACE;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,KAAK,MAAM,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CACzD,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,CAClE,GACA,cAAc,CAAC,QAAQ,CAAC,CAwF1B"}
|
|
@@ -14,6 +14,9 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
14
14
|
return config?.createContext?.() ?? {};
|
|
15
15
|
};
|
|
16
16
|
return async (opts)=>{
|
|
17
|
+
const path = config.pathExtractor?.({
|
|
18
|
+
meta: opts._def.meta
|
|
19
|
+
}) ?? '';
|
|
17
20
|
const ctx = await createContext().catch((cause)=>{
|
|
18
21
|
const error = new TRPCError.TRPCError({
|
|
19
22
|
code: 'INTERNAL_SERVER_ERROR',
|
|
@@ -28,7 +31,7 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
28
31
|
ctx,
|
|
29
32
|
error,
|
|
30
33
|
input: opts.args[0],
|
|
31
|
-
path
|
|
34
|
+
path,
|
|
32
35
|
type: opts._def.type
|
|
33
36
|
});
|
|
34
37
|
rethrowNextErrors.rethrowNextErrors(error);
|
|
@@ -50,7 +53,7 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
50
53
|
type: opts._def.type,
|
|
51
54
|
ctx,
|
|
52
55
|
getRawInput: async ()=>input,
|
|
53
|
-
path
|
|
56
|
+
path,
|
|
54
57
|
input
|
|
55
58
|
}).then((data)=>{
|
|
56
59
|
if (data instanceof redirect.TRPCRedirectError) throw data;
|
|
@@ -64,7 +67,7 @@ var rethrowNextErrors = require('./rethrowNextErrors.js');
|
|
|
64
67
|
type: opts._def.type,
|
|
65
68
|
ctx,
|
|
66
69
|
getRawInput: async ()=>input1,
|
|
67
|
-
path
|
|
70
|
+
path,
|
|
68
71
|
input: input1
|
|
69
72
|
}).then((data)=>{
|
|
70
73
|
if (data instanceof redirect.TRPCRedirectError) throw data;
|
|
@@ -12,6 +12,9 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
12
12
|
return config?.createContext?.() ?? {};
|
|
13
13
|
};
|
|
14
14
|
return async (opts)=>{
|
|
15
|
+
const path = config.pathExtractor?.({
|
|
16
|
+
meta: opts._def.meta
|
|
17
|
+
}) ?? '';
|
|
15
18
|
const ctx = await createContext().catch((cause)=>{
|
|
16
19
|
const error = new TRPCError({
|
|
17
20
|
code: 'INTERNAL_SERVER_ERROR',
|
|
@@ -26,7 +29,7 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
26
29
|
ctx,
|
|
27
30
|
error,
|
|
28
31
|
input: opts.args[0],
|
|
29
|
-
path
|
|
32
|
+
path,
|
|
30
33
|
type: opts._def.type
|
|
31
34
|
});
|
|
32
35
|
rethrowNextErrors(error);
|
|
@@ -48,7 +51,7 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
48
51
|
type: opts._def.type,
|
|
49
52
|
ctx,
|
|
50
53
|
getRawInput: async ()=>input,
|
|
51
|
-
path
|
|
54
|
+
path,
|
|
52
55
|
input
|
|
53
56
|
}).then((data)=>{
|
|
54
57
|
if (data instanceof TRPCRedirectError) throw data;
|
|
@@ -62,7 +65,7 @@ import { rethrowNextErrors } from './rethrowNextErrors.mjs';
|
|
|
62
65
|
type: opts._def.type,
|
|
63
66
|
ctx,
|
|
64
67
|
getRawInput: async ()=>input1,
|
|
65
|
-
path
|
|
68
|
+
path,
|
|
66
69
|
input: input1
|
|
67
70
|
}).then((data)=>{
|
|
68
71
|
if (data instanceof TRPCRedirectError) throw data;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 32.
|
|
2
|
+
"bundleSize": 102969,
|
|
3
|
+
"bundleOrigSize": 151874,
|
|
4
|
+
"bundleReduction": 32.2,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/stream/stream.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"/src/unstable-core-do-not-import.ts",
|
|
18
18
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
19
19
|
],
|
|
20
|
-
"percent": 14.
|
|
20
|
+
"percent": 14.04,
|
|
21
21
|
"reduction": 9.37
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependents": [
|
|
33
33
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
34
34
|
],
|
|
35
|
-
"percent": 10.
|
|
35
|
+
"percent": 10.92,
|
|
36
36
|
"reduction": 0
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependents": [
|
|
47
47
|
"/src/unstable-core-do-not-import.ts"
|
|
48
48
|
],
|
|
49
|
-
"percent": 10.
|
|
49
|
+
"percent": 10.16,
|
|
50
50
|
"reduction": 4.19
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"/src/unstable-core-do-not-import.ts",
|
|
62
62
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
63
63
|
],
|
|
64
|
-
"percent": 6.
|
|
64
|
+
"percent": 6.14,
|
|
65
65
|
"reduction": 59.52
|
|
66
66
|
},
|
|
67
67
|
{
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
81
81
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
82
82
|
],
|
|
83
|
-
"percent": 5.
|
|
83
|
+
"percent": 5.82,
|
|
84
84
|
"reduction": 41.05
|
|
85
85
|
},
|
|
86
86
|
{
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"/src/unstable-core-do-not-import.ts",
|
|
96
96
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
97
97
|
],
|
|
98
|
-
"percent": 5.
|
|
98
|
+
"percent": 5.39,
|
|
99
99
|
"reduction": 0
|
|
100
100
|
},
|
|
101
101
|
{
|
|
@@ -109,9 +109,23 @@
|
|
|
109
109
|
"dependents": [
|
|
110
110
|
"/src/adapters/aws-lambda/index.ts"
|
|
111
111
|
],
|
|
112
|
-
"percent": 4.
|
|
112
|
+
"percent": 4.71,
|
|
113
113
|
"reduction": 13.62
|
|
114
114
|
},
|
|
115
|
+
{
|
|
116
|
+
"id": "/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
117
|
+
"size": 3135,
|
|
118
|
+
"origSize": 4032,
|
|
119
|
+
"renderedExports": [
|
|
120
|
+
"nextAppDirCaller"
|
|
121
|
+
],
|
|
122
|
+
"removedExports": [],
|
|
123
|
+
"dependents": [
|
|
124
|
+
"/src/adapters/next-app-dir.ts"
|
|
125
|
+
],
|
|
126
|
+
"percent": 3.04,
|
|
127
|
+
"reduction": 22.25
|
|
128
|
+
},
|
|
115
129
|
{
|
|
116
130
|
"id": "/src/observable/observable.ts",
|
|
117
131
|
"size": 3129,
|
|
@@ -129,20 +143,6 @@
|
|
|
129
143
|
"percent": 3.04,
|
|
130
144
|
"reduction": 0.67
|
|
131
145
|
},
|
|
132
|
-
{
|
|
133
|
-
"id": "/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
134
|
-
"size": 3050,
|
|
135
|
-
"origSize": 3818,
|
|
136
|
-
"renderedExports": [
|
|
137
|
-
"nextAppDirCaller"
|
|
138
|
-
],
|
|
139
|
-
"removedExports": [],
|
|
140
|
-
"dependents": [
|
|
141
|
-
"/src/adapters/next-app-dir.ts"
|
|
142
|
-
],
|
|
143
|
-
"percent": 2.97,
|
|
144
|
-
"reduction": 20.12
|
|
145
|
-
},
|
|
146
146
|
{
|
|
147
147
|
"id": "/src/observable/operators.ts",
|
|
148
148
|
"size": 2756,
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"/src/unstable-core-do-not-import/router.ts",
|
|
177
177
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
178
178
|
],
|
|
179
|
-
"percent": 2.
|
|
179
|
+
"percent": 2.66,
|
|
180
180
|
"reduction": 45.94
|
|
181
181
|
},
|
|
182
182
|
{
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
211
211
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
212
212
|
],
|
|
213
|
-
"percent": 2.
|
|
213
|
+
"percent": 2.55,
|
|
214
214
|
"reduction": 55.5
|
|
215
215
|
},
|
|
216
216
|
{
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
"/src/adapters/node-http/index.ts",
|
|
240
240
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
241
241
|
],
|
|
242
|
-
"percent": 2.
|
|
242
|
+
"percent": 2.11,
|
|
243
243
|
"reduction": 14.12
|
|
244
244
|
},
|
|
245
245
|
{
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
"/src/unstable-core-do-not-import.ts",
|
|
256
256
|
"/src/unstable-core-do-not-import/router.ts"
|
|
257
257
|
],
|
|
258
|
-
"percent": 1.
|
|
258
|
+
"percent": 1.94,
|
|
259
259
|
"reduction": 0
|
|
260
260
|
},
|
|
261
261
|
{
|
|
@@ -276,7 +276,7 @@
|
|
|
276
276
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
277
277
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
278
278
|
],
|
|
279
|
-
"percent": 1.
|
|
279
|
+
"percent": 1.68,
|
|
280
280
|
"reduction": 19.47
|
|
281
281
|
},
|
|
282
282
|
{
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
],
|
|
303
303
|
"removedExports": [],
|
|
304
304
|
"dependents": [],
|
|
305
|
-
"percent": 1.
|
|
305
|
+
"percent": 1.53,
|
|
306
306
|
"reduction": 21.04
|
|
307
307
|
},
|
|
308
308
|
{
|
|
@@ -361,25 +361,10 @@
|
|
|
361
361
|
"percent": 1.23,
|
|
362
362
|
"reduction": 23.5
|
|
363
363
|
},
|
|
364
|
-
{
|
|
365
|
-
"id": "/src/adapters/fastify/fastifyRequestHandler.ts",
|
|
366
|
-
"size": 1132,
|
|
367
|
-
"origSize": 2160,
|
|
368
|
-
"renderedExports": [
|
|
369
|
-
"fastifyRequestHandler"
|
|
370
|
-
],
|
|
371
|
-
"removedExports": [],
|
|
372
|
-
"dependents": [
|
|
373
|
-
"/src/adapters/fastify/index.ts",
|
|
374
|
-
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
375
|
-
],
|
|
376
|
-
"percent": 1.1,
|
|
377
|
-
"reduction": 47.59
|
|
378
|
-
},
|
|
379
364
|
{
|
|
380
365
|
"id": "/src/unstable-core-do-not-import/utils.ts",
|
|
381
|
-
"size":
|
|
382
|
-
"origSize":
|
|
366
|
+
"size": 1152,
|
|
367
|
+
"origSize": 1581,
|
|
383
368
|
"renderedExports": [
|
|
384
369
|
"unsetMarker",
|
|
385
370
|
"mergeWithoutOverrides",
|
|
@@ -401,8 +386,23 @@
|
|
|
401
386
|
"/src/unstable-core-do-not-import/procedureBuilder.ts",
|
|
402
387
|
"/src/unstable-core-do-not-import/stream/stream.ts"
|
|
403
388
|
],
|
|
404
|
-
"percent": 1.
|
|
405
|
-
"reduction":
|
|
389
|
+
"percent": 1.12,
|
|
390
|
+
"reduction": 27.13
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"id": "/src/adapters/fastify/fastifyRequestHandler.ts",
|
|
394
|
+
"size": 1132,
|
|
395
|
+
"origSize": 2160,
|
|
396
|
+
"renderedExports": [
|
|
397
|
+
"fastifyRequestHandler"
|
|
398
|
+
],
|
|
399
|
+
"removedExports": [],
|
|
400
|
+
"dependents": [
|
|
401
|
+
"/src/adapters/fastify/index.ts",
|
|
402
|
+
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
403
|
+
],
|
|
404
|
+
"percent": 1.1,
|
|
405
|
+
"reduction": 47.59
|
|
406
406
|
},
|
|
407
407
|
{
|
|
408
408
|
"id": "/src/unstable-core-do-not-import/parser.ts",
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
"/src/unstable-core-do-not-import.ts",
|
|
417
417
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
418
418
|
],
|
|
419
|
-
"percent": 0.
|
|
419
|
+
"percent": 0.96,
|
|
420
420
|
"reduction": 56.22
|
|
421
421
|
},
|
|
422
422
|
{
|
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
"dependents": [
|
|
448
448
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
449
449
|
],
|
|
450
|
-
"percent": 0.
|
|
450
|
+
"percent": 0.79,
|
|
451
451
|
"reduction": 0.97
|
|
452
452
|
},
|
|
453
453
|
{
|
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
"dependents": [
|
|
571
571
|
"/src/unstable-core-do-not-import.ts"
|
|
572
572
|
],
|
|
573
|
-
"percent": 0.
|
|
573
|
+
"percent": 0.21,
|
|
574
574
|
"reduction": 94.55
|
|
575
575
|
},
|
|
576
576
|
{
|
|
@@ -715,27 +715,27 @@
|
|
|
715
715
|
"reduction": 100
|
|
716
716
|
},
|
|
717
717
|
{
|
|
718
|
-
"id": "/src/adapters/
|
|
718
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
719
719
|
"size": 0,
|
|
720
|
-
"origSize":
|
|
720
|
+
"origSize": 64,
|
|
721
721
|
"renderedExports": [],
|
|
722
722
|
"removedExports": [],
|
|
723
|
-
"dependents": [
|
|
724
|
-
"/src/adapters/express.ts",
|
|
725
|
-
"/src/adapters/standalone.ts",
|
|
726
|
-
"/src/adapters/next.ts",
|
|
727
|
-
"/src/adapters/fastify/fastifyRequestHandler.ts"
|
|
728
|
-
],
|
|
723
|
+
"dependents": [],
|
|
729
724
|
"percent": 0,
|
|
730
725
|
"reduction": 100
|
|
731
726
|
},
|
|
732
727
|
{
|
|
733
|
-
"id": "/src/adapters/
|
|
728
|
+
"id": "/src/adapters/node-http/index.ts",
|
|
734
729
|
"size": 0,
|
|
735
|
-
"origSize":
|
|
730
|
+
"origSize": 111,
|
|
736
731
|
"renderedExports": [],
|
|
737
732
|
"removedExports": [],
|
|
738
|
-
"dependents": [
|
|
733
|
+
"dependents": [
|
|
734
|
+
"/src/adapters/express.ts",
|
|
735
|
+
"/src/adapters/next.ts",
|
|
736
|
+
"/src/adapters/standalone.ts",
|
|
737
|
+
"/src/adapters/fastify/fastifyRequestHandler.ts"
|
|
738
|
+
],
|
|
739
739
|
"percent": 0,
|
|
740
740
|
"reduction": 100
|
|
741
741
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GACxB,KAAK,CAYP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,KAAK,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;AACxE,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,KAAK,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,GAAG,EAAE,IAAI,GACR,IAAI,CAEN;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GACxB,KAAK,CAYP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,KAAK,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;AACxE,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,KAAK,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,GAAG,EAAE,IAAI,GACR,IAAI,CAEN;AAKD,wBAAgB,eAAe,CAAC,MAAM,EACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,aAAa,CAAC,MAAM,CAAC,CAIhC"}
|
|
@@ -31,8 +31,9 @@ function isFunction(fn) {
|
|
|
31
31
|
*/ function omitPrototype(obj) {
|
|
32
32
|
return Object.assign(Object.create(null), obj);
|
|
33
33
|
}
|
|
34
|
+
const asyncIteratorsSupported = typeof Symbol === 'function' && !!Symbol.asyncIterator;
|
|
34
35
|
function isAsyncIterable(value) {
|
|
35
|
-
return isObject(value) && Symbol.asyncIterator in value;
|
|
36
|
+
return asyncIteratorsSupported && isObject(value) && Symbol.asyncIterator in value;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
exports.isAsyncIterable = isAsyncIterable;
|
|
@@ -29,8 +29,9 @@ function isFunction(fn) {
|
|
|
29
29
|
*/ function omitPrototype(obj) {
|
|
30
30
|
return Object.assign(Object.create(null), obj);
|
|
31
31
|
}
|
|
32
|
+
const asyncIteratorsSupported = typeof Symbol === 'function' && !!Symbol.asyncIterator;
|
|
32
33
|
function isAsyncIterable(value) {
|
|
33
|
-
return isObject(value) && Symbol.asyncIterator in value;
|
|
34
|
+
return asyncIteratorsSupported && isObject(value) && Symbol.asyncIterator in value;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export { isAsyncIterable, isFunction, isObject, mergeWithoutOverrides, omitPrototype, unsetMarker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.382+94f198fec",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"funding": [
|
|
150
150
|
"https://trpc.io/sponsor"
|
|
151
151
|
],
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "94f198fece23e9328f7a30d1badf74de524b0ebb"
|
|
153
153
|
}
|
|
@@ -19,9 +19,13 @@ import { rethrowNextErrors } from './rethrowNextErrors';
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a caller that works with Next.js React Server Components & Server Actions
|
|
21
21
|
*/
|
|
22
|
-
export function nextAppDirCaller<TContext>(
|
|
22
|
+
export function nextAppDirCaller<TContext, TMeta>(
|
|
23
23
|
config: Simplify<
|
|
24
24
|
{
|
|
25
|
+
/**
|
|
26
|
+
* Extract the path from the procedure metadata
|
|
27
|
+
*/
|
|
28
|
+
pathExtractor?: (opts: { meta: TMeta }) => string;
|
|
25
29
|
/**
|
|
26
30
|
* Transform form data to a `Record` before passing it to the procedure
|
|
27
31
|
* @default true
|
|
@@ -43,6 +47,8 @@ export function nextAppDirCaller<TContext>(
|
|
|
43
47
|
return config?.createContext?.() ?? ({} as TContext);
|
|
44
48
|
};
|
|
45
49
|
return async (opts) => {
|
|
50
|
+
const path =
|
|
51
|
+
config.pathExtractor?.({ meta: opts._def.meta as TMeta }) ?? '';
|
|
46
52
|
const ctx: TContext = await createContext().catch((cause) => {
|
|
47
53
|
const error = new TRPCError({
|
|
48
54
|
code: 'INTERNAL_SERVER_ERROR',
|
|
@@ -60,7 +66,7 @@ export function nextAppDirCaller<TContext>(
|
|
|
60
66
|
ctx,
|
|
61
67
|
error,
|
|
62
68
|
input: opts.args[0],
|
|
63
|
-
path
|
|
69
|
+
path,
|
|
64
70
|
type: opts._def.type,
|
|
65
71
|
});
|
|
66
72
|
|
|
@@ -86,7 +92,7 @@ export function nextAppDirCaller<TContext>(
|
|
|
86
92
|
type: opts._def.type,
|
|
87
93
|
ctx,
|
|
88
94
|
getRawInput: async () => input,
|
|
89
|
-
path
|
|
95
|
+
path,
|
|
90
96
|
input,
|
|
91
97
|
})
|
|
92
98
|
.then((data) => {
|
|
@@ -102,7 +108,7 @@ export function nextAppDirCaller<TContext>(
|
|
|
102
108
|
type: opts._def.type,
|
|
103
109
|
ctx,
|
|
104
110
|
getRawInput: async () => input,
|
|
105
|
-
path
|
|
111
|
+
path,
|
|
106
112
|
input,
|
|
107
113
|
})
|
|
108
114
|
.then((data) => {
|
|
@@ -46,8 +46,13 @@ export function omitPrototype<TObj extends Record<string, unknown>>(
|
|
|
46
46
|
return Object.assign(Object.create(null), obj);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
const asyncIteratorsSupported =
|
|
50
|
+
typeof Symbol === 'function' && !!Symbol.asyncIterator;
|
|
51
|
+
|
|
49
52
|
export function isAsyncIterable<TValue>(
|
|
50
53
|
value: unknown,
|
|
51
54
|
): value is AsyncIterable<TValue> {
|
|
52
|
-
return
|
|
55
|
+
return (
|
|
56
|
+
asyncIteratorsSupported && isObject(value) && Symbol.asyncIterator in value
|
|
57
|
+
);
|
|
53
58
|
}
|