@ai-sdk/provider-utils 4.0.38 → 4.0.39
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.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/schema.ts +23 -4
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -307,7 +307,11 @@ type Schema<OBJECT = unknown> = {
|
|
|
307
307
|
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
308
308
|
type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
309
309
|
type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | z4.core.$ZodType<SCHEMA, any>;
|
|
310
|
-
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
310
|
+
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
311
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
312
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
311
315
|
type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
312
316
|
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;
|
|
313
317
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -307,7 +307,11 @@ type Schema<OBJECT = unknown> = {
|
|
|
307
307
|
declare function lazySchema<SCHEMA>(createSchema: () => Schema<SCHEMA>): LazySchema<SCHEMA>;
|
|
308
308
|
type LazySchema<SCHEMA> = () => Schema<SCHEMA>;
|
|
309
309
|
type ZodSchema<SCHEMA = any> = z3.Schema<SCHEMA, z3.ZodTypeDef, any> | z4.core.$ZodType<SCHEMA, any>;
|
|
310
|
-
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> &
|
|
310
|
+
type StandardSchema<SCHEMA = any> = StandardSchemaV1<unknown, SCHEMA> & {
|
|
311
|
+
readonly '~standard': StandardSchemaV1.Props<unknown, SCHEMA> & {
|
|
312
|
+
readonly jsonSchema?: StandardJSONSchemaV1.Converter;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
311
315
|
type FlexibleSchema<SCHEMA = any> = Schema<SCHEMA> | LazySchema<SCHEMA> | ZodSchema<SCHEMA> | StandardSchema<SCHEMA>;
|
|
312
316
|
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;
|
|
313
317
|
/**
|
package/dist/index.js
CHANGED
|
@@ -779,7 +779,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
// src/version.ts
|
|
782
|
-
var VERSION = true ? "4.0.
|
|
782
|
+
var VERSION = true ? "4.0.39" : "0.0.0-test";
|
|
783
783
|
|
|
784
784
|
// src/get-from-api.ts
|
|
785
785
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2331,11 +2331,18 @@ function asSchema(schema) {
|
|
|
2331
2331
|
}
|
|
2332
2332
|
function standardSchema(standardSchema2) {
|
|
2333
2333
|
return jsonSchema(
|
|
2334
|
-
() =>
|
|
2335
|
-
standardSchema2
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2334
|
+
() => {
|
|
2335
|
+
if (!hasStandardJsonSchema(standardSchema2)) {
|
|
2336
|
+
throw new Error(
|
|
2337
|
+
`Standard schema vendor '${standardSchema2["~standard"].vendor}' does not support JSON Schema conversion.`
|
|
2338
|
+
);
|
|
2339
|
+
}
|
|
2340
|
+
return addAdditionalPropertiesToJsonSchema(
|
|
2341
|
+
standardSchema2["~standard"].jsonSchema.input({
|
|
2342
|
+
target: "draft-07"
|
|
2343
|
+
})
|
|
2344
|
+
);
|
|
2345
|
+
},
|
|
2339
2346
|
{
|
|
2340
2347
|
validate: async (value) => {
|
|
2341
2348
|
const result = await standardSchema2["~standard"].validate(value);
|
|
@@ -2350,6 +2357,9 @@ function standardSchema(standardSchema2) {
|
|
|
2350
2357
|
}
|
|
2351
2358
|
);
|
|
2352
2359
|
}
|
|
2360
|
+
function hasStandardJsonSchema(schema) {
|
|
2361
|
+
return schema["~standard"].jsonSchema != null;
|
|
2362
|
+
}
|
|
2353
2363
|
function zod3Schema(zodSchema2, options) {
|
|
2354
2364
|
var _a2;
|
|
2355
2365
|
const useReferences = (_a2 = options == null ? void 0 : options.useReferences) != null ? _a2 : false;
|