@ai-matrx/records 0.96.4 → 0.96.5
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
|
@@ -3797,7 +3797,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
3797
3797
|
const keys = /* @__PURE__ */ new Set([...Object.keys(a.values ?? {}), ...Object.keys(b.values ?? {})]);
|
|
3798
3798
|
let differ = 0;
|
|
3799
3799
|
for (const k of keys) if (!sameJson(a.values?.[k] ?? null, b.values?.[k] ?? null)) differ += 1;
|
|
3800
|
-
if (differ < 3) say(`tables[0] (${main.token}).rows[${j}] (${b.key})`, `"${storeText(b.values?.[main.titleField])}" differs from "${storeText(a.values?.[main.titleField])}" in only ${differ} field(s); two real ${main.labelPlural.toLowerCase()} differ in at least three.`);
|
|
3800
|
+
if (differ < Math.min(3, keys.size)) say(`tables[0] (${main.token}).rows[${j}] (${b.key})`, `"${storeText(b.values?.[main.titleField])}" differs from "${storeText(a.values?.[main.titleField])}" in only ${differ} field(s); two real ${main.labelPlural.toLowerCase()} differ in at least three.`);
|
|
3801
3801
|
}
|
|
3802
3802
|
}
|
|
3803
3803
|
}
|
|
@@ -7512,17 +7512,18 @@ function describeCheck(spec, ctx = {}) {
|
|
|
7512
7512
|
for (let round = 0; round < 3; round++) {
|
|
7513
7513
|
const bad = rowProblemTables(fixed.spec, problems);
|
|
7514
7514
|
if (!bad.size) break;
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
}
|
|
7515
|
+
const unlinked = [];
|
|
7516
|
+
for (const t of fixed.spec.tables) {
|
|
7517
|
+
if (bad.has(t.token) || !t.rows?.length) continue;
|
|
7518
|
+
const links = t.fields.filter((f) => f.relationTarget && bad.has(f.relationTarget) && t.rows.some((r) => r.values?.[f.key] != null));
|
|
7519
|
+
if (!links.length) continue;
|
|
7520
|
+
for (const f of links) {
|
|
7521
|
+
for (const r of t.rows) if (r.values) delete r.values[f.key];
|
|
7522
|
+
f.required = false;
|
|
7524
7523
|
}
|
|
7524
|
+
unlinked.push(`tables.${t.token}.rows: kept without their ${links.map((f) => f.label || f.key).join(" / ")} link (the rows they pointed at were left out)`);
|
|
7525
7525
|
}
|
|
7526
|
+
fixed.autoFixes.push(...unlinked);
|
|
7526
7527
|
for (const t of fixed.spec.tables) {
|
|
7527
7528
|
if (!bad.has(t.token) || !t.rows?.length) continue;
|
|
7528
7529
|
const why = problems.find((p) => ROW_AT.exec(p.at)?.[1] === t.token)?.says ?? "they did not pass the check";
|