@trpc/server 11.0.0-rc.402 → 11.0.0-rc.413

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getPlanner.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/getPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAExE,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AActC;;IAEI;AACJ,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI,MAAM,SAAS,oBAAoB,GACtE,qBAAqB,GACrB,MAAM,SAAS,sBAAsB,GACrC,iCAAiC,GACjC,KAAK,CAAC;AA0HV,wBAAgB,UAAU,CAAC,MAAM,SAAS,WAAW,EAAE,KAAK,EAAE,MAAM;;;;EAoCnE"}
1
+ {"version":3,"file":"getPlanner.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws-lambda/getPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAExE,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,iCAAiC,CAAC;AActC;;IAEI;AACJ,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI,MAAM,SAAS,oBAAoB,GACtE,qBAAqB,GACrB,MAAM,SAAS,sBAAsB,GACrC,iCAAiC,GACjC,KAAK,CAAC;AA6IV,wBAAgB,UAAU,CAAC,MAAM,SAAS,WAAW,EAAE,KAAK,EAAE,MAAM;;;;EAoCnE"}
@@ -11,6 +11,15 @@ function determinePayloadFormat(event) {
11
11
  return unknownEvent.version;
12
12
  }
13
13
  }
14
+ function getHeadersAndCookiesFromResponse(response) {
15
+ const headers = Object.fromEntries(response.headers.entries());
16
+ const cookies = response.headers.getSetCookie().flatMap((value)=>value.split(',')).map((cookie)=>cookie.trim());
17
+ delete headers['set-cookie'];
18
+ return {
19
+ headers,
20
+ cookies
21
+ };
22
+ }
14
23
  const v1Processor = {
15
24
  // same as getPath above
16
25
  getTRPCPath: (event)=>{
@@ -59,10 +68,16 @@ const v1Processor = {
59
68
  },
60
69
  getMethod: (event)=>event.httpMethod,
61
70
  toResult: async (response)=>{
71
+ const { headers , cookies } = getHeadersAndCookiesFromResponse(response);
62
72
  const result = {
73
+ ...cookies.length && {
74
+ multiValueHeaders: {
75
+ 'set-cookie': cookies
76
+ }
77
+ },
63
78
  statusCode: response.status,
64
79
  body: await response.text(),
65
- headers: Object.fromEntries(response.headers.entries())
80
+ headers
66
81
  };
67
82
  return result;
68
83
  }
@@ -100,10 +115,12 @@ const v2Processor = {
100
115
  },
101
116
  getMethod: (event)=>event.requestContext.http.method,
102
117
  toResult: async (response)=>{
118
+ const { headers , cookies } = getHeadersAndCookiesFromResponse(response);
103
119
  const result = {
120
+ cookies,
104
121
  statusCode: response.status,
105
122
  body: await response.text(),
106
- headers: Object.fromEntries(response.headers.entries())
123
+ headers
107
124
  };
108
125
  return result;
109
126
  }
@@ -9,6 +9,15 @@ function determinePayloadFormat(event) {
9
9
  return unknownEvent.version;
10
10
  }
11
11
  }
12
+ function getHeadersAndCookiesFromResponse(response) {
13
+ const headers = Object.fromEntries(response.headers.entries());
14
+ const cookies = response.headers.getSetCookie().flatMap((value)=>value.split(',')).map((cookie)=>cookie.trim());
15
+ delete headers['set-cookie'];
16
+ return {
17
+ headers,
18
+ cookies
19
+ };
20
+ }
12
21
  const v1Processor = {
13
22
  // same as getPath above
14
23
  getTRPCPath: (event)=>{
@@ -57,10 +66,16 @@ const v1Processor = {
57
66
  },
58
67
  getMethod: (event)=>event.httpMethod,
59
68
  toResult: async (response)=>{
69
+ const { headers , cookies } = getHeadersAndCookiesFromResponse(response);
60
70
  const result = {
71
+ ...cookies.length && {
72
+ multiValueHeaders: {
73
+ 'set-cookie': cookies
74
+ }
75
+ },
61
76
  statusCode: response.status,
62
77
  body: await response.text(),
63
- headers: Object.fromEntries(response.headers.entries())
78
+ headers
64
79
  };
65
80
  return result;
66
81
  }
@@ -98,10 +113,12 @@ const v2Processor = {
98
113
  },
99
114
  getMethod: (event)=>event.requestContext.http.method,
100
115
  toResult: async (response)=>{
116
+ const { headers , cookies } = getHeadersAndCookiesFromResponse(response);
101
117
  const result = {
118
+ cookies,
102
119
  statusCode: response.status,
103
120
  body: await response.text(),
104
- headers: Object.fromEntries(response.headers.entries())
121
+ headers
105
122
  };
106
123
  return result;
107
124
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 105501,
3
- "bundleOrigSize": 154208,
4
- "bundleReduction": 31.59,
2
+ "bundleSize": 106181,
3
+ "bundleOrigSize": 154794,
4
+ "bundleReduction": 31.4,
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.15,
20
+ "percent": 14.06,
21
21
  "reduction": 8.44
22
22
  },
23
23
  {
@@ -32,7 +32,7 @@
32
32
  "dependents": [
33
33
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
34
34
  ],
35
- "percent": 10.65,
35
+ "percent": 10.59,
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.28,
49
+ "percent": 10.22,
50
50
  "reduction": 3.08
51
51
  },
52
52
  {
@@ -61,13 +61,13 @@
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": 5.96,
65
65
  "reduction": 59.52
66
66
  },
67
67
  {
68
68
  "id": "/src/unstable-core-do-not-import/router.ts",
69
- "size": 5988,
70
- "origSize": 10158,
69
+ "size": 6102,
70
+ "origSize": 10247,
71
71
  "renderedExports": [
72
72
  "createRouterFactory",
73
73
  "callProcedure",
@@ -80,8 +80,8 @@
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.68,
84
- "reduction": 41.05
83
+ "percent": 5.75,
84
+ "reduction": 40.45
85
85
  },
86
86
  {
87
87
  "id": "/src/unstable-core-do-not-import/http/contentType.ts",
@@ -95,13 +95,13 @@
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.26,
98
+ "percent": 5.22,
99
99
  "reduction": 0
100
100
  },
101
101
  {
102
102
  "id": "/src/adapters/aws-lambda/getPlanner.ts",
103
- "size": 4852,
104
- "origSize": 5617,
103
+ "size": 5418,
104
+ "origSize": 6114,
105
105
  "renderedExports": [
106
106
  "getPlanner"
107
107
  ],
@@ -109,8 +109,8 @@
109
109
  "dependents": [
110
110
  "/src/adapters/aws-lambda/index.ts"
111
111
  ],
112
- "percent": 4.6,
113
- "reduction": 13.62
112
+ "percent": 5.1,
113
+ "reduction": 11.38
114
114
  },
115
115
  {
116
116
  "id": "/src/adapters/next-app-dir/nextAppDirCaller.ts",
@@ -123,7 +123,7 @@
123
123
  "dependents": [
124
124
  "/src/adapters/next-app-dir.ts"
125
125
  ],
126
- "percent": 2.97,
126
+ "percent": 2.95,
127
127
  "reduction": 22.27
128
128
  },
129
129
  {
@@ -140,7 +140,7 @@
140
140
  "/src/observable/index.ts",
141
141
  "/src/observable/operators.ts"
142
142
  ],
143
- "percent": 2.97,
143
+ "percent": 2.95,
144
144
  "reduction": 0.67
145
145
  },
146
146
  {
@@ -156,7 +156,7 @@
156
156
  "dependents": [
157
157
  "/src/observable/index.ts"
158
158
  ],
159
- "percent": 2.61,
159
+ "percent": 2.6,
160
160
  "reduction": 0
161
161
  },
162
162
  {
@@ -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.6,
179
+ "percent": 2.58,
180
180
  "reduction": 45.94
181
181
  },
182
182
  {
@@ -190,7 +190,7 @@
190
190
  "dependents": [
191
191
  "/src/unstable-core-do-not-import.ts"
192
192
  ],
193
- "percent": 2.56,
193
+ "percent": 2.55,
194
194
  "reduction": 40.91
195
195
  },
196
196
  {
@@ -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.49,
213
+ "percent": 2.47,
214
214
  "reduction": 55.5
215
215
  },
216
216
  {
@@ -224,7 +224,7 @@
224
224
  "dependents": [
225
225
  "/src/adapters/fetch/index.ts"
226
226
  ],
227
- "percent": 2.14,
227
+ "percent": 2.12,
228
228
  "reduction": 2.17
229
229
  },
230
230
  {
@@ -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.06,
242
+ "percent": 2.05,
243
243
  "reduction": 14.12
244
244
  },
245
245
  {
@@ -253,7 +253,7 @@
253
253
  "dependents": [
254
254
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
255
255
  ],
256
- "percent": 1.94,
256
+ "percent": 1.93,
257
257
  "reduction": 5.79
258
258
  },
259
259
  {
@@ -269,7 +269,7 @@
269
269
  "/src/unstable-core-do-not-import.ts",
270
270
  "/src/unstable-core-do-not-import/router.ts"
271
271
  ],
272
- "percent": 1.9,
272
+ "percent": 1.88,
273
273
  "reduction": 0
274
274
  },
275
275
  {
@@ -290,7 +290,7 @@
290
290
  "/src/unstable-core-do-not-import/http/contentType.ts",
291
291
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
292
292
  ],
293
- "percent": 1.64,
293
+ "percent": 1.63,
294
294
  "reduction": 19.47
295
295
  },
296
296
  {
@@ -304,7 +304,7 @@
304
304
  "dependents": [
305
305
  "/src/adapters/node-http/index.ts"
306
306
  ],
307
- "percent": 1.63,
307
+ "percent": 1.62,
308
308
  "reduction": 20.03
309
309
  },
310
310
  {
@@ -316,7 +316,7 @@
316
316
  ],
317
317
  "removedExports": [],
318
318
  "dependents": [],
319
- "percent": 1.5,
319
+ "percent": 1.49,
320
320
  "reduction": 21.04
321
321
  },
