@ai-sdk/provider-utils 5.0.9 → 5.0.10
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.ts +5 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/schema.ts +23 -4
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -973,7 +973,11 @@ type Schema<OBJECT = unknown> = {
|
|
|
973
973
|
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
974
974
|
type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
975
975
|
type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | z4.core.$ZodType<SCHEMA, any>;
|
|
976
|
-
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
976
|
+
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
977
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
978
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
979
|
+
};
|
|
980
|
+
};
|
|
977
981
|
type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
978
982
|
type InferSchema<SCHEMA> = SCHEMA extends ZodSchema<infer T> ? T : SCHEMA extends StandardSchema<infer T> ? T : SCHEMA extends LazySchema<infer T> ? T : SCHEMA extends Schema<infer T> ? T : never;
|
|
979
983
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1153,7 +1153,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
1155
|
// src/version.ts
|
|
1156
|
-
var VERSION = true ? "5.0.
|
|
1156
|
+
var VERSION = true ? "5.0.10" : "0.0.0-test";
|
|
1157
1157
|
|
|
1158
1158
|
// src/get-from-api.ts
|
|
1159
1159
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2793,11 +2793,18 @@ function asSchema(schema) {
|
|
|
2793
2793
|
}
|
|
2794
2794
|
function standardSchema(standardSchema2) {
|
|
2795
2795
|
return jsonSchema(
|
|
2796
|
-
() =>
|
|
2797
|
-
standardSchema2
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2796
|
+
() => {
|
|
2797
|
+
if (!hasStandardJsonSchema(standardSchema2)) {
|
|
2798
|
+
throw new Error(
|
|
2799
|
+
`Standard schema vendor '${standardSchema2["~standard"].vendor}' does not support JSON Schema conversion.`
|
|
2800
|
+
);
|
|
2801
|
+
}
|
|
2802
|
+
return addAdditionalPropertiesToJsonSchema(
|
|
2803
|
+
standardSchema2["~standard"].jsonSchema.input({
|
|
2804
|
+
target: "draft-07"
|
|
2805
|
+
})
|
|
2806
|
+
);
|
|
2807
|
+
},
|
|
2801
2808
|
{
|
|
2802
2809
|
validate: async (value) => {
|
|
2803
2810
|
const result = await standardSchema2["~standard"].validate(value);
|
|
@@ -2812,6 +2819,9 @@ function standardSchema(standardSchema2) {
|
|
|
2812
2819
|
}
|
|
2813
2820
|
);
|
|
2814
2821
|
}
|
|
2822
|
+
function hasStandardJsonSchema(schema) {
|
|
2823
|
+
return schema["~standard"].jsonSchema != null;
|
|
2824
|
+
}
|
|
2815
2825
|
function zod3Schema(zodSchema2, options) {
|
|
2816
2826
|
var _a2;
|
|
2817
2827
|
const useReferences = (_a2 = options == null ? void 0 : options.useReferences) != null ? _a2 : false;
|