@trpc/client 11.0.0-rc.459 → 11.0.0-rc.461

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": 50976,
3
- "bundleOrigSize": 68169,
4
- "bundleReduction": 25.22,
2
+ "bundleSize": 51737,
3
+ "bundleOrigSize": 68912,
4
+ "bundleReduction": 24.92,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/links/wsLink.ts",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "removedExports": [],
15
15
  "dependents": [],
16
- "percent": 25.64,
16
+ "percent": 25.26,
17
17
  "reduction": 10.22
18
18
  },
19
19
  {
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "removedExports": [],
27
27
  "dependents": [],
28
- "percent": 11.5,
28
+ "percent": 11.33,
29
29
  "reduction": 3.51
30
30
  },
31
31
  {
@@ -37,9 +37,33 @@
37
37
  ],
38
38
  "removedExports": [],
39
39
  "dependents": [],
40
- "percent": 10.71,
40
+ "percent": 10.55,
41
41
  "reduction": 18.48
42
42
  },
43
+ {
44
+ "id": "/src/links/internals/httpUtils.ts",
45
+ "size": 4465,
46
+ "origSize": 6646,
47
+ "renderedExports": [
48
+ "resolveHTTPLinkOptions",
49
+ "getInput",
50
+ "getUrl",
51
+ "getBody",
52
+ "jsonHttpRequester",
53
+ "fetchHTTPResponse",
54
+ "httpRequest",
55
+ "mergeAbortSignals"
56
+ ],
57
+ "removedExports": [],
58
+ "dependents": [
59
+ "/src/links/httpBatchLink.ts",
60
+ "/src/links/httpLink.ts",
61
+ "/src/links/httpBatchStreamLink.ts",
62
+ "/src/links/httpSubscriptionLink.ts"
63
+ ],
64
+ "percent": 8.63,
65
+ "reduction": 32.82
66
+ },
43
67
  {
44
68
  "id": "/src/internals/dataLoader.ts",
45
69
  "size": 4084,
@@ -52,7 +76,7 @@
52
76
  "/src/links/httpBatchLink.ts",
53
77
  "/src/links/httpBatchStreamLink.ts"
54
78
  ],
55
- "percent": 8.01,
79
+ "percent": 7.89,
56
80
  "reduction": 5.64
57
81
  },
58
82
  {
@@ -64,33 +88,9 @@
64
88
  ],
65
89
  "removedExports": [],
66
90
  "dependents": [],
67
- "percent": 7.7,
91
+ "percent": 7.59,
68
92
  "reduction": 4.69
69
93
  },
70
- {
71
- "id": "/src/links/internals/httpUtils.ts",
72
- "size": 3704,
73
- "origSize": 5903,
74
- "renderedExports": [
75
- "resolveHTTPLinkOptions",
76
- "getInput",
77
- "getUrl",
78
- "getBody",
79
- "jsonHttpRequester",
80
- "fetchHTTPResponse",
81
- "httpRequest",
82
- "mergeAbortSignals"
83
- ],
84
- "removedExports": [],
85
- "dependents": [
86
- "/src/links/httpBatchLink.ts",
87
- "/src/links/httpLink.ts",
88
- "/src/links/httpBatchStreamLink.ts",
89
- "/src/links/httpSubscriptionLink.ts"
90
- ],
91
- "percent": 7.27,
92
- "reduction": 37.25
93
- },
94
94
  {
95
95
  "id": "/src/links/httpSubscriptionLink.ts",
96
96
  "size": 3522,
@@ -100,7 +100,7 @@
100
100
  ],
101
101
  "removedExports": [],
102
102
  "dependents": [],
103
- "percent": 6.91,
103
+ "percent": 6.81,
104
104
  "reduction": 6.13
105
105
  },
106
106
  {
@@ -112,7 +112,7 @@
112
112
  ],
113
113
  "removedExports": [],
114
114
  "dependents": [],
115
- "percent": 6.25,
115
+ "percent": 6.15,
116
116
  "reduction": 14.15
