@trpc/server 11.0.0-next-alpha.148 → 11.0.0-next-alpha.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/adapters/aws-lambda/index.js +2 -2
  2. package/dist/adapters/aws-lambda/index.mjs +2 -2
  3. package/dist/adapters/express.js +3 -3
  4. package/dist/adapters/express.mjs +3 -3
  5. package/dist/adapters/fastify/index.js +2 -2
  6. package/dist/adapters/fastify/index.mjs +2 -2
  7. package/dist/adapters/fetch/index.js +2 -2
  8. package/dist/adapters/fetch/index.mjs +2 -2
  9. package/dist/adapters/next.js +3 -3
  10. package/dist/adapters/next.mjs +3 -3
  11. package/dist/adapters/node-http/index.js +3 -3
  12. package/dist/adapters/node-http/index.mjs +3 -3
  13. package/dist/adapters/standalone.js +3 -3
  14. package/dist/adapters/standalone.mjs +3 -3
  15. package/dist/adapters/ws.js +1 -1
  16. package/dist/adapters/ws.mjs +1 -1
  17. package/dist/bundle-analysis.json +28 -28
  18. package/dist/core/router.d.ts +8 -1
  19. package/dist/core/router.d.ts.map +1 -1
  20. package/dist/http/index.js +2 -2
  21. package/dist/http/index.mjs +2 -2
  22. package/dist/index.js +2 -2
  23. package/dist/index.mjs +4 -4
  24. package/dist/{nodeHTTPRequestHandler-3f218e71.js → nodeHTTPRequestHandler-a7049e69.js} +1 -1
  25. package/dist/{nodeHTTPRequestHandler-f04ea0b8.js → nodeHTTPRequestHandler-abbfb330.js} +1 -1
  26. package/dist/{nodeHTTPRequestHandler-c92e159b.mjs → nodeHTTPRequestHandler-ca65b7c9.mjs} +1 -1
  27. package/dist/{procedureBuilder-51db231f.js → procedureBuilder-0446e596.js} +1 -1
  28. package/dist/{procedureBuilder-f3a66e27.js → procedureBuilder-4b68e226.js} +1 -1
  29. package/dist/{procedureBuilder-955ce9bc.mjs → procedureBuilder-cf58dadb.mjs} +1 -1
  30. package/dist/{resolveHTTPResponse-fda30ede.mjs → resolveHTTPResponse-3ebaa4f6.mjs} +1 -1
  31. package/dist/{resolveHTTPResponse-e5110d33.js → resolveHTTPResponse-7c84e387.js} +1 -1
  32. package/dist/{resolveHTTPResponse-62594a39.js → resolveHTTPResponse-fa37ffd7.js} +1 -1
  33. package/dist/{router-05a567ea.js → router-18d63731.js} +15 -7
  34. package/dist/{router-40fcf5e5.js → router-8dcebd61.js} +10 -2
  35. package/dist/{router-8564439c.mjs → router-f9ce121f.mjs} +15 -7
  36. package/dist/unstableInternalsExport.js +2 -2
  37. package/dist/unstableInternalsExport.mjs +2 -2
  38. package/package.json +2 -2
  39. package/src/core/router.ts +28 -8
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var TRPCError = require('../../TRPCError-0b220715.js');
6
6
  require('../../config-774dae36.js');
7
7
  require('../../transformTRPCResponse-9f3b865f.js');
8
- var resolveHTTPResponse = require('../../resolveHTTPResponse-e5110d33.js');
8
+ var resolveHTTPResponse = require('../../resolveHTTPResponse-7c84e387.js');
9
9
  require('../../getCauseFromUnknown-d535264a.js');
10
10
  require('../../codes-87f6824b.js');
11
- require('../../router-05a567ea.js');
11
+ require('../../router-18d63731.js');
12
12
  require('../../index-a496f86b.js');
13
13
  require('../../contentType-a229790b.js');
14
14
 
@@ -1,10 +1,10 @@
1
1
  import { T as TRPCError } from '../../TRPCError-7e8e2a1b.mjs';
2
2
  import '../../config-50853f49.mjs';
3
3
  import '../../transformTRPCResponse-31040a38.mjs';
4
- import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-fda30ede.mjs';
4
+ import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-3ebaa4f6.mjs';
5
5
  import '../../getCauseFromUnknown-2d66414a.mjs';
6
6
  import '../../codes-c924c3db.mjs';
7
- import '../../router-8564439c.mjs';
7
+ import '../../router-f9ce121f.mjs';
8
8
  import '../../index-a9e3e610.mjs';
9
9
  import '../../contentType-31223e57.mjs';
10
10
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-3f218e71.js');
5
+ var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-a7049e69.js');
6
6
  require('../transformTRPCResponse-9f3b865f.js');
7
7
  require('../codes-87f6824b.js');
