@bettercms-ai/sdk 1.14.0 → 1.15.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/README.md +34 -0
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -943,6 +943,13 @@ interface CreateClientOptions {
|
|
|
943
943
|
* deep-link each rendered value back to its editor. Requires `perspective: "drafts"`,
|
|
944
944
|
* and then either a `previewToken` or a `content:read:draft` key. Ignored on published
|
|
945
945
|
* reads — the payload must never reach a production build.
|
|
946
|
+
*
|
|
947
|
+
* **Defaults to `true` on `perspective: "drafts"`** (since 1.15.0). Provenance is the whole
|
|
948
|
+
* reason the drafts perspective exists in a preview build, and an option nobody knew to pass
|
|
949
|
+
* meant every such build rendered anonymous strings: the editor could bind them only by
|
|
950
|
+
* guessing at their text. It stays OFF on every other perspective, unconditionally, so a
|
|
951
|
+
* published build cannot acquire a payload by accident — pass `stega: false` to opt a draft
|
|
952
|
+
* read out (a diff or a checksum over draft content is the case that wants it).
|
|
946
953
|
*/
|
|
947
954
|
stega?: boolean;
|
|
948
955
|
/** Per-attempt timeout in ms. Defaults to 10000. */
|
package/dist/index.d.ts
CHANGED
|
@@ -943,6 +943,13 @@ interface CreateClientOptions {
|
|
|
943
943
|
* deep-link each rendered value back to its editor. Requires `perspective: "drafts"`,
|
|
944
944
|
* and then either a `previewToken` or a `content:read:draft` key. Ignored on published
|
|
945
945
|
* reads — the payload must never reach a production build.
|
|
946
|
+
*
|
|
947
|
+
* **Defaults to `true` on `perspective: "drafts"`** (since 1.15.0). Provenance is the whole
|
|
948
|
+
* reason the drafts perspective exists in a preview build, and an option nobody knew to pass
|
|
949
|
+
* meant every such build rendered anonymous strings: the editor could bind them only by
|
|
950
|
+
* guessing at their text. It stays OFF on every other perspective, unconditionally, so a
|
|
951
|
+
* published build cannot acquire a payload by accident — pass `stega: false` to opt a draft
|
|
952
|
+
* read out (a diff or a checksum over draft content is the case that wants it).
|
|
946
953
|
*/
|
|
947
954
|
stega?: boolean;
|
|
948
955
|
/** Per-attempt timeout in ms. Defaults to 10000. */
|
package/dist/index.js
CHANGED
|
@@ -1189,6 +1189,7 @@ function createClient(options) {
|
|
|
1189
1189
|
throw lastError ?? new BetterCMSError("Unreachable", 0, "NETWORK_ERROR");
|
|
1190
1190
|
}
|
|
1191
1191
|
const draft = perspective === "drafts";
|
|
1192
|
+
const stega = options.stega ?? draft;
|
|
1192
1193
|
return {
|
|
1193
1194
|
perspective,
|
|
1194
1195
|
async getEntry(slug, opts) {
|
|
@@ -1196,12 +1197,12 @@ function createClient(options) {
|
|
|
1196
1197
|
token: previewToken,
|
|
1197
1198
|
depth: opts?.depth,
|
|
1198
1199
|
select: opts?.select?.join(","),
|
|
1199
|
-
stega:
|
|
1200
|
+
stega: stega ? "1" : void 0
|
|
1200
1201
|
})}` : `${base}/content-entries/${encodeURIComponent(slug)}${qs({
|
|
1201
1202
|
depth: opts?.depth,
|
|
1202
1203
|
select: opts?.select?.join(","),
|
|
1203
1204
|
perspective: draft ? "draft" : void 0,
|
|
1204
|
-
stega: draft &&
|
|
1205
|
+
stega: draft && stega ? "1" : void 0
|
|
1205
1206
|
})}`;
|
|
1206
1207
|
return unwrap(await fetchJSON(url));
|
|
1207
1208
|
},
|
|
@@ -1213,7 +1214,7 @@ function createClient(options) {
|
|
|
1213
1214
|
depth: opts?.depth,
|
|
1214
1215
|
select: opts?.select?.join(","),
|
|
1215
1216
|
perspective: draft ? "draft" : void 0,
|
|
1216
|
-
stega: draft &&
|
|
1217
|
+
stega: draft && stega ? "1" : void 0
|
|
1217
1218
|
})}`;
|
|
1218
1219
|
return unwrap(await fetchJSON(url));
|
|
1219
1220
|
},
|