@bettercms-ai/sdk 1.23.0 → 1.24.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _bettercms_ai_types from '@bettercms-ai/types';
2
- import { ContentPageResult, Content, DeliveredLayout, ContentModelField, BetterCMSErrorCode, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Perspective, DeliveryEntry, DeliveryList, DeliveryPage, DeliveryComponent, PageMetaJson, DeliveryEntrySeo, SiteSeoDefaults, Page, MediaAsset, FormField, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } from '@bettercms-ai/types';
2
+ import { ContentPageResult, Content, DeliveredLayout, ContentModelField, Fieldset, BetterCMSErrorCode, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Perspective, DeliveryEntry, DeliveryList, DeliveryPage, DeliveryComponent, PageMetaJson, DeliveryEntrySeo, SiteSeoDefaults, 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, Form, FormBlock, FormField, FormProps, FormSubmission, HeadingBlock, HeadingProps, ImageBlock, ImageProps, MediaAsset, Page, PageMetaJson, PaginatedResult, Perspective, Redirect, SignInInput, SignUpInput, SiteSeoDefaults, SpacerBlock, SpacerProps, TextBlock, TextProps, VideoBlock, VideoProps, Workspace, getBlockType, isBlock } from '@bettercms-ai/types';
4
4
  export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder } from '@bettercms-ai/image-url';
5
5
 
