@ai-matrx/records 0.76.16 → 0.76.17
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.cjs
CHANGED
|
@@ -4565,6 +4565,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4565
4565
|
}
|
|
4566
4566
|
}
|
|
4567
4567
|
const refWeek = [0, 1, 2, 3, 4, 5, 6].map((i) => shiftDays(TEMPLATE_REFERENCE_DATE, i));
|
|
4568
|
+
const KEY_PART = "";
|
|
4568
4569
|
const crossBreaks = () => {
|
|
4569
4570
|
const out = /* @__PURE__ */ new Map();
|
|
4570
4571
|
const live = (token) => (state.get(token) ?? []).filter((r) => !r.archived);
|
|
@@ -4610,7 +4611,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4610
4611
|
const linked = Array.isArray(ref2) ? ref2.includes(r.key) : ref2 === r.key;
|
|
4611
4612
|
return linked && (!need.field || (need.in ?? []).includes(storeText(c.values?.[need.field]) ?? ""));
|
|
4612
4613
|
});
|
|
4613
|
-
if (kids.length < (need.min ?? 1)) out.set(
|
|
4614
|
+
if (kids.length < (need.min ?? 1)) out.set(["rc", t.token, r.key, st, kids.length].join(KEY_PART), `"${name(t.token, r)}" is ${st}, which needs ${need.min ?? 1} linked ${byToken.get(need.table)?.labelSingular.toLowerCase() ?? need.table}${need.field ? ` in ${(need.in ?? []).join("/")}` : ""}; it has ${kids.length}.`);
|
|
4614
4615
|
}
|
|
4615
4616
|
for (const f of t.fields.filter((x) => x.eligible)) {
|
|
4616
4617
|
const el = f.eligible;
|
|
@@ -4624,7 +4625,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4624
4625
|
if (!ok) {
|
|
4625
4626
|
const target = fieldOf(t.token, f.key)?.relationTarget ?? "";
|
|
4626
4627
|
const prow = live(target).find((x) => x.key === who);
|
|
4627
|
-
out.set(
|
|
4628
|
+
out.set(["el", t.token, r.key, f.key, String(who), on].join(KEY_PART), `"${name(t.token, r)}" (${on}) has ${f.label.toLowerCase()} "${prow ? name(target, prow) : String(who)}", who holds no ${byToken.get(el.table)?.labelSingular.toLowerCase() ?? el.table}${el.where ? ` (${Object.values(el.where).join(", ")})` : ""} valid on that day.`);
|
|
4628
4629
|
}
|
|
4629
4630
|
}
|
|
4630
4631
|
}
|
|
@@ -4634,7 +4635,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4634
4635
|
};
|
|
4635
4636
|
const crossSeen = new Set(crossBreaks().keys());
|
|
4636
4637
|
for (const [k, msg] of crossBreaks()) {
|
|
4637
|
-
const [kind, table, row] = k.split(
|
|
4638
|
+
const [kind, table, row] = k.split(KEY_PART);
|
|
4638
4639
|
if (kind === "rc" || kind === "el") say(`tables (${table}).rows (${row})`, msg);
|
|
4639
4640
|
}
|
|
4640
4641
|
const moveOne = (a, at, rawSet) => {
|