@trpc/client 11.0.0-rc.560 → 11.0.0-rc.563

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,7 +1,7 @@
1
1
  {
2
- "bundleSize": 57426,
3
- "bundleOrigSize": 75759,
4
- "bundleReduction": 24.2,
2
+ "bundleSize": 54651,
3
+ "bundleOrigSize": 72819,
4
+ "bundleReduction": 24.95,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/links/wsLink.ts",
@@ -13,32 +13,20 @@
13
13
  ],
14
14
  "removedExports": [],
15
15
  "dependents": [],
16
- "percent": 26.6,
16
+ "percent": 27.96,
17
17
  "reduction": 10.13
18
18
  },
19
- {
20
- "id": "/src/links/httpSubscriptionLink.ts",
21
- "size": 7004,
22
- "origSize": 8051,
23
- "renderedExports": [
24
- "unstable_httpSubscriptionLink"
25
- ],
26
- "removedExports": [],
27
- "dependents": [],
28
- "percent": 12.2,
29
- "reduction": 13
30
- },
31
19
  {
32
20
  "id": "/src/links/httpBatchStreamLink.ts",
33
- "size": 5861,
34
- "origSize": 6074,
21
+ "size": 6007,
22
+ "origSize": 6284,
35
23
  "renderedExports": [
36
24
  "unstable_httpBatchStreamLink"
37
25
  ],
38
26
  "removedExports": [],
39
27
  "dependents": [],
40
- "percent": 10.21,
41
- "reduction": 3.51
28
+ "percent": 10.99,
29
+ "reduction": 4.41
42
30
  },
43
31
  {
44
32
  "id": "/src/links/loggerLink.ts",
@@ -49,33 +37,9 @@
49
37
  ],
50
38
  "removedExports": [],
51
39
  "dependents": [],
52
- "percent": 9.5,
40
+ "percent": 9.98,
53
41
  "reduction": 18.48
54
42
  },
55
- {
56
- "id": "/src/links/internals/httpUtils.ts",
57
- "size": 4465,
58
- "origSize": 6645,
59
- "renderedExports": [
60
- "resolveHTTPLinkOptions",
61
- "getInput",
62
- "getUrl",
63
- "getBody",
64
- "jsonHttpRequester",
65
- "fetchHTTPResponse",
66
- "httpRequest",
67
- "mergeAbortSignals"
68
- ],
69
- "removedExports": [],
70
- "dependents": [
71
- "/src/links/httpBatchLink.ts",
72
- "/src/links/httpLink.ts",
73
- "/src/links/httpBatchStreamLink.ts",
74
- "/src/links/httpSubscriptionLink.ts"
75
- ],
76
- "percent": 7.78,
77
- "reduction": 32.81
78
- },
79
43
  {
80
44
  "id": "/src/internals/dataLoader.ts",
81
45
  "size": 4084,
@@ -88,20 +52,55 @@
88
52
  "/src/links/httpBatchLink.ts",
89
53
  "/src/links/httpBatchStreamLink.ts"
90
54
  ],
91
- "percent": 7.11,
55
+ "percent": 7.47,
92
56
  "reduction": 5.64
93
57
  },
