UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

19 lines (18 loc) 624 B
import { z as n } from "zod"; import { isArray as t, isEmpty as i } from "lodash-es"; import l from "./getZodSchemaForColumnType.js"; function m(e) { const o = l(e); return n.union([ n.null(), n.string().length(0).transform(() => null), o ]).optional().refine((r) => e.endsWith("_LIST") ? r == null || t(r) : !0, "Default value cannot be an array for a non-list column type").transform((r) => { if (!(r == null || r === "" || t(r) && i(r))) return typeof r == "string" ? r : JSON.stringify(r); }); } export { m as getDefaultValueValidator }; //# sourceMappingURL=DefaultValueValidator.js.map