@homepages/concrete 8.0.0 → 9.1.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 (331) hide show
  1. package/CHANGELOG.md +1005 -0
  2. package/README.md +20 -9
  3. package/codemods/list-grammar.mjs +923 -0
  4. package/codemods/manifest.json +64 -0
  5. package/codemods/process-builders.mjs +198 -0
  6. package/codemods/slot-object.mjs +1097 -0
  7. package/codemods/steps/content-object-fields.mjs +324 -0
  8. package/codemods/steps/list-object-form.mjs +6 -7
  9. package/codemods/table-rows.mjs +568 -0
  10. package/codemods/unwrap-object-fields.mjs +310 -0
  11. package/codemods/viewer-slot-document.mjs +131 -0
  12. package/codemods/write-property-as-facts-document.mjs +716 -0
  13. package/codemods/write-the-address-line.mjs +255 -0
  14. package/codemods/write-the-registry-members.mjs +653 -0
  15. package/codemods/write-the-select-from.mjs +141 -0
  16. package/codemods/write-the-sole-from.mjs +369 -0
  17. package/codemods/write-the-table-from.mjs +267 -0
  18. package/codemods/write-the-whole-item.mjs +512 -0
  19. package/codemods/writeback-drop.mjs +168 -0
  20. package/codemods/written-contact-address.mjs +162 -0
  21. package/codemods/written-media-category.mjs +227 -0
  22. package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
  23. package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
  24. package/codemods/written-uploads-sort-into-lists.mjs +405 -0
  25. package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
  26. package/codemods/written-video-sources-drop.mjs +144 -0
  27. package/codemods/written-without-pick-none.mjs +146 -0
  28. package/codemods/written-without-retired-knowledge.mjs +223 -0
  29. package/codemods/written-without-the-media-key.mjs +202 -0
  30. package/codemods/written-without-the-property-type.mjs +249 -0
  31. package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +1259 -0
  32. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +1 -0
  33. package/dist/artifact/playground/client/index.html +2 -2
  34. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  35. package/dist/artifact/playground/host.mjs +61 -27
  36. package/dist/base.css +58 -1
  37. package/dist/cli/build/artifact.js +6 -9
  38. package/dist/cli/build/captures.js +2 -12
  39. package/dist/cli/build/esbuild.js +1 -25
  40. package/dist/cli/build/fixtures.js +2 -1
  41. package/dist/cli/build/icons.js +1 -1
  42. package/dist/cli/build/static.js +2 -2
  43. package/dist/cli/capture/capture.js +8 -9
  44. package/dist/cli/check/analyze.js +8 -1
  45. package/dist/cli/check/load-outdir.js +47 -0
  46. package/dist/cli/check/load-workspace.js +4 -4
  47. package/dist/cli/check/render/html.js +1 -2
  48. package/dist/cli/check/render/inputs.js +10 -3
  49. package/dist/cli/check/render/island-frames.js +2 -1
  50. package/dist/cli/check/render/marker-coverage.js +23 -15
  51. package/dist/cli/check/report.js +5 -0
  52. package/dist/cli/check/stages/bundles.js +1 -1
  53. package/dist/cli/check/stages/relations.js +1 -1
  54. package/dist/cli/check/stages/render.js +48 -33
  55. package/dist/cli/check/stages/sections.js +83 -31
  56. package/dist/cli/check/stages/workspace.js +2 -0
  57. package/dist/cli/check/template-key.js +16 -0
  58. package/dist/cli/commands.js +1 -1
  59. package/dist/cli/dev/crop.js +1 -1
  60. package/dist/cli/dev/fixture-ladders.js +96 -0
  61. package/dist/cli/dev/islands.js +12 -123
  62. package/dist/cli/dev/listen.js +20 -1
  63. package/dist/cli/dev/load-template.js +1 -1
  64. package/dist/cli/dev/server.js +35 -10
  65. package/dist/cli/dev/vite.js +9 -7
  66. package/dist/cli/dev/workspace-reader.js +16 -16
  67. package/dist/cli/media/derive.js +43 -57
  68. package/dist/cli/media/frame-rung-floor.js +0 -1
  69. package/dist/cli/property/index.js +1 -6
  70. package/dist/css/inline.js +1 -22
  71. package/dist/eslint/rules/no-marker-literal.js +1 -1
  72. package/dist/fixtures/load.js +16 -7
  73. package/dist/fixtures/media-plugin.js +17 -12
  74. package/dist/fixtures/media-store.js +115 -0
  75. package/dist/fixtures/property.js +345 -126
  76. package/dist/fixtures/resolve.js +260 -251
  77. package/dist/fixtures/rows.js +4 -11
  78. package/dist/fixtures.d.ts +234 -109
  79. package/dist/index.d.ts +25 -16
  80. package/dist/index.js +10 -6
  81. package/dist/islands/marker.js +2 -1
  82. package/dist/packages/external/concrete/package.js +1 -1
  83. package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
  84. package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
  85. package/dist/packages/internal/capture-settle/dist/index.js +3 -0
  86. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
  87. package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
  88. package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
  89. package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
  90. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +250 -46
  91. package/dist/packages/internal/fill-bake/dist/compute-reads.js +361 -4
  92. package/dist/packages/internal/fill-bake/dist/derive-source.js +25 -18
  93. package/dist/packages/internal/fill-bake/dist/index.js +9 -3
  94. package/dist/packages/internal/fill-bake/dist/item-merge.js +113 -0
  95. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -0
  96. package/dist/packages/internal/fill-bake/dist/linked-merge.js +38 -0
  97. package/dist/packages/internal/fill-bake/dist/list-grammar.js +174 -0
  98. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  99. package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
  100. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +363 -0
  101. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
  102. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +60 -0
  103. package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
  104. package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
  105. package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
  106. package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
  107. package/dist/packages/internal/image-ladder/dist/index.js +3 -3
  108. package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
  109. package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
  110. package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
  111. package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
  112. package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
  113. package/dist/packages/internal/island-runtime/dist/index.js +2 -1
  114. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
  115. package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
  116. package/dist/packages/internal/media-resolution/dist/document.js +63 -0
  117. package/dist/packages/internal/media-resolution/dist/image.js +226 -0
  118. package/dist/packages/internal/media-resolution/dist/index.js +11 -0
  119. package/dist/packages/internal/media-resolution/dist/list.js +112 -0
  120. package/dist/packages/internal/media-resolution/dist/media.js +59 -0
  121. package/dist/packages/internal/media-resolution/dist/records.js +7 -0
  122. package/dist/packages/internal/media-resolution/dist/slot.js +37 -0
  123. package/dist/packages/internal/media-resolution/dist/store.js +19 -0
  124. package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
  125. package/dist/packages/internal/media-resolution/dist/video.js +93 -0
  126. package/dist/packages/internal/property-facts/dist/registry-facts.js +245 -0
  127. package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
  128. package/dist/packages/internal/section-contracts/dist/catalog.js +34 -14
  129. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
  130. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +21 -0
  131. package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
  132. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  133. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
  134. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
  135. package/dist/packages/internal/section-contracts/dist/index.js +7 -2
  136. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +2 -36
  137. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -21
  138. package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
  139. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
  140. package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
  141. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +9 -5
  142. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
  143. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -17
  144. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +80 -0
  145. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
  146. package/dist/packages/internal/section-contracts/dist/runners.js +77 -18
  147. package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
  148. package/dist/packages/internal/section-contracts/dist/source-contract.js +89 -95
  149. package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
  150. package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
  151. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +39 -23
  152. package/dist/packages/internal/source-resolution/dist/index.js +113 -73
  153. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
  154. package/dist/packages/internal/street-address/dist/index.js +72 -0
  155. package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
  156. package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
  157. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  158. package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
  159. package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
  160. package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
  161. package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
  162. package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
  163. package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
  164. package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
  165. package/dist/packages/internal/template-contracts/dist/decision-fills.js +81 -0
  166. package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
  167. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
  168. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
  169. package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
  170. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
  171. package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
  172. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
  173. package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
  174. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
  175. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
  176. package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
  177. package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
  178. package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
  179. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +93 -0
  180. package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
  181. package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
  182. package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
  183. package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
  184. package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
  185. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
  186. package/dist/packages/internal/template-contracts/dist/list-editing.js +93 -0
  187. package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
  188. package/dist/packages/internal/template-contracts/dist/list.js +258 -0
  189. package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
  190. package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
  191. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
  192. package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
  193. package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
  194. package/dist/packages/internal/template-contracts/dist/object.js +131 -0
  195. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
  196. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
  197. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
  198. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
  199. package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
  200. package/dist/packages/internal/template-contracts/dist/read-graph.js +240 -0
  201. package/dist/packages/internal/template-contracts/dist/ref-locate.js +176 -0
  202. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
  203. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +270 -0
  204. package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
  205. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
  206. package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
  207. package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
  208. package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
  209. package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
  210. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +127 -0
  211. package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
  212. package/dist/packages/internal/template-contracts/dist/row-sources.js +41 -5
  213. package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
  214. package/dist/packages/internal/template-contracts/dist/row.js +84 -0
  215. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
  216. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
  217. package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +233 -405
  219. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +331 -227
  220. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
  221. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
  222. package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
  223. package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
  224. package/dist/packages/internal/template-contracts/dist/slot-types.js +139 -0
  225. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +95 -0
  226. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
  227. package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
  228. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
  229. package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
  230. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
  231. package/dist/platform/fs.js +5 -2
  232. package/dist/playground/canvas-island-host.d.ts +11 -0
  233. package/dist/playground/canvas-island-host.js +29 -0
  234. package/dist/playground/canvas-markers.js +14 -0
  235. package/dist/playground-island-runtime.d.ts +3 -2
  236. package/dist/playground-island-runtime.js +3 -2
  237. package/dist/primitives/FrameShell.js +0 -1
  238. package/dist/primitives/Image.d.ts +5 -4
  239. package/dist/primitives/Tour.d.ts +1 -1
  240. package/dist/primitives/Video.d.ts +2 -2
  241. package/dist/primitives/index.d.ts +2 -3
  242. package/dist/primitives/picture-sources.js +2 -2
  243. package/dist/primitives/probe-context.js +2 -12
  244. package/dist/primitives/slot-address.d.ts +44 -0
  245. package/dist/primitives/slot-address.js +19 -0
  246. package/dist/primitives/slot-bindings.d.ts +65 -26
  247. package/dist/primitives/slot-bindings.js +104 -46
  248. package/dist/primitives/slot-document.d.ts +23 -18
  249. package/dist/primitives/slot-document.js +39 -14
  250. package/dist/primitives/slot-download.d.ts +39 -0
  251. package/dist/primitives/slot-download.js +39 -0
  252. package/dist/primitives/slot-list.d.ts +3 -3
  253. package/dist/primitives/slot-list.js +0 -2
  254. package/dist/primitives/slot-media.d.ts +24 -5
  255. package/dist/primitives/slot-media.js +6 -9
  256. package/dist/primitives/slot-object.d.ts +49 -0
  257. package/dist/primitives/slot-object.js +20 -0
  258. package/dist/primitives/slot-scalar.d.ts +27 -2
  259. package/dist/primitives/slot-scalar.js +50 -7
  260. package/dist/primitives/slot.d.ts +13 -6
  261. package/dist/primitives/slot.js +10 -3
  262. package/dist/rules/registry.js +25 -30
  263. package/dist/schema/define-schema.d.ts +4 -8
  264. package/dist/schema/define-schema.js +178 -79
  265. package/dist/schema/extract-fill-spec.js +2 -153
  266. package/dist/schema/fact.d.ts +57 -15
  267. package/dist/schema/fact.js +42 -7
  268. package/dist/schema/facts-view.d.ts +14 -0
  269. package/dist/schema/format.d.ts +1 -0
  270. package/dist/schema/format.js +2 -1
  271. package/dist/schema/manifest.js +24 -0
  272. package/dist/schema/property-facts.d.ts +8 -12
  273. package/dist/schema/section-props.d.ts +2 -66
  274. package/dist/schema/section-schema.d.ts +8 -11
  275. package/dist/schema/section-schema.js +27 -10
  276. package/dist/section/declare.d.ts +18 -7
  277. package/dist/section/declare.js +18 -5
  278. package/dist/section/materialize.js +3 -8
  279. package/dist/section/section.d.ts +12 -8
  280. package/dist/section/section.js +1 -1
  281. package/dist/template/logic-shim.d.ts +14 -7
  282. package/dist/template/logic-shim.js +14 -7
  283. package/dist/template/materialize.js +17 -18
  284. package/dist/template/mirror-types.js +30 -31
  285. package/dist/template/section-reads.js +85 -9
  286. package/guide/reference/cli/INDEX.md +2 -2
  287. package/guide/reference/cli/build.md +1 -1
  288. package/guide/reference/cli/check.md +1 -1
  289. package/guide/reference/cli/dev.md +1 -1
  290. package/guide/reference/cli/property-add.md +1 -1
  291. package/guide/reference/cli/property-list.md +2 -2
  292. package/guide/reference/cli/publish.md +1 -1
  293. package/guide/reference/cli/upgrade.md +1 -1
  294. package/guide/reference/rules/INDEX.md +29 -25
  295. package/package.json +9 -8
  296. package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
  297. package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
  298. package/dist/fixtures/canonical.d.ts +0 -166
  299. package/dist/fixtures/media.js +0 -163
  300. package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
  301. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  302. package/dist/packages/internal/format-geometry/dist/index.js +0 -4
  303. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
  304. package/dist/packages/internal/property-facts/dist/index.js +0 -3
  305. package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
  306. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  307. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
  308. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
  309. package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
  310. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
  311. package/dist/primitives/slot-group.d.ts +0 -40
  312. package/dist/primitives/slot-group.js +0 -36
  313. package/dist/schema/extract-used-facts.js +0 -34
  314. package/dist/schema/fill-builders.d.ts +0 -115
  315. package/dist/schema/fill-builders.js +0 -25
  316. package/dist/schema/fill-declaration.d.ts +0 -14
  317. package/dist/schema/fill-spec.js +0 -98
  318. package/dist/schema/layout.d.ts +0 -30
  319. package/dist/schema/layout.js +0 -14
  320. package/dist/schema/row-fields.js +0 -88
  321. package/dist/schema/row-ref.d.ts +0 -59
  322. package/dist/schema/row-ref.js +0 -28
  323. package/dist/schema/runtime-values.d.ts +0 -71
  324. package/dist/schema/section-nav.js +0 -14
  325. package/dist/schema/slot-builders.d.ts +0 -633
  326. package/dist/schema/slot-builders.js +0 -177
  327. package/dist/schema/slot-ref.d.ts +0 -79
  328. package/dist/schema/slot-ref.js +0 -41
  329. package/dist/schema/slot-types.d.ts +0 -111
  330. package/dist/schema/slot-types.js +0 -214
  331. package/dist/section/groups.js +0 -68
