@bettercms-ai/sdk 1.18.0 → 1.20.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, SiteSeoDefaults, Page, MediaAsset, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } 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, 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
 
@@ -223,6 +223,8 @@ interface ManagedContentModel {
223
223
  name: string;
224
224
  slug: string;
225
225
  description: string | null;
226
+ /** Public URL of one entry, e.g. `/blog/:slug` (`:slug` is the entry's slug). Null = none. */
227
+ urlPattern?: string | null;
226
228
  fields: ContentModelField[];
227
229
  createdAt: string;
228
230
  updatedAt: string;
@@ -274,6 +276,11 @@ interface CreateManagedPageInput {
274
276
  /** Append fields to an existing page's schema (additive — see addPageFields). */
275
277
  interface AddPageFieldsInput {
276
278
  addFields: ContentModelField[];
279
+ /**
280
+ * Optional insertion point: the key of an existing TOP-LEVEL field to insert after. Omit to
281
+ * append (the default). An unknown key is refused by the API, never silently appended.
282
+ */
283
+ after?: string;
277
284
  }
278
285
  interface CreateModelInput {
279
286
  name: string;
@@ -289,12 +296,27 @@ interface CreateModelInput {
289
296
  * a block would orphan every entry it already has.
290
297
  */
291
298
  kind?: "model" | "block";
299
+ /** Editor-only field grouping. Fields join one with `fieldsetId`. Order is the array index. */
300
+ fieldsets?: ModelFieldset[];
301
+ /** Public URL of one entry, e.g. `/blog/:slug`: starts with `/`, contains `:slug` exactly once. */
302
+ urlPattern?: string | null;
303
+ }
304
+ /** A named, editor-only group of a model's fields. Same shape as the dashboard's `Fieldset`. */
305
+ interface ModelFieldset {
306
+ id: string;
307
+ name: string;
308
+ /** One line shown under the card title in the editor, at most 500 characters. */
309
+ description?: string;
292
310
  }
293
311
  interface UpdateModelInput {
294
312
  name?: string;
295
313
  slug?: string;
296
314
  description?: string;
297
315
  fields?: ContentModelField[];
316
+ /** Replaces the fieldset list. `null` drops every fieldset. Sent alone, it leaves `fields` untouched. */
317
+ fieldsets?: ModelFieldset[] | null;
318
+ /** Public URL of one entry, e.g. `/blog/:slug`. `null` (or "") clears it. */
319
+ urlPattern?: string | null;
298
320
  }
299
321
  interface CreateEntryInput {
300
322
  contentModelId: string;
@@ -308,6 +330,27 @@ interface UpdateEntryInput {
308
330
  status?: "draft" | "published";
309
331
  data?: Record<string, unknown>;
310
332
  pageId?: string | null;
333
+ /** The entry's native SEO. Merges into what is stored: an omitted key is kept, null or "" clears it. */
334
+ meta?: {
335
+ metaTitle?: string | null;
336
+ metaDescription?: string | null;
337
+ noindex?: boolean;
338
+ canonical?: string | null;
339
+ og?: {
340
+ title?: string | null;
341
+ description?: string | null;
342
+ image?: string | null;
343
+ type?: string | null;
344
+ } | null;
345
+ twitter?: {
346
+ card?: string | null;
347
+ title?: string | null;
348
+ description?: string | null;
349
+ image?: string | null;
350
+ } | null;
351
+ schemaType?: string | null;
352
+ schema?: Record<string, unknown> | Array<Record<string, unknown>> | null;
353
+ };
311
354
  }
312
355
  /** Set a page's field VALUES (the actual content). For a singleton, upserts its one entry. */
313
356
  interface SetPageContentInput {
@@ -385,6 +428,12 @@ interface UploadAssetInput {
385
428
  filename?: string;
386
429
  altText?: string;
387
430
  caption?: string;
431
+ /**
432
+ * Video/audio only: the spoken words (≤ 100,000 characters). Stored on the asset and published
433
+ * wherever the file is used. Sent as a second JSON call after the upload, because it is too
434
+ * long for the upload's query string.
435
+ */
436
+ transcript?: string;
388
437
  /** Target Media Library folder id (defaults to project root). */
389
438
  folderId?: string;
390
439
  }
@@ -393,6 +442,27 @@ interface UploadedAsset {
393
442
  url: string;
394
443
  key: string;
395
444
  filename: string;
445
+ /** Present when a transcript was written with the upload. */
446
+ transcript?: string;
447
+ }
448
+ /** Describe an existing asset. `null` clears a field; an omitted key is left alone. */
449
+ interface UpdateAssetInput {
450
+ altText?: string | null;
451
+ caption?: string | null;
452
+ /** Video/audio only, ≤ 100,000 characters. */
453
+ transcript?: string | null;
454
+ }
455
+ interface ManagedMediaAsset {
456
+ id: string;
457
+ url: string;
458
+ filename: string;
459
+ mimeType: string;
460
+ sizeBytes: number;
461
+ altText: string | null;
462
+ caption: string | null;
463
+ transcript: string | null;
464
+ folderId: string | null;
465
+ createdAt: string;
396
466
  }
397
467
 
398
468
  /** Semantic error codes used by the SDK. */
@@ -426,7 +496,17 @@ declare class BetterCMSError extends Error {
426
496
  * hint which field or rule failed (FLO-474). Mirrors the forms client's `fieldErrors`.
427
497
  */
428
498
  readonly fieldErrors?: Record<string, string>;
429
- constructor(message: string, status: number, code: BetterCMSErrorCode, bodyCode?: string, fieldErrors?: Record<string, string>);
499
+ /**
500
+ * The parsed response body, when there was one.
501
+ *
502
+ * Several refusals carry STRUCTURED detail that neither `message` nor `fieldErrors` can hold,
503
+ * and which is the whole point of the refusal: a component publish 409s with the full
504
+ * `readiness` tuple (what evidence is missing, whether a human still has to approve it) and
505
+ * 422s with the `issues` naming the Layouts it would break. Collapsing those to a sentence
506
+ * leaves a caller able to report that something failed and not what to do about it.
507
+ */
508
+ readonly body?: unknown;
509
+ constructor(message: string, status: number, code: BetterCMSErrorCode, bodyCode?: string, fieldErrors?: Record<string, string>, body?: unknown);
430
510
  toJSON(): {
431
511
  name: string;
432
512
  message: string;
@@ -628,10 +708,40 @@ interface ManagedComponentInput {
628
708
  name?: string;
629
709
  slug?: string;
630
710
  category?: string;
711
+ sectionType?: string | null;
712
+ /**
713
+ * The organisational Group, by NAME. The API resolves it against the project's Groups and
714
+ * creates it when missing — a caller filing a whole site's components into folders has a name
715
+ * ("Sections"), never an id.
716
+ */
717
+ group?: string;
718
+ groupId?: string | null;
631
719
  description?: string;
632
720
  blockJson?: unknown[];
633
721
  props?: unknown[];
634
722
  }
723
+ /**
724
+ * The catalogue shape: what each component IS, without its block trees.
725
+ *
726
+ * The default list carries every component's draft AND live `blockJson`, which on a
727
+ * componentized site is the largest response this API produces — and a caller asking which
728
+ * components exist wants none of it. This shape also carries `sectionType`, `status` and the
729
+ * Group, the three facts that decide whether a component is insertable, whether it is on the
730
+ * live site, and where an editor finds it.
731
+ */
732
+ interface ManagedComponentSummary {
733
+ id: string;
734
+ projectId: string | null;
735
+ name: string;
736
+ slug: string;
737
+ category: string;
738
+ sectionType: string | null;
739
+ status: string | null;
740
+ groupId: string | null;
741
+ groupName: string | null;
742
+ updatedAt: string | null;
743
+ builtin?: boolean;
744
+ }
635
745
  /**
636
746
  * A set of sections that repeat across the project's pages, proposed as one component.
637
747
  * Derived per request from the pages' DRAFT blocks — never stored.
@@ -800,6 +910,8 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
800
910
  /** Get one content entry by id INCLUDING its data (incl. drafts). */
801
911
  getEntry(id: string): Promise<ManagedContentEntry>;
802
912
  uploadAsset(input: UploadAssetInput): Promise<UploadedAsset>;
913
+ /** Set an asset's alt text, caption or transcript (video/audio only). `null` clears. */
914
+ updateAsset(id: string, input: UpdateAssetInput): Promise<ManagedMediaAsset>;
803
915
  /** List forms in the key's project (or workspace-level). */
804
916
  listForms(): Promise<ManagedForm[]>;
805
917
  /** Get one form by id INCLUDING its field schema + settings. */
@@ -809,6 +921,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
809
921
  /** Update a form by id (passing `fields` replaces the array). */
810
922
  updateForm(id: string, input: ManagedFormInput): Promise<ManagedForm>;
811
923
  listComponents(): Promise<ManagedComponent[]>;
924
+ listComponents(options: {
925
+ select: "summary";
926
+ }): Promise<ManagedComponentSummary[]>;
812
927
  getComponent(id: string): Promise<ManagedComponent>;
813
928
  createComponent(input: ManagedComponentInput): Promise<ManagedComponent>;
814
929
  updateComponent(id: string, input: ManagedComponentInput): Promise<ManagedComponent>;
@@ -1170,6 +1285,10 @@ interface SeoInput {
1170
1285
  metaTitle?: string | null;
1171
1286
  metaDescription?: string | null;
1172
1287
  metaJson?: PageMetaJson | null;
1288
+ /** `"home"` makes the Automatic JSON-LD a WebSite, as the hosted renderer does. */
1289
+ slug?: string | null;
1290
+ /** Exclude from search engines. Surfaces as `ResolvedSeo.noindex` / `robots`. */
1291
+ noindex?: boolean | null;
1173
1292
  }
1174
1293
  /** Fully-resolved SEO values, page-over-site. Empty string ⇒ omit that tag. */
1175
1294
  interface ResolvedSeo {
@@ -1195,9 +1314,33 @@ interface ResolvedSeo {
1195
1314
  image: string;
1196
1315
  site: string;
1197
1316
  };
1198
- /** JSON-LD nodes (site schema first, then the page's), already flattened + de-empted. */
1317
+ /**
1318
+ * JSON-LD nodes (site schema first, then the page's), already flattened + de-empted. The page's
1319
+ * part follows the renderer's precedence: Custom (`metaJson.schema`) > `metaJson.schemaType` >
1320
+ * Automatic (WebPage; WebSite on the home page).
1321
+ */
1199
1322
  jsonLd: Array<Record<string, unknown>>;
1323
+ /** True when the page is excluded from search engines (the renderer's `<meta name="robots" content="noindex">`). */
1324
+ noindex: boolean;
1325
+ /** `noindex` in the `{ index, follow }` shape Next's `Metadata.robots` takes. */
1326
+ robots: {
1327
+ index: boolean;
1328
+ follow: boolean;
1329
+ };
1200
1330
  }
1331
+ /**
1332
+ * A Delivery API entry as a `resolveSeo` input. The server already resolved the collection
1333
+ * template's `{{field}}` tokens for this entry and merged the entry's own SEO over it, so this is
1334
+ * a reshape, not a resolver:
1335
+ *
1336
+ * const entry = await bcms.getEntry("astro");
1337
+ * const seo = resolveSeo(entrySeoInput(entry), siteDefaults, { siteUrl, path: `/tags/${entry.slug}` });
1338
+ * // seo.jsonLd holds the template's schema, resolved for this entry
1339
+ */
1340
+ declare function entrySeoInput(entry: {
1341
+ slug: string;
1342
+ seo?: DeliveryEntrySeo | null;
1343
+ }): SeoInput;
1201
1344
  /** Where this page lives, so a canonical can be derived when the page sets none. */
1202
1345
  interface SeoLocation {
1203
1346
  /** Absolute site origin, e.g. `https://acme.com`. Trailing slash optional. */
@@ -1437,4 +1580,4 @@ declare function inviteMember(client: BetterCMSAdminClient, workspaceId: string,
1437
1580
  declare function updateMemberRole(client: BetterCMSAdminClient, workspaceId: string, memberId: string, role: MemberRole): Promise<Member>;
1438
1581
  declare function removeMember(client: BetterCMSAdminClient, workspaceId: string, memberId: string): Promise<void>;
1439
1582
 
1440
- 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 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 ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, PORTABLE_TEXT_FORMAT, 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 UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, 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 };
1583
+ 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 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 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 UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, 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 };
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, SiteSeoDefaults, Page, MediaAsset, Form, FormSubmission, Workspace, ApiKey, ApiKeyPermission, ApiKeyTokenType } 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, 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
 
@@ -223,6 +223,8 @@ interface ManagedContentModel {
223
223
  name: string;
224
224
  slug: string;
225
225
  description: string | null;
226
+ /** Public URL of one entry, e.g. `/blog/:slug` (`:slug` is the entry's slug). Null = none. */
227
+ urlPattern?: string | null;
226
228
  fields: ContentModelField[];
227
229
  createdAt: string;
228
230
  updatedAt: string;
@@ -274,6 +276,11 @@ interface CreateManagedPageInput {
274
276
  /** Append fields to an existing page's schema (additive — see addPageFields). */
275
277
  interface AddPageFieldsInput {
276
278
  addFields: ContentModelField[];
279
+ /**
280
+ * Optional insertion point: the key of an existing TOP-LEVEL field to insert after. Omit to
281
+ * append (the default). An unknown key is refused by the API, never silently appended.
282
+ */
283
+ after?: string;
277
284
  }
278
285
  interface CreateModelInput {
279
286
  name: string;
@@ -289,12 +296,27 @@ interface CreateModelInput {
289
296
  * a block would orphan every entry it already has.
290
297
  */
291
298
  kind?: "model" | "block";
299
+ /** Editor-only field grouping. Fields join one with `fieldsetId`. Order is the array index. */
300
+ fieldsets?: ModelFieldset[];
301
+ /** Public URL of one entry, e.g. `/blog/:slug`: starts with `/`, contains `:slug` exactly once. */
302
+ urlPattern?: string | null;
303
+ }
304
+ /** A named, editor-only group of a model's fields. Same shape as the dashboard's `Fieldset`. */
305
+ interface ModelFieldset {
306
+ id: string;
307
+ name: string;
308
+ /** One line shown under the card title in the editor, at most 500 characters. */
309
+ description?: string;
292
310
  }
293
311
  interface UpdateModelInput {
294
312
  name?: string;
295
313
  slug?: string;
296
314
  description?: string;
297
315
  fields?: ContentModelField[];
316
+ /** Replaces the fieldset list. `null` drops every fieldset. Sent alone, it leaves `fields` untouched. */
317
+ fieldsets?: ModelFieldset[] | null;
318
+ /** Public URL of one entry, e.g. `/blog/:slug`. `null` (or "") clears it. */
319
+ urlPattern?: string | null;
298
320
  }
299
321
  interface CreateEntryInput {
300
322
  contentModelId: string;
@@ -308,6 +330,27 @@ interface UpdateEntryInput {
308
330
  status?: "draft" | "published";
309
331
  data?: Record<string, unknown>;
310
332
  pageId?: string | null;
333
+ /** The entry's native SEO. Merges into what is stored: an omitted key is kept, null or "" clears it. */
334
+ meta?: {
335
+ metaTitle?: string | null;
336
+ metaDescription?: string | null;
337
+ noindex?: boolean;
338
+ canonical?: string | null;
339
+ og?: {
340
+ title?: string | null;
341
+ description?: string | null;
342
+ image?: string | null;
343
+ type?: string | null;
344
+ } | null;
345
+ twitter?: {
346
+ card?: string | null;
347
+ title?: string | null;
348
+ description?: string | null;
349
+ image?: string | null;
350
+ } | null;
351
+ schemaType?: string | null;
352
+ schema?: Record<string, unknown> | Array<Record<string, unknown>> | null;
353
+ };
311
354
  }
312
355
  /** Set a page's field VALUES (the actual content). For a singleton, upserts its one entry. */
313
356
  interface SetPageContentInput {
@@ -385,6 +428,12 @@ interface UploadAssetInput {
385
428
  filename?: string;
386
429
  altText?: string;
387
430
  caption?: string;
431
+ /**
432
+ * Video/audio only: the spoken words (≤ 100,000 characters). Stored on the asset and published
433
+ * wherever the file is used. Sent as a second JSON call after the upload, because it is too
434
+ * long for the upload's query string.
435
+ */
436
+ transcript?: string;
388
437
  /** Target Media Library folder id (defaults to project root). */
389
438
  folderId?: string;
390
439
  }
@@ -393,6 +442,27 @@ interface UploadedAsset {
393
442
  url: string;
394
443
  key: string;
395
444
  filename: string;
445
+ /** Present when a transcript was written with the upload. */
446
+ transcript?: string;
447
+ }
448
+ /** Describe an existing asset. `null` clears a field; an omitted key is left alone. */
449
+ interface UpdateAssetInput {
450
+ altText?: string | null;
451
+ caption?: string | null;
452
+ /** Video/audio only, ≤ 100,000 characters. */
453
+ transcript?: string | null;
454
+ }
455
+ interface ManagedMediaAsset {
456
+ id: string;
457
+ url: string;
458
+ filename: string;
459
+ mimeType: string;
460
+ sizeBytes: number;
461
+ altText: string | null;
462
+ caption: string | null;
463
+ transcript: string | null;
464
+ folderId: string | null;
465
+ createdAt: string;
396
466
  }
397
467
 
398
468
  /** Semantic error codes used by the SDK. */
@@ -426,7 +496,17 @@ declare class BetterCMSError extends Error {
426
496
  * hint which field or rule failed (FLO-474). Mirrors the forms client's `fieldErrors`.
427
497
  */
428
498
  readonly fieldErrors?: Record<string, string>;
429
- constructor(message: string, status: number, code: BetterCMSErrorCode, bodyCode?: string, fieldErrors?: Record<string, string>);
499
+ /**
500
+ * The parsed response body, when there was one.
501
+ *
502
+ * Several refusals carry STRUCTURED detail that neither `message` nor `fieldErrors` can hold,
503
+ * and which is the whole point of the refusal: a component publish 409s with the full
504
+ * `readiness` tuple (what evidence is missing, whether a human still has to approve it) and
505
+ * 422s with the `issues` naming the Layouts it would break. Collapsing those to a sentence
506
+ * leaves a caller able to report that something failed and not what to do about it.
507
+ */
508
+ readonly body?: unknown;
509
+ constructor(message: string, status: number, code: BetterCMSErrorCode, bodyCode?: string, fieldErrors?: Record<string, string>, body?: unknown);
430
510
  toJSON(): {
431
511
  name: string;
432
512
  message: string;
@@ -628,10 +708,40 @@ interface ManagedComponentInput {
628
708
  name?: string;
629
709
  slug?: string;
630
710
  category?: string;
711
+ sectionType?: string | null;
712
+ /**
713
+ * The organisational Group, by NAME. The API resolves it against the project's Groups and
714
+ * creates it when missing — a caller filing a whole site's components into folders has a name
715
+ * ("Sections"), never an id.
716
+ */
717
+ group?: string;
718
+ groupId?: string | null;
631
719
  description?: string;
632
720
  blockJson?: unknown[];
633
721
  props?: unknown[];
634
722
  }
723
+ /**
724
+ * The catalogue shape: what each component IS, without its block trees.
725
+ *
726
+ * The default list carries every component's draft AND live `blockJson`, which on a
727
+ * componentized site is the largest response this API produces — and a caller asking which
728
+ * components exist wants none of it. This shape also carries `sectionType`, `status` and the
729
+ * Group, the three facts that decide whether a component is insertable, whether it is on the
730
+ * live site, and where an editor finds it.
731
+ */
732
+ interface ManagedComponentSummary {
733
+ id: string;
734
+ projectId: string | null;
735
+ name: string;
736
+ slug: string;
737
+ category: string;
738
+ sectionType: string | null;
739
+ status: string | null;
740
+ groupId: string | null;
741
+ groupName: string | null;
742
+ updatedAt: string | null;
743
+ builtin?: boolean;
744
+ }
635
745
  /**
636
746
  * A set of sections that repeat across the project's pages, proposed as one component.
637
747
  * Derived per request from the pages' DRAFT blocks — never stored.
@@ -800,6 +910,8 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
800
910
  /** Get one content entry by id INCLUDING its data (incl. drafts). */
801
911
  getEntry(id: string): Promise<ManagedContentEntry>;
802
912
  uploadAsset(input: UploadAssetInput): Promise<UploadedAsset>;
913
+ /** Set an asset's alt text, caption or transcript (video/audio only). `null` clears. */
914
+ updateAsset(id: string, input: UpdateAssetInput): Promise<ManagedMediaAsset>;
803
915
  /** List forms in the key's project (or workspace-level). */
804
916
  listForms(): Promise<ManagedForm[]>;
805
917
  /** Get one form by id INCLUDING its field schema + settings. */
@@ -809,6 +921,9 @@ declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
809
921
  /** Update a form by id (passing `fields` replaces the array). */
810
922
  updateForm(id: string, input: ManagedFormInput): Promise<ManagedForm>;
811
923
  listComponents(): Promise<ManagedComponent[]>;
924
+ listComponents(options: {
925
+ select: "summary";
926
+ }): Promise<ManagedComponentSummary[]>;
812
927
  getComponent(id: string): Promise<ManagedComponent>;
813
928
  createComponent(input: ManagedComponentInput): Promise<ManagedComponent>;
814
929
  updateComponent(id: string, input: ManagedComponentInput): Promise<ManagedComponent>;
@@ -1170,6 +1285,10 @@ interface SeoInput {
1170
1285
  metaTitle?: string | null;
1171
1286
  metaDescription?: string | null;
1172
1287
  metaJson?: PageMetaJson | null;
1288
+ /** `"home"` makes the Automatic JSON-LD a WebSite, as the hosted renderer does. */
1289
+ slug?: string | null;
1290
+ /** Exclude from search engines. Surfaces as `ResolvedSeo.noindex` / `robots`. */
1291
+ noindex?: boolean | null;
1173
1292
  }
1174
1293
  /** Fully-resolved SEO values, page-over-site. Empty string ⇒ omit that tag. */
1175
1294
  interface ResolvedSeo {
@@ -1195,9 +1314,33 @@ interface ResolvedSeo {
1195
1314
  image: string;
1196
1315
  site: string;
1197
1316
  };
1198
- /** JSON-LD nodes (site schema first, then the page's), already flattened + de-empted. */
1317
+ /**
1318
+ * JSON-LD nodes (site schema first, then the page's), already flattened + de-empted. The page's
1319
+ * part follows the renderer's precedence: Custom (`metaJson.schema`) > `metaJson.schemaType` >
1320
+ * Automatic (WebPage; WebSite on the home page).
1321
+ */
1199
1322
  jsonLd: Array<Record<string, unknown>>;
1323
+ /** True when the page is excluded from search engines (the renderer's `<meta name="robots" content="noindex">`). */
1324
+ noindex: boolean;
1325
+ /** `noindex` in the `{ index, follow }` shape Next's `Metadata.robots` takes. */
1326
+ robots: {
1327
+ index: boolean;
1328
+ follow: boolean;
1329
+ };
1200
1330
  }
1331
+ /**
1332
+ * A Delivery API entry as a `resolveSeo` input. The server already resolved the collection
1333
+ * template's `{{field}}` tokens for this entry and merged the entry's own SEO over it, so this is
1334
+ * a reshape, not a resolver:
1335
+ *
1336
+ * const entry = await bcms.getEntry("astro");
1337
+ * const seo = resolveSeo(entrySeoInput(entry), siteDefaults, { siteUrl, path: `/tags/${entry.slug}` });
1338
+ * // seo.jsonLd holds the template's schema, resolved for this entry
1339
+ */
1340
+ declare function entrySeoInput(entry: {
1341
+ slug: string;
1342
+ seo?: DeliveryEntrySeo | null;
1343
+ }): SeoInput;
1201
1344
  /** Where this page lives, so a canonical can be derived when the page sets none. */
1202
1345
  interface SeoLocation {
1203
1346
  /** Absolute site origin, e.g. `https://acme.com`. Trailing slash optional. */
@@ -1437,4 +1580,4 @@ declare function inviteMember(client: BetterCMSAdminClient, workspaceId: string,
1437
1580
  declare function updateMemberRole(client: BetterCMSAdminClient, workspaceId: string, memberId: string, role: MemberRole): Promise<Member>;
1438
1581
  declare function removeMember(client: BetterCMSAdminClient, workspaceId: string, memberId: string): Promise<void>;
1439
1582
 
1440
- 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 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 ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, PORTABLE_TEXT_FORMAT, 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 UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, 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 };
1583
+ 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 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 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 UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, 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 };