@homepages/concrete 6.2.0 → 8.0.0
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 +152 -0
- package/codemods/manifest.json +19 -0
- package/codemods/object-form-only.mjs +39 -0
- package/codemods/steps/list-object-form.mjs +688 -0
- package/codemods/steps/select-object-form.mjs +210 -0
- package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +1101 -0
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +14 -14
- package/dist/asset-modules.d.ts +2 -1
- package/dist/cli/check/stages/render.js +1 -1
- package/dist/cli/check/stages/sections.js +1 -1
- package/dist/fixtures/canonical.d.ts +2 -5
- package/dist/fixtures/media.js +11 -25
- package/dist/fixtures/property.js +28 -16
- package/dist/fixtures/resolve.js +31 -17
- package/dist/fixtures/rows.js +3 -83
- package/dist/fixtures.d.ts +17 -9
- package/dist/index.d.ts +9 -9
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +32 -10
- package/dist/packages/internal/fill-bake/dist/derive-source.js +15 -4
- package/dist/packages/internal/fill-bake/dist/index.js +2 -2
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +6 -61
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +15 -0
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-5pxZnlkh.js → property-facts-Cy7-O4p0.js} +2 -5
- package/dist/packages/internal/section-contracts/dist/catalog.js +2 -22
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +6 -1
- package/dist/packages/internal/section-contracts/dist/group-contract.js +1 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -5
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +16 -7
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +1 -5
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +14 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +3 -28
- package/dist/packages/internal/section-contracts/dist/source-contract.js +93 -20
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +19 -9
- package/dist/packages/internal/source-resolution/dist/index.js +48 -57
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +6 -17
- package/dist/packages/internal/template-contracts/dist/facts-view.js +4 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +20 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +362 -380
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +289 -293
- package/dist/primitives/slot-bindings.d.ts +7 -40
- package/dist/primitives/slot-bindings.js +10 -12
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +13 -1
- package/dist/schema/extract-fill-spec.js +14 -17
- package/dist/schema/fact.d.ts +2 -19
- package/dist/schema/fill-builders.d.ts +4 -3
- package/dist/schema/fill-spec.js +18 -1
- package/dist/schema/layout.d.ts +6 -8
- package/dist/schema/layout.js +3 -9
- package/dist/schema/property-facts.d.ts +17 -47
- package/dist/schema/row-fields.js +88 -0
- package/dist/schema/row-ref.d.ts +59 -0
- package/dist/schema/row-ref.js +28 -0
- package/dist/schema/runtime-values.d.ts +8 -13
- package/dist/schema/section-props.d.ts +19 -26
- package/dist/schema/section-schema.d.ts +6 -6
- package/dist/schema/section-schema.js +2 -2
- package/dist/schema/slot-builders.d.ts +247 -122
- package/dist/schema/slot-builders.js +57 -28
- package/dist/schema/slot-ref.d.ts +18 -2
- package/dist/schema/slot-ref.js +11 -3
- package/dist/schema/slot-types.d.ts +7 -7
- package/dist/schema/slot-types.js +55 -19
- package/dist/section/declare.d.ts +1 -1
- package/dist/section/section.d.ts +3 -3
- package/dist/template/logic-shim.d.ts +1 -1
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +3 -8
- package/package.json +1 -1
- package/tsconfig.base.json +1 -0
- package/dist/artifact/playground/client/assets/index-Cqz-jjVw.js +0 -1101
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/row-contract.js +0 -37
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +0 -15
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -10
|
@@ -19,10 +19,7 @@ function checkSelectListVocabulary(element, label, sectionKey) {
|
|
|
19
19
|
if (!Array.isArray(element.values) || element.values.length === 0) throw new Error(`Section "${sectionKey}": ${label} element is a \`select\` with no \`values\` — a select-list's vocabulary must be a non-empty static \`values\` array.`);
|
|
20
20
|
}
|
|
21
21
|
function checkSingleItem(slot, label, sectionKey) {
|
|
22
|
-
if (slot.title !== void 0
|
|
23
|
-
const offending = slot.title !== void 0 ? "title" : "layout";
|
|
24
|
-
throw new Error(`Section "${sectionKey}": ${label} declares \`${offending}\` beside \`element\` — the row surface belongs to a record item (\`fields\`) only.`);
|
|
25
|
-
}
|
|
22
|
+
if (slot.title !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares \`title\` beside \`element\` — the row surface belongs to a record item (\`fields\`) only.`);
|
|
26
23
|
const element = slot.element;
|
|
27
24
|
if (element == null) throw new Error(`Section "${sectionKey}": ${label} must declare its item — \`element\` (a single slot) or \`fields\` (a record of slots).`);
|
|
28
25
|
if (!LIST_ITEM_TYPES.has(element.type ?? "")) throw new Error(`Section "${sectionKey}": ${label} element must be a single value primitive (${[...LIST_ITEM_TYPES].join("|")}) — never a list or a record, got "${element.type}".`);
|
|
@@ -49,7 +46,6 @@ function checkRecordItem(slot, label, sectionKey) {
|
|
|
49
46
|
if (field.type === "list") checkSingleItem(field, `${label} field "${fieldId}"`, sectionKey);
|
|
50
47
|
}
|
|
51
48
|
if (slot.title !== void 0 && !Object.hasOwn(fields, slot.title)) throw new Error(`Section "${sectionKey}": ${label} \`title\` names "${slot.title}", which is not a declared field.`);
|
|
52
|
-
for (const row of slot.layout ?? []) for (const fieldId of Array.isArray(row) ? row : [row]) if (!Object.hasOwn(fields, fieldId)) throw new Error(`Section "${sectionKey}": ${label} \`layout\` names "${fieldId}", which is not a declared field.`);
|
|
53
49
|
}
|
|
54
50
|
function checkListSlot(slot, label, sectionKey) {
|
|
55
51
|
if (slot.element != null && slot.fields != null) throw new Error(`Section "${sectionKey}": ${label} declares both \`element\` and \`fields\` — the item is exactly one of the two.`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { plannerForField } from "../../fill-vocabulary/dist/row-planners.js";
|
|
2
2
|
import { isListFill } from "./fill-spec-view.js";
|
|
3
|
+
import { rowReadFields } from "../../fill-vocabulary/dist/row-reads.js";
|
|
3
4
|
|
|
4
5
|
//#region ../../internal/section-contracts/dist/row-fill-contract.js
|
|
5
6
|
function assertRowFillContract(schema, decision, sectionKey) {
|
|
@@ -18,9 +19,22 @@ function assertRowFillContract(schema, decision, sectionKey) {
|
|
|
18
19
|
if (!rowField) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" field "${field}" is not a declared field of "${slotId}" (declared: ${declared.length > 0 ? declared.join(", ") : "none"}).`);
|
|
19
20
|
if (rowField.source) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}", which is source-bound (source.kind "${rowField.source.kind ?? "?"}") — the fact bakes it; drop the decision.`);
|
|
20
21
|
if (plannerForField(rowField) === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}"), which no row can be filled with — a row field is written or picked inside the list's one batched call: text, a select key, an asset, or a list of text, keys or assets.`);
|
|
22
|
+
if (slot.source === void 0) {
|
|
23
|
+
const reads = fill.fields?.[field]?.reads;
|
|
24
|
+
assertEarlierRowReads(declared, field, reads, `Section "${sectionKey}": list fill "${decision.id}" field "${field}" of "${slotId}"`);
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
29
|
+
function assertEarlierRowReads(declared, field, reads, where) {
|
|
30
|
+
const position = declared.indexOf(field);
|
|
31
|
+
for (const read of rowReadFields(reads)) {
|
|
32
|
+
const at = declared.indexOf(read);
|
|
33
|
+
if (at === -1) throw new Error(`${where} reads row field "${read}", which the row does not declare (declared: ${declared.join(", ")}).`);
|
|
34
|
+
if (at === position) throw new Error(`${where} reads itself — a row fill reads only fields declared before it.`);
|
|
35
|
+
if (at > position) throw new Error(`${where} reads row field "${read}", declared after it — the model writes a row top to bottom, so a fill reads only earlier fields. Declare "${read}" first, or drop the read.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
24
38
|
|
|
25
39
|
//#endregion
|
|
26
40
|
export { assertRowFillContract };
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { FACT_GRAPH } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
2
|
import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
|
|
3
3
|
import { assertCapContract } from "./cap-contract.js";
|
|
4
|
-
import { DECISION_KINDS } from "./fill-spec-view.js";
|
|
5
|
-
import { assertChooseSelectContract } from "./choose-select-contract.js";
|
|
6
4
|
import { assertCountBoundsContract } from "./count-bounds-contract.js";
|
|
7
5
|
import { assertGroupContract } from "./group-contract.js";
|
|
8
6
|
import { assertInterpolationContract } from "./interpolation-contract.js";
|
|
7
|
+
import { DECISION_KINDS } from "./fill-spec-view.js";
|
|
9
8
|
import { assertWriterReadsFactContract } from "./writer-reads-fact-contract.js";
|
|
10
9
|
import { assertListFillContract } from "./list-fill-contract.js";
|
|
11
10
|
import { assertListScalarContract } from "./list-scalar-contract.js";
|
|
12
|
-
import { assertNameTitleContract } from "./name-title-contract.js";
|
|
13
11
|
import { assertNestedSlotTypes } from "./nested-slot-contract.js";
|
|
14
12
|
import { assertRecordCollectionContract } from "./record-collection-contract.js";
|
|
15
13
|
import { assertOptionSourceContract } from "./option-source-contract.js";
|
|
16
14
|
import { assertPoiCurationContract } from "./poi-curation-contract.js";
|
|
17
|
-
import { assertPoolingFieldContract } from "./pooling-field-contract.js";
|
|
18
|
-
import { assertRowContract } from "./row-contract.js";
|
|
19
15
|
import { assertRowFillContract } from "./row-fill-contract.js";
|
|
20
16
|
import { assertSourceContract } from "./source-contract.js";
|
|
21
17
|
import { assertDisplayContract } from "./display-contract.js";
|
|
22
18
|
import { assertDisplayEvidenceContract } from "./display-evidence-contract.js";
|
|
23
19
|
import { assertSelectContract } from "./select-contract.js";
|
|
24
|
-
import { assertSourceFilterContract } from "./source-filter-contract.js";
|
|
25
20
|
import { assertSourcesContract } from "./sources-contract.js";
|
|
26
21
|
import { assertUrlContract } from "./url-contract.js";
|
|
27
22
|
|
|
@@ -65,18 +60,6 @@ const CONTRACTS = {
|
|
|
65
60
|
implementation: byDecision(({ key, schema }, d) => assertListFillContract(schema, d, key)),
|
|
66
61
|
assertions: [assertListFillContract]
|
|
67
62
|
},
|
|
68
|
-
"choose-select": {
|
|
69
|
-
implementation: byDecision(({ key, schema }, d) => assertChooseSelectContract(schema, d, key)),
|
|
70
|
-
assertions: [assertChooseSelectContract]
|
|
71
|
-
},
|
|
72
|
-
"name-title": {
|
|
73
|
-
implementation: byDecision(({ key, schema }, d) => assertNameTitleContract(schema, d, key)),
|
|
74
|
-
assertions: [assertNameTitleContract]
|
|
75
|
-
},
|
|
76
|
-
"pooling-field": {
|
|
77
|
-
implementation: byDecision(({ key, schema }, d) => assertPoolingFieldContract(schema, d, key)),
|
|
78
|
-
assertions: [assertPoolingFieldContract]
|
|
79
|
-
},
|
|
80
63
|
"row-fill": {
|
|
81
64
|
implementation: byDecision(({ key, schema }, d) => assertRowFillContract(schema, d, key)),
|
|
82
65
|
assertions: [assertRowFillContract]
|
|
@@ -102,10 +85,10 @@ const CONTRACTS = {
|
|
|
102
85
|
assertions: [assertDisplayEvidenceContract]
|
|
103
86
|
},
|
|
104
87
|
source: {
|
|
105
|
-
implementation: bySection(({ key, schema }) => assertSourceContract({
|
|
88
|
+
implementation: bySection(({ key, schema, fillSpec }) => assertSourceContract({
|
|
106
89
|
key,
|
|
107
90
|
slots: schema.slots
|
|
108
|
-
})),
|
|
91
|
+
}, fillSpec)),
|
|
109
92
|
assertions: [assertSourceContract]
|
|
110
93
|
},
|
|
111
94
|
"record-collection": {
|
|
@@ -132,10 +115,6 @@ const CONTRACTS = {
|
|
|
132
115
|
implementation: bySection(({ key, schema }) => assertUrlContract(schema, key)),
|
|
133
116
|
assertions: [assertUrlContract]
|
|
134
117
|
},
|
|
135
|
-
"source-filter": {
|
|
136
|
-
implementation: bySection(({ key, schema }) => assertSourceFilterContract(schema, key)),
|
|
137
|
-
assertions: [assertSourceFilterContract]
|
|
138
|
-
},
|
|
139
118
|
sources: {
|
|
140
119
|
implementation: bySection(({ key, schema }) => assertSourcesContract(schema, key)),
|
|
141
120
|
assertions: [assertSourcesContract]
|
|
@@ -147,10 +126,6 @@ const CONTRACTS = {
|
|
|
147
126
|
group: {
|
|
148
127
|
implementation: bySection(({ key, schema }) => assertGroupContract(schema, key)),
|
|
149
128
|
assertions: [assertGroupContract]
|
|
150
|
-
},
|
|
151
|
-
row: {
|
|
152
|
-
implementation: bySection(({ key, schema }) => assertRowContract(schema, key)),
|
|
153
|
-
assertions: [assertRowContract]
|
|
154
129
|
}
|
|
155
130
|
};
|
|
156
131
|
function toSectionRunner(implementation) {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { COLLECTIONS, SOURCE_FIELDS, isWritableSourceField } from "../../template-contracts/dist/slot-catalog.js";
|
|
1
|
+
import { COLLECTIONS, FACT_GRAPH, SOURCE_FIELDS, isWritableSourceField } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { plannedFieldsOf } from "./fill-spec-view.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/section-contracts/dist/source-contract.js
|
|
4
|
-
function
|
|
5
|
-
if (desc.value_type === "unit_list") return "unit";
|
|
6
|
-
if (desc.value_type === "contact_list") return "contact";
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
function assertOne(path, key, slot, rowContainer) {
|
|
5
|
+
function assertOne(path, key, slot) {
|
|
10
6
|
const src = slot.source;
|
|
11
7
|
if (!src) {
|
|
12
8
|
if (slot.writeback !== void 0) throw new Error(`${path}: "writeback" without a source. Only a slot bound to a fact (a direct source) answers whether edits propagate — remove the key.`);
|
|
@@ -16,11 +12,10 @@ function assertOne(path, key, slot, rowContainer) {
|
|
|
16
12
|
const def = SOURCE_FIELDS[src.field ?? ""];
|
|
17
13
|
if (!def) throw new Error(`${path}: unknown direct source field "${String(src.field)}"`);
|
|
18
14
|
const recordItemSlot = slot.type === "list" && slot.fields != null;
|
|
19
|
-
if (def.image && slot.type !== "image"
|
|
15
|
+
if (def.image && slot.type !== "image") throw new Error(`${path}: image source field "${src.field}" must sit on an image slot`);
|
|
20
16
|
if (Object.hasOwn(COLLECTIONS, src.field ?? "")) {
|
|
21
17
|
if (!recordItemSlot) throw new Error(`${path}: fact-collection source "${src.field}" needs a record item (a list declaring \`fields\`) — a fact row cannot project onto one slot.`);
|
|
22
18
|
}
|
|
23
|
-
if (rowContainer !== null && def.container !== rowContainer) throw new Error(`${path}: row-field source "${src.field}" belongs to the "${def.container}" container, but this list's rows resolve against "${rowContainer}" — a row field must bind a field of its own row.`);
|
|
24
19
|
if (typeof slot.writeback !== "boolean") throw new Error(`${path}: a direct source requires "writeback" (boolean) — declare whether edits propagate to "${src.field}".`);
|
|
25
20
|
if (slot.writeback === true && !isWritableSourceField(src.field ?? "")) throw new Error(`${path}: "writeback: true" on read-only source field "${src.field}" — the catalog has no write path for it; declare "writeback: false".`);
|
|
26
21
|
return;
|
|
@@ -30,28 +25,106 @@ function assertOne(path, key, slot, rowContainer) {
|
|
|
30
25
|
if (src.transform !== key) throw new Error(`${path}: unknown transform "${String(src.transform)}". A "derived" source is a compute() binding, and its transform must equal its own slot key ("${key}") — it does not, which means the schema was hand-authored with a mismatched transform rather than produced by defineSchema's compute() path. Author a derived value with compute() ("slot({ source: compute({ reads }, fn) })").`);
|
|
31
26
|
assertDeclaredRefs(path, src.reads);
|
|
32
27
|
}
|
|
33
|
-
function assertDeclaredRefs(path, reads) {
|
|
28
|
+
function assertDeclaredRefs(path, reads, rowMember) {
|
|
34
29
|
if (reads === void 0) return;
|
|
35
30
|
if (!Array.isArray(reads)) throw new Error(`${path}: "reads" is not a list of refs.`);
|
|
36
31
|
reads.forEach((entry, i) => {
|
|
37
|
-
const { kind, key, section, slot } = entry ?? {};
|
|
32
|
+
const { kind, key, section, slot, field } = entry ?? {};
|
|
38
33
|
if (kind === "fact" && typeof key === "string") return;
|
|
39
34
|
if (kind === "slot" && typeof section === "string" && typeof slot === "string") return;
|
|
35
|
+
if (kind === "row" && typeof field === "string") {
|
|
36
|
+
if (rowMember === void 0) throw new Error(`${path}: reads[${String(i)}] reads the row member "${field}" outside a record list's row — only a row field's compute runs once per row.`);
|
|
37
|
+
rowMember(field);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
40
|
throw new Error(kind === void 0 ? `${path}: reads[${String(i)}] is a ref without a "kind" — this framework reads only kind-tagged fact and slot refs. Run \`concrete upgrade\`, then build again.` : `${path}: reads[${String(i)}] is not a fact ref ({ kind: "fact", key }) or a slot ref ({ kind: "slot", section, slot }).`);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
function assertSourceContract(schema) {
|
|
43
|
+
function assertSourceContract(schema, fillSpec = { decisions: [] }) {
|
|
44
44
|
for (const [name, slot] of Object.entries(schema.slots)) {
|
|
45
|
-
|
|
45
|
+
const at = `${schema.key}.${name}`;
|
|
46
|
+
if (slot.source?.kind === "row") throw new Error(`${at}: a row source on a top-level slot — a row member or marker names a field of a record list's row, and a top-level slot has no row. Bind the slot to a fact instead.`);
|
|
47
|
+
assertOne(at, name, slot);
|
|
46
48
|
if (slot.type !== "list" || slot.fields === void 0) continue;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
assertNotImplicit(at, slot.fields, plannedRowFields(fillSpec, name));
|
|
50
|
+
assertRowSourceList(at, name, slot, slot.fields);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function plannedRowFields(fillSpec, listKey) {
|
|
54
|
+
const decision = fillSpec.decisions.find((d) => d.produces.includes(listKey));
|
|
55
|
+
return new Set(decision === void 0 ? [] : plannedFieldsOf(decision));
|
|
56
|
+
}
|
|
57
|
+
function assertNotImplicit(at, fields, planned) {
|
|
58
|
+
const offenders = [];
|
|
59
|
+
for (const [fieldKey, field] of Object.entries(fields)) {
|
|
60
|
+
const kind = field.source?.kind;
|
|
61
|
+
if (kind === "direct") offenders.push(`"${fieldKey}" (bound \`direct\` to "${String(field.source?.field)}")`);
|
|
62
|
+
else if ((kind === void 0 || kind === "authored") && !planned.has(fieldKey)) offenders.push(`"${fieldKey}" (no origin)`);
|
|
63
|
+
}
|
|
64
|
+
if (offenders.length === 0) return;
|
|
65
|
+
throw new Error(`${at}: a record list in the implicit form, which this platform no longer reads — row field ${offenders.join(", ")}. Every row field declares its own origin: a member of its row (\`row.<member>\`), a \`compute()\`, or a \`fill()\`. Rebuild the section with @homepages/concrete 7.0.0 or later (\`concrete upgrade\`).`);
|
|
66
|
+
}
|
|
67
|
+
function memberFits(valueType, field) {
|
|
68
|
+
switch (valueType) {
|
|
69
|
+
case "image": return field.type === "image";
|
|
70
|
+
case "image_list": return field.type === "list" && field.fields === void 0 && field.element?.type === "image";
|
|
71
|
+
case "number": return field.type === "number";
|
|
72
|
+
case "text": return field.type === "text" || field.type === "url" || field.type === "select";
|
|
73
|
+
default: return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function fittingTypes(valueType) {
|
|
77
|
+
switch (valueType) {
|
|
78
|
+
case "image": return "an `image` field";
|
|
79
|
+
case "image_list": return "a list of images (`list({ item: image() })`)";
|
|
80
|
+
case "number": return "a `number` field";
|
|
81
|
+
case "text": return "a `text`, `url` or `select` field";
|
|
82
|
+
default: return "no field — it is not offered to a row";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function assertRowSourceList(at, listKey, list, fields) {
|
|
86
|
+
const listSource = list.source;
|
|
87
|
+
const boundField = listSource?.kind === "direct" ? listSource.field ?? "" : void 0;
|
|
88
|
+
if (boundField !== void 0 && !Object.hasOwn(COLLECTIONS, boundField)) throw new Error(`${at}: row sources on a list bound to "${boundField}", which is not a fact collection — a row member names a member of the row a collection supplies.`);
|
|
89
|
+
const collection = boundField;
|
|
90
|
+
const computed = listSource?.kind === "derived";
|
|
91
|
+
const filled = listSource === void 0;
|
|
92
|
+
const assertMember = (path, member) => {
|
|
93
|
+
if (filled) throw new Error(`${path}: row member "${member}" on a list a fill() builds — its rows do not exist until the fill answers, so they offer no members. Give the field its own fill() instead.`);
|
|
94
|
+
if (collection === void 0) return void 0;
|
|
95
|
+
if (member === COLLECTIONS[collection].idKey) throw new Error(`${path}: row member "${member}" is the row's identity, which every baked "${collection}" row carries as "${member}" already — drop the field.`);
|
|
96
|
+
const row = FACT_GRAPH[collection].row;
|
|
97
|
+
const descriptor = row[member];
|
|
98
|
+
if (descriptor === void 0) throw new Error(`${path}: unknown row member "${member}" — a "${collection}" row offers ${Object.keys(row).filter((name) => name !== COLLECTIONS[collection].idKey).map((name) => `"${name}"`).join(", ")}.`);
|
|
99
|
+
return descriptor;
|
|
100
|
+
};
|
|
101
|
+
for (const [fieldKey, field] of Object.entries(fields)) {
|
|
102
|
+
const path = `${at}.${fieldKey}`;
|
|
103
|
+
const src = field.source;
|
|
104
|
+
if (src === void 0 || src.kind === "authored") {
|
|
105
|
+
if (field.writeback !== void 0) throw new Error(`${path}: "writeback" without a source. Only a field bound to a row member answers whether edits propagate — remove the key.`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (src.kind === "derived") {
|
|
109
|
+
if (field.writeback !== void 0) throw new Error(`${path}: "writeback" on a derived (compute) source. Nothing can write back through a derivation — remove the key.`);
|
|
110
|
+
const handle = `${listKey}.${fieldKey}`;
|
|
111
|
+
if (src.transform !== handle) throw new Error(`${path}: unknown transform "${String(src.transform)}". A row field's compute() is held under "${handle}" — its list's key and its own — which this declaration does not name, so it was not produced by the framework's compute() path.`);
|
|
112
|
+
assertDeclaredRefs(path, src.reads, (member) => {
|
|
113
|
+
assertMember(path, member);
|
|
114
|
+
});
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (src.kind !== "row") continue;
|
|
118
|
+
if (typeof src.field !== "string") throw new Error(`${path}: a row source names no member — it is \`{ kind: "row", field: "<member>" }\`.`);
|
|
119
|
+
const member = src.field;
|
|
120
|
+
const descriptor = assertMember(path, member);
|
|
121
|
+
if (field.writeback !== void 0 && typeof field.writeback !== "boolean") throw new Error(`${path}: "writeback" is not a boolean — declare whether edits propagate to row member "${member}".`);
|
|
122
|
+
if (descriptor === void 0) {
|
|
123
|
+
if (computed && field.writeback === true) throw new Error(`${path}: "writeback: true" on a row of a computed list — nothing can write back through a derivation; declare "writeback: false".`);
|
|
124
|
+
continue;
|
|
54
125
|
}
|
|
126
|
+
if (!memberFits(descriptor.value_type, field)) throw new Error(`${path}: row member "${member}" is a ${descriptor.value_type} value and cannot sit on a "${String(field.type)}" field — it belongs on ${fittingTypes(descriptor.value_type)}.`);
|
|
127
|
+
if (field.writeback === true && descriptor.writeback === void 0) throw new Error(`${path}: "writeback: true" on read-only row member "${member}" — the catalog has no write path for it; declare "writeback: false".`);
|
|
55
128
|
}
|
|
56
129
|
}
|
|
57
130
|
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
import { originationFor } from "../../fill-vocabulary/dist/origination.js";
|
|
2
|
+
import { plannedFieldsOf } from "./fill-spec-view.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/section-contracts/dist/writer-reads-fact-contract.js
|
|
4
|
-
const WRITES = [
|
|
5
|
-
|
|
5
|
+
const WRITES = [
|
|
6
|
+
"write",
|
|
7
|
+
"estimate",
|
|
8
|
+
"write-items"
|
|
9
|
+
];
|
|
10
|
+
function writes(slot, planned = []) {
|
|
6
11
|
if (slot === void 0) return false;
|
|
7
|
-
const origination = originationFor(slot);
|
|
12
|
+
const origination = originationFor(slot, planned);
|
|
8
13
|
if (origination === void 0) return false;
|
|
9
|
-
return WRITES.includes(origination.kind)
|
|
14
|
+
return WRITES.includes(origination.kind);
|
|
10
15
|
}
|
|
11
|
-
function readsAFact(reads) {
|
|
12
|
-
return (reads ?? []).some((ref) =>
|
|
16
|
+
function readsAFact(reads, rowsAreFacts) {
|
|
17
|
+
return (reads ?? []).some((ref) => {
|
|
18
|
+
const kind = ref?.kind;
|
|
19
|
+
return kind === "fact" || rowsAreFacts && kind === "row";
|
|
20
|
+
});
|
|
13
21
|
}
|
|
14
22
|
function assertWriterReadsFactContract(schema, decision, sectionKey) {
|
|
15
|
-
if (decision.kind !== "text" && decision.kind !== "list") return;
|
|
23
|
+
if (decision.kind !== "text" && decision.kind !== "number" && decision.kind !== "list") return;
|
|
16
24
|
const fill = decision;
|
|
17
25
|
const writing = [];
|
|
26
|
+
let rowsAreFacts = false;
|
|
18
27
|
for (const slotId of decision.produces) {
|
|
19
28
|
const slot = schema.slots[slotId];
|
|
20
29
|
if (slot === void 0) continue;
|
|
21
|
-
if (
|
|
30
|
+
if (originationFor(slot)?.kind === "bound-rows") rowsAreFacts = true;
|
|
31
|
+
if (decision.kind === "text" || decision.kind === "number" || writes(slot, plannedFieldsOf(decision))) writing.push(slotId);
|
|
22
32
|
for (const field of Object.keys(fill.fields ?? {})) if (writes(slot.fields?.[field])) writing.push(`${slotId}.${field}`);
|
|
23
33
|
}
|
|
24
34
|
if (writing.length === 0) return;
|
|
25
35
|
const fields = Object.values(fill.fields ?? {});
|
|
26
|
-
if (readsAFact(fill.reads) || fields.some((field) => readsAFact(field.reads))) return;
|
|
36
|
+
if (readsAFact(fill.reads, false) || fields.some((field) => readsAFact(field.reads, rowsAreFacts))) return;
|
|
27
37
|
throw new Error(`Section "${sectionKey}": fill "${decision.id}" writes ${writing.map((w) => `"${w}"`).join(", ")} but reads no fact — its model call is shown exactly its \`reads\`, so it would write from the brief alone. Declare the facts it writes from (\`reads: [fact.description]\`), on the fill or on the row field that writes.`);
|
|
28
38
|
}
|
|
29
39
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { FACT_GRAPH, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS } from "../../template-contracts/dist/slot-catalog.js";
|
|
1
|
+
import { COLLECTIONS, FACT_GRAPH, FACT_PROJECTIONS, REFERRAL_FIELDS, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { rowMemberOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
|
|
2
3
|
import { projectFactsView } from "../../template-contracts/dist/facts-view.js";
|
|
3
4
|
|
|
4
5
|
//#region ../../internal/source-resolution/dist/index.js
|
|
5
|
-
function rowFieldSources(fields) {
|
|
6
|
-
const map = {};
|
|
7
|
-
for (const [key, field] of Object.entries(fields ?? {})) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
|
|
8
|
-
return map;
|
|
9
|
-
}
|
|
10
6
|
function primaryContact(facts) {
|
|
11
7
|
return facts.contacts?.find((c) => c.primary) ?? facts.contacts?.[0];
|
|
12
8
|
}
|
|
@@ -18,29 +14,16 @@ function comparablesOf(facts) {
|
|
|
18
14
|
const raw = facts.comparables;
|
|
19
15
|
return Array.isArray(raw) ? raw : [];
|
|
20
16
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
title: "title",
|
|
24
|
-
org_name: "org_name",
|
|
25
|
-
email: "email",
|
|
26
|
-
phone: "phone",
|
|
27
|
-
website: "website_url",
|
|
28
|
-
instagram: "instagram_url",
|
|
29
|
-
linkedin: "linkedin_url",
|
|
30
|
-
x: "x_url",
|
|
31
|
-
facebook: "facebook_url",
|
|
32
|
-
headshot: "avatar_upload_id",
|
|
33
|
-
logo_dark: "logo_dark_upload_id",
|
|
34
|
-
logo_light: "logo_light_upload_id"
|
|
35
|
-
};
|
|
17
|
+
const CONTACT_ROW = FACT_GRAPH.contacts.row;
|
|
18
|
+
const REFERRAL_FIELD_TO_CONTACT_KEY = Object.fromEntries(REFERRAL_FIELDS.map((field) => [field, CONTACT_ROW[field].path]));
|
|
36
19
|
const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
|
|
37
20
|
const LOGO_VARIANT_FALLBACK = {
|
|
38
21
|
logo_dark: {
|
|
39
|
-
other:
|
|
22
|
+
other: CONTACT_ROW.logo_light.path,
|
|
40
23
|
mask: "black"
|
|
41
24
|
},
|
|
42
25
|
logo_light: {
|
|
43
|
-
other:
|
|
26
|
+
other: CONTACT_ROW.logo_dark.path,
|
|
44
27
|
mask: "white"
|
|
45
28
|
}
|
|
46
29
|
};
|
|
@@ -96,43 +79,51 @@ function singleUnitLabelDefault(propertyType) {
|
|
|
96
79
|
default: return null;
|
|
97
80
|
}
|
|
98
81
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
82
|
+
function collectionRowsOf(collection, facts) {
|
|
83
|
+
switch (collection) {
|
|
84
|
+
case "units": return [...facts.units].sort((a, b) => a.position - b.position);
|
|
85
|
+
case "contacts": return contactsOf(facts);
|
|
86
|
+
case "comparables": return comparablesOf(facts);
|
|
87
|
+
}
|
|
101
88
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
89
|
+
const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(CONTACT_ROW).filter(([, member]) => member.strength !== void 0).map(([name]) => [name, FACT_PROJECTIONS.contact[name] ?? name]));
|
|
90
|
+
function mediaRefOf(raw) {
|
|
91
|
+
if (typeof raw !== "string") return null;
|
|
92
|
+
const assetId = raw.trim();
|
|
93
|
+
return assetId.length > 0 ? { asset_id: assetId } : null;
|
|
94
|
+
}
|
|
95
|
+
function mediaRefListOf(raw) {
|
|
96
|
+
if (!Array.isArray(raw)) return [];
|
|
97
|
+
return [...raw].sort((a, b) => (typeof a["position"] === "number" ? a["position"] : 0) - (typeof b["position"] === "number" ? b["position"] : 0)).flatMap((element) => {
|
|
98
|
+
const ref = mediaRefOf(element["id"]);
|
|
99
|
+
if (ref === null) return [];
|
|
100
|
+
if ("floor_label" in element) ref.floor_label = typeof element["floor_label"] === "string" ? element["floor_label"] : null;
|
|
101
|
+
return [ref];
|
|
107
102
|
});
|
|
108
103
|
}
|
|
109
|
-
function
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
function readRowMember(collection, row, member, facts) {
|
|
105
|
+
const descriptor = FACT_GRAPH[collection].row[member];
|
|
106
|
+
if (descriptor === void 0) return null;
|
|
107
|
+
if (collection === "contacts") {
|
|
108
|
+
const fact = CONTACT_MEMBER_FACT[member];
|
|
109
|
+
if (fact !== void 0) return resolveContactScalar(row, fact);
|
|
110
|
+
}
|
|
111
|
+
if (collection === "units" && member === "unit_label") return row["unit_label"] ?? singleUnitLabelDefault(facts.property_type);
|
|
112
|
+
const raw = row[descriptor.path] ?? null;
|
|
113
|
+
if (descriptor.value_type === "image") return mediaRefOf(raw);
|
|
114
|
+
if (descriptor.value_type === "image_list") return mediaRefListOf(raw);
|
|
115
|
+
return raw;
|
|
116
|
+
}
|
|
117
|
+
function projectCollectionRows(collection, facts, fields, rowComputes = {}) {
|
|
118
|
+
const idKey = COLLECTIONS[collection].idKey;
|
|
119
|
+
const members = rowMemberSources(fields);
|
|
120
|
+
return collectionRowsOf(collection, facts).map((row) => {
|
|
121
|
+
const out = { [idKey]: row[idKey] };
|
|
122
|
+
for (const [key, member] of Object.entries(members)) out[key] = readRowMember(collection, row, member, facts);
|
|
123
|
+
for (const [key, compute] of Object.entries(rowComputes)) out[key] = compute((member) => readRowMember(collection, row, member, facts));
|
|
124
|
+
return out;
|
|
119
125
|
});
|
|
120
126
|
}
|
|
121
|
-
function buildUnitFloorplanList(facts) {
|
|
122
|
-
return [...facts.units].sort((a, b) => a.position - b.position).map((u) => ({
|
|
123
|
-
unit_id: u.unit_id,
|
|
124
|
-
unit_label: u.unit_label,
|
|
125
|
-
floorplans: [...u.floor_plans].sort((a, b) => a.position - b.position)
|
|
126
|
-
}));
|
|
127
|
-
}
|
|
128
|
-
function buildComparablesList(facts) {
|
|
129
|
-
return comparablesOf(facts).map((row) => ({ ...row }));
|
|
130
|
-
}
|
|
131
|
-
const COLLECTION_PROJECTIONS = {
|
|
132
|
-
units: buildUnitsList,
|
|
133
|
-
contacts: buildContactsList,
|
|
134
|
-
comparables: buildComparablesList
|
|
135
|
-
};
|
|
136
127
|
function firstUnit(facts) {
|
|
137
128
|
if (facts.units.length === 0) return void 0;
|
|
138
129
|
return [...facts.units].sort((a, b) => a.position - b.position)[0];
|
|
@@ -175,7 +166,7 @@ function resolveContactScalar(contact, field) {
|
|
|
175
166
|
function readFrom(field, ctx) {
|
|
176
167
|
const desc = SOURCE_FIELDS[field];
|
|
177
168
|
if (!desc) return null;
|
|
178
|
-
if (Object.hasOwn(
|
|
169
|
+
if (Object.hasOwn(COLLECTIONS, field)) return null;
|
|
179
170
|
if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? primaryContact(ctx.facts), field);
|
|
180
171
|
if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
|
|
181
172
|
return resolvePropertyScalar(ctx.facts, field);
|
|
@@ -194,4 +185,4 @@ function readAddressPart(address, part) {
|
|
|
194
185
|
}
|
|
195
186
|
|
|
196
187
|
//#endregion
|
|
197
|
-
export {
|
|
188
|
+
export { primaryContact, primaryContactFactValue, projectCollectionRows, projectFactsView, readFrom, readRowMember, resolveContactCardField, rowMemberSources, singleUnitLabelDefault };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FACT_GRAPH, FactGraphName, FactMemberDescriptor, FactProjections, FactShapeDescriptor, FactValueType
|
|
1
|
+
import { FACT_GRAPH, FactGraphName, FactMemberDescriptor, FactProjections, FactShapeDescriptor, FactValueType } from "./slot-catalog.js";
|
|
2
2
|
//#region ../../internal/template-contracts/dist/facts-view.d.ts
|
|
3
3
|
type Graph = typeof FACT_GRAPH;
|
|
4
4
|
type ScalarType<V extends FactValueType> = V extends "number" ? number | null : V extends "boolean" ? boolean : V extends "text_list" ? readonly string[] : string | null;
|
|
@@ -13,25 +13,14 @@ type FactPoolName = { [K in FactGraphName]: Graph[K] extends {
|
|
|
13
13
|
type PoolRow<P extends FactPoolName> = Graph[P] extends {
|
|
14
14
|
row: infer R extends FactShapeDescriptor;
|
|
15
15
|
} ? R : never;
|
|
16
|
-
type RowBindableName<P extends FactPoolName> = { [K in FactGraphName]: Graph[K] extends {
|
|
17
|
-
role: "bindable";
|
|
18
|
-
path: `${P}[].${string}`;
|
|
19
|
-
} ? K : never; }[FactGraphName];
|
|
20
|
-
type BoundRowMember<P extends FactPoolName, K> = K extends FactGraphName ? Graph[K]["path"] extends `${P}[].${infer M}` ? M : never : never;
|
|
21
|
-
type BoundMembers<P extends FactPoolName> = { [K in RowBindableName<P>]: BoundRowMember<P, K>; }[RowBindableName<P>];
|
|
22
|
-
type ContainerOf<K extends FactGraphName> = Graph[K] extends {
|
|
23
|
-
container: infer C extends SourceFieldContainer;
|
|
24
|
-
} ? C : never;
|
|
25
|
-
type AliasNameFor<C, K> = C extends keyof FactProjections ? { [A in keyof FactProjections[C]]: FactProjections[C][A] extends K ? A : never; }[keyof FactProjections[C]] : never;
|
|
26
|
-
type AuthorFacingName<K extends FactGraphName> = [AliasNameFor<ContainerOf<K>, K>] extends [never] ? K : AliasNameFor<ContainerOf<K>, K>;
|
|
27
16
|
/**
|
|
28
17
|
* One row of pool `P`, as the derive-time view carries it: exactly the
|
|
29
|
-
* registry row descriptor's members, each
|
|
30
|
-
*
|
|
31
|
-
* `
|
|
32
|
-
*
|
|
18
|
+
* registry row descriptor's members, each under its author-facing name —
|
|
19
|
+
* `website`, stored as `website_url`; a comparable's `photo`, stored as
|
|
20
|
+
* `photo_upload_id` — so one spelling serves `fact.contact.*`, a row reference
|
|
21
|
+
* and the row.
|
|
33
22
|
*/
|
|
34
|
-
type FactsRow<P extends FactPoolName> = { readonly [
|
|
23
|
+
type FactsRow<P extends FactPoolName> = { readonly [M in keyof PoolRow<P>]: MemberType<PoolRow<P>[M]>; };
|
|
35
24
|
type EntryValue<K extends FactGraphName> = Graph[K] extends {
|
|
36
25
|
primary_of: infer P extends FactPoolName;
|
|
37
26
|
} ? FactsRow<P> | null : Graph[K] extends {
|
|
@@ -41,29 +41,10 @@ function authorFacingName(key, container) {
|
|
|
41
41
|
}
|
|
42
42
|
return key;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
for (const [key, entry] of Object.entries(FACT_GRAPH)) {
|
|
46
|
-
if (entry.role !== "bindable") continue;
|
|
47
|
-
const match = /^(\w+)\[\]\.(\w+)$/.exec(entry.path);
|
|
48
|
-
if (match === null) continue;
|
|
49
|
-
(ROW_BINDABLES[match[1]] ??= []).push({
|
|
50
|
-
name: authorFacingName(key, entry.container),
|
|
51
|
-
member: match[2]
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function rowValue(pool, shape, raw) {
|
|
44
|
+
function rowValue(shape, raw) {
|
|
55
45
|
const source = raw !== null && typeof raw === "object" ? raw : {};
|
|
56
|
-
const bound = ROW_BINDABLES[pool] ?? [];
|
|
57
|
-
const boundMembers = new Set(bound.map((b) => b.member));
|
|
58
46
|
const out = {};
|
|
59
|
-
for (const [member, desc] of Object.entries(shape))
|
|
60
|
-
if (boundMembers.has(member)) continue;
|
|
61
|
-
out[member] = memberValue(desc, source[member]);
|
|
62
|
-
}
|
|
63
|
-
for (const { name, member } of bound) {
|
|
64
|
-
const desc = shape[member];
|
|
65
|
-
out[name] = desc === void 0 ? null : memberValue(desc, source[member]);
|
|
66
|
-
}
|
|
47
|
+
for (const [member, desc] of Object.entries(shape)) out[member] = memberValue(desc, source[desc.path ?? member]);
|
|
67
48
|
return out;
|
|
68
49
|
}
|
|
69
50
|
const POOL_ORDER = { units: (rows) => [...rows].sort((a, b) => (num(a.position) ?? 0) - (num(b.position) ?? 0)) };
|
|
@@ -93,11 +74,11 @@ function projectFactsView(canonical) {
|
|
|
93
74
|
const poolEntry = FACT_GRAPH[pool];
|
|
94
75
|
const rows = poolRows(pool, entry.path);
|
|
95
76
|
const primary = POOL_PRIMARY[pool]?.(rows);
|
|
96
|
-
view[key] = primary === void 0 || poolEntry.row === void 0 ? null : rowValue(
|
|
77
|
+
view[key] = primary === void 0 || poolEntry.row === void 0 ? null : rowValue(poolEntry.row, primary);
|
|
97
78
|
continue;
|
|
98
79
|
}
|
|
99
80
|
if (entry.row !== void 0) {
|
|
100
|
-
target[key] = poolRows(key, entry.path).map((r) => rowValue(
|
|
81
|
+
target[key] = poolRows(key, entry.path).map((r) => rowValue(entry.row, r));
|
|
101
82
|
continue;
|
|
102
83
|
}
|
|
103
84
|
if (entry.fields !== void 0) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region ../../internal/template-contracts/dist/row-sources.js
|
|
2
|
+
function sourceRecord(source) {
|
|
3
|
+
return source !== null && typeof source === "object" ? source : null;
|
|
4
|
+
}
|
|
5
|
+
function rowMemberOf(source) {
|
|
6
|
+
const src = sourceRecord(source);
|
|
7
|
+
if (src?.["kind"] !== "row") return null;
|
|
8
|
+
return typeof src["field"] === "string" ? src["field"] : null;
|
|
9
|
+
}
|
|
10
|
+
function rowMemberSources(fields) {
|
|
11
|
+
const map = {};
|
|
12
|
+
for (const [key, field] of Object.entries(fields ?? {})) {
|
|
13
|
+
const member = rowMemberOf(field.source);
|
|
14
|
+
if (member !== null) map[key] = member;
|
|
15
|
+
}
|
|
16
|
+
return map;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { rowMemberOf, rowMemberSources };
|