94
58
  {
95
59
  "id": "/src/links/httpBatchLink.ts",
96
- "size": 3925,
97
- "origSize": 4118,
60
+ "size": 3938,
61
+ "origSize": 4170,
98
62
  "renderedExports": [
99
63
  "httpBatchLink"
100
64
  ],
101
65
  "removedExports": [],
102
66
  "dependents": [],
103
- "percent": 6.83,
104
- "reduction": 4.69
67
+ "percent": 7.21,
68
+ "reduction": 5.56
69
+ },
70
+ {
71
+ "id": "/src/links/httpSubscriptionLink.ts",
72
+ "size": 3776,
73
+ "origSize": 4507,
74
+ "renderedExports": [
75
+ "unstable_httpSubscriptionLink"
76
+ ],
77
+ "removedExports": [],
78
+ "dependents": [],
79
+ "percent": 6.91,
80
+ "reduction": 16.22
81
+ },
82
+ {
83
+ "id": "/src/links/internals/httpUtils.ts",
84
+ "size": 3693,
85
+ "origSize": 5873,
86
+ "renderedExports": [
87
+ "resolveHTTPLinkOptions",
88
+ "getInput",
89
+ "getUrl",
90
+ "getBody",
91
+ "jsonHttpRequester",
92
+ "fetchHTTPResponse",
93
+ "httpRequest"
94
+ ],
95
+ "removedExports": [],
96
+ "dependents": [
97
+ "/src/links/httpBatchLink.ts",
98
+ "/src/links/httpLink.ts",
99
+ "/src/links/httpBatchStreamLink.ts",
100
+ "/src/links/httpSubscriptionLink.ts"
101
+ ],
102
+ "percent": 6.76,
103
+ "reduction": 37.12
105
104
  },
106
105
  {
107
106
  "id": "/src/links/httpLink.ts",
@@ -112,13 +111,13 @@
112
111
  ],
113
112
  "removedExports": [],
114
113
  "dependents": [],
115
- "percent": 5.54,
114
+ "percent": 5.82,
116
115
  "reduction": 14.14
117
116
  },
118
117
  {
119
118
  "id": "/src/internals/TRPCUntypedClient.ts",
120
- "size": 2162,
121
- "origSize": 4228,
119
+ "size": 2169,
120
+ "origSize": 4235,
122
121
  "renderedExports": [
123
122
  "TRPCUntypedClient"
124
123
  ],
@@ -127,8 +126,8 @@
127
126
  "/src/createTRPCUntypedClient.ts",
128
127
  "/src/createTRPCClient.ts"
129
128
  ],
130
- "percent": 3.76,
131
- "reduction": 48.86
129
+ "percent": 3.97,
130
+ "reduction": 48.78
132
131
  },
133
132
  {
134
133
  "id": "/src/TRPCClientError.ts",
@@ -147,7 +146,7 @@
147
146
  "/src/links/httpSubscriptionLink.ts",
148
147
  "/src/internals/TRPCUntypedClient.ts"
149
148
  ],
150
- "percent": 3.38,
149
+ "percent": 3.55,
151
150
  "reduction": 45.43
152
151
  },
153
152
  {
@@ -164,9 +163,26 @@
164
163
  "dependents": [
165
164
  "/src/index.ts"
166
165
  ],
167
- "percent": 2.07,
166
+ "percent": 2.17,
168
167
  "reduction": 73.19
169
168
  },
169
+ {
170
+ "id": "/src/internals/signals.ts",
171
+ "size": 1059,
172
+ "origSize": 1107,
173
+ "renderedExports": [
174
+ "allAbortSignals",
175
+ "raceAbortSignals"
176
+ ],
177
+ "removedExports": [],
178
+ "dependents": [
179
+ "/src/links/httpBatchLink.ts",
180
+ "/src/links/httpBatchStreamLink.ts",
181
+ "/src/links/httpSubscriptionLink.ts"
182
+ ],
183
+ "percent": 1.94,
184
+ "reduction": 4.34
185
+ },
170
186
  {
171
187
  "id": "/src/links/internals/createChain.ts",
172
188
  "size": 690,
@@ -179,7 +195,7 @@
179
195
  "/src/links/splitLink.ts",
180
196
  "/src/internals/TRPCUntypedClient.ts"
181
197
  ],
182
- "percent": 1.2,
198
+ "percent": 1.26,
183
199
  "reduction": 32.75
184
200
  },
185
201
  {
@@ -191,7 +207,7 @@
191
207
  ],
192
208
  "removedExports": [],
193
209
  "dependents": [],
194
- "percent": 1.06,
210
+ "percent": 1.12,
195
211
  "reduction": 44.95
196
212
  },
