@trpc/server 11.0.0-rc.797 → 11.0.0-rc.800

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",
@@ -360,10 +360,10 @@
360
360
  "/src/unstable-core-do-not-import/router.ts",
361
361
  "/src/unstable-core-do-not-import/transformer.ts",
362
362
  "/src/unstable-core-do-not-import/middleware.ts",
363
- "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
364
363
  "/src/unstable-core-do-not-import/http/contentType.ts",
365
364
  "/src/unstable-core-do-not-import/http/abortError.ts",
366
365
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
366
+ "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
367
367
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
368
368
  "/src/unstable-core-do-not-import/stream/sse.ts"
369
369
  ],
@@ -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",
@@ -881,16 +881,6 @@
881
881
  "percent": 0,
882
882
  "reduction": 100
883
883
  },
884
- {
885
- "id": "/src/rpc.ts",
886
- "size": 0,
887
- "origSize": 36,
888
- "renderedExports": [],
889
- "removedExports": [],
890
- "dependents": [],
891
- "percent": 0,
892
- "reduction": 100
893
- },
894
884
  {
895
885
  "id": "/src/shared.ts",
896
886
  "size": 0,
@@ -909,9 +899,9 @@
909
899
  "removedExports": [],
910
900
  "dependents": [
911
901
  "/src/adapters/express.ts",
902
+ "/src/adapters/standalone.ts",
912
903
  "/src/adapters/next.ts",
913
904
  "/src/adapters/ws.ts",
914
- "/src/adapters/standalone.ts",
915
905
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
916
906
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
917
907
  "/src/adapters/node-http/writeResponse.ts"
@@ -919,6 +909,16 @@
919
909
  "percent": 0,
920
910
  "reduction": 100
921
911
  },
912
+ {
913
+ "id": "/src/rpc.ts",
914
+ "size": 0,
915
+ "origSize": 36,
916
+ "renderedExports": [],
917
+ "removedExports": [],
918
+ "dependents": [],
919
+ "percent": 0,
920
+ "reduction": 100
921
+ },
922
922
  {
923
923
  "id": "/src/adapters/next-app-dir.ts",
924
924
  "size": 0,
@@ -969,9 +969,9 @@
969
969
  "removedExports": [],
970
970
  "dependents": [
971
971
  "/src/adapters/express.ts",
972
+ "/src/adapters/standalone.ts",
972
973
  "/src/adapters/next.ts",
973
974
  "/src/adapters/ws.ts",
974
- "/src/adapters/standalone.ts",
975
975
  "/src/adapters/fastify/fastifyRequestHandler.ts"
976
976
  ],
977
977
  "percent": 0,
@@ -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.797+8374c3b18",
3
+ "version": "11.0.0-rc.800+892471d1b",
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": "8374c3b1869538c8a32c2ea266c9762c98a8b91c"
155
+ "gitHead": "892471d1bd6914ca2df548bdda2e703e3c73a5e7"
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
  }