@ai-sdk/provider-utils 3.0.45 → 3.0.47
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 +16 -0
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -434,12 +434,20 @@ async function fetchWithValidatedEndpoint({
|
|
|
434
434
|
init,
|
|
435
435
|
fetch: customFetch,
|
|
436
436
|
trustedOrigin,
|
|
437
|
-
redirect = "error"
|
|
437
|
+
redirect = "error",
|
|
438
|
+
requireDnsValidation = false
|
|
438
439
|
}) {
|
|
439
440
|
const urlText = url.toString();
|
|
440
441
|
const isTrusted = trustedOrigin !== void 0 && isSameOrigin(urlText, trustedOrigin);
|
|
441
442
|
if (!isTrusted) {
|
|
442
443
|
validateDownloadUrl(urlText);
|
|
444
|
+
if (requireDnsValidation && (customFetch == null || customFetch === globalThis.fetch) && !isNodeRuntime() && // A window alias alone does not distinguish older Deno from a browser.
|
|
445
|
+
!(isBrowserRuntime() && typeof document !== "undefined")) {
|
|
446
|
+
throw new DownloadError({
|
|
447
|
+
url: urlText,
|
|
448
|
+
message: "This server runtime requires a custom fetch with connect-time DNS validation for untrusted URLs"
|
|
449
|
+
});
|
|
450
|
+
}
|
|
443
451
|
}
|
|
444
452
|
const fetch = isTrusted && customFetch != null ? customFetch : isTrusted ? globalThis.fetch : await getValidatedFetch(customFetch);
|
|
445
453
|
return await fetch(url, {
|
|
@@ -752,7 +760,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
752
760
|
}
|
|
753
761
|
|
|
754
762
|
// src/version.ts
|
|
755
|
-
var VERSION = true ? "3.0.
|
|
763
|
+
var VERSION = true ? "3.0.47" : "0.0.0-test";
|
|
756
764
|
|
|
757
765
|
// src/get-from-api.ts
|
|
758
766
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1169,11 +1177,13 @@ function isParsableJson(input) {
|
|
|
1169
1177
|
import {
|
|
1170
1178
|
EventSourceParserStream
|
|
1171
1179
|
} from "eventsource-parser/stream";
|
|
1180
|
+
var DEFAULT_MAX_EVENT_SIZE = 64 * 1024 * 1024;
|
|
1172
1181
|
function parseJsonEventStream({
|
|
1173
1182
|
stream,
|
|
1174
|
-
schema
|
|
1183
|
+
schema,
|
|
1184
|
+
maxEventSize = DEFAULT_MAX_EVENT_SIZE
|
|
1175
1185
|
}) {
|
|
1176
|
-
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
1186
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({ maxBufferSize: maxEventSize })).pipeThrough(
|
|
1177
1187
|
new TransformStream({
|
|
1178
1188
|
async transform({ data }, controller) {
|
|
1179
1189
|
if (data === "[DONE]") {
|