@ai-sdk/provider-utils 4.0.2 → 4.0.3

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
@@ -382,7 +382,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
382
382
  }
383
383
 
384
384
  // src/version.ts
385
- var VERSION = true ? "4.0.2" : "0.0.0-test";
385
+ var VERSION = true ? "4.0.3" : "0.0.0-test";
386
386
 
387
387
  // src/get-from-api.ts
388
388
  var getOriginalFetch = () => globalThis.fetch;
@@ -677,30 +677,39 @@ import * as z4 from "zod/v4";
677
677
 
678
678
  // src/add-additional-properties-to-json-schema.ts
679
679
  function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
680
- if (jsonSchema2.type === "object") {
680
+ if (jsonSchema2.type === "object" || Array.isArray(jsonSchema2.type) && jsonSchema2.type.includes("object")) {
681
681
  jsonSchema2.additionalProperties = false;
682
- const properties = jsonSchema2.properties;
682
+ const { properties } = jsonSchema2;
683
683
  if (properties != null) {
684
- for (const property in properties) {
685
- properties[property] = addAdditionalPropertiesToJsonSchema(
686
- properties[property]
687
- );
684
+ for (const key of Object.keys(properties)) {
685
+ properties[key] = visit(properties[key]);
688
686
  }
689
687
  }
690
688
  }
691
- if (jsonSchema2.type === "array" && jsonSchema2.items != null) {
692
- if (Array.isArray(jsonSchema2.items)) {
693
- jsonSchema2.items = jsonSchema2.items.map(
694
- (item) => addAdditionalPropertiesToJsonSchema(item)
695
- );
696
- } else {
697
- jsonSchema2.items = addAdditionalPropertiesToJsonSchema(
698
- jsonSchema2.items
699
- );
689
+ if (jsonSchema2.items != null) {
690
+ jsonSchema2.items = Array.isArray(jsonSchema2.items) ? jsonSchema2.items.map(visit) : visit(jsonSchema2.items);
691
+ }
692
+ if (jsonSchema2.anyOf != null) {
693
+ jsonSchema2.anyOf = jsonSchema2.anyOf.map(visit);
694
+ }
695
+ if (jsonSchema2.allOf != null) {
696
+ jsonSchema2.allOf = jsonSchema2.allOf.map(visit);
697
+ }
698
+ if (jsonSchema2.oneOf != null) {
699
+ jsonSchema2.oneOf = jsonSchema2.oneOf.map(visit);
700
+ }
701
+ const { definitions } = jsonSchema2;
702
+ if (definitions != null) {
703
+ for (const key of Object.keys(definitions)) {
704
+ definitions[key] = visit(definitions[key]);
700
705
  }
701
706
  }
702
707
  return jsonSchema2;
703
708
  }
709
+ function visit(def) {
710
+ if (typeof def === "boolean") return def;
711
+ return addAdditionalPropertiesToJsonSchema(def);
712
+ }
704
713
 
705
714
  // src/to-json-schema/zod3-to-json-schema/options.ts
706
715
  var ignoreOverride = Symbol(