@bettercms-ai/sdk 1.26.0 → 1.26.2

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
@@ -1397,7 +1397,8 @@ function createClient(options) {
1397
1397
  depth: opts?.depth,
1398
1398
  select: opts?.select?.join(","),
1399
1399
  perspective: draft ? "draft" : void 0,
1400
- stega: draft && stega ? "1" : void 0
1400
+ stega: draft && stega ? "1" : void 0,
1401
+ projectId: defaultProjectId
1401
1402
  })}`;
1402
1403
  return unwrap(await fetchJSON(url));
1403
1404
  },
@@ -1409,7 +1410,8 @@ function createClient(options) {
1409
1410
  depth: opts?.depth,
1410
1411
  select: opts?.select?.join(","),
1411
1412
  perspective: draft ? "draft" : void 0,
1412
- stega: draft && stega ? "1" : void 0
1413
+ stega: draft && stega ? "1" : void 0,
1414
+ projectId: defaultProjectId
1413
1415
  })}`;
1414
1416
  return unwrap(await fetchJSON(url));
1415
1417
  },
@@ -1443,19 +1445,21 @@ function createClient(options) {
1443
1445
  async listPages(opts) {
1444
1446
  const url = `${base}/pages${qs({
1445
1447
  page: opts?.page,
1446
- perPage: opts?.perPage
1448
+ perPage: opts?.perPage,
1449
+ projectId: defaultProjectId
1447
1450
  })}`;
1448
1451
  return unwrap(await fetchJSON(url));
1449
1452
  },
1450
1453
  async listComponents() {
1451
1454
  const url = `${base}/components${qs({
1452
1455
  perspective: draft ? "draft" : void 0,
1453
- token: draft ? previewToken : void 0
1456
+ token: draft ? previewToken : void 0,
1457
+ projectId: defaultProjectId
1454
1458
  })}`;
1455
1459
  return unwrap(await fetchJSON(url));
1456
1460
  },
1457
1461
  async getLayout() {
1458
- const url = `${base}/layout${draft ? "?perspective=draft" : ""}`;
1462
+ const url = `${base}/layout${qs({ perspective: draft ? "draft" : void 0, projectId: defaultProjectId })}`;
1459
1463
  try {
1460
1464
  return unwrap(await fetchJSON(url));
1461
1465
  } catch (error) {
@@ -1691,7 +1695,6 @@ async function search(opts) {
1691
1695
 
1692
1696
  // src/published-content.ts
1693
1697
  var cache = null;
1694
- var checkedAt = 0;
1695
1698
  function publishedContentFile() {
1696
1699
  const proc = globalThis.process;
1697
1700
  if (typeof proc?.getBuiltinModule !== "function") return null;
@@ -1700,9 +1703,6 @@ function publishedContentFile() {
1700
1703
  function readPublishedContent() {
1701
1704
  const file = publishedContentFile();
1702
1705
  if (!file) return null;
1703
- const now = Date.now();
1704
- if (cache && cache.file === file && now - checkedAt < 1e3) return cache.content;
1705
- checkedAt = now;
1706
1706
  const proc = globalThis.process;
1707
1707
  const fs = proc.getBuiltinModule("node:fs");
1708
1708
  try {
@@ -1725,7 +1725,6 @@ function publishedEntry(slug) {
1725
1725
  }
1726
1726
  function resetPublishedContentCache() {
1727
1727
  cache = null;
1728
- checkedAt = 0;
1729
1728
  }
1730
1729
 
1731
1730
  // src/index.ts