@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.
Files changed (118) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +1 -1
  3. package/codemods/manifest.json +10 -0
  4. package/codemods/registry-keys-only.mjs +113 -0
  5. package/codemods/steps/list-object-form.mjs +2 -3
  6. package/codemods/steps/registry-key-reads.mjs +276 -0
  7. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
  8. package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
  9. package/dist/artifact/playground/client/index.html +2 -2
  10. package/dist/artifact/playground/host.mjs +42 -42
  11. package/dist/cli/build/artifact.js +2 -1
  12. package/dist/cli/build/fixtures.js +2 -1
  13. package/dist/cli/check/render/inputs.js +3 -3
  14. package/dist/cli/check/stages/sections.js +5 -6
  15. package/dist/cli/dev/workspace-reader.js +9 -2
  16. package/dist/fixtures/media-store.js +3 -3
  17. package/dist/fixtures/resolve.js +24 -16
  18. package/dist/fixtures/synthesize-empties.js +3 -1
  19. package/dist/fixtures.d.ts +1 -1
  20. package/dist/index.d.ts +3 -4
  21. package/dist/packages/external/concrete/package.js +1 -1
  22. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -6
  23. package/dist/packages/internal/fill-bake/dist/compute-reads.js +8 -4
  24. package/dist/packages/internal/fill-bake/dist/index.js +1 -1
  25. package/dist/packages/internal/fill-bake/dist/item-merge.js +32 -6
  26. package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -5
  27. package/dist/packages/internal/fill-bake/dist/list-grammar.js +4 -26
  28. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  29. package/dist/packages/internal/media-resolution/dist/document.js +16 -15
  30. package/dist/packages/internal/media-resolution/dist/image.js +38 -92
  31. package/dist/packages/internal/media-resolution/dist/index.js +1 -1
  32. package/dist/packages/internal/media-resolution/dist/list.js +11 -11
  33. package/dist/packages/internal/media-resolution/dist/media.js +17 -16
  34. package/dist/packages/internal/media-resolution/dist/records.js +4 -2
  35. package/dist/packages/internal/media-resolution/dist/slot.js +5 -5
  36. package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
  37. package/dist/packages/internal/media-resolution/dist/video.js +16 -16
  38. package/dist/packages/internal/property-facts/dist/registry-facts.js +8 -1
  39. package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
  40. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +2 -3
  41. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +5 -3
  42. package/dist/packages/internal/section-contracts/dist/index.js +0 -1
  43. package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
  44. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  45. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +4 -2
  46. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
  47. package/dist/packages/internal/section-contracts/dist/runners.js +1 -8
  48. package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
  49. package/dist/packages/internal/section-contracts/dist/source-contract.js +12 -8
  50. package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
  51. package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
  52. package/dist/packages/internal/source-resolution/dist/index.js +21 -188
  53. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  54. package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
  55. package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
  56. package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
  57. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
  58. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
  59. package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
  60. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
  61. package/dist/packages/internal/template-contracts/dist/fact-registry.js +10 -3
  62. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
  63. package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
  64. package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
  65. package/dist/packages/internal/template-contracts/dist/list.js +7 -15
  66. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
  67. package/dist/packages/internal/template-contracts/dist/object.js +3 -2
  68. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
  69. package/dist/packages/internal/template-contracts/dist/read-graph.js +5 -32
  70. package/dist/packages/internal/template-contracts/dist/ref-locate.js +10 -6
  71. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +1 -1
  72. package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
  73. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
  74. package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
  75. package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
  76. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +4 -7
  77. package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
  78. package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -3
  79. package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
  80. package/dist/packages/internal/template-contracts/dist/row.js +6 -7
  81. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
  82. package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
  83. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
  84. package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
  85. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -702
  86. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -498
  87. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
  88. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
  89. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +2 -1
  90. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
  91. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
  92. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
  93. package/dist/primitives/Image.d.ts +3 -3
  94. package/dist/primitives/slot-download.d.ts +1 -1
  95. package/dist/primitives/slot-media.d.ts +1 -1
  96. package/dist/schema/fact.d.ts +19 -52
  97. package/dist/schema/fact.js +6 -25
  98. package/dist/schema/facts-view.d.ts +1 -2
  99. package/dist/schema/property-facts.d.ts +1 -62
  100. package/dist/schema/section-schema.d.ts +2 -2
  101. package/dist/schema/section-schema.js +1 -1
  102. package/guide/reference/cli/INDEX.md +2 -2
  103. package/guide/reference/cli/build.md +1 -1
  104. package/guide/reference/cli/check.md +1 -1
  105. package/guide/reference/cli/dev.md +1 -1
  106. package/guide/reference/cli/property-add.md +1 -1
  107. package/guide/reference/cli/property-list.md +1 -1
  108. package/guide/reference/cli/publish.md +1 -1
  109. package/guide/reference/cli/upgrade.md +1 -1
  110. package/guide/reference/rules/INDEX.md +2 -3
  111. package/package.json +1 -1
  112. package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +0 -1259
  113. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
  114. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
  115. package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
  116. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
  117. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
  118. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
@@ -1,16 +1,18 @@
1
1
  import { ADDRESS_MEMBERS, isAddressMember } from "../../template-contracts/dist/address-value.js";
