@ai-sdk/provider-utils 3.0.26 → 3.0.27
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/CHANGELOG.md +8 -0
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -154,6 +154,15 @@ var DownloadError = class extends (_b = AISDKError, _a = symbol, _b) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
// src/cancel-response-body.ts
|
|
158
|
+
async function cancelResponseBody(response) {
|
|
159
|
+
var _a2;
|
|
160
|
+
try {
|
|
161
|
+
await ((_a2 = response.body) == null ? void 0 : _a2.cancel());
|
|
162
|
+
} catch (e) {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
157
166
|
// src/is-browser-runtime.ts
|
|
158
167
|
function isBrowserRuntime(globalThisAny = globalThis) {
|
|
159
168
|
return globalThisAny.window != null;
|
|
@@ -328,6 +337,7 @@ async function fetchWithValidatedRedirects({
|
|
|
328
337
|
}
|
|
329
338
|
const location = response.headers.get("location");
|
|
330
339
|
if (response.status >= 300 && response.status < 400 && location) {
|
|
340
|
+
await cancelResponseBody(response);
|
|
331
341
|
currentUrl = new URL(location, currentUrl).toString();
|
|
332
342
|
continue;
|
|
333
343
|
}
|
|
@@ -350,6 +360,7 @@ async function readResponseWithSizeLimit({
|
|
|
350
360
|
if (contentLength != null) {
|
|
351
361
|
const length = parseInt(contentLength, 10);
|
|
352
362
|
if (!isNaN(length) && length > maxBytes) {
|
|
363
|
+
await cancelResponseBody(response);
|
|
353
364
|
throw new DownloadError({
|
|
354
365
|
url,
|
|
355
366
|
message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
|
|
@@ -528,7 +539,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
528
539
|
}
|
|
529
540
|
|
|
530
541
|
// src/version.ts
|
|
531
|
-
var VERSION = true ? "3.0.
|
|
542
|
+
var VERSION = true ? "3.0.27" : "0.0.0-test";
|
|
532
543
|
|
|
533
544
|
// src/get-from-api.ts
|
|
534
545
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2704,6 +2715,7 @@ export {
|
|
|
2704
2715
|
VERSION,
|
|
2705
2716
|
asSchema,
|
|
2706
2717
|
asValidator,
|
|
2718
|
+
cancelResponseBody,
|
|
2707
2719
|
combineHeaders,
|
|
2708
2720
|
convertAsyncIteratorToReadableStream,
|
|
2709
2721
|
convertBase64ToUint8Array,
|