8
- require('../resolveHTTPResponse-e5110d33.js');
9
- require('../router-05a567ea.js');
8
+ require('../resolveHTTPResponse-7c84e387.js');
9
+ require('../router-18d63731.js');
10
10
  require('../TRPCError-0b220715.js');
11
11
  require('../getCauseFromUnknown-d535264a.js');
12
12
  require('../index-a496f86b.js');
@@ -1,8 +1,8 @@
1
- import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-c92e159b.mjs';
1
+ import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-ca65b7c9.mjs';
2
2
  import '../transformTRPCResponse-31040a38.mjs';
3
3
  import '../codes-c924c3db.mjs';
4
- import '../resolveHTTPResponse-fda30ede.mjs';
5
- import '../router-8564439c.mjs';
4
+ import '../resolveHTTPResponse-3ebaa4f6.mjs';
5
+ import '../router-f9ce121f.mjs';
6
6
  import '../TRPCError-7e8e2a1b.mjs';
7
7
  import '../getCauseFromUnknown-2d66414a.mjs';
8
8
  import '../index-a9e3e610.mjs';
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var node_stream = require('node:stream');
6
6
  require('../../transformTRPCResponse-9f3b865f.js');
7
- var resolveHTTPResponse = require('../../resolveHTTPResponse-e5110d33.js');
7
+ var resolveHTTPResponse = require('../../resolveHTTPResponse-7c84e387.js');
8
8
  var batchStreamFormatter = require('../../batchStreamFormatter-93cdcdd4.js');
9
9
  var adapters_ws = require('../ws.js');
10
10
  require('../../codes-87f6824b.js');
11
- require('../../router-05a567ea.js');
11
+ require('../../router-18d63731.js');
12
12
  require('../../TRPCError-0b220715.js');
13
13
  require('../../getCauseFromUnknown-d535264a.js');
14
14
  require('../../index-a496f86b.js');
@@ -1,10 +1,10 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import '../../transformTRPCResponse-31040a38.mjs';
3
- import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-fda30ede.mjs';
3
+ import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-3ebaa4f6.mjs';
4
4
  import { g as getBatchStreamFormatter } from '../../batchStreamFormatter-fc1ffb26.mjs';
5
5
  import { applyWSSHandler } from '../ws.mjs';
6
6
  import '../../codes-c924c3db.mjs';
7
- import '../../router-8564439c.mjs';
7
+ import '../../router-f9ce121f.mjs';
8
8
  import '../../TRPCError-7e8e2a1b.mjs';
9
9
  import '../../getCauseFromUnknown-2d66414a.mjs';
10
10
  import '../../index-a9e3e610.mjs';
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../transformTRPCResponse-9f3b865f.js');
6
- var resolveHTTPResponse = require('../../resolveHTTPResponse-e5110d33.js');
6
+ var resolveHTTPResponse = require('../../resolveHTTPResponse-7c84e387.js');
7
7
  var batchStreamFormatter = require('../../batchStreamFormatter-93cdcdd4.js');
8
8
  require('../../codes-87f6824b.js');
9
- require('../../router-05a567ea.js');
9
+ require('../../router-18d63731.js');
10
10
  require('../../TRPCError-0b220715.js');
11
11
  require('../../getCauseFromUnknown-d535264a.js');
12
12
  require('../../index-a496f86b.js');
@@ -1,8 +1,8 @@
1
1
  import '../../transformTRPCResponse-31040a38.mjs';
2
- import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-fda30ede.mjs';
2
+ import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-3ebaa4f6.mjs';
3
3
  import { g as getBatchStreamFormatter } from '../../batchStreamFormatter-fc1ffb26.mjs';
4
4
  import '../../codes-c924c3db.mjs';
5
- import '../../router-8564439c.mjs';
5
+ import '../../router-f9ce121f.mjs';
6
6
  import '../../TRPCError-7e8e2a1b.mjs';
7
7
  import '../../getCauseFromUnknown-2d66414a.mjs';
8
8
  import '../../index-a9e3e610.mjs';
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var TRPCError = require('../TRPCError-0b220715.js');
6
6
  var transformTRPCResponse = require('../transformTRPCResponse-9f3b865f.js');
7
- var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-3f218e71.js');
7
+ var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-a7049e69.js');
8
8
  require('../getCauseFromUnknown-d535264a.js');
9
9
  require('../codes-87f6824b.js');
10
- require('../resolveHTTPResponse-e5110d33.js');
11
- require('../router-05a567ea.js');
10
+ require('../resolveHTTPResponse-7c84e387.js');
11
+ require('../router-18d63731.js');
12
12
  require('../index-a496f86b.js');
13
13
  require('../config-774dae36.js');
14
14
  require('../contentType-a229790b.js');
@@ -1,10 +1,10 @@
1
1
  import { T as TRPCError } from '../TRPCError-7e8e2a1b.mjs';
