@trpc/server 11.0.0-rc.795 → 11.0.0-rc.798

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": 198990,
3
- "bundleOrigSize": 230642,
4
- "bundleReduction": 13.72,
2
+ "bundleSize": 198987,
3
+ "bundleOrigSize": 230694,
4
+ "bundleReduction": 13.74,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -291,9 +291,9 @@
291
291
  "removedExports": [],
292
292
  "dependents": [
293
293
  "/src/unstable-core-do-not-import.ts",
294
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
294
295
  "/src/unstable-core-do-not-import/router.ts",
295
- "/src/unstable-core-do-not-import/initTRPC.ts",
296
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
296
+ "/src/unstable-core-do-not-import/initTRPC.ts"
297
297
  ],
298
298
  "percent": 1.38,
299
299
  "reduction": 45.98
@@ -353,14 +353,14 @@
353
353
  "removedExports": [],
354
354
  "dependents": [
355
355
  "/src/unstable-core-do-not-import.ts",
356
+ "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
357
+ "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
358
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
356
359
  "/src/unstable-core-do-not-import/error/TRPCError.ts",
357
360
  "/src/unstable-core-do-not-import/router.ts",
358
361
  "/src/unstable-core-do-not-import/transformer.ts",
359
362
  "/src/unstable-core-do-not-import/middleware.ts",
360
363
  "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
361
- "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
362
- "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
363
- "/src/unstable-core-do-not-import/http/resolveResponse.ts",
364
364
  "/src/unstable-core-do-not-import/http/contentType.ts",
365
365
  "/src/unstable-core-do-not-import/http/abortError.ts",
366
366
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
@@ -382,10 +382,10 @@
382
382
  "removedExports": [],
383
383
  "dependents": [
384
384
  "/src/unstable-core-do-not-import.ts",
385
- "/src/unstable-core-do-not-import/router.ts",
386
- "/src/unstable-core-do-not-import/middleware.ts",
387
385
  "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
388
386
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
387
+ "/src/unstable-core-do-not-import/router.ts",
388
+ "/src/unstable-core-do-not-import/middleware.ts",
389
389
  "/src/unstable-core-do-not-import/http/contentType.ts",
390
390
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
391
391
  "/src/unstable-core-do-not-import/stream/sse.ts"
@@ -452,8 +452,8 @@
452
452
  "removedExports": [],
453
453
  "dependents": [
454
454
  "/src/unstable-core-do-not-import.ts",
455
- "/src/unstable-core-do-not-import/error/getErrorShape.ts",
456
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
455
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
456
+ "/src/unstable-core-do-not-import/error/getErrorShape.ts"
457
457
  ],
458
458
  "percent": 1.05,
459
459
  "reduction": 18.54
@@ -489,8 +489,8 @@
489
489
  },
490
490
  {
491
491
  "id": "/src/unstable-core-do-not-import/stream/utils/disposable.ts",
492
- "size": 1758,
493
- "origSize": 1784,
492
+ "size": 1755,
493
+ "origSize": 1836,
494
494
  "renderedExports": [
495
495
  "makeResource",
496
496
  "makeAsyncResource"
@@ -505,7 +505,7 @@
505
505
  "/src/unstable-core-do-not-import/stream/utils/timerResource.ts"
506
506
  ],
507
507
  "percent": 0.88,
508
- "reduction": 1.46
508
+ "reduction": 4.41
509
509
  },
510
510
  {
511
511
  "id": "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
@@ -860,19 +860,21 @@
860
860
  "reduction": 93.9
861
861
  },
862
862
  {
863
- "id": "/src/index.ts",
863
+ "id": "/src/http.ts",
864
864
  "size": 0,
865
- "origSize": 32,
865
+ "origSize": 37,
866
866
  "renderedExports": [],
867
867
  "removedExports": [],
868
- "dependents": [],
868
+ "dependents": [
869
+ "/src/adapters/ws.ts"
870
+ ],
869
871
  "percent": 0,
870
872
  "reduction": 100
871
873
  },
872
874
  {
873
- "id": "/src/rpc.ts",
875
+ "id": "/src/index.ts",
874
876
  "size": 0,
875
- "origSize": 36,
877
+ "origSize": 32,
876
878
  "renderedExports": [],
877
879
  "removedExports": [],
878
880
  "dependents": [],
@@ -880,21 +882,19 @@
880
882
  "reduction": 100
881
883
  },
882
884
  {
883
- "id": "/src/http.ts",
885
+ "id": "/src/shared.ts",
884
886
  "size": 0,
885
- "origSize": 37,
887
+ "origSize": 653,
886
888
  "renderedExports": [],
887
889
  "removedExports": [],
888
- "dependents": [
889
- "/src/adapters/ws.ts"
890
- ],
890
+ "dependents": [],
891
891
  "percent": 0,
892
892
  "reduction": 100
893
893
  },
894
894
  {
895
- "id": "/src/shared.ts",
895
+ "id": "/src/rpc.ts",
896
896
  "size": 0,
897
- "origSize": 653,
897
+ "origSize": 36,
898
898
  "renderedExports": [],
899
899
  "removedExports": [],
900
900
  "dependents": [],
@@ -909,9 +909,9 @@
909
909
  "removedExports": [],
910
910
  "dependents": [
911
911
  "/src/adapters/express.ts",
912
- "/src/adapters/next.ts",
913
- "/src/adapters/standalone.ts",
914
912
  "/src/adapters/ws.ts",
913
+ "/src/adapters/standalone.ts",
914
+ "/src/adapters/next.ts",
915
915
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
916
916
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
917
917
  "/src/adapters/node-http/writeResponse.ts"
@@ -941,16 +941,6 @@
941
941
  "percent": 0,
942
942
  "reduction": 100
943
943
  },
944
- {
945
- "id": "/src/adapters/fastify/index.ts",
946
- "size": 0,
947
- "origSize": 78,
948
- "renderedExports": [],
949
- "removedExports": [],
950
- "dependents": [],
951
- "percent": 0,
952
- "reduction": 100
953
- },
954
944
  {
955
945
  "id": "/src/adapters/fetch/index.ts",
956
946
  "size": 0,
@@ -969,13 +959,23 @@
969
959
  "removedExports": [],
970
960
  "dependents": [
971
961
  "/src/adapters/express.ts",
972
- "/src/adapters/next.ts",
973
- "/src/adapters/standalone.ts",
974
962
  "/src/adapters/ws.ts",
963
+ "/src/adapters/standalone.ts",
964
+ "/src/adapters/next.ts",
975
965
  "/src/adapters/fastify/fastifyRequestHandler.ts"
976
966
  ],
977
967
  "percent": 0,
978
968
  "reduction": 100
969
+ },
970
+ {
971
+ "id": "/src/adapters/fastify/index.ts",
972
+ "size": 0,
973
+ "origSize": 78,
974
+ "renderedExports": [],
975
+ "removedExports": [],
976
+ "dependents": [],
977
+ "percent": 0,
978
+ "reduction": 100
979
979
  }
980
980
  ],
981
981
  "moduleCount": 63
@@ -1 +1 @@
1
- {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../../../src/unstable-core-do-not-import/stream/utils/disposable.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,CAAC,GAAG,UAAU,CAY7E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC3B,CAAC,GAAG,eAAe,CAYrB"}
1
+ {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../../../src/unstable-core-do-not-import/stream/utils/disposable.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,CAAC,GAAG,UAAU,CAa7E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC3B,CAAC,GAAG,eAAe,CAarB"}
@@ -16,11 +16,12 @@ _Symbol1;
16
16
  */ function makeResource(thing, dispose) {
17
17
  const it = thing;
18
18
  // eslint-disable-next-line no-restricted-syntax
19
- if (it[Symbol.dispose]) {
20
- throw new Error('Symbol.dispose already exists');
21
- }
19
+ const existing = it[Symbol.dispose];
22
20
  // eslint-disable-next-line no-restricted-syntax
23
- it[Symbol.dispose] = dispose;
21
+ it[Symbol.dispose] = ()=>{
22
+ dispose();
23
+ existing?.();
24
+ };
24
25
  return it;
25
26
  }
26
27
  /**
@@ -32,11 +33,12 @@ _Symbol1;
32
33
  */ function makeAsyncResource(thing, dispose) {
33
34
  const it = thing;
34
35
  // eslint-disable-next-line no-restricted-syntax
35
- if (it[Symbol.asyncDispose]) {
36
- throw new Error('Symbol.asyncDispose already exists');
37
- }
36
+ const existing = it[Symbol.asyncDispose];
38
37
  // eslint-disable-next-line no-restricted-syntax
39
- it[Symbol.asyncDispose] = dispose;
38
+ it[Symbol.asyncDispose] = async ()=>{
39
+ await dispose();
40
+ await existing?.();
41
+ };
40
42
  return it;
41
43
  }
42
44
 
@@ -14,11 +14,12 @@ _Symbol1;
14
14
  */ function makeResource(thing, dispose) {
15
15
  const it = thing;
16
16
  // eslint-disable-next-line no-restricted-syntax
17
- if (it[Symbol.dispose]) {
18
- throw new Error('Symbol.dispose already exists');
19
- }
17
+ const existing = it[Symbol.dispose];
20
18
  // eslint-disable-next-line no-restricted-syntax
21
- it[Symbol.dispose] = dispose;
19
+ it[Symbol.dispose] = ()=>{
20
+ dispose();
21
+ existing?.();
22
+ };
22
23
  return it;
23
24
  }
24
25
  /**
@@ -30,11 +31,12 @@ _Symbol1;
30
31
  */ function makeAsyncResource(thing, dispose) {
31
32
  const it = thing;
32
33
  // eslint-disable-next-line no-restricted-syntax
33
- if (it[Symbol.asyncDispose]) {
34
- throw new Error('Symbol.asyncDispose already exists');
35
- }
34
+ const existing = it[Symbol.asyncDispose];
36
35
  // eslint-disable-next-line no-restricted-syntax
37
- it[Symbol.asyncDispose] = dispose;
36
+ it[Symbol.asyncDispose] = async ()=>{
37
+ await dispose();
38
+ await existing?.();
39
+ };
38
40
  return it;
39
41
  }
40
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.795+394b0f5cc",
3
+ "version": "11.0.0-rc.798+5cf2f3e17",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -152,5 +152,5 @@
152
152
  "peerDependencies": {
153
153
  "typescript": ">=5.7.2"
154
154
  },
155
- "gitHead": "394b0f5cc328937156cc75a772b3280231d4a2e2"
155
+ "gitHead": "5cf2f3e1780f8bfaf43ba564c91a8b428af7cf2d"
156
156
  }
@@ -14,17 +14,18 @@ Symbol.asyncDispose ??= Symbol();
14
14
  * @returns The original value with Symbol.dispose method added
15
15
  */
16
16
  export function makeResource<T>(thing: T, dispose: () => void): T & Disposable {
17
- const it = thing as T & Disposable;
17
+ const it = thing as T & Partial<Disposable>;
18
18
 
19
19
  // eslint-disable-next-line no-restricted-syntax
20
- if (it[Symbol.dispose]) {
21
- throw new Error('Symbol.dispose already exists');
22
- }
20
+ const existing = it[Symbol.dispose];
23
21
 
24
22
  // eslint-disable-next-line no-restricted-syntax
25
- it[Symbol.dispose] = dispose;
23
+ it[Symbol.dispose] = () => {
24
+ dispose();
25
+ existing?.();
26
+ };
26
27
 
27
- return it;
28
+ return it as T & Disposable;
28
29
  }
29
30
 
30
31
  /**
@@ -38,15 +39,16 @@ export function makeAsyncResource<T>(
38
39
  thing: T,
39
40
  dispose: () => Promise<void>,
40
41
  ): T & AsyncDisposable {
41
- const it = thing as T & AsyncDisposable;
42
+ const it = thing as T & Partial<AsyncDisposable>;
42
43
 
43
44
  // eslint-disable-next-line no-restricted-syntax
44
- if (it[Symbol.asyncDispose]) {
45
- throw new Error('Symbol.asyncDispose already exists');
46
- }
45
+ const existing = it[Symbol.asyncDispose];
47
46
 
48
47
  // eslint-disable-next-line no-restricted-syntax
49
- it[Symbol.asyncDispose] = dispose;
48
+ it[Symbol.asyncDispose] = async () => {
49
+ await dispose();
50
+ await existing?.();
51
+ };
50
52
 
51
- return it;
53
+ return it as T & AsyncDisposable;
52
54
  }