@ai-matrx/records 0.72.12 → 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 +12 -0
- package/dist/templates/index.cjs +15 -7
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.js +15 -7
- package/dist/templates/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 0.72.12
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/templates/index.cjs
CHANGED
|
@@ -3601,6 +3601,12 @@ 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/;
|
|
@@ -3923,7 +3929,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
3923
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.`);
|
|
3924
3930
|
}
|
|
3925
3931
|
});
|
|
3926
|
-
if (!hasLookupOrRollup)
|
|
3932
|
+
if (!hasLookupOrRollup) sayGallery("tables", "At least one relationship has to be read across: add a lookup or a rollup through a relation field.");
|
|
3927
3933
|
if (main) {
|
|
3928
3934
|
const normTitle = (v) => (storeText(v) ?? "").toLowerCase().replace(/\s+/g, " ").trim();
|
|
3929
3935
|
const rows = main.rows;
|
|
@@ -3991,8 +3997,8 @@ function validateTemplate(raw, options = {}) {
|
|
|
3991
3997
|
else surfaces.set(token, { at, ...table ? { table } : {} });
|
|
3992
3998
|
};
|
|
3993
3999
|
const views = spec.views ?? [];
|
|
3994
|
-
if (views.length < 3)
|
|
3995
|
-
if (!views.some((v) => v.kind === "grid"))
|
|
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.");
|
|
3996
4002
|
views.forEach((view, i) => {
|
|
3997
4003
|
const at = `views[${i}] (${view.token})`;
|
|
3998
4004
|
claim(view.token, at, view.table);
|
|
@@ -4118,7 +4124,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4118
4124
|
}
|
|
4119
4125
|
};
|
|
4120
4126
|
const extras = spec.extras ?? [];
|
|
4121
|
-
if (extras.length < 2)
|
|
4127
|
+
if (extras.length < 2) sayGallery("extras", `A template carries at least two extras; this one has ${extras.length}.`);
|
|
4122
4128
|
const formTokens = new Set(forms.map((f) => f.token));
|
|
4123
4129
|
const viewTokens = new Set(views.map((v) => v.token));
|
|
4124
4130
|
const docTokens = new Set(extras.filter((e) => e.kind === "document").map((e) => e.token));
|
|
@@ -4467,7 +4473,8 @@ function validateTemplate(raw, options = {}) {
|
|
|
4467
4473
|
if (here >= 0 && Number.isFinite(firstWhen) && here < firstWhen && !TERMINAL_STAGE.test(st)) {
|
|
4468
4474
|
for (const k of rule.filled ?? []) {
|
|
4469
4475
|
if (!/^(?:datetime|date|checkbox|signature|attachment)$/.test(fieldOf(table, k)?.parityType ?? "")) continue;
|
|
4470
|
-
|
|
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.`);
|
|
4471
4478
|
}
|
|
4472
4479
|
}
|
|
4473
4480
|
if (!rule.when.includes(st)) continue;
|
|
@@ -4805,6 +4812,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4805
4812
|
}
|
|
4806
4813
|
}
|
|
4807
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;
|
|
4808
4816
|
const added = { key: `walk-${i}-${ri}`, values };
|
|
4809
4817
|
const landed = rules ? storeText(values[rules.stageField]) : null;
|
|
4810
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.`);
|
|
@@ -5929,7 +5937,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
|
|
|
5929
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>"}.`);
|
|
5930
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.`);
|
|
5931
5939
|
}
|
|
5932
|
-
for (const f of t.fields.filter((x) => isNumber(x) && !isComputed(x) && /(^|_)(count|roster_size|
|
|
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))) {
|
|
5933
5941
|
const linked = own.find((c) => c.fields.some((cf) => isRelation(cf) && cf.relationTarget === t.token));
|
|
5934
5942
|
const declared = (t.countMatches ?? []).find((c) => c.field === f.key);
|
|
5935
5943
|
const linkers = own.filter((c) => c.fields.some((cf) => isRelation(cf) && cf.relationTarget === t.token)).map((c) => c.labelPlural.toLowerCase());
|
|
@@ -5964,7 +5972,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
|
|
|
5964
5972
|
const describeOwes = (p) => {
|
|
5965
5973
|
const root = p.at.split(/[.\s[(]/)[0];
|
|
5966
5974
|
if (GALLERY_ONLY_ROOTS.includes(root)) return false;
|
|
5967
|
-
if (seedLooks.has(p)) return false;
|
|
5975
|
+
if (seedLooks.has(p) || galleryBar.has(p)) return false;
|
|
5968
5976
|
if (/^tables\[\d+\] \([^)]*\)\.rows$/.test(p.at)) return false;
|
|
5969
5977
|
return true;
|
|
5970
5978
|
};
|