@ai-sdk/provider-utils 4.0.65 → 4.0.67
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 +12 -0
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/fetch-with-validated-redirects.ts +21 -1
- package/src/schema.ts +2 -1
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.
|
|
950
|
+
var VERSION = true ? "4.0.67" : "0.0.0-test";
|
|
943
951
|
|
|
944
952
|
// src/get-from-api.ts
|
|
945
953
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2518,7 +2526,7 @@ function standardSchema(standardSchema2) {
|
|
|
2518
2526
|
{
|
|
2519
2527
|
validate: async (value) => {
|
|
2520
2528
|
const result = await standardSchema2["~standard"].validate(value);
|
|
2521
|
-
return "value" in result ? { success: true, value: result.value } : {
|
|
2529
|
+
return result.issues === void 0 && "value" in result ? { success: true, value: result.value } : {
|
|
2522
2530
|
success: false,
|
|
2523
2531
|
error: new TypeValidationError({
|
|
2524
2532
|
value,
|