@trpc/server 11.1.3-canary.4 → 11.1.3-canary.7

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": 202625,
3
- "bundleOrigSize": 235222,
4
- "bundleReduction": 13.86,
2
+ "bundleSize": 202465,
3
+ "bundleOrigSize": 235087,
4
+ "bundleReduction": 13.88,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 10.41,
17
+ "percent": 10.42,
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": 10.19,
33
+ "percent": 10.2,
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.84,
50
+ "percent": 9.85,
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.39,
67
+ "percent": 6.4,
68
68
  "reduction": 0
69
69
  },
70
70
  {
@@ -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.01,
101
+ "percent": 5.02,
102
102
  "reduction": 29.54
103
103
  },
104
104
  {
@@ -117,8 +117,8 @@
117
117
  },
118
118
  {
119
119
  "id": "/src/unstable-core-do-not-import/http/contentType.ts",
120
- "size": 7874,
121
- "origSize": 7940,
120
+ "size": 7793,
121
+ "origSize": 7883,
122
122
  "renderedExports": [
123
123
  "getRequestInfo"
124
124
  ],
@@ -127,8 +127,8 @@
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.89,
131
- "reduction": 0.83
130
+ "percent": 3.85,
131
+ "reduction": 1.14
132
132
  },
133
133
  {
134
134
  "id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
@@ -323,7 +323,7 @@
323
323
  "dependents": [
324
324
  "/src/unstable-core-do-not-import.ts"
325
325
  ],
326
- "percent": 1.31,
326
+ "percent": 1.32,
327
327
  "reduction": 40.81
328
328
  },
329
329
  {
@@ -381,13 +381,13 @@
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.21,
384
+ "percent": 1.22,
385
385
  "reduction": 17.51
386
386
  },
387
387
  {
388
388
  "id": "/src/unstable-core-do-not-import/error/TRPCError.ts",
389
- "size": 2429,
390
- "origSize": 2221,
389
+ "size": 2350,
390
+ "origSize": 2143,
391
391
  "renderedExports": [
392
392
  "getCauseFromUnknown",
393
393
  "getTRPCErrorFromUnknown",
@@ -404,7 +404,7 @@
404
404
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
405
405
  "/src/unstable-core-do-not-import/stream/sse.ts"
406
406
  ],
407
- "percent": 1.2,
407
+ "percent": 1.16,
408
408
  "reduction": 0
409
409
  },
410
410
  {
@@ -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.54,
622
+ "percent": 0.55,
623
623
  "reduction": 15.08
624
624
  },
625
625
  {
@@ -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.38,
693
+ "percent": 0.39,
694
694
  "reduction": 44.13
695
695
  },
696
696
  {
@@ -897,9 +897,9 @@
897
897
  "reduction": 100
898
898
  },
899
899
  {
900
- "id": "/src/shared.ts",
900
+ "id": "/src/rpc.ts",
901
901
  "size": 0,
902
- "origSize": 653,
902
+ "origSize": 36,
903
903
  "renderedExports": [],
904
904
  "removedExports": [],
905
905
  "dependents": [],
@@ -907,9 +907,9 @@
907
907
  "reduction": 100
908
908
  },
