@bettercms-ai/sdk 1.26.1 → 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 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1695,7 +1695,6 @@ async function search(opts) {
|
|
|
1695
1695
|
|
|
1696
1696
|
// src/published-content.ts
|
|
1697
1697
|
var cache = null;
|
|
1698
|
-
var checkedAt = 0;
|
|
1699
1698
|
function publishedContentFile() {
|
|
1700
1699
|
const proc = globalThis.process;
|
|
1701
1700
|
if (typeof proc?.getBuiltinModule !== "function") return null;
|
|
@@ -1704,9 +1703,6 @@ function publishedContentFile() {
|
|
|
1704
1703
|
function readPublishedContent() {
|
|
1705
1704
|
const file = publishedContentFile();
|
|
1706
1705
|
if (!file) return null;
|
|
1707
|
-
const now = Date.now();
|
|
1708
|
-
if (cache && cache.file === file && now - checkedAt < 1e3) return cache.content;
|
|
1709
|
-
checkedAt = now;
|
|
1710
1706
|
const proc = globalThis.process;
|
|
1711
1707
|
const fs = proc.getBuiltinModule("node:fs");
|
|
1712
1708
|
try {
|
|
@@ -1718,18 +1714,23 @@ function readPublishedContent() {
|
|
|
1718
1714
|
}
|
|
1719
1715
|
return cache.content;
|
|
1720
1716
|
}
|
|
1717
|
+
var flat = /* @__PURE__ */ new WeakMap();
|
|
1721
1718
|
function publishedEntry(slug) {
|
|
1722
1719
|
const collections = readPublishedContent()?.collections ?? {};
|
|
1723
1720
|
for (const rows of Object.values(collections)) {
|
|
1724
1721
|
if (!Array.isArray(rows)) continue;
|
|
1725
1722
|
const hit = rows.find((row) => row?.slug === slug);
|
|
1726
|
-
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;
|
|
1727
1729
|
}
|
|
1728
1730
|
return null;
|
|
1729
1731
|
}
|
|
1730
1732
|
function resetPublishedContentCache() {
|
|
1731
1733
|
cache = null;
|
|
1732
|
-
checkedAt = 0;
|
|
1733
1734
|
}
|
|
1734
1735
|
|
|
1735
1736
|
// src/index.ts
|