@uniweb/core 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
@@ -42,8 +42,8 @@
42
42
  "vitest": "^4.1.7"
43
43
  },
44
44
  "dependencies": {
45
- "@uniweb/theming": "^0.1.15",
46
- "@uniweb/semantic-parser": "^1.4.0"
45
+ "@uniweb/semantic-parser": "^1.4.0",
46
+ "@uniweb/theming": "^0.1.15"
47
47
  },
48
48
  "scripts": {
49
49
  "test": "vitest run"
@@ -109,19 +109,37 @@ function applyDeferredDetail(cfg, queries, records) {
109
109
  // projection is not obliged to carry — so on such a host that rule can never
110
110
  // fire, and this is the only way a detail page reaches a whole record.
111
111
  if (cfg.endpoint) {
112
- const recordPattern = resolveRecordAddressPattern(cfg.query ?? cfg.schema, records)
112
+ // `cfg.query`, not `cfg.query ?? cfg.schema`. The `??` was unreachable:
113
+ // `endpoint` is set in exactly one place (`resolveQuerySource`), which returns
114
+ // early unless `cfg.query` is a non-empty string — so reaching here proves it.
115
+ // It read as a tolerance for two producer shapes and was really a vestige of
116
+ // the build lane not emitting `query`, which it now does.
117
+ const recordPattern = resolveRecordAddressPattern(cfg.query, records)
113
118
  if (recordPattern) return { ...cfg, detail: recordPattern }
114
119
  }
115
120
 
116
- const schema = cfg.schema
117
- if (!schema || !queries) return cfg
118
- const collConfig = queries[schema]
121
+ // **`config.queries` is keyed by QUERY NAME, so look it up by the query.**
122
+ // This read `cfg.schema` the BINDING KEY, which merely defaults to the query
123
+ // name. `fetch: { query: 'articles', schema: 'posts' }` is a supported, allow-
124
+ // listed, unwarned form (`RECOGNIZED_FETCH_KEYS.query`), and under it the lookup
125
+ // missed and a detail page silently rendered the brief without its body.
126
+ // Measured 2026-09-01, control passing: `{query:'articles'}` resolved
127
+ // `/data/articles/{slug}.json`; `{query:'articles',schema:'posts'}` resolved
128
+ // nothing, from the same file.
129
+ //
130
+ // ⚖️ The `|| cfg.schema` is NOT the vestige deleted above. A source-shape fetch
131
+ // (`{ path: … }`) has no query at all, and its schema — inferred from the path —
132
+ // is the only key there is. Two shapes, two answers; the deleted one had one
133
+ // shape and pretended otherwise.
134
+ const queryName = cfg.query || cfg.schema
135
+ if (!queryName || !queries) return cfg
136
+ const collConfig = queries[queryName]
119
137
  if (!collConfig || typeof collConfig !== 'object') return cfg
120
138
  const deferred = Array.isArray(collConfig.deferred) ? collConfig.deferred : null
121
139
  if (!deferred || deferred.length === 0) return cfg
122
140
  const pattern = typeof collConfig.detailUrl === 'string'
123
141
  ? collConfig.detailUrl
124
- : recordDataUrl(schema, '{slug}')
142
+ : recordDataUrl(queryName, '{slug}')
125
143
  return { ...cfg, detail: pattern }
126
144
  }
127
145