197
213
  {
@@ -205,7 +221,7 @@
205
221
  "dependents": [
206
222
  "/src/unstable-internals.ts"
207
223
  ],
208
- "percent": 0.98,
224
+ "percent": 1.03,
209
225
  "reduction": 66.71
210
226
  },
211
227
  {
@@ -220,7 +236,7 @@
220
236
  "/src/index.ts",
221
237
  "/src/links/internals/httpUtils.ts"
222
238
  ],
223
- "percent": 0.75,
239
+ "percent": 0.78,
224
240
  "reduction": 33.54
225
241
  },
226
242
  {
@@ -234,7 +250,7 @@
234
250
  ],
235
251
  "removedExports": [],
236
252
  "dependents": [],
237
- "percent": 0.57,
253
+ "percent": 0.6,
238
254
  "reduction": 15.17
239
255
  },
240
256
  {
@@ -249,7 +265,7 @@
249
265
  "/src/links/wsLink.ts",
250
266
  "/src/links/httpSubscriptionLink.ts"
251
267
  ],
252
- "percent": 0.28,
268
+ "percent": 0.29,
253
269
  "reduction": 81.71
254
270
  },
255
271
  {
@@ -263,7 +279,7 @@
263
279
  "dependents": [
264
280
  "/src/index.ts"
265
281
  ],
266
- "percent": 0.17,
282
+ "percent": 0.18,
267
283
  "reduction": 82.58
268
284
  },
269
285
  {
@@ -291,5 +307,5 @@
291
307
  "reduction": 100
292
308
  }
293
309
  ],
294
- "moduleCount": 20
310
+ "moduleCount": 21
295
311
  }
@@ -50,7 +50,7 @@ class TRPCUntypedClient {
50
50
  path,
51
51
  input,
52
52
  context: opts?.context,
53
- signal: null
53
+ signal: opts.signal
54
54
  });
