@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.js
CHANGED
|
@@ -4401,6 +4401,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4401
4401
|
}
|
|
4402
4402
|
}
|
|
4403
4403
|
const refWeek = [0, 1, 2, 3, 4, 5, 6].map((i) => shiftDays(TEMPLATE_REFERENCE_DATE, i));
|
|
4404
|
+
const KEY_PART = "";
|
|
4404
4405
|
const crossBreaks = () => {
|
|
4405
4406
|
const out = /* @__PURE__ */ new Map();
|
|
4406
4407
|
const live = (token) => (state.get(token) ?? []).filter((r) => !r.archived);
|
|
@@ -4446,7 +4447,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4446
4447
|
const linked = Array.isArray(ref2) ? ref2.includes(r.key) : ref2 === r.key;
|
|
4447
4448
|
return linked && (!need.field || (need.in ?? []).includes(storeText(c.values?.[need.field]) ?? ""));
|
|
4448
4449
|
});
|
|
4449
|
-
if (kids.length < (need.min ?? 1)) out.set(
|
|
4450
|
+
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}.`);
|
|
4450
4451
|
}
|
|
4451
4452
|
for (const f of t.fields.filter((x) => x.eligible)) {
|
|
4452
4453
|
const el = f.eligible;
|
|
@@ -4460,7 +4461,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4460
4461
|
if (!ok) {
|
|
4461
4462
|
const target = fieldOf(t.token, f.key)?.relationTarget ?? "";
|
|
4462
4463
|
const prow = live(target).find((x) => x.key === who);
|
|
4463
|
-
out.set(
|
|
4464
|
+
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.`);
|
|
4464
4465
|
}
|
|
4465
4466
|
}
|
|
4466
4467
|
}
|
|
@@ -4470,7 +4471,7 @@ function validateTemplate(raw, options = {}) {
|
|
|
4470
4471
|
};
|
|
4471
4472
|
const crossSeen = new Set(crossBreaks().keys());
|
|
4472
4473
|
for (const [k, msg] of crossBreaks()) {
|
|
4473
|
-
const [kind, table, row] = k.split(
|
|
4474
|
+
const [kind, table, row] = k.split(KEY_PART);
|
|
4474
4475
|
if (kind === "rc" || kind === "el") say(`tables (${table}).rows (${row})`, msg);
|
|
4475
4476
|
}
|
|
4476
4477
|
const moveOne = (a, at, rawSet) => {
|