@@ -155,6 +155,10 @@ interface ManagedContentModel {
155
155
  /** Public URL of one entry, e.g. `/blog/:slug` (`:slug` is the entry's slug). Null = none. */
156
156
  urlPattern?: string | null;
157
157
  fields: ContentModelField[];
158
+ fieldsets?: ModelFieldset[] | null;
159
+ kind?: "model" | "block";
160
+ /** Send it back as `ifMatch` on updateModel. */
161
+ optimisticVersion?: number;
158
162
  createdAt: string;
159
163
  updatedAt: string;
160
164
  deletedAt: string | null;
@@ -189,6 +193,12 @@ interface ManagedPage {
189
193
  pageType: "singleton" | "dynamic" | null;
190
194
  fields: ContentModelField[];
191
195
  optimisticVersion: number;
196
+ /** The model this page's schema lives in (get only); its version is updatePageModel's `ifMatch`. */
197
+ backingModel?: {
198
+ id: string;
199
+ optimisticVersion: number;
200
+ fieldsets: ModelFieldset[] | null;
201
+ } | null;
192
202
  createdAt: string;
193
203
  updatedAt: string;
194
204
  deletedAt: string | null;
@@ -241,13 +251,11 @@ interface CreateModelInput {
241
251
  /** Public URL of one entry, e.g. `/blog/:slug`: starts with `/`, contains `:slug` exactly once. */
242
252
  urlPattern?: string | null;
243
253
  }
244
- /** A named, editor-only group of a model's fields. Same shape as the dashboard's `Fieldset`. */
245
- interface ModelFieldset {
246
- id: string;
247
- name: string;
248
- /** One line shown under the card title in the editor, at most 500 characters. */
249
- description?: string;
250
- }
254
+ /**
255
+ * A named, editor-only group of a model's fields: the dashboard's `Fieldset`. `uiOrigin` and
256
+ * `uiBefore` (the chrome before the first agent change) are server-owned: an echo is dropped.
257
+ */
258
+ type ModelFieldset = Fieldset;
251
259
  interface UpdateModelInput {
252
260
  name?: string;
253
261
  slug?: string;
@@ -257,6 +265,21 @@ interface UpdateModelInput {
257
265
  fieldsets?: ModelFieldset[] | null;
258
266
  /** Public URL of one entry, e.g. `/blog/:slug`. `null` (or "") clears it. */
259
267
  urlPattern?: string | null;
268
+ /**
269
+ * Editor chrome by field path (`hero.cta`), rewritten into `fields` by the server. Any of these,
270
+ * or `override`, needs `ifMatch` (428 without). `null` clears.
271
+ */
272
+ fieldUi?: Record<string, Record<string, unknown> | null>;
273
+ fieldFieldset?: Record<string, string | null>;
274
+ /** The full new order of one parent's children (top level when `parentPath` is omitted). */
275
+ fieldOrder?: {
276
+ parentPath?: string;
277
+ order: string[];
278
+ };
279
+ fieldLabel?: Record<string, string>;
280
+ fieldHelpText?: Record<string, string | null>;
281
+ /** Replace chrome a person shaped; without it that is a 409 `ui_human_owned`. */
282
+ override?: boolean;
260
283
  }
261
284
  interface CreateEntryInput {
262
285
  contentModelId: string;
@@ -336,8 +359,17 @@ declare function listEntries(client: ManagementClient, filter?: ListEntriesFilte
336
359
  declare function getEntry(client: ManagementClient, id: string): Promise<ManagedContentEntry>;
337
360
  /** Create a content model (schema). */
338
361
  declare function createModel(client: ManagementClient, input: CreateModelInput): Promise<ManagedContentModel>;
339
- /** Update a content model (additive — fields/name/slug/description). */
340
- declare function updateModel(client: ManagementClient, id: string, input: UpdateModelInput): Promise<ManagedContentModel>;
362
+ /**
363
+ * Update a content model (additive — fields/name/slug/description). `opts.ifMatch` is the model's
364
+ * optimisticVersion: a stale one is a 409, and the chrome keys refuse without it.
365
+ */
366
+ declare function updateModel(client: ManagementClient, id: string, input: UpdateModelInput, opts?: {
367
+ ifMatch?: number;
368
+ }): Promise<ManagedContentModel>;
369
+ /** updateModel addressed by page id: the model the page's schema lives in (`backingModel`). 404 `no_backing_model`. */
370
+ declare function updatePageModel(client: ManagementClient, pageId: string, input: UpdateModelInput, opts?: {
371
+ ifMatch?: number;
372
+ }): Promise<ManagedContentModel>;
341
373
  /** Create a content entry under a model. */
342
374
  /**
343
375
  * Advisory notes the server attached to a write — e.g. `REFERENCE_NOT_FOUND: …` for a reference
@@ -724,6 +756,8 @@ interface ManagedComponent {
724
756
  }>;
725
757
  }> | null;
726
758
  thumbnail?: string | null;
759
+ /** Send it back as `ifMatch` on updateComponent. */
760
+ optimisticVersion?: number;
727
761
  }
728
762
  /** Create/update input. `blockJson` is the ContentBlock tree; `props` the override allowlist. */
729
763
  interface ManagedComponentInput {
@@ -748,6 +782,12 @@ interface ManagedComponentInput {
748
782
  * variant family, which is started from it when it has none.
749
783
  */
750
784
  variantOf?: string;
785
+ /** Update only: prop chrome by prop path (`cta.label`). Any of these, or `override`, needs `ifMatch`. */
786
+ propUi?: Record<string, Record<string, unknown> | null>;
787
+ propGroup?: Record<string, Record<string, unknown> | null>;
788
+ propLabel?: Record<string, string>;
789
+ /** Replace chrome a person shaped; without it that is a 409 `ui_human_owned`. */
790
+ override?: boolean;
751
791
  }
752
792
  /**
753
793
  * The catalogue shape: what each component IS, without its block trees.
@@ -907,7 +947,13 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
907
947
  listModels(): Promise<ManagedContentModel[]>;
908
948
  getModel(id: string): Promise<ManagedContentModel>;
909
949
  createModel(input: CreateModelInput): Promise<ManagedContentModel>;
910
- updateModel(id: string, input: UpdateModelInput): Promise<ManagedContentModel>;
950
+ updateModel(id: string, input: UpdateModelInput, opts?: {
951
+ ifMatch?: number;
952
+ }): Promise<ManagedContentModel>;
953
+ /** updateModel by page id; `ifMatch` = the page's `backingModel.optimisticVersion`. */
954
+ updatePageModel(pageId: string, input: UpdateModelInput, opts?: {
955
+ ifMatch?: number;
956
+ }): Promise<ManagedContentModel>;
911
957
  listPages(): Promise<ManagedPage[]>;
912
958
  /** Get one page by id INCLUDING its field schema + pageType. */
913
959
  getPage(id: string): Promise<ManagedPage>;
@@ -955,7 +1001,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
955
1001
  }): Promise<ManagedComponentSummary[]>;
956
1002
  getComponent(id: string): Promise<ManagedComponent>;
957
1003
  createComponent(input: ManagedComponentInput): Promise<ManagedComponent>;
958
- updateComponent(id: string, input: ManagedComponentInput): Promise<ManagedComponent>;
1004
+ updateComponent(id: string, input: ManagedComponentInput, opts?: {
1005
+ ifMatch?: number;
1006
+ }): Promise<ManagedComponent>;
959
1007
  /** Sections repeating across the project's pages, proposed as components. */
960
1008
  listExtractionCandidates(projectId?: string): Promise<ExtractionCandidate[]>;
961
1009
  /** Fold one candidate into a component and repoint every occurrence at it. */
@@ -1700,4 +1748,4 @@ interface WebhookListResponse {
1700
1748
  };
1701
1749
  }
1702
1750
 
1703
- export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, regenerateApiKey, removeMember, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updateWorkspace, uploadMedia };
1751
+ export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, regenerateApiKey, removeMember, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _bettercms_ai_types from '@bettercms-ai/types';
2
- import { ContentPageResult, Content, DeliveredLayout, ContentModelField, BetterCMSErrorCode, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Perspective, DeliveryEntry, DeliveryList, DeliveryPage, DeliveryComponent, PageMetaJson, DeliveryEntrySeo, SiteSeoDefaults, Page, MediaAsset, FormField, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } from '@bettercms-ai/types';
2
+ import { ContentPageResult, Content, DeliveredLayout, ContentModelField, Fieldset, BetterCMSErrorCode, LayoutStructureDocument, LayoutDataDocument, PageLayoutOverrideDocument, ManagementLayoutCommand, AuthUser, AuthSession, SignInInput, SignUpInput, Perspective, DeliveryEntry, DeliveryList, DeliveryPage, DeliveryComponent, PageMetaJson, DeliveryEntrySeo, SiteSeoDefaults, 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, Form, FormBlock, FormField, FormProps, FormSubmission, HeadingBlock, HeadingProps, ImageBlock, ImageProps, MediaAsset, Page, PageMetaJson, PaginatedResult, Perspective, Redirect, SignInInput, SignUpInput, SiteSeoDefaults, SpacerBlock, SpacerProps, TextBlock, TextProps, VideoBlock, VideoProps, Workspace, getBlockType, isBlock } from '@bettercms-ai/types';
4
4
  export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder } from '@bettercms-ai/image-url';