55
55
  return observable$.subscribe({
56
56
  next (envelope) {
@@ -48,7 +48,7 @@ class TRPCUntypedClient {
48
48
  path,
49
49
  input,
50
50
  context: opts?.context,
51
- signal: null
51
+ signal: opts.signal
52
52
  });
53
53
  return observable$.subscribe({
54
54
  next (envelope) {
@@ -0,0 +1,12 @@
1
+ import type { Maybe } from '@trpc/server/unstable-core-do-not-import';
2
+ /**
3
+ * Like `Promise.all()` but for abort signals
4
+ * - When all signals have been aborted, the merged signal will be aborted
5
+ * - If one signal is `null`, no signal will be aborted
6
+ */
7
+ export declare function allAbortSignals(...signals: Maybe<AbortSignal>[]): AbortSignal;
8
+ /**
9
+ * Like `Promise.race` but for abort signals
10
+ */
11
+ export declare function raceAbortSignals(...signals: Maybe<AbortSignal>[]): AbortSignal;
12
+ //# sourceMappingURL=signals.d.ts.map
@@ -0,0 +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;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAC/B,WAAW,CAYb"}
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Like `Promise.all()` but for abort signals
5
+ * - When all signals have been aborted, the merged signal will be aborted
6
+ * - If one signal is `null`, no signal will be aborted
7
+ */ function allAbortSignals(...signals) {
8
+ const ac = new AbortController();
9
+ const count = signals.length;
10
+ let abortedCount = 0;
11
+ const onAbort = ()=>{
12
+ if (++abortedCount === count) {
13
+ ac.abort();
14
+ }
15
+ };
16
+ for (const signal of signals){
17
+ if (signal?.aborted) {
18
+ onAbort();
19
+ } else {
20
+ signal?.addEventListener('abort', onAbort, {
21
+ once: true
22
+ });
23
+ }
24
+ }
25
+ return ac.signal;
26
+ }
27
+ /**
28
+ * Like `Promise.race` but for abort signals
29
+ */ function raceAbortSignals(...signals) {
30
+ const ac = new AbortController();
31
+ for (const signal of signals){
32
+ if (signal?.aborted) {
33
+ ac.abort();
34
+ } else {
35
+ signal?.addEventListener('abort', ()=>ac.abort(), {
36
+ once: true
37
+ });
38
+ }
39
+ }
40
+ return ac.signal;
41
+ }
42
+
43
+ exports.allAbortSignals = allAbortSignals;
44
+ exports.raceAbortSignals = raceAbortSignals;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Like `Promise.all()` but for abort signals
3
+ * - When all signals have been aborted, the merged signal will be aborted
4
+ * - If one signal is `null`, no signal will be aborted
5
+ */ function allAbortSignals(...signals) {
6
+ const ac = new AbortController();
7
+ const count = signals.length;
8
+ let abortedCount = 0;
9
+ const onAbort = ()=>{
10
+ if (++abortedCount === count) {
11
+ ac.abort();
12
+ }
13
+ };
14
+ for (const signal of signals){
15
+ if (signal?.aborted) {
16
+ onAbort();
17
+ } else {
18
+ signal?.addEventListener('abort', onAbort, {
19
+ once: true
20
+ });
21
+ }
22
+ }
23
+ return ac.signal;
24
+ }
25
+ /**
26
+ * Like `Promise.race` but for abort signals
27
+ */ function raceAbortSignals(...signals) {
28
+ const ac = new AbortController();
29
+ for (const signal of signals){
30
+ if (signal?.aborted) {
31
+ ac.abort();
32
+ } else {
33
+ signal?.addEventListener('abort', ()=>ac.abort(), {
34
+ once: true
35
+ });
36
+ }
37
+ }
38
+ return ac.signal;
39
+ }
40
+
41
+ export { allAbortSignals, raceAbortSignals };
@@ -1 +1 @@
1
- {"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAO7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,SAAS,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC/D,QAAQ,CAAC,OAAO,CAAC,CAkHnB"}
1
+ {"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAQ7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAOnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,SAAS,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC/D,QAAQ,CAAC,OAAO,CAAC,CAkHnB"}
@@ -3,6 +3,7 @@
3
3
  var observable = require('@trpc/server/observable');
4
4
  var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
5
5
  var dataLoader = require('../internals/dataLoader.js');
6
+ var signals = require('../internals/signals.js');
6
7
  var TRPCClientError = require('../TRPCClientError.js');
7
8
  var httpUtils = require('./internals/httpUtils.js');
8
9
 
@@ -33,7 +34,7 @@ var httpUtils = require('./internals/httpUtils.js');
33
34
  async fetch (batchOps) {
34
35
  const path = batchOps.map((op)=>op.path).join(',');
35
36
  const inputs = batchOps.map((op)=>op.input);
36
- const ac = httpUtils.mergeAbortSignals(batchOps);
37
+ const signal = signals.allAbortSignals(...batchOps.map((op)=>op.signal));
37
38
  const res = await httpUtils.jsonHttpRequester({
38
39
  ...resolvedOpts,
39
40
  path,
@@ -50,7 +51,7 @@ var httpUtils = require('./internals/httpUtils.js');
50
51
  }
51
52
  return opts.headers;
52
53
  },
53
- signal: ac.signal
54
+ signal
54
55
  });
55
56
  const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(()=>res.json);
56
57
  const result = resJSON.map((item)=>({
@@ -1,8 +1,9 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { transformResult } from '@trpc/server/unstable-core-do-not-import';
3
3
  import { dataLoader } from '../internals/dataLoader.mjs';
4
+ import { allAbortSignals } from '../internals/signals.mjs';
4
5
  import { TRPCClientError } from '../TRPCClientError.mjs';
5
- import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, jsonHttpRequester } from './internals/httpUtils.mjs';
6
+ import { resolveHTTPLinkOptions, getUrl, jsonHttpRequester } from './internals/httpUtils.mjs';
6
7
 
7
8
  /**
8
9
  * @see https://trpc.io/docs/client/links/httpBatchLink
@@ -31,7 +32,7 @@ import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, jsonHttpRequester }
31
32
  async fetch (batchOps) {
32
33
  const path = batchOps.map((op)=>op.path).join(',');
33
34
  const inputs = batchOps.map((op)=>op.input);
34
- const ac = mergeAbortSignals(batchOps);
35
+ const signal = allAbortSignals(...batchOps.map((op)=>op.signal));
35
36
  const res = await jsonHttpRequester({
36
37
  ...resolvedOpts,
37
38
  path,
@@ -48,7 +49,7 @@ import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, jsonHttpRequester }
48
49
  }
49
50
  return opts.headers;
50
51
  },
51
- signal: ac.signal
52
+ signal
52
53
  });
53
54
  const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(()=>res.json);
54
55
  const result = resJSON.map((item)=>({
@@ -1 +1 @@
1
- {"version":3,"file":"httpBatchStreamLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchStreamLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAM7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AASnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,KAAK,SAAS,YAAY,IAC/D,oBAAoB,CAAC,KAAK,CAAC,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEJ;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,SAAS,SAAS,EACpE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GACrE,QAAQ,CAAC,OAAO,CAAC,CA6JnB"}
1
+ {"version":3,"file":"httpBatchStreamLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchStreamLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAO7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQnE,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,KAAK,SAAS,YAAY,IAC/D,oBAAoB,CAAC,KAAK,CAAC,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEJ;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,SAAS,SAAS,EACpE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,GACrE,QAAQ,CAAC,OAAO,CAAC,CAgKnB"}
@@ -3,6 +3,7 @@
3
3
  var observable = require('@trpc/server/observable');
4
4
  var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
5
5
  var dataLoader = require('../internals/dataLoader.js');
6
+ var signals = require('../internals/signals.js');
6
7
  var TRPCClientError = require('../TRPCClientError.js');
7
8
  var httpUtils = require('./internals/httpUtils.js');
8
9
 
@@ -37,10 +38,11 @@ var httpUtils = require('./internals/httpUtils.js');
37
38
  async fetch (batchOps) {
38
39
  const path = batchOps.map((op)=>op.path).join(',');
39
40
  const inputs = batchOps.map((op)=>op.input);
40
- const ac = httpUtils.mergeAbortSignals(batchOps);
41
+ const batchSignals = signals.allAbortSignals(...batchOps.map((op)=>op.signal));
42
+ const abortController = new AbortController();
41
43
  const responsePromise = httpUtils.fetchHTTPResponse({
42
44
  ...resolvedOpts,
43
- signal: ac.signal,
45
+ signal: signals.raceAbortSignals(batchSignals, abortController.signal),
44
46
  type,
45
47
  contentTypeHeader: 'application/json',
46
48
  trpcAcceptHeader: 'application/jsonl',
@@ -72,7 +74,7 @@ var httpUtils = require('./internals/httpUtils.js');
72
74
  error
73
75
  });
74
76
  },
75
- abortController: ac
77
+ abortController
76
78
  });
77
79
  const promises = Object.keys(batchOps).map(async (key)=>{
78
80
  let json = await Promise.resolve(head[key]);
@@ -1,8 +1,9 @@
1
1
  import { observable } from '@trpc/server/observable';
2
2
  import { jsonlStreamConsumer } from '@trpc/server/unstable-core-do-not-import';
3
3
  import { dataLoader } from '../internals/dataLoader.mjs';
4
+ import { allAbortSignals, raceAbortSignals } from '../internals/signals.mjs';
4
5
  import { TRPCClientError } from '../TRPCClientError.mjs';
5
- import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, fetchHTTPResponse, getBody } from './internals/httpUtils.mjs';
6
+ import { resolveHTTPLinkOptions, getUrl, fetchHTTPResponse, getBody } from './internals/httpUtils.mjs';
6
7
 
7
8
  /**
8
9
  * @see https://trpc.io/docs/client/links/httpBatchStreamLink
@@ -35,10 +36,11 @@ import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, fetchHTTPResponse, g
35
36
  async fetch (batchOps) {
36
37
  const path = batchOps.map((op)=>op.path).join(',');
37
38
  const inputs = batchOps.map((op)=>op.input);
38
- const ac = mergeAbortSignals(batchOps);
39
+ const batchSignals = allAbortSignals(...batchOps.map((op)=>op.signal));
40
+ const abortController = new AbortController();
39
41
  const responsePromise = fetchHTTPResponse({
40
42
  ...resolvedOpts,
41
- signal: ac.signal,
43
+ signal: raceAbortSignals(batchSignals, abortController.signal),
42
44
  type,
43
45
  contentTypeHeader: 'application/json',
44
46
  trpcAcceptHeader: 'application/jsonl',
@@ -70,7 +72,7 @@ import { resolveHTTPLinkOptions, getUrl, mergeAbortSignals, fetchHTTPResponse, g
70
72
  error
71
73
  });
72
74
  },
73
- abortController: ac
75
+ abortController
74
76
  });
75
77
  const promises = Object.keys(batchOps).map(async (key)=>{
76
78
  let json = await Promise.resolve(head[key]);
@@ -1,28 +1,17 @@
1
- import type { AnyClientTypes, inferClientTypes, InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
1
+ import type { AnyClientTypes, inferClientTypes, InferrableClientTypes, SSEStreamConsumerOptions } from '@trpc/server/unstable-core-do-not-import';
2
2
  import { type TransformerOptions } from '../unstable-internals';
3
3
  import type { CallbackOrValue } from './internals/urlWithConnectionParams';
4
4
  import { type UrlOptionsWithConnectionParams } from './internals/urlWithConnectionParams';
5
5
  import type { TRPCLink } from './types';
6
- type RecreateOnErrorOpt = {
7
- type: 'raw';
8
- event: Event;
9
- } | {
10
- type: 'http-error';
11
- status: number;
12
- event: Event;
13
- };
14
6
  type HTTPSubscriptionLinkOptions<TRoot extends AnyClientTypes> = {
15
7
  /**
16
8
  * EventSource options or a callback that returns them
17
9
  */
18
10
  eventSourceOptions?: CallbackOrValue<EventSourceInit>;
19
11
  /**
20
- * For a given error, should we reinitialize the underlying EventSource?
21
- *
22
- * This is useful where a long running subscription might be interrupted by a recoverable network error,
23
- * but the existing authorization in a header or URI has expired in the mean-time
12
+ * @see https://trpc.io/docs/client/links/httpSubscriptionLink#updatingConfig
24
13
  */
25
- shouldRecreateOnError?: (opt: RecreateOnErrorOpt) => boolean | Promise<boolean>;
14
+ experimental_shouldRecreateOnError?: SSEStreamConsumerOptions['shouldRecreateOnError'];
26
15
  } & TransformerOptions<TRoot> & UrlOptionsWithConnectionParams;
27
16
  /**
28
17
  * @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":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBxC,KAAK,kBAAkB,GACnB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACd,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEN,KAAK,2BAA2B,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/D;;OAEG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IACtD;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,CACtB,GAAG,EAAE,kBAAkB,KACpB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAC3B,8BAA8B,CAAC;AAEjC;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,SAAS,qBAAqB,EAEzC,IAAI,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,GAC/D,QAAQ,CAAC,WAAW,CAAC,CA2HvB"}
1
+ {"version":3,"file":"httpSubscriptionLink.d.ts","sourceRoot":"","sources":["../../src/links/httpSubscriptionLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,0CAA0C,CAAC;AAOlD,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBxC,KAAK,2BAA2B,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/D;;OAEG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IACtD;;OAEG;IACH,kCAAkC,CAAC,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CACxF,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAC3B,8BAA8B,CAAC;AAEjC;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,SAAS,qBAAqB,EAEzC,IAAI,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,GAC/D,QAAQ,CAAC,WAAW,CAAC,CA6FvB"}