909
909
  {
910
- "id": "/src/rpc.ts",
910
+ "id": "/src/shared.ts",
911
911
  "size": 0,
912
- "origSize": 36,
912
+ "origSize": 653,
913
913
  "renderedExports": [],
914
914
  "removedExports": [],
915
915
  "dependents": [],
@@ -925,8 +925,8 @@
925
925
  "dependents": [
926
926
  "/src/adapters/express.ts",
927
927
  "/src/adapters/next.ts",
928
- "/src/adapters/ws.ts",
929
928
  "/src/adapters/standalone.ts",
929
+ "/src/adapters/ws.ts",
930
930
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
931
931
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
932
932
  "/src/adapters/node-http/writeResponse.ts"
@@ -957,9 +957,9 @@
957
957
  "reduction": 100
958
958
  },
959
959
  {
960
- "id": "/src/adapters/fastify/index.ts",
960
+ "id": "/src/adapters/fetch/index.ts",
961
961
  "size": 0,
962
- "origSize": 78,
962
+ "origSize": 64,
963
963
  "renderedExports": [],
964
964
  "removedExports": [],
965
965
  "dependents": [],
@@ -967,9 +967,9 @@
967
967
  "reduction": 100
968
968
  },
969
969
  {
970
- "id": "/src/adapters/fetch/index.ts",
970
+ "id": "/src/adapters/fastify/index.ts",
971
971
  "size": 0,
972
- "origSize": 64,
972
+ "origSize": 78,
973
973
  "renderedExports": [],
974
974
  "removedExports": [],
975
975
  "dependents": [],
@@ -985,8 +985,8 @@
985
985
  "dependents": [
986
986
  "/src/adapters/express.ts",
987
987
  "/src/adapters/next.ts",
988
- "/src/adapters/ws.ts",
989
988
  "/src/adapters/standalone.ts",
989
+ "/src/adapters/ws.ts",
990
990
  "/src/adapters/fastify/fastifyRequestHandler.ts"
991
991
  ],
992
992
  "percent": 0,
@@ -1 +1 @@
1
- {"version":3,"file":"TRPCError.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/error/TRPCError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMxD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CA0BrE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAoBjE;AAED,qBAAa,SAAU,SAAQ,KAAK;IAGlC,SAAyB,KAAK,CAAC,EAAE,KAAK,CAAC;IACvC,SAAgB,IAAI,4XAAC;gBAET,IAAI,EAAE;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAgBF"}
1
+ {"version":3,"file":"TRPCError.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/error/TRPCError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMxD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CA0BrE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAoBjE;AAED,qBAAa,SAAU,SAAQ,KAAK;IAGlC,SAAyB,KAAK,CAAC,EAAE,KAAK,CAAC;IACvC,SAAgB,IAAI,4XAAC;gBAET,IAAI,EAAE;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAYF"}
@@ -71,10 +71,7 @@ class TRPCError extends Error {
71
71
  _define_property(this, "cause", void 0), _define_property(this, "code", void 0);
72
72
  this.code = opts.code;
73
73
  this.name = 'TRPCError';
74
- if (!this.cause) {
75
- // < ES2022 / < Node 16.9.0 compatability
76
- this.cause = cause;
77
- }
74
+ this.cause ?? (this.cause = cause);
78
75
  }
79
76
  }
80
77
 
@@ -69,10 +69,7 @@ class TRPCError extends Error {
69
69
  _define_property(this, "cause", void 0), _define_property(this, "code", void 0);
70
70
  this.code = opts.code;
71
71
  this.name = 'TRPCError';
72
- if (!this.cause) {
73
- // < ES2022 / < Node 16.9.0 compatability
74
- this.cause = cause;
75
- }
72
+ this.cause ?? (this.cause = cause);
76
73
  }
77
74
  }
78
75
 
@@ -1 +1 @@
1
- {"version":3,"file":"contentType.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/contentType.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAChB,YAAY,EAAE,eAAe,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AA+QF,wBAAsB,cAAc,CAClC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAG1B"}
1
+ {"version":3,"file":"contentType.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/contentType.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAChB,YAAY,EAAE,eAAe,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AA8QF,wBAAsB,cAAc,CAClC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAG1B"}
@@ -18,19 +18,17 @@ var parseConnectionParams = require('./parseConnectionParams.js');
18
18
  if (value !== utils.unsetMarker) {
19
19
  return value;
20
20
  }