2
+ import { tableKey } from "../../template-contracts/dist/registry-shape.js";
2
3
  import { rowTableOf } from "../../template-contracts/dist/ref-locate.js";
4
+ import "../../template-contracts/dist/table-members.js";
3
5
  import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
4
6
  import { fillOf, grammarSlots, insideItem, slotInScope } from "./grammar-scope.js";
5
7
  import { fittingTypes, memberFits, refuseIndexedRow } from "./source-contract.js";
6
- import { tableKeySpelling, tableMemberOrRefuse } from "./table-member.js";
8
+ import { tableMemberOrRefuse } from "./table-member.js";
7
9
 
8
10
  //#region ../../internal/section-contracts/dist/row-rule-contract.js
9
11
  const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
10
12
  function memberOf(table, field, where) {
11
13
  return tableMemberOrRefuse(table, field, where, {
12
14
  noun: "member",
13
- identity: `"${field}" is the "${tableKeySpelling(table)}" row's identity, which the row slot's value already is — read a member of the row instead.`
15
+ identity: `"${field}" is the "${tableKey(table)}" row's identity, which the row slot's value already is — read a member of the row instead.`
14
16
  });
15
17
  }
16
18
  function resolveHolder(ctx, reader, rowKey, where) {
@@ -1,5 +1,4 @@
1
- import { TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
2
- import { memberListOfKey } from "../../template-contracts/dist/registry-shape.js";
1
+ import { memberListOfKey, tableKey, tableNames, tableOf } from "../../template-contracts/dist/registry-shape.js";
3
2
  import { listSourceRefusal } from "../../template-contracts/dist/row.js";
4
3
  import "../../template-contracts/dist/table-members.js";
5
4
  import { elementTableOf, fillOf, grammarSlots, insideItem, sameSectionSlot, sectionSlotAt } from "./grammar-scope.js";
@@ -8,24 +7,24 @@ import { elementTableOf, fillOf, grammarSlots, insideItem, sameSectionSlot, sect
8
7
  const ORIGINS = "the element inside an item, a row slot, a `compute()`, or a `fill.pick`";
9
8
  function originTable(ctx, row) {
10
9
  const source = row.def.source;
11
- if (source?.kind === "element" && row.container !== void 0) return elementTableOf(ctx, row.container)?.table ?? null;
10
+ if (source?.kind === "element" && row.container !== void 0) return elementTableOf(ctx, row.container);
12
11
  if (source?.kind !== "section") return null;
13
12
  const target = sameSectionSlot(ctx, source);
14
13
  const def = target === null ? void 0 : sectionSlotAt(ctx.schema, target)?.def;
15
14
  if (def?.type !== "row" || typeof def.from !== "string") return null;
16
- return tableKeyOf(def.from)?.table ?? def.from;
15
+ return tableOf(def.from) ?? def.from;
17
16
  }
18
17
  function checkRow(ctx, row) {
19
18
  const where = `Section "${ctx.key}": row "${row.path}"`;
20
19
  const from = row.def.from;
21
20
  if (from === void 0) throw new Error(`${where} declares no \`from\` — a row names its table: \`row({ label, from: fact.property.contacts })\`; rebuild the section with the current Concrete.`);
22
21
  if (Array.isArray(from)) for (const [index, key] of from.entries()) {
23
- if (tableKeyOf(key) === null) throw new Error(`${where}'s \`from\` lists ${JSON.stringify(key)}, which is no table — a row's list of \`from\` names tables.`);
22
+ if (tableOf(key) === null) throw new Error(`${where}'s \`from\` lists ${JSON.stringify(key)}, which is no table — a row's list of \`from\` names tables.`);
24
23
  if (from.indexOf(key) !== index) throw new Error(`${where} names the table ${JSON.stringify(key)} twice in \`from\`.`);
25
24
  }
26
- const table = Array.isArray(from) ? tableKeyOf(from[0]) : tableKeyOf(from);
25
+ const table = Array.isArray(from) ? tableOf(from[0]) : tableOf(from);
27
26
  if (table === null) {
28
- if (memberListOfKey(from) === null) throw new Error(`${where}'s \`from\` is ${JSON.stringify(from)}, which is neither a table nor a table's list-valued member — a row's \`from\` is one of ${Object.keys(TABLES).map((t) => `"${t}"`).join(", ")}, or \`<table>.<member>\` for a list-valued member.`);
27
+ if (memberListOfKey(from) === null) throw new Error(`${where}'s \`from\` is ${JSON.stringify(from)}, which is neither a table nor a table's list-valued member — a row's \`from\` is one of ${tableNames().map((table) => `"${tableKey(table)}"`).join(", ")}, or \`<table>.<member>\` for a list-valued member.`);
29
28
  if (row.def.source?.kind !== "element" || !insideItem(row)) throw new Error(`${where} is \`from\` the list-valued member ${JSON.stringify(from)} but holds no element — a row from a member holds an item of the list over it: \`source: entry\`.`);
30
29
  return;
31
30
  }
@@ -57,7 +56,7 @@ function checkRow(ctx, row) {
57
56
  default: throw new Error(`${where} is sourced by ${JSON.stringify(source)} — a row's source is ${ORIGINS}.`);
58
57
  }
59
58
  const held = originTable(ctx, row);
60
- if (held !== null && held !== table.table) throw new Error(`${where} is \`from\` the ${table.table} table but its source holds rows of ${held} — a row's source yields a row of its own \`from\`.`);
59
+ if (held !== null && held !== table) throw new Error(`${where} is \`from\` the ${table} table but its source holds rows of ${held} — a row's source yields a row of its own \`from\`.`);
61
60
  }
62
61
  function assertRowSourceContract(ctx) {
63
62
  for (const slot of grammarSlots(ctx.schema)) if (slot.def.type === "row") checkRow(ctx, slot);
@@ -1,5 +1,3 @@
1
- import { FACT_GRAPH } from "../../template-contracts/dist/slot-catalog.js";
2
- import { legacyFactKey } from "../../template-contracts/dist/registry-aliases.js";
3
1
  import { isReadableFactKey } from "../../template-contracts/dist/fact-keys.js";
4
2
  import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
5
3
  import { producedSlot } from "./grammar-scope.js";
@@ -14,7 +12,6 @@ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
14
12
  import { assertDirectlyLinkedListContract } from "./directly-linked-list-contract.js";
15
13
  import { assertFillVerbContract } from "./fill-verb-contract.js";
16
14
  import { assertObjectContract } from "./object-contract.js";
17
- import { assertOptionSourceContract } from "./option-source-contract.js";
18
15
  import { DECISION_KINDS } from "./fill-spec-view.js";
19
16
  import { assertPoiCurationContract } from "./poi-curation-contract.js";
20
17
  import { assertReadsAcyclicContract } from "./reads-acyclic-contract.js";
@@ -54,7 +51,7 @@ function decisionReadNodes(decision) {
54
51
  const CONTRACTS = {
55
52
  "reads-readable": {
56
53
  implementation: bySection(({ key, fillSpec }) => {
57
- for (const r of fillSpec.reads ?? []) if (!isReadableFactKey(r) && !Object.hasOwn(FACT_GRAPH, legacyFactKey(r))) throw new Error(`Section "${key}": fill-spec reads "${r}", which is not a fact the registry declares.`);
54
+ for (const r of fillSpec.reads ?? []) if (!isReadableFactKey(r)) throw new Error(`Section "${key}": fill-spec reads "${r}", which is not a fact the registry declares.`);
58
55
  for (const d of fillSpec.decisions) for (const [at, node] of decisionReadNodes(d)) assertDeclaredRefs(`Section "${key}": fill-spec decision "${d.id}"${at}`, node.reads);
59
56
  }),
60
57
  assertions: []
@@ -158,10 +155,6 @@ const CONTRACTS = {
158
155
  implementation: bySection(({ key, schema }) => assertSelectContract(schema, key)),
159
156
  assertions: [assertSelectContract]
160
157
  },
161
- "option-source": {
162
- implementation: bySection(({ key, schema }) => assertOptionSourceContract(schema, key)),
163
- assertions: [assertOptionSourceContract]
164
- },
165
158
  url: {
166
159
  implementation: bySection(({ key, schema }) => assertUrlContract(schema, key)),
167
160
  assertions: [assertUrlContract]
@@ -1,7 +1,13 @@
1
+ import { factSelectValues } from "../../template-contracts/dist/fact-keys.js";
2
+
1
3
  //#region ../../internal/section-contracts/dist/select-contract.js
2
4
  function checkSelectSlot(slot, label, sectionKey) {
3
5
  if (slot.type !== "select") return;
4
- if (slot.values != null === (slot.options != null)) throw new Error(`Section "${sectionKey}": ${label} needs exactly one of \`values\` or \`options\`.`);
6
+ const hasValues = slot.values != null;
7
+ const fact = slot.source?.kind === "home" ? slot.source.key : void 0;
8
+ if (hasValues && fact !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares both \`values\` and a fact source — name its choices in one place.`);
9
+ if (!hasValues && fact === void 0) throw new Error(`Section "${sectionKey}": ${label} needs its choices: \`values\`, or a fact source whose fact declares them.`);
10
+ if (fact !== void 0 && factSelectValues(fact) === void 0) throw new Error(`Section "${sectionKey}": ${label} is bound to ${JSON.stringify(fact)}, which declares no choices, so the dropdown would be empty — bind a fact that declares them (\`fact.property.listing_intent\`), or name the choices as its \`from\`.`);
5
11
  }
6
12
  function assertSelectContract(schema, sectionKey) {
7
13
  for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
@@ -1,6 +1,7 @@
1
- import { tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
2
2
  import { mirrorKindOf } from "../../template-contracts/dist/mirror-kind.js";
3
- import { isMediaListKey, sourceFieldDescriptor } from "../../template-contracts/dist/fact-keys.js";
3
+ import { isMediaListKey, isRegistryFactKey, registryFactValueType } from "../../template-contracts/dist/fact-keys.js";
4
+ import "../../template-contracts/dist/table-members.js";
4
5
  import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
5
6
  import { objectFieldOf } from "../../template-contracts/dist/slot-overrides.js";
6
7
 
@@ -16,12 +17,15 @@ function assertOne(path, key, slot, section) {
16
17
  if (src.kind === "home") {
17
18
  const field = src.key ?? "";
18
19
  if (isMediaListKey(field)) throw new Error(`${path}: "${field}" is read, never bound — a \`compute()\` reads a media list; a media slot or a list of media picks from it, naming it as its \`from\` (\`fill.pick\`).`);
19
- const def = sourceFieldDescriptor(field);
20
- if (!def) throw new Error(`${path}: unknown fact "${String(src.key)}"`);
21
- if (def.image && slot.type !== "image") throw new Error(`${path}: image source field "${src.key}" must sit on an image slot`);
22
- if (def.value_type === "address" && slot.type !== "address") throw new Error(`${path}: "${field}" is a whole address, which only an \`address\` slot holds — bind it to an \`address()\`, or show the line you want with a \`compute()\` reading it (\`concrete upgrade\` rewrites a text slot bound to it).`);
23
- if (slot.type === "address" && def.value_type !== "address") throw new Error(`${path}: an \`address\` slot bound to "${field}", which is not an address — bind it to the property's address, or compute the value.`);
24
- if (tableKeyOf(field) !== null && !(slot.type === "list" && (slot.element?.type === "row" || slot.element?.type === "object"))) throw new Error(`${path}: table source "${src.key}" needs an item that declares a row (\`list({ item: (el) => object({ … }) })\`) — a fact row cannot project onto one slot.`);
20
+ if (tableOf(field) !== null) {
21
+ if (!(slot.type === "list" && (slot.element?.type === "row" || slot.element?.type === "object"))) throw new Error(`${path}: table source "${field}" needs an item that declares a row (\`list({ item: (el) => object({ … }) })\`) — a fact row cannot project onto one slot.`);
22
+ return;
23
+ }
24
+ if (!isRegistryFactKey(field)) throw new Error(`${path}: unknown fact "${String(src.key)}"`);
25
+ const valueType = registryFactValueType(field);
26
+ if (valueType === "image" && slot.type !== "image") throw new Error(`${path}: image source field "${src.key}" must sit on an image slot`);
27
+ if (valueType === "address" && slot.type !== "address") throw new Error(`${path}: "${field}" is a whole address, which only an \`address\` slot holds — bind it to an \`address()\`, or show the line you want with a \`compute()\` reading it (\`concrete upgrade\` rewrites a text slot bound to it).`);
28
+ if (slot.type === "address" && valueType !== "address") throw new Error(`${path}: an \`address\` slot bound to "${field}", which is not an address — bind it to the property's address, or compute the value.`);
25
29
  return;
26
30
  }
27
31
  if (typeof src.kind !== "string") throw new Error(`${path} is sourced by a ref without a "kind" — this framework reads only kind-tagged refs. Run \`concrete upgrade\`, then build again.`);
@@ -27,7 +27,7 @@ function check(slot, sectionKey, path, inherited, picked = false) {
27
27
  }
28
28
  function checkMediaFilter(slot, sectionKey, path, bound) {
29
29
  const kind = slot.type ?? "";
30
- if ("category" in slot) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`category\`. A media slot names the list it picks from in \`from\` (${mediaListKeys().map((key) => `"${key}"`).join(", ")}), or owns its asset without one.`);
30
+ if ("category" in slot) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`category\`. A media slot names the list it picks from in \`from\` (${mediaListKeys().map((key) => `"${key}"`).join(", ")}), or owns its media without one.`);
31
31
  if (!isMediaType(kind)) {
32
32
  if (slot.from !== void 0 && kind !== "row") throw new Error(`Section "${sectionKey}": slot "${path}" declares \`from\`, but a section's ${kind === "select" ? "select states its values" : "slot names no candidates of its own"} — a media slot picks \`from\` a media list, a row from its table.`);
33
33
  if (slot.process !== void 0) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`process\`, which only a media slot (image, video, tour, document, media) carries.`);
@@ -1,16 +1,13 @@
1
- import { REGISTRY_TABLE_KEYS } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { tableKey } from "../../template-contracts/dist/registry-shape.js";
2
2
  import { tableRowMember } from "../../template-contracts/dist/table-members.js";
3
3
 
4
4
  //#region ../../internal/section-contracts/dist/table-member.js
5
- function tableKeySpelling(key) {
6
- return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
7
- }
8
- function tableMemberOrRefuse(key, field, at, refusal) {
9
- const found = tableRowMember(key, field);
5
+ function tableMemberOrRefuse(table, field, at, refusal) {
6
+ const found = tableRowMember(table, field);
10
7
  if (found.kind === "identity") throw new Error(`${at}: ${refusal.identity}`);
11
- if (found.kind === "unknown") throw new Error(`${at}: unknown ${refusal.noun} "${field}" — a "${tableKeySpelling(key)}" row offers ${found.offers.map((name) => `"${name}"`).join(", ")}.`);
8
+ if (found.kind === "unknown") throw new Error(`${at}: unknown ${refusal.noun} "${field}" — a "${tableKey(table)}" row offers ${found.offers.map((name) => `"${name}"`).join(", ")}.`);
12
9
  return found;
13
10
  }
14
11
 
15
12
  //#endregion
16
- export { tableKeySpelling, tableMemberOrRefuse };
13
+ export { tableMemberOrRefuse };
@@ -1,19 +1,11 @@
1
1
  import { addressMember, isAddressMember, normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
2
- import { FACT_GRAPH, FACT_PROJECTIONS, REFERRAL_FIELDS, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS, TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
3
- import { memberValueType, tableColumnOfKey } from "../../template-contracts/dist/registry-shape.js";
4
- import { isMediaListKey, isRegistryFactKey, readRegistryFact, registryPropertyRoot } from "../../template-contracts/dist/fact-keys.js";
5
- import { rowIdentityKey, tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
2
+ import { memberValueType, tableColumnOfKey, tableOf } from "../../template-contracts/dist/registry-shape.js";
3
+ import { isMediaListKey, isRegistryFactKey, readRegistryFact } from "../../template-contracts/dist/fact-keys.js";
4
+ import { tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
6
5
  import { elementRowKeys, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
7
- import { readLegacyFact, readLegacyRows } from "../../template-contracts/dist/legacy-facts.js";
8
6
 
9
7
  //#region ../../internal/source-resolution/dist/index.js
10
- function tableKey(table) {
11
- return typeof table === "string" ? {
12
- table,
13
- reading: "legacy"
14
- } : table;
15
- }
16
- function registryTableRows(table, facts) {
8
+ function tableRows(table, facts) {
17
9
  const addresses = Object.entries(tableFields(table)).filter(([, declaration]) => memberValueType(declaration) === "address").map(([name]) => name);
18
10
  return facts[table].map((item) => {
19
11
  const row = { ...item };
@@ -21,104 +13,8 @@ function registryTableRows(table, facts) {
21
13
  return row;
22
14
  });
23
15
  }
24
- function contactsOf(facts) {
25
- return readLegacyRows(facts, "contacts");
26
- }
27
- const REFERRAL_FIELD_SET = new Set(REFERRAL_FIELDS);
28
- const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
29
- const LOGO_VARIANT_FALLBACK = {
30
- logo_dark: {
31
- other: "logo_light",
32
- mask: "black"
33
- },
34
- logo_light: {
35
- other: "logo_dark",
36
- mask: "white"
37
- }
38
- };
39
- function resolveContactCardField(contact, field) {
40
- if (!REFERRAL_FIELD_SET.has(field)) return null;
41
- const raw = contact?.[field] ?? null;
42
- if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
43
- const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
44
- if (assetId !== null) return { asset_id: assetId };
45
- const fb = LOGO_VARIANT_FALLBACK[field];
46
- if (fb !== void 0) {
47
- const otherRaw = contact?.[fb.other] ?? null;
48
- const otherId = typeof otherRaw === "string" && otherRaw.trim().length > 0 ? otherRaw.trim() : null;
49
- if (otherId !== null) return {
50
- asset_id: otherId,
51
- mask: fb.mask
52
- };
53
- }
54
- return null;
55
- }
56
- if (raw === null || raw === void 0) return "";
57
- return typeof raw === "string" ? raw : String(raw);
58
- }
59
- const PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER = {
60
- primary_contact_name: "name",
61
- primary_contact_title: "title",
62
- primary_contact_bio: "bio",
63
- primary_contact_email: "email",
64
- primary_contact_phone: "phone",
65
- primary_contact_address: "address",
66
- primary_contact_website_url: "website",
67
- primary_contact_avatar_upload_id: "headshot",
68
- primary_contact_logo_dark_upload_id: "logo_dark",
69
- primary_contact_logo_light_upload_id: "logo_light",
70
- primary_contact_instagram_url: "instagram",
71
- primary_contact_linkedin_url: "linkedin",
72
- primary_contact_x_url: "x",
73
- primary_contact_facebook_url: "facebook"
74
- };
75
- function primaryContactFactValue(facts, factKey) {
76
- const key = PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER[factKey];
77
- if (key === void 0) return void 0;
78
- const raw = contactsOf(facts)[0]?.[key] ?? null;
79
- return typeof raw === "string" ? raw : null;
80
- }
81
- function tableRowsOf(table, facts) {
82
- const key = tableKey(table);
83
- return key.reading === "legacy" ? readLegacyRows(facts, key.table) : registryTableRows(key.table, facts);
84
- }
85
- const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(FACT_GRAPH.contacts.row).filter(([, member]) => member.primary === true).map(([name]) => [name, FACT_PROJECTIONS.contact[name] ?? name]));
86
- function mediaRefOf(raw) {
87
- if (typeof raw !== "string") return null;
88
- const assetId = raw.trim();
89
- return assetId.length > 0 ? { asset_id: assetId } : null;
90
- }
91
- function mediaRefListOf(raw) {
92
- if (!Array.isArray(raw)) return [];
93
- return [...raw].sort((a, b) => (typeof a["position"] === "number" ? a["position"] : 0) - (typeof b["position"] === "number" ? b["position"] : 0)).flatMap((element) => {
94
- const ref = mediaRefOf(element["id"]);
95
- if (ref === null) return [];
96
- if ("floor_label" in element) ref.floor_label = typeof element["floor_label"] === "string" ? element["floor_label"] : null;
97
- return [ref];
98
- });
99
- }
100
- function readMemberOf(table, row, member) {
101
- const key = tableKey(table);
102
- if (key.reading === "legacy") return readLegacyMemberOf(key.table, row, member);
103
- return readRegistryMemberOf(key.table, row, member);
104
- }
105
- function readLegacyMemberOf(table, row, member) {
106
- const descriptor = FACT_GRAPH[table].row[member];
107
- if (descriptor === void 0) return null;
108
- if (table === "contacts") {
109
- const fact = CONTACT_MEMBER_FACT[member];
110
- if (fact !== void 0) return resolveContactScalar(row, fact);
111
- }
112
- const raw = row[member] ?? 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 readRegistryMemberOf(table, row, path) {
118
- const lookup = tableRowMember({
119
- table,
120
- reading: "registry"
121
- }, path);
16
+ function readMemberOf(table, row, path) {
17
+ const lookup = tableRowMember(table, path);
122
18
  if (lookup.kind === "identity") return row["id"] ?? null;
123
19
  if (lookup.kind === "unknown") return null;
124
20
  const dot = path.indexOf(".");
@@ -127,15 +23,10 @@ function readRegistryMemberOf(table, row, path) {
127
23
  return isAddressMember(part) ? addressMember(row[path.slice(0, dot)], part) : null;
128
24
  }
129
25
  function tableRowIds(table, facts) {
130
- const idKey = rowIdentityKey(tableKey(table));
131
- return tableRowsOf(table, facts).flatMap((row) => {
132
- const id = row[idKey];
133
- return typeof id === "string" ? [id] : [];
134
- });
26
+ return tableRows(table, facts).map((row) => row.id);
135
27
  }
136
28
  function tableRowById(table, id, facts) {
137
- const idKey = rowIdentityKey(tableKey(table));
138
- return tableRowsOf(table, facts).find((row) => row[idKey] === id);
29
+ return tableRows(table, facts).find((row) => row.id === id);
139
30
  }
140
31
  function readRowMember(table, id, member, facts) {
141
32
  const row = tableRowById(table, id, facts);
@@ -143,86 +34,28 @@ function readRowMember(table, id, member, facts) {
143
34
  }
144
35
  function projectTableRows(table, facts, fields, rowComputes = {}, ids) {
145
36
  const elementRows = elementRowKeys(fields);
146
- return projectRows(tableKey(table), facts, rowMemberSources(fields), elementRows, rowComputes, ids);
37
+ return projectRows(table, facts, rowMemberSources(fields), elementRows, rowComputes, ids);
147
38
  }
148
- function projectRows(key, facts, members, elementRows, rowComputes, ids) {
149
- const rowId = rowIdentityKey(key);
150
- return (ids === void 0 ? tableRowsOf(key, facts) : ids.flatMap((id) => {
151
- const row = tableRowById(key, id, facts);
39
+ function projectRows(table, facts, members, elementRows, rowComputes, ids) {
40
+ return (ids === void 0 ? tableRows(table, facts) : ids.flatMap((id) => {
41
+ const row = tableRowById(table, id, facts);
152
42
  return row === void 0 ? [] : [row];
153
43
  })).map((row) => {
154
- const out = { id: row[rowId] };
155
- for (const field of elementRows) out[field] = row[rowId];
156
- for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(key, row, member);
157
- for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(key, row, member), row[rowId]);
44
+ const out = { id: row.id };
45
+ for (const field of elementRows) out[field] = row.id;
46
+ for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(table, row, member);
47
+ for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(table, row, member), row.id);
158
48
  return out;
159
49
  });
160
50
  }
161
- function firstUnit(facts) {
162
- return tableRowsOf("units", facts)[0];
163
- }
164
- function resolveUnitScalar(unit, field) {
165
- switch (field) {
166
- case "beds": return unit?.beds ?? null;
167
- case "baths": return unit?.baths ?? null;
168
- case "sqft": return unit?.sqft ?? null;
169
- case "price": return unit?.price ?? null;
170
- case "unit_label": return unit?.unit_label ?? null;
171
- default: return null;
172
- }
173
- }
174
- function resolvePropertyScalar(facts, field) {
175
- const address = readLegacyFact(facts, "address");
176
- if (field === "address") {
177
- if (address && typeof address === "object") return address.display ?? null;
178
- return address;
179
- }
180
- const part = ADDRESS_PARTS[field];
181
- if (part !== void 0) return readAddressPart(address, part);
182
- const virtual = primaryContactFactValue(facts, field);
183
- if (virtual !== void 0) return virtual;
184
- return readLegacyFact(facts, field);
185
- }
186
- const CONTACT_FIELD_TO_CONTACT_MEMBER = Object.fromEntries(Object.entries(CONTACT_MEMBER_FACT).map(([member, fact]) => [fact, member]));
187
- function resolveContactScalar(contact, field) {
188
- if (REFERRAL_FIELD_SET.has(field)) return resolveContactCardField(contact, field);
189
- const key = CONTACT_FIELD_TO_CONTACT_MEMBER[field];
190
- if (key === void 0) return null;
191
- const raw = contact?.[key] ?? null;
192
- if (typeof raw !== "string") return null;
193
- const trimmed = raw.trim();
194
- return trimmed.length > 0 ? trimmed : null;
195
- }
196
51
  function readFactRef(facts, key) {
197
- if (isRegistryFactKey(key)) return readRegistryFact(key, registryPropertyRoot(facts));
52
+ if (isRegistryFactKey(key)) return readRegistryFact(key, facts);
198
53
  if (isMediaListKey(key)) return facts[key.slice(9)];
199
- const table = tableKeyOf(key);
200
- if (table?.reading === "registry") return registryTableRows(table.table, facts);
54
+ const table = tableOf(key);
55
+ if (table !== null) return tableRows(table, facts);
201
56
  const column = tableColumnOfKey(key);
202
- if (column !== null) return registryTableRows(column.table, facts).map((row) => row[column.member] ?? null);
203
- return readLegacyFact(facts, key);
204
- }
205
- function readFrom(field, ctx) {
206
- if (isRegistryFactKey(field)) return readFactRef(ctx.facts, field);
207
- const desc = SOURCE_FIELDS[field];
208
- if (!desc) return null;
209
- if (Object.hasOwn(TABLES, field)) return null;
210
- if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? contactsOf(ctx.facts)[0], field);
211
- if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
212
- return resolvePropertyScalar(ctx.facts, field);
213
- }
214
- const ADDRESS_PARTS = {
215
- address_street: "street",
216
- address_unit: "unit",
217
- address_city: "city",
218
- address_state: "state",
219
- address_postal: "postal"
220
- };
221
- function readAddressPart(address, part) {
222
- if (!address || typeof address !== "object") return null;
223
- const trimmed = (address[part] ?? "").trim();
224
- return trimmed.length > 0 ? trimmed : null;
57
+ if (column !== null) return tableRows(column.table, facts).map((row) => row[column.member] ?? null);
225
58
  }
226
59
 
227
60
  //#endregion
228
- export { primaryContactFactValue, projectTableRows, readFactRef, readFrom, readRowMember, registryTableRows, resolveContactCardField, tableRowById, tableRowIds };
61
+ export { projectTableRows, readFactRef, readRowMember, tableRowById, tableRowIds, tableRows };
@@ -1,7 +1,7 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { listingDigest, sectionContentHash, sourceDigest, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
5
5
  import { verifyArtifact } from "./verify.js";
6
6
 
7
- export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
7
+ export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
@@ -14,11 +14,13 @@ const UNHASHED_DIRS = [
14
14
  PLAYGROUND_DIR,
15
15
  CAPTURES_DIR
16
16
  ];
17
+ const STORED_DIRS = [ASSETS_DIR, CAPTURES_DIR];
17
18
  const FIXTURE_FILES = {
18
19
  contentDoc: "content-doc.json",
19
20
  property: "property.json",
20
21
  meta: "meta.json"
21
22
  };
23
+ const FIXTURE_OPTIONAL_FILES = { settledDoc: "settled-doc.json" };
22
24
  const CAPTURE_FILES = {
23
25
  bundle: "bundle.zip",
24
26
  document: "document.pdf"
@@ -122,4 +124,4 @@ function boundFiles(binding) {
122
124
  }
123
125
 
124
126
  //#endregion
125
- export { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
127
+ export { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
@@ -1,4 +1,4 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, fixturePath, playgroundPath, sectionPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, fixturePath, playgroundPath, sectionPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { sectionContentHash, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, readArtifactSchema } from "./manifest.js";
@@ -11,7 +11,7 @@ const TEMPLATE_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(TEMPLATE_F
11
11
  const ISLAND_CHUNK = new RegExp(`^${SECTION_ISLANDS_DIR}/[A-Za-z0-9._-]+\\.mjs$`);
12
12
  const FLAT_FILE = /^[A-Za-z0-9._-]+$/;
13
13
  const CLIENT_SEGMENT = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
14
- const FIXTURE_FILE_NAMES = new Set(Object.values(FIXTURE_FILES));
14
+ const FIXTURE_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(FIXTURE_FILES), ...Object.values(FIXTURE_OPTIONAL_FILES)]);
15
15
  const ASSET_URL = new RegExp(`${ASSET_URL_PREFIX.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}([A-Za-z0-9._-]+)`, "g");
16
16
  function readJson(files, path, problems) {
17
17
  const bytes = files.get(path);
@@ -47,8 +47,17 @@ function composedSections(composition) {
47
47
  }
48
48
  return keys;
49
49
  }
50
- function verifyArtifact(files) {
50
+ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
51
51
  const problems = [];
52
+ const present = (path) => files.has(path) || stored.has(path);
53
+ for (const path of stored.keys()) if (files.has(path)) problems.push({
54
+ path,
55
+ message: "is carried both as bytes and as a stored file"
56
+ });
57
+ else if (!STORED_DIRS.includes(path.split("/")[0])) problems.push({
58
+ path,
59
+ message: `is held as a stored file, which only ${STORED_DIRS.map((dir) => `${dir}/`).join(" and ")} may be`
60
+ });
52
61
  const raw = readJson(files, MANIFEST_FILE, problems);
53
62
  if (raw === null) return {
54
63
  manifest: null,
@@ -78,7 +87,7 @@ function verifyArtifact(files) {
78
87
  }
79
88
  const manifest = parsed.data;
80
89
  const listed = new Set(manifest.sections.map((section) => section.key));
81
- for (const path of files.keys()) {
90
+ for (const path of [...files.keys(), ...stored.keys()]) {
82
91
  if (path === "manifest.json") continue;
83
92
  const slash = path.indexOf("/");
84
93
  const top = slash < 0 ? path : path.slice(0, slash);
@@ -135,13 +144,16 @@ function verifyArtifact(files) {
135
144
  path: playgroundPath(file),
136
145
  message: "missing"
137
146
  });
138
- for (const id of manifest.fixtures) for (const file of Object.values(FIXTURE_FILES)) {
139
- const path = fixturePath(id, file);
140
- if (readJson(files, path, problems) === null) continue;
141
- for (const match of decoder.decode(files.get(path)).matchAll(ASSET_URL)) if (!files.has(`${"assets"}/${match[1]}`)) problems.push({
142
- path,
143
- message: `names ${match[0]}, which ${ASSETS_DIR}/ does not carry`
144
- });
147
+ for (const id of manifest.fixtures) {
148
+ const optional = Object.values(FIXTURE_OPTIONAL_FILES).filter((file) => files.has(fixturePath(id, file)));
149
+ for (const file of [...Object.values(FIXTURE_FILES), ...optional]) {
150
+ const path = fixturePath(id, file);
151
+ if (readJson(files, path, problems) === null) continue;
152
+ for (const match of decoder.decode(files.get(path)).matchAll(ASSET_URL)) if (!present(`${"assets"}/${match[1]}`)) problems.push({
153
+ path,
154
+ message: `names ${match[0]}, which ${ASSETS_DIR}/ does not carry`
155
+ });
156
+ }
145
157
  }
146
158
  const sectionHashes = /* @__PURE__ */ new Map();
147
159
  for (const section of manifest.sections) {
@@ -219,14 +231,18 @@ function verifyArtifact(files) {
219
231
  for (const file of bound ?? []) {
220
232
  boundPaths.add(file.path);
221
233
  const bytes = files.get(file.path);
222
- if (bytes === void 0) problems.push({
234
+ const digest = stored.get(file.path)?.sha256;
235
+ if (bytes === void 0 && digest === void 0) problems.push({
223
236
  path: file.path,
224
237
  message: `named by the binding as ${file.filename}, and missing`
225
238
  });
226
- else if (file.contentHash !== void 0 && sha256Hex(bytes) !== file.contentHash) problems.push({
227
- path: file.path,
228
- message: `the binding states content hash ${file.contentHash} for ${file.filename}; the bytes hash to ${sha256Hex(bytes)}`
229
- });
239
+ else if (file.contentHash !== void 0) {
240
+ const actual = digest ?? sha256Hex(bytes);
241
+ if (actual !== file.contentHash) problems.push({
242
+ path: file.path,
243
+ message: `the binding states content hash ${file.contentHash} for ${file.filename}; the bytes hash to ${actual}`
244
+ });
245
+ }
230
246
  }
231
247
  if (bound !== void 0) for (const path of files.keys()) {
232
248
  const parts = path.split("/");
@@ -4,6 +4,29 @@ import "./fact-registry.js";
4
4
 
5
5
  //#region ../../internal/template-contracts/dist/content-pick.js
6
6
  const DEFAULT_SLOT_ASPECT = 16 / 10;
7
+ function storedCrop(crop) {
8
+ if (crop === null || typeof crop !== "object") return null;
9
+ const box = crop;
10
+ const [x, y, width, height] = [
11
+ "x",
12
+ "y",
13
+ "width",
14
+ "height"
15
+ ].map((key) => box[key]);
16
+ if (![
17
+ x,
18
+ y,
19
+ width,
20
+ height
21
+ ].every((n) => typeof n === "number" && Number.isFinite(n))) return null;
22
+ if (x === 0 && y === 0 && width === 1 && height === 1) return null;
23
+ return {
24
+ x,
25
+ y,
26
+ width,
27
+ height
28
+ };
29
+ }
7
30
  function slotCropAspects(crop) {
8
31
  if (crop === null || typeof crop !== "object") return {
9
32
  mode: "free",
@@ -48,4 +71,4 @@ function placeCrop(stored, imageAspect, aspects, framing) {
48
71
  }
49
72
 
50
73
  //#endregion
51
- export { DEFAULT_SLOT_ASPECT, defaultCrop, placeCrop, sameCrop, slotCropAspects };
74
+ export { DEFAULT_SLOT_ASPECT, defaultCrop, placeCrop, sameCrop, slotCropAspects, storedCrop };
@@ -10,7 +10,7 @@ import { ResponsiveImage } from "./responsive-image.js";
10
10
  * poster.
11
11
  */
12
12
  type DocumentValue = {
13
- /** The `intake.upload` row this slot points at — the whole stored value. */
13
+ /** The media this slot points at — the whole stored value. */
14
14
  asset_id: string;
15
15
  /**
16
16
  * Served source — the editor gets a presigned URL, a published page gets the
@@ -32,7 +32,7 @@ type DocumentValue = {
32
32
  * The first page's preview URL, or `''` when there is none — a preview is
33
33
  * rendered after the upload lands, and only for a PDF. Named like a video's
34
34
  * and a tour's poster because it plays the same part: the still `<Slot.Image>`
35
- * draws for a slot whose asset is not itself an image.
35
+ * draws for a slot whose media is not itself an image.
36
36
  */
37
37
  poster: string;
38
38
  /** The preview's responsive ladder, when one exists. Absent, `<Image>` falls back to `poster`. */