@trpc/client 11.0.0-rc.764 → 11.0.0-rc.768

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": 66219,
3
- "bundleOrigSize": 83339,
4
- "bundleReduction": 20.54,
2
+ "bundleSize": 66332,
3
+ "bundleOrigSize": 83397,
4
+ "bundleReduction": 20.46,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/links/wsLink.ts",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "removedExports": [],
15
15
  "dependents": [],
16
- "percent": 27.21,
16
+ "percent": 27.16,
17
17
  "reduction": 10.3
18
18
  },
19
19
  {
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "removedExports": [],
27
27
  "dependents": [],
28
- "percent": 12.03,
28
+ "percent": 12.01,
29
29
  "reduction": 0
30
30
  },
31
31
  {
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "removedExports": [],
39
39
  "dependents": [],
40
- "percent": 9.09,
40
+ "percent": 9.07,
41
41
  "reduction": 4.42
42
42
  },
43
43
  {
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "removedExports": [],
51
51
  "dependents": [],
52
- "percent": 8.45,
52
+ "percent": 8.44,
53
53
  "reduction": 19.44
54
54
  },
55
55
  {
@@ -64,7 +64,7 @@
64
64
  "/src/links/httpBatchLink.ts",
65
65
  "/src/links/httpBatchStreamLink.ts"
66
66
  ],
67
- "percent": 6.17,
67
+ "percent": 6.16,
68
68
  "reduction": 5.64
69
69
  },
70
70
  {
@@ -76,7 +76,7 @@
76
76
  ],
77
77
  "removedExports": [],
78
78
  "dependents": [],
79
- "percent": 5.95,
79
+ "percent": 5.94,
80
80
  "reduction": 5.59
81
81
  },
82
82
  {
@@ -99,20 +99,20 @@
99
99
  "/src/links/httpBatchStreamLink.ts",
100
100
  "/src/links/httpSubscriptionLink.ts"
101
101
  ],
102
- "percent": 5.58,
102
+ "percent": 5.57,
103
103
  "reduction": 37.14
104
104
  },
105
105
  {
106
106
  "id": "/src/links/httpLink.ts",
107
- "size": 3179,
108
- "origSize": 3707,
107
+ "size": 3292,
108
+ "origSize": 3765,
109
109
  "renderedExports": [
110
110
  "httpLink"
111
111
  ],
112
112
  "removedExports": [],
113
113
  "dependents": [],
114
- "percent": 4.8,
115
- "reduction": 14.24
114
+ "percent": 4.96,
115
+ "reduction": 12.56
116
116
  },
117
117
  {
118
118
  "id": "/src/internals/TRPCUntypedClient.ts",
@@ -126,7 +126,7 @@
126
126
  "/src/createTRPCUntypedClient.ts",
127
127
  "/src/createTRPCClient.ts"
128
128
  ],
129
- "percent": 4.77,
129
+ "percent": 4.76,
130
130
  "reduction": 31.02
131
131
  },
132
132
  {
@@ -146,7 +146,7 @@
146
146
  "/src/links/httpSubscriptionLink.ts",
147
147
  "/src/internals/TRPCUntypedClient.ts"
148
148
  ],
149
- "percent": 4.21,
149
+ "percent": 4.2,
150
150
  "reduction": 21.8
151
151
  },
152
152
  {
@@ -1 +1 @@
1
- {"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,cAAc,IACtD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE,CAAC;AAmCJ;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAC5D,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC1D,QAAQ,CAAC,OAAO,CAAC,CAgEnB"}
1
+ {"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,cAAc,IACtD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE,CAAC;AAoCJ;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAC5D,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC1D,QAAQ,CAAC,OAAO,CAAC,CAgEnB"}
@@ -7,29 +7,31 @@ var httpUtils = require('./internals/httpUtils.js');
7
7
  var contentTypes = require('./internals/contentTypes.js');
8
8
 
9
9
  const universalRequester = (opts)=>{
10
- const input = httpUtils.getInput(opts);
11
- if (contentTypes.isFormData(input)) {
12
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
13
- throw new Error('FormData is only supported for mutations');
10
+ if ('input' in opts) {
11
+ const { input } = opts;
12
+ if (contentTypes.isFormData(input)) {
13
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
14
+ throw new Error('FormData is only supported for mutations');
15
+ }
16
+ return httpUtils.httpRequest({
17
+ ...opts,
18
+ // The browser will set this automatically and include the boundary= in it
19
+ contentTypeHeader: undefined,
20
+ getUrl: httpUtils.getUrl,
21
+ getBody: ()=>input
22
+ });
14
23
  }
15
- return httpUtils.httpRequest({
16
- ...opts,
17
- // The browser will set this automatically and include the boundary= in it
18
- contentTypeHeader: undefined,
19
- getUrl: httpUtils.getUrl,
20
- getBody: ()=>input
21
- });
22
- }
23
- if (contentTypes.isOctetType(input)) {
24
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
25
- throw new Error('Octet type input is only supported for mutations');
24
+ if (contentTypes.isOctetType(input)) {
25
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
26
+ throw new Error('Octet type input is only supported for mutations');
27
+ }
28
+ return httpUtils.httpRequest({
29
+ ...opts,
30
+ contentTypeHeader: 'application/octet-stream',
31
+ getUrl: httpUtils.getUrl,
32
+ getBody: ()=>input
33
+ });
26
34
  }
27
- return httpUtils.httpRequest({
28
- ...opts,
29
- contentTypeHeader: 'application/octet-stream',
30
- getUrl: httpUtils.getUrl,
31
- getBody: ()=>input
32
- });
33
35
  }
34
36
  return httpUtils.jsonHttpRequester(opts);
35
37
  };