2
2
  import { a as getErrorShape } from '../transformTRPCResponse-31040a38.mjs';
3
- import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-c92e159b.mjs';
3
+ import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-ca65b7c9.mjs';
4
4
  import '../getCauseFromUnknown-2d66414a.mjs';
5
5
  import '../codes-c924c3db.mjs';
6
- import '../resolveHTTPResponse-fda30ede.mjs';
7
- import '../router-8564439c.mjs';
6
+ import '../resolveHTTPResponse-3ebaa4f6.mjs';
7
+ import '../router-f9ce121f.mjs';
8
8
  import '../index-a9e3e610.mjs';
9
9
  import '../config-50853f49.mjs';
10
10
  import '../contentType-31223e57.mjs';
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var nodeHTTPRequestHandler = require('../../nodeHTTPRequestHandler-3f218e71.js');
5
+ var nodeHTTPRequestHandler = require('../../nodeHTTPRequestHandler-a7049e69.js');
6
6
  require('../../transformTRPCResponse-9f3b865f.js');
7
7
  require('../../codes-87f6824b.js');
8
- require('../../resolveHTTPResponse-e5110d33.js');
9
- require('../../router-05a567ea.js');
8
+ require('../../resolveHTTPResponse-7c84e387.js');
9
+ require('../../router-18d63731.js');
10
10
  require('../../TRPCError-0b220715.js');
11
11
  require('../../getCauseFromUnknown-d535264a.js');
12
12
  require('../../index-a496f86b.js');
@@ -1,8 +1,8 @@
1
- export { n as nodeHTTPRequestHandler } from '../../nodeHTTPRequestHandler-c92e159b.mjs';
1
+ export { n as nodeHTTPRequestHandler } from '../../nodeHTTPRequestHandler-ca65b7c9.mjs';
2
2
  import '../../transformTRPCResponse-31040a38.mjs';
3
3
  import '../../codes-c924c3db.mjs';
4
- import '../../resolveHTTPResponse-fda30ede.mjs';
5
- import '../../router-8564439c.mjs';
4
+ import '../../resolveHTTPResponse-3ebaa4f6.mjs';
5
+ import '../../router-f9ce121f.mjs';
6
6
  import '../../TRPCError-7e8e2a1b.mjs';
7
7
  import '../../getCauseFromUnknown-2d66414a.mjs';
8
8
  import '../../index-a9e3e610.mjs';
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var http = require('node:http');
6
- var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-3f218e71.js');
6
+ var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-a7049e69.js');
7
7
  require('../transformTRPCResponse-9f3b865f.js');
8
8
  require('../codes-87f6824b.js');
9
- require('../resolveHTTPResponse-e5110d33.js');
10
- require('../router-05a567ea.js');
9
+ require('../resolveHTTPResponse-7c84e387.js');
10
+ require('../router-18d63731.js');
11
11
  require('../TRPCError-0b220715.js');
12
12
  require('../getCauseFromUnknown-d535264a.js');
13
13
  require('../index-a496f86b.js');
@@ -1,9 +1,9 @@
1
1
  import http from 'node:http';
2
- import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-c92e159b.mjs';
2
+ import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-ca65b7c9.mjs';
3
3
  import '../transformTRPCResponse-31040a38.mjs';
4
4
  import '../codes-c924c3db.mjs';
5
- import '../resolveHTTPResponse-fda30ede.mjs';
6
- import '../router-8564439c.mjs';
5
+ import '../resolveHTTPResponse-3ebaa4f6.mjs';
6
+ import '../router-f9ce121f.mjs';
7
7
  import '../TRPCError-7e8e2a1b.mjs';
8
8
  import '../getCauseFromUnknown-2d66414a.mjs';
9
9
  import '../index-a9e3e610.mjs';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var router = require('../router-05a567ea.js');
5
+ var router = require('../router-18d63731.js');
6
6
  var TRPCError = require('../TRPCError-0b220715.js');
7
7
  require('../config-774dae36.js');
8
8
  var observable = require('../observable-464116ac.js');
@@ -1,4 +1,4 @@
1
- import { e as callProcedure } from '../router-8564439c.mjs';
1
+ import { e as callProcedure } from '../router-f9ce121f.mjs';
2
2
  import { T as TRPCError, g as getTRPCErrorFromUnknown } from '../TRPCError-7e8e2a1b.mjs';
3
3
  import '../config-50853f49.mjs';
4
4
  import { i as isObservable } from '../observable-ade1bad8.mjs';
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 97809,
3
- "bundleOrigSize": 149509,
4
- "bundleReduction": 34.58,
2
+ "bundleSize": 98207,
3
+ "bundleOrigSize": 150186,
4
+ "bundleReduction": 34.61,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/adapters/ws.ts",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
16
16
  ],
