@ai-matrx/records 0.72.7 → 0.72.11

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.
@@ -3466,6 +3466,20 @@ 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
+ for (const table of tablesRaw) {
3470
+ for (const f of table.fields) {
3471
+ for (const rule of f.rules ?? []) {
3472
+ if (rule.kind !== "pattern" || typeof rule.value !== "string" || typeof rule.example !== "string") continue;
3473
+ let re = null;
3474
+ try {
3475
+ re = new RegExp(rule.value);
3476
+ } catch {
3477
+ continue;
3478
+ }
3479
+ if (!re.test(rule.example)) say(`tables (${table.token}).fields (${f.key}).rules`, `"${f.label}" shows "${rule.example}" as the way to write it, and its own pattern refuses that. Make the example match the pattern.`);
3480
+ }
3481
+ }
3482
+ }
3469
3483
  const EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3470
3484
  for (const table of tablesRaw) {
3471
3485
  for (const f of table.fields.filter((x) => x.parityType === "email" || x.format === "email")) {
@@ -5555,7 +5569,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
5555
5569
  }
5556
5570
  }
5557
5571
  }
5558
- if (/report_due|reporting_due/.test(f.key)) {
5572
+ if (/report_due|reporting_due/.test(f.key) && /grant|award|funder|funding/i.test(`${t.token} ${t.name} ${t.labelSingular}`)) {
5559
5573
  const st = t.fields.find((x) => isChoice(x) && /status|stage/.test(x.key));
5560
5574
  if (!st) continue;
5561
5575
  for (const r of t.rows) {
@@ -6062,7 +6076,8 @@ function compileInstallPlan(written) {
6062
6076
  const documentRefs = Object.fromEntries(
6063
6077
  spec.extras.filter((e) => e.kind === "document").map((e) => [e.token, ref(`documents.${e.token}`)])
6064
6078
  );
6065
- for (const e of spec.extras) {
6079
+ const extrasInOrder = [...spec.extras.filter((e) => e.kind === "document"), ...spec.extras.filter((e) => e.kind !== "document")];
6080
+ for (const e of extrasInOrder) {
6066
6081
  switch (e.kind) {
6067
6082
  case "booking":
6068
6083
  steps.push({