117
117
  },
118
118
  {
@@ -127,7 +127,7 @@
127
127
  "/src/createTRPCUntypedClient.ts",
128
128
  "/src/createTRPCClient.ts"
129
129
  ],
130
- "percent": 4.24,
130
+ "percent": 4.18,
131
131
  "reduction": 47.6
132
132
  },
133
133
  {
@@ -147,7 +147,7 @@
147
147
  "/src/links/httpSubscriptionLink.ts",
148
148
  "/src/internals/TRPCUntypedClient.ts"
149
149
  ],
150
- "percent": 3.81,
150
+ "percent": 3.75,
151
151
  "reduction": 45.43
152
152
  },
153
153
  {
@@ -164,7 +164,7 @@
164
164
  "dependents": [
165
165
  "/src/index.ts"
166
166
  ],
167
- "percent": 2.33,
167
+ "percent": 2.29,
168
168
  "reduction": 73.19
169
169
  },
170
170
  {
@@ -179,7 +179,7 @@
179
179
  "/src/links/splitLink.ts",
180
180
  "/src/internals/TRPCUntypedClient.ts"
181
181
  ],
182
- "percent": 1.35,
182
+ "percent": 1.33,
183
183
  "reduction": 32.75
184
184
  },
185
185
  {
@@ -191,7 +191,7 @@
191
191
  ],
192
192
  "removedExports": [],
193
193
  "dependents": [],
194
- "percent": 1.2,
194
+ "percent": 1.18,
195
195
  "reduction": 44.95
196
196
  },
197
197
  {
@@ -205,7 +205,7 @@
205
205
  "dependents": [
206
206
  "/src/unstable-internals.ts"
207
207
  ],
208
- "percent": 1.11,
208
+ "percent": 1.09,
209
209
  "reduction": 66.75
210
210
  },
211
211
  {
@@ -220,7 +220,7 @@
220
220
  "/src/index.ts",
221
221
  "/src/links/internals/httpUtils.ts"
222
222
  ],
223
- "percent": 0.84,
223
+ "percent": 0.83,
224
224
  "reduction": 33.54
225
225
  },
226
226
  {
@@ -234,7 +234,7 @@
234
234
  ],
235
235
  "removedExports": [],
236
236
  "dependents": [],
237
- "percent": 0.65,
237
+ "percent": 0.64,
238
238
  "reduction": 15.17
239
239
  },
240
240
  {
@@ -263,7 +263,7 @@
263
263
  "dependents": [
264
264
  "/src/index.ts"
265
265
  ],
266
- "percent": 0.2,
266
+ "percent": 0.19,
267
267
  "reduction": 82.58
268
268
  },
