@trpc/client 11.2.1-canary.0 → 11.2.1-canary.3
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/TRPCClientError.d.ts +1 -0
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/TRPCClientError.js +2 -4
- package/dist/TRPCClientError.mjs +2 -5
- package/dist/bundle-analysis.json +88 -70
- package/dist/index.js +3 -0
- package/dist/index.mjs +2 -1
- package/dist/internals/signals.d.ts +1 -0
- package/dist/internals/signals.d.ts.map +1 -1
- package/dist/internals/signals.js +14 -0
- package/dist/internals/signals.mjs +14 -1
- package/dist/links/httpSubscriptionLink.d.ts.map +1 -1
- package/dist/links/httpSubscriptionLink.js +1 -11
- package/dist/links/httpSubscriptionLink.mjs +2 -12
- package/dist/links/localLink.d.ts +15 -0
- package/dist/links/localLink.d.ts.map +1 -0
- package/dist/links/localLink.js +333 -0
- package/dist/links/localLink.mjs +331 -0
- package/dist/links.d.ts +1 -0
- package/dist/links.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/TRPCClientError.ts +4 -9
- package/src/internals/signals.ts +16 -0
- package/src/links/httpSubscriptionLink.ts +3 -18
- package/src/links/localLink.ts +277 -0
- package/src/links.ts +1 -0
|
@@ -7,6 +7,7 @@ export interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
|
|
|
7
7
|
readonly data: Maybe<TShape['data']>;
|
|
8
8
|
}
|
|
9
9
|
export type TRPCClientErrorLike<TInferrable extends InferrableClientTypes> = TRPCClientErrorBase<inferErrorShape<TInferrable>>;
|
|
10
|
+
export declare function isTRPCClientError<TInferrable extends InferrableClientTypes>(cause: unknown): cause is TRPCClientError<TInferrable>;
|
|
10
11
|
export declare class TRPCClientError<TRouterOrProcedure extends InferrableClientTypes> extends Error implements TRPCClientErrorBase<inferErrorShape<TRouterOrProcedure>> {
|
|
11
12
|
readonly cause: Error | undefined;
|
|
12
13
|
readonly shape: Maybe<inferErrorShape<TRouterOrProcedure>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TRPCClientError.d.ts","sourceRoot":"","sources":["../src/TRPCClientError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAElD,KAAK,eAAe,CAAC,WAAW,SAAS,qBAAqB,IAC5D,gBAAgB,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;AAC9C,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,iBAAiB;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;CACtC;AACD,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,qBAAqB,IACvE,mBAAmB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"TRPCClientError.d.ts","sourceRoot":"","sources":["../src/TRPCClientError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAElD,KAAK,eAAe,CAAC,WAAW,SAAS,qBAAqB,IAC5D,gBAAgB,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;AAC9C,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,iBAAiB;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;CACtC;AACD,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,qBAAqB,IACvE,mBAAmB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;AAEpD,wBAAgB,iBAAiB,CAAC,WAAW,SAAS,qBAAqB,EACzE,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,eAAe,CAAC,WAAW,CAAC,CAEvC;AAqBD,qBAAa,eAAe,CAAC,kBAAkB,SAAS,qBAAqB,CAC3E,SAAQ,KACR,YAAW,mBAAmB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAInE,SAAyB,KAAK,oBAAC;IAC/B,SAAgB,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAClE,SAAgB,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE;;;OAGG;IACI,IAAI,sCAAC;gBAGV,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACvE,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC;WAkBW,IAAI,CAAC,kBAAkB,SAAS,qBAAqB,EACjE,MAAM,EAAE,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,MAAM,EAC/C,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAO,GAC5C,eAAe,CAAC,kBAAkB,CAAC;CA2BvC"}
|
package/dist/TRPCClientError.js
CHANGED
|
@@ -16,10 +16,7 @@ function _define_property(obj, key, value) {
|
|
|
16
16
|
return obj;
|
|
17
17
|
}
|
|
18
18
|
function isTRPCClientError(cause) {
|
|
19
|
-
return cause instanceof TRPCClientError
|
|
20
|
-
* @deprecated
|
|
21
|
-
* Delete in next major
|
|
22
|
-
*/ cause instanceof Error && cause.name === 'TRPCClientError';
|
|
19
|
+
return cause instanceof TRPCClientError;
|
|
23
20
|
}
|
|
24
21
|
function isTRPCErrorResponse(obj) {
|
|
25
22
|
return unstableCoreDoNotImport.isObject(obj) && unstableCoreDoNotImport.isObject(obj['error']) && typeof obj['error']['code'] === 'number' && typeof obj['error']['message'] === 'string';
|
|
@@ -79,3 +76,4 @@ class TRPCClientError extends Error {
|
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
exports.TRPCClientError = TRPCClientError;
|
|
79
|
+
exports.isTRPCClientError = isTRPCClientError;
|
package/dist/TRPCClientError.mjs
CHANGED
|
@@ -14,10 +14,7 @@ function _define_property(obj, key, value) {
|
|
|
14
14
|
return obj;
|
|
15
15
|
}
|
|
16
16
|
function isTRPCClientError(cause) {
|
|
17
|
-
return cause instanceof TRPCClientError
|
|
18
|
-
* @deprecated
|
|
19
|
-
* Delete in next major
|
|
20
|
-
*/ cause instanceof Error && cause.name === 'TRPCClientError';
|
|
17
|
+
return cause instanceof TRPCClientError;
|
|
21
18
|
}
|
|
22
19
|
function isTRPCErrorResponse(obj) {
|
|
23
20
|
return isObject(obj) && isObject(obj['error']) && typeof obj['error']['code'] === 'number' && typeof obj['error']['message'] === 'string';
|
|
@@ -76,4 +73,4 @@ class TRPCClientError extends Error {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
export { TRPCClientError };
|
|
76
|
+
export { TRPCClientError, isTRPCClientError };
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 93279,
|
|
3
|
+
"bundleOrigSize": 103745,
|
|
4
|
+
"bundleReduction": 10.09,
|
|
5
5
|
"modules": [
|
|
6
|
+
{
|
|
7
|
+
"id": "/src/links/localLink.ts",
|
|
8
|
+
"size": 16810,
|
|
9
|
+
"origSize": 8796,
|
|
10
|
+
"renderedExports": [
|
|
11
|
+
"experimental_localLink"
|
|
12
|
+
],
|
|
13
|
+
"removedExports": [],
|
|
14
|
+
"dependents": [],
|
|
15
|
+
"percent": 18.02,
|
|
16
|
+
"reduction": 0
|
|
17
|
+
},
|
|
6
18
|
{
|
|
7
19
|
"id": "/src/links/wsLink/wsClient/wsClient.ts",
|
|
8
20
|
"size": 12116,
|
|
@@ -14,20 +26,20 @@
|
|
|
14
26
|
"dependents": [
|
|
15
27
|
"/src/links/wsLink/createWsClient.ts"
|
|
16
28
|
],
|
|
17
|
-
"percent":
|
|
29
|
+
"percent": 12.99,
|
|
18
30
|
"reduction": 1.08
|
|
19
31
|
},
|
|
20
32
|
{
|
|
21
33
|
"id": "/src/links/httpSubscriptionLink.ts",
|
|
22
|
-
"size":
|
|
23
|
-
"origSize":
|
|
34
|
+
"size": 7748,
|
|
35
|
+
"origSize": 7382,
|
|
24
36
|
"renderedExports": [
|
|
25
37
|
"httpSubscriptionLink",
|
|
26
38
|
"unstable_httpSubscriptionLink"
|
|
27
39
|
],
|
|
28
40
|
"removedExports": [],
|
|
29
41
|
"dependents": [],
|
|
30
|
-
"percent":
|
|
42
|
+
"percent": 8.31,
|
|
31
43
|
"reduction": 0
|
|
32
44
|
},
|
|
33
45
|
{
|
|
@@ -42,7 +54,7 @@
|
|
|
42
54
|
"dependents": [
|
|
43
55
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
44
56
|
],
|
|
45
|
-
"percent":
|
|
57
|
+
"percent": 6.62,
|
|
46
58
|
"reduction": 4.9
|
|
47
59
|
},
|
|
48
60
|
{
|
|
@@ -55,7 +67,7 @@
|
|
|
55
67
|
],
|
|
56
68
|
"removedExports": [],
|
|
57
69
|
"dependents": [],
|
|
58
|
-
"percent":
|
|
70
|
+
"percent": 6.57,
|
|
59
71
|
"reduction": 0
|
|
60
72
|
},
|
|
61
73
|
{
|
|
@@ -67,7 +79,7 @@
|
|
|
67
79
|
],
|
|
68
80
|
"removedExports": [],
|
|
69
81
|
"dependents": [],
|
|
70
|
-
"percent":
|
|
82
|
+
"percent": 6,
|
|
71
83
|
"reduction": 19.44
|
|
72
84
|
},
|
|
73
85
|
{
|
|
@@ -81,7 +93,7 @@
|
|
|
81
93
|
"dependents": [
|
|
82
94
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
83
95
|
],
|
|
84
|
-
"percent":
|
|
96
|
+
"percent": 5.35,
|
|
85
97
|
"reduction": 8.12
|
|
86
98
|
},
|
|
87
99
|
{
|
|
@@ -93,7 +105,7 @@
|
|
|
93
105
|
],
|
|
94
106
|
"removedExports": [],
|
|
95
107
|
"dependents": [],
|
|
96
|
-
"percent":
|
|
108
|
+
"percent": 4.42,
|
|
97
109
|
"reduction": 4.6
|
|
98
110
|
},
|
|
99
111
|
{
|
|
@@ -108,7 +120,7 @@
|
|
|
108
120
|
"/src/links/httpBatchLink.ts",
|
|
109
121
|
"/src/links/httpBatchStreamLink.ts"
|
|
110
122
|
],
|
|
111
|
-
"percent":
|
|
123
|
+
"percent": 4.32,
|
|
112
124
|
"reduction": 5.52
|
|
113
125
|
},
|
|
114
126
|
{
|
|
@@ -126,12 +138,12 @@
|
|
|
126
138
|
],
|
|
127
139
|
"removedExports": [],
|
|
128
140
|
"dependents": [
|
|
129
|
-
"/src/links/httpBatchLink.ts",
|
|
130
141
|
"/src/links/httpLink.ts",
|
|
142
|
+
"/src/links/httpBatchLink.ts",
|
|
131
143
|
"/src/links/httpBatchStreamLink.ts",
|
|
132
144
|
"/src/links/httpSubscriptionLink.ts"
|
|
133
145
|
],
|
|
134
|
-
"percent":
|
|
146
|
+
"percent": 3.96,
|
|
135
147
|
"reduction": 37.14
|
|
136
148
|
},
|
|
137
149
|
{
|
|
@@ -143,7 +155,7 @@
|
|
|
143
155
|
],
|
|
144
156
|
"removedExports": [],
|
|
145
157
|
"dependents": [],
|
|
146
|
-
"percent":
|
|
158
|
+
"percent": 3.53,
|
|
147
159
|
"reduction": 12.56
|
|
148
160
|
},
|
|
149
161
|
{
|
|
@@ -158,29 +170,9 @@
|
|
|
158
170
|
"/src/createTRPCUntypedClient.ts",
|
|
159
171
|
"/src/createTRPCClient.ts"
|
|
160
172
|
],
|
|
161
|
-
"percent":
|
|
173
|
+
"percent": 3.39,
|
|
162
174
|
"reduction": 28.5
|
|
163
175
|
},
|
|
164
|
-
{
|
|
165
|
-
"id": "/src/TRPCClientError.ts",
|
|
166
|
-
"size": 2787,
|
|
167
|
-
"origSize": 3564,
|
|
168
|
-
"renderedExports": [
|
|
169
|
-
"TRPCClientError"
|
|
170
|
-
],
|
|
171
|
-
"removedExports": [],
|
|
172
|
-
"dependents": [
|
|
173
|
-
"/src/index.ts",
|
|
174
|
-
"/src/links/httpBatchLink.ts",
|
|
175
|
-
"/src/links/httpLink.ts",
|
|
176
|
-
"/src/links/httpBatchStreamLink.ts",
|
|
177
|
-
"/src/links/httpSubscriptionLink.ts",
|
|
178
|
-
"/src/internals/TRPCUntypedClient.ts",
|
|
179
|
-
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
180
|
-
],
|
|
181
|
-
"percent": 3.64,
|
|
182
|
-
"reduction": 21.8
|
|
183
|
-
},
|
|
184
176
|
{
|
|
185
177
|
"id": "/src/links/wsLink/wsClient/utils.ts",
|
|
186
178
|
"size": 2781,
|
|
@@ -198,9 +190,31 @@
|
|
|
198
190
|
"/src/links/wsLink/wsClient/requestManager.ts",
|
|
199
191
|
"/src/links/wsLink/wsClient/wsConnection.ts"
|
|
200
192
|
],
|
|
201
|
-
"percent":
|
|
193
|
+
"percent": 2.98,
|
|
202
194
|
"reduction": 0.47
|
|
203
195
|
},
|
|
196
|
+
{
|
|
197
|
+
"id": "/src/TRPCClientError.ts",
|
|
198
|
+
"size": 2666,
|
|
199
|
+
"origSize": 3486,
|
|
200
|
+
"renderedExports": [
|
|
201
|
+
"isTRPCClientError",
|
|
202
|
+
"TRPCClientError"
|
|
203
|
+
],
|
|
204
|
+
"removedExports": [],
|
|
205
|
+
"dependents": [
|
|
206
|
+
"/src/index.ts",
|
|
207
|
+
"/src/links/httpLink.ts",
|
|
208
|
+
"/src/links/httpBatchLink.ts",
|
|
209
|
+
"/src/links/httpBatchStreamLink.ts",
|
|
210
|
+
"/src/links/httpSubscriptionLink.ts",
|
|
211
|
+
"/src/links/localLink.ts",
|
|
212
|
+
"/src/internals/TRPCUntypedClient.ts",
|
|
213
|
+
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
214
|
+
],
|
|
215
|
+
"percent": 2.86,
|
|
216
|
+
"reduction": 23.52
|
|
217
|
+
},
|
|
204
218
|
{
|
|
205
219
|
"id": "/src/links/retryLink.ts",
|
|
206
220
|
"size": 2590,
|
|
@@ -210,25 +224,27 @@
|
|
|
210
224
|
],
|
|
211
225
|
"removedExports": [],
|
|
212
226
|
"dependents": [],
|
|
213
|
-
"percent":
|
|
227
|
+
"percent": 2.78,
|
|
214
228
|
"reduction": 19.62
|
|
215
229
|
},
|
|
216
230
|
{
|
|
217
231
|
"id": "/src/internals/signals.ts",
|
|
218
|
-
"size":
|
|
219
|
-
"origSize":
|
|
232
|
+
"size": 1501,
|
|
233
|
+
"origSize": 1561,
|
|
220
234
|
"renderedExports": [
|
|
221
235
|
"allAbortSignals",
|
|
222
|
-
"raceAbortSignals"
|
|
236
|
+
"raceAbortSignals",
|
|
237
|
+
"abortSignalToPromise"
|
|
223
238
|
],
|
|
224
239
|
"removedExports": [],
|
|
225
240
|
"dependents": [
|
|
226
241
|
"/src/links/httpBatchLink.ts",
|
|
227
242
|
"/src/links/httpBatchStreamLink.ts",
|
|
228
|
-
"/src/links/httpSubscriptionLink.ts"
|
|
243
|
+
"/src/links/httpSubscriptionLink.ts",
|
|
244
|
+
"/src/links/localLink.ts"
|
|
229
245
|
],
|
|
230
|
-
"percent": 1.
|
|
231
|
-
"reduction": 3.
|
|
246
|
+
"percent": 1.61,
|
|
247
|
+
"reduction": 3.84
|
|
232
248
|
},
|
|
233
249
|
{
|
|
234
250
|
"id": "/src/createTRPCClient.ts",
|
|
@@ -244,7 +260,7 @@
|
|
|
244
260
|
"dependents": [
|
|
245
261
|
"/src/index.ts"
|
|
246
262
|
],
|
|
247
|
-
"percent": 1.
|
|
263
|
+
"percent": 1.25,
|
|
248
264
|
"reduction": 75.3
|
|
249
265
|
},
|
|
250
266
|
{
|
|
@@ -257,7 +273,7 @@
|
|
|
257
273
|
],
|
|
258
274
|
"removedExports": [],
|
|
259
275
|
"dependents": [],
|
|
260
|
-
"percent": 1.
|
|
276
|
+
"percent": 1.01,
|
|
261
277
|
"reduction": 41.31
|
|
262
278
|
},
|
|
263
279
|
{
|
|
@@ -272,7 +288,7 @@
|
|
|
272
288
|
"/src/links/splitLink.ts",
|
|
273
289
|
"/src/internals/TRPCUntypedClient.ts"
|
|
274
290
|
],
|
|
275
|
-
"percent": 0.
|
|
291
|
+
"percent": 0.74,
|
|
276
292
|
"reduction": 32.75
|
|
277
293
|
},
|
|
278
294
|
{
|
|
@@ -284,7 +300,7 @@
|
|
|
284
300
|
],
|
|
285
301
|
"removedExports": [],
|
|
286
302
|
"dependents": [],
|
|
287
|
-
"percent": 0.
|
|
303
|
+
"percent": 0.65,
|
|
288
304
|
"reduction": 44.95
|
|
289
305
|
},
|
|
290
306
|
{
|
|
@@ -296,9 +312,10 @@
|
|
|
296
312
|
],
|
|
297
313
|
"removedExports": [],
|
|
298
314
|
"dependents": [
|
|
299
|
-
"/src/unstable-internals.ts"
|
|
315
|
+
"/src/unstable-internals.ts",
|
|
316
|
+
"/src/links/localLink.ts"
|
|
300
317
|
],
|
|
301
|
-
"percent": 0.
|
|
318
|
+
"percent": 0.61,
|
|
302
319
|
"reduction": 66.71
|
|
303
320
|
},
|
|
304
321
|
{
|
|
@@ -314,7 +331,7 @@
|
|
|
314
331
|
"dependents": [
|
|
315
332
|
"/src/links/wsLink/wsClient/wsClient.ts"
|
|
316
333
|
],
|
|
317
|
-
"percent": 0.
|
|
334
|
+
"percent": 0.52,
|
|
318
335
|
"reduction": 81.6
|
|
319
336
|
},
|
|
320
337
|
{
|
|
@@ -329,7 +346,7 @@
|
|
|
329
346
|
"/src/index.ts",
|
|
330
347
|
"/src/links/internals/httpUtils.ts"
|
|
331
348
|
],
|
|
332
|
-
"percent": 0.
|
|
349
|
+
"percent": 0.46,
|
|
333
350
|
"reduction": 33.54
|
|
334
351
|
},
|
|
335
352
|
{
|
|
@@ -343,7 +360,7 @@
|
|
|
343
360
|
],
|
|
344
361
|
"removedExports": [],
|
|
345
362
|
"dependents": [],
|
|
346
|
-
"percent": 0.
|
|
363
|
+
"percent": 0.35,
|
|
347
364
|
"reduction": 15.17
|
|
348
365
|
},
|
|
349
366
|
{
|
|
@@ -356,9 +373,10 @@
|
|
|
356
373
|
"removedExports": [],
|
|
357
374
|
"dependents": [
|
|
358
375
|
"/src/links/httpSubscriptionLink.ts",
|
|
359
|
-
"/src/links/retryLink.ts"
|
|
376
|
+
"/src/links/retryLink.ts",
|
|
377
|
+
"/src/links/localLink.ts"
|
|
360
378
|
],
|
|
361
|
-
"percent": 0.
|
|
379
|
+
"percent": 0.27,
|
|
362
380
|
"reduction": 6.96
|
|
363
381
|
},
|
|
364
382
|
{
|
|
@@ -373,7 +391,7 @@
|
|
|
373
391
|
"/src/links/httpSubscriptionLink.ts",
|
|
374
392
|
"/src/links/wsLink/wsClient/utils.ts"
|
|
375
393
|
],
|
|
376
|
-
"percent": 0.
|
|
394
|
+
"percent": 0.26,
|
|
377
395
|
"reduction": 76.38
|
|
378
396
|
},
|
|
379
397
|
{
|
|
@@ -387,7 +405,7 @@
|
|
|
387
405
|
"dependents": [
|
|
388
406
|
"/src/index.ts"
|
|
389
407
|
],
|
|
390
|
-
"percent": 0.
|
|
408
|
+
"percent": 0.11,
|
|
391
409
|
"reduction": 82.58
|
|
392
410
|
},
|
|
393
411
|
{
|
|
@@ -401,33 +419,33 @@
|
|
|
401
419
|
"dependents": [
|
|
402
420
|
"/src/links/wsLink/wsLink.ts"
|
|
403
421
|
],
|
|
404
|
-
"percent": 0.
|
|
422
|
+
"percent": 0.08,
|
|
405
423
|
"reduction": 76.83
|
|
406
424
|
},
|
|
407
425
|
{
|
|
408
|
-
"id": "/src/
|
|
426
|
+
"id": "/src/index.ts",
|
|
409
427
|
"size": 0,
|
|
410
|
-
"origSize":
|
|
428
|
+
"origSize": 540,
|
|
411
429
|
"renderedExports": [],
|
|
412
430
|
"removedExports": [],
|
|
413
|
-
"dependents": [
|
|
414
|
-
"/src/links/wsLink/wsLink.ts",
|
|
415
|
-
"/src/links/httpSubscriptionLink.ts",
|
|
416
|
-
"/src/links/internals/httpUtils.ts"
|
|
417
|
-
],
|
|
431
|
+
"dependents": [],
|
|
418
432
|
"percent": 0,
|
|
419
433
|
"reduction": 100
|
|
420
434
|
},
|
|
421
435
|
{
|
|
422
|
-
"id": "/src/
|
|
436
|
+
"id": "/src/unstable-internals.ts",
|
|
423
437
|
"size": 0,
|
|
424
|
-
"origSize":
|
|
438
|
+
"origSize": 90,
|
|
425
439
|
"renderedExports": [],
|
|
426
440
|
"removedExports": [],
|
|
427
|
-
"dependents": [
|
|
441
|
+
"dependents": [
|
|
442
|
+
"/src/links/wsLink/wsLink.ts",
|
|
443
|
+
"/src/links/httpSubscriptionLink.ts",
|
|
444
|
+
"/src/links/internals/httpUtils.ts"
|
|
445
|
+
],
|
|
428
446
|
"percent": 0,
|
|
429
447
|
"reduction": 100
|
|
430
448
|
}
|
|
431
449
|
],
|
|
432
|
-
"moduleCount":
|
|
450
|
+
"moduleCount": 30
|
|
433
451
|
}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var splitLink = require('./links/splitLink.js');
|
|
|
13
13
|
var wsLink = require('./links/wsLink/wsLink.js');
|
|
14
14
|
var httpSubscriptionLink = require('./links/httpSubscriptionLink.js');
|
|
15
15
|
var retryLink = require('./links/retryLink.js');
|
|
16
|
+
var localLink = require('./links/localLink.js');
|
|
16
17
|
var TRPCUntypedClient = require('./internals/TRPCUntypedClient.js');
|
|
17
18
|
var createWsClient = require('./links/wsLink/createWsClient.js');
|
|
18
19
|
|
|
@@ -26,6 +27,7 @@ exports.createTRPCProxyClient = createTRPCClient.createTRPCClient;
|
|
|
26
27
|
exports.getUntypedClient = createTRPCClient.getUntypedClient;
|
|
27
28
|
exports.getFetch = getFetch.getFetch;
|
|
28
29
|
exports.TRPCClientError = TRPCClientError.TRPCClientError;
|
|
30
|
+
exports.isTRPCClientError = TRPCClientError.isTRPCClientError;
|
|
29
31
|
exports.isFormData = contentTypes.isFormData;
|
|
30
32
|
exports.isNonJsonSerializable = contentTypes.isNonJsonSerializable;
|
|
31
33
|
exports.isOctetType = contentTypes.isOctetType;
|
|
@@ -39,5 +41,6 @@ exports.wsLink = wsLink.wsLink;
|
|
|
39
41
|
exports.httpSubscriptionLink = httpSubscriptionLink.httpSubscriptionLink;
|
|
40
42
|
exports.unstable_httpSubscriptionLink = httpSubscriptionLink.unstable_httpSubscriptionLink;
|
|
41
43
|
exports.retryLink = retryLink.retryLink;
|
|
44
|
+
exports.experimental_localLink = localLink.experimental_localLink;
|
|
42
45
|
exports.TRPCUntypedClient = TRPCUntypedClient.TRPCUntypedClient;
|
|
43
46
|
exports.createWSClient = createWsClient.createWSClient;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createTRPCUntypedClient } from './createTRPCUntypedClient.mjs';
|
|
2
2
|
export { clientCallTypeToProcedureType, createTRPCClient, createTRPCClientProxy, createTRPCClient as createTRPCProxyClient, getUntypedClient } from './createTRPCClient.mjs';
|
|
3
3
|
export { getFetch } from './getFetch.mjs';
|
|
4
|
-
export { TRPCClientError } from './TRPCClientError.mjs';
|
|
4
|
+
export { TRPCClientError, isTRPCClientError } from './TRPCClientError.mjs';
|
|
5
5
|
export { isFormData, isNonJsonSerializable, isOctetType } from './links/internals/contentTypes.mjs';
|
|
6
6
|
export { httpBatchLink } from './links/httpBatchLink.mjs';
|
|
7
7
|
export { httpBatchStreamLink, unstable_httpBatchStreamLink } from './links/httpBatchStreamLink.mjs';
|
|
@@ -11,5 +11,6 @@ export { splitLink } from './links/splitLink.mjs';
|
|
|
11
11
|
export { wsLink } from './links/wsLink/wsLink.mjs';
|
|
12
12
|
export { httpSubscriptionLink, unstable_httpSubscriptionLink } from './links/httpSubscriptionLink.mjs';
|
|
13
13
|
export { retryLink } from './links/retryLink.mjs';
|
|
14
|
+
export { experimental_localLink } from './links/localLink.mjs';
|
|
14
15
|
export { TRPCUntypedClient } from './internals/TRPCUntypedClient.mjs';
|
|
15
16
|
export { createWSClient } from './links/wsLink/createWsClient.mjs';
|
|
@@ -12,4 +12,5 @@ export declare function allAbortSignals(...signals: Maybe<AbortSignal>[]): Abort
|
|
|
12
12
|
* [`AbortSignal.any`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static).
|
|
13
13
|
*/
|
|
14
14
|
export declare function raceAbortSignals(...signals: Maybe<AbortSignal>[]): AbortSignal;
|
|
15
|
+
export declare function abortSignalToPromise(signal: AbortSignal): Promise<never>;
|
|
15
16
|
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/internals/signals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,CAwB7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAC/B,WAAW,CAYb"}
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/internals/signals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,CAwB7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAC/B,WAAW,CAYb;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAcxE"}
|
|
@@ -42,6 +42,20 @@
|
|
|
42
42
|
}
|
|
43
43
|
return ac.signal;
|
|
44
44
|
}
|
|
45
|
+
function abortSignalToPromise(signal) {
|
|
46
|
+
return new Promise((_, reject)=>{
|
|
47
|
+
if (signal.aborted) {
|
|
48
|
+
reject(signal.reason);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
signal.addEventListener('abort', ()=>{
|
|
52
|
+
reject(signal.reason);
|
|
53
|
+
}, {
|
|
54
|
+
once: true
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
45
58
|
|
|
59
|
+
exports.abortSignalToPromise = abortSignalToPromise;
|
|
46
60
|
exports.allAbortSignals = allAbortSignals;
|
|
47
61
|
exports.raceAbortSignals = raceAbortSignals;
|
|
@@ -40,5 +40,18 @@
|
|
|
40
40
|
}
|
|
41
41
|
return ac.signal;
|
|
42
42
|
}
|
|
43
|
+
function abortSignalToPromise(signal) {
|
|
44
|
+
return new Promise((_, reject)=>{
|
|
45
|
+
if (signal.aborted) {
|
|
46
|
+
reject(signal.reason);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
signal.addEventListener('abort', ()=>{
|
|
50
|
+
reject(signal.reason);
|
|
51
|
+
}, {
|
|
52
|
+
once: true
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
43
56
|
|
|
44
|
-
export { allAbortSignals, raceAbortSignals };
|
|
57
|
+
export { abortSignalToPromise, allAbortSignals, raceAbortSignals };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpSubscriptionLink.d.ts","sourceRoot":"","sources":["../../src/links/httpSubscriptionLink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"httpSubscriptionLink.d.ts","sourceRoot":"","sources":["../../src/links/httpSubscriptionLink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAUlD,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;AAEjC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,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,CAuKvB;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,6BAAuB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var observable = require('@trpc/server/observable');
|
|
4
|
-
var rpc = require('@trpc/server/rpc');
|
|
5
4
|
var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
|
|
6
5
|
var inputWithTrackedEventId = require('../internals/inputWithTrackedEventId.js');
|
|
7
6
|
var signals = require('../internals/signals.js');
|
|
@@ -19,15 +18,6 @@ async function urlWithConnectionParams(opts) {
|
|
|
19
18
|
}
|
|
20
19
|
return url;
|
|
21
20
|
}
|
|
22
|
-
/**
|
|
23
|
-
* tRPC error codes that are considered retryable
|
|
24
|
-
* With out of the box SSE, the client will reconnect when these errors are encountered
|
|
25
|
-
*/ const codes5xx = [
|
|
26
|
-
rpc.TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
|
|
27
|
-
rpc.TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
|
|
28
|
-
rpc.TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
|
|
29
|
-
rpc.TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
30
|
-
];
|
|
31
21
|
/**
|
|
32
22
|
* @see https://trpc.io/docs/client/links/httpSubscriptionLink
|
|
33
23
|
*/ function httpSubscriptionLink(opts) {
|
|
@@ -119,7 +109,7 @@ async function urlWithConnectionParams(opts) {
|
|
|
119
109
|
const error = TRPCClientError.TRPCClientError.from({
|
|
120
110
|
error: chunk.error
|
|
121
111
|
});
|
|
122
|
-
if (
|
|
112
|
+
if (unstableCoreDoNotImport.retryableRpcCodes.includes(chunk.error.code)) {
|
|
123
113
|
//
|
|
124
114
|
connectionState.next({
|
|
125
115
|
type: 'state',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { observable, behaviorSubject } from '@trpc/server/observable';
|
|
2
|
-
import {
|
|
3
|
-
import { sseStreamConsumer, run } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
+
import { sseStreamConsumer, run, retryableRpcCodes } from '@trpc/server/unstable-core-do-not-import';
|
|
4
3
|
import { inputWithTrackedEventId } from '../internals/inputWithTrackedEventId.mjs';
|
|
5
4
|
import { raceAbortSignals } from '../internals/signals.mjs';
|
|
6
5
|
import { TRPCClientError } from '../TRPCClientError.mjs';
|
|
@@ -17,15 +16,6 @@ async function urlWithConnectionParams(opts) {
|
|
|
17
16
|
}
|
|
18
17
|
return url;
|
|
19
18
|
}
|
|
20
|
-
/**
|
|
21
|
-
* tRPC error codes that are considered retryable
|
|
22
|
-
* With out of the box SSE, the client will reconnect when these errors are encountered
|
|
23
|
-
*/ const codes5xx = [
|
|
24
|
-
TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
|
|
25
|
-
TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
|
|
26
|
-
TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
|
|
27
|
-
TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
28
|
-
];
|
|
29
19
|
/**
|
|
30
20
|
* @see https://trpc.io/docs/client/links/httpSubscriptionLink
|
|
31
21
|
*/ function httpSubscriptionLink(opts) {
|
|
@@ -117,7 +107,7 @@ async function urlWithConnectionParams(opts) {
|
|
|
117
107
|
const error = TRPCClientError.from({
|
|
118
108
|
error: chunk.error
|
|
119
109
|
});
|
|
120
|
-
if (
|
|
110
|
+
if (retryableRpcCodes.includes(chunk.error.code)) {
|
|
121
111
|
//
|
|
122
112
|
connectionState.next({
|
|
123
113
|
type: 'state',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AnyRouter, type ErrorHandlerOptions, type inferClientTypes, type inferRouterContext } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
+
import type { TransformerOptions } from '../internals/transformer';
|
|
3
|
+
import type { TRPCLink } from './types';
|
|
4
|
+
export type LocalLinkOptions<TRouter extends AnyRouter> = {
|
|
5
|
+
router: TRouter;
|
|
6
|
+
createContext: () => Promise<inferRouterContext<TRouter>>;
|
|
7
|
+
onError?: (opts: ErrorHandlerOptions<inferRouterContext<TRouter>>) => void;
|
|
8
|
+
} & TransformerOptions<inferClientTypes<TRouter>>;
|
|
9
|
+
/**
|
|
10
|
+
* localLink is a terminating link that allows you to make tRPC procedure calls directly in your application without going through HTTP.
|
|
11
|
+
*
|
|
12
|
+
* @see https://trpc.io/docs/links/localLink
|
|
13
|
+
*/
|
|
14
|
+
export declare function experimental_localLink<TRouter extends AnyRouter>(opts: LocalLinkOptions<TRouter>): TRPCLink<TRouter>;
|
|
15
|
+
//# sourceMappingURL=localLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localLink.d.ts","sourceRoot":"","sources":["../../src/links/localLink.ts"],"names":[],"mappings":"AAOA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,SAAS,IAAI;IACxD,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAC5E,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAC9B,QAAQ,CAAC,OAAO,CAAC,CA2OnB"}
|