@uniweb/build 1.11.2 → 1.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,11 +56,11 @@
56
56
  "js-yaml": "^4.3.2",
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
- "@uniweb/theming": "~1.2.1",
60
- "@uniweb/schemas": "~1.6.6",
61
- "@uniweb/semantic-parser": "~1.13.0",
59
+ "@uniweb/schemas": "~1.6.7",
62
60
  "@uniweb/content-reader": "~1.5.7",
61
+ "@uniweb/theming": "~1.2.1",
63
62
  "@uniweb/content-writer": "~1.3.1",
63
+ "@uniweb/semantic-parser": "~1.13.0",
64
64
  "@uniweb/projections": "~1.2.7"
65
65
  },
66
66
  "optionalDependencies": {
@@ -206,10 +206,23 @@ function referencedModels(model) {
206
206
  return out
207
207
  }
208
208
 
209
- /** The fields of a model's brief — what a reference to one of its records is delivered as. */
209
+ /**
210
+ * The fields of a model's brief — what a reference to one of its records is delivered as: the
211
+ * section the declaration marks `brief: true`, at any depth (inside a group, say), else the one
212
+ * section of a model that has a single one.
213
+ */
210
214
  function briefFields(model) {
215
+ const marked = (sections) => {
216
+ for (const section of Object.values(sections || {})) {
217
+ if (section?.brief) return section
218
+ const nested = Object.fromEntries(Object.entries(section?.fields || {}).filter(([, f]) => f?.type === 'section'))
219
+ const found = marked(nested)
220
+ if (found) return found
221
+ }
222
+ return null
223
+ }
211
224
  const sections = Object.values(model?.sections || {})
212
- const brief = sections.find((s) => s?.brief) ?? (sections.length === 1 && !sections[0]?.multiple ? sections[0] : null)
225
+ const brief = marked(model?.sections) ?? (sections.length === 1 && !sections[0]?.multiple ? sections[0] : null)
213
226
  return brief?.fields ?? null
214
227
  }
215
228
 
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import { parseOptionsRef, FIELD_RULES } from '@uniweb/schemas/format'
25
+ import { markedBriefPath } from '@uniweb/schemas/conform'
25
26
  import { qualifyRef } from '@uniweb/schemas/refs'
26
27
 
27
28
  // Text kinds carry per-locale values when localized.
@@ -159,7 +160,7 @@ export function toDataSchemaDeclaration(normalized, { name, resolveName, resolve
159
160
  // The model-level sort axis is inline: `sort_date: true` on the brief's named
160
161
  // date field (replaces the old schema-level `sort_date_field` back-reference).
161
162
  if (normalized.sortDate && brief) {
162
- const f = sections[brief]?.fields?.[normalized.sortDate]
163
+ const f = sectionAt(sections, brief)?.fields?.[normalized.sortDate]
163
164
  if (f) f.sort_date = true
164
165
  }
165
166
 
@@ -291,24 +292,25 @@ function lowerFieldsForm(fields, resolve, optResolve, constraints) {
291
292
  }
292
293
  }
293
294
 
294
- // The explicit `sections:` map → a map of lowered section bodies. The brief is the
295
- // section marked `brief: true`, else the first `single` (the framework's inference).
295
+ // The explicit `sections:` map → a map of lowered section bodies. The brief is the section
296
+ // marked `brief: true` at any depth (`markedBriefPath`, `@uniweb/schemas/conform`), else the
297
+ // first top-level `single` not marked `brief: false` (the framework's inference).
296
298
  function lowerSectionsForm(sectionsMap, resolve, optResolve) {
297
299
  const sections = {}
298
- let explicit = null
299
300
  let firstSingle = null
300
301
  for (const [secName, def] of Object.entries(sectionsMap)) {
301
302
  sections[secName] = lowerSection(def, resolve, optResolve, secName)
302
- if (def.brief === true) explicit = secName
303
- if (!firstSingle && (def.kind || 'single') === 'single') firstSingle = secName
303
+ if (!firstSingle && (def.kind || 'single') === 'single' && def.brief !== false) firstSingle = secName
304
304
  }
305
- // The brief is the section marked `brief: true`, else the first `single` (the
306
- // framework's inference). Stamp it inline so the wire and the producer's own
307
- // consumers (entity-shaping, back-fill render) find it the same way — the
308
- // sections-tree has no schema-level `brief:` back-reference.
309
- const brief = explicit || firstSingle
310
- if (brief && sections[brief] && !sections[brief].brief) sections[brief].brief = true
311
- return { sections, brief }
305
+ // A marked brief is lowered where it sits, marked; only with none is the inferred one stamped,
306
+ // inline, so the wire and the producer's own consumers (entity-shaping, back-fill render) find
307
+ // it the same way — the sections-tree has no schema-level `brief:` back-reference. ⛔ Until
308
+ // 2026-10-29 only a top-level mark was seen here, so a brief marked inside a group went out
309
+ // beside the first top-level single, stamped too, and a register refused the two.
310
+ const marked = markedBriefPath({ sections: sectionsMap })
311
+ if (marked) return { sections, brief: marked }
312
+ if (firstSingle) sections[firstSingle].brief = true
313
+ return { sections, brief: firstSingle }
312
314
  }
313
315
 
314
316
  // Lower one section to its declaration body (the caller keys it by name; a nested
@@ -303,9 +303,6 @@ function stampList(def, items, at, banks, counts, claimed) {
303
303
  single.$uuid = u
304
304
  claimed.add(u)
305
305
  counts.stamped++
306
- } else {
307
- // Under an item the backend holds, with no identity here: one the backend may hold.
308
- counts.unbankedSingles++
309
306
  }
310
307
  })
311
308
  }
@@ -322,13 +319,10 @@ function stampList(def, items, at, banks, counts, claimed) {
322
319
  * @param {object} declaration - its data schema's declaration
323
320
  * @param {Object<string,string>} bank - this record's entry (`harvestRecordItems` /
324
321
  * `storedRecordItems`)
325
- * @returns {{ stamped: number, unknown: number, unbankedSingles: number }} items given a
326
- * uuid; list items sent as new; and single sections under an item that kept its uuid but
327
- * with none banked for them, which a backend may hold (a bank from before 2026-10-28 has
328
- * none), so the caller can recover them
322
+ * @returns {{ stamped: number, unknown: number }} items given a uuid, and list items sent as new
329
323
  */
330
324
  export function stampRecordItems(document, declaration, bank) {
331
- const counts = { stamped: 0, unknown: 0, unbankedSingles: 0 }
325
+ const counts = { stamped: 0, unknown: 0 }
332
326
  const claimed = new Set()
333
327
  const banks = { lists: bankedLists(bank), singles: bankedSingles(bank) }
334
328
  eachRecordList(declaration, document, (path, def, items) => {
@@ -554,10 +554,6 @@ export async function emitSyncPackages(siteRoot, opts = {}) {
554
554
  const n = stampRecordItems(e.document, declaration, banked)
555
555
  recordItemIdentity.stamped += n.stamped
556
556
  recordItemIdentity.unknown += n.unknown
557
- // A single section under an item the backend holds, banked nowhere — a bank from before such
558
- // sections were banked (2026-10-28) — is recovered as an unbanked record's items are: sent
559
- // without its `$uuid`, a push after the first is refused whole.
560
- if (n.unbankedSingles > 0) unbankedIds.add(e.id)
561
557
  }
562
558
 
563
559
  const siteEntity = siteDoc