@bettercms-ai/sdk 1.41.0 → 1.41.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
@@ -622,10 +622,10 @@ async function getManagedPage(client, id) {
622
622
  );
623
623
  return res.data;
624
624
  }
625
- async function setPageContent(client, id, input) {
625
+ async function setPageContent(client, id, input, opts) {
626
626
  const res = await client.fetchJSON(
627
627
  client.url(`/management/pages/${id}/content`),
628
- { method: "PUT", body: JSON.stringify(input) }
628
+ { method: "PUT", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
629
629
  );
630
630
  return res.data;
631
631
  }
@@ -1078,8 +1078,8 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
1078
1078
  return addPageFields(this, id, input);
1079
1079
  }
1080
1080
  /** Set a page's field VALUES — singleton pages get/update their one entry. */
1081
- setPageContent(id, input) {
1082
- return setPageContent(this, id, input);
1081
+ setPageContent(id, input, opts) {
1082
+ return setPageContent(this, id, input, opts);
1083
1083
  }
1084
1084
  // ── Schema authoring (additive field append) ──────────────────────────────
1085
1085
  /** Append fields to a content model (additive — rejects existing keys). */
@@ -1460,7 +1460,7 @@ function createClient(options) {
1460
1460
  }
1461
1461
  let page = 1;
1462
1462
  for (; ; ) {
1463
- const list = await this.listPages({ page, perPage: 100 });
1463
+ const list = await this.listPages({ page, perPage: 100, slug });
1464
1464
  const found = list.items.find((p) => p.slug === slug);
1465
1465
  if (found) return found;
1466
1466
  if (!list.hasNextPage) return null;
@@ -1471,6 +1471,7 @@ function createClient(options) {
1471
1471
  const url = `${base}/pages${qs({
1472
1472
  page: opts?.page,
1473
1473
  perPage: opts?.perPage,
1474
+ slug: opts?.slug,
1474
1475
  projectId: defaultProjectId,
1475
1476
  branch
1476
1477
  })}`;