@trpc/client 11.1.2-canary.7 → 11.1.3-alpha-tmp-issues-6785.34
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 +25 -25
- package/dist/internals/dataLoader.d.ts.map +1 -1
- package/dist/internals/dataLoader.js +2 -6
- package/dist/internals/dataLoader.mjs +2 -6
- package/dist/links/wsLink/wsClient/requestManager.d.ts +4 -0
- package/dist/links/wsLink/wsClient/requestManager.d.ts.map +1 -1
- package/dist/links/wsLink/wsClient/requestManager.js +5 -0
- package/dist/links/wsLink/wsClient/requestManager.mjs +5 -0
- package/dist/links/wsLink/wsClient/wsClient.js +1 -1
- package/dist/links/wsLink/wsClient/wsClient.mjs +1 -1
- package/package.json +5 -5
- package/src/internals/dataLoader.ts +2 -6
- package/src/links/wsLink/wsClient/requestManager.ts +9 -0
- package/src/links/wsLink/wsClient/wsClient.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 19.
|
|
2
|
+
"bundleSize": 76613,
|
|
3
|
+
"bundleOrigSize": 95136,
|
|
4
|
+
"bundleReduction": 19.47,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink/wsClient/wsClient.ts",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12116,
|
|
9
|
+
"origSize": 12248,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"WsClient"
|
|
12
12
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/links/wsLink/createWsClient.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 15.
|
|
17
|
+
"percent": 15.81,
|
|
18
18
|
"reduction": 1.08
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"removedExports": [],
|
|
29
29
|
"dependents": [],
|
|
30
|
-
"percent": 10.
|
|
30
|
+
"percent": 10.55,
|
|
31
31
|
"reduction": 0
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependents": [
|
|
43
43
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
44
44
|
],
|
|
45
|
-
"percent": 8.
|
|
45
|
+
"percent": 8.06,
|
|
46
46
|
"reduction": 4.9
|
|
47
47
|
},
|
|
48
48
|
{
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
],
|
|
56
56
|
"removedExports": [],
|
|
57
57
|
"dependents": [],
|
|
58
|
-
"percent": 8
|
|
58
|
+
"percent": 8,
|
|
59
59
|
"reduction": 0
|
|
60
60
|
},
|
|
61
61
|
{
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
],
|
|
68
68
|
"removedExports": [],
|
|
69
69
|
"dependents": [],
|
|
70
|
-
"percent": 7.
|
|
70
|
+
"percent": 7.3,
|
|
71
71
|
"reduction": 19.44
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"id": "/src/links/wsLink/wsClient/requestManager.ts",
|
|
75
|
-
"size":
|
|
76
|
-
"origSize":
|
|
75
|
+
"size": 4992,
|
|
76
|
+
"origSize": 5433,
|
|
77
77
|
"renderedExports": [
|
|
78
78
|
"RequestManager"
|
|
79
79
|
],
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"dependents": [
|
|
82
82
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
83
83
|
],
|
|
84
|
-
"percent": 6.
|
|
85
|
-
"reduction": 8.
|
|
84
|
+
"percent": 6.52,
|
|
85
|
+
"reduction": 8.12
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"id": "/src/links/httpBatchLink.ts",
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
],
|
|
94
94
|
"removedExports": [],
|
|
95
95
|
"dependents": [],
|
|
96
|
-
"percent": 5.
|
|
96
|
+
"percent": 5.38,
|
|
97
97
|
"reduction": 4.6
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"id": "/src/internals/dataLoader.ts",
|
|
101
|
-
"size":
|
|
102
|
-
"origSize":
|
|
101
|
+
"size": 4026,
|
|
102
|
+
"origSize": 4261,
|
|
103
103
|
"renderedExports": [
|
|
104
104
|
"dataLoader"
|
|
105
105
|
],
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"/src/links/httpBatchLink.ts",
|
|
109
109
|
"/src/links/httpBatchStreamLink.ts"
|
|
110
110
|
],
|
|
111
|
-
"percent": 5.
|
|
112
|
-
"reduction": 5.
|
|
111
|
+
"percent": 5.25,
|
|
112
|
+
"reduction": 5.52
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"id": "/src/links/internals/httpUtils.ts",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"/src/links/httpBatchStreamLink.ts",
|
|
132
132
|
"/src/links/httpSubscriptionLink.ts"
|
|
133
133
|
],
|
|
134
|
-
"percent": 4.
|
|
134
|
+
"percent": 4.82,
|
|
135
135
|
"reduction": 37.14
|
|
136
136
|
},
|
|
137
137
|
{
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
],
|
|
144
144
|
"removedExports": [],
|
|
145
145
|
"dependents": [],
|
|
146
|
-
"percent": 4.
|
|
146
|
+
"percent": 4.3,
|
|
147
147
|
"reduction": 12.56
|
|
148
148
|
},
|
|
149
149
|
{
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"/src/createTRPCUntypedClient.ts",
|
|
159
159
|
"/src/createTRPCClient.ts"
|
|
160
160
|
],
|
|
161
|
-
"percent": 4.
|
|
161
|
+
"percent": 4.12,
|
|
162
162
|
"reduction": 28.5
|
|
163
163
|
},
|
|
164
164
|
{
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"/src/internals/TRPCUntypedClient.ts",
|
|
179
179
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
180
180
|
],
|
|
181
|
-
"percent": 3.
|
|
181
|
+
"percent": 3.64,
|
|
182
182
|
"reduction": 21.8
|
|
183
183
|
},
|
|
184
184
|
{
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"/src/links/wsLink/wsClient/requestManager.ts",
|
|
199
199
|
"/src/links/wsLink/wsClient/wsConnection.ts"
|
|
200
200
|
],
|
|
201
|
-
"percent": 3.
|
|
201
|
+
"percent": 3.63,
|
|
202
202
|
"reduction": 0.47
|
|
203
203
|
},
|
|
204
204
|
{
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
],
|
|
211
211
|
"removedExports": [],
|
|
212
212
|
"dependents": [],
|
|
213
|
-
"percent": 3.
|
|
213
|
+
"percent": 3.38,
|
|
214
214
|
"reduction": 19.62
|
|
215
215
|
},
|
|
216
216
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataLoader.d.ts","sourceRoot":"","sources":["../../src/internals/dataLoader.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC;IACpC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;CAChE,CAAC;AAWF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EACrC,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;gBAsGnB,IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dataLoader.d.ts","sourceRoot":"","sources":["../../src/internals/dataLoader.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC;IACpC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;CAChE,CAAC;AAWF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EACrC,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;gBAsGnB,IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;EAyB1C"}
|
|
@@ -103,14 +103,10 @@
|
|
|
103
103
|
const promise = new Promise((resolve, reject)=>{
|
|
104
104
|
item.reject = reject;
|
|
105
105
|
item.resolve = resolve;
|
|
106
|
-
|
|
107
|
-
pendingItems = [];
|
|
108
|
-
}
|
|
106
|
+
pendingItems ?? (pendingItems = []);
|
|
109
107
|
pendingItems.push(item);
|
|
110
108
|
});
|
|
111
|
-
|
|
112
|
-
dispatchTimer = setTimeout(dispatch);
|
|
113
|
-
}
|
|
109
|
+
dispatchTimer ?? (dispatchTimer = setTimeout(dispatch));
|
|
114
110
|
return promise;
|
|
115
111
|
}
|
|
116
112
|
return {
|
|
@@ -101,14 +101,10 @@
|
|
|
101
101
|
const promise = new Promise((resolve, reject)=>{
|
|
102
102
|
item.reject = reject;
|
|
103
103
|
item.resolve = resolve;
|
|
104
|
-
|
|
105
|
-
pendingItems = [];
|
|
106
|
-
}
|
|
104
|
+
pendingItems ?? (pendingItems = []);
|
|
107
105
|
pendingItems.push(item);
|
|
108
106
|
});
|
|
109
|
-
|
|
110
|
-
dispatchTimer = setTimeout(dispatch);
|
|
111
|
-
}
|
|
107
|
+
dispatchTimer ?? (dispatchTimer = setTimeout(dispatch));
|
|
112
108
|
return promise;
|
|
113
109
|
}
|
|
114
110
|
return {
|
|
@@ -93,6 +93,10 @@ export declare class RequestManager {
|
|
|
93
93
|
* Checks if there are any pending requests, including ongoing subscriptions.
|
|
94
94
|
*/
|
|
95
95
|
hasPendingRequests(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if there are any pending subscriptions
|
|
98
|
+
*/
|
|
99
|
+
hasPendingSubscriptions(): boolean;
|
|
96
100
|
/**
|
|
97
101
|
* Checks if there are any outgoing requests waiting to be sent.
|
|
98
102
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestManager.d.ts","sourceRoot":"","sources":["../../../../src/links/wsLink/wsClient/requestManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAC/B,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC,EAC7D,eAAe,CAAC,aAAa,CAAC,CAC/B,CAAC;AAEF,KAAK,SAAS,GAAG,MAAM,CAAC;AACxB,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE5C;;;;GAIG;AACH,UAAU,OAAO;IACf,OAAO,EAAE,yBAAyB,CAAC;IACnC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAA4C;IAEpE;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAkC;IAEzD;;;;;;;OAOG;IACI,QAAQ,CAAC,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,UAAU;IA2BzE;;OAEG;IACI,MAAM,CAAC,SAAS,EAAE,aAAa;IAStC;;;;;;;OAOG;IACI,KAAK;YAhEyC,SAAS;;IA0E9D;;;OAGG;IACI,kBAAkB;IAIzB;;OAEG;IACI,iBAAiB,CAAC,SAAS,EAAE,aAAa;IAMjD;;OAEG;IACI,mBAAmB;YA9F2B,SAAS;;IAkG9D;;;;OAIG;IACI,WAAW;;;;;;;;;;;IAiBlB;;OAEG;IACI,kBAAkB;IAIzB;;OAEG;IACI,mBAAmB;CAG3B"}
|
|
1
|
+
{"version":3,"file":"requestManager.d.ts","sourceRoot":"","sources":["../../../../src/links/wsLink/wsClient/requestManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAC/B,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC,EAC7D,eAAe,CAAC,aAAa,CAAC,CAC/B,CAAC;AAEF,KAAK,SAAS,GAAG,MAAM,CAAC;AACxB,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE5C;;;;GAIG;AACH,UAAU,OAAO;IACf,OAAO,EAAE,yBAAyB,CAAC;IACnC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAA4C;IAEpE;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAkC;IAEzD;;;;;;;OAOG;IACI,QAAQ,CAAC,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,UAAU;IA2BzE;;OAEG;IACI,MAAM,CAAC,SAAS,EAAE,aAAa;IAStC;;;;;;;OAOG;IACI,KAAK;YAhEyC,SAAS;;IA0E9D;;;OAGG;IACI,kBAAkB;IAIzB;;OAEG;IACI,iBAAiB,CAAC,SAAS,EAAE,aAAa;IAMjD;;OAEG;IACI,mBAAmB;YA9F2B,SAAS;;IAkG9D;;;;OAIG;IACI,WAAW;;;;;;;;;;;IAiBlB;;OAEG;IACI,kBAAkB;IAIzB;;OAEG;IACI,uBAAuB;IAM9B;;OAEG;IACI,mBAAmB;CAG3B"}
|
|
@@ -119,6 +119,11 @@ function _define_property(obj, key, value) {
|
|
|
119
119
|
return this.getPendingRequests().length > 0;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
+
* Checks if there are any pending subscriptions
|
|
123
|
+
*/ hasPendingSubscriptions() {
|
|
124
|
+
return this.getPendingRequests().some((request)=>request.message.method === 'subscription');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
122
127
|
* Checks if there are any outgoing requests waiting to be sent.
|
|
123
128
|
*/ hasOutgoingRequests() {
|
|
124
129
|
return this.outgoingRequests.length > 0;
|
|
@@ -117,6 +117,11 @@ function _define_property(obj, key, value) {
|
|
|
117
117
|
return this.getPendingRequests().length > 0;
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
+
* Checks if there are any pending subscriptions
|
|
121
|
+
*/ hasPendingSubscriptions() {
|
|
122
|
+
return this.getPendingRequests().some((request)=>request.message.method === 'subscription');
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
120
125
|
* Checks if there are any outgoing requests waiting to be sent.
|
|
121
126
|
*/ hasOutgoingRequests() {
|
|
122
127
|
return this.outgoingRequests.length > 0;
|
|
@@ -188,7 +188,7 @@ function _define_property(obj, key, value) {
|
|
|
188
188
|
ws.addEventListener('close', (event)=>{
|
|
189
189
|
handleCloseOrError(event);
|
|
190
190
|
this.callbacks.onClose?.(event);
|
|
191
|
-
if (!this.lazyMode) {
|
|
191
|
+
if (!this.lazyMode || this.requestManager.hasPendingSubscriptions()) {
|
|
192
192
|
this.reconnect(new utils.TRPCWebSocketClosedError({
|
|
193
193
|
message: 'WebSocket closed',
|
|
194
194
|
cause: event
|
|
@@ -186,7 +186,7 @@ function _define_property(obj, key, value) {
|
|
|
186
186
|
ws.addEventListener('close', (event)=>{
|
|
187
187
|
handleCloseOrError(event);
|
|
188
188
|
this.callbacks.onClose?.(event);
|
|
189
|
-
if (!this.lazyMode) {
|
|
189
|
+
if (!this.lazyMode || this.requestManager.hasPendingSubscriptions()) {
|
|
190
190
|
this.reconnect(new TRPCWebSocketClosedError({
|
|
191
191
|
message: 'WebSocket closed',
|
|
192
192
|
cause: event
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.3-alpha-tmp-issues-6785.34+051d951a8",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
"!**/__tests__"
|
|
78
78
|
],
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@trpc/server": "11.1.
|
|
80
|
+
"@trpc/server": "11.1.3-alpha-tmp-issues-6785.34+051d951a8",
|
|
81
81
|
"typescript": ">=5.7.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@trpc/server": "11.1.
|
|
84
|
+
"@trpc/server": "11.1.3-alpha-tmp-issues-6785.34+051d951a8",
|
|
85
85
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
86
86
|
"@types/node": "^22.13.5",
|
|
87
87
|
"dataloader": "^2.2.2",
|
|
88
|
-
"eslint": "^9.
|
|
88
|
+
"eslint": "^9.26.0",
|
|
89
89
|
"isomorphic-fetch": "^3.0.0",
|
|
90
90
|
"node-fetch": "^3.3.0",
|
|
91
91
|
"rollup": "^4.34.8",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"funding": [
|
|
102
102
|
"https://trpc.io/sponsor"
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "051d951a890850119f639d8a62db85cc8335b884"
|
|
105
105
|
}
|
|
@@ -145,15 +145,11 @@ export function dataLoader<TKey, TValue>(
|
|
|
145
145
|
item.reject = reject;
|
|
146
146
|
item.resolve = resolve;
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
pendingItems = [];
|
|
150
|
-
}
|
|
148
|
+
pendingItems ??= [];
|
|
151
149
|
pendingItems.push(item);
|
|
152
150
|
});
|
|
153
151
|
|
|
154
|
-
|
|
155
|
-
dispatchTimer = setTimeout(dispatch);
|
|
156
|
-
}
|
|
152
|
+
dispatchTimer ??= setTimeout(dispatch);
|
|
157
153
|
|
|
158
154
|
return promise;
|
|
159
155
|
}
|
|
@@ -165,6 +165,15 @@ export class RequestManager {
|
|
|
165
165
|
return this.getPendingRequests().length > 0;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Checks if there are any pending subscriptions
|
|
170
|
+
*/
|
|
171
|
+
public hasPendingSubscriptions() {
|
|
172
|
+
return this.getPendingRequests().some(
|
|
173
|
+
(request) => request.message.method === 'subscription',
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
168
177
|
/**
|
|
169
178
|
* Checks if there are any outgoing requests waiting to be sent.
|
|
170
179
|
*/
|
|
@@ -330,7 +330,7 @@ export class WsClient {
|
|
|
330
330
|
handleCloseOrError(event);
|
|
331
331
|
this.callbacks.onClose?.(event);
|
|
332
332
|
|
|
333
|
-
if (!this.lazyMode) {
|
|
333
|
+
if (!this.lazyMode || this.requestManager.hasPendingSubscriptions()) {
|
|
334
334
|
this.reconnect(
|
|
335
335
|
new TRPCWebSocketClosedError({
|
|
336
336
|
message: 'WebSocket closed',
|