@bettercms-ai/sdk 1.37.0 → 1.38.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,8 +1,8 @@
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, RichTextResolved, RichTextEmbeds, 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-tNsCHy0p.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-tNsCHy0p.cjs';
4
+ import { D as DeliveryFormField } from './read-client-B1uDVNKk.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-B1uDVNKk.cjs';
6
6
  export { ResolvedSeo, SeoInput, SeoLocation, entrySeoInput, resolveSeo } from './seo.cjs';
7
7
  export { SearchHit, SearchOptions, search } from './read.cjs';
8
8
  export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder, imageValueObjectPosition, imageValueUrl } from '@bettercms-ai/image-url';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
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, RichTextResolved, RichTextEmbeds, 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-tNsCHy0p.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-tNsCHy0p.js';
4
+ import { D as DeliveryFormField } from './read-client-B1uDVNKk.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-B1uDVNKk.js';
6
6
  export { ResolvedSeo, SeoInput, SeoLocation, entrySeoInput, resolveSeo } from './seo.js';
7
7
  export { SearchHit, SearchOptions, search } from './read.js';
8
8
  export { ImageFit, ImageFormat, ImageSource, ImageUrlBuilder, ImageUrlOptions, imageUrl, default as imageUrlBuilder, imageValueObjectPosition, imageValueUrl } from '@bettercms-ai/image-url';
package/dist/index.js CHANGED
@@ -1216,6 +1216,7 @@ function createClient(options) {
1216
1216
  const apiUrl = options.apiUrl.replace(/\/+$/, "");
1217
1217
  const { workspace, apiKey, perspective = "published", previewToken } = options;
1218
1218
  const defaultProjectId = options.projectId;
1219
+ const branch = options.branch && options.branch !== "main" ? options.branch : void 0;
1219
1220
  const timeout = options.timeout ?? DEFAULT_TIMEOUT3;
1220
1221
  const base = `${apiUrl}/api/v1/delivery/${workspace}`;
1221
1222
  const headers = () => {
@@ -1275,7 +1276,8 @@ function createClient(options) {
1275
1276
  select: opts?.select?.join(","),
1276
1277
  perspective: draft ? "draft" : void 0,
1277
1278
  stega: draft && stega ? "1" : void 0,
1278
- projectId: defaultProjectId
1279
+ projectId: defaultProjectId,
1280
+ branch
1279
1281
  })}`;
1280
1282
  return unwrap(await fetchJSON(url));
1281
1283
  },
@@ -1288,7 +1290,8 @@ function createClient(options) {
1288
1290
  select: opts?.select?.join(","),
1289
1291
  perspective: draft ? "draft" : void 0,
1290
1292
  stega: draft && stega ? "1" : void 0,
1291
- projectId: defaultProjectId
1293
+ projectId: defaultProjectId,
1294
+ branch
1292
1295
  })}`;
1293
1296
  return unwrap(await fetchJSON(url));
1294
1297
  },
@@ -1325,7 +1328,8 @@ function createClient(options) {
1325
1328
  const url = `${base}/pages${qs({
1326
1329
  page: opts?.page,
1327
1330
  perPage: opts?.perPage,
1328
- projectId: defaultProjectId
1331
+ projectId: defaultProjectId,
1332
+ branch
1329
1333
  })}`;
1330
1334
  return unwrap(await fetchJSON(url));
1331
1335
  },
@@ -1333,12 +1337,13 @@ function createClient(options) {
1333
1337
  const url = `${base}/components${qs({
1334
1338
  perspective: draft ? "draft" : void 0,
1335
1339
  token: draft ? previewToken : void 0,
1336
- projectId: defaultProjectId
1340
+ projectId: defaultProjectId,
1341
+ branch
1337
1342
  })}`;
1338
1343
  return unwrap(await fetchJSON(url));
1339
1344
  },
1340
1345
  async getLayout() {
1341
- const url = `${base}/layout${qs({ perspective: draft ? "draft" : void 0, projectId: defaultProjectId })}`;
1346
+ const url = `${base}/layout${qs({ perspective: draft ? "draft" : void 0, projectId: defaultProjectId, branch })}`;
1342
1347
  try {
1343
1348
  return unwrap(await fetchJSON(url));
1344
1349
  } catch (error) {
@@ -1348,7 +1353,8 @@ function createClient(options) {
1348
1353
  },
1349
1354
  async listForms(opts) {
1350
1355
  const url = `${base}/forms${qs({
1351
- projectId: opts?.projectId ?? defaultProjectId
1356
+ projectId: opts?.projectId ?? defaultProjectId,
1357
+ branch
1352
1358
  })}`;
1353
1359
  return unwrap(
1354
1360
  await fetchJSON(url)