UNPKG

@rnaga/wp-node

Version:

👉 **[View Full Documentation at rnaga.github.io/wp-node →](https://rnaga.github.io/wp-node/)**

19 lines (18 loc) • 651 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.metaInsert = exports.metaUpdate = void 0; const zod_1 = require("zod"); exports.metaUpdate = zod_1.z.object({ meta_value: zod_1.z .any() .transform((v) => typeof v == "undefined" ? "" : new String(v).toString()), }); const metaInsert = (table) => zod_1.z.object({ [`${table}_id`]: zod_1.z.number().int().nonnegative(), meta_key: zod_1.z.string().max(255).trim(), meta_value: zod_1.z.union([ zod_1.z.string().trim().nullable(), zod_1.z.any().transform((v) => v.toString()), ]), }); exports.metaInsert = metaInsert;