@trpc/client 11.0.0-rc.761 → 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.
- package/dist/bundle-analysis.json +26 -26
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/httpLink.js +23 -21
- package/dist/links/httpLink.mjs +24 -22
- package/package.json +4 -4
- package/src/links/httpLink.ts +23 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 20.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
102
|
+
"percent": 5.57,
|
|
103
103
|
"reduction": 37.14
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"id": "/src/links/httpLink.ts",
|
|
107
|
-
"size":
|
|
108
|
-
"origSize":
|
|
107
|
+
"size": 3292,
|
|
108
|
+
"origSize": 3765,
|
|
109
109
|
"renderedExports": [
|
|
110
110
|
"httpLink"
|
|
111
111
|
],
|
|
112
112
|
"removedExports": [],
|
|
113
113
|
"dependents": [],
|
|
114
|
-
"percent": 4.
|
|
115
|
-
"reduction":
|
|
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.
|
|
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.
|
|
149
|
+
"percent": 4.2,
|
|
150
150
|
"reduction": 21.8
|
|
151
151
|
},
|
|
152
152
|
{
|
|
@@ -310,26 +310,26 @@
|
|
|
310
310
|
"reduction": 82.58
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
|
-
"id": "/src/
|
|
313
|
+
"id": "/src/index.ts",
|
|
314
314
|
"size": 0,
|
|
315
|
-
"origSize":
|
|
315
|
+
"origSize": 652,
|
|
316
316
|
"renderedExports": [],
|
|
317
317
|
"removedExports": [],
|
|
318
|
-
"dependents": [
|
|
319
|
-
"/src/links/wsLink.ts",
|
|
320
|
-
"/src/links/httpSubscriptionLink.ts",
|
|
321
|
-
"/src/links/internals/httpUtils.ts"
|
|
322
|
-
],
|
|
318
|
+
"dependents": [],
|
|
323
319
|
"percent": 0,
|
|
324
320
|
"reduction": 100
|
|
325
321
|
},
|
|
326
322
|
{
|
|
327
|
-
"id": "/src/
|
|
323
|
+
"id": "/src/unstable-internals.ts",
|
|
328
324
|
"size": 0,
|
|
329
|
-
"origSize":
|
|
325
|
+
"origSize": 90,
|
|
330
326
|
"renderedExports": [],
|
|
331
327
|
"removedExports": [],
|
|
332
|
-
"dependents": [
|
|
328
|
+
"dependents": [
|
|
329
|
+
"/src/links/wsLink.ts",
|
|
330
|
+
"/src/links/httpSubscriptionLink.ts",
|
|
331
|
+
"/src/links/internals/httpUtils.ts"
|
|
332
|
+
],
|
|
333
333
|
"percent": 0,
|
|
334
334
|
"reduction": 100
|
|
335
335
|
}
|
|
@@ -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;
|
|
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"}
|
package/dist/links/httpLink.js
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
};
|
package/dist/links/httpLink.mjs
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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": "
|
|
102
|
+
"gitHead": "de6335c47117e1b513d1cf2ec64376deb903823a"
|
|
103
103
|
}
|
package/src/links/httpLink.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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);
|