@@ -1,33 +1,35 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { transformResult } from '@trpc/server/unstable-core-do-not-import';
3
3
  import { TRPCClientError } from '../TRPCClientError.mjs';
4
- import { resolveHTTPLinkOptions, getInput, httpRequest, getUrl, jsonHttpRequester } from './internals/httpUtils.mjs';
4
+ import { resolveHTTPLinkOptions, httpRequest, getUrl, jsonHttpRequester } from './internals/httpUtils.mjs';
5
5
  import { isFormData, isOctetType } from './internals/contentTypes.mjs';
6
6
 
7
7
  const universalRequester = (opts)=>{
8
- const input = getInput(opts);
9
- if (isFormData(input)) {
10
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
11
- throw new Error('FormData is only supported for mutations');
8
+ if ('input' in opts) {
9
+ const { input } = opts;
10
+ if (isFormData(input)) {
11
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
12
+ throw new Error('FormData is only supported for mutations');
13
+ }
14
+ return httpRequest({
15
+ ...opts,
16
+ // The browser will set this automatically and include the boundary= in it
17
+ contentTypeHeader: undefined,
18
+ getUrl,
19
+ getBody: ()=>input
20
+ });
12
21
  }
13
- return httpRequest({
14
- ...opts,
15
- // The browser will set this automatically and include the boundary= in it
16
- contentTypeHeader: undefined,
17
- getUrl,
18
- getBody: ()=>input
19
- });
20
- }
21
- if (isOctetType(input)) {
22
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
23
- throw new Error('Octet type input is only supported for mutations');
22
+ if (isOctetType(input)) {
23
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
24
+ throw new Error('Octet type input is only supported for mutations');
25
+ }
26
+ return httpRequest({
27
+ ...opts,
28
+ contentTypeHeader: 'application/octet-stream',
29
+ getUrl,
30
+ getBody: ()=>input
31
+ });
24
32
  }
25
- return httpRequest({
26
- ...opts,
27
- contentTypeHeader: 'application/octet-stream',
28
- getUrl,
29
- getBody: ()=>input
30
- });
31
33
  }
32
34
  return jsonHttpRequester(opts);
33
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "11.0.0-rc.764+71c7ccc49",
3
+ "version": "11.0.0-rc.768+de6335c47",
4
4
  "description": "The tRPC client library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -77,11 +77,11 @@
77
77
  "!**/__tests__"
78
78
  ],
79
79
  "peerDependencies": {
80
- "@trpc/server": "11.0.0-rc.764+71c7ccc49",
80
+ "@trpc/server": "11.0.0-rc.768+de6335c47",
81
81
  "typescript": ">=5.7.2"
82
82
  },
83
83
  "devDependencies": {
84
- "@trpc/server": "11.0.0-rc.764+71c7ccc49",
84
+ "@trpc/server": "11.0.0-rc.768+de6335c47",
85
85
  "@types/isomorphic-fetch": "^0.0.39",
86
86
  "@types/node": "^22.9.0",
87
87
  "eslint": "^9.13.0",
@@ -99,5 +99,5 @@
99
99
  "funding": [
100
100
  "https://trpc.io/sponsor"
101
101
  ],
102
- "gitHead": "71c7ccc4915f8689d4d974d983d1c69ebce74aef"
102
+ "gitHead": "de6335c47117e1b513d1cf2ec64376deb903823a"
103
103
  }
@@ -11,7 +11,6 @@ import type {
11
11
  Requester,
12
12
  } from './internals/httpUtils';
13
13
  import {
14
- getInput,
15
14
  getUrl,
16
15
  httpRequest,
17
16
  jsonHttpRequester,
@@ -37,33 +36,34 @@ export type HTTPLinkOptions<TRoot extends AnyClientTypes> =
37
36
  };
38
37
 
39
38
  const universalRequester: Requester = (opts) => {
40
- const input = getInput(opts);
39
+ if ('input' in opts) {
40
+ const { input } = opts;
41
+ if (isFormData(input)) {
42
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
43
+ throw new Error('FormData is only supported for mutations');
44
+ }
41
45
 
42
- if (isFormData(input)) {
43
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
44
- throw new Error('FormData is only supported for mutations');
46
+ return httpRequest({
47
+ ...opts,
48
+ // The browser will set this automatically and include the boundary= in it
49
+ contentTypeHeader: undefined,
50
+ getUrl,
51
+ getBody: () => input,
52
+ });
45
53
  }
46
54
 
47
- return httpRequest({
48
- ...opts,
49
- // The browser will set this automatically and include the boundary= in it
50
- contentTypeHeader: undefined,
51
- getUrl,
52
- getBody: () => input,
53
- });
54
- }
55
+ if (isOctetType(input)) {
56
+ if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
57
+ throw new Error('Octet type input is only supported for mutations');
58
+ }
55
59
 
56
- if (isOctetType(input)) {
57
- if (opts.type !== 'mutation' && opts.methodOverride !== 'POST') {
58
- throw new Error('Octet type input is only supported for mutations');
60
+ return httpRequest({
61
+ ...opts,
62
+ contentTypeHeader: 'application/octet-stream',
63
+ getUrl,
64
+ getBody: () => input,
65
+ });
59
66
  }
60
-
61
- return httpRequest({
62
- ...opts,
63
- contentTypeHeader: 'application/octet-stream',
64
- getUrl,
65
- getBody: () => input,
66
- });
67
67
  }
68
68
 
69
69
  return jsonHttpRequester(opts);