17
- "percent": 9.98,
17
+ "percent": 9.94,
18
18
  "reduction": 0
19
19
  },
20
20
  {
@@ -31,7 +31,7 @@
31
31
  "/src/http/index.ts",
32
32
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
33
33
  ],
34
- "percent": 9.53,
34
+ "percent": 9.49,
35
35
  "reduction": 22.5
36
36
  },
37
37
  {
@@ -47,7 +47,7 @@
47
47
  "dependents": [
48
48
  "/src/adapters/node-http/content-type/form-data/index.ts"
49
49
  ],
50
- "percent": 6.01,
50
+ "percent": 5.99,
51
51
  "reduction": 7.43
52
52
  },
53
53
  {
@@ -62,7 +62,7 @@
62
62
  "/src/core/initTRPC.ts",
63
63
  "/src/unstableInternalsExport.ts"
64
64
  ],
65
- "percent": 5.59,
65
+ "percent": 5.57,
66
66
  "reduction": 52.25
67
67
  },
68
68
  {
@@ -78,7 +78,7 @@
78
78
  "dependents": [
79
79
  "/src/adapters/node-http/content-type/form-data/index.ts"
80
80
  ],
81
- "percent": 5.05,
81
+ "percent": 5.03,
82
82
  "reduction": 36.93
83
83
  },
84
84
  {
@@ -102,7 +102,7 @@
102
102
  "dependents": [
103
103
  "/home/runner/work/trpc/trpc/node_modules/.pnpm/@web3-storage+multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.js"
104
104
  ],
105
- "percent": 4.55,
105
+ "percent": 4.53,
106
106
  "reduction": 35.63
107
107
  },
108
108
  {
@@ -116,13 +116,13 @@
116
116
  ],
117
117
  "removedExports": [],
118
118
  "dependents": [],
119
- "percent": 4.45,
119
+ "percent": 4.43,
120
120
  "reduction": 34.59
121
121
  },
122
122
  {
123
123
  "id": "/src/core/router.ts",
124
- "size": 3580,
125
- "origSize": 6087,
124
+ "size": 3978,
125
+ "origSize": 6764,
126
126
  "renderedExports": [
127
127
  "createRouterFactory",
128
128
  "callProcedure",
@@ -133,7 +133,7 @@
133
133
  "/src/core/initTRPC.ts",
134
134
  "/src/core/internals/mergeRouters.ts"
135
135
  ],
136
- "percent": 3.66,
136
+ "percent": 4.05,
137
137
  "reduction": 41.19
138
138
  },
139
139
  {
@@ -147,7 +147,7 @@
147
147
  "dependents": [
148
148
  "/src/adapters/node-http/index.ts"
149
149
  ],
150
- "percent": 3.65,
150
+ "percent": 3.64,
151
151
  "reduction": 14.43
152
152
  },
153
153
  {
@@ -161,7 +161,7 @@
161
161
  "dependents": [
162
162
  "/src/adapters/fetch/index.ts"
163
163
  ],
164
- "percent": 3.28,
164
+ "percent": 3.27,
165
165
  "reduction": 10.53
166
166
  },
167
167
  {
@@ -180,7 +180,7 @@
180
180
  "dependents": [
181
181
  "/src/adapters/aws-lambda/index.ts"
182
182
  ],
183
- "percent": 3.04,
183
+ "percent": 3.03,
184
184
  "reduction": 39.33
185
185
  },
186
186
  {
@@ -192,7 +192,7 @@
192
192
  ],
193
193
  "removedExports": [],
194
194
  "dependents": [],
195
- "percent": 2.79,
195
+ "percent": 2.78,
196
196
  "reduction": 49.43
197
197
  },
198
198
  {
@@ -207,7 +207,7 @@
207
207
  "/src/adapters/fastify/fastifyTRPCPlugin.ts",
208
208
  "/src/adapters/fastify/index.ts"
209
209
  ],
210
- "percent": 2.65,
210
+ "percent": 2.64,
211
211
  "reduction": 29.47
212
212
  },
213
213
  {
@@ -225,7 +225,7 @@
225
225
  "/src/core/initTRPC.ts",
226
226
  "/src/core/internals/procedureBuilder.ts"
227
227
  ],
228
- "percent": 2.54,
228
+ "percent": 2.53,
229
229
  "reduction": 56.62
230
230
  },
231
231
  {
@@ -237,7 +237,7 @@
237
237
  ],
238
238
  "removedExports": [],
239
239
  "dependents": [],
240
- "percent": 2.21,
240
+ "percent": 2.2,
241
241
  "reduction": 34.12
242
242
  },
243
243
  {
@@ -252,7 +252,7 @@
252
252
  "dependents": [
253
253
  "/src/observable/index.ts"
254
254
  ],
255
- "percent": 1.89,
255
+ "percent": 1.88,
256
256
  "reduction": 6.14
257
257
  },
