@trpc/server 11.0.0-rc.334 → 11.0.0-rc.340

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,7 +1,7 @@
1
1
  {
2
- "bundleSize": 98388,
3
- "bundleOrigSize": 157498,
4
- "bundleReduction": 37.53,
2
+ "bundleSize": 99038,
3
+ "bundleOrigSize": 157976,
4
+ "bundleReduction": 37.31,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/adapters/ws.ts",
@@ -15,7 +15,7 @@
15
15
  "dependents": [
16
16
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
17
17
  ],
18
- "percent": 10.34,
18
+ "percent": 10.27,
19
19
  "reduction": 0
20
20
  },
21
21
  {
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "removedExports": [],
29
29
  "dependents": [],
30
- "percent": 9.63,
30
+ "percent": 9.57,
31
31
  "reduction": 20.86
32
32
  },
33
33
  {
@@ -43,13 +43,13 @@
43
43
  "/src/unstable-core-do-not-import.ts",
44
44
  "/src/unstable-core-do-not-import/initTRPC.ts"
45
45
  ],
46
- "percent": 6.49,
46
+ "percent": 6.45,
47
47
  "reduction": 59.29
48
48
  },
49
49
  {
50
50
  "id": "/src/unstable-core-do-not-import/router.ts",
51
- "size": 5831,
52
- "origSize": 10003,
51
+ "size": 5988,
52
+ "origSize": 10158,
53
53
  "renderedExports": [
54
54
  "createRouterFactory",
55
55
  "callProcedure",
@@ -62,8 +62,8 @@
62
62
  "/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
63
63
  "/src/unstable-core-do-not-import/initTRPC.ts"
64
64
  ],
65
- "percent": 5.93,
66
- "reduction": 41.71
65
+ "percent": 6.05,
66
+ "reduction": 41.05
67
67
  },
68
68
  {
69
69
  "id": "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
@@ -78,7 +78,7 @@
78
78
  "dependents": [
79
79
  "/src/adapters/node-http/content-type/form-data/index.ts"
80
80
  ],
81
- "percent": 5.06,
81
+ "percent": 5.03,
82
82
  "reduction": 38
83
83
  },
84
84
  {
@@ -92,7 +92,7 @@
92
92
  ],
93
93
  "removedExports": [],
94
94
  "dependents": [],
95
- "percent": 4.49,
95
+ "percent": 4.46,
96
96
  "reduction": 32.71
97
97
  },
98
98
  {
@@ -106,7 +106,7 @@
106
106
  "dependents": [
107
107
  "/src/adapters/node-http/index.ts"
108
108
  ],
109
- "percent": 4,
109
+ "percent": 3.97,
110
110
  "reduction": 13.56
111
111
  },
112
112
  {
@@ -120,7 +120,7 @@
120
120
  "dependents": [
121
121
  "/src/adapters/fetch/index.ts"
122
122
  ],
123
- "percent": 3.52,
123
+ "percent": 3.5,
124
124
  "reduction": 9.9
125
125
  },
126
126
  {
@@ -139,7 +139,7 @@
139
139
  "dependents": [
140
140
  "/src/adapters/aws-lambda/index.ts"
141
141
  ],
142
- "percent": 3.36,
142
+ "percent": 3.34,
143
143
  "reduction": 34.98
144
144
  },
145
145
  {
@@ -156,7 +156,7 @@
156
156
  "/src/observable/index.ts",
157
157
  "/src/observable/operators.ts"
158
158
  ],
159
- "percent": 3.18,
159
+ "percent": 3.16,
160
160
  "reduction": 0.67
161
161
  },
162
162
  {
@@ -170,7 +170,7 @@
170
170
  "dependents": [
171
171
  "/src/adapters/next-app-dir.ts"
172
172
  ],
173
- "percent": 3.1,
173
+ "percent": 3.08,
174
174
  "reduction": 21.85
175
175
  },
176
176
  {
@@ -186,7 +186,7 @@
186
186
  "dependents": [
187
187
  "/src/observable/index.ts"
188
188
  ],
189
- "percent": 2.8,
189
+ "percent": 2.78,
190
190
  "reduction": 0
191
191
  },
