@ai-matrx/records 0.81.3 → 0.82.1
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 +23 -0
- package/dist/app-table/index.cjs +1 -1
- package/dist/app-table/index.cjs.map +1 -1
- package/dist/app-table/index.js +1 -1
- package/dist/app-table/index.js.map +1 -1
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +1 -1
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.js +1 -1
- package/dist/data/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/templates/index.cjs +542 -5
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.js +542 -5
- package/dist/templates/index.js.map +1 -1
- package/package.json +4 -4
package/dist/templates/index.cjs
CHANGED
|
@@ -2087,7 +2087,7 @@ function validateUseCase(useCase) {
|
|
|
2087
2087
|
`${primary.rows.length} rows makes the screen look empty. Seed at least ${MIN_ROWS_IN_PRIMARY_TABLE} \u2014 dozens is better.`
|
|
2088
2088
|
);
|
|
2089
2089
|
}
|
|
2090
|
-
const resolveField = (tableToken,
|
|
2090
|
+
const resolveField = (tableToken, fieldKey2) => tablesByToken.get(tableToken)?.fields.find((f) => f.key === fieldKey2);
|
|
2091
2091
|
useCase.relationships?.forEach((rel, i) => {
|
|
2092
2092
|
const at = `relationships[${i}]`;
|
|
2093
2093
|
if (!tablesByToken.has(rel.fromTable)) {
|
|
@@ -4566,8 +4566,8 @@ function validateTemplate(raw, options = {}) {
|
|
|
4566
4566
|
for (const k of rule.filled ?? []) if (!filled(val(k))) say(at, `"${row.key}" is ${st}, so "${fieldOf(table, k)?.label ?? k}" is filled; it is empty.`);
|
|
4567
4567
|
for (const [k, v] of Object.entries(rule.equals ?? {})) {
|
|
4568
4568
|
const got = val(k) ?? null;
|
|
4569
|
-
const
|
|
4570
|
-
if (!
|
|
4569
|
+
const same4 = sameJson(got, v) || typeof v === "number" && parseNumeric(storeText(got) ?? "") !== null && qCmp(parseNumeric(storeText(got) ?? ""), parseNumeric(String(v))) === 0;
|
|
4570
|
+
if (!same4) say(at, `"${row.key}" is ${st}, so "${fieldOf(table, k)?.label ?? k}" is ${JSON.stringify(v)}; it is ${JSON.stringify(got)}.`);
|
|
4571
4571
|
}
|
|
4572
4572
|
}
|
|
4573
4573
|
};
|
|
@@ -5905,7 +5905,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
|
|
|
5905
5905
|
}
|
|
5906
5906
|
}
|
|
5907
5907
|
const rows = t.rows;
|
|
5908
|
-
const
|
|
5908
|
+
const same4 = (x, y) => {
|
|
5909
5909
|
const a = storeText(x);
|
|
5910
5910
|
const b = storeText(y);
|
|
5911
5911
|
if (a === null || b === null) return false;
|
|
@@ -5923,7 +5923,7 @@ ${e.body}`.matchAll(MERGE_TOKEN)].map((m) => m[1]));
|
|
|
5923
5923
|
};
|
|
5924
5924
|
for (const sf of t.fields.filter((ff) => !isComputed(ff) && !isRelation(ff) && ff.key !== l.key)) {
|
|
5925
5925
|
const have = rows.filter((r) => filled(r.values?.[sf.key]));
|
|
5926
|
-
if (have.length >= 3 && have.every((r) =>
|
|
5926
|
+
if (have.length >= 3 && have.every((r) => same4(r.values?.[sf.key], far(r)))) {
|
|
5927
5927
|
say(`tables (${t.token}).fields (${sf.key})`, `"${sf.label}" repeats "${l.label}" on every row; drop it and use the lookup, which follows the linked record.`);
|
|
5928
5928
|
}
|
|
5929
5929
|
}
|
|
@@ -6819,6 +6819,502 @@ function mergeDescribeParts(plan, tables, doors, views, existingTables = [], not
|
|
|
6819
6819
|
return spec;
|
|
6820
6820
|
}
|
|
6821
6821
|
|
|
6822
|
+
// src/templates/describe/computed-shape.ts
|
|
6823
|
+
var VIA_KEYS = ["via", "relation", "relationField", "relation_field", "relationKey", "through", "rollupVia", "lookupVia", "rollupRelation", "lookupRelation", "rollupThrough", "lookupThrough", "from", "link", "linkField"];
|
|
6824
|
+
var PICK_KEYS = ["pick", "field", "targetField", "target_field", "fieldKey", "rollupField", "lookupField", "rollupTarget", "lookupTarget", "target", "of", "column", "sourceField", "source"];
|
|
6825
|
+
var AGG_KEYS = ["agg", "fn", "func", "function", "operation", "aggregation", "aggregate", "op", "aggregator", "calculation", "rollupFn", "rollupFunction", "rollupAgg", "rollupAggregate", "rollupAggregation", "rollupOperation", "rollupOp"];
|
|
6826
|
+
var AGG_WORDS = {
|
|
6827
|
+
sum: "sum",
|
|
6828
|
+
total: "sum",
|
|
6829
|
+
add: "sum",
|
|
6830
|
+
sumof: "sum",
|
|
6831
|
+
summation: "sum",
|
|
6832
|
+
count: "count",
|
|
6833
|
+
countall: "count",
|
|
6834
|
+
countrows: "count",
|
|
6835
|
+
number: "count",
|
|
6836
|
+
numberof: "count",
|
|
6837
|
+
n: "count",
|
|
6838
|
+
tally: "count",
|
|
6839
|
+
avg: "avg",
|
|
6840
|
+
average: "avg",
|
|
6841
|
+
mean: "avg",
|
|
6842
|
+
min: "min",
|
|
6843
|
+
minimum: "min",
|
|
6844
|
+
lowest: "min",
|
|
6845
|
+
smallest: "min",
|
|
6846
|
+
earliest: "min",
|
|
6847
|
+
max: "max",
|
|
6848
|
+
maximum: "max",
|
|
6849
|
+
highest: "max",
|
|
6850
|
+
largest: "max",
|
|
6851
|
+
latest: "max",
|
|
6852
|
+
median: "median",
|
|
6853
|
+
filled: "filled",
|
|
6854
|
+
countfilled: "filled",
|
|
6855
|
+
empty: "empty",
|
|
6856
|
+
countempty: "empty",
|
|
6857
|
+
unique: "unique",
|
|
6858
|
+
distinct: "unique",
|
|
6859
|
+
countunique: "unique",
|
|
6860
|
+
countdistinct: "unique"
|
|
6861
|
+
};
|
|
6862
|
+
var squash = (s) => String(s ?? "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
6863
|
+
var singular = (s) => s.replace(/ies$/, "y").replace(/s$/, "");
|
|
6864
|
+
var same2 = (a, b) => squash(a) === squash(b) || singular(squash(a)) === singular(squash(b));
|
|
6865
|
+
function aggWord(v) {
|
|
6866
|
+
return typeof v === "string" ? AGG_WORDS[squash(v)] : void 0;
|
|
6867
|
+
}
|
|
6868
|
+
function take(f, nested, keys) {
|
|
6869
|
+
for (const k of keys) if (nested && nested[k] !== void 0 && nested[k] !== null && nested[k] !== "") return { value: nested[k], key: k, from: "nested" };
|
|
6870
|
+
for (const k of keys) if (f[k] !== void 0 && f[k] !== null && f[k] !== "") return { value: f[k], key: k, from: "field" };
|
|
6871
|
+
return void 0;
|
|
6872
|
+
}
|
|
6873
|
+
function normalizeComputedFields(spec, fixes) {
|
|
6874
|
+
const every = allTables(spec);
|
|
6875
|
+
const byToken = new Map(every.map((t) => [t.token, t]));
|
|
6876
|
+
for (const t of spec.tables) {
|
|
6877
|
+
for (const f of t.fields) {
|
|
6878
|
+
const raw = f;
|
|
6879
|
+
const nestedKind = ["rollup", "lookup"].find((k) => raw[k] && typeof raw[k] === "object");
|
|
6880
|
+
const kind = f.parityType === "rollup" || f.parityType === "lookup" ? f.parityType : !f.parityType && nestedKind ? nestedKind : void 0;
|
|
6881
|
+
if (!kind) continue;
|
|
6882
|
+
const nested = nestedKind ? raw[nestedKind] : void 0;
|
|
6883
|
+
const at = `tables.${t.token}.fields.${f.key}`;
|
|
6884
|
+
const consumed = [];
|
|
6885
|
+
let changed = false;
|
|
6886
|
+
const hasVia = typeof f.via === "string" && t.fields.some((x) => x.key === f.via);
|
|
6887
|
+
let via = hasVia ? t.fields.find((x) => x.key === f.via) : void 0;
|
|
6888
|
+
if (!via) {
|
|
6889
|
+
const got = take(raw, nested, VIA_KEYS);
|
|
6890
|
+
if (got && typeof got.value === "string") {
|
|
6891
|
+
const rels = t.fields.filter((x) => x.parityType === "relation" && x.relationTarget && x.key !== f.key);
|
|
6892
|
+
const hits = [
|
|
6893
|
+
rels.filter((x) => x.key === got.value),
|
|
6894
|
+
rels.filter((x) => same2(x.key, got.value)),
|
|
6895
|
+
rels.filter((x) => same2(x.label, got.value)),
|
|
6896
|
+
rels.filter((x) => same2(x.relationTarget, got.value))
|
|
6897
|
+
].find((h) => h.length === 1);
|
|
6898
|
+
if (hits) {
|
|
6899
|
+
via = hits[0];
|
|
6900
|
+
f.via = via.key;
|
|
6901
|
+
consumed.push([got.from, got.key]);
|
|
6902
|
+
changed = true;
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
if (!via || !via.relationTarget) {
|
|
6907
|
+
if (changed) fixes.push(`${at}: ${kind} written as ${nestedKind ? `{${nestedKind}:\u2026}` : "loose keys"}, read into via/pick${kind === "rollup" ? "/agg" : ""} where unambiguous`);
|
|
6908
|
+
continue;
|
|
6909
|
+
}
|
|
6910
|
+
const far = byToken.get(via.relationTarget);
|
|
6911
|
+
if (kind === "rollup" && !f.agg) {
|
|
6912
|
+
const got = take(raw, nested, AGG_KEYS);
|
|
6913
|
+
const word = got ? aggWord(got.value) : void 0;
|
|
6914
|
+
if (got && word) {
|
|
6915
|
+
f.agg = word;
|
|
6916
|
+
consumed.push([got.from, got.key]);
|
|
6917
|
+
changed = true;
|
|
6918
|
+
}
|
|
6919
|
+
}
|
|
6920
|
+
if (!f.pick || !far?.fields.some((x) => x.key === f.pick)) {
|
|
6921
|
+
const got = take(raw, nested, PICK_KEYS);
|
|
6922
|
+
const named = got && typeof got.value === "string" ? got.value : void 0;
|
|
6923
|
+
const farField = named ? far?.fields.find((x) => x.key === named) ?? far?.fields.find((x) => same2(x.key, named)) ?? far?.fields.find((x) => same2(x.label, named)) : void 0;
|
|
6924
|
+
if (farField) {
|
|
6925
|
+
f.pick = farField.key;
|
|
6926
|
+
if (got) consumed.push([got.from, got.key]);
|
|
6927
|
+
changed = true;
|
|
6928
|
+
} else if (kind === "rollup" && (f.agg === "count" || !f.agg && !named) && far) {
|
|
6929
|
+
const title = far.titleField;
|
|
6930
|
+
const stand = far.fields.find((x) => x.key === title) ?? far.fields.find((x) => !["relation", "formula", "lookup", "rollup", "autonumber"].includes(x.parityType));
|
|
6931
|
+
if (stand) {
|
|
6932
|
+
f.pick = stand.key;
|
|
6933
|
+
if (got) consumed.push([got.from, got.key]);
|
|
6934
|
+
changed = true;
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
}
|
|
6938
|
+
if (kind === "rollup" && changed && via && !via.multi && (via.relationMax ?? 1) <= 1) {
|
|
6939
|
+
via.multi = true;
|
|
6940
|
+
delete via.relationMax;
|
|
6941
|
+
for (const r of spec.relationships ?? []) if (r.fromTable === t.token && r.fromField === via.key) r.cardinality = "many";
|
|
6942
|
+
fixes.push(`${at}.via: "${via.key}" made a list (a rollup adds up many linked records)`);
|
|
6943
|
+
}
|
|
6944
|
+
if (!changed) continue;
|
|
6945
|
+
f.parityType = kind;
|
|
6946
|
+
if (kind === "lookup") delete raw["agg"];
|
|
6947
|
+
for (const [from, k] of consumed) if (from === "field") delete raw[k];
|
|
6948
|
+
if (nestedKind) delete raw[nestedKind];
|
|
6949
|
+
fixes.push(`${at}: ${kind} written in a shape the check does not read, rewritten as via "${f.via}", pick "${f.pick ?? "(none)"}"${kind === "rollup" ? `, agg "${f.agg ?? "(none)"}"` : ""}`);
|
|
6950
|
+
}
|
|
6951
|
+
}
|
|
6952
|
+
}
|
|
6953
|
+
|
|
6954
|
+
// src/templates/describe/mechanical-shapes.ts
|
|
6955
|
+
var squash2 = (s) => String(s ?? "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
6956
|
+
var singular2 = (s) => s.replace(/ies$/, "y").replace(/s$/, "");
|
|
6957
|
+
var same3 = (a, b) => squash2(a) !== "" && (squash2(a) === squash2(b) || singular2(squash2(a)) === singular2(squash2(b)));
|
|
6958
|
+
var tableOf = (spec, token) => allTables(spec).find((t) => t.token === token);
|
|
6959
|
+
function fieldKey(t, name) {
|
|
6960
|
+
if (!t || typeof name !== "string") return void 0;
|
|
6961
|
+
return t.fields.find((f) => f.key === name)?.key ?? t.fields.find((f) => same3(f.key, name))?.key ?? t.fields.find((f) => same3(f.label, name))?.key;
|
|
6962
|
+
}
|
|
6963
|
+
var VIEW_ALIASES = {
|
|
6964
|
+
groupBy: ["group_by", "groupby", "groupField", "group_field", "columnField", "column_field"],
|
|
6965
|
+
dateField: ["date_field", "datefield", "dateColumn", "date_column", "calendarField"],
|
|
6966
|
+
startField: ["start_field", "startDate", "start_date", "start"],
|
|
6967
|
+
endField: ["end_field", "endDate", "end_date", "end"],
|
|
6968
|
+
coverField: ["cover_field", "coverImage", "cover_image", "imageField", "image_field", "photoField", "photo_field"],
|
|
6969
|
+
swimlaneBy: ["swimlane_by", "swimlaneField", "swimlane_field", "lanes"]
|
|
6970
|
+
};
|
|
6971
|
+
var EQ_OPS = /* @__PURE__ */ new Set(["eq", "is", "equals", "equal", "=", "==", "===", "equal_to", "is_equal"]);
|
|
6972
|
+
var NEQ_OPS = /* @__PURE__ */ new Set(["neq", "ne", "is_not", "isnot", "not_equal", "!=", "<>", "not_equals", "not_in", "nin", "not_any_of"]);
|
|
6973
|
+
var IN_OPS = /* @__PURE__ */ new Set(["in", "is_any_of", "any_of", "one_of", "in_list", "is_one_of"]);
|
|
6974
|
+
var EMPTY_OPS = /* @__PURE__ */ new Set(["is_empty", "empty", "is_null", "null", "unset", "is_blank", "blank", "is_unset"]);
|
|
6975
|
+
function sortDirection(v) {
|
|
6976
|
+
const s = String(v ?? "").toLowerCase().replace(/[^a-z]/g, "");
|
|
6977
|
+
if (["asc", "ascending", "up", "az", "oldest", "lowest", "first"].includes(s)) return "asc";
|
|
6978
|
+
if (["desc", "descending", "down", "za", "newest", "highest", "last"].includes(s)) return "desc";
|
|
6979
|
+
return void 0;
|
|
6980
|
+
}
|
|
6981
|
+
function fixViewShapes(spec, fixes) {
|
|
6982
|
+
for (const view of spec.views ?? []) {
|
|
6983
|
+
const t = tableOf(spec, view.table);
|
|
6984
|
+
const at = `views.${view.token}`;
|
|
6985
|
+
for (const [canon, alts] of Object.entries(VIEW_ALIASES)) {
|
|
6986
|
+
if (view[canon] == null) {
|
|
6987
|
+
const alt = alts.find((a) => view[a] != null && typeof view[a] === "string");
|
|
6988
|
+
if (alt) {
|
|
6989
|
+
view[canon] = view[alt];
|
|
6990
|
+
delete view[alt];
|
|
6991
|
+
fixes.push(`${at}.${canon}: written as "${alt}"`);
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6994
|
+
if (typeof view[canon] === "string") {
|
|
6995
|
+
const k = fieldKey(t, view[canon]);
|
|
6996
|
+
if (k && k !== view[canon]) {
|
|
6997
|
+
fixes.push(`${at}.${canon}: "${view[canon]}" is the field "${k}"`);
|
|
6998
|
+
view[canon] = k;
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
const rawSorts = view.sorts ?? view.sort ?? view.orderBy ?? view.order_by;
|
|
7003
|
+
if (rawSorts !== void 0) {
|
|
7004
|
+
const list = Array.isArray(rawSorts) ? rawSorts : typeof rawSorts === "string" ? rawSorts.split(",") : rawSorts && typeof rawSorts === "object" ? [rawSorts] : [];
|
|
7005
|
+
const out = [];
|
|
7006
|
+
for (const s of list) {
|
|
7007
|
+
let name, dir;
|
|
7008
|
+
if (typeof s === "string") {
|
|
7009
|
+
const m = /^\s*(-?)\s*([^\s]+)(?:\s+(asc|desc|ascending|descending))?\s*$/i.exec(s);
|
|
7010
|
+
if (m) {
|
|
7011
|
+
name = m[2];
|
|
7012
|
+
dir = m[3] ?? (m[1] ? "desc" : "asc");
|
|
7013
|
+
}
|
|
7014
|
+
} else if (s && typeof s === "object") {
|
|
7015
|
+
name = s.field ?? s.key ?? s.column ?? s.by ?? s.name;
|
|
7016
|
+
dir = s.direction ?? s.dir ?? s.order ?? s.sort ?? "asc";
|
|
7017
|
+
}
|
|
7018
|
+
const key = fieldKey(t, name) ?? (typeof name === "string" ? name : void 0);
|
|
7019
|
+
const d = sortDirection(dir);
|
|
7020
|
+
if (key && d) out.push({ field: key, direction: d });
|
|
7021
|
+
}
|
|
7022
|
+
const changed = JSON.stringify(rawSorts) !== JSON.stringify(out) || view.sort !== void 0 || view.orderBy !== void 0 || view.order_by !== void 0;
|
|
7023
|
+
delete view.sort;
|
|
7024
|
+
delete view.orderBy;
|
|
7025
|
+
delete view.order_by;
|
|
7026
|
+
if (out.length) view.sorts = out;
|
|
7027
|
+
else delete view.sorts;
|
|
7028
|
+
if (changed) fixes.push(`${at}.sorts: written in the store's shape [{field, direction}]`);
|
|
7029
|
+
}
|
|
7030
|
+
if (Array.isArray(view.filters)) {
|
|
7031
|
+
const filters = {};
|
|
7032
|
+
const anyOf = { ...view.anyOf ?? {} };
|
|
7033
|
+
const dropped = [];
|
|
7034
|
+
for (const c of view.filters) {
|
|
7035
|
+
if (!c || typeof c !== "object") continue;
|
|
7036
|
+
const name = c.field ?? c.key ?? c.column ?? c.name;
|
|
7037
|
+
const key = fieldKey(t, name) ?? (typeof name === "string" ? name : void 0);
|
|
7038
|
+
if (!key) continue;
|
|
7039
|
+
const f = t?.fields.find((x) => x.key === key);
|
|
7040
|
+
const op = String(c.op ?? c.operator ?? c.comparison ?? "eq").toLowerCase().trim().replace(/[\s-]+/g, "_");
|
|
7041
|
+
const has = "value" in c || "values" in c;
|
|
7042
|
+
const val = "value" in c ? c.value : c.values;
|
|
7043
|
+
const setEq = (v) => {
|
|
7044
|
+
if (key in filters || key in anyOf) dropped.push(`${key} (two conditions on one field)`);
|
|
7045
|
+
else filters[key] = v;
|
|
7046
|
+
};
|
|
7047
|
+
const setAny = (vals) => {
|
|
7048
|
+
if (key in filters || key in anyOf) dropped.push(`${key} (two conditions on one field)`);
|
|
7049
|
+
else if (vals.length === 1) filters[key] = vals[0];
|
|
7050
|
+
else anyOf[key] = vals;
|
|
7051
|
+
};
|
|
7052
|
+
const universe = f?.parityType === "checkbox" ? [true, false] : f?.choices?.length ? [...f.choices] : void 0;
|
|
7053
|
+
if (EMPTY_OPS.has(op)) setEq(null);
|
|
7054
|
+
else if (EQ_OPS.has(op) && has && !Array.isArray(val)) setEq(val);
|
|
7055
|
+
else if ((IN_OPS.has(op) || EQ_OPS.has(op)) && Array.isArray(val) && val.length) setAny(val);
|
|
7056
|
+
else if (NEQ_OPS.has(op) && has && universe) {
|
|
7057
|
+
const gone = new Set(Array.isArray(val) ? val : [val]);
|
|
7058
|
+
const left = universe.filter((x) => !gone.has(x));
|
|
7059
|
+
if (left.length) setAny(left);
|
|
7060
|
+
else dropped.push(`${key} ${op}`);
|
|
7061
|
+
} else dropped.push(`${key} ${op}`);
|
|
7062
|
+
}
|
|
7063
|
+
view.filters = filters;
|
|
7064
|
+
if (Object.keys(anyOf).length) view.anyOf = anyOf;
|
|
7065
|
+
fixes.push(`${at}.filters: an array of conditions written as the store's map (field \u2192 value; several values \u2192 anyOf)${dropped.length ? `; not expressible and dropped, so the view shows more rows than asked: ${dropped.join(", ")}` : ""}`);
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
function dropDuplicateViews(spec, fixes) {
|
|
7070
|
+
const seen = /* @__PURE__ */ new Map();
|
|
7071
|
+
const kept = [];
|
|
7072
|
+
for (const v of spec.views ?? []) {
|
|
7073
|
+
const { token: _t, name: _n, isDefault: _d, ...shape } = v;
|
|
7074
|
+
const sig = JSON.stringify(Object.keys(shape).sort().map((k) => [k, shape[k]]));
|
|
7075
|
+
const twin = seen.get(sig);
|
|
7076
|
+
if (!twin) {
|
|
7077
|
+
seen.set(sig, v);
|
|
7078
|
+
kept.push(v);
|
|
7079
|
+
continue;
|
|
7080
|
+
}
|
|
7081
|
+
if (v.isDefault) twin.isDefault = true;
|
|
7082
|
+
fixes.push(`views.${v.token}: "${v.name}" showed exactly what "${twin.name}" shows; dropped`);
|
|
7083
|
+
}
|
|
7084
|
+
if (kept.length !== (spec.views ?? []).length) spec.views = kept;
|
|
7085
|
+
}
|
|
7086
|
+
var KIND_KEYS = ["kind", "type", "fieldType", "field_type", "dataType", "data_type", "parity_type"];
|
|
7087
|
+
var KIND_SYNONYMS = {
|
|
7088
|
+
string: "text",
|
|
7089
|
+
shorttext: "text",
|
|
7090
|
+
singlelinetext: "text",
|
|
7091
|
+
varchar: "text",
|
|
7092
|
+
longtext: "long_text",
|
|
7093
|
+
textarea: "long_text",
|
|
7094
|
+
paragraph: "long_text",
|
|
7095
|
+
multiline: "long_text",
|
|
7096
|
+
richtext: "long_text",
|
|
7097
|
+
integer: "number",
|
|
7098
|
+
int: "number",
|
|
7099
|
+
decimal: "number",
|
|
7100
|
+
float: "number",
|
|
7101
|
+
numeric: "number",
|
|
7102
|
+
money: "currency",
|
|
7103
|
+
price: "currency",
|
|
7104
|
+
amount: "currency",
|
|
7105
|
+
boolean: "checkbox",
|
|
7106
|
+
bool: "checkbox",
|
|
7107
|
+
tick: "checkbox",
|
|
7108
|
+
yesno: "checkbox",
|
|
7109
|
+
date: "datetime",
|
|
7110
|
+
timestamp: "datetime",
|
|
7111
|
+
datetime: "datetime",
|
|
7112
|
+
time: "datetime",
|
|
7113
|
+
dropdown: "select",
|
|
7114
|
+
enum: "select",
|
|
7115
|
+
choice: "select",
|
|
7116
|
+
singleselect: "select",
|
|
7117
|
+
multiselect: "multi_select",
|
|
7118
|
+
tags: "multi_select",
|
|
7119
|
+
tel: "phone",
|
|
7120
|
+
telephone: "phone",
|
|
7121
|
+
mobile: "phone",
|
|
7122
|
+
mail: "email",
|
|
7123
|
+
emailaddress: "email",
|
|
7124
|
+
website: "url",
|
|
7125
|
+
link: "url",
|
|
7126
|
+
uri: "url"
|
|
7127
|
+
};
|
|
7128
|
+
function inferKind(label, key) {
|
|
7129
|
+
const s = `${key.replace(/_/g, " ")} ${label}`.toLowerCase();
|
|
7130
|
+
if (/\be-?mail\b/.test(s)) return "email";
|
|
7131
|
+
if (/\b(phone|mobile|cell|telephone|fax)\b/.test(s)) return "phone";
|
|
7132
|
+
if (/\b(url|website|web site|link)\b/.test(s)) return "url";
|
|
7133
|
+
if (/\b(amount|fee|price|cost|total|balance|budget|salary|wage|deposit|revenue|payment)\b/.test(s)) return "currency";
|
|
7134
|
+
if (/\b(date|when|due|deadline|birthday|dob|start|end|time|at)\b/.test(s) || /_(on|at)$/.test(key)) return "datetime";
|
|
7135
|
+
if (/\b(notes?|description|details|comments?|summary|instructions)\b/.test(s)) return "long_text";
|
|
7136
|
+
if (/\b(count|quantity|qty|hours|score|age|number of|size|weight|rating)\b/.test(s)) return "number";
|
|
7137
|
+
if (/\b(name|title|owner|label|code|id|reference)\b/.test(s)) return "text";
|
|
7138
|
+
return void 0;
|
|
7139
|
+
}
|
|
7140
|
+
var wordOf = (v) => {
|
|
7141
|
+
if (typeof v !== "string") return void 0;
|
|
7142
|
+
if (RESOLVABLE_FIELD_TYPE_WORDS.includes(v)) return v;
|
|
7143
|
+
const syn = KIND_SYNONYMS[squash2(v)];
|
|
7144
|
+
return syn && RESOLVABLE_FIELD_TYPE_WORDS.includes(syn) ? syn : void 0;
|
|
7145
|
+
};
|
|
7146
|
+
function fixFieldKinds(spec, fixes) {
|
|
7147
|
+
for (const t of spec.tables) {
|
|
7148
|
+
for (const f of t.fields) {
|
|
7149
|
+
const raw = f;
|
|
7150
|
+
if (typeof raw.parityType === "string" && RESOLVABLE_FIELD_TYPE_WORDS.includes(raw.parityType)) continue;
|
|
7151
|
+
const at = `tables.${t.token}.fields.${f.key}`;
|
|
7152
|
+
const alias = KIND_KEYS.find((k) => raw[k] != null && typeof raw[k] === "string");
|
|
7153
|
+
let kind = wordOf(raw.parityType) ?? (alias ? wordOf(raw[alias]) : void 0);
|
|
7154
|
+
let how = alias ? `its "${alias}" says "${raw[alias]}"` : raw.parityType ? `"${raw.parityType}" is not a type word` : "it names no type";
|
|
7155
|
+
if (!kind && !alias && !raw.parityType) {
|
|
7156
|
+
kind = inferKind(String(f.label ?? ""), String(f.key ?? ""));
|
|
7157
|
+
how = `it names no type; "${f.label}" plainly is one`;
|
|
7158
|
+
}
|
|
7159
|
+
if (!kind) continue;
|
|
7160
|
+
for (const k of KIND_KEYS) if (k !== "parityType" && raw[k] === raw[alias ?? ""] && alias) delete raw[k];
|
|
7161
|
+
f.parityType = kind;
|
|
7162
|
+
if ((kind === "phone" || kind === "email") && !raw.format) raw.format = kind;
|
|
7163
|
+
fixes.push(`${at}: type ${kind} (${how})`);
|
|
7164
|
+
}
|
|
7165
|
+
}
|
|
7166
|
+
}
|
|
7167
|
+
function fixFormulaRefs(spec, fixes) {
|
|
7168
|
+
for (const t of spec.tables) {
|
|
7169
|
+
for (const f of t.fields) {
|
|
7170
|
+
if (f.parityType !== "formula" || typeof f.formula !== "string") continue;
|
|
7171
|
+
const others = t.fields.filter((x) => x.key !== f.key);
|
|
7172
|
+
const labelFor = (name) => others.find((x) => x.label === name)?.label ?? others.find((x) => x.key === name)?.label ?? others.find((x) => same3(x.key, name))?.label ?? others.find((x) => same3(x.label, name))?.label;
|
|
7173
|
+
const text = f.formula.replace(/^\s*=\s*/, "");
|
|
7174
|
+
let out = "";
|
|
7175
|
+
let i = 0;
|
|
7176
|
+
while (i < text.length) {
|
|
7177
|
+
const c = text[i];
|
|
7178
|
+
if (c === "{") {
|
|
7179
|
+
const j = text.indexOf("}", i);
|
|
7180
|
+
if (j < 0) {
|
|
7181
|
+
out += text.slice(i);
|
|
7182
|
+
break;
|
|
7183
|
+
}
|
|
7184
|
+
const name = text.slice(i + 1, j).trim();
|
|
7185
|
+
out += `{${labelFor(name) ?? name}}`;
|
|
7186
|
+
i = j + 1;
|
|
7187
|
+
} else if (c === "'" || c === '"') {
|
|
7188
|
+
const j = text.indexOf(c, i + 1);
|
|
7189
|
+
if (j < 0) {
|
|
7190
|
+
out += text.slice(i);
|
|
7191
|
+
break;
|
|
7192
|
+
}
|
|
7193
|
+
out += text.slice(i, j + 1);
|
|
7194
|
+
i = j + 1;
|
|
7195
|
+
} else if (/[A-Za-z_]/.test(c)) {
|
|
7196
|
+
const m = /^[A-Za-z_][A-Za-z_0-9]*/.exec(text.slice(i))[0];
|
|
7197
|
+
const after = text.slice(i + m.length).trimStart()[0];
|
|
7198
|
+
const label = after === "(" ? void 0 : labelFor(m);
|
|
7199
|
+
out += label ? `{${label}}` : m;
|
|
7200
|
+
i += m.length;
|
|
7201
|
+
} else {
|
|
7202
|
+
out += c;
|
|
7203
|
+
i += 1;
|
|
7204
|
+
}
|
|
7205
|
+
}
|
|
7206
|
+
if (out !== f.formula) {
|
|
7207
|
+
fixes.push(`tables.${t.token}.fields.${f.key}.formula: fields named by label in braces ("${f.formula}" \u2192 "${out}")`);
|
|
7208
|
+
f.formula = out;
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
function fixInverseKeys(spec, fixes) {
|
|
7214
|
+
const rels = spec.relationships ?? [];
|
|
7215
|
+
const taken = /* @__PURE__ */ new Set();
|
|
7216
|
+
for (const t of allTables(spec)) for (const f of t.fields) taken.add(`${t.token}.${f.key}`);
|
|
7217
|
+
for (const r of rels) if (r.inverseKey) taken.add(`${r.toTable}.${r.inverseKey}`);
|
|
7218
|
+
for (const r of rels) {
|
|
7219
|
+
if (!r.inverseKey) continue;
|
|
7220
|
+
const target = tableOf(spec, r.toTable);
|
|
7221
|
+
if (!target?.fields.some((f) => f.key === r.inverseKey)) continue;
|
|
7222
|
+
let k = `${r.fromTable}_${r.fromField}_back`;
|
|
7223
|
+
for (let n = 2; taken.has(`${r.toTable}.${k}`); n++) k = `${r.fromTable}_${r.fromField}_back_${n}`;
|
|
7224
|
+
fixes.push(`relationships: ${r.fromTable}.${r.fromField} \u2192 ${r.toTable}: inverseKey "${r.inverseKey}" is already a field of ${r.toTable}; renamed "${k}"`);
|
|
7225
|
+
taken.add(`${r.toTable}.${k}`);
|
|
7226
|
+
r.inverseKey = k;
|
|
7227
|
+
}
|
|
7228
|
+
}
|
|
7229
|
+
var STATUS_WORDS = /\b(open|booked|upcoming|unpaid|outstanding|active|ordered|pending|overdue|scheduled|confirmed|paid|completed|current|remaining)\b/i;
|
|
7230
|
+
function fixRollupFilters(spec, fixes) {
|
|
7231
|
+
for (const t of spec.tables) {
|
|
7232
|
+
for (const f of t.fields) {
|
|
7233
|
+
if (f.parityType !== "rollup" || f.filter && Object.keys(f.filter).length || !f.via) continue;
|
|
7234
|
+
const hit = STATUS_WORDS.exec(`${f.label} ${f.key.replace(/_/g, " ")}`);
|
|
7235
|
+
const via = t.fields.find((x) => x.key === f.via);
|
|
7236
|
+
const far = via?.relationTarget ? tableOf(spec, via.relationTarget) : void 0;
|
|
7237
|
+
if (!hit || !far) continue;
|
|
7238
|
+
const word = hit[1].toLowerCase();
|
|
7239
|
+
const cands = [];
|
|
7240
|
+
for (const x of far.fields) {
|
|
7241
|
+
if (["select", "multi_select"].includes(x.parityType)) {
|
|
7242
|
+
for (const c of x.choices ?? []) if (c.toLowerCase() === word) cands.push({ key: x.key, value: c });
|
|
7243
|
+
}
|
|
7244
|
+
if (x.parityType === "checkbox" && new RegExp(`(^|_)${word}($|_)`).test(x.key)) cands.push({ key: x.key, value: true });
|
|
7245
|
+
if (x.parityType === "checkbox" && word === "unpaid" && /(^|_)paid($|_)/.test(x.key)) cands.push({ key: x.key, value: false });
|
|
7246
|
+
}
|
|
7247
|
+
if (cands.length !== 1) continue;
|
|
7248
|
+
f.filter = { [cands[0].key]: cands[0].value };
|
|
7249
|
+
fixes.push(`tables.${t.token}.fields.${f.key}: "${hit[1]}" in its name now picks those records: filter ${JSON.stringify(f.filter)}`);
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
7252
|
+
}
|
|
7253
|
+
function fictional(p) {
|
|
7254
|
+
const h = [...p].reduce((n, ch) => (n * 31 + ch.charCodeAt(0)) % 1e3, 7);
|
|
7255
|
+
const nn = String(h % 100).padStart(2, "0");
|
|
7256
|
+
const uk = String(h).padStart(3, "0");
|
|
7257
|
+
if (/^\s*\+/.test(p) && !/^\s*\+1\b/.test(p)) return `+44 20 7946 0${uk}`;
|
|
7258
|
+
if (/^\s*0\d/.test(p)) return `020 7946 0${uk}`;
|
|
7259
|
+
return p.replace(/(\d{3})([\s.-]?)(\d{4})\s*$/, (_m, _a, sep) => `555${sep}01${nn}`);
|
|
7260
|
+
}
|
|
7261
|
+
function fixFictionalPhones(spec, fixes) {
|
|
7262
|
+
const json = JSON.stringify(spec);
|
|
7263
|
+
const hits = /* @__PURE__ */ new Set();
|
|
7264
|
+
const isPhoneField = (f) => f.parityType === "phone" || /(^|_)(phone|mobile|cell|fax|tel)(_|$)/.test(f.key);
|
|
7265
|
+
const biz = spec.business?.phone;
|
|
7266
|
+
if (typeof biz === "string") for (const p of phonesOutsideFictionalRange(biz, true)) hits.add(p);
|
|
7267
|
+
for (const t of spec.tables) for (const r of t.rows ?? []) for (const f of t.fields) {
|
|
7268
|
+
const v = r.values?.[f.key];
|
|
7269
|
+
if (typeof v === "string") for (const p of phonesOutsideFictionalRange(v, isPhoneField(f))) hits.add(p);
|
|
7270
|
+
}
|
|
7271
|
+
for (const p of phonesOutsideFictionalRange(json)) hits.add(p);
|
|
7272
|
+
let out = json;
|
|
7273
|
+
let n = 0;
|
|
7274
|
+
for (const p of hits) {
|
|
7275
|
+
const escaped = JSON.stringify(p).slice(1, -1);
|
|
7276
|
+
if (!out.includes(escaped)) continue;
|
|
7277
|
+
out = out.split(escaped).join(JSON.stringify(fictional(p)).slice(1, -1));
|
|
7278
|
+
n += 1;
|
|
7279
|
+
}
|
|
7280
|
+
if (!n) return;
|
|
7281
|
+
const next = JSON.parse(out);
|
|
7282
|
+
for (const k of Object.keys(spec)) delete spec[k];
|
|
7283
|
+
Object.assign(spec, next);
|
|
7284
|
+
fixes.push(`phones: ${n} number(s) that could reach a real phone replaced with fictional ones (555-0100\u20260199, UK Ofcom drama range)`);
|
|
7285
|
+
}
|
|
7286
|
+
function fixTeamBlockCopy(spec, fixes) {
|
|
7287
|
+
const block = SHARED_BLOCKS.team_member;
|
|
7288
|
+
const used = /* @__PURE__ */ new Set();
|
|
7289
|
+
for (const v of spec.views ?? []) for (const k of ["groupBy", "dateField", "startField", "endField", "coverField", "swimlaneBy", "measure"]) if (v.table && v[k]) used.add(`${v.table}.${v[k]}`);
|
|
7290
|
+
for (const fm of spec.forms ?? []) for (const q2 of fm.fields ?? []) used.add(`${fm.table}.${q2.fieldKey}`);
|
|
7291
|
+
for (const e of spec.extras ?? []) for (const q2 of e.questions ?? []) used.add(`${e.table}.${q2.fieldKey}`);
|
|
7292
|
+
for (const t of spec.tables) {
|
|
7293
|
+
const meaning = (f) => block.fields.find((bf) => bf.parityType === f.parityType && bf.sameAs.some((w) => same3(w, f.label) || same3(w, f.key)));
|
|
7294
|
+
const hits = t.fields.map((f) => ({ f, bf: meaning(f) })).filter((x) => x.bf);
|
|
7295
|
+
if (hits.length < block.copyThreshold) continue;
|
|
7296
|
+
const hired = hits.some((h) => h.bf.key === "start_date");
|
|
7297
|
+
const hasRole = hits.some((h) => h.bf.key === "role");
|
|
7298
|
+
const contactOfSomeone = t.fields.some((f) => f.parityType === "relation" && f.relationTarget && f.relationTarget !== block.table && spec.tables.some((o) => o.token === f.relationTarget));
|
|
7299
|
+
if (!(hired || hasRole && !contactOfSomeone)) continue;
|
|
7300
|
+
const order = ["full_name", "role", "work_email", "mobile", "start_date"];
|
|
7301
|
+
const keep = new Set(hits.filter((h) => ["full_name", "role"].includes(h.bf.key)).map((h) => h.f.key));
|
|
7302
|
+
const dropped = [];
|
|
7303
|
+
let left = hits.length;
|
|
7304
|
+
for (const h of [...hits].sort((a, b) => order.indexOf(b.bf.key) - order.indexOf(a.bf.key))) {
|
|
7305
|
+
if (left < block.copyThreshold) break;
|
|
7306
|
+
if (keep.has(h.f.key) || used.has(`${t.token}.${h.f.key}`) || t.titleField === h.f.key) continue;
|
|
7307
|
+
dropped.push(h.f.label);
|
|
7308
|
+
t.fields = t.fields.filter((x) => x.key !== h.f.key);
|
|
7309
|
+
for (const r of t.rows ?? []) if (r.values) delete r.values[h.f.key];
|
|
7310
|
+
left -= 1;
|
|
7311
|
+
}
|
|
7312
|
+
if (left >= block.copyThreshold) continue;
|
|
7313
|
+
if (!t.fields.some((f) => f.key === "notes")) t.fields.push({ key: "notes", label: "Notes", parityType: "long_text", sensitivity: "internal", contextPolicy: "include" });
|
|
7314
|
+
fixes.push(`tables.${t.token}: copied the shared team_member block; kept as an ordinary table (${t.fields.map((f) => f.label).join(", ")}); dropped ${dropped.join(", ") || "nothing"}`);
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
|
|
6822
7318
|
// src/templates/describe/autofix.ts
|
|
6823
7319
|
var clone2 = (v) => JSON.parse(JSON.stringify(v));
|
|
6824
7320
|
var SENSITIVITY_RANK2 = ["public", "internal", "confidential", "restricted"];
|
|
@@ -7140,6 +7636,15 @@ function switchJob(spec, fixes) {
|
|
|
7140
7636
|
function autofixDescribeSpec(input, ctx = {}) {
|
|
7141
7637
|
const spec = describeSpec(clone2(input));
|
|
7142
7638
|
const autoFixes = [];
|
|
7639
|
+
fixFieldKinds(spec, autoFixes);
|
|
7640
|
+
normalizeComputedFields(spec, autoFixes);
|
|
7641
|
+
fixFormulaRefs(spec, autoFixes);
|
|
7642
|
+
fixViewShapes(spec, autoFixes);
|
|
7643
|
+
dropDuplicateViews(spec, autoFixes);
|
|
7644
|
+
fixInverseKeys(spec, autoFixes);
|
|
7645
|
+
fixRollupFilters(spec, autoFixes);
|
|
7646
|
+
fixTeamBlockCopy(spec, autoFixes);
|
|
7647
|
+
fixFictionalPhones(spec, autoFixes);
|
|
7143
7648
|
fixMissingQuestionFields(spec, autoFixes);
|
|
7144
7649
|
raiseSensitivity(spec, autoFixes);
|
|
7145
7650
|
flagAskedOfSubject(spec, ctx, autoFixes);
|
|
@@ -7363,6 +7868,30 @@ var VIEW_SHAPE_FACTS = {
|
|
|
7363
7868
|
startField_endField: "timeline only, required: keys of two datetime fields",
|
|
7364
7869
|
coverField: "gallery only, required: the key of a file field"
|
|
7365
7870
|
};
|
|
7871
|
+
var ROLLUP_SHAPE_FACTS = {
|
|
7872
|
+
rule: 'a rollup is a field of the PARENT table that adds up the records linked to it: parityType "rollup", via = the key of a relation field of THIS table (that link must be a list: multi true), pick = the key of a field on the far table, agg = sum | count | avg | min | max; an optional filter picks which linked records. Write exactly these keys on the field itself \u2014 never a nested {rollup:{\u2026}} object, never relation/field/fn.',
|
|
7873
|
+
example: { key: "total_paid", label: "Total paid", parityType: "rollup", via: "payments", pick: "amount", agg: "sum" }
|
|
7874
|
+
};
|
|
7875
|
+
var LOOKUP_SHAPE_FACTS = {
|
|
7876
|
+
rule: 'a lookup is a field that shows one value of the record a relation field points at: parityType "lookup", via = the key of a relation field of THIS table, pick = the key of a field on the far table. Write exactly these keys on the field itself \u2014 never a nested {lookup:{\u2026}} object.',
|
|
7877
|
+
example: { key: "client_phone", label: "Client phone", parityType: "lookup", via: "client", pick: "phone" }
|
|
7878
|
+
};
|
|
7879
|
+
var VIEW_FILTERS_SHAPE_FACTS = {
|
|
7880
|
+
rule: "a view's `filters` is ONE object of field key \u2192 value (a plain value is equality, null means empty); several allowed values of one field go in `anyOf` as field key \u2192 [values]; `sorts` is a list of {field, direction: asc|desc}; groupBy, dateField, startField, endField, coverField are field KEYS. Never write filters or sort as a list of {field, op, value}. The store cannot filter on 'not', 'contains', 'less than' or 'is not empty' \u2014 leave such a condition out.",
|
|
7881
|
+
example: { token: "open_requests", name: "Open requests", table: "request", kind: "kanban", groupBy: "stage", filters: { priority: "High" }, anyOf: { stage: ["New", "In progress"] }, sorts: [{ field: "due_on", direction: "asc" }] }
|
|
7882
|
+
};
|
|
7883
|
+
var FIELD_SHAPE_FACTS = {
|
|
7884
|
+
rule: "every field is {key, label, parityType, sensitivity, contextPolicy}; the type word goes in `parityType` (never `kind` or `type`) and is one of field_kinds.",
|
|
7885
|
+
example: { key: "visit_fee", label: "Visit fee", parityType: "currency", sensitivity: "internal", contextPolicy: "include" }
|
|
7886
|
+
};
|
|
7887
|
+
var FORMULA_SHAPE_FACTS = {
|
|
7888
|
+
rule: "a formula names every field by its LABEL in braces ({Quantity}), never by key; operators are + - * / % only (no >, <, = or comparisons), functions are IF, ROUND, SUM, DATEDIFF and the other store functions; it never reads a lookup or rollup, nor itself.",
|
|
7889
|
+
example: { key: "line_total", label: "Line total", parityType: "formula", formula: "{Quantity} * {Unit price}" }
|
|
7890
|
+
};
|
|
7891
|
+
var RELATIONSHIP_SHAPE_FACTS = {
|
|
7892
|
+
rule: "a relationship's inverseKey is the name the OTHER table sees this link under; it must not be a key that table already has as a field. A parent that lists its children owns ONE multi relation field (multi true); the child's single link to the parent is a second field, and their inverseKeys differ from every field key.",
|
|
7893
|
+
example: { fromTable: "request", fromField: "client", toTable: "client", flavor: "referenced", cardinality: "one", onDelete: "restrict", inverseKey: "requests_from" }
|
|
7894
|
+
};
|
|
7366
7895
|
function describeVocabulary() {
|
|
7367
7896
|
return {
|
|
7368
7897
|
field_kinds: RESOLVABLE_FIELD_TYPE_WORDS,
|
|
@@ -7386,6 +7915,14 @@ function describeVocabulary() {
|
|
|
7386
7915
|
booking_window: { weekday: "0 = Sunday \u2026 6 = Saturday", from: "HH:MM", to: "HH:MM later than from" },
|
|
7387
7916
|
booking_availability: BOOKING_AVAILABILITY_FACTS,
|
|
7388
7917
|
view_shape: VIEW_SHAPE_FACTS,
|
|
7918
|
+
rollup_shape: ROLLUP_SHAPE_FACTS,
|
|
7919
|
+
lookup_shape: LOOKUP_SHAPE_FACTS,
|
|
7920
|
+
view_filters_shape: VIEW_FILTERS_SHAPE_FACTS,
|
|
7921
|
+
field_shape: FIELD_SHAPE_FACTS,
|
|
7922
|
+
formula_shape: FORMULA_SHAPE_FACTS,
|
|
7923
|
+
relationship_shape: RELATIONSHIP_SHAPE_FACTS,
|
|
7924
|
+
phone_rule: "seed phone numbers are fictional: 555-0100 to 555-0199 in North America (e.g. (813) 555-0142) or a UK Ofcom drama number (e.g. 020 7946 0123); never a real-looking number.",
|
|
7925
|
+
team_rule: "the team (name, role, work email, mobile, start date) is the shared team_member block; do not declare a table with those fields \u2014 keep a table of your own to just name and role, or point a relation field at team_member.",
|
|
7389
7926
|
title_field: "a table's titleField is the key of a plain text-like field of that same table (a name, a title) \u2014 never a link to another table, a formula or a timed date"
|
|
7390
7927
|
};
|
|
7391
7928
|
}
|