@bettercms-ai/sdk 1.13.0 → 1.13.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
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  BetterCMSError: () => BetterCMSError,
39
39
  BetterCMSManagementClient: () => BetterCMSManagementClient,
40
40
  ErrorCodes: () => ErrorCodes,
41
+ PORTABLE_TEXT_FORMAT: () => PORTABLE_TEXT_FORMAT,
41
42
  addModelFields: () => addModelFields,
42
43
  addPageFields: () => addPageFields,
43
44
  asStringArray: () => asStringArray,
@@ -87,6 +88,7 @@ __export(index_exports, {
87
88
  listSubmissions: () => listSubmissions,
88
89
  listWorkspaces: () => listWorkspaces,
89
90
  plain: () => plain,
91
+ portableText: () => portableText,
90
92
  publishPage: () => publishPage,
91
93
  regenerateApiKey: () => regenerateApiKey,
92
94
  removeMember: () => removeMember,
@@ -624,7 +626,14 @@ var MIME_BY_EXT = {
624
626
  avif: "image/avif",
625
627
  mp4: "video/mp4",
626
628
  webm: "video/webm",
627
- pdf: "application/pdf"
629
+ pdf: "application/pdf",
630
+ // mp3/ogg were server-allowed all along; the SDK sent application/octet-stream for them,
631
+ // which the allowlist then refused — so an agent could never upload audio.
632
+ mp3: "audio/mpeg",
633
+ ogg: "audio/ogg",
634
+ txt: "text/plain",
635
+ md: "text/markdown",
636
+ markdown: "text/markdown"
628
637
  };
629
638
  function basenameOf(p) {
630
639
  const clean = p.split(/[?#]/)[0] ?? p;
@@ -833,6 +842,7 @@ async function getManagedLayout(client, opts) {
833
842
  const query = new URLSearchParams();
834
843
  if (opts?.scope) query.set("scope", opts.scope);
835
844
  if (opts?.pageId) query.set("pageId", opts.pageId);
845
+ if (opts?.copy) query.set("preview", opts.copy);
836
846
  const result = await client.fetchJSON(
837
847
  client.url(`/management/layout${query.size ? `?${query}` : ""}`),
838
848
  opts?.projectId ? { headers: { "X-BCMS-Project": opts.projectId } } : void 0
@@ -1339,6 +1349,12 @@ function stripStega(value) {
1339
1349
  }
1340
1350
 
1341
1351
  // src/richtext.ts
1352
+ var PORTABLE_TEXT_FORMAT = "portable-text-1";
1353
+ function portableText(value) {
1354
+ if (!isRichText(value)) return null;
1355
+ const v = value;
1356
+ return v.format === PORTABLE_TEXT_FORMAT && Array.isArray(v.value) ? v.value : null;
1357
+ }
1342
1358
  function isRichText(value) {
1343
1359
  return typeof value === "object" && value !== null && !Array.isArray(value) && ("html" in value || "format" in value);
1344
1360
  }
@@ -1727,6 +1743,7 @@ var import_types = require("@bettercms-ai/types");
1727
1743
  BetterCMSError,
1728
1744
  BetterCMSManagementClient,
1729
1745
  ErrorCodes,
1746
+ PORTABLE_TEXT_FORMAT,
1730
1747
  addModelFields,
1731
1748
  addPageFields,
1732
1749
  asStringArray,
@@ -1776,6 +1793,7 @@ var import_types = require("@bettercms-ai/types");
1776
1793
  listSubmissions,
1777
1794
  listWorkspaces,
1778
1795
  plain,
1796
+ portableText,
1779
1797
  publishPage,
1780
1798
  regenerateApiKey,
1781
1799
  removeMember,