@ai-matrx/records 0.72.11 → 0.72.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.72.14
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records/v0.72.12..npm/records/v0.72.14 -- apps/shared/records`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.72.13
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records/v0.72.12..npm/records/v0.72.13 -- apps/shared/records`).
13
+ No source changes intended and no consumer action required.
14
+
15
+ ## 0.72.12
16
+
17
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
18
+ `git diff npm/records/v0.72.11..npm/records/v0.72.12 -- apps/shared/records`).
19
+ No source changes intended and no consumer action required.
20
+
3
21
  ## 0.72.11
4
22
 
5
23
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -3601,9 +3601,23 @@ function validateTemplate(raw, options = {}) {
3601
3601
  seedLooks.add(p);
3602
3602
  problems.push(p);
3603
3603
  };
3604
+ const galleryBar = /* @__PURE__ */ new WeakSet();
3605
+ const sayGallery = (at, says) => {
3606
+ const p = { at, says };
3607
+ galleryBar.add(p);
3608
+ problems.push(p);
3609
+ };
3604
3610
  const tz = raw.business?.timezone || "UTC";
3605
3611
  const tablesRaw = allTables(raw);
3606
3612
  const ISO_DAY = /\b\d{4}-\d{2}-\d{2}\b/;
3613
+ for (const e of raw.extras ?? []) {
3614
+ if (e.kind !== "checklist") continue;
3615
+ for (const st of e.steps ?? []) {
3616
+ if (st.dueDays !== void 0 && !(Number.isInteger(st.dueDays) && st.dueDays >= 0 && st.dueDays <= 3650)) {
3617
+ say(`extras (${e.token}).steps (${st.ref ?? "?"}).dueDays`, `A step is due a whole number of days after the checklist starts, from 0 to 3650; ${st.dueDays} is not. Start the checklist earlier instead of counting backwards.`);
3618
+ }
3619
+ }
3620
+ }
3607
3621
  for (const table of tablesRaw) {
3608
3622
  for (const f of table.fields) {
3609
3623
  for (const rule of f.rules ?? []) {
@@ -3915,7 +3929,7 @@ function validateTemplate(raw, options = {}) {
3915
3929
  say(`${tat}.rows`, `Only ${titles.size} of ${table.rows.length} rows have a title of their own; a list of look-alike names reads as generated.`);
3916
3930
  }
3917
3931
  });
3918
- if (!hasLookupOrRollup) say("tables", "At least one relationship has to be read across: add a lookup or a rollup through a relation field.");
3932
+ if (!hasLookupOrRollup) sayGallery("tables", "At least one relationship has to be read across: add a lookup or a rollup through a relation field.");
3919
3933
  if (main) {
3920
3934
  const normTitle = (v) => (storeText(v) ?? "").toLowerCase().replace(/\s+/g, " ").trim();
3921
3935
  const rows = main.rows;
@@ -3983,8 +3997,8 @@ function validateTemplate(raw, options = {}) {
3983
3997
  else surfaces.set(token, { at, ...table ? { table } : {} });
3984
3998
  };
3985
3999
  const views = spec.views ?? [];
3986
- if (views.length < 3) say("views", `A template shows at least three views; this one has ${views.length}.`);
3987
- if (!views.some((v) => v.kind === "grid")) say("views", "One of the views is a grid \u2014 the table everyone recognises.");
4000
+ if (views.length < 3) sayGallery("views", `A template shows at least three views; this one has ${views.length}.`);
4001
+ if (!views.some((v) => v.kind === "grid")) sayGallery("views", "One of the views is a grid \u2014 the table everyone recognises.");
3988
4002
  views.forEach((view, i) => {
3989
4003
  const at = `views[${i}] (${view.token})`;
3990
4004
  claim(view.token, at, view.table);
@@ -4110,7 +4124,7 @@ function validateTemplate(raw, options = {}) {
4110
4124
  }
4111
4125
  };
4112
4126
  const extras = spec.extras ?? [];
4113
- if (extras.length < 2) say("extras", `A template carries at least two extras; this one has ${extras.length}.`);
4127
+ if (extras.length < 2) sayGallery("extras", `A template carries at least two extras; this one has ${extras.length}.`);
4114
4128
  const formTokens = new Set(forms.map((f) => f.token));
4115
4129
  const viewTokens = new Set(views.map((v) => v.token));
4116
4130
  const docTokens = new Set(extras.filter((e) => e.kind === "document").map((e) => e.token));
@@ -4459,7 +4473,8 @@ function validateTemplate(raw, options = {}) {
4459
4473
  if (here >= 0 && Number.isFinite(firstWhen) && here < firstWhen && !TERMINAL_STAGE.test(st)) {
4460
4474
  for (const k of rule.filled ?? []) {
4461
4475
  if (!/^(?:datetime|date|checkbox|signature|attachment)$/.test(fieldOf(table, k)?.parityType ?? "")) continue;
4462
- if (filled(row.values?.[k])) say(at, `"${row.key}" is ${st}, but already has "${fieldOf(table, k)?.label ?? k}", which only a ${rule.when.join("/")} record carries. Leave it empty until the record gets there.`);
4476
+ const v = row.values?.[k];
4477
+ if (fieldOf(table, k)?.parityType === "checkbox" ? v === true || v === "true" : filled(v)) say(at, `"${row.key}" is ${st}, but already has "${fieldOf(table, k)?.label ?? k}", which only a ${rule.when.join("/")} record carries. Leave it empty until the record gets there.`);
4463
4478
  }
4464
4479
  }
4465
4480
  if (!rule.when.includes(st)) continue;
@@ -4797,6 +4812,7 @@ function validateTemplate(raw, options = {}) {
4797
4812
  }
4798
4813
  }
4799
4814
  adds += 1;
4815
+ for (const f of table.fields) if (f.default !== void 0 && !isComputed(f) && values[f.key] === void 0) values[f.key] = f.default;
4800
4816
  const added = { key: `walk-${i}-${ri}`, values };
4801
4817
  const landed = rules ? storeText(values[rules.stageField]) : null;
4802
4818
  for (const k of landed ? rules?.requires?.[landed] ?? [] : []) if (!filled(values[k])) say(`${at}.action.rows[${ri}]`, `The new row "${keyValue}" lands in "${landed}", which needs "${k}" filled; the store would refuse it.`);
@@ -5921,7 +5937,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
5921
5937
  if (bothDates && !datesStated) say(`${at}.childDates`, `"${t.token}" and its ${rel.label.toLowerCase()} ("${parent.token}") both carry dates; say how they agree, e.g. {"relation": "${rel.key}", "field": "<this table's date>", "parentField": "<${parent.token}'s date>"} or say why they are independent in independentOf {"${rel.key}": "<reason>"}.`);
5922
5938
  if (bothStatus && !statusStated) say(`${at}.statusAgrees`, `"${t.token}" and its ${rel.label.toLowerCase()} ("${parent.token}") both carry a status; say which child statuses need which parent status (statusAgrees), e.g. a Closed deal means a Sold listing.`);
5923
5939
  }
5924
- for (const f of t.fields.filter((x) => isNumber(x) && !isComputed(x) && /(^|_)(count|roster_size|size|number_of|enrolled|headcount|players|members)($|_)/.test(x.key))) {
5940
+ for (const f of t.fields.filter((x) => isNumber(x) && !isComputed(x) && /(^|_)(count|roster_size|team_size|class_size|number_of|enrolled|headcount|players|members)($|_)/.test(x.key))) {
5925
5941
  const linked = own.find((c) => c.fields.some((cf) => isRelation(cf) && cf.relationTarget === t.token));
5926
5942
  const declared = (t.countMatches ?? []).find((c) => c.field === f.key);
5927
5943
  const linkers = own.filter((c) => c.fields.some((cf) => isRelation(cf) && cf.relationTarget === t.token)).map((c) => c.labelPlural.toLowerCase());
@@ -5956,7 +5972,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
5956
5972
  const describeOwes = (p) => {
5957
5973
  const root = p.at.split(/[.\s[(]/)[0];
5958
5974
  if (GALLERY_ONLY_ROOTS.includes(root)) return false;
5959
- if (seedLooks.has(p)) return false;
5975
+ if (seedLooks.has(p) || galleryBar.has(p)) return false;
5960
5976
  if (/^tables\[\d+\] \([^)]*\)\.rows$/.test(p.at)) return false;
5961
5977
  return true;
5962
5978
  };