@@ -0,0 +1,115 @@
1
+ import { mediaRecords } from "../packages/internal/template-contracts/dist/registry-facts.js";
2
+ import { cropKeyOwner } from "../packages/internal/media-resolution/dist/crop-key.js";
3
+ import { recordsOf } from "../packages/internal/media-resolution/dist/records.js";
4
+ import { resolveSlotValue } from "../packages/internal/media-resolution/dist/slot.js";
5
+ import "../packages/internal/media-resolution/dist/index.js";
6
+
7
+ //#region src/fixtures/media-store.ts
8
+ const clamp01 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
9
+ function cropRectOf(value) {
10
+ if (typeof value !== "object" || value === null) return null;
11
+ const { nx = 0, ny = 0, nw = 1, nh = 1 } = value;
12
+ if (![
13
+ nx,
14
+ ny,
15
+ nw,
16
+ nh
17
+ ].every((n) => typeof n === "number" && Number.isFinite(n))) return null;
18
+ const x = clamp01(nx);
19
+ const y = clamp01(ny);
20
+ const rect = {
21
+ nx: x,
22
+ ny: y,
23
+ nw: Math.min(clamp01(nw), 1 - x),
24
+ nh: Math.min(clamp01(nh), 1 - y)
25
+ };
26
+ if (rect.nw <= 0 || rect.nh <= 0) return null;
27
+ return rect.nx === 0 && rect.ny === 0 && rect.nw === 1 && rect.nh === 1 ? null : rect;
28
+ }
29
+ const CROP_KEY = /^processed\/crops\/([^/]+)\/(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)$/;
30
+ function cropOfKey(key) {
31
+ const match = CROP_KEY.exec(key);
32
+ if (match === null || cropKeyOwner(key) === null) return null;
33
+ const rect = cropRectOf({
34
+ nx: Number(match[2]),
35
+ ny: Number(match[3]),
36
+ nw: Number(match[4]),
37
+ nh: Number(match[5])
38
+ });
39
+ return rect === null ? null : {
40
+ id: match[1],
41
+ rect
42
+ };
43
+ }
44
+ function keyOf(file) {
45
+ if (file === null || file === void 0) return null;
46
+ return typeof file === "string" ? file : file.url;
47
+ }
48
+ function fixtureMediaStore(media, serving = {}) {
49
+ const serve = serving.url ?? ((path) => path);
50
+ const files = /* @__PURE__ */ new Map();
51
+ for (const entry of media.values()) for (const file of [entry.file, entry.posterFile]) {
52
+ const key = keyOf(file);
53
+ if (key !== null) files.set(key, file);
54
+ }
55
+ const fileUrl = (key) => files.has(key) ? serve(key) : key;
56
+ const responsiveOf = (key) => {
57
+ const file = key === null ? void 0 : files.get(key);
58
+ if (file === void 0 || typeof file === "string" || file.responsive === null) return null;
59
+ return {
60
+ ...file.responsive,
61
+ sources: file.responsive.sources.map((source) => ({
62
+ ...source,
63
+ srcset: serveSrcset(source.srcset, serve)
64
+ }))
65
+ };
66
+ };
67
+ return {
68
+ servedUrl: (key) => {
69
+ const crop = cropOfKey(key);
70
+ if (crop === null) return Promise.resolve(fileUrl(key));
71
+ const source = keyOf(media.get(crop.id)?.file);
72
+ if (source === null) return Promise.reject(/* @__PURE__ */ new Error(`no image "${crop.id}" to crop`));
73
+ return Promise.resolve(serving.crop === void 0 ? serve(source) : serving.crop(source, crop.rect));
74
+ },
75
+ fileUrl: (key) => Promise.resolve(fileUrl(key)),
76
+ ladder: () => Promise.resolve({ responsiveFor: (key) => Promise.resolve(responsiveOf(key)) })
77
+ };
78
+ }
79
+ function serveSrcset(srcset, serve) {
80
+ return srcset.split(",").map((rung) => {
81
+ const [url = "", ...descriptors] = rung.trim().split(/\s+/);
82
+ return [serve(url), ...descriptors].join(" ");
83
+ }).join(", ");
84
+ }
85
+ function fixtureAssetRecords(facts, media, sizeOf) {
86
+ const records = recordsOf(facts === null ? null : mediaRecords(facts));
87
+ const sized = /* @__PURE__ */ new Map();
88
+ for (const entry of media.values()) {
89
+ const key = keyOf(entry.file);
90
+ if (key !== null && entry.sizeBytes !== void 0) sized.set(key, entry.sizeBytes);
91
+ }
92
+ return new Map([...records].map(([id, record]) => {
93
+ const bytes = record.bytes ?? (record.key === null ? void 0 : sized.get(record.key) ?? sizeOf?.(record.key));
94
+ return [id, bytes === void 0 || bytes === record.bytes ? record : {
95
+ ...record,
96
+ bytes
97
+ }];
98
+ }));
99
+ }
100
+ async function resolveFixtureSlots(input) {
101
+ const ctx = {
102
+ store: input.store,
103
+ assets: input.assets,
104
+ resolvePoi: (value) => value
105
+ };
106
+ const out = {};
107
+ for (const [id, value] of Object.entries(input.slots)) {
108
+ const def = input.declared[id];
109
+ out[id] = await resolveSlotValue(value, def, ctx);
110
+ }
111
+ return out;
112
+ }
113
+
114
+ //#endregion
115
+ export { cropRectOf, fixtureAssetRecords, fixtureMediaStore, resolveFixtureSlots };
@@ -1,5 +1,8 @@
1
- import { _ as PropertyFactsSchema } from "../packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js";
2
- import "../packages/internal/property-facts/dist/index.js";
1
+ import { storedAddressView } from "../packages/internal/template-contracts/dist/address-value.js";
2
+ import { derivedMembers } from "../packages/internal/template-contracts/dist/fact-compute.js";
3
+ import { splitMedia } from "../packages/internal/template-contracts/dist/registry-facts.js";
4
+ import { propertyFacts } from "../packages/internal/template-contracts/dist/fact-registry.js";
5
+ import { RegistryFactsSchema } from "../packages/internal/property-facts/dist/registry-facts.js";
3
6
  import { basename, extname } from "node:path";