322
322
  {
@@ -328,7 +328,7 @@
328
328
  ],
329
329
  "removedExports": [],
330
330
  "dependents": [],
331
- "percent": 1.46,
331
+ "percent": 1.45,
332
332
  "reduction": 26.94
333
333
  },
334
334
  {
@@ -355,7 +355,7 @@
355
355
  "dependents": [
356
356
  "/src/adapters/fastify/index.ts"
357
357
  ],
358
- "percent": 1.42,
358
+ "percent": 1.41,
359
359
  "reduction": 34.7
360
360
  },
361
361
  {
@@ -372,7 +372,7 @@
372
372
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
373
373
  "/src/unstable-core-do-not-import/error/getErrorShape.ts"
374
374
  ],
375
- "percent": 1.2,
375
+ "percent": 1.19,
376
376
  "reduction": 23.5
377
377
  },
378
378
  {
@@ -400,7 +400,7 @@
400
400
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
401
401
  "/src/unstable-core-do-not-import/stream/stream.ts"
402
402
  ],
403
- "percent": 1.09,
403
+ "percent": 1.08,
404
404
  "reduction": 27.13
405
405
  },
406
406
  {
@@ -430,7 +430,7 @@
430
430
  "/src/unstable-core-do-not-import.ts",
431
431
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
432
432
  ],