5
5
 
@@ -155,6 +155,10 @@ interface ManagedContentModel {
155
155
  /** Public URL of one entry, e.g. `/blog/:slug` (`:slug` is the entry's slug). Null = none. */
156
156
  urlPattern?: string | null;
157
157
  fields: ContentModelField[];
158
+ fieldsets?: ModelFieldset[] | null;
159
+ kind?: "model" | "block";
160
+ /** Send it back as `ifMatch` on updateModel. */
161
+ optimisticVersion?: number;
158
162
  createdAt: string;
159
163
  updatedAt: string;
160
164
  deletedAt: string | null;
@@ -189,6 +193,12 @@ interface ManagedPage {
189
193
  pageType: "singleton" | "dynamic" | null;
190
194
  fields: ContentModelField[];
191
195
  optimisticVersion: number;
196
+ /** The model this page's schema lives in (get only); its version is updatePageModel's `ifMatch`. */
197
+ backingModel?: {
198
+ id: string;
199
+ optimisticVersion: number;
200
+ fieldsets: ModelFieldset[] | null;
201
+ } | null;
192
202
  createdAt: string;
193
203
  updatedAt: string;
194
204
  deletedAt: string | null;
@@ -241,13 +251,11 @@ interface CreateModelInput {
241
251
  /** Public URL of one entry, e.g. `/blog/:slug`: starts with `/`, contains `:slug` exactly once. */
242
252
  urlPattern?: string | null;
243
253
  }
244
- /** A named, editor-only group of a model's fields. Same shape as the dashboard's `Fieldset`. */
245
- interface ModelFieldset {
246
- id: string;
247
- name: string;
248
- /** One line shown under the card title in the editor, at most 500 characters. */
249
- description?: string;
250
- }
254
+ /**
255
+ * A named, editor-only group of a model's fields: the dashboard's `Fieldset`. `uiOrigin` and
256
+ * `uiBefore` (the chrome before the first agent change) are server-owned: an echo is dropped.
257
+ */
258
+ type ModelFieldset = Fieldset;
251
259
  interface UpdateModelInput {
252
260
  name?: string;
253
261
  slug?: string;
@@ -257,6 +265,21 @@ interface UpdateModelInput {
257
265
  fieldsets?: ModelFieldset[] | null;
258
266
  /** Public URL of one entry, e.g. `/blog/:slug`. `null` (or "") clears it. */
259
267
  urlPattern?: string | null;
268
+ /**
269
+ * Editor chrome by field path (`hero.cta`), rewritten into `fields` by the server. Any of these,
270
+ * or `override`, needs `ifMatch` (428 without). `null` clears.
271
+ */
272
+ fieldUi?: Record<string, Record<string, unknown> | null>;
273
+ fieldFieldset?: Record<string, string | null>;
274
+ /** The full new order of one parent's children (top level when `parentPath` is omitted). */
275
+ fieldOrder?: {
276
+ parentPath?: string;
277
+ order: string[];
278
+ };
279
+ fieldLabel?: Record<string, string>;
280
+ fieldHelpText?: Record<string, string | null>;
281
+ /** Replace chrome a person shaped; without it that is a 409 `ui_human_owned`. */
282
+ override?: boolean;
260
283
  }
261
284
  interface CreateEntryInput {
262
285
  contentModelId: string;
@@ -336,8 +359,17 @@ declare function listEntries(client: ManagementClient, filter?: ListEntriesFilte
336
359
  declare function getEntry(client: ManagementClient, id: string): Promise<ManagedContentEntry>;
337
360
  /** Create a content model (schema). */
338
361
  declare function createModel(client: ManagementClient, input: CreateModelInput): Promise<ManagedContentModel>;
339
- /** Update a content model (additive — fields/name/slug/description). */
340
- declare function updateModel(client: ManagementClient, id: string, input: UpdateModelInput): Promise<ManagedContentModel>;
362
+ /**
363
+ * Update a content model (additive — fields/name/slug/description). `opts.ifMatch` is the model's
364
+ * optimisticVersion: a stale one is a 409, and the chrome keys refuse without it.
365
+ */
366
+ declare function updateModel(client: ManagementClient, id: string, input: UpdateModelInput, opts?: {
367
+ ifMatch?: number;
368
+ }): Promise<ManagedContentModel>;
369
+ /** updateModel addressed by page id: the model the page's schema lives in (`backingModel`). 404 `no_backing_model`. */
370
+ declare function updatePageModel(client: ManagementClient, pageId: string, input: UpdateModelInput, opts?: {
371
+ ifMatch?: number;
372
+ }): Promise<ManagedContentModel>;
341
373
  /** Create a content entry under a model. */
342
374
  /**
343
375
  * Advisory notes the server attached to a write — e.g. `REFERENCE_NOT_FOUND: …` for a reference
@@ -724,6 +756,8 @@ interface ManagedComponent {
724
756
  }>;
725
757
  }> | null;
726
758
  thumbnail?: string | null;
759
+ /** Send it back as `ifMatch` on updateComponent. */
760
+ optimisticVersion?: number;
727
761
  }
728
762
  /** Create/update input. `blockJson` is the ContentBlock tree; `props` the override allowlist. */
729
763
  interface ManagedComponentInput {
@@ -748,6 +782,12 @@ interface ManagedComponentInput {
748
782
  * variant family, which is started from it when it has none.
749
783
  */
750
784
  variantOf?: string;
785
+ /** Update only: prop chrome by prop path (`cta.label`). Any of these, or `override`, needs `ifMatch`. */
786
+ propUi?: Record<string, Record<string, unknown> | null>;
787
+ propGroup?: Record<string, Record<string, unknown> | null>;
788
+ propLabel?: Record<string, string>;
789
+ /** Replace chrome a person shaped; without it that is a 409 `ui_human_owned`. */
790
+ override?: boolean;
751
791
  }
752
792
  /**
753
793
  * The catalogue shape: what each component IS, without its block trees.
@@ -907,7 +947,13 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
907
947
  listModels(): Promise<ManagedContentModel[]>;
908
948
  getModel(id: string): Promise<ManagedContentModel>;
909
949
  createModel(input: CreateModelInput): Promise<ManagedContentModel>;
910
- updateModel(id: string, input: UpdateModelInput): Promise<ManagedContentModel>;
950
+ updateModel(id: string, input: UpdateModelInput, opts?: {
951
+ ifMatch?: number;
952
+ }): Promise<ManagedContentModel>;
953
+ /** updateModel by page id; `ifMatch` = the page's `backingModel.optimisticVersion`. */
954
+ updatePageModel(pageId: string, input: UpdateModelInput, opts?: {
955
+ ifMatch?: number;
956
+ }): Promise<ManagedContentModel>;
911
957
  listPages(): Promise<ManagedPage[]>;
912
958
  /** Get one page by id INCLUDING its field schema + pageType. */
913
959
  getPage(id: string): Promise<ManagedPage>;
@@ -955,7 +1001,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
955
1001
  }): Promise<ManagedComponentSummary[]>;
956
1002
  getComponent(id: string): Promise<ManagedComponent>;
957
1003
  createComponent(input: ManagedComponentInput): Promise<ManagedComponent>;
958
- updateComponent(id: string, input: ManagedComponentInput): Promise<ManagedComponent>;
1004
+ updateComponent(id: string, input: ManagedComponentInput, opts?: {
1005
+ ifMatch?: number;
1006
+ }): Promise<ManagedComponent>;
959
1007
  /** Sections repeating across the project's pages, proposed as components. */
960
1008
  listExtractionCandidates(projectId?: string): Promise<ExtractionCandidate[]>;
961
1009
  /** Fold one candidate into a component and repoint every occurrence at it. */
@@ -1700,4 +1748,4 @@ interface WebhookListResponse {
1700
1748
  };
1701
1749
  }
1702
1750
 
1703
- export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, regenerateApiKey, removeMember, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updateWorkspace, uploadMedia };
1751
+ export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, regenerateApiKey, removeMember, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
package/dist/index.js CHANGED
@@ -520,10 +520,18 @@ async function createModel(client, input) {
520
520
  );
521
521
  return res.data;
522
522
  }
