@ai-sdk/provider-utils 3.0.45 → 3.0.46
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 +6 -0
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.46" : "0.0.0-test";
|
|
756
764
|
|
|
757
765
|
// src/get-from-api.ts
|
|
758
766
|
var getOriginalFetch = () => globalThis.fetch;
|