433
- "percent": 0.98,
433
+ "percent": 0.97,
434
434
  "reduction": 58.57
435
435
  },
436
436
  {
@@ -447,7 +447,7 @@
447
447
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
448
448
  "/src/adapters/next-app-dir/rethrowNextErrors.ts"
449
449
  ],
450
- "percent": 0.94,
450
+ "percent": 0.93,
451
451
  "reduction": 13.65
452
452
  },
453
453
  {
@@ -461,7 +461,7 @@
461
461
  "dependents": [
462
462
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
463
463
  ],
464
- "percent": 0.78,
464
+ "percent": 0.77,
465
465
  "reduction": 0.97
466
466
  },
467
467
  {
@@ -473,7 +473,7 @@
473
473
  ],
474
474
  "removedExports": [],
475
475
  "dependents": [],
476
- "percent": 0.72,
476
+ "percent": 0.71,
477
477
  "reduction": 66.9
478
478
  },
479
479
  {
@@ -530,7 +530,7 @@
530
530
  "/src/unstable-core-do-not-import.ts",
531
531
  "/src/unstable-core-do-not-import/initTRPC.ts"
532
532
  ],
533
- "percent": 0.33,
533
+ "percent": 0.32,
534
534
  "reduction": 87.96
535
535
  },
536
536
  {
@@ -542,7 +542,7 @@
542
542
  ],
