@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
25 lines (24 loc) • 952 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const validation_1 = require("../../registry/validation");
const constants_1 = require("../postcode/constants");
// Constraints taken from the BRK API (apart from postcode which comes from our postcode component)
const addressNLSchema = zod_1.z.object({
postcode: zod_1.z.string().regex(new RegExp(constants_1.POSTCODE_REGEX)).optional(),
houseNumber: zod_1.z
.string()
.regex(/^\d{1,5}$/)
.optional(),
houseLetter: zod_1.z
.string()
.regex(/^[a-zA-Z]$/)
.optional(),
houseNumberAddition: zod_1.z
.string()
.regex(/^([a-z,A-Z,0-9]){1,4}$/)
.optional(),
});
const defaultValueSchema = zod_1.z.object({ defaultValue: addressNLSchema });
const schema = ({ intl }) => (0, validation_1.buildCommonSchema)(intl).and(defaultValueSchema);
exports.default = schema;