4
7
 
5
8
  //#region src/fixtures/property.ts
@@ -25,6 +28,22 @@ const MIME_BY_EXTENSION = {
25
28
  ".svg": "image/svg+xml",
26
29
  ".zip": "application/zip"
27
30
  };
31
+ const CONTACT_IMAGE_FIELDS = [
32
+ "headshot",
33
+ "logo_dark",
34
+ "logo_light"
35
+ ];
36
+ const ADDRESS_PARTS = /* @__PURE__ */ new Set([
37
+ "street",
38
+ "unit",
39
+ "city",
40
+ "state",
41
+ "postal",
42
+ "latitude",
43
+ "longitude",
44
+ "source"
45
+ ]);
46
+ const COMPARABLE_FIELDS = propertyFacts.pages.comparables.declaration.element.fields;
28
47
  function mediaUrl(file) {
29
48
  return typeof file === "string" ? file : file.url;
30
49
  }
@@ -39,9 +58,156 @@ function isMediaFile(value) {
39
58
  if (typeof value === "string") return value.length > 0;
40
59
  return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.width === "number" && typeof value.height === "number";
41
60
  }
61
+ function isRecord(value) {
62
+ return typeof value === "object" && value !== null && !Array.isArray(value);
63
+ }
64
+ const ENTRY_SUBSTITUTIONS = /* @__PURE__ */ new Set([
65
+ "id",
66
+ "file",
67
+ "poster",
68
+ "preview",
69
+ "thumbnail_source_url",
70
+ "source"
71
+ ]);
72
+ const FIXTURE_EPOCH = Date.UTC(2026, 0, 1);
73
+ function addedAt(index) {
74
+ return new Date(FIXTURE_EPOCH + index * 1e3).toISOString();
75
+ }
76
+ const NOTHING_STATED = {
77
+ crop: null,
78
+ key: null,
79
+ mime: null,
80
+ bytes: null,
81
+ url: null,
82
+ provider: null,
83
+ account: null,
84
+ page_count: null,
85
+ duration_ms: null,
86
+ width: null,
87
+ height: null,
88
+ captured_at: null,
89
+ scan_count: null,
90
+ poster_at_ms: null,
91
+ renditions: {
92
+ master: null,
93
+ crop: null,
94
+ cutout: null,
95
+ mask_white: null,
96
+ mask_black: null,
97
+ poster: null,
98
+ encode: null
99
+ },
100
+ state: "ready"
101
+ };
102
+ function fixtureRecord(id, kind, name, added, stated) {
103
+ return {
104
+ ...NOTHING_STATED,
105
+ id,
106
+ file: id,
107
+ kind,
108
+ name,
109
+ added_at: added,
110
+ ...stated
111
+ };
112
+ }
113
+ function linkName(url) {
114
+ return typeof url === "string" ? url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "") : "";
115
+ }
116
+ function renditionsOf(held) {
117
+ return {
118
+ master: null,
119
+ crop: null,
120
+ cutout: null,
121
+ mask_white: null,
122
+ mask_black: null,
123
+ poster: null,
124
+ encode: null,
125
+ ...held
126
+ };
127
+ }
128
+ function renditionOf(file, mime = null) {
129
+ const sized = typeof file === "string" ? null : file;
130
+ return {
131
+ key: mediaUrl(file),
132
+ mime,
133
+ width: sized?.width ?? null,
134
+ height: sized?.height ?? null,
135
+ bytes: null
136
+ };
137
+ }
138
+ function thumbnailRendition(url) {
139
+ return {
140
+ key: url,
141
+ mime: null,
142
+ width: null,
143
+ height: null,
144
+ bytes: null
145
+ };
146
+ }
147
+ const AUTHORED_LISTS = /* @__PURE__ */ new Set([
148
+ "address",
149
+ "uploads",
150
+ "property_media",
151
+ "floor_plans",
152
+ "property_documents",
153
+ "hero",
154
+ "units",
155
+ "commercial_spaces",
156
+ "contacts",
157
+ "comparables"
158
+ ]);
159
+ const UNSTATED_UNIT_MEMBERS = {
160
+ floor: null,
161
+ hoa_monthly: null,
162
+ parking: null,
163
+ lot_sqft: null,
164
+ amenities: []
165
+ };
166
+ const UNSTATED_SPACE_MEMBERS = {
167
+ use: null,
168
+ sqft: null,
169
+ price: null,
170
+ floor: null,
171
+ parking: null,
172
+ amenities: []
173
+ };
174
+ const SORTED_LISTS = {
175
+ property_media: {
176
+ kinds: [
177
+ "image",
178
+ "video",
179
+ "tour"
180
+ ],
181
+ what: "a photo, video or tour"
182
+ },
183
+ floor_plans: {
184
+ kinds: ["image"],
185
+ what: "a floor plan"
186
+ },
187
+ property_documents: {
188
+ kinds: [
189
+ "document",
190
+ "image",
191
+ "video"
192
+ ],
193
+ what: "a document, image or video"
194
+ }
195
+ };
196
+ function omit(record, keys) {
197
+ return Object.fromEntries(Object.entries(record).filter(([key]) => !keys.has(key)));
198
+ }
199
+ function listOf(value) {
200
+ return Array.isArray(value) ? value : [];
201
+ }
42
202
  function canonicalizeProperty(property, file) {
43
203
  const violations = [];
44
204
  const media = /* @__PURE__ */ new Map();
205
+ const files = {};
206
+ const owning = (record) => {
207
+ const { file, value } = splitMedia(record);
208
+ files[file.id] = file;
209
+ return value;
210
+ };
45
211
  const invalid = (message) => {
46
212
  violations.push({
47
213
  rule: "fixtures/property-invalid",
@@ -50,15 +216,15 @@ function canonicalizeProperty(property, file) {
50
216
  });
51
217
  };
52
218
  const seen = /* @__PURE__ */ new Map();
53
- const admit = (pool, id, path) => {
219
+ const admit = (list, id, path) => {
54
220
  if (typeof id !== "string" || id === "") {
55
221
  invalid(`${path}: every entry needs a non-empty string id`);
56
222
  return false;
57
223
  }
58
- let ids = seen.get(pool);
59
- if (ids === void 0) seen.set(pool, ids = /* @__PURE__ */ new Set());
224
+ let ids = seen.get(list);
225
+ if (ids === void 0) seen.set(list, ids = /* @__PURE__ */ new Set());
60
226
  if (ids.has(id)) {
61
- invalid(`${path}: id "${id}" is repeated within ${pool}`);
227
+ invalid(`${path}: id "${id}" is repeated within ${list}`);
62
228
  return false;
63
229
  }
64
230
  ids.add(id);
@@ -69,122 +235,171 @@ function canonicalizeProperty(property, file) {
69
235
  invalid(`${path}: expected an imported media file`);
70
236
  return false;
71
237
  };
72
- const photos = [];
73
- for (const [i, photo] of (property.photos ?? []).entries()) {
74
- const path = `photos[${i}]`;
75
- if (!admit("photos", photo.id, path) || !admitFile(photo.file, `${path}.file`)) continue;
76
- const { file: photoFile, ...row } = photo;
77
- photos.push(row);
78
- media.set(photo.id, entry(photo.id, "image", photoFile, photo.caption ?? ""));
79
- }
80
- const floorPlans = [];
81
- for (const [i, plan] of (property.floor_plans ?? []).entries()) {
82
- const path = `floor_plans[${i}]`;
83
- if (!admit("floor_plans", plan.id, path) || !admitFile(plan.file, `${path}.file`)) continue;
84
- const { file: planFile, ...row } = plan;
85
- floorPlans.push({
86
- ...row,
87
- processed_s3_key: mediaUrl(planFile)
88
- });
89
- media.set(plan.id, entry(plan.id, "image", planFile, ""));
90
- }
91
238
  const admitThumbnail = (value, path) => {
92
239
  if (value === void 0) return {};
93
240
  if (typeof value === "string" && value !== "") return { posterUrl: value };
94
241
  invalid(`${path}.thumbnail_source_url: expected a non-empty URL`);
95
242
  return null;
96
243
  };
97
- const videos = [];
98
- for (const [i, video] of (property.videos ?? []).entries()) {
99
- const path = `videos[${i}]`;
100
- if (!admit("videos", video.id, path)) continue;
101
- if (video.source === "upload") {
102
- if (!admitFile(video.file, `${path}.file`)) continue;
103
- const { file: videoFile, poster, ...row } = video;
244
+ const uploads = [];
245
+ const pooled = (id, record, catalog) => {
246
+ uploads.push(owning(record));
247
+ media.set(id, catalog);
248
+ };
249
+ for (const [i, raw] of listOf(property.uploads).entries()) {
250
+ const path = `uploads[${i}]`;
251
+ if (!isRecord(raw)) {
252
+ invalid(`${path}: expected an upload entry`);
253
+ continue;
254
+ }
255
+ if (!admit("uploads", raw["id"], path)) continue;
256
+ const id = raw["id"];
257
+ const { file: entryFile, poster, preview, thumbnail_source_url: thumbnail } = raw;
258
+ const stated = omit(raw, ENTRY_SUBSTITUTIONS);
259
+ const added = addedAt(i);
260
+ const fileNamed = (file, held = {}) => ({
261
+ mime: mimeOf(mediaUrl(file)),
262
+ ...stated,
263
+ key: mediaUrl(file),
264
+ renditions: renditionsOf(held)
265
+ });
266
+ const kind = raw["kind"];
267
+ if (kind === "video" && raw["source"] !== "upload" && raw["source"] !== "link") {
268
+ invalid(`${path}.source: expected "upload" or "link"`);
269
+ continue;
270
+ }
271
+ if (kind === "image") {
272
+ if (!admitFile(entryFile, `${path}.file`)) continue;
273
+ pooled(id, fixtureRecord(id, "image", displayName(mediaUrl(entryFile)), added, fileNamed(entryFile)), entry(id, "image", entryFile));
274
+ } else if (kind === "video" && raw["source"] === "upload") {
275
+ if (!admitFile(entryFile, `${path}.file`)) continue;
104
276
  if (poster !== void 0 && !admitFile(poster, `${path}.poster`)) continue;
105
- videos.push({
106
- ...row,
107
- url: null,
108
- provider: null
109
- });
110
- media.set(video.id, {
111
- ...entry(video.id, "video", videoFile, video.caption ?? ""),
277
+ const held = {
278
+ encode: renditionOf(entryFile, mimeOf(mediaUrl(entryFile))),
279
+ ...poster === void 0 ? {} : { poster: renditionOf(poster) }
280
+ };
281
+ pooled(id, fixtureRecord(id, "video", displayName(mediaUrl(entryFile)), added, fileNamed(entryFile, held)), {
282
+ ...entry(id, "video", entryFile),
112
283
  ...poster === void 0 ? {} : { posterFile: poster }
113
284
  });
114
- } else {
115
- const { thumbnail_source_url: thumbnail, ...row } = video;
116
- const poster = admitThumbnail(thumbnail, path);
117
- if (poster === null) continue;
118
- videos.push(row);
119
- media.set(video.id, {
120
- ...entry(video.id, "video", null, video.caption ?? ""),
121
- url: video.url,
122
- provider: video.provider,
123
- ...poster
285
+ } else if (kind === "video" || kind === "tour") {
286
+ const thumb = admitThumbnail(thumbnail, path);
287
+ if (thumb === null) continue;
288
+ const held = thumb.posterUrl === void 0 ? {} : { poster: thumbnailRendition(thumb.posterUrl) };
289
+ pooled(id, fixtureRecord(id, kind, linkName(raw["url"]), added, {
290
+ ...stated,
291
+ renditions: renditionsOf(held)
292
+ }), {
293
+ ...entry(id, kind, null),
294
+ url: typeof raw["url"] === "string" ? raw["url"] : null,
295
+ provider: typeof raw["provider"] === "string" ? raw["provider"] : null,
296
+ ...thumb
124
297
  });
125
- }
126
- }
127
- const tours = [];
128
- for (const [i, tour] of (property.tours ?? []).entries()) {
129
- const path = `tours[${i}]`;
130
- if (!admit("tours", tour.id, path)) continue;
131
- const { thumbnail_source_url: thumbnail, ...row } = tour;
132
- const poster = admitThumbnail(thumbnail, path);
133
- if (poster === null) continue;
134
- tours.push(row);
135
- media.set(tour.id, {
136
- ...entry(tour.id, "tour", null, ""),
137
- url: tour.url,
138
- provider: tour.provider,
139
- ...poster
140
- });
298
+ } else if (kind === "document") {
299
+ if (!admitFile(entryFile, `${path}.file`)) continue;
300
+ if (preview !== void 0 && !admitFile(preview, `${path}.preview`)) continue;
301
+ const url = mediaUrl(entryFile);
302
+ const held = preview === void 0 ? {} : { poster: renditionOf(preview) };
303
+ pooled(id, fixtureRecord(id, "document", displayName(url), added, fileNamed(entryFile, held)), {
304
+ ...entry(id, "document", entryFile),
305
+ ...preview === void 0 ? {} : { posterFile: preview }
306
+ });
307
+ } else invalid(`${path}.kind: expected "image", "video", "tour" or "document"`);
141
308
  }
142
- const documents = [];
143
- const documentNotes = [];
144
- for (const [i, doc] of (property.documents ?? []).entries()) {
145
- const path = `documents[${i}]`;
146
- if (!admit("documents", doc.id, path) || !admitFile(doc.file, `${path}.file`)) continue;
147
- const { file: docFile, ...row } = doc;
148
- const url = mediaUrl(docFile);
149
- documents.push({
150
- ...row,
151
- filename: displayName(url),
152
- mime: mimeOf(url)
153
- });
154
- if (typeof doc.notes === "string" && doc.notes !== "") documentNotes.push({
155
- upload_id: doc.id,
156
- notes: doc.notes
157
- });
158
- media.set(doc.id, entry(doc.id, "document", docFile, ""));
309
+ const statedKinds = new Map(listOf(property.uploads).flatMap((raw) => isRecord(raw) && typeof raw["id"] === "string" ? [[raw["id"], raw["kind"]]] : []));
310
+ const sorted = {
311
+ property_media: [],
312
+ floor_plans: [],
313
+ property_documents: []
314
+ };
315
+ for (const list of Object.keys(SORTED_LISTS)) {
316
+ const { kinds, what } = SORTED_LISTS[list];
317
+ for (const [i, value] of listOf(property[list]).entries()) {
318
+ const path = `${list}[${i}]`;
319
+ const id = isRecord(value) ? value["id"] : void 0;
320
+ const kind = typeof id === "string" ? statedKinds.get(id) : void 0;
321
+ if (typeof id !== "string" || !kinds.includes(kind)) invalid(`${path}: expected ${what} among the property's uploads`);
322
+ else if (admit(list, id, path)) sorted[list].push({ media: id });
323
+ }
159
324
  }
325
+ const picked = (value, list, path) => {
326
+ const id = isRecord(value) ? value["id"] : void 0;
327
+ if (typeof id !== "string" || files[id]?.["kind"] !== "image" || !sorted[list].some((ref) => ref.media === id)) {
328
+ invalid(`${path}: expected ${list === "property_media" ? "a photo" : "a floor plan"} among the property's ${list}`);
329
+ return null;
330
+ }
331
+ return { media: id };
332
+ };
333
+ const hero = property.hero === void 0 || property.hero === null ? null : picked(property.hero, "property_media", "hero");
334
+ const owned = (value, id, path) => {
335
+ if (value === null || value === void 0) return null;
336
+ if (!admitFile(value, path)) return null;
337
+ media.set(id, entry(id, "image", value));
338
+ return owning(fixtureRecord(id, "image", displayName(mediaUrl(value)), addedAt(0), {
339
+ mime: mimeOf(mediaUrl(value)),
340
+ key: mediaUrl(value)
341
+ }));
342
+ };
343
+ const rowsPicking = (list, rows, unstated) => {
344
+ const out = [];
345
+ for (const [i, raw] of listOf(rows).entries()) {
346
+ const path = `${list}[${i}]`;
347
+ if (!isRecord(raw) || !admit(list, raw["id"], path)) continue;
348
+ const floorPlans = listOf(raw["floor_plans"]).flatMap((plan, j) => {
349
+ const at = `${path}.floor_plans[${j}]`;
350
+ if (!isRecord(plan)) {
351
+ invalid(`${at}: expected a floor plan the row holds`);
352
+ return [];
353
+ }
354
+ const { image, ...rest } = plan;
355
+ const ref = picked(image, "floor_plans", `${at}.image`);
356
+ return ref === null ? [] : [{
357
+ id: ref.media,
358
+ image: ref,
359
+ ...rest
360
+ }];
361
+ });
362
+ const photos = listOf(raw["photos"]).flatMap((photo, j) => {
363
+ const ref = picked(photo, "property_media", `${path}.photos[${j}]`);
364
+ return ref === null ? [] : [ref];
365
+ });
366
+ out.push({
367
+ ...unstated,
368
+ ...raw,
369
+ floor_plans: floorPlans,
370
+ photos
371
+ });
372
+ }
373
+ return out;
374
+ };
375
+ const units = rowsPicking("units", property.units, UNSTATED_UNIT_MEMBERS);
376
+ const commercialSpaces = rowsPicking("commercial_spaces", property.commercial_spaces, UNSTATED_SPACE_MEMBERS);
377
+ const statedAddress = (value, path) => {
378
+ if (value !== null && value !== void 0 && !isRecord(value)) invalid(`${path}: expected an address — its parts and its pin — or null`);
379
+ for (const [key, part] of Object.entries(isRecord(value) ? value : {})) if (!ADDRESS_PARTS.has(key)) invalid(`${path}.${key}: not a member an address states (its parts and its pin)`);
380
+ else if (part !== null && part !== void 0) {
381
+ const coordinate = key === "latitude" || key === "longitude";
382
+ if (coordinate ? typeof part !== "number" : typeof part !== "string") invalid(`${path}.${key}: expected ${coordinate ? "a number" : "a string"} or null`);
383
+ }
384
+ return storedAddressView(value);
385
+ };
160
386
  const contacts = [];
161
- for (const [i, contact] of (property.contacts ?? []).entries()) {
387
+ for (const [i, raw] of listOf(property.contacts).entries()) {
162
388
  const path = `contacts[${i}]`;
163
- if (!admit("contacts", contact.id, path)) continue;
164
- const { avatar, logo_dark: logoDark, logo_light: logoLight, ...row } = contact;
165
- const image = (value, field) => {
166
- if (value === null || value === void 0) return null;
167
- if (!admitFile(value, `${path}.${field}`)) return null;
168
- const id = contactImageId(contact.id, field);
169
- media.set(id, entry(id, "image", value, contact.name ?? ""));
170
- return id;
171
- };
172
- contacts.push({
173
- ...row,
174
- avatar_upload_id: image(avatar, "avatar"),
175
- logo_dark_upload_id: image(logoDark, "logo_dark"),
176
- logo_light_upload_id: image(logoLight, "logo_light")
177
- });
389
+ if (!isRecord(raw) || !admit("contacts", raw["id"], path)) continue;
390
+ const contact = { ...raw };
391
+ for (const field of CONTACT_IMAGE_FIELDS) contact[field] = owned(raw[field], contactImageId(raw["id"], field), `${path}.${field}`);
392
+ contact["address"] = statedAddress(raw["address"], `${path}.address`);
393
+ contacts.push(contact);
178
394
  }
395
+ const subject = statedAddress(property.address, "address");
179
396
  const comparables = [];
180
- for (const [i, comp] of (property.comparables ?? []).entries()) {
181
- const { photo, ...row } = comp;
182
- let photoId = null;
183
- if (photo !== null && photo !== void 0 && admitFile(photo, `comparables[${i}].photo`)) {
184
- photoId = comparableImageId(comp.id);
185
- media.set(photoId, entry(photoId, "image", photo, comp.address));
186
- }
187
- comparables.push({
397
+ for (const [i, raw] of listOf(property.comparables).entries()) {
398
+ const path = `comparables[${i}]`;
399
+ if (!isRecord(raw) || !admit("comparables", raw["id"], path)) continue;
400
+ const { photo, ...row } = raw;
401
+ const address = statedAddress(raw["address"], `${path}.address`);
402
+ const comparable = {
188
403
  year_built: null,
189
404
  lot_sqft: null,
190
405
  stories: null,
@@ -194,9 +409,16 @@ function canonicalizeProperty(property, file) {
194
409
  listed_date: null,
195
410
  mls_number: null,
196
411
  description: null,
197
- property_type: null,
198
412
  ...row,
199
- photo_upload_id: photoId
413
+ address,
414
+ photo: owned(photo, comparableImageId(raw["id"]), `${path}.photo`)
415
+ };
416
+ comparables.push({
417
+ ...comparable,
418
+ ...derivedMembers(COMPARABLE_FIELDS, comparable, {
419
+ address: subject,
420
+ listing_intent: property.listing_intent
421
+ })
200
422
  });
201
423
  }
202
424
  if (violations.length > 0) return {
@@ -205,23 +427,21 @@ function canonicalizeProperty(property, file) {
205
427
  violations
206
428
  };
207
429
  const candidate = {
208
- address: property.address,
209
- lat: property.lat,
210
- lon: property.lon,
211
- property_type: property.property_type,
212
- listing_intent: property.listing_intent,
213
- units: property.units,
214
- narrative: property.narrative,
215
- tours,
430
+ site_url: null,
431
+ ...omit(property, AUTHORED_LISTS),
432
+ address: subject,
433
+ uploads,
434
+ property_media: sorted.property_media,
435
+ floor_plans: sorted.floor_plans,
436
+ property_documents: sorted.property_documents,
437
+ hero,
438
+ units,
439
+ commercial_spaces: commercialSpaces,
440
+ contacts,
216
441
  comparables,
217
- photos,
218
- floor_plans: floorPlans,
219
- videos,
220
- document_notes: documentNotes,
221
- documents,
222
- contacts
223
- };
224
- const parsed = PropertyFactsSchema.safeParse(candidate);
442
+ files
443
+ };
444
+ const parsed = RegistryFactsSchema.safeParse(candidate);
225
445
  if (!parsed.success) {
226
446
  for (const issue of parsed.error.issues) invalid(`${issue.path.map(String).join(".") || "(root)"}: ${issue.message}`);
227
447
  return {
@@ -236,7 +456,7 @@ function canonicalizeProperty(property, file) {
236
456
  violations
237
457
  };
238
458
  }
239
- function entry(id, kind, file, alt) {
459
+ function entry(id, kind, file) {
240
460
  const url = file === null ? "" : mediaUrl(file);
241
461
  return {
242
462
  id,
@@ -244,7 +464,6 @@ function entry(id, kind, file, alt) {
244
464
  file,
245
465
  url: null,
246
466
  provider: null,
247
- alt,
248
467
  filename: url === "" ? "" : displayName(url),
249
468
  mime: url === "" ? "" : mimeOf(url)
250
469
  };