@bettercms-ai/sdk 1.15.0 → 1.17.0
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 +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -89,6 +89,7 @@ __export(index_exports, {
|
|
|
89
89
|
listWorkspaces: () => listWorkspaces,
|
|
90
90
|
plain: () => plain,
|
|
91
91
|
portableText: () => portableText,
|
|
92
|
+
publishManagedLayout: () => publishManagedLayout,
|
|
92
93
|
publishPage: () => publishPage,
|
|
93
94
|
regenerateApiKey: () => regenerateApiKey,
|
|
94
95
|
removeMember: () => removeMember,
|
|
@@ -905,6 +906,14 @@ async function commandManagedLayout(client, input) {
|
|
|
905
906
|
});
|
|
906
907
|
return result.data;
|
|
907
908
|
}
|
|
909
|
+
async function publishManagedLayout(client, input) {
|
|
910
|
+
const result = await client.fetchJSON(client.url("/management/layout/publish"), {
|
|
911
|
+
method: "POST",
|
|
912
|
+
headers: { "If-Match": `W/"${input.ifMatch}"`, ...input.projectId ? { "X-BCMS-Project": input.projectId } : {} },
|
|
913
|
+
body: JSON.stringify({ scope: "global" })
|
|
914
|
+
});
|
|
915
|
+
return result.data;
|
|
916
|
+
}
|
|
908
917
|
|
|
909
918
|
// src/management-client.ts
|
|
910
919
|
var DEFAULT_BASE_URL2 = "https://api.bettercms.ai/v1";
|
|
@@ -1080,13 +1089,16 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
|
|
|
1080
1089
|
extractComponent(input) {
|
|
1081
1090
|
return extractComponent(this, input);
|
|
1082
1091
|
}
|
|
1083
|
-
// ── Layout:
|
|
1092
|
+
// ── Layout: Global/page draft authoring + Global Layout publish (page overrides go live with the page). ──
|
|
1084
1093
|
getManagedLayout(opts) {
|
|
1085
1094
|
return getManagedLayout(this, opts);
|
|
1086
1095
|
}
|
|
1087
1096
|
commandManagedLayout(input) {
|
|
1088
1097
|
return commandManagedLayout(this, input);
|
|
1089
1098
|
}
|
|
1099
|
+
publishManagedLayout(input) {
|
|
1100
|
+
return publishManagedLayout(this, input);
|
|
1101
|
+
}
|
|
1090
1102
|
// ── AI (Option B): write/rewrite/translate copy + generate SEO meta (BYOK-metered) ──
|
|
1091
1103
|
/** Write, rewrite, or translate a piece of copy. Returns the suggested text. */
|
|
1092
1104
|
writeContent(input) {
|
|
@@ -1458,7 +1470,21 @@ function derivedCanonical({ siteUrl, path }) {
|
|
|
1458
1470
|
function jsonLdNodes(schema) {
|
|
1459
1471
|
if (!schema) return [];
|
|
1460
1472
|
const arr = Array.isArray(schema) ? schema : [schema];
|
|
1461
|
-
|
|
1473
|
+
const out = [];
|
|
1474
|
+
for (const node of arr) {
|
|
1475
|
+
if (!node || Object.keys(node).length === 0) continue;
|
|
1476
|
+
const graph = node["@graph"];
|
|
1477
|
+
if (Array.isArray(graph)) {
|
|
1478
|
+
for (const child of graph) {
|
|
1479
|
+
if (child && typeof child === "object" && !Array.isArray(child) && Object.keys(child).length > 0) {
|
|
1480
|
+
out.push(child);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
continue;
|
|
1484
|
+
}
|
|
1485
|
+
out.push(node);
|
|
1486
|
+
}
|
|
1487
|
+
return out;
|
|
1462
1488
|
}
|
|
1463
1489
|
function resolveSeo(page, defaults = {}, location = {}) {
|
|
1464
1490
|
const meta = page.metaJson ?? {};
|
|
@@ -1862,6 +1888,7 @@ var import_types = require("@bettercms-ai/types");
|
|
|
1862
1888
|
listWorkspaces,
|
|
1863
1889
|
plain,
|
|
1864
1890
|
portableText,
|
|
1891
|
+
publishManagedLayout,
|
|
1865
1892
|
publishPage,
|
|
1866
1893
|
regenerateApiKey,
|
|
1867
1894
|
removeMember,
|