@uniweb/runtime 0.15.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/src/prefetch.js CHANGED
@@ -10,12 +10,12 @@
10
10
  * compute that itself: resolve the configs, issue the requests, unwrap the responses in the
11
11
  * shape the datastore expects — a copy of the runtime's logic, in another repo, drifting
12
12
  * (the records envelope went silently unread that way on 2026-09-02). [Diego, 2026-09-03]:
13
- * *the backend sets `config.records`; the fetch comes from the runtime.* The host now calls
13
+ * *the backend sets the records service; the fetch comes from the runtime.* The host now calls
14
14
  * this and carries no copy. Hosting agreed to exactly that shape the same day.
15
15
  *
16
16
  * ⛔ Contract with the host, deliberately small:
17
17
  * - `content` the render payload (`site-content.json` / `__DATA__`), config included —
18
- * `config.records` and `config.base` are read from it.
18
+ * `config.services` and `config.base` are read from it.
19
19
  * - `route` the page to prefetch for; a `[slug]` template resolves through the same
20
20
  * matcher the SPA uses, so `/blog/post-1` finds `/blog/:slug`.
21
21
  * - `fetch` how to dispatch a request. The runtime composes the address; the host
@@ -46,7 +46,8 @@
46
46
  * is a different cache decision (hosting, 2026-09-03).
47
47
  *
48
48
  * It resolves nothing the host owns and models no host route layout: every address is
49
- * `{base}/…` from the payload, or an endpoint the host itself published in `config.records`.
49
+ * `{base}/…` from the payload, or the records service the host itself
50
+ * published at `config.services.records`.
50
51
  */
51
52
  import { resolveFetchConfigs } from '@uniweb/core/fetch-config'
52
53
  import { deriveCacheKey } from '@uniweb/core/datastore'
@@ -117,7 +118,7 @@ export function resolvePageFetchConfigs(content, route, { locale = null } = {})
117
118
  locale,
118
119
  defaultLocale: resolveDefaultLocale(content?.config) ?? null,
119
120
  queries: content?.config?.queries ?? null,
120
- records: content?.config?.records ?? null,
121
+ services: content?.config?.services ?? null,
121
122
  variables: binding?.variables ?? null,
122
123
  }
123
124
  const out = new Map()
@@ -162,7 +163,7 @@ export function resolvePageFetchConfigs(content, route, { locale = null } = {})
162
163
  * @param {Object[]} configs resolved configs (from `resolvePageFetchConfigs` or the host's own
163
164
  * call to `resolveFetchConfigs`)
164
165
  * @param {Object} opts
165
- * @param {Object} opts.content the payload — `config.base`, `config.records`
166
+ * @param {Object} opts.content the payload — `config.base`, `config.services`
166
167
  * @param {Function} [opts.fetch] the transport; defaults to the global `fetch`
167
168
  * @param {boolean} [opts.dev]
168
169
  * @returns {Promise<Array<{ config: Object, outcome: 'fetched'|'failed'|'skipped', data: any, error?: string }>>}
@@ -173,12 +174,11 @@ export async function executeFetchConfigs(configs, { content, fetch = null, dev
173
174
  }
174
175
  const fetcher = createDefaultFetcher({
175
176
  basePath: content?.config?.base || '',
176
- records: content?.config?.records ?? null,
177
177
  dev,
178
178
  fetch,
179
179
  })
180
180
  const ctx = { website: null }
181
- // Dispatched together, not one after another: a question door batches the
181
+ // Dispatched together, not one after another: the records service batches the
182
182
  // requests issued in one tick into one POST, and a page's configs are
183
183
  // independent of each other. Order is preserved in the result.
184
184
  return Promise.all((configs || []).filter(Boolean).map(async (config) => {
package/src/setup.js CHANGED
@@ -246,11 +246,8 @@ function buildDefaultFetcher(content) {
246
246
  // transports (`fetcher.transports`) plus a transport's own binding config,
247
247
  // which a transport reads through ctx.website.config.fetcher.
248
248
  //
249
- // The host's live-records stamp (`config.records`), when a backend set one: the fetcher
250
- // reads its `envelope` for requests that resolved to that lane.
251
- const records = content?.config?.records ?? null
252
249
  const dev = !!(import.meta.env && import.meta.env.DEV)
253
- return createDefaultFetcher({ basePath, dev, records })
250
+ return createDefaultFetcher({ basePath, dev })
254
251
  }
255
252
 
256
253
  /**
package/src/ssr.js CHANGED
@@ -58,7 +58,7 @@ export {
58
58
 
59
59
  // Server-side prefetch — the runtime executing a page's fetches for a host, so an isolate
60
60
  // receives `fetchedData` computed by our fetcher and the host carries no copy of it.
61
- // [Diego, 2026-09-03]: the backend sets config.records; the fetch comes from the runtime.
61
+ // [Diego, 2026-09-03]: the backend sets the records service; the fetch comes from the runtime.
62
62
  export {
63
63
  findPageForRoute,
64
64
  resolvePageFetchConfigs,
@@ -72,6 +72,13 @@ export {
72
72
  // what it deliberately leaves to the host.
73
73
  export { createPageRenderer, prefetchAndHydrate } from './page-renderer.js'
74
74
 
75
+ // The whole corpus, rather than one page — for a host that indexes a site or
76
+ // derives something over every record its queries return. It asks through the
77
+ // same client and the same composition a page render uses, which is the point:
78
+ // an index that composed its own questions could offer a result whose page then
79
+ // renders empty. The host supplies only the transport.
80
+ export { collectSiteRecords } from './collect-records.js'
81
+
75
82
  // Appearance. injectPageContent() already emits this for every prerendered
76
83
  // page; exported for lanes that assemble a shell without a per-page render.
77
84
  export { renderAppearanceBootScript } from './appearance.js'