192
192
  {
@@ -206,7 +206,7 @@
206
206
  "/src/unstable-core-do-not-import/router.ts",
207
207
  "/src/unstable-core-do-not-import/initTRPC.ts"
208
208
  ],
209
- "percent": 2.79,
209
+ "percent": 2.77,
210
210
  "reduction": 45.94
211
211
  },
212
212
  {
@@ -220,7 +220,7 @@
220
220
  "dependents": [
221
221
  "/src/unstable-core-do-not-import.ts"
222
222
  ],
223
- "percent": 2.7,
223
+ "percent": 2.68,
224
224
  "reduction": 41.08
225
225
  },
226
226
  {
@@ -240,7 +240,7 @@
240
240
  "/src/unstable-core-do-not-import/initTRPC.ts",
241
241
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
242
242
  ],
243
- "percent": 2.67,
243
+ "percent": 2.65,
244
244
  "reduction": 55.5
245
245
  },
246
246
  {
@@ -255,7 +255,7 @@
255
255
  "/src/adapters/fastify/index.ts",
256
256
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
257
257
  ],
258
- "percent": 2.52,
258
+ "percent": 2.5,
259
259
  "reduction": 36.53
260
260
  },
261
261
  {
@@ -267,9 +267,25 @@
267
267
  ],
268
268
  "removedExports": [],
269
269
  "dependents": [],
270
- "percent": 2.49,
270
+ "percent": 2.47,
271
271
  "reduction": 32.42
272
272
  },
273
+ {
274
+ "id": "/src/unstable-core-do-not-import/createProxy.ts",
275
+ "size": 2000,
276
+ "origSize": 1919,
277
+ "renderedExports": [
278
+ "createRecursiveProxy",
279
+ "createFlatProxy"
280
+ ],
281
+ "removedExports": [],
282
+ "dependents": [
283
+ "/src/unstable-core-do-not-import.ts",
284
+ "/src/unstable-core-do-not-import/router.ts"
285
+ ],
286
+ "percent": 2.02,
287
+ "reduction": 0
288
+ },
273
289
  {
274
290
  "id": "/src/unstable-core-do-not-import/error/TRPCError.ts",
275
291
  "size": 1733,
@@ -288,7 +304,7 @@
288
304
  "/src/unstable-core-do-not-import/middleware.ts",
289
305
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
290
306
  ],
291
- "percent": 1.76,
307
+ "percent": 1.75,
292
308
  "reduction": 19.47
293
309
  },
294
310
  {
@@ -302,7 +318,7 @@
302
318
  "dependents": [
303
319
  "/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
304
320
  ],
305
- "percent": 1.67,
321
+ "percent": 1.66,
306
322
  "reduction": 34.79
307
323
  },
308
324
  {
@@ -314,7 +330,7 @@
314
330
  ],
315
331
  "removedExports": [],
316
332
  "dependents": [],
317
- "percent": 1.63,
333
+ "percent": 1.62,
318
334
  "reduction": 29.12
319
335
  },
320
336
  {
@@ -328,7 +344,7 @@
328
344
  "dependents": [
329
345
  "/src/adapters/node-http/content-type/json/index.ts"
330
346
  ],
331
- "percent": 1.62,
347
+ "percent": 1.61,
332
348
  "reduction": 0.19
333
349
  },
334
350
  {
@@ -340,7 +356,7 @@
340
356
  ],
341
357
  "removedExports": [],
342
358
  "dependents": [],
343
- "percent": 1.61,
359
+ "percent": 1.6,
344
360
  "reduction": 21.04
345
361
  },
346
362
  {
@@ -353,25 +369,9 @@
353
369
  ],
354
370
  "removedExports": [],
355
371
  "dependents": [],
356
- "percent": 1.55,
372
+ "percent": 1.54,
357
373
  "reduction": 27.6
358
374
  },