258
258
  {
@@ -264,7 +264,7 @@
264
264
  ],
265
265
  "removedExports": [],
266
266
  "dependents": [],
267
- "percent": 1.73,
267
+ "percent": 1.72,
268
268
  "reduction": 0
269
269
  },
270
270
  {
@@ -279,7 +279,7 @@
279
279
  "/src/adapters/node-http/content-type/json/index.ts",
280
280
  "/src/http/resolveHTTPResponse.ts"
281
281
  ],
282
- "percent": 1.68,
282
+ "percent": 1.67,
283
283
  "reduction": 34.21
284
284
  },
285
285
  {
@@ -325,7 +325,7 @@
325
325
  "/src/shared/index.ts",
326
326
  "/src/core/router.ts"
327
327
  ],
328
- "percent": 1.54,
328
+ "percent": 1.53,
329
329
  "reduction": 5.58
330
330
  },
331
331
  {
@@ -412,7 +412,7 @@
412
412
  "dependents": [
413
413
  "/src/adapters/node-http/content-type/json/index.ts"
414
414
  ],
415
- "percent": 1.13,
415
+ "percent": 1.12,
416
416
  "reduction": 2.22
417
417
  },
418
418
  {
@@ -451,7 +451,7 @@
451
451
  "dependents": [
452
452
  "/src/rpc/index.ts"
453
453
  ],
454
- "percent": 1.04,
454
+ "percent": 1.03,
455
455
  "reduction": 23.99
456
456
  },
457
457
  {
@@ -562,7 +562,7 @@
562
562
  "/src/shared/index.ts",
563
563
  "/src/error/TRPCError.ts"
564
564
  ],
565
- "percent": 0.68,
565
+ "percent": 0.67,
566
566
  "reduction": 7.54
567
567
  },
568
568
  {
@@ -599,7 +599,7 @@
599
599
  ],
600
600
  "removedExports": [],
601
601
  "dependents": [],
602
- "percent": 0.65,
602
+ "percent": 0.64,
603
603
  "reduction": 8.15
604
604
  },