21
- if (promise === null) {
22
- // dedupes promises and catches errors
23
- promise = fn().catch((cause)=>{
24
- if (cause instanceof TRPCError.TRPCError) {
25
- throw cause;
26
- }
27
- throw new TRPCError.TRPCError({
28
- code: 'BAD_REQUEST',
29
- message: cause instanceof Error ? cause.message : 'Invalid input',
30
- cause
31
- });
21
+ // dedupes promises and catches errors
22
+ promise ?? (promise = fn().catch((cause)=>{
23
+ if (cause instanceof TRPCError.TRPCError) {
24
+ throw cause;
25
+ }
26
+ throw new TRPCError.TRPCError({
27
+ code: 'BAD_REQUEST',
28
+ message: cause instanceof Error ? cause.message : 'Invalid input',
29
+ cause
32
30
  });
33
- }
31
+ }));
34
32
  value = await promise;
35
33
  promise = null;
36
34
  return value;
@@ -16,19 +16,17 @@ import { parseConnectionParamsFromString } from './parseConnectionParams.mjs';
16
16
  if (value !== unsetMarker) {
17
17
  return value;
18
18
  }
19
- if (promise === null) {
20
- // dedupes promises and catches errors
21
- promise = fn().catch((cause)=>{
22
- if (cause instanceof TRPCError) {
23
- throw cause;
24
- }
25
- throw new TRPCError({
26
- code: 'BAD_REQUEST',
27
- message: cause instanceof Error ? cause.message : 'Invalid input',
28
- cause
29
- });
19
+ // dedupes promises and catches errors
20
+ promise ?? (promise = fn().catch((cause)=>{
21
+ if (cause instanceof TRPCError) {
22
+ throw cause;
23
+ }
24
+ throw new TRPCError({
25
+ code: 'BAD_REQUEST',
26
+ message: cause instanceof Error ? cause.message : 'Invalid input',
27
+ cause
30
28
  });
31
- }
29
+ }));
32
30
  value = await promise;
33
31
  promise = null;
34
32
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.1.3-canary.4+cf7091a95",
3
+ "version": "11.1.3-canary.7+f35eb5a2e",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -127,7 +127,7 @@
127
127
  "@types/react-dom": "^19.1.1",
128
128
  "@types/ws": "^8.2.0",
129
129
  "devalue": "^5.0.0",
130
- "eslint": "^9.21.0",
130
+ "eslint": "^9.26.0",
131
131
  "express": "^5.0.0",
132
132
  "fastify": "^4.16.0",
133
133
  "fastify-plugin": "^5.0.0",
@@ -152,5 +152,5 @@
152
152
  "peerDependencies": {
153
153
  "typescript": ">=5.7.2"
154
154
  },
155
- "gitHead": "cf7091a95bb216c595b7eeb28d54dbcb217e3359"
155
+ "gitHead": "f35eb5a2e2cb5514d22ed4bcbf4a4addebd00ff9"
156
156
  }
@@ -74,10 +74,6 @@ export class TRPCError extends Error {
74
74
 
75
75
  this.code = opts.code;
76
76
  this.name = 'TRPCError';
77
-
78
- if (!this.cause) {
79
- // < ES2022 / < Node 16.9.0 compatability
80
- this.cause = cause;
81
- }
77
+ this.cause ??= cause;
82
78
  }
83
79
  }
@@ -34,19 +34,18 @@ function memo<TReturn>(fn: () => Promise<TReturn>) {
34
34
  if (value !== unsetMarker) {
35
35
  return value;
36
36
  }
37
- if (promise === null) {
38
- // dedupes promises and catches errors
39
- promise = fn().catch((cause) => {
40
- if (cause instanceof TRPCError) {
41
- throw cause;
42
- }
43
- throw new TRPCError({
44
- code: 'BAD_REQUEST',
45
- message: cause instanceof Error ? cause.message : 'Invalid input',
46
- cause,
47
- });
37
+
38
+ // dedupes promises and catches errors
39
+ promise ??= fn().catch((cause) => {
40
+ if (cause instanceof TRPCError) {
41
+ throw cause;
42
+ }
43
+ throw new TRPCError({
44
+ code: 'BAD_REQUEST',
45
+ message: cause instanceof Error ? cause.message : 'Invalid input',
46
+ cause,
48
47
  });
49
- }
48
+ });
50
49
 
51
50
  value = await promise;
52
51
  promise = null;