@ai-sdk/provider-utils 4.0.0-beta.50 → 4.0.0-beta.52
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 +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +18 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -21
package/dist/index.mjs
CHANGED
|
@@ -289,7 +289,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/version.ts
|
|
292
|
-
var VERSION = true ? "4.0.0-beta.
|
|
292
|
+
var VERSION = true ? "4.0.0-beta.52" : "0.0.0-test";
|
|
293
293
|
|
|
294
294
|
// src/get-from-api.ts
|
|
295
295
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -609,33 +609,6 @@ function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
|
|
|
609
609
|
return jsonSchema2;
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
-
// src/to-json-schema/arktype-to-json-schema.ts
|
|
613
|
-
var arktypeToJsonSchema = (schema) => () => {
|
|
614
|
-
return schema.toJsonSchema();
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
// src/to-json-schema/effect-to-json-schema.ts
|
|
618
|
-
var effectToJsonSchema = (schema) => async () => {
|
|
619
|
-
try {
|
|
620
|
-
const { JSONSchema } = await import("effect");
|
|
621
|
-
return JSONSchema.make(schema);
|
|
622
|
-
} catch (e) {
|
|
623
|
-
throw new Error(`Failed to import module 'effect'`);
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
// src/to-json-schema/valibot-to-json-schema.ts
|
|
628
|
-
var valibotToJsonSchema = (schema) => {
|
|
629
|
-
return async () => {
|
|
630
|
-
try {
|
|
631
|
-
const { toJsonSchema } = await import("@valibot/to-json-schema");
|
|
632
|
-
return toJsonSchema(schema);
|
|
633
|
-
} catch (e) {
|
|
634
|
-
throw new Error(`Failed to import module '@valibot/to-json-schema'`);
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
|
|
639
612
|
// src/to-json-schema/zod3-to-json-schema/options.ts
|
|
640
613
|
var ignoreOverride = Symbol(
|
|
641
614
|
"Let zodToJsonSchema decide on which parser to use"
|
|
@@ -1847,57 +1820,26 @@ function isSchema(value) {
|
|
|
1847
1820
|
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
|
|
1848
1821
|
}
|
|
1849
1822
|
function asSchema(schema) {
|
|
1850
|
-
return schema == null ? jsonSchema({
|
|
1851
|
-
properties: {},
|
|
1852
|
-
additionalProperties: false
|
|
1853
|
-
}) : isSchema(schema) ? schema : "~standard" in schema ? standardSchema(schema) : schema();
|
|
1823
|
+
return schema == null ? jsonSchema({ properties: {}, additionalProperties: false }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
|
|
1854
1824
|
}
|
|
1855
1825
|
function standardSchema(standardSchema2) {
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
)
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
standardSchema2,
|
|
1872
|
-
effectToJsonSchema
|
|
1873
|
-
);
|
|
1874
|
-
}
|
|
1875
|
-
case "valibot": {
|
|
1876
|
-
return standardSchemaWithJsonSchemaResolver(
|
|
1877
|
-
standardSchema2,
|
|
1878
|
-
valibotToJsonSchema
|
|
1879
|
-
);
|
|
1880
|
-
}
|
|
1881
|
-
default: {
|
|
1882
|
-
return standardSchemaWithJsonSchemaResolver(standardSchema2, () => () => {
|
|
1883
|
-
throw new Error(`Unsupported standard schema vendor: ${vendor}`);
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
function standardSchemaWithJsonSchemaResolver(standardSchema2, jsonSchemaResolver) {
|
|
1889
|
-
return jsonSchema(jsonSchemaResolver(standardSchema2), {
|
|
1890
|
-
validate: async (value) => {
|
|
1891
|
-
const result = await standardSchema2["~standard"].validate(value);
|
|
1892
|
-
return "value" in result ? { success: true, value: result.value } : {
|
|
1893
|
-
success: false,
|
|
1894
|
-
error: new TypeValidationError({
|
|
1895
|
-
value,
|
|
1896
|
-
cause: result.issues
|
|
1897
|
-
})
|
|
1898
|
-
};
|
|
1826
|
+
return jsonSchema(
|
|
1827
|
+
() => standardSchema2["~standard"].jsonSchema.input({
|
|
1828
|
+
target: "draft-07"
|
|
1829
|
+
}),
|
|
1830
|
+
{
|
|
1831
|
+
validate: async (value) => {
|
|
1832
|
+
const result = await standardSchema2["~standard"].validate(value);
|
|
1833
|
+
return "value" in result ? { success: true, value: result.value } : {
|
|
1834
|
+
success: false,
|
|
1835
|
+
error: new TypeValidationError({
|
|
1836
|
+
value,
|
|
1837
|
+
cause: result.issues
|
|
1838
|
+
})
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1899
1841
|
}
|
|
1900
|
-
|
|
1842
|
+
);
|
|
1901
1843
|
}
|
|
1902
1844
|
function zod3Schema(zodSchema2, options) {
|
|
1903
1845
|
var _a;
|