605
605
  {
@@ -1,3 +1,4 @@
1
+ import { MaybePromise } from '../types';
1
2
  import { AnyRootConfig } from './internals/config';
2
3
  import { ProcedureCallOptions } from './internals/procedureBuilder';
3
4
  import { AnyProcedure, ProcedureArgs } from './procedure';
@@ -24,7 +25,13 @@ type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord> = {
24
25
  /**
25
26
  * @internal
26
27
  */
27
- export type RouterCaller<TDef extends AnyRouterDef> = (ctx: TDef['_config']['$types']['ctx']) => DecoratedProcedureRecord<TDef['record']>;
28
+ export type RouterCaller<TDef extends AnyRouterDef> = (
29
+ /**
30
+ * @note
31
+ * If passing a function, we recommend it's a cached function
32
+ * e.g. wrapped in `React.cache` to avoid unnecessary computations
33
+ */
34
+ ctx: TDef['_config']['$types']['ctx'] | (() => MaybePromise<TDef['_config']['$types']['ctx']>)) => DecoratedProcedureRecord<TDef['record']>;
28
35
  export interface Router<TDef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AAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAChC,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KACvD,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE9C,MAAM,WAAW,MAAM,CAAC,IAAI,SAAS,YAAY;IAC/C,IAAI,EAAE,IAAI,CAAC;IACX;;;OAGG;IACH,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AA8B7C;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAC3B,OAAO,SAAS,aAAa,EAC7B,iBAAiB,SAAS,qBAAqB,IAC7C,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAC/C;;GAEG;AACH,iBAAiB,CAAC;AAEpB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,aAAa,EAC/D,MAAM,EAAE,OAAO,qIAkEhB;AAOD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,oBAAoB,GAAG;IAAE,UAAU,EAAE,qBAAqB,CAAA;CAAE,oBAYnE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,aAAa,uGAkChE"}
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var transformTRPCResponse = require('../transformTRPCResponse-9f3b865f.js');
6
- var resolveHTTPResponse = require('../resolveHTTPResponse-e5110d33.js');
6
+ var resolveHTTPResponse = require('../resolveHTTPResponse-7c84e387.js');
7
7
  var batchStreamFormatter = require('../batchStreamFormatter-93cdcdd4.js');
8
8
  require('../codes-87f6824b.js');
9
- require('../router-05a567ea.js');
9
+ require('../router-18d63731.js');
10
10
  require('../TRPCError-0b220715.js');
11
11
  require('../getCauseFromUnknown-d535264a.js');
12
12
  require('../index-a496f86b.js');
@@ -1,8 +1,8 @@
1
1
  export { T as TRPC_ERROR_CODES_BY_NUMBER, g as getHTTPStatusCode, b as getHTTPStatusCodeFromError } from '../transformTRPCResponse-31040a38.mjs';
2
- export { r as resolveHTTPResponse } from '../resolveHTTPResponse-fda30ede.mjs';
2
+ export { r as resolveHTTPResponse } from '../resolveHTTPResponse-3ebaa4f6.mjs';
3
3
  export { g as getBatchStreamFormatter } from '../batchStreamFormatter-fc1ffb26.mjs';
4
4
  import '../codes-c924c3db.mjs';
5
- import '../router-8564439c.mjs';
5
+ import '../router-f9ce121f.mjs';
6
6
  import '../TRPCError-7e8e2a1b.mjs';
7
7
  import '../getCauseFromUnknown-2d66414a.mjs';
8
8
  import '../index-a9e3e610.mjs';
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var router = require('./router-05a567ea.js');
5
+ var router = require('./router-18d63731.js');
6
6
  var TRPCError = require('./TRPCError-0b220715.js');
7
- var procedureBuilder = require('./procedureBuilder-f3a66e27.js');
7
+ var procedureBuilder = require('./procedureBuilder-4b68e226.js');
8
8
  var index = require('./index-a496f86b.js');
9
9
  var config = require('./config-774dae36.js');
10
10
  require('./getCauseFromUnknown-d535264a.js');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { d as defaultFormatter, g as getDataTransformer, a as defaultTransformer, c as createRouterFactory, b as createCallerFactory } from './router-8564439c.mjs';
2
- export { e as callProcedure, b as createCallerFactory, a as defaultTransformer, g as getDataTransformer } from './router-8564439c.mjs';
1
+ import { d as defaultFormatter, g as getDataTransformer, a as defaultTransformer, c as createRouterFactory, b as createCallerFactory } from './router-f9ce121f.mjs';
2
+ export { e as callProcedure, b as createCallerFactory, a as defaultTransformer, g as getDataTransformer } from './router-f9ce121f.mjs';
3
3
  export { T as TRPCError, g as getTRPCErrorFromUnknown } from './TRPCError-7e8e2a1b.mjs';
4
- import { c as createBuilder, a as createMiddlewareFactory, m as mergeRouters } from './procedureBuilder-955ce9bc.mjs';
5
- export { b as createInputMiddleware, d as createOutputMiddleware, e as experimental_standaloneMiddleware } from './procedureBuilder-955ce9bc.mjs';
4
+ import { c as createBuilder, a as createMiddlewareFactory, m as mergeRouters } from './procedureBuilder-cf58dadb.mjs';
5
+ export { b as createInputMiddleware, d as createOutputMiddleware, e as experimental_standaloneMiddleware } from './procedureBuilder-cf58dadb.mjs';
6
6
  import { c as createFlatProxy } from './index-a9e3e610.mjs';
7
7
  import { i as isServerDefault } from './config-50853f49.mjs';
8
8
  import './getCauseFromUnknown-2d66414a.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('./transformTRPCResponse-9f3b865f.js');
4
- var resolveHTTPResponse = require('./resolveHTTPResponse-e5110d33.js');
4
+ var resolveHTTPResponse = require('./resolveHTTPResponse-7c84e387.js');
5
5
  var batchStreamFormatter = require('./batchStreamFormatter-93cdcdd4.js');
6
6
  var adapters_nodeHttp_contentType_json_index = require('./adapters/node-http/content-type/json/index.js');
7
7
 
@@ -1,5 +1,5 @@
1
1
  import './transformTRPCResponse-59486a84.js';
2
- import { r as resolveHTTPResponse } from './resolveHTTPResponse-62594a39.js';
2
+ import { r as resolveHTTPResponse } from './resolveHTTPResponse-fa37ffd7.js';
3
3
  import { g as getBatchStreamFormatter } from './batchStreamFormatter-2c1405a1.js';
4
4
  import { nodeHTTPJSONContentTypeHandler } from './adapters/node-http/content-type/json/index.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import './transformTRPCResponse-31040a38.mjs';
2
- import { r as resolveHTTPResponse } from './resolveHTTPResponse-fda30ede.mjs';
2
+ import { r as resolveHTTPResponse } from './resolveHTTPResponse-3ebaa4f6.mjs';
3
3
  import { g as getBatchStreamFormatter } from './batchStreamFormatter-fc1ffb26.mjs';
4
4
  import { nodeHTTPJSONContentTypeHandler } from './adapters/node-http/content-type/json/index.mjs';
5
5
 
@@ -1,4 +1,4 @@
1
- import { d as defaultFormatter, a as defaultTransformer, c as createRouterFactory } from './router-40fcf5e5.js';
1
+ import { d as defaultFormatter, a as defaultTransformer, c as createRouterFactory } from './router-8dcebd61.js';
2
2
  import { T as TRPCError, g as getTRPCErrorFromUnknown } from './TRPCError-2bb6a7d0.js';
3
3
 
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var router = require('./router-05a567ea.js');
3
+ var router = require('./router-18d63731.js');
4
4
  var TRPCError = require('./TRPCError-0b220715.js');
5
5
 
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { d as defaultFormatter, a as defaultTransformer, c as createRouterFactory } from './router-8564439c.mjs';
1
+ import { d as defaultFormatter, a as defaultTransformer, c as createRouterFactory } from './router-f9ce121f.mjs';
2
2
  import { T as TRPCError, g as getTRPCErrorFromUnknown } from './TRPCError-7e8e2a1b.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { e as callProcedure } from './router-8564439c.mjs';
1
+ import { e as callProcedure } from './router-f9ce121f.mjs';
2
2
  import { T as TRPCError, g as getTRPCErrorFromUnknown } from './TRPCError-7e8e2a1b.mjs';
3
3
  import './config-50853f49.mjs';
4
4
  import { t as transformTRPCResponse, g as getHTTPStatusCode, a as getErrorShape } from './transformTRPCResponse-31040a38.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var router = require('./router-05a567ea.js');
3
+ var router = require('./router-18d63731.js');
4
4
  var TRPCError = require('./TRPCError-0b220715.js');
5
5
  require('./config-774dae36.js');
6
6
  var transformTRPCResponse = require('./transformTRPCResponse-9f3b865f.js');
@@ -1,4 +1,4 @@
1
- import { e as callProcedure } from './router-40fcf5e5.js';
1
+ import { e as callProcedure } from './router-8dcebd61.js';
2
2
  import { T as TRPCError, g as getTRPCErrorFromUnknown } from './TRPCError-2bb6a7d0.js';
3
3
  import './config-e3dd843b.js';
4
4
  import { t as transformTRPCResponse, g as getHTTPStatusCode, a as getErrorShape } from './transformTRPCResponse-59486a84.js';
@@ -131,16 +131,24 @@ function isProcedure(procedureOrRouter) {
131
131
  function createCallerFactory() {
132
132
  return function createCallerInner(router) {
133
133
  const _def = router._def;
134
- return function createCaller(ctx) {
134
+ return function createCaller(maybeContext) {
135
135
  const proxy = index.createRecursiveProxy(({ path , args })=>{
136
136
  const fullPath = path.join('.');
137
137
  const procedure = _def.procedures[fullPath];
138
- return procedure({
139
- path: fullPath,
140
- getRawInput: async ()=>args[0],
141
- ctx,
142
- type: procedure._def.type
143
- });
138
+ const callProc = (ctx)=>procedure({
139
+ path: fullPath,
140
+ getRawInput: async ()=>args[0],
141
+ ctx,
142
+ type: procedure._def.type
143
+ });
144
+ if (typeof maybeContext === 'function') {
145
+ const context = maybeContext();
146
+ if (context instanceof Promise) {
147
+ return context.then(callProc);
148
+ }
149
+ return callProc(context);
150
+ }
151
+ return callProc(maybeContext);
144
152
  });
145
153
  return proxy;
146
154
  };
@@ -126,16 +126,24 @@ function callProcedure(opts) {
126
126
  function createCallerFactory() {
127
127
  return function createCallerInner(router) {
128
128
  const _def = router._def;
129
- return function createCaller(ctx) {
129
+ return function createCaller(maybeContext) {
130
130
  const proxy = createRecursiveProxy(({ path, args }) => {
131
131
  const fullPath = path.join('.');
132
132
  const procedure = _def.procedures[fullPath];
133
- return procedure({
133
+ const callProc = (ctx) => procedure({
134
134
  path: fullPath,
135
135
  getRawInput: async () => args[0],
136
136
  ctx,
137
137
  type: procedure._def.type,
138
138
  });
139
+ if (typeof maybeContext === 'function') {
140
+ const context = maybeContext();
141
+ if (context instanceof Promise) {
142
+ return context.then(callProc);
143
+ }
144
+ return callProc(context);
145
+ }
146
+ return callProc(maybeContext);
139
147
  });
140
148
  return proxy;
141
149
  };
@@ -129,16 +129,24 @@ function isProcedure(procedureOrRouter) {
129
129
  function createCallerFactory() {
130
130
  return function createCallerInner(router) {
131
131
  const _def = router._def;
132
- return function createCaller(ctx) {
132
+ return function createCaller(maybeContext) {
133
133
  const proxy = createRecursiveProxy(({ path , args })=>{
134
134
  const fullPath = path.join('.');
135
135
  const procedure = _def.procedures[fullPath];
136
- return procedure({
137
- path: fullPath,
138
- getRawInput: async ()=>args[0],
139
- ctx,
140
- type: procedure._def.type
141
- });
136
+ const callProc = (ctx)=>procedure({
137
+ path: fullPath,
138
+ getRawInput: async ()=>args[0],
139
+ ctx,
140
+ type: procedure._def.type
141
+ });
142
+ if (typeof maybeContext === 'function') {
143
+ const context = maybeContext();
144
+ if (context instanceof Promise) {
145
+ return context.then(callProc);
146
+ }
147
+ return callProc(context);
148
+ }
149
+ return callProc(maybeContext);
142
150
  });
143
151
  return proxy;
144
152
  };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var procedureBuilder = require('./procedureBuilder-f3a66e27.js');
6
- require('./router-05a567ea.js');
5
+ var procedureBuilder = require('./procedureBuilder-4b68e226.js');
6
+ require('./router-18d63731.js');
7
7
  require('./TRPCError-0b220715.js');
8
8
  require('./getCauseFromUnknown-d535264a.js');
9
9
  require('./index-a496f86b.js');
@@ -1,5 +1,5 @@
1
- export { c as createBuilder, m as mergeRouters, f as middlewareMarker, u as unsetMarker } from './procedureBuilder-955ce9bc.mjs';
2
- import './router-8564439c.mjs';
1
+ export { c as createBuilder, m as mergeRouters, f as middlewareMarker, u as unsetMarker } from './procedureBuilder-cf58dadb.mjs';
2
+ import './router-f9ce121f.mjs';
3
3
  import './TRPCError-7e8e2a1b.mjs';
4
4
  import './getCauseFromUnknown-2d66414a.mjs';
5
5
  import './index-a9e3e610.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-next-alpha.148+ae4a74bf5",
3
+ "version": "11.0.0-next-alpha.150+9d9cbb7df",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -179,5 +179,5 @@
179
179
  "funding": [
180
180
  "https://trpc.io/sponsor"
181
181
  ],
182
- "gitHead": "ae4a74bf57b84104458272e0ca1d3e9bb74b4301"
182
+ "gitHead": "9d9cbb7df3e413aad827812495248363438da33d"
183
183
  }
@@ -2,6 +2,7 @@ import { defaultFormatter } from '../error/formatter';
2
2
  import { TRPCError } from '../error/TRPCError';
3
3
  import { createRecursiveProxy } from '../shared/createProxy';
4
4
  import { defaultTransformer } from '../transformer';
5
+ import { MaybePromise } from '../types';
5
6
  import { AnyRootConfig } from './internals/config';
6
7
  import { omitPrototype } from './internals/omitPrototype';
7
8
  import { ProcedureCallOptions } from './internals/procedureBuilder';
@@ -47,7 +48,14 @@ type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord> = {
47
48
  * @internal
48
49
  */
49
50
  export type RouterCaller<TDef extends AnyRouterDef> = (
50
- ctx: TDef['_config']['$types']['ctx'],
51
+ /**
52
+ * @note
53
+ * If passing a function, we recommend it's a cached function
54
+ * e.g. wrapped in `React.cache` to avoid unnecessary computations
55
+ */
56
+ ctx:
57
+ | TDef['_config']['$types']['ctx']
58
+ | (() => MaybePromise<TDef['_config']['$types']['ctx']>),
51
59
  ) => DecoratedProcedureRecord<TDef['record']>;
52
60
 
53
61
  export interface Router<TDef extends AnyRouterDef> {
@@ -201,18 +209,30 @@ export function createCallerFactory<TConfig extends AnyRootConfig>() {
201
209
  TRouter extends Router<AnyRouterDef<TConfig>>,
202
210
  >(router: TRouter): RouterCaller<TRouter['_def']> {
203
211
  const _def = router._def;
212
+ type Context = TConfig['$types']['ctx'];
204
213
 
205
- return function createCaller(ctx) {
214
+ return function createCaller(maybeContext) {
206
215
  const proxy = createRecursiveProxy(({ path, args }) => {
207
216
  const fullPath = path.join('.');
208
217
  const procedure = _def.procedures[fullPath] as AnyProcedure;
209
218
 
210
- return procedure({
211
- path: fullPath,
212
- getRawInput: async () => args[0],
213
- ctx,
214
- type: procedure._def.type,
215
- });
219
+ const callProc = (ctx: Context) =>
220
+ procedure({
221
+ path: fullPath,
222
+ getRawInput: async () => args[0],
223
+ ctx,
224
+ type: procedure._def.type,
225
+ });
226
+
227
+ if (typeof maybeContext === 'function') {
228
+ const context = (maybeContext as () => MaybePromise<Context>)();
229
+ if (context instanceof Promise) {
230
+ return context.then(callProc);
231
+ }
232
+ return callProc(context);
233
+ }
234
+
235
+ return callProc(maybeContext);
216
236
  });
217
237
 
218
238
  return proxy as ReturnType<RouterCaller<any>>;