523
- async function updateModel(client, id, input) {
523
+ var ifMatchHeaders = (opts) => opts?.ifMatch !== void 0 ? { "If-Match": `W/"${opts.ifMatch}"` } : {};
524
+ async function updateModel(client, id, input, opts) {
524
525
  const res = await client.fetchJSON(
525
526
  client.url(`/management/content/models/${id}`),
526
- { method: "PATCH", body: JSON.stringify(input) }
527
+ { method: "PATCH", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
528
+ );
529
+ return res.data;
530
+ }
531
+ async function updatePageModel(client, pageId, input, opts) {
532
+ const res = await client.fetchJSON(
533
+ client.url(`/management/pages/${pageId}/model`),
534
+ { method: "PATCH", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
527
535
  );
528
536
  return res.data;
529
537
  }
@@ -536,11 +544,9 @@ async function createEntry(client, input) {
536
544
  return withWarnings(res);
537
545
  }
538
546
  async function updateEntry(client, id, input, opts) {
539
- const headers = {};
540
- if (opts?.ifMatch !== void 0) headers["If-Match"] = `W/"${opts.ifMatch}"`;
541
547
  const res = await client.fetchJSON(
542
548
  client.url(`/management/content/entries/${id}`),
543
- { method: "PATCH", body: JSON.stringify(input), headers }
549
+ { method: "PATCH", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
544
550
  );
545
551
  return withWarnings(res);
546
552
  }
@@ -776,10 +782,10 @@ async function extractComponent(client, input) {
776
782
  );
777
783
  return { component: res.data, replaced: res.replaced };
778
784
  }
779
- async function updateComponent(client, id, input) {
785
+ async function updateComponent(client, id, input, opts) {
780
786
  const res = await client.fetchJSON(
781
787
  client.url(`/management/components/${id}`),
782
- { method: "PATCH", body: JSON.stringify(input) }
788
+ { method: "PATCH", body: JSON.stringify(input), headers: ifMatchHeaders(opts) }
783
789
  );
784
790
  return res.data;
785
791
  }
@@ -907,8 +913,12 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
907
913
  createModel(input) {
908
914
  return createModel(this, input);
909
915
  }
910
- updateModel(id, input) {
911
- return updateModel(this, id, input);
916
+ updateModel(id, input, opts) {
917
+ return updateModel(this, id, input, opts);
918
+ }
919
+ /** updateModel by page id; `ifMatch` = the page's `backingModel.optimisticVersion`. */
920
+ updatePageModel(pageId, input, opts) {
921
+ return updatePageModel(this, pageId, input, opts);
912
922
  }
913
923
  // ── Page authoring (page-first: singleton + dynamic) ──────────────────────
914
924
  listPages() {
@@ -996,8 +1006,8 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
996
1006
  createComponent(input) {
997
1007
  return createComponent(this, input);
998
1008
  }
999
- updateComponent(id, input) {
1000
- return updateComponent(this, id, input);
1009
+ updateComponent(id, input, opts) {
1010
+ return updateComponent(this, id, input, opts);
1001
1011
  }
1002
1012
  /** Sections repeating across the project's pages, proposed as components. */
1003
1013
  listExtractionCandidates(projectId) {
@@ -1927,6 +1937,7 @@ export {
1927
1937
  updateMemberRole,
1928
1938
  updateModel,
1929
1939
  updatePage,
1940
+ updatePageModel,
1930
1941
  updateWorkspace,
1931
1942
  uploadMedia
1932
1943
  };