543
543
  "removedExports": [],
544
544
  "dependents": [],
545
- "percent": 0.27,
545
+ "percent": 0.26,
546
546
  "reduction": 72.92
547
547
  },
548
548
  {
@@ -732,8 +732,8 @@
732
732
  "removedExports": [],
733
733
  "dependents": [
734
734
  "/src/adapters/express.ts",
735
- "/src/adapters/next.ts",
736
735
  "/src/adapters/standalone.ts",
736
+ "/src/adapters/next.ts",
737
737
  "/src/adapters/fastify/fastifyRequestHandler.ts"
738
738
  ],
739
739
  "percent": 0,
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAA2B,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EACV,YAAY,EACZ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mBAAmB,CAAC,KAAK,SAAS,YAAY,4CAElD,KAAK,OAAO,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,KAC3C,aAAa,KAAK,EAAE,OAAO,CAAC,CA8ChC;AAED,gBAAgB;AAChB,KAAK,YAAY,CACf,QAAQ,SAAS,SAAS,EAAE,EAC5B,KAAK,SAAS,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAErE,OAAO,SAAS,YAAY,GAAG,EAAE,IAC/B,QAAQ,SAAS;IACnB,MAAM,IAAI,SAAS,SAAS;IAC5B,GAAG,MAAM,IAAI,SAAS,SAAS,EAAE;CAClC,GACG,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,GAC3D,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAEhC,wBAAgB,YAAY,CAAC,QAAQ,SAAS,SAAS,EAAE,EACvD,GAAG,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,GAC3B,YAAY,CAAC,QAAQ,CAAC,CAoDxB"}
@@ -110,6 +110,9 @@ function createCallerFactory() {
110
110
  return function createCaller(ctxOrCallback, options) {
111
111
  const proxy = createProxy.createRecursiveProxy(async ({ path , args })=>{
112
112
  const fullPath = path.join('.');
113
+ if (path.length === 1 && path[0] === '_def') {
114
+ return _def;
115
+ }
113
116
  const procedure = _def.procedures[fullPath];
114
117
  let ctx = undefined;
115
118
  try {
@@ -108,6 +108,9 @@ function createCallerFactory() {
108
108
  return function createCaller(ctxOrCallback, options) {
109
109
  const proxy = createRecursiveProxy(async ({ path , args })=>{
110
110
  const fullPath = path.join('.');
111
+ if (path.length === 1 && path[0] === '_def') {
112
+ return _def;
113
+ }
111
114
  const procedure = _def.procedures[fullPath];
112
115
  let ctx = undefined;
113
116
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.402+f5eb0631e",
3
+ "version": "11.0.0-rc.413+87f0cbc94",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -117,7 +117,7 @@
117
117
  },
118
118
  "devDependencies": {
119
119
  "@fastify/websocket": "^10.0.1",
120
- "@tanstack/react-query": "^5.25.0",
120
+ "@tanstack/react-query": "^5.45.0",
121
121
  "@types/aws-lambda": "^8.10.137",
122
122
  "@types/express": "^4.17.17",
123
123
  "@types/hash-sum": "^1.0.0",
@@ -141,7 +141,7 @@
141
141
  "tslib": "^2.5.0",
142
142
  "tsx": "^4.0.0",
143
143
  "typescript": "^5.4.0",
144
- "valibot": "^0.31.0",
144
+ "valibot": "^0.32.0",
145
145
  "ws": "^8.0.0",
146
146
  "yup": "^1.0.0",
147
147
  "zod": "^3.0.0"
@@ -149,5 +149,5 @@
149
149
  "funding": [
150
150
  "https://trpc.io/sponsor"
151
151
  ],
152
- "gitHead": "f5eb0631e46f99fa9723ae3cfc043350f5fce4b6"
152
+ "gitHead": "87f0cbc948c7b3a1a642cf9dde710bcabec7bc0c"
153
153
  }
@@ -40,6 +40,19 @@ interface Processor<TEvent extends LambdaEvent> {
40
40
  toResult: (response: Response) => Promise<inferAPIGWReturn<TEvent>>;
41
41
  }
42
42
 
43
+ function getHeadersAndCookiesFromResponse(response: Response) {
44
+ const headers = Object.fromEntries(response.headers.entries());
45
+
46
+ const cookies: string[] = response.headers
47
+ .getSetCookie()
48
+ .flatMap((value) => value.split(','))
49
+ .map((cookie) => cookie.trim());
50
+
51
+ delete headers['set-cookie'];
52
+
53
+ return { headers, cookies };
54
+ }
55
+
43
56
  const v1Processor: Processor<APIGatewayProxyEvent> = {
44
57
  // same as getPath above
45
58
  getTRPCPath: (event) => {
@@ -98,10 +111,13 @@ const v1Processor: Processor<APIGatewayProxyEvent> = {
98
111
  },
99
112
  getMethod: (event) => event.httpMethod,
100
113
  toResult: async (response) => {
114
+ const { headers, cookies } = getHeadersAndCookiesFromResponse(response);
115
+
101
116
  const result: APIGatewayProxyResult = {
117
+ ...(cookies.length && { multiValueHeaders: { 'set-cookie': cookies } }),
102
118
  statusCode: response.status,
103
119
  body: await response.text(),
104
- headers: Object.fromEntries(response.headers.entries()),
120
+ headers,
105
121
  };
106
122
 
107
123
  return result;
@@ -142,10 +158,13 @@ const v2Processor: Processor<APIGatewayProxyEventV2> = {
142
158
  },
143
159
  getMethod: (event) => event.requestContext.http.method,
144
160
  toResult: async (response) => {
161
+ const { headers, cookies } = getHeadersAndCookiesFromResponse(response);
162
+
145
163
  const result: APIGatewayProxyStructuredResultV2 = {
164
+ cookies,
146
165
  statusCode: response.status,
147
166
  body: await response.text(),
148
- headers: Object.fromEntries(response.headers.entries()),
167
+ headers,
149
168
  };
150
169
 
151
170
  return result;
@@ -267,6 +267,10 @@ export function createCallerFactory<TRoot extends AnyRootTypes>() {
267
267
  const proxy = createRecursiveProxy(async ({ path, args }) => {
268
268
  const fullPath = path.join('.');
269
269
 
270
+ if (path.length === 1 && path[0] === '_def') {
271
+ return _def;
272
+ }
273
+
270
274
  const procedure = _def.procedures[fullPath] as AnyProcedure;
271
275
 
272
276
  let ctx: Context | undefined = undefined;