@elytracms/next 0.0.95 → 0.0.96

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 CHANGED
@@ -301,6 +301,13 @@ interface StaticContentData {
301
301
  routes?: readonly RouteRecord[];
302
302
  /** Redirect records served by `resolvePage` (EC-019/020). */
303
303
  redirects?: readonly RedirectRecord[];
304
+ /**
305
+ * The project's collection definitions (every host path hands the resolved config's). They
306
+ * are also the asset metadata's lens (EC-659): the asset collection's `localized` fields
307
+ * are the only ones a stored per-locale value is read for. ABSENT means no schema — no
308
+ * field is localized, so every stored translation is drift: never applied (the shared
309
+ * value is served), each one named on `sourceIssues`.
310
+ */
304
311
  collections?: readonly CollectionDef[];
305
312
  /**
306
313
  * Stored document sources. Either a bare `CmsDocument` (gated by its own
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { registerComponents, createRenderContext, renderDocumentBodyItems, documentBodyItems, serializeListingQuery, documentBodyRichTextValues, documentBodyCompositionNodes, richTextEmbedsInValue, collectReferencedAssetIds, collectRichTextRefsInValue, collectReferencedRelations, collectReferencedListings, collectReferencedRichTextLinks, listingRequestOf } from '@elytracms/core/runtime-renderer';
2
2
  import { isBlockSequenceValueShape } from '@elytracms/core/rich-text';
3
3
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
- import { cacheTags, isDocumentHistory, assetWithoutUrlIssue, resolvedAsset, parseDeliveredDocuments, parseDeliveredRedirects, createContentClient, createContentContext } from '@elytracms/core/content';
4
+ import { cacheTags, isDocumentHistory, assetWithoutUrlIssue, assetMetaDriftIssue, resolvedAsset, parseDeliveredDocuments, parseDeliveredRedirects, createContentClient, createContentContext } from '@elytracms/core/content';
5
5
  import { DEFAULT_SEO_FIELD, parseLocaleConfig, documentKey, readLiveRedirects, SEO_SUBFIELDS, splitLocalePath, DRAFT_PERSPECTIVE, splitPath, localeUrlPath, variantOf, DRAFT_VARIANT, createRouter, presentationBodyFields } from '@elytracms/core/cms-core';
6
6
  export { DRAFT_PERSPECTIVE, documentSchema, localeConfigSchema, localeUrlPath, parseLocaleConfig, redirectRecordSchema, resolveLocale, routeRecordSchema, splitLocalePath, textDirection, variantOf } from '@elytracms/core/cms-core';
7
- import { assetReadLocale, redirectRecordKind } from '@elytracms/core/persistence';
7
+ import { assetMetaLens, assetMetaDrift, assetReadLocale, redirectRecordKind } from '@elytracms/core/persistence';
8
8
  import { revalidateTag, cacheTag } from 'next/cache';
9
9
  import { draftMode } from 'next/headers';
10
10
  import { redirect, notFound, permanentRedirect } from 'next/navigation';
@@ -136,9 +136,13 @@ function createStaticContentSource(data) {
136
136
  }
137
137
  const assets = /* @__PURE__ */ new Map();
138
138
  for (const record2 of data.assets ?? []) assets.set(record2.id, record2);
139
+ const metaLens = assetMetaLens(data.collections ?? []);
139
140
  const sourceIssues = [
140
141
  ...data.sourceIssues ?? [],
141
- ...[...assets.values()].filter((record2) => !assetUrl(record2)).map((record2) => assetWithoutUrlIssue(record2.id))
142
+ ...[...assets.values()].filter((record2) => !assetUrl(record2)).map((record2) => assetWithoutUrlIssue(record2.id)),
143
+ ...[...assets.values()].flatMap(
144
+ (record2) => assetMetaDrift(record2, metaLens).map((drift) => assetMetaDriftIssue(record2.id, drift))
145
+ )
142
146
  ];
143
147
  const lookupFor = (_perspective) => ({
144
148
  collection: (id) => collections.get(id),
@@ -152,7 +156,8 @@ function createStaticContentSource(data) {
152
156
  context: createContentContext({
153
157
  locale: init.locale ?? locales.default,
154
158
  perspective: init.perspective,
155
- locales
159
+ locales,
160
+ assetMetaLens: metaLens
156
161
  }),
157
162
  routes,
158
163
  redirects,
@@ -172,7 +177,7 @@ function createStaticContentSource(data) {
172
177
  // EC-633: a record with no URL is no resolved asset — not baked, so the page renders
173
178
  // the empty state the canvas renders for it (and `sourceIssues` names it).
174
179
  assets: (locale) => [...assets.values()].flatMap((record2) => {
175
- const asset = resolvedAsset(record2, assetUrl(record2), assetReadLocale(locales, locale));
180
+ const asset = resolvedAsset(record2, assetUrl(record2), assetReadLocale(locales, metaLens, locale));
176
181
  return asset ? [asset] : [];
177
182
  }),
178
183
  // EC-499: the schema the route helper reads a collection's declared