@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 +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/{read-Bb60mWmW.d.ts → read-CZB0cP-f.d.ts} +1 -1
- package/dist/{read-AYzXKCU-.d.cts → read-DWArctXs.d.cts} +1 -1
- package/dist/{read-client-CnkVzNP0.d.cts → read-client-TTj8g07j.d.cts} +2 -0
- package/dist/{read-client-CnkVzNP0.d.ts → read-client-TTj8g07j.d.ts} +2 -0
- package/dist/read.cjs +2 -1
- package/dist/read.cjs.map +1 -1
- package/dist/read.d.cts +2 -2
- package/dist/read.d.ts +2 -2
- package/dist/read.js +2 -1
- package/dist/read.js.map +1 -1
- package/dist/sections.cjs +2 -1
- package/dist/sections.cjs.map +1 -1
- package/dist/sections.d.cts +1 -1
- package/dist/sections.d.ts +1 -1
- package/dist/sections.js +2 -1
- package/dist/sections.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _bettercms_ai_types from '@bettercms-ai/types';
|
|
2
2
|
import { ContentPageResult, Content, DeliveredLayout, ContentModelField, Fieldset, ComponentPreview, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Page, MediaAsset, FormField, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } from '@bettercms-ai/types';
|
|
3
3
|
export { ApiError, ApiKey, ApiKeyPermission, ApiKeyTokenType, AssertEqual, AuthSession, AuthUser, BetterCMSErrorCode, BlockType, ButtonBlock, ButtonProps, ColumnsBlock, ColumnsProps, Content, ContentBlock, ContentEntry, ContentModel, ContentModelField, ContentPageResult, ContentResponse, DeepReadonly, DeliveryComponent, DeliveryEntry, DeliveryList, DeliveryPage, EmbedCard, Form, FormBlock, FormField, FormProps, FormSubmission, HeadingBlock, HeadingProps, ImageBlock, ImageProps, MediaAsset, Page, PageMetaJson, PaginatedResult, Perspective, Redirect, ResolvedAuthor, ResolvedPost, RichTextEmbeds, RichTextResolved, SignInInput, SignUpInput, SiteSeoDefaults, SpacerBlock, SpacerProps, TextBlock, TextProps, VideoBlock, VideoProps, Workspace, getBlockType, isBlock } from '@bettercms-ai/types';
|
|
4
|
-
import { D as DeliveryFormField } from './read-client-
|
|
5
|
-
export { a as BCMSClientError, E as BCMSErrorCodes, a as BetterCMSError, B as BetterCMSReadClient, C as CreateClientOptions, b as DeliveryForm, c as DeliveryFormFieldType, E as ErrorCodes, F as FormSubmitError, d as FormValue, e as FormValues, G as GetEntryOptions, L as ListEntriesOptions, f as ListPagesOptions, S as SubmitFormOptions, g as SubmitFormResult, h as asStringArray, i as createClient, j as formInitialValues, k as isMultiValueField, s as shouldShowField, l as submitForm, t as toggleOption } from './read-client-
|
|
4
|
+
import { D as DeliveryFormField } from './read-client-TTj8g07j.cjs';
|
|
5
|
+
export { a as BCMSClientError, E as BCMSErrorCodes, a as BetterCMSError, B as BetterCMSReadClient, C as CreateClientOptions, b as DeliveryForm, c as DeliveryFormFieldType, E as ErrorCodes, F as FormSubmitError, d as FormValue, e as FormValues, G as GetEntryOptions, L as ListEntriesOptions, f as ListPagesOptions, S as SubmitFormOptions, g as SubmitFormResult, h as asStringArray, i as createClient, j as formInitialValues, k as isMultiValueField, s as shouldShowField, l as submitForm, t as toggleOption } from './read-client-TTj8g07j.cjs';
|
|
6
6
|
export { C as CONTENT_APPLIED, a as ContentAppliedMessage, E as EDITOR_FRAME_NAME, c as contentApplied, i as inEditor, o as onContentApplied } from './in-editor-D1vXPgJh.cjs';
|
|
7
|
-
export { P as PORTABLE_TEXT_FORMAT, R as ResolvedHolder, a as RichTextValue, S as SearchHit, b as SearchOptions, T as TextOrRich, e as embeds, i as isRichText, l as lines, p as plain, c as portableText, r as resolved, d as rich, s as search } from './read-
|
|
7
|
+
export { P as PORTABLE_TEXT_FORMAT, R as ResolvedHolder, a as RichTextValue, S as SearchHit, b as SearchOptions, T as TextOrRich, e as embeds, i as isRichText, l as lines, p as plain, c as portableText, r as resolved, d as rich, s as search } from './read-DWArctXs.cjs';
|
|
8
8
|
export { ResolvedSeo, SeoInput, SeoLocation, entrySeoInput, resolveSeo } from './seo.cjs';
|
|
9
9
|
export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder, imageValueObjectPosition, imageValueUrl } from '@bettercms-ai/image-url';
|
|
10
10
|
|
|
@@ -357,7 +357,11 @@ declare function getManagedPage(client: ManagementClient, id: string): Promise<M
|
|
|
357
357
|
* page-backed content entry (idempotent); for a dynamic page it upserts the entry
|
|
358
358
|
* keyed by the page. Returns the resulting entry.
|
|
359
359
|
*/
|
|
360
|
-
declare function setPageContent(client: ManagementClient, id: string, input: SetPageContentInput
|
|
360
|
+
declare function setPageContent(client: ManagementClient, id: string, input: SetPageContentInput,
|
|
361
|
+
/** `ifMatch`: the page version read (get_page) — required with `replace` over a field a section edits. */
|
|
362
|
+
opts?: {
|
|
363
|
+
ifMatch?: number;
|
|
364
|
+
}): Promise<ManagedContentEntry>;
|
|
361
365
|
/** Append fields to a content model's schema (additive — rejects existing keys). */
|
|
362
366
|
declare function addModelFields(client: ManagementClient, id: string, input: AddPageFieldsInput): Promise<ManagedContentModel>;
|
|
363
367
|
/** List content entries (incl. drafts), optionally filtered by model/page/status. */
|
|
@@ -776,7 +780,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
|
|
|
776
780
|
/** Append fields to an existing page (additive — the API rejects existing keys). */
|
|
777
781
|
addPageFields(id: string, input: AddPageFieldsInput): Promise<ManagedPage>;
|
|
778
782
|
/** Set a page's field VALUES — singleton pages get/update their one entry. */
|
|
779
|
-
setPageContent(id: string, input: SetPageContentInput
|
|
783
|
+
setPageContent(id: string, input: SetPageContentInput, opts?: {
|
|
784
|
+
ifMatch?: number;
|
|
785
|
+
}): Promise<ManagedContentEntry>;
|
|
780
786
|
/** Append fields to a content model (additive — rejects existing keys). */
|
|
781
787
|
addModelFields(id: string, input: AddPageFieldsInput): Promise<ManagedContentModel>;
|
|
782
788
|
createEntry(input: CreateEntryInput): Promise<ManagedContentEntry & EntryWriteWarnings>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _bettercms_ai_types from '@bettercms-ai/types';
|
|
2
2
|
import { ContentPageResult, Content, DeliveredLayout, ContentModelField, Fieldset, ComponentPreview, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Page, MediaAsset, FormField, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } from '@bettercms-ai/types';
|
|
3
3
|
export { ApiError, ApiKey, ApiKeyPermission, ApiKeyTokenType, AssertEqual, AuthSession, AuthUser, BetterCMSErrorCode, BlockType, ButtonBlock, ButtonProps, ColumnsBlock, ColumnsProps, Content, ContentBlock, ContentEntry, ContentModel, ContentModelField, ContentPageResult, ContentResponse, DeepReadonly, DeliveryComponent, DeliveryEntry, DeliveryList, DeliveryPage, EmbedCard, Form, FormBlock, FormField, FormProps, FormSubmission, HeadingBlock, HeadingProps, ImageBlock, ImageProps, MediaAsset, Page, PageMetaJson, PaginatedResult, Perspective, Redirect, ResolvedAuthor, ResolvedPost, RichTextEmbeds, RichTextResolved, SignInInput, SignUpInput, SiteSeoDefaults, SpacerBlock, SpacerProps, TextBlock, TextProps, VideoBlock, VideoProps, Workspace, getBlockType, isBlock } from '@bettercms-ai/types';
|
|
4
|
-
import { D as DeliveryFormField } from './read-client-
|
|
5
|
-
export { a as BCMSClientError, E as BCMSErrorCodes, a as BetterCMSError, B as BetterCMSReadClient, C as CreateClientOptions, b as DeliveryForm, c as DeliveryFormFieldType, E as ErrorCodes, F as FormSubmitError, d as FormValue, e as FormValues, G as GetEntryOptions, L as ListEntriesOptions, f as ListPagesOptions, S as SubmitFormOptions, g as SubmitFormResult, h as asStringArray, i as createClient, j as formInitialValues, k as isMultiValueField, s as shouldShowField, l as submitForm, t as toggleOption } from './read-client-
|
|
4
|
+
import { D as DeliveryFormField } from './read-client-TTj8g07j.js';
|
|
5
|
+
export { a as BCMSClientError, E as BCMSErrorCodes, a as BetterCMSError, B as BetterCMSReadClient, C as CreateClientOptions, b as DeliveryForm, c as DeliveryFormFieldType, E as ErrorCodes, F as FormSubmitError, d as FormValue, e as FormValues, G as GetEntryOptions, L as ListEntriesOptions, f as ListPagesOptions, S as SubmitFormOptions, g as SubmitFormResult, h as asStringArray, i as createClient, j as formInitialValues, k as isMultiValueField, s as shouldShowField, l as submitForm, t as toggleOption } from './read-client-TTj8g07j.js';
|
|
6
6
|
export { C as CONTENT_APPLIED, a as ContentAppliedMessage, E as EDITOR_FRAME_NAME, c as contentApplied, i as inEditor, o as onContentApplied } from './in-editor-D1vXPgJh.js';
|
|
7
|
-
export { P as PORTABLE_TEXT_FORMAT, R as ResolvedHolder, a as RichTextValue, S as SearchHit, b as SearchOptions, T as TextOrRich, e as embeds, i as isRichText, l as lines, p as plain, c as portableText, r as resolved, d as rich, s as search } from './read-
|
|
7
|
+
export { P as PORTABLE_TEXT_FORMAT, R as ResolvedHolder, a as RichTextValue, S as SearchHit, b as SearchOptions, T as TextOrRich, e as embeds, i as isRichText, l as lines, p as plain, c as portableText, r as resolved, d as rich, s as search } from './read-CZB0cP-f.js';
|
|
8
8
|
export { ResolvedSeo, SeoInput, SeoLocation, entrySeoInput, resolveSeo } from './seo.js';
|
|
9
9
|
export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder, imageValueObjectPosition, imageValueUrl } from '@bettercms-ai/image-url';
|
|
10
10
|
|
|
@@ -357,7 +357,11 @@ declare function getManagedPage(client: ManagementClient, id: string): Promise<M
|
|
|
357
357
|
* page-backed content entry (idempotent); for a dynamic page it upserts the entry
|
|
358
358
|
* keyed by the page. Returns the resulting entry.
|
|
359
359
|
*/
|
|
360
|
-
declare function setPageContent(client: ManagementClient, id: string, input: SetPageContentInput
|
|
360
|
+
declare function setPageContent(client: ManagementClient, id: string, input: SetPageContentInput,
|
|
361
|
+
/** `ifMatch`: the page version read (get_page) — required with `replace` over a field a section edits. */
|
|
362
|
+
opts?: {
|
|
363
|
+
ifMatch?: number;
|
|
364
|
+
}): Promise<ManagedContentEntry>;
|
|
361
365
|
/** Append fields to a content model's schema (additive — rejects existing keys). */
|
|
362
366
|
declare function addModelFields(client: ManagementClient, id: string, input: AddPageFieldsInput): Promise<ManagedContentModel>;
|
|
363
367
|
/** List content entries (incl. drafts), optionally filtered by model/page/status. */
|
|
@@ -776,7 +780,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
|
|
|
776
780
|
/** Append fields to an existing page (additive — the API rejects existing keys). */
|
|
777
781
|
addPageFields(id: string, input: AddPageFieldsInput): Promise<ManagedPage>;
|
|
778
782
|
/** Set a page's field VALUES — singleton pages get/update their one entry. */
|
|
779
|
-
setPageContent(id: string, input: SetPageContentInput
|
|
783
|
+
setPageContent(id: string, input: SetPageContentInput, opts?: {
|
|
784
|
+
ifMatch?: number;
|
|
785
|
+
}): Promise<ManagedContentEntry>;
|
|
780
786
|
/** Append fields to a content model (additive — rejects existing keys). */
|
|
781
787
|
addModelFields(id: string, input: AddPageFieldsInput): Promise<ManagedContentModel>;
|
|
782
788
|
createEntry(input: CreateEntryInput): Promise<ManagedContentEntry & EntryWriteWarnings>;
|
package/dist/index.js
CHANGED
|
@@ -484,10 +484,10 @@ async function getManagedPage(client, id) {
|
|
|
484
484
|
);
|
|
485
485
|
return res.data;
|
|
486
486
|
}
|
|
487
|
-
async function setPageContent(client, id, input) {
|
|
487
|
+
async function setPageContent(client, id, input, opts) {
|
|
488
488
|
const res = await client.fetchJSON(
|
|
489
489
|
client.url(`/management/pages/${id}/content`),
|
|
490
|
-
{ method: "PUT", body: JSON.stringify(input) }
|
|
490
|
+
{ method: "PUT", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
|
|
491
491
|
);
|
|
492
492
|
return res.data;
|
|
493
493
|
}
|
|
@@ -940,8 +940,8 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
|
|
|
940
940
|
return addPageFields(this, id, input);
|
|
941
941
|
}
|
|
942
942
|
/** Set a page's field VALUES — singleton pages get/update their one entry. */
|
|
943
|
-
setPageContent(id, input) {
|
|
944
|
-
return setPageContent(this, id, input);
|
|
943
|
+
setPageContent(id, input, opts) {
|
|
944
|
+
return setPageContent(this, id, input, opts);
|
|
945
945
|
}
|
|
946
946
|
// ── Schema authoring (additive field append) ──────────────────────────────
|
|
947
947
|
/** Append fields to a content model (additive — rejects existing keys). */
|
|
@@ -1322,7 +1322,7 @@ function createClient(options) {
|
|
|
1322
1322
|
}
|
|
1323
1323
|
let page = 1;
|
|
1324
1324
|
for (; ; ) {
|
|
1325
|
-
const list = await this.listPages({ page, perPage: 100 });
|
|
1325
|
+
const list = await this.listPages({ page, perPage: 100, slug });
|
|
1326
1326
|
const found = list.items.find((p) => p.slug === slug);
|
|
1327
1327
|
if (found) return found;
|
|
1328
1328
|
if (!list.hasNextPage) return null;
|
|
@@ -1333,6 +1333,7 @@ function createClient(options) {
|
|
|
1333
1333
|
const url = `${base}/pages${qs({
|
|
1334
1334
|
page: opts?.page,
|
|
1335
1335
|
perPage: opts?.perPage,
|
|
1336
|
+
slug: opts?.slug,
|
|
1336
1337
|
projectId: defaultProjectId,
|
|
1337
1338
|
branch
|
|
1338
1339
|
})}`;
|