359
- {
360
- "id": "/src/unstable-core-do-not-import/createProxy.ts",
361
- "size": 1507,
362
- "origSize": 1596,
363
- "renderedExports": [
364
- "createRecursiveProxy",
365
- "createFlatProxy"
366
- ],
367
- "removedExports": [],
368
- "dependents": [
369
- "/src/unstable-core-do-not-import.ts",
370
- "/src/unstable-core-do-not-import/router.ts"
371
- ],
372
- "percent": 1.53,
373
- "reduction": 5.58
374
- },
375
375
  {
376
376
  "id": "/src/adapters/fastify/fastifyTRPCPlugin.ts",
377
377
  "size": 1481,
@@ -383,7 +383,7 @@
383
383
  "dependents": [
384
384
  "/src/adapters/fastify/index.ts"
385
385
  ],
386
- "percent": 1.51,
386
+ "percent": 1.5,
387
387
  "reduction": 34.44
388
388
  },
389
389
  {
@@ -397,7 +397,7 @@
397
397
  "dependents": [
398
398
  "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts"
399
399
  ],
400
- "percent": 1.42,
400
+ "percent": 1.41,
401
401
  "reduction": 0
402
402
  },
403
403
  {
@@ -413,7 +413,7 @@
413
413
  "/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
414
414
  "/src/unstable-core-do-not-import/error/getErrorShape.ts"
415
415
  ],
416
- "percent": 1.29,
416
+ "percent": 1.28,
417
417
  "reduction": 22.76
418
418
  },
419
419
  {
@@ -428,7 +428,7 @@
428
428
  "/src/unstable-core-do-not-import.ts",
429
429
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
430
430
  ],
431
- "percent": 1.01,
431
+ "percent": 1,
432
432
  "reduction": 56.22
433
433
  },
434
434
  {
@@ -461,11 +461,11 @@
461
461
  "removedExports": [],
462
462
  "dependents": [
463
463
  "/src/unstable-core-do-not-import.ts",
464
+ "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
464
465
  "/src/unstable-core-do-not-import/error/TRPCError.ts",
465
466
  "/src/unstable-core-do-not-import/router.ts",
466
467
  "/src/unstable-core-do-not-import/transformer.ts",
467
468
  "/src/unstable-core-do-not-import/middleware.ts",
468
- "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
469
469
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
470
470
  ],
471
471
  "percent": 0.89,
@@ -502,7 +502,7 @@
502
502
  "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
503
503
  "/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts"
504
504
  ],
505
- "percent": 0.74,
505
+ "percent": 0.73,
506
506
  "reduction": 67.52
507
507
  },
508
508
  {
@@ -528,7 +528,7 @@
528
528
  ],
529
529
  "removedExports": [],
530
530
  "dependents": [],
531
- "percent": 0.68,
531
+ "percent": 0.67,
532
532
  "reduction": 0.6
533
533
  },
534
534
  {
@@ -543,7 +543,7 @@
543
543
  "/src/unstable-core-do-not-import.ts",
544
544
  "/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
545
545
  ],
546
- "percent": 0.64,
546
+ "percent": 0.63,
547
547
  "reduction": 43.49
548
548
  },
549
549
  {
@@ -556,7 +556,7 @@
556
556
  ],
557
557
  "removedExports": [],
558
558
  "dependents": [],
559
- "percent": 0.59,
559
+ "percent": 0.58,
560
560
  "reduction": 65.23
561
561
  },
562
562
  {
@@ -611,7 +611,7 @@
611
611
  "dependents": [
612
612
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
613
613
  ],
614
- "percent": 0.3,
614
+ "percent": 0.29,
615
615
  "reduction": 35.11
616
616
  },
617
617
  {
@@ -663,8 +663,8 @@
663
663
  ],
664
664
  "removedExports": [],
665
665
  "dependents": [
666
- "/src/adapters/node-http/content-type/json/index.ts",
667
- "/src/adapters/node-http/content-type/form-data/index.ts"
666
+ "/src/adapters/node-http/content-type/form-data/index.ts",
667
+ "/src/adapters/node-http/content-type/json/index.ts"
668
668
  ],
