@homepages/concrete 9.1.0 → 10.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 +52 -0
- package/README.md +1 -1
- package/codemods/manifest.json +10 -0
- package/codemods/registry-keys-only.mjs +113 -0
- package/codemods/steps/list-object-form.mjs +2 -3
- package/codemods/steps/registry-key-reads.mjs +276 -0
- package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
- package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/host.mjs +42 -42
- package/dist/cli/build/artifact.js +2 -1
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/check/render/inputs.js +3 -3
- package/dist/cli/check/stages/sections.js +5 -6
- package/dist/cli/dev/workspace-reader.js +9 -2
- package/dist/fixtures/media-store.js +3 -3
- package/dist/fixtures/resolve.js +24 -16
- package/dist/fixtures/synthesize-empties.js +3 -1
- package/dist/fixtures.d.ts +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -6
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +8 -4
- package/dist/packages/internal/fill-bake/dist/index.js +1 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +32 -6
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -5
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +4 -26
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/media-resolution/dist/document.js +16 -15
- package/dist/packages/internal/media-resolution/dist/image.js +38 -92
- package/dist/packages/internal/media-resolution/dist/index.js +1 -1
- package/dist/packages/internal/media-resolution/dist/list.js +11 -11
- package/dist/packages/internal/media-resolution/dist/media.js +17 -16
- package/dist/packages/internal/media-resolution/dist/records.js +4 -2
- package/dist/packages/internal/media-resolution/dist/slot.js +5 -5
- package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
- package/dist/packages/internal/media-resolution/dist/video.js +16 -16
- package/dist/packages/internal/property-facts/dist/registry-facts.js +8 -1
- package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +2 -3
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +5 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -1
- package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
- package/dist/packages/internal/section-contracts/dist/runners.js +1 -8
- package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
- package/dist/packages/internal/section-contracts/dist/source-contract.js +12 -8
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
- package/dist/packages/internal/source-resolution/dist/index.js +21 -188
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
- package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +10 -3
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
- package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/list.js +7 -15
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
- package/dist/packages/internal/template-contracts/dist/object.js +3 -2
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +5 -32
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +10 -6
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
- package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +4 -7
- package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/row.js +6 -7
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
- package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -702
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -498
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +2 -1
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
- package/dist/primitives/Image.d.ts +3 -3
- package/dist/primitives/slot-download.d.ts +1 -1
- package/dist/primitives/slot-media.d.ts +1 -1
- package/dist/schema/fact.d.ts +19 -52
- package/dist/schema/fact.js +6 -25
- package/dist/schema/facts-view.d.ts +1 -2
- package/dist/schema/property-facts.d.ts +1 -62
- package/dist/schema/section-schema.d.ts +2 -2
- package/dist/schema/section-schema.js +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 +2 -3
- package/package.json +1 -1
- package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +0 -1259
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { stampTableBounds } from "../../packages/internal/template-contracts/dist/
|
|
1
|
+
import { stampTableBounds } from "../../packages/internal/template-contracts/dist/registry-shape.js";
|
|
2
2
|
import { orgsForScope } from "../../template/define-template.js";
|
|
3
|
+
import "../../packages/internal/template-contracts/dist/table-members.js";
|
|
3
4
|
import { qualify } from "../../rules/registry.js";
|
|
4
5
|
import { isInsideRoot } from "../../platform/paths.js";
|
|
5
6
|
import { CONCRETE_CLI_VERSION } from "../version.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ASSET_URL_PREFIX, FIXTURE_FILES, fixturePath, isFixtureId } from "../../packages/internal/template-artifact/dist/layout.js";
|
|
1
|
+
import { ASSET_URL_PREFIX, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, fixturePath, isFixtureId } from "../../packages/internal/template-artifact/dist/layout.js";
|
|
2
2
|
import "../../packages/internal/template-artifact/dist/index.js";
|
|
3
3
|
import { assetContentType } from "../../packages/internal/template-artifact/dist/asset-mime.js";
|
|
4
4
|
import { mediaUrl } from "../../fixtures/property.js";
|
|
@@ -70,6 +70,7 @@ async function fixtureFiles(input) {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
files.set(fixturePath(fixture.id, FIXTURE_FILES.contentDoc), json(fixture.contentDoc));
|
|
73
|
+
if (fixture.settled !== void 0) files.set(fixturePath(fixture.id, FIXTURE_OPTIONAL_FILES.settledDoc), json({ instances: fixture.settled }));
|
|
73
74
|
files.set(fixturePath(fixture.id, FIXTURE_FILES.property), json({
|
|
74
75
|
facts: rewriteUrls(fixture.facts, urls),
|
|
75
76
|
media
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fixtureMediaRecords, fixtureMediaStore, resolveFixtureSlots } from "../../../fixtures/media-store.js";
|
|
2
2
|
import { resolveNav } from "./nav.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/check/render/inputs.ts
|
|
@@ -8,7 +8,7 @@ async function* renderInputs(composition, sections, corpus, assets) {
|
|
|
8
8
|
for (const entry of corpus) {
|
|
9
9
|
const { fixture } = entry;
|
|
10
10
|
const store = fixtureMediaStore(fixture.media);
|
|
11
|
-
const records =
|
|
11
|
+
const records = fixtureMediaRecords(fixture.facts, fixture.media, (path) => assets?.get(path)?.bytes);
|
|
12
12
|
const enabled = (instanceId) => fixture.contentDoc.instances.find((i) => i.instance_id === instanceId)?.enabled === true;
|
|
13
13
|
const navPages = manifest.pages.map((page) => ({
|
|
14
14
|
id: page.id,
|
|
@@ -39,7 +39,7 @@ async function* renderInputs(composition, sections, corpus, assets) {
|
|
|
39
39
|
slots: await resolveFixtureSlots({
|
|
40
40
|
slots: instance.slots,
|
|
41
41
|
declared: section.section.schema.slots,
|
|
42
|
-
|
|
42
|
+
records,
|
|
43
43
|
store
|
|
44
44
|
}),
|
|
45
45
|
nav: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { tableColumnOfKey } from "../../../packages/internal/template-contracts/dist/registry-shape.js";
|
|
1
|
+
import { tableColumnOfKey, tableKey, tableOf } from "../../../packages/internal/template-contracts/dist/registry-shape.js";
|
|
3
2
|
import { declaringModule } from "../../../section/section.js";
|
|
4
3
|
import "../../../packages/internal/template-contracts/dist/table-members.js";
|
|
5
4
|
import { isInsideRoot, workspacePath } from "../../../platform/paths.js";
|
|
@@ -29,7 +28,7 @@ function stampItemOrder(object) {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
function heldTables(slot) {
|
|
32
|
-
const rowTables = (row) => row?.type === "row" ? [row.from].flat().flatMap((key) =>
|
|
31
|
+
const rowTables = (row) => row?.type === "row" ? [row.from].flat().flatMap((key) => tableOf(key) ?? []) : [];
|
|
33
32
|
if (slot.type === "row") return new Set(rowTables(slot));
|
|
34
33
|
if (slot.type !== "list") return /* @__PURE__ */ new Set();
|
|
35
34
|
return /* @__PURE__ */ new Set([...rowTables(slot.element), ...Object.values(slot.element?.fields ?? {}).flatMap(rowTables)]);
|
|
@@ -41,11 +40,11 @@ function wholeTableReads(schema) {
|
|
|
41
40
|
if (slot.source?.kind === "derived") {
|
|
42
41
|
const held = heldTables(slot);
|
|
43
42
|
for (const read of slot.source.reads ?? []) {
|
|
44
|
-
const table = read.kind === "home" ?
|
|
45
|
-
if (table !== null && !held.has(table
|
|
43
|
+
const table = read.kind === "home" ? tableOf(read.key) : null;
|
|
44
|
+
if (table !== null && !held.has(table)) found.push([
|
|
46
45
|
path,
|
|
47
46
|
String(read.key),
|
|
48
|
-
|
|
47
|
+
tableKey(table)
|
|
49
48
|
]);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { stampTableBounds } from "../../packages/internal/template-contracts/dist/
|
|
1
|
+
import { stampTableBounds } from "../../packages/internal/template-contracts/dist/registry-shape.js";
|
|
2
2
|
import { isTemplate } from "../../template/define-template.js";
|
|
3
|
+
import "../../packages/internal/template-contracts/dist/table-members.js";
|
|
3
4
|
import { compileTemplateCss } from "../../css/compile.js";
|
|
4
5
|
import { materializeTemplate } from "../../template/materialize.js";
|
|
5
6
|
import { loadFixtures } from "../../fixtures/load.js";
|
|
6
|
-
import { resolveFixture } from "../../fixtures/resolve.js";
|
|
7
|
+
import { computeReadsSectionOf, resolveFixture } from "../../fixtures/resolve.js";
|
|
7
8
|
import { materializeSection } from "../../section/materialize.js";
|
|
8
9
|
import { loadTemplateModule } from "./load-template.js";
|
|
9
10
|
import { createElement } from "react";
|
|
@@ -51,6 +52,7 @@ function hostFixture(fixture, sizeOf) {
|
|
|
51
52
|
facts: fixture.facts,
|
|
52
53
|
media,
|
|
53
54
|
instances: fixture.contentDoc.instances,
|
|
55
|
+
...fixture.settled === void 0 ? {} : { settled: fixture.settled },
|
|
54
56
|
provenance: fixture.provenance
|
|
55
57
|
};
|
|
56
58
|
}
|
|
@@ -188,6 +190,11 @@ var DevWorkspace = class {
|
|
|
188
190
|
}
|
|
189
191
|
});
|
|
190
192
|
}
|
|
193
|
+
async computes(key) {
|
|
194
|
+
const section = (await this.loadComposition()).materialized.sections.get(key);
|
|
195
|
+
if (section === void 0) throw new Error(`The composition places no section "${key}".`);
|
|
196
|
+
return computeReadsSectionOf(section);
|
|
197
|
+
}
|
|
191
198
|
renderer() {
|
|
192
199
|
return {
|
|
193
200
|
section: async (key) => {
|
|
@@ -82,7 +82,7 @@ function serveSrcset(srcset, serve) {
|
|
|
82
82
|
return [serve(url), ...descriptors].join(" ");
|
|
83
83
|
}).join(", ");
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function fixtureMediaRecords(facts, media, sizeOf) {
|
|
86
86
|
const records = recordsOf(facts === null ? null : mediaRecords(facts));
|
|
87
87
|
const sized = /* @__PURE__ */ new Map();
|
|
88
88
|
for (const entry of media.values()) {
|
|
@@ -100,7 +100,7 @@ function fixtureAssetRecords(facts, media, sizeOf) {
|
|
|
100
100
|
async function resolveFixtureSlots(input) {
|
|
101
101
|
const ctx = {
|
|
102
102
|
store: input.store,
|
|
103
|
-
|
|
103
|
+
records: input.records,
|
|
104
104
|
resolvePoi: (value) => value
|
|
105
105
|
};
|
|
106
106
|
const out = {};
|
|
@@ -112,4 +112,4 @@ async function resolveFixtureSlots(input) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
//#endregion
|
|
115
|
-
export { cropRectOf,
|
|
115
|
+
export { cropRectOf, fixtureMediaRecords, fixtureMediaStore, resolveFixtureSlots };
|
package/dist/fixtures/resolve.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { normalizeAddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
|
|
2
|
-
import {
|
|
2
|
+
import { declaredKinds, isEmailValue, isIsoDateValue, isMediaType, isPhoneValue } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
3
3
|
import { getComputed } from "../packages/internal/template-contracts/dist/compute.js";
|
|
4
|
+
import { tableKey } from "../packages/internal/template-contracts/dist/registry-shape.js";
|
|
4
5
|
import { heldRowTableOf, listTableOf, placementOf, rowTablesOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
|
|
6
|
+
import "../packages/internal/template-contracts/dist/table-members.js";
|
|
5
7
|
import { fillSpecFromSchema } from "../schema/extract-fill-spec.js";
|
|
6
8
|
import { elementRowKeys, listSourceOf, memberSourceOf } from "../packages/internal/template-contracts/dist/row-sources.js";
|
|
7
9
|
import { objectFieldSlotId } from "../packages/internal/template-contracts/dist/slot-overrides.js";
|
|
@@ -95,10 +97,10 @@ function resolveFixture(loaded, options) {
|
|
|
95
97
|
const slots = {};
|
|
96
98
|
const provenanceOf = {};
|
|
97
99
|
for (const [id, def] of Object.entries(schemaSlots)) {
|
|
100
|
+
provenanceOf[id] = provenanceFor(def, id, values[id], instance.slots[id], facts);
|
|
98
101
|
const cases = def.variant?.cases;
|
|
99
102
|
if (cases !== void 0 && (instance.variant === void 0 || !cases.includes(instance.variant))) continue;
|
|
100
103
|
slots[id] = instance.slots[id];
|
|
101
|
-
provenanceOf[id] = provenanceFor(def, id, values[id], slots[id], facts);
|
|
102
104
|
}
|
|
103
105
|
instances.push({
|
|
104
106
|
instance_id: instance.instance_id,
|
|
@@ -118,11 +120,27 @@ function resolveFixture(loaded, options) {
|
|
|
118
120
|
facts,
|
|
119
121
|
media,
|
|
120
122
|
contentDoc: { instances },
|
|
123
|
+
settled: settled.instances,
|
|
121
124
|
provenance
|
|
122
125
|
},
|
|
123
126
|
violations
|
|
124
127
|
};
|
|
125
128
|
}
|
|
129
|
+
function computeReadsSectionOf(section, log) {
|
|
130
|
+
const { schema } = section;
|
|
131
|
+
return {
|
|
132
|
+
localKey: section.key,
|
|
133
|
+
schema: {
|
|
134
|
+
slots: schema.slots,
|
|
135
|
+
display: schema.meta.display ?? {}
|
|
136
|
+
},
|
|
137
|
+
bakeContext: {
|
|
138
|
+
computed: getComputed(schema),
|
|
139
|
+
section_key: section.key,
|
|
140
|
+
log
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
126
144
|
function pickDecisions(schema) {
|
|
127
145
|
try {
|
|
128
146
|
return fillSpecFromSchema(schema).decisions;
|
|
@@ -186,14 +204,7 @@ function fillInstance(placement, entry, ctx) {
|
|
|
186
204
|
slots,
|
|
187
205
|
...Object.keys(overrides).length === 0 ? {} : { display_overrides: overrides }
|
|
188
206
|
},
|
|
189
|
-
section:
|
|
190
|
-
localKey: section.key,
|
|
191
|
-
schema: {
|
|
192
|
-
slots: schema.slots,
|
|
193
|
-
display
|
|
194
|
-
},
|
|
195
|
-
bakeContext
|
|
196
|
-
},
|
|
207
|
+
section: computeReadsSectionOf(section, ctx.log),
|
|
197
208
|
values
|
|
198
209
|
};
|
|
199
210
|
}
|
|
@@ -285,9 +296,6 @@ function itemsValue(def, path, items, stated, decisions) {
|
|
|
285
296
|
return out;
|
|
286
297
|
});
|
|
287
298
|
}
|
|
288
|
-
function storedTableKey(key) {
|
|
289
|
-
return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
|
|
290
|
-
}
|
|
291
299
|
function provenanceFor(def, id, stated, value, facts) {
|
|
292
300
|
const source = def.source;
|
|
293
301
|
if (def.type === "object") return { kind: "authored" };
|
|
@@ -296,7 +304,7 @@ function provenanceFor(def, id, stated, value, facts) {
|
|
|
296
304
|
const table = heldRowTableOf(facts, rowTablesOf(def), typeof value === "string" ? value : null);
|
|
297
305
|
return table !== null ? {
|
|
298
306
|
kind: "fact",
|
|
299
|
-
ref:
|
|
307
|
+
ref: tableKey(table)
|
|
300
308
|
} : { kind: "empty" };
|
|
301
309
|
}
|
|
302
310
|
if (source?.kind === "home") return {
|
|
@@ -373,8 +381,8 @@ function mediaRef(def, value, ctx) {
|
|
|
373
381
|
});
|
|
374
382
|
return null;
|
|
375
383
|
}
|
|
376
|
-
return {
|
|
384
|
+
return { media: carried.id };
|
|
377
385
|
}
|
|
378
386
|
|
|
379
387
|
//#endregion
|
|
380
|
-
export { emptyValueFor, isEmptyValue, resolveFixture, uniquePlacements };
|
|
388
|
+
export { computeReadsSectionOf, emptyValueFor, isEmptyValue, resolveFixture, uniquePlacements };
|
|
@@ -3,6 +3,8 @@ import { emptyValueFor, isEmptyValue, uniquePlacements } from "./resolve.js";
|
|
|
3
3
|
//#region src/fixtures/synthesize-empties.ts
|
|
4
4
|
function synthesizeEmptyFixtures(resolved, placements) {
|
|
5
5
|
const out = [];
|
|
6
|
+
const base = { ...resolved };
|
|
7
|
+
delete base.settled;
|
|
6
8
|
for (const placement of uniquePlacements(placements)) {
|
|
7
9
|
const instance = resolved.contentDoc.instances.find((i) => i.instance_id === placement.instance);
|
|
8
10
|
if (instance === void 0) continue;
|
|
@@ -10,7 +12,7 @@ function synthesizeEmptyFixtures(resolved, placements) {
|
|
|
10
12
|
if (!(slot in instance.slots) || isEmptyValue(instance.slots[slot], def.type)) continue;
|
|
11
13
|
const empty = emptyValueFor(def.type);
|
|
12
14
|
out.push({
|
|
13
|
-
...
|
|
15
|
+
...base,
|
|
14
16
|
id: `${resolved.id}/empty/${placement.instance}/${slot}`,
|
|
15
17
|
label: `${resolved.label}: ${placement.instance}.${slot} = ${Array.isArray(empty) ? "empty" : "null"}`,
|
|
16
18
|
synthesized: true,
|
package/dist/fixtures.d.ts
CHANGED
|
@@ -318,7 +318,7 @@ type ContentItem<F> = {
|
|
|
318
318
|
* `{ contact: listingAgent, field: "logo_dark" }`. A contact's headshot and logos are image
|
|
319
319
|
* media like any other, but the platform holds them on the card rather than in a pool, so
|
|
320
320
|
* they have no entry of their own to state — this names the same image the resolver
|
|
321
|
-
* registers, and it resolves to the `{
|
|
321
|
+
* registers, and it resolves to the `{ media }` reference the platform bakes for that field. A contact the property does not carry, or a field it holds `null`, is a check
|
|
322
322
|
* error like any other media the property lacks.
|
|
323
323
|
*/
|
|
324
324
|
interface ContactImageEntry {
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { ObjectLabelField, ObjectLabelSource, ObjectSlotDef, object } from "./pa
|
|
|
21
21
|
import { RowFill, RowSlotDef, RowSourceInput, TableSource, row } from "./packages/internal/template-contracts/dist/row.js";
|
|
22
22
|
import { ListFill, ListSlotDef, ListSourceInput, list } from "./packages/internal/template-contracts/dist/list.js";
|
|
23
23
|
import { DocumentMedia, ImageMedia, Media, TourMedia, VideoMedia } from "./packages/internal/template-contracts/dist/registry-facts.js";
|
|
24
|
-
import {
|
|
24
|
+
import { Coordinates } from "./schema/property-facts.js";
|
|
25
25
|
import "./schema/section-schema.js";
|
|
26
26
|
import { UseEditorResult, useEditor } from "./packages/internal/island-runtime/dist/use-editor.js";
|
|
27
27
|
import { useCaptureReady } from "./packages/internal/island-runtime/dist/use-capture-ready.js";
|
|
@@ -43,9 +43,8 @@ import { Video } from "./primitives/Video.js";
|
|
|
43
43
|
import { Slot } from "./primitives/slot.js";
|
|
44
44
|
import "./primitives/index.js";
|
|
45
45
|
import { ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE } from "./packages/internal/template-contracts/dist/markers.js";
|
|
46
|
-
import {
|
|
46
|
+
import { DerivedFactRef, FactNamespace, RegistryFactRef, fact } from "./schema/fact.js";
|
|
47
47
|
import { FactsCommercialSpace, FactsComparable, FactsContact, FactsUnit } from "./schema/facts-view.js";
|
|
48
|
-
import { DerivedFactRef, DirectFactRef, FactNamespace, RegistryFactRef, fact } from "./schema/fact.js";
|
|
49
48
|
import { presets } from "./schema/format-presets.js";
|
|
50
49
|
import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost } from "./schema/formats.js";
|
|
51
50
|
//#region src/index.d.ts
|
|
@@ -59,4 +58,4 @@ import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, insta
|
|
|
59
58
|
*/
|
|
60
59
|
declare const CONCRETE_VERSION: string;
|
|
61
60
|
//#endregion
|
|
62
|
-
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, type AddressMembers, type AddressSlot, type AddressSlotDef, type AddressValue, type AuthorImage, type AutocropInput, type AutocropProcess, type BoundSlotValue, CONCRETE_VERSION, type CanvasInput, type CanvasesInput, type
|
|
61
|
+
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, type AddressMembers, type AddressSlot, type AddressSlotDef, type AddressValue, type AuthorImage, type AutocropInput, type AutocropProcess, type BoundSlotValue, CONCRETE_VERSION, type CanvasInput, type CanvasesInput, type ComputeBinding, type Coordinates, type CropConfig, type CutoutProcess, type DateSlot, type DateSlotDef, type DefineTemplateInput, type DerivedFactRef, type DisplayEntryInput, type DisplayFill, type DocumentCollectionValue, type DocumentFormat, type DocumentMedia, type DocumentSlot, type DocumentSlotDef, type DocumentValue, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, type ElementOf, type ElementRef, type EmailSlot, type EmailSlotDef, type FactNamespace, type FactsCommercialSpace, type FactsComparable, type FactsContact, type FactsUnit, type FieldBinding, type FieldBindings, type FillBinding, type FillVerb, type FindFill, type FindInput, type FormatIdentity, FrameShell, type HolderProcess, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, type IconName, Image, type ImageCollectionValue, type ImageFormat, type ImageMedia, type ImageSlot, type ImageSlotDef, type ImageValue, IslandComponent, IslandEditor, IslandEditorOptions, IslandMarker, type IslandMarkerProps, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, type ItemBinding, type ItemIdentity, type ListFill, type ListItemSlot, type ListSlot, type ListSlotDef, type ListSourceInput, type Media, type MediaSlot, type MediaSlotDef, type MediaValue, type NumberSlot, type NumberSlotDef, type ObjectBinding, type ObjectFieldSlot, type ObjectLabelField, type ObjectLabelSource, type ObjectSlot, type ObjectSlotDef, type ObjectValue, type OutputClass, type PageComponent, type PhoneSlot, type PhoneSlotDef, type PhysicalLength, type PickFill, type PickInput, type PicturePlan, type PictureSourceSpec, type PlaybackConfig, type PoiPhoto, type PoiRow, type PoiSlot, type PoiSlotDef, type RegistryFactRef, type RenderedPage, type ResponsiveImage, type ResponsiveSource, type RowFill, type RowId, type RowRef, type RowSlot, type RowSlotDef, type RowSourceInput, Section, type SectionContractProps, type SectionOptions, type SectionPlacementProps, type SectionRenderBindings, type SectionValue, type SelectOptionInput, type SelectOptionObject, type SelectSlot, type SelectSlotDef, Slot, type SlotBinding, type SlotBindingMap, type SlotRef, type SlotSource, type SlotValue, type TableRow, type TableSource, type TemplateCanvas, type TemplatePage, type TemplatePreview, type TemplateScope, type TemplateValue, type TextSlot, type TextSlotDef, Tour, type TourCollectionValue, type TourMedia, type TourSlot, type TourSlotDef, type TourValue, type UrlSlot, type UrlSlotDef, type UseEditorResult, type ValueBinding, type ValueSlot, Video, type VideoCollectionValue, type VideoMedia, type VideoSlot, type VideoSlotDef, type VideoValue, type WebsiteFormat, type WebsitePage, type WriteFill, type WriteInput, a4Landscape, a4Portrait, address, bindItems, compute, date, deck16x9, defineTemplate, deserializeIslandProps, document, email, facebookPost, fact, fill, halfLetterFlyer, image, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, media, number, object, phone, poi, postcard6x4, postcard7x5, presets, holderProcess as process, row, section, select, serializeIslandProps, text, tour, url, useCaptureReady, useEditor, useIslandId, video, website, xPost };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
|
|
2
|
-
import { DISPLAY_ENTRIES
|
|
2
|
+
import { DISPLAY_ENTRIES } from "../../template-contracts/dist/slot-catalog.js";
|
|
3
3
|
import { storedAsRefs } from "../../template-contracts/dist/registry-facts.js";
|
|
4
|
+
import { tableOf } from "../../template-contracts/dist/registry-shape.js";
|
|
4
5
|
import { attributedRows, heldRowTableOf, holderOf, isHolderKind, listTableOf, rowTablesOf } from "../../template-contracts/dist/ref-locate.js";
|
|
6
|
+
import "../../template-contracts/dist/table-members.js";
|
|
5
7
|
import { elementRowKeys, listSourceOf, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
6
8
|
import { objectFieldOf, objectFieldSlotId } from "../../template-contracts/dist/slot-overrides.js";
|
|
7
|
-
import { projectTableRows,
|
|
9
|
+
import { projectTableRows, readFactRef, tableRowIds } from "../../source-resolution/dist/index.js";
|
|
8
10
|
import { callDerived, readsAnySlot } from "./derive-source.js";
|
|
9
11
|
import { declaredDisplay } from "./display.js";
|
|
10
|
-
import { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList,
|
|
12
|
+
import { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList, readResolvedRowMember, rowIdentity, storedElements } from "./list-grammar.js";
|
|
11
13
|
|
|
12
14
|
//#region ../../internal/fill-bake/dist/bake-property-ref.js
|
|
13
15
|
function boundFactKey(def) {
|
|
@@ -17,9 +19,9 @@ function boundFactKey(def) {
|
|
|
17
19
|
return typeof src["key"] === "string" ? src["key"] : null;
|
|
18
20
|
}
|
|
19
21
|
function resolveDirectField(field, facts, fields, rowComputes) {
|
|
20
|
-
const table =
|
|
22
|
+
const table = tableOf(field);
|
|
21
23
|
if (table !== null) return storedAsRefs(projectTableRows(table, facts, fields, rowComputes));
|
|
22
|
-
return storedAsRefs(
|
|
24
|
+
return storedAsRefs(readFactRef(facts, field) ?? null);
|
|
23
25
|
}
|
|
24
26
|
function derivedSource(def) {
|
|
25
27
|
if (def.source === null || def.source === void 0 || typeof def.source !== "object") return null;
|
|
@@ -175,7 +177,7 @@ function bakeObjectFields(name, def, bakeRows, facts, ctx, scope) {
|
|
|
175
177
|
if (nested !== void 0 && member !== null) {
|
|
176
178
|
const row = rowInScopeAt(bakeRows, path)(member.slot);
|
|
177
179
|
if (row === void 0) continue;
|
|
178
|
-
out[key] = projectNestedList(
|
|
180
|
+
out[key] = projectNestedList(readResolvedRowMember(row, member.field, facts), nested, facts);
|
|
179
181
|
continue;
|
|
180
182
|
}
|
|
181
183
|
const baked = bakeValueSlot(path, field, facts, ctx, bakeRows);
|
|
@@ -2,7 +2,7 @@ import { normalizeAddressValue } from "../../template-contracts/dist/address-val
|
|
|
2
2
|
import { DISPLAY_ENTRIES } from "../../template-contracts/dist/slot-catalog.js";
|
|
3
3
|
import { heldRowTableOf, holderOf, mirrorRefOf, rowTablesOf, sectionSlotAt, slotTableOf } from "../../template-contracts/dist/ref-locate.js";
|
|
4
4
|
import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
5
|
-
import { isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId } from "../../template-contracts/dist/slot-overrides.js";
|
|
5
|
+
import { isOrderOverridden, isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId } from "../../template-contracts/dist/slot-overrides.js";
|
|
6
6
|
import { declaredSlotRefs } from "./derive-source.js";
|
|
7
7
|
import { declaredDisplay } from "./display.js";
|
|
8
8
|
import { computedRow, isGrammarList, objectElementFields, projectElements, readResolvedRowMember } from "./list-grammar.js";
|
|
@@ -95,7 +95,8 @@ function applyComputeReads(input) {
|
|
|
95
95
|
freshSource: items,
|
|
96
96
|
overrides: itemOverridesForSlot(inst.slot_overrides, decl.key),
|
|
97
97
|
generatedFields: [],
|
|
98
|
-
membership: "source"
|
|
98
|
+
membership: "source",
|
|
99
|
+
ordered: isOrderOverridden(inst.slot_overrides, decl.key)
|
|
99
100
|
});
|
|
100
101
|
};
|
|
101
102
|
const memberAt = (instanceId, rowPath, field) => {
|
|
@@ -131,7 +132,10 @@ function applyComputeReads(input) {
|
|
|
131
132
|
return path === void 0 ? void 0 : memberAt(decl.instanceId, path, member)?.value;
|
|
132
133
|
};
|
|
133
134
|
const valueOf = (inst, decl) => {
|
|
134
|
-
if (decl.kind === "reader")
|
|
135
|
+
if (decl.kind === "reader") {
|
|
136
|
+
const member = memberAt(decl.instanceId, decl.rowPath, decl.field);
|
|
137
|
+
return member === void 0 ? void 0 : { value: mergeLinkedValue(storedRefValue(inst, decl.key), member.value) };
|
|
138
|
+
}
|
|
135
139
|
if (decl.kind === "mirror") {
|
|
136
140
|
const upstreamInstance = targetOf(decl, decl.ref);
|
|
137
141
|
const upstream = readStored(upstreamInstance, decl.ref.slot);
|
|
@@ -144,7 +148,7 @@ function applyComputeReads(input) {
|
|
|
144
148
|
});
|
|
145
149
|
return { value: row.id };
|
|
146
150
|
}
|
|
147
|
-
if (decl.def.type !== "list") return { value: upstream ?? null };
|
|
151
|
+
if (decl.def.type !== "list") return { value: mergeLinkedValue(storedRefValue(inst, decl.key), upstream ?? null) };
|
|
148
152
|
const items = projectElements(identifiedElements(Array.isArray(upstream) ? upstream : [], table), projectionOf(decl, table));
|
|
149
153
|
return { value: listValue(inst, decl, table, items) };
|
|
150
154
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { projectTableRows, readFactRef, readRowMember } from "../../source-resolution/dist/index.js";
|
|
2
2
|
import { callDerived, declaredReads, declaredSlotRefs, readsAnySlot } from "./derive-source.js";
|
|
3
3
|
import { declaredDisplay } from "./display.js";
|
|
4
|
-
import { decisionProducing, isGrammarList, objectElementFields, readResolvedRowMember,
|
|
4
|
+
import { decisionProducing, isGrammarList, objectElementFields, readResolvedRowMember, rowIdentity } from "./list-grammar.js";
|
|
5
5
|
import { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource, identifiedElements, resolveDerivedHandle, resolveDirectField, rowComputesOf, topLevelRowReader } from "./bake-property-ref.js";
|
|
6
6
|
import { mergeLinkedValue } from "./linked-merge.js";
|
|
7
7
|
import { mergeSourcedItems } from "./item-merge.js";
|
|
@@ -47,11 +47,14 @@ function mergeSourcedItems(input) {
|
|
|
47
47
|
const id = cur[idKey];
|
|
48
48
|
if (typeof id === "string") currentById.set(id, cur);
|
|
49
49
|
}
|
|
50
|
-
if (membership === "source")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (membership === "source") {
|
|
51
|
+
if (input.ordered === true) return mergeOrderedSourceItems(current, freshSource, input, idKey);
|
|
52
|
+
return freshSource.map((fresh) => {
|
|
53
|
+
const id = fresh[idKey];
|
|
54
|
+
const cur = typeof id === "string" ? currentById.get(id) : void 0;
|
|
55
|
+
return cur === void 0 ? fresh : mergeItem(cur, fresh, overrides?.[id], generatedFields, idKey, true);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
55
58
|
const freshById = /* @__PURE__ */ new Map();
|
|
56
59
|
for (const fresh of freshSource) {
|
|
57
60
|
const id = fresh[idKey];
|
|
@@ -63,8 +66,30 @@ function mergeSourcedItems(input) {
|
|
|
63
66
|
return fresh === void 0 ? cur : mergeItem(cur, fresh, overrides?.[id], generatedFields, idKey, true);
|
|
64
67
|
});
|
|
65
68
|
}
|
|
69
|
+
function mergeOrderedSourceItems(current, freshSource, input, idKey) {
|
|
70
|
+
const freshById = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const fresh of freshSource) {
|
|
72
|
+
const id = fresh[idKey];
|
|
73
|
+
if (typeof id === "string") freshById.set(id, fresh);
|
|
74
|
+
}
|
|
75
|
+
const out = [];
|
|
76
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
77
|
+
for (const cur of current) {
|
|
78
|
+
const id = cur[idKey];
|
|
79
|
+
const fresh = typeof id === "string" ? freshById.get(id) : void 0;
|
|
80
|
+
if (fresh === void 0 || emitted.has(id)) continue;
|
|
81
|
+
out.push(mergeItem(cur, fresh, input.overrides?.[id], input.generatedFields, idKey, true));
|
|
82
|
+
emitted.add(id);
|
|
83
|
+
}
|
|
84
|
+
for (const fresh of freshSource) {
|
|
85
|
+
const id = fresh[idKey];
|
|
86
|
+
if (typeof id === "string" && emitted.has(id)) continue;
|
|
87
|
+
out.push(fresh);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
66
91
|
function mergeTableItems(input) {
|
|
67
|
-
const { current, freshSource, overrides, removed, generatedFields, idKey } = input;
|
|
92
|
+
const { current, freshSource, overrides, removed, generatedFields, idKey, ordered } = input;
|
|
68
93
|
const freshById = /* @__PURE__ */ new Map();
|
|
69
94
|
for (const f of freshSource) {
|
|
70
95
|
const id = f[idKey];
|
|
@@ -89,6 +114,7 @@ function mergeTableItems(input) {
|
|
|
89
114
|
if (removed?.[id] === true) continue;
|
|
90
115
|
out.push(fresh);
|
|
91
116
|
}
|
|
117
|
+
if (ordered === true) return out;
|
|
92
118
|
const freshIndex = /* @__PURE__ */ new Map();
|
|
93
119
|
freshSource.forEach((f, i) => {
|
|
94
120
|
const id = f[idKey];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
1
2
|
import { elementIdentity } from "../../template-contracts/dist/ref-locate.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/fill-bake/dist/linked-merge.js
|
|
4
5
|
const isFields = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
return typeof value["asset_id"] === "string" && value["asset_id"] !== "" ? value["asset_id"] : null;
|
|
6
|
+
function mediaOf(value) {
|
|
7
|
+
return contentMediaIdOf(value) ?? null;
|
|
8
8
|
}
|
|
9
9
|
function mergeLinkedValue(current, fresh) {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
10
|
+
const media = mediaOf(fresh);
|
|
11
|
+
if (media !== null) return mediaOf(current) === media ? current : fresh;
|
|
12
12
|
if (Array.isArray(fresh)) return Array.isArray(current) ? mergeLinkedList(current, fresh) : fresh;
|
|
13
13
|
if (isFields(fresh)) return isFields(current) ? mergeLinkedFields(current, fresh) : fresh;
|
|
14
14
|
return fresh;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
|
|
2
2
|
import { storedAsRefs } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { attributedRows, elementIdentity } from "../../template-contracts/dist/ref-locate.js";
|
|
4
|
-
import {
|
|
5
|
-
import { elementRowKeys, memberSourceOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
|
|
4
|
+
import { elementRowKeys, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
6
5
|
import { projectTableRows, readRowMember } from "../../source-resolution/dist/index.js";
|
|
7
6
|
|
|
8
7
|
//#region ../../internal/fill-bake/dist/list-grammar.js
|
|
@@ -19,7 +18,7 @@ function decisionProducing(scope, path) {
|
|
|
19
18
|
function rowIdentity(element, table) {
|
|
20
19
|
if (typeof element === "string") return element === "" ? null : element;
|
|
21
20
|
if (table !== null && isRecord(element)) {
|
|
22
|
-
const id = element[
|
|
21
|
+
const id = element["id"];
|
|
23
22
|
if (typeof id === "string" && id !== "") return id;
|
|
24
23
|
}
|
|
25
24
|
return elementIdentity(element, table);
|
|
@@ -43,12 +42,6 @@ function computedRow(element, tables, facts) {
|
|
|
43
42
|
id: rowIdentity(element, first)
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
|
-
function registryReadingOf(table) {
|
|
47
|
-
return {
|
|
48
|
-
table: table.table,
|
|
49
|
-
reading: "registry"
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
45
|
function readResolvedRowMember(row, member, facts) {
|
|
53
46
|
if (row.table !== null) return row.id === null ? null : storedAsRefs(readRowMember(row.table, row.id, member, facts));
|
|
54
47
|
return isRecord(row.element) ? row.element[member] ?? null : null;
|
|
@@ -75,16 +68,9 @@ function projectElements(elements, projection) {
|
|
|
75
68
|
const fields = element.type === "object" ? element.fields ?? {} : void 0;
|
|
76
69
|
if (table !== null) {
|
|
77
70
|
if (fields === void 0) return elements.map((identified) => identified.id);
|
|
78
|
-
const members = rowMemberSources(fields);
|
|
79
71
|
return elements.flatMap(({ element: held, id }) => {
|
|
80
|
-
const
|
|
81
|
-
const [projected] = storedAsRefs(projectTableRows(table, facts, fields, computes, [rowId]));
|
|
72
|
+
const [projected] = storedAsRefs(projectTableRows(table, facts, fields, computes, [typeof held === "string" ? held : id]));
|
|
82
73
|
if (projected === void 0) return [];
|
|
83
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
84
|
-
const nested = nestedItemOf(field);
|
|
85
|
-
const member = members[key];
|
|
86
|
-
if (nested !== void 0 && member !== void 0 && readsElementRows(nested)) projected[key] = storedAsRefs(readRowMember(registryReadingOf(table), rowId, member, facts));
|
|
87
|
-
}
|
|
88
74
|
return [withNestedLists({
|
|
89
75
|
...projected,
|
|
90
76
|
id
|
|
@@ -98,14 +84,6 @@ function projectElements(elements, projection) {
|
|
|
98
84
|
function nestedItemOf(def) {
|
|
99
85
|
return isGrammarList(def) && def.element?.type === "object" ? def.element : void 0;
|
|
100
86
|
}
|
|
101
|
-
function readsElementRows(declaration) {
|
|
102
|
-
const fields = declaration.fields ?? {};
|
|
103
|
-
return elementRowKeys(fields).length > 0 || Object.keys(rowMemberSources(fields)).length > 0;
|
|
104
|
-
}
|
|
105
|
-
function readNestedMember(row, member, nestedItem, facts) {
|
|
106
|
-
if (row.table !== null && row.id !== null && readsElementRows(nestedItem)) return storedAsRefs(readRowMember(registryReadingOf(row.table), row.id, member, facts));
|
|
107
|
-
return readResolvedRowMember(row, member, facts);
|
|
108
|
-
}
|
|
109
87
|
function projectNestedList(value, nestedItem, facts) {
|
|
110
88
|
if (!Array.isArray(value)) return value;
|
|
111
89
|
const ids = contentIdentities(value);
|
|
@@ -171,4 +149,4 @@ function storedElements(stored, fields, table) {
|
|
|
171
149
|
}
|
|
172
150
|
|
|
173
151
|
//#endregion
|
|
174
|
-
export { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList,
|
|
152
|
+
export { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList, readResolvedRowMember, rowIdentity, storedElements };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
1
2
|
import { readLadder } from "./store.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/media-resolution/dist/document.js
|
|
@@ -15,7 +16,7 @@ async function withPreview(out, previewKey, store) {
|
|
|
15
16
|
out.poster = await store.fileUrl(previewKey);
|
|
16
17
|
} catch (err) {
|
|
17
18
|
store.log?.warn({
|
|
18
|
-
|
|
19
|
+
media_id: out.asset_id,
|
|
19
20
|
err: err.message
|
|
20
21
|
}, "resolve-document-slot: preview presign failed; no poster");
|
|
21
22
|
return out;
|
|
@@ -24,35 +25,35 @@ async function withPreview(out, previewKey, store) {
|
|
|
24
25
|
if (responsive) out.poster_responsive = responsive;
|
|
25
26
|
return out;
|
|
26
27
|
}
|
|
27
|
-
async function resolveDocumentSlot(value,
|
|
28
|
+
async function resolveDocumentSlot(value, records, store) {
|
|
28
29
|
if (value === null) return null;
|
|
29
30
|
if (typeof value !== "object") return DEFAULT;
|
|
30
31
|
const v = value;
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
store.log?.warn({
|
|
32
|
+
const mediaId = contentMediaIdOf(v) ?? "";
|
|
33
|
+
if (!mediaId) return DEFAULT;
|
|
34
|
+
const record = records.get(mediaId);
|
|
35
|
+
if (record === void 0) {
|
|
36
|
+
store.log?.warn({ media_id: mediaId }, "resolve-document-slot: no media the render may reach");
|
|
36
37
|
return DEFAULT;
|
|
37
38
|
}
|
|
38
|
-
const key =
|
|
39
|
+
const key = record.key;
|
|
39
40
|
if (key === null) {
|
|
40
|
-
store.log?.warn({
|
|
41
|
+
store.log?.warn({ media_id: mediaId }, "resolve-document-slot: media has no stored object");
|
|
41
42
|
return DEFAULT;
|
|
42
43
|
}
|
|
43
44
|
try {
|
|
44
|
-
const filename =
|
|
45
|
+
const filename = (v.picked === null && typeof v.name === "string" && v.name !== "" ? v.name : null) ?? record.name;
|
|
45
46
|
return await withPreview({
|
|
46
|
-
asset_id:
|
|
47
|
+
asset_id: mediaId,
|
|
47
48
|
url: store.namedFileUrl ? await store.namedFileUrl(key, filename) : await store.fileUrl(key),
|
|
48
49
|
filename,
|
|
49
|
-
content_type:
|
|
50
|
-
size_bytes:
|
|
50
|
+
content_type: record.mime ?? "",
|
|
51
|
+
size_bytes: record.bytes ?? 0,
|
|
51
52
|
poster: ""
|
|
52
|
-
},
|
|
53
|
+
}, record.renditions.poster?.key ?? null, store);
|
|
53
54
|
} catch (err) {
|
|
54
55
|
store.log?.error({
|
|
55
|
-
|
|
56
|
+
media_id: mediaId,
|
|
56
57
|
err: err.message
|
|
57
58
|
}, "resolve-document-slot: presign failed; soft-empty document");
|
|
58
59
|
return DEFAULT;
|