@ai-sdk/provider-utils 4.0.65 → 4.0.66

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/dist/index.mjs CHANGED
@@ -580,12 +580,20 @@ async function fetchWithValidatedEndpoint({
580
580
  init,
581
581
  fetch: customFetch,
582
582
  trustedOrigin,
583
- redirect = "error"
583
+ redirect = "error",
584
+ requireDnsValidation = false
584
585
  }) {
585
586
  const urlText = url.toString();
586
587
  const isTrusted = trustedOrigin !== void 0 && isSameOrigin(urlText, trustedOrigin);
587
588
  if (!isTrusted) {
588
589
  validateDownloadUrl(urlText);
590
+ if (requireDnsValidation && (customFetch == null || customFetch === globalThis.fetch) && !isNodeRuntime() && // A window alias alone does not distinguish older Deno from a browser.
591
+ !(isBrowserRuntime() && typeof document !== "undefined")) {
592
+ throw new DownloadError({
593
+ url: urlText,
594
+ message: "This server runtime requires a custom fetch with connect-time DNS validation for untrusted URLs"
595
+ });
596
+ }
589
597
  }
590
598
  const fetch = isTrusted && customFetch != null ? customFetch : isTrusted ? globalThis.fetch : await getValidatedFetch(customFetch);
591
599
  return await fetch(url, {
@@ -939,7 +947,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
939
947
  }
940
948
 
941
949
  // src/version.ts
942
- var VERSION = true ? "4.0.65" : "0.0.0-test";
950
+ var VERSION = true ? "4.0.66" : "0.0.0-test";
943
951
 
944
952
  // src/get-from-api.ts
945
953
  var getOriginalFetch = () => globalThis.fetch;