669
669
  "percent": 0.12,
670
670
  "reduction": 86.68
@@ -711,9 +711,9 @@
711
711
  "reduction": 100
712
712
  },
713
713
  {
714
- "id": "/src/index.ts",
714
+ "id": "/src/rpc.ts",
715
715
  "size": 0,
716
- "origSize": 32,
716
+ "origSize": 36,
717
717
  "renderedExports": [],
718
718
  "removedExports": [],
719
719
  "dependents": [],
@@ -721,9 +721,9 @@
721
721
  "reduction": 100
722
722
  },
723
723
  {
724
- "id": "/src/rpc.ts",
724
+ "id": "/src/index.ts",
725
725
  "size": 0,
726
- "origSize": 36,
726
+ "origSize": 32,
727
727
  "renderedExports": [],
728
728
  "removedExports": [],
729
729
  "dependents": [],
@@ -1 +1 @@
1
- {"version":3,"file":"createProxy.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/createProxy.ts"],"names":[],"mappings":"AAAA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AACD,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC;AA4B7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAc,aAAa,YAC5B,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,eAAe,2BACT,MAAM,GAAG,MAAM,KAAK,KAAK,GAAG,KAC5C,KAWF,CAAC"}
1
+ {"version":3,"file":"createProxy.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/createProxy.ts"],"names":[],"mappings":"AAAA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AACD,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC;AAuC7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAc,aAAa,YAC5B,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,eAAe,2BACT,MAAM,GAAG,MAAM,KAAK,KAAK,GAAG,KAC5C,KAWF,CAAC"}
@@ -17,11 +17,26 @@ function createInnerProxy(callback, path) {
17
17
  ]);
18
18
  },
19
19
  apply (_1, _2, args) {
20
- const isApply = path[path.length - 1] === 'apply';
21
- return callback({
22
- args: isApply ? args.length >= 2 ? args[1] : [] : args,
23
- path: isApply ? path.slice(0, -1) : path
24
- });
20
+ const lastOfPath = path[path.length - 1];
21
+ let opts = {
22
+ args,
23
+ path
24
+ };
25
+ // special handling for e.g. `trpc.hello.call(this, 'there')` and `trpc.hello.apply(this, ['there'])
26
+ if (lastOfPath === 'call') {
27
+ opts = {
28
+ args: args.length >= 2 ? [
29
+ args[1]
30
+ ] : [],
31
+ path: path.slice(0, -1)
32
+ };
33
+ } else if (lastOfPath === 'apply') {
34
+ opts = {
35
+ args: args.length >= 2 ? args[1] : [],
36
+ path: path.slice(0, -1)
37
+ };
38
+ }
39
+ return callback(opts);
25
40
  }
26
41
  });
27
42
  return proxy;
@@ -15,11 +15,26 @@ function createInnerProxy(callback, path) {
15
15
  ]);
16
16
  },
17
17
  apply (_1, _2, args) {
18
- const isApply = path[path.length - 1] === 'apply';
19
- return callback({
20
- args: isApply ? args.length >= 2 ? args[1] : [] : args,
21
- path: isApply ? path.slice(0, -1) : path
22
- });
18
+ const lastOfPath = path[path.length - 1];
19
+ let opts = {
20
+ args,
21
+ path
22
+ };
23
+ // special handling for e.g. `trpc.hello.call(this, 'there')` and `trpc.hello.apply(this, ['there'])
24
+ if (lastOfPath === 'call') {
25
+ opts = {
26
+ args: args.length >= 2 ? [
27
+ args[1]
28
+ ] : [],
29
+ path: path.slice(0, -1)
30
+ };
31
+ } else if (lastOfPath === 'apply') {
32
+ opts = {
33
+ args: args.length >= 2 ? args[1] : [],
34
+ path: path.slice(0, -1)
35
+ };
36
+ }
37
+ return callback(opts);
23
38
  }
24
39
  });
25
40
  return proxy;
