@mastra/schema-compat 1.0.0-beta.3 → 1.0.0-beta.4
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 +10 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/provider-compats/openai.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4872,6 +4872,19 @@ var OpenAISchemaCompatLayer = class extends SchemaCompatLayer3 {
|
|
|
4872
4872
|
return processedInner.nullable();
|
|
4873
4873
|
}
|
|
4874
4874
|
return value;
|
|
4875
|
+
} else if (isDefault(z)(value)) {
|
|
4876
|
+
const innerType = "_def" in value ? value._def.innerType : value._zod?.def?.innerType;
|
|
4877
|
+
const defaultValue = "_def" in value ? value._def.defaultValue : value._zod?.def?.defaultValue;
|
|
4878
|
+
if (innerType) {
|
|
4879
|
+
const processedInner = this.processZodType(innerType);
|
|
4880
|
+
return processedInner.nullable().transform((val) => {
|
|
4881
|
+
if (val === null) {
|
|
4882
|
+
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
4883
|
+
}
|
|
4884
|
+
return val;
|
|
4885
|
+
});
|
|
4886
|
+
}
|
|
4887
|
+
return value;
|
|
4875
4888
|
} else if (isObj2(z)(value)) {
|
|
4876
4889
|
return this.defaultZodObjectHandler(value);
|
|
4877
4890
|
} else if (isUnion2(z)(value)) {
|