@bettercms-ai/sdk 1.26.2 → 1.27.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/dist/index.cjs CHANGED
@@ -1429,6 +1429,8 @@ function createClient(options) {
1429
1429
  metaDescription: d.metaDescription ?? null,
1430
1430
  metaJson: d.metaJson ?? null,
1431
1431
  blocks: d.blockJson ?? [],
1432
+ // C3: the DRAFT field styles, present only when the page styles a field.
1433
+ ...d.fieldStyles ? { fieldStyles: d.fieldStyles } : {},
1432
1434
  updatedAt: d.updatedAt ?? null,
1433
1435
  publishedAt: d.publishedAt ?? null
1434
1436
  };
@@ -1714,12 +1716,18 @@ function readPublishedContent() {
1714
1716
  }
1715
1717
  return cache.content;
1716
1718
  }
1719
+ var flat = /* @__PURE__ */ new WeakMap();
1717
1720
  function publishedEntry(slug) {
1718
1721
  const collections = readPublishedContent()?.collections ?? {};
1719
1722
  for (const rows of Object.values(collections)) {
1720
1723
  if (!Array.isArray(rows)) continue;
1721
1724
  const hit = rows.find((row) => row?.slug === slug);
1722
- if (hit) return hit;
1725
+ if (!hit) continue;
1726
+ const data = hit.data;
1727
+ if (!data || typeof data !== "object" || Array.isArray(data)) return hit;
1728
+ let entry = flat.get(hit);
1729
+ if (!entry) flat.set(hit, entry = { ...data, ...hit });
1730
+ return entry;
1723
1731
  }
1724
1732
  return null;
1725
1733
  }