@@ -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,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,SAAS,CAAC;AAGrD,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;CAC5C;AAED,KAAK,iBAAiB,CAAC,UAAU,SAAS,YAAY,IAAI,CACxD,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,KACnC,OAAO,CACV,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,cAAc,GAC7C,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,GACvD,oBAAoB,CAAC,UAAU,CAAC,CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,YAAY,IAAI;KAC9D,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G,QAAQ,CAAC,GAC3B,YAAY,CAAC,QAAQ,CAAC,CAoDxB"}
@@ -25,7 +25,11 @@ const emptyRouter = {
25
25
  /**
26
26
  * Then is a reserved word because otherwise we can't return a promise that returns a Proxy
27
27
  * since JS will think that `.then` is something that exists
28
- */ 'then'
28
+ */ 'then',
29
+ /**
30
+ * `fn.call()` and `fn.apply()` are reserved words because otherwise we can't call a function using `.call` or `.apply`
31
+ */ 'call',
32
+ 'apply'
29
33
  ];
30
34
  /**
31
35
  * @internal
@@ -23,7 +23,11 @@ const emptyRouter = {
23
23
  /**
24
24
  * Then is a reserved word because otherwise we can't return a promise that returns a Proxy
25
25
  * since JS will think that `.then` is something that exists
26
- */ 'then'
26
+ */ 'then',
27
+ /**
28
+ * `fn.call()` and `fn.apply()` are reserved words because otherwise we can't call a function using `.call` or `.apply`
29
+ */ 'call',
30
+ 'apply'
27
31
  ];
28
32
  /**
29
33
  * @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.334+fdf26e552",
3
+ "version": "11.0.0-rc.340+d1652d1bc",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -136,7 +136,6 @@
136
136
  "@types/react-dom": "^18.2.14",
137
137
  "@types/ws": "^8.2.0",
138
138
  "@web3-storage/multipart-parser": "^1.0.0",
139
- "aws-lambda": "^1.0.7",
140
139
  "devalue": "^4.0.0",
141
140
  "eslint": "^8.56.0",
142
141
  "express": "^4.17.1",
@@ -161,5 +160,5 @@
161
160
  "funding": [
162
161
  "https://trpc.io/sponsor"
163
162
  ],
164
- "gitHead": "fdf26e5525b0f316b8b480141f65f4200acaa707"
163
+ "gitHead": "d1652d1bc0a9ff3e3d286a4bf69c116621c165f8"
165
164
  }
@@ -19,11 +19,22 @@ function createInnerProxy(callback: ProxyCallback, path: string[]) {
19
19
  return createInnerProxy(callback, [...path, key]);
20
20
  },
21
21
  apply(_1, _2, args) {
22
- const isApply = path[path.length - 1] === 'apply';
23
- return callback({
24
- args: isApply ? (args.length >= 2 ? args[1] : []) : args,
25
- path: isApply ? path.slice(0, -1) : path,
26
- });
22
+ const lastOfPath = path[path.length - 1];
23
+
24
+ let opts = { args, path };
25
+ // special handling for e.g. `trpc.hello.call(this, 'there')` and `trpc.hello.apply(this, ['there'])
26
+ if (lastOfPath === 'call') {
27
+ opts = {
28
+ args: args.length >= 2 ? [args[1]] : [],
29
+ path: path.slice(0, -1),
30
+ };
31
+ } else if (lastOfPath === 'apply') {
32
+ opts = {
33
+ args: args.length >= 2 ? args[1] : [],
34
+ path: path.slice(0, -1),
35
+ };
36
+ }
37
+ return callback(opts);
27
38
  },
28
39
  });
29
40
 
@@ -124,6 +124,11 @@ const reservedWords = [
124
124
  * since JS will think that `.then` is something that exists
125
125
  */
126
126
  'then',
127
+ /**
128
+ * `fn.call()` and `fn.apply()` are reserved words because otherwise we can't call a function using `.call` or `.apply`
129
+ */
130
+ 'call',
131
+ 'apply',
127
132
  ];
128
133
 
129
134
  export type CreateRouterOptions = {