@trpc/client 11.1.3-canary.7 → 11.1.4-alpha-tmp-issues-6744.2

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,12 +1,12 @@
1
1
  {
2
- "bundleSize": 76364,
3
- "bundleOrigSize": 94870,
4
- "bundleReduction": 19.51,
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": 12067,
9
- "origSize": 12199,
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.8,
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.59,
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.08,
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.03,
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.33,
70
+ "percent": 7.3,
71
71
  "reduction": 19.44
72
72
  },
73
73
  {
74
74
  "id": "/src/links/wsLink/wsClient/requestManager.ts",
75
- "size": 4792,
76
- "origSize": 5216,
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.28,
85
- "reduction": 8.13
84
+ "percent": 6.52,
85
+ "reduction": 8.12
86
86
  },
87
87
  {
88
88
  "id": "/src/links/httpBatchLink.ts",
@@ -93,7 +93,7 @@
93
93
  ],
94
94
  "removedExports": [],
95
95
  "dependents": [],
96
- "percent": 5.4,
96
+ "percent": 5.38,
97
97
  "reduction": 4.6
98
98
  },
99
99
  {
@@ -108,7 +108,7 @@
108
108
  "/src/links/httpBatchLink.ts",
109
109
  "/src/links/httpBatchStreamLink.ts"
110
110
  ],
111
- "percent": 5.27,
111
+ "percent": 5.25,
112
112
  "reduction": 5.52
113
113
  },
114
114
  {
@@ -131,7 +131,7 @@
131
131
  "/src/links/httpBatchStreamLink.ts",
132
132
  "/src/links/httpSubscriptionLink.ts"
133
133
  ],
134
- "percent": 4.83,
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.31,
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.14,
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.65,
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.64,
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.39,
213
+ "percent": 3.38,
214
214
  "reduction": 19.62
215
215
  },
216
216
  {
@@ -227,7 +227,7 @@
227
227
  "/src/links/httpBatchStreamLink.ts",
228
228
  "/src/links/httpSubscriptionLink.ts"
229
229
  ],
230
- "percent": 1.56,
230
+ "percent": 1.55,
231
231
  "reduction": 3.88
232
232
  },
233
233
  {
@@ -314,7 +314,7 @@
314
314
  "dependents": [
315
315
  "/src/links/wsLink/wsClient/wsClient.ts"
316
316
  ],
317
- "percent": 0.64,
317
+ "percent": 0.63,
318
318
  "reduction": 81.6
319
319
  },
320
320
  {
@@ -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-canary.7+f35eb5a2e",
3
+ "version": "11.1.4-alpha-tmp-issues-6744.2+b1f86ccb5",
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.1.3-canary.7+f35eb5a2e",
80
+ "@trpc/server": "11.1.4-alpha-tmp-issues-6744.2+b1f86ccb5",
81
81
  "typescript": ">=5.7.2"
82
82
  },
83
83
  "devDependencies": {
84
- "@trpc/server": "11.1.3-canary.7+f35eb5a2e",
84
+ "@trpc/server": "11.1.4-alpha-tmp-issues-6744.2+b1f86ccb5",
85
85
  "@types/isomorphic-fetch": "^0.0.39",
86
86
  "@types/node": "^22.13.5",
87
87
  "dataloader": "^2.2.2",
@@ -101,5 +101,5 @@
101
101
  "funding": [
102
102
  "https://trpc.io/sponsor"
103
103
  ],
104
- "gitHead": "f35eb5a2e2cb5514d22ed4bcbf4a4addebd00ff9"
104
+ "gitHead": "b1f86ccb5ebfa20498dcf3bf48e438e5b4fbef9f"
105
105
  }
@@ -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',