@ai-matrx/records 0.72.6 → 0.72.7
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/dist/templates/index.js
CHANGED
|
@@ -3466,6 +3466,15 @@ function validateTemplate(raw, options = {}) {
|
|
|
3466
3466
|
const tz = raw.business?.timezone || "UTC";
|
|
3467
3467
|
const tablesRaw = allTables(raw);
|
|
3468
3468
|
const ISO_DAY = /\b\d{4}-\d{2}-\d{2}\b/;
|
|
3469
|
+
const EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3470
|
+
for (const table of tablesRaw) {
|
|
3471
|
+
for (const f of table.fields.filter((x) => x.parityType === "email" || x.format === "email")) {
|
|
3472
|
+
table.rows?.forEach((row) => {
|
|
3473
|
+
const v = unwrap(row.values?.[f.key]);
|
|
3474
|
+
if (typeof v === "string" && v !== "" && !EMAIL_SHAPE.test(v)) say(`tables (${table.token}).rows (${row.key}).${f.key}`, `"${v}" is not an email address the store will take (no spaces, one @, a dotted domain).`);
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3469
3478
|
for (const table of tablesRaw) {
|
|
3470
3479
|
const tf = table.fields.find((f) => f.key === table.titleField);
|
|
3471
3480
|
if (tf && tf.default !== void 0) say(`tables (${table.token}).fields (${tf.key})`, `"${tf.label}" names each ${table.labelSingular.toLowerCase()}, so it takes no default; ask it on the form instead.`);
|