@bettercms-ai/sdk 1.26.2 → 1.26.3
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 +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1714,12 +1714,18 @@ function readPublishedContent() {
|
|
|
1714
1714
|
}
|
|
1715
1715
|
return cache.content;
|
|
1716
1716
|
}
|
|
1717
|
+
var flat = /* @__PURE__ */ new WeakMap();
|
|
1717
1718
|
function publishedEntry(slug) {
|
|
1718
1719
|
const collections = readPublishedContent()?.collections ?? {};
|
|
1719
1720
|
for (const rows of Object.values(collections)) {
|
|
1720
1721
|
if (!Array.isArray(rows)) continue;
|
|
1721
1722
|
const hit = rows.find((row) => row?.slug === slug);
|
|
1722
|
-
if (hit)
|
|
1723
|
+
if (!hit) continue;
|
|
1724
|
+
const data = hit.data;
|
|
1725
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return hit;
|
|
1726
|
+
let entry = flat.get(hit);
|
|
1727
|
+
if (!entry) flat.set(hit, entry = { ...data, ...hit });
|
|
1728
|
+
return entry;
|
|
1723
1729
|
}
|
|
1724
1730
|
return null;
|
|
1725
1731
|
}
|