@elytracms/next 0.0.86 → 0.0.88
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/dist/index.d.ts +82 -216
- package/dist/index.js +64 -202
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import { ComponentRegistry, ComponentIssue, ComponentManifest } from '@elytracms/core/component-registry';
|
|
3
3
|
export { ComponentManifest, PropField, SlotSpec, defineComponent } from '@elytracms/core/component-registry';
|
|
4
|
-
import { ComponentImplementations,
|
|
4
|
+
import { ComponentImplementations, RelationTarget, DocumentBodyItem } from '@elytracms/core/runtime-renderer';
|
|
5
5
|
export { ComponentImplementations, RenderAsset } from '@elytracms/core/runtime-renderer';
|
|
6
6
|
import { HostComponentEntry } from '@elytracms/core/studio-core';
|
|
7
7
|
import { ResolvePageResult, ResolvedAsset, Perspective, ContentClient, CacheTags, ContentDocumentSource, ResolvedDocument } from '@elytracms/core/content';
|
|
8
8
|
export { Perspective } from '@elytracms/core/content';
|
|
9
9
|
import { LocaleConfig, Locale, RouteRecord, CollectionDef, RedirectRecord } from '@elytracms/core/cms-core';
|
|
10
10
|
export { CmsDocument, CollectionDef, FieldDef, Locale, LocaleConfig, LocaleRequest, LocaleStrategy, LocaleUrlPath, RedirectRecord, RouteRecord, documentSchema, fallbackHomeRoutes, localeConfigSchema, localeUrlPath, mergeRouteRecords, redirectRecordSchema, resolveLocale, routeRecordSchema, splitLocalePath, textDirection } from '@elytracms/core/cms-core';
|
|
11
|
-
import { ComponentNode } from '@elytracms/core/project-graph';
|
|
12
|
-
export { ComponentNode } from '@elytracms/core/project-graph';
|
|
13
11
|
import { AssetRecord, PersistenceAdapter } from '@elytracms/core/persistence';
|
|
14
12
|
export { AssetRecord } from '@elytracms/core/persistence';
|
|
15
|
-
import { Metadata, MetadataRoute } from 'next';
|
|
13
|
+
import { ResolvingMetadata, Metadata, ResolvedMetadata, MetadataRoute } from 'next';
|
|
16
14
|
import { z } from 'zod';
|
|
17
15
|
export { z } from 'zod';
|
|
18
16
|
import { ImageLoader } from 'next/image';
|
|
19
17
|
import { HostImageRenderer } from './host-image.js';
|
|
18
|
+
export { ComponentNode } from '@elytracms/core/project-graph';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* One host-repo component: the manifest the builder edits against plus the
|
|
@@ -69,8 +68,9 @@ interface DefineHostComponentsOptions {
|
|
|
69
68
|
* strict {@link HostComponent}: the config declares implementations opaquely,
|
|
70
69
|
* and EC-539 made `createElytraHost({ ...site })` the contract, so a
|
|
71
70
|
* compile-time check at this seam was already gone for the recommended path.
|
|
72
|
-
* The check is RUNTIME instead (EC-541)
|
|
73
|
-
*
|
|
71
|
+
* The check is RUNTIME instead (EC-541), through core's one registration step
|
|
72
|
+
* `registerImplementations` (EC-555 — the studio registry and the preview
|
|
73
|
+
* harness call the same one): a value that is not a component is
|
|
74
74
|
* recorded as an `invalid-implementation` issue naming the component id and
|
|
75
75
|
* the received kind, and is NOT put into `implementations` — so the renderer
|
|
76
76
|
* takes its missing-component path (a visible EC-015 fallback) instead of
|
|
@@ -88,71 +88,6 @@ interface DefineHostComponentsOptions {
|
|
|
88
88
|
*/
|
|
89
89
|
declare function defineHostComponents(components?: readonly HostComponentEntry[], options?: DefineHostComponentsOptions): HostComponents;
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
* Binding payloads for the embedded runtime (EC-144): one payload value per
|
|
93
|
-
* binding `sourceId`. The catch-all route helper provides `document` (the
|
|
94
|
-
* route-bound resolved document) and `params` (dynamic route params) by
|
|
95
|
-
* default; hosts add more through the route helper's `payloads` factory
|
|
96
|
-
* (e.g. a `listDocuments` result for a posts repeater).
|
|
97
|
-
*
|
|
98
|
-
* This is a deliberately small, pure resolver — the embedded runtime never
|
|
99
|
-
* imports `@elytracms/core/data-binding` (a builder-side package). Semantics mirror
|
|
100
|
-
* EC-023 tokens: a binding token is a JSON Pointer (RFC 6901) into the
|
|
101
|
-
* payload; a miss resolves to `undefined`, never a throw (the renderer turns
|
|
102
|
-
* unresolvable bindings into visible fallback behavior, EC-015).
|
|
103
|
-
*/
|
|
104
|
-
type BindingPayloads = Record<string, unknown>;
|
|
105
|
-
/**
|
|
106
|
-
* Marker key of an {@link SourcePayloadError} payload. A plain string property
|
|
107
|
-
* (not a Symbol) on purpose: the route helper's cached path JSON-serializes
|
|
108
|
-
* payloads through `unstable_cache`, and the marker must survive that
|
|
109
|
-
* round-trip.
|
|
110
|
-
*/
|
|
111
|
-
declare const SOURCE_PAYLOAD_ERROR_KEY = "__elytraSourcePayloadError";
|
|
112
|
-
/**
|
|
113
|
-
* Explicit issue payload for a source whose stored query was REJECTED at
|
|
114
|
-
* delivery (EC-177 gap 3) — e.g. a sort/filter field that is no longer
|
|
115
|
-
* filterable in the live schema. Materialization stores this instead of a
|
|
116
|
-
* silently-absent payload; `createBindingResolver` throws on it, which the
|
|
117
|
-
* renderer converts into its visible per-node render-error fallback (EC-015).
|
|
118
|
-
* Validation principle: a broken stored query is a visible state, never an
|
|
119
|
-
* empty section.
|
|
120
|
-
*/
|
|
121
|
-
interface SourcePayloadError {
|
|
122
|
-
[SOURCE_PAYLOAD_ERROR_KEY]: true;
|
|
123
|
-
sourceId: string;
|
|
124
|
-
/** Human-readable messages of the structured query errors. */
|
|
125
|
-
messages: string[];
|
|
126
|
-
}
|
|
127
|
-
/** Build the explicit issue payload for one failed source query. */
|
|
128
|
-
declare function sourcePayloadError(sourceId: string, messages: readonly string[]): SourcePayloadError;
|
|
129
|
-
/** `true` when a payload value is an explicit {@link SourcePayloadError}. */
|
|
130
|
-
declare function isSourcePayloadError(value: unknown): value is SourcePayloadError;
|
|
131
|
-
/**
|
|
132
|
-
* Resolve a JSON Pointer token within a payload value. Numeric segments index
|
|
133
|
-
* arrays; string segments index plain objects. Any miss (unknown key,
|
|
134
|
-
* out-of-range index, traversal through a primitive) yields `undefined`.
|
|
135
|
-
*/
|
|
136
|
-
declare function resolvePayloadToken(payload: unknown, token: string): unknown;
|
|
137
|
-
/**
|
|
138
|
-
* Create the renderer's `ResolveBinding` over a payload map. Mode semantics
|
|
139
|
-
* (brief §4.6, uniform binding model):
|
|
140
|
-
*
|
|
141
|
-
* - `value` / `object` / `condition` — the value at the token within the
|
|
142
|
-
* payload named by `sourceId`.
|
|
143
|
-
* - `spread` — same lookup; the renderer spreads the resulting object.
|
|
144
|
-
* - `repeaterItem` — the token resolves against the active repeater item,
|
|
145
|
-
* not the root payload.
|
|
146
|
-
*
|
|
147
|
-
* Total for data misses: an unknown `sourceId` or missing path resolves to
|
|
148
|
-
* `undefined` — the renderer (EC-015) degrades visibly instead of crashing.
|
|
149
|
-
* An explicit {@link SourcePayloadError} payload (a REJECTED stored query, not
|
|
150
|
-
* merely missing data) throws instead: the renderer catches per node and
|
|
151
|
-
* renders its visible render-error fallback with the query error message;
|
|
152
|
-
* conditions treat the throw as `false` (the node hides) — never a page crash.
|
|
153
|
-
*/
|
|
154
|
-
declare function createBindingResolver(payloads: BindingPayloads): ResolveBinding;
|
|
155
|
-
|
|
156
91
|
/**
|
|
157
92
|
* `<CanvasRenderer />` (EC-144, vision AD-1): an async React Server Component
|
|
158
93
|
* that renders a resolved page (from `resolvePage`, EC-143) through
|
|
@@ -166,13 +101,6 @@ interface CanvasRendererProps {
|
|
|
166
101
|
result: ResolvePageResult;
|
|
167
102
|
/** Host component surface from `defineHostComponents`. */
|
|
168
103
|
components: HostComponents;
|
|
169
|
-
/**
|
|
170
|
-
* Binding payloads keyed by `sourceId`. Defaults to
|
|
171
|
-
* `{ document, params }` derived from the result.
|
|
172
|
-
*/
|
|
173
|
-
payloads?: BindingPayloads;
|
|
174
|
-
/** Full custom binding resolver — overrides `payloads` when provided. */
|
|
175
|
-
resolveBinding?: ResolveBinding;
|
|
176
104
|
/**
|
|
177
105
|
* Delivery-shaped assets the page may reference (EC-195, from the render
|
|
178
106
|
* outcome). An `asset`-typed Image prop resolves through these to a url +
|
|
@@ -226,8 +154,6 @@ interface DeliveryPresentation {
|
|
|
226
154
|
/** Field names whose values form the body, in render order. */
|
|
227
155
|
body?: readonly string[];
|
|
228
156
|
}
|
|
229
|
-
/** Default payloads: the route-bound document and the dynamic route params. */
|
|
230
|
-
declare function defaultBindingPayloads(result: ResolvePageResult): BindingPayloads;
|
|
231
157
|
/**
|
|
232
158
|
* Render a resolved page server-side. Async so hosts can compose it like any
|
|
233
159
|
* other RSC; resolution itself is synchronous (the content was prefetched by
|
|
@@ -253,22 +179,10 @@ declare function bodyItemsOf(document: Record<string, unknown> | null | undefine
|
|
|
253
179
|
*
|
|
254
180
|
* Accessors are synchronous over a prefetched `ContentLookup` (vision AD-4);
|
|
255
181
|
* any fetching happens when the source is loaded, before clients are minted.
|
|
182
|
+
*
|
|
183
|
+
* EC-574: the `CanvasDataSource` shape and the `sources` member (the data-binding
|
|
184
|
+
* subsystem's per-section query definitions, EC-166) are gone with that subsystem.
|
|
256
185
|
*/
|
|
257
|
-
/**
|
|
258
|
-
* One data-source definition the published graph's bindings reference
|
|
259
|
-
* (EC-166 delivery): the structural shape of an `@elytracms/core/data-binding`
|
|
260
|
-
* `DataSource`, declared here so the embedded runtime stays free of
|
|
261
|
-
* builder-side packages. Only `cms`-kind sources with the EC-166 per-scope id
|
|
262
|
-
* prefixes (`cms.section.<nodeId>` / `cms.template.<pageId>`) participate in
|
|
263
|
-
* automatic payload materialization; everything else is ignored.
|
|
264
|
-
*/
|
|
265
|
-
interface CanvasDataSource {
|
|
266
|
-
kind: string;
|
|
267
|
-
id: string;
|
|
268
|
-
label?: string;
|
|
269
|
-
/** Kind-specific config; cms query configs parse via `@elytracms/core/content`. */
|
|
270
|
-
config?: unknown;
|
|
271
|
-
}
|
|
272
186
|
interface ContentSource {
|
|
273
187
|
/** The project's locale configuration (default + supported set, EC-018). */
|
|
274
188
|
readonly locales: LocaleConfig;
|
|
@@ -299,15 +213,6 @@ interface ContentSource {
|
|
|
299
213
|
* picker decides, exactly as before.
|
|
300
214
|
*/
|
|
301
215
|
readonly collections?: readonly CollectionDef[];
|
|
302
|
-
/**
|
|
303
|
-
* Data-source definitions the graph's bindings reference (EC-166 delivery,
|
|
304
|
-
* additive). When present, the route helper materializes per-section list
|
|
305
|
-
* sources automatically by replaying their stored where/sort/limit through
|
|
306
|
-
* `listDocuments` — see `materializeSourcePayloads`. Optional so existing
|
|
307
|
-
* custom sources stay valid; absent definitions degrade to unresolved
|
|
308
|
-
* bindings (the renderer's visible fallbacks), never a crash.
|
|
309
|
-
*/
|
|
310
|
-
readonly sources?: readonly CanvasDataSource[];
|
|
311
216
|
/**
|
|
312
217
|
* The project's delivery-shaped assets (EC-195, additive). Lets the route
|
|
313
218
|
* helper bake the assets a page may reference into the (serializable) render
|
|
@@ -327,60 +232,6 @@ interface ContentSource {
|
|
|
327
232
|
*/
|
|
328
233
|
declare function mergeCacheTags(first: CacheTags, ...rest: readonly CacheTags[]): CacheTags;
|
|
329
234
|
|
|
330
|
-
/**
|
|
331
|
-
* Automatic payload materialization for EC-166 repeating sections — the
|
|
332
|
-
* delivery half of the builder's collection-driven LAYOUTS (EC-187: layouts
|
|
333
|
-
* are the only graph trees that can bind section sources now). A published
|
|
334
|
-
* layout may carry bindings against per-scope CMS sources; the renderer needs
|
|
335
|
-
* the source PAYLOADS:
|
|
336
|
-
*
|
|
337
|
-
* - **Repeating sections** (`cms.section.<nodeId>`): the stored source config
|
|
338
|
-
* carries the closed AD-3 query. For every section source a referenced
|
|
339
|
-
* layout tree actually binds, the stored where/sort/limit replays through
|
|
340
|
-
* the request client's `listDocuments` — published perspective and ambient
|
|
341
|
-
* locale come from the client itself. The list result's `CacheTags` (the
|
|
342
|
-
* fetch-time doc tags of what was actually returned plus the coarse
|
|
343
|
-
* collection tag — the EC-146 contract) are surfaced so the route helper
|
|
344
|
-
* merges them into the request tag set.
|
|
345
|
-
*
|
|
346
|
-
* The `cms.template.<pageId>` "current document" source is RETIRED (EC-187):
|
|
347
|
-
* there is no template page, and a routed page document's `body` uses static
|
|
348
|
-
* props (v1). A collection detail route's document is read by the dev route
|
|
349
|
-
* component directly via the route's `document` ref.
|
|
350
|
-
*
|
|
351
|
-
* Everything degrades visibly, never a crash:
|
|
352
|
-
*
|
|
353
|
-
* - a missing source definition, a non-cms kind, or a malformed config leaves
|
|
354
|
-
* the payload absent, so the binding resolves to `undefined` and the
|
|
355
|
-
* renderer shows its EC-015 fallback (an empty list renders the section's
|
|
356
|
-
* empty state);
|
|
357
|
-
* - a structured query error (the stored query was REJECTED at delivery, e.g.
|
|
358
|
-
* a sort field no longer filterable in the live schema) stores an explicit
|
|
359
|
-
* {@link sourcePayloadError} payload instead — the binding resolver throws
|
|
360
|
-
* on it and the renderer shows its visible per-node render-error fallback,
|
|
361
|
-
* not a silently empty section (EC-177 gap 3).
|
|
362
|
-
*/
|
|
363
|
-
/** Collect every binding `sourceId` referenced in a node tree (props, conditions, slots). */
|
|
364
|
-
declare function collectBindingSourceIds(node: ComponentNode, into?: Set<string>): Set<string>;
|
|
365
|
-
interface MaterializeSourcePayloadsInput {
|
|
366
|
-
/** Accessor client bound to this request's perspective + locale. */
|
|
367
|
-
client: ContentClient;
|
|
368
|
-
result: ResolvePageResult;
|
|
369
|
-
/** Source definitions from the `ContentSource` (absent ones simply skip). */
|
|
370
|
-
sources: readonly CanvasDataSource[];
|
|
371
|
-
}
|
|
372
|
-
interface MaterializedSourcePayloads {
|
|
373
|
-
payloads: BindingPayloads;
|
|
374
|
-
/** `CacheTags` of every accessor call made here (one entry per section list). */
|
|
375
|
-
tags: CacheTags[];
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Materialize the EC-166 source payloads for one resolved page. Pure over the
|
|
379
|
-
* prefetched source — `listDocuments` is synchronous; tags are returned (not
|
|
380
|
-
* applied) so the caller owns the merge.
|
|
381
|
-
*/
|
|
382
|
-
declare function materializeSourcePayloads(input: MaterializeSourcePayloadsInput): MaterializedSourcePayloads;
|
|
383
|
-
|
|
384
235
|
/**
|
|
385
236
|
* Bridge from a `PersistenceAdapter` to the synchronous `ContentLookup` the
|
|
386
237
|
* accessors (EC-143) read through: prefetch the project's collections,
|
|
@@ -411,12 +262,6 @@ interface ContentSnapshotOptions {
|
|
|
411
262
|
* config declares.
|
|
412
263
|
*/
|
|
413
264
|
locales: LocaleConfig;
|
|
414
|
-
/**
|
|
415
|
-
* Data-source definitions the graph's bindings reference (EC-166): section
|
|
416
|
-
* sources (`cms.section.<nodeId>`) carry their stored where/sort/limit, and
|
|
417
|
-
* the route helper materializes their payloads automatically.
|
|
418
|
-
*/
|
|
419
|
-
sources?: readonly CanvasDataSource[];
|
|
420
265
|
}
|
|
421
266
|
interface ContentSnapshot extends ContentSource {
|
|
422
267
|
readonly projectId: string;
|
|
@@ -451,11 +296,6 @@ interface StaticContentData {
|
|
|
451
296
|
* explicit unresolved-placeholder scheme (never a silent empty string).
|
|
452
297
|
*/
|
|
453
298
|
assetUrl?: (asset: AssetRecord) => string;
|
|
454
|
-
/**
|
|
455
|
-
* Data-source definitions section bindings reference (EC-166 delivery).
|
|
456
|
-
* Absent definitions degrade to unresolved bindings, never a crash.
|
|
457
|
-
*/
|
|
458
|
-
sources?: readonly CanvasDataSource[];
|
|
459
299
|
}
|
|
460
300
|
|
|
461
301
|
/**
|
|
@@ -476,8 +316,9 @@ declare function createContentSnapshot(adapter: PersistenceAdapter, projectId: s
|
|
|
476
316
|
|
|
477
317
|
/**
|
|
478
318
|
* The pure half of the catch-all route helper (EC-144): URL → outcome, with
|
|
479
|
-
* no Next.js imports — so redirects, 404s, locale handling,
|
|
480
|
-
* and tag merging are all unit-testable as plain
|
|
319
|
+
* no Next.js imports — so redirects, 404s, locale handling, asset/relation/
|
|
320
|
+
* listing/link baking, and tag merging are all unit-testable as plain
|
|
321
|
+
* functions. `route.tsx` maps
|
|
481
322
|
* each outcome onto `redirect()` / `permanentRedirect()` / `notFound()` /
|
|
482
323
|
* `<CanvasRenderer />`.
|
|
483
324
|
*/
|
|
@@ -518,27 +359,6 @@ interface CanvasWrapContext extends CanvasRequestInfo {
|
|
|
518
359
|
*/
|
|
519
360
|
result: ResolvePageResult;
|
|
520
361
|
}
|
|
521
|
-
/** What the host's payload factory sees for one request. */
|
|
522
|
-
interface CanvasPayloadContext {
|
|
523
|
-
/** Accessor client bound to this request's perspective + locale. */
|
|
524
|
-
client: ContentClient;
|
|
525
|
-
result: ResolvePageResult;
|
|
526
|
-
perspective: Perspective;
|
|
527
|
-
/** The normalized request path (locale prefix stripped). */
|
|
528
|
-
path: string;
|
|
529
|
-
params: Record<string, string>;
|
|
530
|
-
/**
|
|
531
|
-
* Register the `CacheTags` of any extra accessor call this factory makes
|
|
532
|
-
* (e.g. `listDocuments`) so they join the request's merged tag set — the
|
|
533
|
-
* EC-146 invalidation hook sees everything the request actually read.
|
|
534
|
-
*/
|
|
535
|
-
addTags(tags: CacheTags): void;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Builds the binding payloads for a page render. The defaults
|
|
539
|
-
* (`document`, `params`) are always present; factory entries win on conflict.
|
|
540
|
-
*/
|
|
541
|
-
type CanvasPayloadsFactory = (ctx: CanvasPayloadContext) => BindingPayloads | Promise<BindingPayloads>;
|
|
542
362
|
type CanvasPageOutcome = {
|
|
543
363
|
kind: 'redirect';
|
|
544
364
|
target: string;
|
|
@@ -550,7 +370,6 @@ type CanvasPageOutcome = {
|
|
|
550
370
|
} | {
|
|
551
371
|
kind: 'render';
|
|
552
372
|
result: ResolvePageResult;
|
|
553
|
-
payloads: BindingPayloads;
|
|
554
373
|
/**
|
|
555
374
|
* The delivery-shaped assets the page may reference (EC-195). Baked into
|
|
556
375
|
* the outcome (serializable) so the renderer resolves `asset`-typed Image
|
|
@@ -604,7 +423,6 @@ type CanvasPageOutcome = {
|
|
|
604
423
|
declare function pathFromSlug(slug: readonly string[] | undefined): string;
|
|
605
424
|
|
|
606
425
|
interface ResolveCanvasPageOptions {
|
|
607
|
-
payloads?: CanvasPayloadsFactory;
|
|
608
426
|
/**
|
|
609
427
|
* Component registry (EC-205): when provided, the baked {@link CanvasPageOutcome}
|
|
610
428
|
* `assets` are PAGE-SCOPED to exactly the asset ids this page's composition +
|
|
@@ -663,22 +481,18 @@ interface CanvasRouteOptions {
|
|
|
663
481
|
loadContent: (request: CanvasContentRequest) => Promise<ContentSource>;
|
|
664
482
|
/** Host component surface from `defineHostComponents`. */
|
|
665
483
|
components: HostComponents;
|
|
666
|
-
/** Extra binding payloads per request (e.g. `listDocuments` for a list page). */
|
|
667
|
-
payloads?: CanvasPayloadsFactory;
|
|
668
484
|
/**
|
|
669
485
|
* EC-146 instant publish: cache the published-perspective resolution in
|
|
670
486
|
* Next's data cache (`unstable_cache`), tagged with the response's own
|
|
671
487
|
* fetch-time tags, invalidated by the `/api/revalidate` webhook. Draft mode
|
|
672
488
|
* always bypasses this cache entirely. Tag-driven only — no time-based
|
|
673
|
-
* revalidation (the AD-5 model). Cached values are JSON-serialized
|
|
674
|
-
* payload factories must return plain data on the cached path.
|
|
489
|
+
* revalidation (the AD-5 model). Cached values are JSON-serialized plain data.
|
|
675
490
|
*/
|
|
676
491
|
cache?: CanvasCacheOptions;
|
|
677
492
|
/**
|
|
678
493
|
* EC-146 hook: receives the merged `CacheTags` of everything this request
|
|
679
|
-
* read (the `resolvePage` tags plus
|
|
680
|
-
*
|
|
681
|
-
* the run that wrote the entry.
|
|
494
|
+
* read (the `resolvePage` tags plus the baked relations/listings/links). On a
|
|
495
|
+
* cache hit these are the stored tags of the run that wrote the entry.
|
|
682
496
|
*/
|
|
683
497
|
onTags?: (tags: CacheTags, info: CanvasRequestInfo) => void;
|
|
684
498
|
/** Override the generated `<head>` metadata for a resolved page. */
|
|
@@ -724,13 +538,53 @@ interface CanvasRouteProps {
|
|
|
724
538
|
interface CanvasRoute {
|
|
725
539
|
/** The page component: `export default route.Page`. */
|
|
726
540
|
Page: (props: CanvasRouteProps) => Promise<ReactNode>;
|
|
727
|
-
/**
|
|
728
|
-
|
|
541
|
+
/**
|
|
542
|
+
* Next metadata hook: `export const generateMetadata = route.generateMetadata`.
|
|
543
|
+
* Next passes the parent segment's resolving metadata as the second argument;
|
|
544
|
+
* the route merges the page's tags over it (EC-610). A caller that invokes this
|
|
545
|
+
* by hand (the scaffold's `app/page.tsx`) forwards its own `parent`.
|
|
546
|
+
*/
|
|
547
|
+
generateMetadata: (props: CanvasRouteProps, parent?: ResolvingMetadata) => Promise<Metadata>;
|
|
729
548
|
}
|
|
730
549
|
/** Create the `{ Page, generateMetadata }` pair for `app/[[...slug]]/page.tsx`. */
|
|
731
550
|
declare function createCanvasRoute(options: CanvasRouteOptions): CanvasRoute;
|
|
732
551
|
|
|
552
|
+
/**
|
|
553
|
+
* EC-531, narrowed by EC-610 (owner ruling 3, 2026-10-23): `og:locale` ONLY in the
|
|
554
|
+
* shape Open Graph specifies — `language_TERRITORY` with an underscore (`de_DE`),
|
|
555
|
+
* where BCP 47 writes `de-DE`. The value is the page's RESOLVED locale
|
|
556
|
+
* (`result.tags.locale`, the same fact the router used to pick the content). A
|
|
557
|
+
* bare language code (`de`) is outside that format, so the kit emits nothing for
|
|
558
|
+
* it and the layout's own value stands through the merge: inventing a territory
|
|
559
|
+
* (`de` → `de_DE`) would be wrong exactly where it matters (Austria, the UK,
|
|
560
|
+
* Brazil, Latin America), and a wrong valid value looks deliberate.
|
|
561
|
+
*/
|
|
562
|
+
declare function openGraphLocale(locale: string): string | null;
|
|
733
563
|
declare function canvasPageMetadata(result: ResolvePageResult, assets?: readonly ResolvedAsset[]): Metadata;
|
|
564
|
+
/**
|
|
565
|
+
* EC-610 (owner ruling 1, 2026-10-13): **the site provides the default tags, and
|
|
566
|
+
* the page's tags are merged on top** — a value the page states overrides the
|
|
567
|
+
* site's, a value the page leaves empty falls back to the site's.
|
|
568
|
+
*
|
|
569
|
+
* Next merges metadata SHALLOWLY (read: `generate-metadata.md`, "Merging"): a
|
|
570
|
+
* page segment's `openGraph` object REPLACES the layout's whole `openGraph`, so a
|
|
571
|
+
* site-wide `type`, `siteName`, site image or `locale` declared once in the root
|
|
572
|
+
* layout never reached a canvas page, and both real sites hand-rolled around it
|
|
573
|
+
* differently (NK-039's page hook, Konditorei's post bypass). This is the one
|
|
574
|
+
* merge, applied by the canvas route to whatever builds the page's metadata (the
|
|
575
|
+
* kit's default or the host's `metadata` option): every object-valued key the
|
|
576
|
+
* page sets (`openGraph`, `twitter`, `robots`, `alternates`, …) is merged one
|
|
577
|
+
* level deep over the parent's RESOLVED value; a key the page does not set is left
|
|
578
|
+
* to Next, which inherits it from the parent as before; a scalar or array the
|
|
579
|
+
* page sets wins outright.
|
|
580
|
+
*
|
|
581
|
+
* The parent's resolved shapes spread back cleanly: Next hands `generateMetadata`
|
|
582
|
+
* a `ResolvedMetadata` whose URLs are already strings, whose `images` are
|
|
583
|
+
* descriptor objects and whose titles are `{ absolute, template }` — all of which
|
|
584
|
+
* `Metadata` accepts (Next's own "extend rather than replace" example spreads
|
|
585
|
+
* `(await parent).openGraph?.images`).
|
|
586
|
+
*/
|
|
587
|
+
declare function mergeMetadataOverParent(parent: ResolvedMetadata | null | undefined, page: Metadata): Metadata;
|
|
734
588
|
|
|
735
589
|
/**
|
|
736
590
|
* `sitemap.xml` from published routes (EC-171): walk the same route records
|
|
@@ -1450,7 +1304,9 @@ declare function createPreviewRoute(options: PreviewRouteOptions): PreviewRouteH
|
|
|
1450
1304
|
/**
|
|
1451
1305
|
* Create the preview-disable route handler (e.g.
|
|
1452
1306
|
* `app/api/preview/disable/route.ts`). Disabling needs no token — it only
|
|
1453
|
-
* ever reduces visibility back to the published perspective.
|
|
1307
|
+
* ever reduces visibility back to the published perspective. The `redirect`
|
|
1308
|
+
* target passes the same same-site check as the enable route; an off-site one
|
|
1309
|
+
* redirects to `/` instead.
|
|
1454
1310
|
*/
|
|
1455
1311
|
declare function createPreviewDisableRoute(): PreviewRouteHandlers;
|
|
1456
1312
|
|
|
@@ -1588,8 +1444,6 @@ interface ElytraHostOptions {
|
|
|
1588
1444
|
}
|
|
1589
1445
|
/** Pass-through canvas-route options the kit does not own. */
|
|
1590
1446
|
interface HostCanvasRouteOptions {
|
|
1591
|
-
/** Extra binding payloads per request (see `CanvasRouteOptions.payloads`). */
|
|
1592
|
-
payloads?: CanvasPayloadsFactory;
|
|
1593
1447
|
/** Tag observation hook (see `CanvasRouteOptions.onTags`). */
|
|
1594
1448
|
onTags?: (tags: CacheTags, info: CanvasRequestInfo) => void;
|
|
1595
1449
|
/** Metadata override (see `CanvasRouteOptions.metadata`). */
|
|
@@ -1742,13 +1596,13 @@ interface LiveContentOptions {
|
|
|
1742
1596
|
/**
|
|
1743
1597
|
* The `delivery.ts` payload shape (validated field-by-field below). A
|
|
1744
1598
|
* deployment IS one environment (EC-179); the snapshot carries content only
|
|
1745
|
-
* (EC-287) — documents, assets, editorial redirects (EC-303)
|
|
1746
|
-
*
|
|
1599
|
+
* (EC-287) — documents, assets, editorial redirects (EC-303). (A `sources`
|
|
1600
|
+
* strand from an older deployment is ignored — it belonged to the deleted
|
|
1601
|
+
* data-binding subsystem, EC-574.)
|
|
1747
1602
|
*/
|
|
1748
1603
|
interface DeliverySnapshotPayload {
|
|
1749
1604
|
projectId: string;
|
|
1750
1605
|
redirects?: unknown[];
|
|
1751
|
-
sources?: unknown;
|
|
1752
1606
|
documents: unknown[];
|
|
1753
1607
|
assets: unknown[];
|
|
1754
1608
|
}
|
|
@@ -1810,13 +1664,25 @@ type PreviewEvaluation = {
|
|
|
1810
1664
|
message: string;
|
|
1811
1665
|
};
|
|
1812
1666
|
/**
|
|
1813
|
-
*
|
|
1814
|
-
* preview
|
|
1667
|
+
* The ONE same-site check for a preview redirect target, shared by the enable and
|
|
1668
|
+
* disable routes, so the preview endpoints can never be used as an open redirect.
|
|
1669
|
+
* `null` means rejected; an empty value yields `fallback`.
|
|
1670
|
+
*
|
|
1671
|
+
* EC-594: the parser a browser uses decides, not a blocklist of shapes (the old
|
|
1672
|
+
* blocklist caught `//host` and backslashes — EC-304 B-3 — but not `/<TAB>/host`,
|
|
1673
|
+
* which the parser collapses to `//host`):
|
|
1674
|
+
*
|
|
1675
|
+
* - only a path-absolute reference (`/…`) is accepted — a relative one would be
|
|
1676
|
+
* resolved against the route's own path by a browser, so it has no fixed meaning;
|
|
1677
|
+
* - any C0 control or DEL is rejected outright;
|
|
1678
|
+
* - the value is resolved against a fixed origin and must stay on it;
|
|
1679
|
+
* - what is returned is the parser's normalised `pathname + search + hash`, never
|
|
1680
|
+
* the raw input — and that returned target must itself stay on the origin, since
|
|
1681
|
+
* dot-segment removal can leave a pathname starting with `//` (`/.//host`,
|
|
1682
|
+
* `/..//host`, `/%2e//host`), which as a `Location` is scheme-relative.
|
|
1815
1683
|
*
|
|
1816
|
-
*
|
|
1817
|
-
*
|
|
1818
|
-
* `//host` does. A leading single `/` followed by a non-slash, with no backslash
|
|
1819
|
-
* anywhere, is the only accepted same-site shape.
|
|
1684
|
+
* A scheme-relative or absolute value naming the resolution origin itself resolves
|
|
1685
|
+
* on it and yields its path — harmless, because only that path is returned.
|
|
1820
1686
|
*/
|
|
1821
1687
|
declare function safeRedirectTarget(value: string | null | undefined, fallback?: string): string | null;
|
|
1822
1688
|
/**
|
|
@@ -1842,4 +1708,4 @@ declare function evaluatePreviewRequest(requestUrl: string | URL, expectedToken:
|
|
|
1842
1708
|
*/
|
|
1843
1709
|
declare const PACKAGE = "@elytracms/next";
|
|
1844
1710
|
|
|
1845
|
-
export { type AssetImageLoaderOptions, type
|
|
1711
|
+
export { type AssetImageLoaderOptions, type CacheWrapper, type CacheWrapperOptions, type CachedEntry, type CanvasCacheOptions, type CanvasContentRequest, type CanvasPageOutcome, CanvasRenderer, type CanvasRendererProps, type CanvasRequestInfo, type CanvasRoute, type CanvasRouteOptions, type CanvasRouteProps, type CanvasSitemapOptions, type CanvasSitemapResult, type CanvasWrapContext, type ContentSnapshot, type ContentSnapshotOptions, type ContentSource, type CreateCanvasSitemapOptions, type DefineHostComponentsOptions, type DeliveryPresentation, ELYTRA_HOST_ENV_KEYS, type ElytraContentMode, type ElytraHost, type ElytraHostEnv, type ElytraHostImageOptions, type ElytraHostOptions, ElytraImage, type ElytraImageAsset, type ElytraImageProps, type GlobalsConventions, type HostCanvasRouteOptions, type HostComponent, type HostComponents, type LiveContentOptions, type LoadGlobalsOptions, type NextImagePrimitiveOptions, PACKAGE, type PreviewEvaluation, type PreviewRouteHandlers, type PreviewRouteOptions, REVALIDATE_SIGNATURE_HEADER, type ResolveCanvasPageOptions, type ResolveGlobalsOptions, type ResolvedLink, type ResolvedNavEntry, type ResolvedNavLink, type RevalidateEvaluation, type RevalidatePayload, type RevalidateRouteHandlers, type RevalidateRouteOptions, type SiteGlobals, type SitemapParamsProvider, type SitemapRouteContext, type SitemapSkippedRoute, type StaticContentData, assembleLiveSource, bodyItemsOf, canvasPageMetadata, canvasSitemapEntries, collectionCacheTag, createAssetImageLoader, createCanvasRoute, createCanvasSitemap, createContentSnapshot, createElytraHost, createPreviewDisableRoute, createPreviewRoute, createRevalidateRoute, createStaticContentSource, defineHostComponents, docCacheTag, elytraHostImage, evaluatePreviewRequest, evaluateRevalidateRequest, firstBlockFullBleed, loadCachedEntry, loadLiveContent, mergeCacheTags, mergeMetadataOverParent, nextCacheTags, nextImagePrimitive, openGraphLocale, pathFromSlug, projectSweepTag, resolveCanvasPage, resolveGlobals, resolveHostEnv, revalidatePayloadSchema, routeCacheTag, safeRedirectTarget, scopeCacheTag, signRevalidateBody };
|