(schema)
| 31152 | }); |
| 31153 | }; |
| 31154 | function deepPartialify(schema) { |
| 31155 | if (schema instanceof ZodObject) { |
| 31156 | const newShape = {}; |
| 31157 | for (const key in schema.shape) { |
| 31158 | const fieldSchema = schema.shape[key]; |
| 31159 | newShape[key] = ZodOptional.create(deepPartialify(fieldSchema)); |
| 31160 | } |
| 31161 | return new ZodObject({ |
| 31162 | ...schema._def, |
| 31163 | shape: () => newShape |
| 31164 | }); |
| 31165 | } else if (schema instanceof ZodArray) { |
| 31166 | return new ZodArray({ |
| 31167 | ...schema._def, |
| 31168 | type: deepPartialify(schema.element) |
| 31169 | }); |
| 31170 | } else if (schema instanceof ZodOptional) { |
| 31171 | return ZodOptional.create(deepPartialify(schema.unwrap())); |
| 31172 | } else if (schema instanceof ZodNullable) { |
| 31173 | return ZodNullable.create(deepPartialify(schema.unwrap())); |
| 31174 | } else if (schema instanceof ZodTuple) { |
| 31175 | return ZodTuple.create(schema.items.map((item) => deepPartialify(item))); |
| 31176 | } else { |
| 31177 | return schema; |
| 31178 | } |
| 31179 | } |
| 31180 | var ZodObject = class _ZodObject extends ZodType { |
| 31181 | constructor() { |
| 31182 | super(...arguments); |
no test coverage detected
searching dependent graphs…