269
269
  {
@@ -1 +1 @@
1
- {"version":3,"file":"httpUtils.d.ts","sourceRoot":"","sources":["../../../src/links/internals/httpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC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**
69
+ * Polyfill for DOMException with AbortError name
70
+ */ class AbortError extends Error {
71
+ constructor(){
72
+ const name = 'AbortError';
73
+ super(name);
74
+ this.name = name;
75
+ this.message = name;
76
+ }
77
+ }
78
+ /**
79
+ * Polyfill for `signal.throwIfAborted()`
80
+ *
81
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted
82
+ */ const throwIfAborted = (signal)=>{
83
+ if (!signal?.aborted) {
84
+ return;
85
+ }
86
+ // If available, use the native implementation
87
+ signal.throwIfAborted?.();
88
+ // If we have `DOMException`, use it
89
+ if (typeof DOMException !== 'undefined') {
90
+ throw new DOMException('AbortError', 'AbortError');
91
+ }
92
+ // Otherwise, use our own implementation
93
+ throw new AbortError();
94
+ };
68
95
  async function fetchHTTPResponse(opts) {
69
- opts.signal?.throwIfAborted();
96
+ throwIfAborted(opts.signal);
70
97
  const url = opts.getUrl(opts);
71
98
  const body = opts.getBody(opts);
72
99
  const { type } = opts;
@@ -63,8 +63,35 @@ const jsonHttpRequester = (opts)=>{
63
63
  getBody
64
64
  });
65
65
  };
66
+ /**
67
+ * Polyfill for DOMException with AbortError name
68
+ */ class AbortError extends Error {
69
+ constructor(){
70
+ const name = 'AbortError';
71
+ super(name);
72
+ this.name = name;
73
+ this.message = name;
74
+ }
75
+ }
76
+ /**
77
+ * Polyfill for `signal.throwIfAborted()`
78
+ *
79
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted
80
+ */ const throwIfAborted = (signal)=>{
81
+ if (!signal?.aborted) {
82
+ return;
83
+ }
84
+ // If available, use the native implementation
85
+ signal.throwIfAborted?.();
86
+ // If we have `DOMException`, use it
87
+ if (typeof DOMException !== 'undefined') {
88
+ throw new DOMException('AbortError', 'AbortError');
89
+ }
90
+ // Otherwise, use our own implementation
91
+ throw new AbortError();
92
+ };
66
93
  async function fetchHTTPResponse(opts) {
67
- opts.signal?.throwIfAborted();
94
+ throwIfAborted(opts.signal);
68
95
  const url = opts.getUrl(opts);
69
96
  const body = opts.getBody(opts);
70
97
  const { type } = opts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "11.0.0-rc.459+e14ad2175",
3
+ "version": "11.0.0-rc.461+f178d3fed",
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.459+e14ad2175"
79
+ "@trpc/server": "11.0.0-rc.461+f178d3fed"
80
80
  },
81
81
  "devDependencies": {
82
- "@trpc/server": "11.0.0-rc.459+e14ad2175",
82
+ "@trpc/server": "11.0.0-rc.461+f178d3fed",
83
83
  "@types/isomorphic-fetch": "^0.0.39",
84
84
  "@types/node": "^20.10.0",
85
85
  "eslint": "^8.56.0",
@@ -96,5 +96,5 @@
96
96
  "funding": [
97
97
  "https://trpc.io/sponsor"
98
98
  ],
99
- "gitHead": "e14ad2175af4647060a7dd679d293b090636beda"
99
+ "gitHead": "f178d3fed131c9036014603665a0803de0533c9a"
100
100
  }
@@ -154,13 +154,47 @@ export const jsonHttpRequester: Requester = (opts) => {
154
154
  });
155
155
  };
156
156
 
157
+ /**
158
+ * Polyfill for DOMException with AbortError name
159
+ */
160
+ class AbortError extends Error {
161
+ constructor() {
162
+ const name = 'AbortError';
163
+ super(name);
164
+ this.name = name;
165
+ this.message = name;
166
+ }
167
+ }
168
+
157
169
  export type HTTPRequestOptions = ContentOptions &
158
170
  HTTPBaseRequestOptions & {
159
171
  headers: () => HTTPHeaders | Promise<HTTPHeaders>;
160
172
  };
161
173
 
174
+ /**
175
+ * Polyfill for `signal.throwIfAborted()`
176
+ *
177
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted
178
+ */
179
+ const throwIfAborted = (signal: Maybe<AbortSignal>) => {
180
+ if (!signal?.aborted) {
181
+ return;
182
+ }
183
+ // If available, use the native implementation
184
+ signal.throwIfAborted?.();
185
+
186
+ // If we have `DOMException`, use it
187
+ if (typeof DOMException !== 'undefined') {
188
+ throw new DOMException('AbortError', 'AbortError');
189
+ }
190
+
191
+ // Otherwise, use our own implementation
192
+ throw new AbortError();
193
+ };
194
+
162
195
  export async function fetchHTTPResponse(opts: HTTPRequestOptions) {
163
- opts.signal?.throwIfAborted();
196
+ throwIfAborted(opts.signal);
197
+
164
198
  const url = opts.getUrl(opts);
165
199
  const body = opts.getBody(opts);
166
200
  const { type } = opts;