@trpc/client 11.0.0-rc.593 → 11.0.0-rc.599
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 +21 -21
- package/dist/links/httpSubscriptionLink.d.ts +4 -3
- package/dist/links/httpSubscriptionLink.d.ts.map +1 -1
- package/dist/links/httpSubscriptionLink.js +3 -1
- package/dist/links/httpSubscriptionLink.mjs +3 -1
- package/dist/links/internals/urlWithConnectionParams.d.ts +2 -1
- package/dist/links/internals/urlWithConnectionParams.d.ts.map +1 -1
- package/dist/links/internals/urlWithConnectionParams.js +3 -2
- package/dist/links/internals/urlWithConnectionParams.mjs +3 -2
- package/package.json +4 -4
- package/src/links/httpSubscriptionLink.ts +9 -6
- package/src/links/internals/urlWithConnectionParams.ts +8 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 22.
|
|
2
|
+
"bundleSize": 62359,
|
|
3
|
+
"bundleOrigSize": 80871,
|
|
4
|
+
"bundleReduction": 22.89,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
@@ -13,19 +13,19 @@
|
|
|
13
13
|
],
|
|
14
14
|
"removedExports": [],
|
|
15
15
|
"dependents": [],
|
|
16
|
-
"percent": 28.
|
|
16
|
+
"percent": 28.83,
|
|
17
17
|
"reduction": 10.34
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"id": "/src/links/httpSubscriptionLink.ts",
|
|
21
|
-
"size":
|
|
22
|
-
"origSize":
|
|
21
|
+
"size": 6723,
|
|
22
|
+
"origSize": 6686,
|
|
23
23
|
"renderedExports": [
|
|
24
24
|
"unstable_httpSubscriptionLink"
|
|
25
25
|
],
|
|
26
26
|
"removedExports": [],
|
|
27
27
|
"dependents": [],
|
|
28
|
-
"percent": 10.
|
|
28
|
+
"percent": 10.78,
|
|
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.63,
|
|
41
41
|
"reduction": 4.41
|
|
42
42
|
},
|
|
43
43
|
{
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"removedExports": [],
|
|
51
51
|
"dependents": [],
|
|
52
|
-
"percent": 8.
|
|
52
|
+
"percent": 8.8,
|
|
53
53
|
"reduction": 20.69
|
|
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.55,
|
|
68
68
|
"reduction": 5.64
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
],
|
|
77
77
|
"removedExports": [],
|
|
78
78
|
"dependents": [],
|
|
79
|
-
"percent": 6.
|
|
79
|
+
"percent": 6.32,
|
|
80
80
|
"reduction": 5.56
|
|
81
81
|
},
|
|
82
82
|
{
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"/src/links/httpBatchStreamLink.ts",
|
|
100
100
|
"/src/links/httpSubscriptionLink.ts"
|
|
101
101
|
],
|
|
102
|
-
"percent": 5.
|
|
102
|
+
"percent": 5.92,
|
|
103
103
|
"reduction": 37.12
|
|
104
104
|
},
|
|
105
105
|
{
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
],
|
|
112
112
|
"removedExports": [],
|
|
113
113
|
"dependents": [],
|
|
114
|
-
"percent": 5.
|
|
114
|
+
"percent": 5.1,
|
|
115
115
|
"reduction": 14.14
|
|
116
116
|
},
|
|
117
117
|
{
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"/src/createTRPCUntypedClient.ts",
|
|
127
127
|
"/src/createTRPCClient.ts"
|
|
128
128
|
],
|
|
129
|
-
"percent": 4.
|
|
129
|
+
"percent": 4.34,
|
|
130
130
|
"reduction": 40.88
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"/src/links/httpSubscriptionLink.ts",
|
|
147
147
|
"/src/internals/TRPCUntypedClient.ts"
|
|
148
148
|
],
|
|
149
|
-
"percent": 3.
|
|
149
|
+
"percent": 3.11,
|
|
150
150
|
"reduction": 45.57
|
|
151
151
|
},
|
|
152
152
|
{
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
],
|
|
159
159
|
"removedExports": [],
|
|
160
160
|
"dependents": [],
|
|
161
|
-
"percent": 2.
|
|
161
|
+
"percent": 2.06,
|
|
162
162
|
"reduction": 33.02
|
|
163
163
|
},
|
|
164
164
|
{
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"dependents": [
|
|
193
193
|
"/src/index.ts"
|
|
194
194
|
],
|
|
195
|
-
"percent": 1.
|
|
195
|
+
"percent": 1.9,
|
|
196
196
|
"reduction": 73.19
|
|
197
197
|
},
|
|
198
198
|
{
|
|
@@ -267,8 +267,8 @@
|
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
"id": "/src/links/internals/urlWithConnectionParams.ts",
|
|
270
|
-
"size":
|
|
271
|
-
"origSize":
|
|
270
|
+
"size": 240,
|
|
271
|
+
"origSize": 1016,
|
|
272
272
|
"renderedExports": [
|
|
273
273
|
"resultOf"
|
|
274
274
|
],
|
|
@@ -277,8 +277,8 @@
|
|
|
277
277
|
"/src/links/wsLink.ts",
|
|
278
278
|
"/src/links/httpSubscriptionLink.ts"
|
|
279
279
|
],
|
|
280
|
-
"percent": 0.
|
|
281
|
-
"reduction":
|
|
280
|
+
"percent": 0.38,
|
|
281
|
+
"reduction": 76.38
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
284
|
"id": "/src/createTRPCUntypedClient.ts",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AnyClientTypes, EventSourceLike, inferClientTypes, InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import { type TransformerOptions } from '../unstable-internals';
|
|
3
|
-
import type { CallbackOrValue } from './internals/urlWithConnectionParams';
|
|
4
3
|
import { type UrlOptionsWithConnectionParams } from './internals/urlWithConnectionParams';
|
|
5
|
-
import type { TRPCLink } from './types';
|
|
4
|
+
import type { Operation, TRPCLink } from './types';
|
|
6
5
|
type HTTPSubscriptionLinkOptions<TRoot extends AnyClientTypes, TEventSource extends EventSourceLike.AnyConstructor = typeof EventSource> = {
|
|
7
6
|
/**
|
|
8
7
|
* EventSource ponyfill
|
|
@@ -11,7 +10,9 @@ type HTTPSubscriptionLinkOptions<TRoot extends AnyClientTypes, TEventSource exte
|
|
|
11
10
|
/**
|
|
12
11
|
* EventSource options or a callback that returns them
|
|
13
12
|
*/
|
|
14
|
-
eventSourceOptions?:
|
|
13
|
+
eventSourceOptions?: EventSourceLike.InitDictOf<TEventSource> | ((opts: {
|
|
14
|
+
op: Operation;
|
|
15
|
+
}) => EventSourceLike.InitDictOf<TEventSource> | Promise<EventSourceLike.InitDictOf<TEventSource>>);
|
|
15
16
|
} & TransformerOptions<TRoot> & UrlOptionsWithConnectionParams;
|
|
16
17
|
/**
|
|
17
18
|
* @see https://trpc.io/docs/client/links/httpSubscriptionLink
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpSubscriptionLink.d.ts","sourceRoot":"","sources":["../../src/links/httpSubscriptionLink.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAQlD,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,
|
|
1
|
+
{"version":3,"file":"httpSubscriptionLink.d.ts","sourceRoot":"","sources":["../../src/links/httpSubscriptionLink.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAQlD,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBnD,KAAK,2BAA2B,CAC9B,KAAK,SAAS,cAAc,EAC5B,YAAY,SAAS,eAAe,CAAC,cAAc,GAAG,OAAO,WAAW,IACtE;IACF;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,kBAAkB,CAAC,EACf,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,GACxC,CAAC,CAAC,IAAI,EAAE;QACN,EAAE,EAAE,SAAS,CAAC;KACf,KACG,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,GACxC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5D,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAC3B,8BAA8B,CAAC;AAajC;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,SAAS,qBAAqB,EACzC,YAAY,SAAS,eAAe,CAAC,cAAc,EAEnD,IAAI,EAAE,2BAA2B,CAC/B,gBAAgB,CAAC,WAAW,CAAC,EAC7B,YAAY,CACb,GACA,QAAQ,CAAC,WAAW,CAAC,CA6IvB"}
|
|
@@ -49,7 +49,9 @@ async function urlWithConnectionParams(opts) {
|
|
|
49
49
|
type,
|
|
50
50
|
signal: null
|
|
51
51
|
}),
|
|
52
|
-
init: ()=>urlWithConnectionParams$1.resultOf(opts.eventSourceOptions
|
|
52
|
+
init: ()=>urlWithConnectionParams$1.resultOf(opts.eventSourceOptions, {
|
|
53
|
+
op
|
|
54
|
+
}),
|
|
53
55
|
signal,
|
|
54
56
|
deserialize: transformer$1.output.deserialize,
|
|
55
57
|
EventSource: opts.EventSource ?? globalThis.EventSource
|
|
@@ -47,7 +47,9 @@ async function urlWithConnectionParams(opts) {
|
|
|
47
47
|
type,
|
|
48
48
|
signal: null
|
|
49
49
|
}),
|
|
50
|
-
init: ()=>resultOf(opts.eventSourceOptions
|
|
50
|
+
init: ()=>resultOf(opts.eventSourceOptions, {
|
|
51
|
+
op
|
|
52
|
+
}),
|
|
51
53
|
signal,
|
|
52
54
|
deserialize: transformer.output.deserialize,
|
|
53
55
|
EventSource: opts.EventSource ?? globalThis.EventSource
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type TRPCRequestInfo } from '@trpc/server/http';
|
|
2
2
|
/**
|
|
3
3
|
* Get the result of a value or function that returns a value
|
|
4
|
+
* It also optionally accepts typesafe arguments for the function
|
|
4
5
|
*/
|
|
5
|
-
export declare const resultOf: <T>(value: T | (() => T)) => T;
|
|
6
|
+
export declare const resultOf: <T, TArgs extends any[]>(value: T | ((...args: TArgs) => T), ...args: TArgs) => T;
|
|
6
7
|
/**
|
|
7
8
|
* A value that can be wrapped in callback
|
|
8
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlWithConnectionParams.d.ts","sourceRoot":"","sources":["../../../src/links/internals/urlWithConnectionParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"urlWithConnectionParams.d.ts","sourceRoot":"","sources":["../../../src/links/internals/urlWithConnectionParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,SAAS,GAAG,EAAE,SACtC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,WACzB,KAAK,KACb,CAIF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAE7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;CACzE"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the result of a value or function that returns a value
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* It also optionally accepts typesafe arguments for the function
|
|
6
|
+
*/ const resultOf = (value, ...args)=>{
|
|
7
|
+
return typeof value === 'function' ? value(...args) : value;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
exports.resultOf = resultOf;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the result of a value or function that returns a value
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
* It also optionally accepts typesafe arguments for the function
|
|
4
|
+
*/ const resultOf = (value, ...args)=>{
|
|
5
|
+
return typeof value === 'function' ? value(...args) : value;
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
export { resultOf };
|
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.599+e16cd8d7c",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"!**/*.test.*"
|
|
77
77
|
],
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@trpc/server": "11.0.0-rc.
|
|
79
|
+
"@trpc/server": "11.0.0-rc.599+e16cd8d7c"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@trpc/server": "11.0.0-rc.
|
|
82
|
+
"@trpc/server": "11.0.0-rc.599+e16cd8d7c",
|
|
83
83
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
84
84
|
"@types/node": "^20.10.0",
|
|
85
85
|
"eslint": "^8.57.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"funding": [
|
|
97
97
|
"https://trpc.io/sponsor"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "e16cd8d7cee12eaf1545273858407f0947ca97fc"
|
|
100
100
|
}
|
|
@@ -16,12 +16,11 @@ import { TRPCClientError } from '../TRPCClientError';
|
|
|
16
16
|
import type { TRPCConnectionState } from '../unstable-internals';
|
|
17
17
|
import { getTransformer, type TransformerOptions } from '../unstable-internals';
|
|
18
18
|
import { getUrl } from './internals/httpUtils';
|
|
19
|
-
import type { CallbackOrValue } from './internals/urlWithConnectionParams';
|
|
20
19
|
import {
|
|
21
20
|
resultOf,
|
|
22
21
|
type UrlOptionsWithConnectionParams,
|
|
23
22
|
} from './internals/urlWithConnectionParams';
|
|
24
|
-
import type { TRPCLink } from './types';
|
|
23
|
+
import type { Operation, TRPCLink } from './types';
|
|
25
24
|
|
|
26
25
|
async function urlWithConnectionParams(
|
|
27
26
|
opts: UrlOptionsWithConnectionParams,
|
|
@@ -49,9 +48,13 @@ type HTTPSubscriptionLinkOptions<
|
|
|
49
48
|
/**
|
|
50
49
|
* EventSource options or a callback that returns them
|
|
51
50
|
*/
|
|
52
|
-
eventSourceOptions?:
|
|
53
|
-
EventSourceLike.InitDictOf<TEventSource>
|
|
54
|
-
|
|
51
|
+
eventSourceOptions?:
|
|
52
|
+
| EventSourceLike.InitDictOf<TEventSource>
|
|
53
|
+
| ((opts: {
|
|
54
|
+
op: Operation;
|
|
55
|
+
}) =>
|
|
56
|
+
| EventSourceLike.InitDictOf<TEventSource>
|
|
57
|
+
| Promise<EventSourceLike.InitDictOf<TEventSource>>);
|
|
55
58
|
} & TransformerOptions<TRoot> &
|
|
56
59
|
UrlOptionsWithConnectionParams;
|
|
57
60
|
|
|
@@ -109,7 +112,7 @@ export function unstable_httpSubscriptionLink<
|
|
|
109
112
|
type,
|
|
110
113
|
signal: null,
|
|
111
114
|
}),
|
|
112
|
-
init: () => resultOf(opts.eventSourceOptions),
|
|
115
|
+
init: () => resultOf(opts.eventSourceOptions, { op }),
|
|
113
116
|
signal,
|
|
114
117
|
deserialize: transformer.output.deserialize,
|
|
115
118
|
EventSource:
|
|
@@ -2,9 +2,15 @@ import { type TRPCRequestInfo } from '@trpc/server/http';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the result of a value or function that returns a value
|
|
5
|
+
* It also optionally accepts typesafe arguments for the function
|
|
5
6
|
*/
|
|
6
|
-
export const resultOf = <T
|
|
7
|
-
|
|
7
|
+
export const resultOf = <T, TArgs extends any[]>(
|
|
8
|
+
value: T | ((...args: TArgs) => T),
|
|
9
|
+
...args: TArgs
|
|
10
|
+
): T => {
|
|
11
|
+
return typeof value === 'function'
|
|
12
|
+
? (value as (...args: TArgs) => T)(...args)
|
|
13
|
+
: value;
|
|
8
14
|
};
|
|
9
15
|
|
|
10
16
|
/**
|