@ai-sdk/provider-utils 3.0.18 → 3.0.19
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.js +35 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -263,7 +263,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
// src/version.ts
|
|
266
|
-
var VERSION = true ? "3.0.
|
|
266
|
+
var VERSION = true ? "3.0.19" : "0.0.0-test";
|
|
267
267
|
|
|
268
268
|
// src/get-from-api.ts
|
|
269
269
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1072,6 +1072,33 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
|
|
|
1072
1072
|
// src/zod-schema.ts
|
|
1073
1073
|
import * as z4 from "zod/v4";
|
|
1074
1074
|
|
|
1075
|
+
// src/add-additional-properties-to-json-schema.ts
|
|
1076
|
+
function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
|
|
1077
|
+
if (jsonSchema2.type === "object") {
|
|
1078
|
+
jsonSchema2.additionalProperties = false;
|
|
1079
|
+
const properties = jsonSchema2.properties;
|
|
1080
|
+
if (properties != null) {
|
|
1081
|
+
for (const property in properties) {
|
|
1082
|
+
properties[property] = addAdditionalPropertiesToJsonSchema(
|
|
1083
|
+
properties[property]
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (jsonSchema2.type === "array" && jsonSchema2.items != null) {
|
|
1089
|
+
if (Array.isArray(jsonSchema2.items)) {
|
|
1090
|
+
jsonSchema2.items = jsonSchema2.items.map(
|
|
1091
|
+
(item) => addAdditionalPropertiesToJsonSchema(item)
|
|
1092
|
+
);
|
|
1093
|
+
} else {
|
|
1094
|
+
jsonSchema2.items = addAdditionalPropertiesToJsonSchema(
|
|
1095
|
+
jsonSchema2.items
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return jsonSchema2;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1075
1102
|
// src/zod-to-json-schema/get-relative-path.ts
|
|
1076
1103
|
var getRelativePath = (pathA, pathB) => {
|
|
1077
1104
|
let i = 0;
|
|
@@ -2277,11 +2304,13 @@ function zod4Schema(zodSchema2, options) {
|
|
|
2277
2304
|
const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
|
|
2278
2305
|
return jsonSchema(
|
|
2279
2306
|
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
2280
|
-
() =>
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2307
|
+
() => addAdditionalPropertiesToJsonSchema(
|
|
2308
|
+
z4.toJSONSchema(zodSchema2, {
|
|
2309
|
+
target: "draft-7",
|
|
2310
|
+
io: "input",
|
|
2311
|
+
reused: useReferences ? "ref" : "inline"
|
|
2312
|
+
})
|
|
2313
|
+
),
|
|
2285
2314
|
{
|
|
2286
2315
|
validate: async (value) => {
|
|
2287
2316
|
const result = await z4.safeParseAsync(zodSchema2, value);
|