@cmssy/core 18.0.0 → 19.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,7 +38,8 @@ cause.
38
38
 
39
39
  `defineCmssyConfig`, `createCmssyClient`, `graphqlRequest` for the transport;
40
40
  `fields` and `defineCmssyLayout` for block and layout definitions; `mediaUrl`,
41
- `mediaUrls`, `mediaAlt` for media; `localizeHref`, `resolveCmssyLocale`,
41
+ `mediaUrls`, `mediaAlt`, `mediaType`, `mediaDuration` and the `MediaType`
42
+ vocabulary for media; `localizeHref`, `resolveCmssyLocale`,
42
43
  `CMSSY_LOCALE_HEADER` for i18n; `applyCmssyCsp` and `verifyCmssyWebhook` for the
43
44
  edges. Full signatures in
44
45
  [docs/reference/sdk-api.md](https://github.com/cmssy-io/cmssy-sdk/blob/main/docs/reference/sdk-api.md).
@@ -20,6 +20,7 @@ type RetryOption = CmssyRetryMode | RetryPolicy | false;
20
20
  declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
21
21
  type ResolvedRetryPolicy = Readonly<Required<RetryPolicy>>;
22
22
  declare const CMSSY_RETRY_MODES: Record<CmssyRetryMode, ResolvedRetryPolicy>;
23
+ declare function isTransientRequestError(error: unknown): error is CmssyRequestError;
23
24
 
24
25
  declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
25
26
  declare function resolveApiUrl(apiUrl: string | undefined): string;
@@ -52,4 +53,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
52
53
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
53
54
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
54
55
 
55
- export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyRequestError as b, type CmssyRetryMode as c, type FetchLikeResponse as d, type FetchPageOptions as e, type RetryPolicy as f, fetchLayouts as g, fetchPage as h, fetchPageById as i, fetchPageMeta as j, fetchPages as k, resolveApiUrl as r };
56
+ export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyRequestError as b, type CmssyRetryMode as c, type FetchLikeResponse as d, type FetchPageOptions as e, type RetryPolicy as f, fetchLayouts as g, fetchPage as h, isTransientRequestError as i, fetchPageById as j, fetchPageMeta as k, fetchPages as l, resolveApiUrl as r };
@@ -20,6 +20,7 @@ type RetryOption = CmssyRetryMode | RetryPolicy | false;
20
20
  declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
21
21
  type ResolvedRetryPolicy = Readonly<Required<RetryPolicy>>;
22
22
  declare const CMSSY_RETRY_MODES: Record<CmssyRetryMode, ResolvedRetryPolicy>;
23
+ declare function isTransientRequestError(error: unknown): error is CmssyRequestError;
23
24
 
24
25
  declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
25
26
  declare function resolveApiUrl(apiUrl: string | undefined): string;
@@ -52,4 +53,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
52
53
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
53
54
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
54
55
 
55
- export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyRequestError as b, type CmssyRetryMode as c, type FetchLikeResponse as d, type FetchPageOptions as e, type RetryPolicy as f, fetchLayouts as g, fetchPage as h, fetchPageById as i, fetchPageMeta as j, fetchPages as k, resolveApiUrl as r };
56
+ export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyRequestError as b, type CmssyRetryMode as c, type FetchLikeResponse as d, type FetchPageOptions as e, type RetryPolicy as f, fetchLayouts as g, fetchPage as h, isTransientRequestError as i, fetchPageById as j, fetchPageMeta as k, fetchPages as l, resolveApiUrl as r };
@@ -1,5 +1,5 @@
1
1
  import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
2
- import { G as GraphqlRequestOptions } from './locale-D9KI4bND.js';
2
+ import { G as GraphqlRequestOptions } from './locale-BCguiP54.js';
3
3
 
4
4
  interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
5
5
  readonly regions: R;
@@ -1,5 +1,5 @@
1
1
  import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
2
- import { G as GraphqlRequestOptions } from './locale-JyBHqpAQ.cjs';
2
+ import { G as GraphqlRequestOptions } from './locale-CsDPiYGF.cjs';
3
3
 
4
4
  interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
5
5
  readonly regions: R;
package/dist/index.cjs CHANGED
@@ -74,7 +74,7 @@ Set the listed environment variables (e.g. in .env.local) and restart the dev se
74
74
  }
75
75
 
76
76
  // src/version.ts
77
- var CMSSY_CORE_VERSION = "18.0.0" ;
77
+ var CMSSY_CORE_VERSION = "19.1.0" ;
78
78
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
79
79
 
80
80
  // src/data/http.ts
@@ -115,6 +115,9 @@ var CMSSY_RETRY_MODES = {
115
115
  Object.freeze(CMSSY_RETRY_MODES.build);
116
116
  Object.freeze(CMSSY_RETRY_MODES.interactive);
117
117
  Object.freeze(CMSSY_RETRY_MODES);
118
+ function isTransientRequestError(error) {
119
+ return error instanceof CmssyRequestError && CMSSY_RETRY_MODES.build.retryStatuses.includes(error.status);
120
+ }
118
121
  function resolveRetryPolicy(retry) {
119
122
  if (retry === false || retry === void 0) return null;
120
123
  if (typeof retry === "string") {
@@ -429,8 +432,6 @@ function documentText(document2) {
429
432
  "cmssy: could not read the query text off the given document"
430
433
  );
431
434
  }
432
-
433
- // src/data/queries.ts
434
435
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
435
436
  public {
436
437
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -443,11 +444,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
443
444
  notFoundPageId
444
445
  previewUrl
445
446
  branding {
446
- brandName
447
- logoUrl
448
- logoDarkUrl
449
- faviconUrl
450
- ogImageUrl
447
+ ${types.brandingFieldNames.join("\n ")}
451
448
  }
452
449
  }
453
450
  }
@@ -588,8 +585,6 @@ var fields = {
588
585
  });
589
586
  }
590
587
  };
591
-
592
- // src/media.ts
593
588
  function mediaUrl(value) {
594
589
  if (typeof value === "string") return value || null;
595
590
  return value?.url ?? null;
@@ -601,6 +596,14 @@ function mediaUrls(value) {
601
596
  function mediaAlt(value) {
602
597
  return typeof value === "string" ? void 0 : value?.alt;
603
598
  }
599
+ function mediaType(value) {
600
+ if (typeof value === "string") return void 0;
601
+ const type = value?.type;
602
+ return typeof type === "string" && types.mediaTypeValues.includes(type) ? type : void 0;
603
+ }
604
+ function mediaDuration(value) {
605
+ return typeof value === "string" ? void 0 : value?.duration;
606
+ }
604
607
  function defineCmssyLayout(layout) {
605
608
  const regions = layout.regions;
606
609
  if (!Array.isArray(regions) || regions.length === 0) {
@@ -1109,10 +1112,18 @@ async function verifyCmssyWebhook(options) {
1109
1112
  return parsed;
1110
1113
  }
1111
1114
 
1115
+ Object.defineProperty(exports, "MediaType", {
1116
+ enumerable: true,
1117
+ get: function () { return types.MediaType; }
1118
+ });
1112
1119
  Object.defineProperty(exports, "evaluateFieldConditionGroup", {
1113
1120
  enumerable: true,
1114
1121
  get: function () { return types.evaluateFieldConditionGroup; }
1115
1122
  });
1123
+ Object.defineProperty(exports, "mediaTypeValues", {
1124
+ enumerable: true,
1125
+ get: function () { return types.mediaTypeValues; }
1126
+ });
1116
1127
  exports.CMSSY_EDIT_HEADER = CMSSY_EDIT_HEADER;
1117
1128
  exports.CMSSY_EDIT_QUERY_PARAM = CMSSY_EDIT_QUERY_PARAM;
1118
1129
  exports.CMSSY_EDIT_TOKEN_HEADER = CMSSY_EDIT_TOKEN_HEADER;
@@ -1136,10 +1147,13 @@ exports.defineCmssyLayout = defineCmssyLayout;
1136
1147
  exports.fields = fields;
1137
1148
  exports.graphqlRequest = graphqlRequest;
1138
1149
  exports.isProtocolCompatible = isProtocolCompatible;
1150
+ exports.isTransientRequestError = isTransientRequestError;
1139
1151
  exports.isVerifiedEditUrl = isVerifiedEditUrl;
1140
1152
  exports.layoutRegionsToBridge = layoutRegionsToBridge;
1141
1153
  exports.localizeHref = localizeHref;
1142
1154
  exports.mediaAlt = mediaAlt;
1155
+ exports.mediaDuration = mediaDuration;
1156
+ exports.mediaType = mediaType;
1143
1157
  exports.mediaUrl = mediaUrl;
1144
1158
  exports.mediaUrls = mediaUrls;
1145
1159
  exports.mintCmssyEditToken = mintCmssyEditToken;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, j as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, k as InvisibleBlocksMessage, P as PROTOCOL_VERSION, l as ParentReadyMessage, m as PatchMessage, n as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as ViewportMessage, r as applyCmssyCsp, s as createCmssyClient, t as defineCmssyConfig, u as defineCmssyLayout, v as isProtocolCompatible, w as normalizeOrigin, x as parseEditorMessage, y as postToEditor, z as resolveEditorOrigin } from './csp-BHjoSZ2p.cjs';
2
- export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-JyBHqpAQ.cjs';
3
- export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy } from './content-client-65N8ZRq9.cjs';
1
+ export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, j as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, k as InvisibleBlocksMessage, P as PROTOCOL_VERSION, l as ParentReadyMessage, m as PatchMessage, n as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as ViewportMessage, r as applyCmssyCsp, s as createCmssyClient, t as defineCmssyConfig, u as defineCmssyLayout, v as isProtocolCompatible, w as normalizeOrigin, x as parseEditorMessage, y as postToEditor, z as resolveEditorOrigin } from './csp-Dtp9S9TS.cjs';
2
+ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-CsDPiYGF.cjs';
3
+ export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy, i as isTransientRequestError } from './content-client-DhcHP8ln.cjs';
4
4
  import * as _cmssy_types from '@cmssy/types';
5
- import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
- export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
5
+ import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
+ export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
7
7
 
8
8
  /**
9
9
  * Whether the content is guaranteed to carry the field. Only `required` says
@@ -87,6 +87,8 @@ type MediaLike = ResolvedMedia | string | null | undefined;
87
87
  declare function mediaUrl(value: MediaLike): string | null;
88
88
  declare function mediaUrls(value: readonly MediaLike[] | null | undefined): string[];
89
89
  declare function mediaAlt(value: MediaLike): string | undefined;
90
+ declare function mediaType(value: MediaLike): MediaType | undefined;
91
+ declare function mediaDuration(value: MediaLike): number | undefined;
90
92
 
91
93
  interface BlockManifestSource {
92
94
  type: string;
@@ -153,4 +155,4 @@ declare class CmssyWebhookError extends Error {
153
155
  }
154
156
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
155
157
 
156
- export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
158
+ export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, j as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, k as InvisibleBlocksMessage, P as PROTOCOL_VERSION, l as ParentReadyMessage, m as PatchMessage, n as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as ViewportMessage, r as applyCmssyCsp, s as createCmssyClient, t as defineCmssyConfig, u as defineCmssyLayout, v as isProtocolCompatible, w as normalizeOrigin, x as parseEditorMessage, y as postToEditor, z as resolveEditorOrigin } from './csp-COFMUmsq.js';
2
- export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-D9KI4bND.js';
3
- export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy } from './content-client-65N8ZRq9.js';
1
+ export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, j as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, k as InvisibleBlocksMessage, P as PROTOCOL_VERSION, l as ParentReadyMessage, m as PatchMessage, n as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as ViewportMessage, r as applyCmssyCsp, s as createCmssyClient, t as defineCmssyConfig, u as defineCmssyLayout, v as isProtocolCompatible, w as normalizeOrigin, x as parseEditorMessage, y as postToEditor, z as resolveEditorOrigin } from './csp-AuptG-R-.js';
2
+ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-BCguiP54.js';
3
+ export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy, i as isTransientRequestError } from './content-client-DhcHP8ln.js';
4
4
  import * as _cmssy_types from '@cmssy/types';
5
- import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
- export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
5
+ import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
+ export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
7
7
 
8
8
  /**
9
9
  * Whether the content is guaranteed to carry the field. Only `required` says
@@ -87,6 +87,8 @@ type MediaLike = ResolvedMedia | string | null | undefined;
87
87
  declare function mediaUrl(value: MediaLike): string | null;
88
88
  declare function mediaUrls(value: readonly MediaLike[] | null | undefined): string[];
89
89
  declare function mediaAlt(value: MediaLike): string | undefined;
90
+ declare function mediaType(value: MediaLike): MediaType | undefined;
91
+ declare function mediaDuration(value: MediaLike): number | undefined;
90
92
 
91
93
  interface BlockManifestSource {
92
94
  type: string;
@@ -153,4 +155,4 @@ declare class CmssyWebhookError extends Error {
153
155
  }
154
156
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
155
157
 
156
- export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
158
+ export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX } from '@cmssy/types';
2
- export { evaluateFieldConditionGroup } from '@cmssy/types';
1
+ import { brandingFieldNames, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX } from '@cmssy/types';
2
+ export { MediaType, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
3
3
 
4
4
  // src/config.ts
5
5
  var DEFAULT_CMSSY_EDITOR_ORIGINS = [
@@ -73,7 +73,7 @@ Set the listed environment variables (e.g. in .env.local) and restart the dev se
73
73
  }
74
74
 
75
75
  // src/version.ts
76
- var CMSSY_CORE_VERSION = "18.0.0" ;
76
+ var CMSSY_CORE_VERSION = "19.1.0" ;
77
77
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
78
78
 
79
79
  // src/data/http.ts
@@ -114,6 +114,9 @@ var CMSSY_RETRY_MODES = {
114
114
  Object.freeze(CMSSY_RETRY_MODES.build);
115
115
  Object.freeze(CMSSY_RETRY_MODES.interactive);
116
116
  Object.freeze(CMSSY_RETRY_MODES);
117
+ function isTransientRequestError(error) {
118
+ return error instanceof CmssyRequestError && CMSSY_RETRY_MODES.build.retryStatuses.includes(error.status);
119
+ }
117
120
  function resolveRetryPolicy(retry) {
118
121
  if (retry === false || retry === void 0) return null;
119
122
  if (typeof retry === "string") {
@@ -428,8 +431,6 @@ function documentText(document2) {
428
431
  "cmssy: could not read the query text off the given document"
429
432
  );
430
433
  }
431
-
432
- // src/data/queries.ts
433
434
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
434
435
  public {
435
436
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -442,11 +443,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
442
443
  notFoundPageId
443
444
  previewUrl
444
445
  branding {
445
- brandName
446
- logoUrl
447
- logoDarkUrl
448
- faviconUrl
449
- ogImageUrl
446
+ ${brandingFieldNames.join("\n ")}
450
447
  }
451
448
  }
452
449
  }
@@ -587,8 +584,6 @@ var fields = {
587
584
  });
588
585
  }
589
586
  };
590
-
591
- // src/media.ts
592
587
  function mediaUrl(value) {
593
588
  if (typeof value === "string") return value || null;
594
589
  return value?.url ?? null;
@@ -600,6 +595,14 @@ function mediaUrls(value) {
600
595
  function mediaAlt(value) {
601
596
  return typeof value === "string" ? void 0 : value?.alt;
602
597
  }
598
+ function mediaType(value) {
599
+ if (typeof value === "string") return void 0;
600
+ const type = value?.type;
601
+ return typeof type === "string" && mediaTypeValues.includes(type) ? type : void 0;
602
+ }
603
+ function mediaDuration(value) {
604
+ return typeof value === "string" ? void 0 : value?.duration;
605
+ }
603
606
  function defineCmssyLayout(layout) {
604
607
  const regions = layout.regions;
605
608
  if (!Array.isArray(regions) || regions.length === 0) {
@@ -1108,4 +1111,4 @@ async function verifyCmssyWebhook(options) {
1108
1111
  return parsed;
1109
1112
  }
1110
1113
 
1111
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, verifyCmssyEditToken, verifyCmssyWebhook };
1114
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, verifyCmssyEditToken, verifyCmssyWebhook };
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var types = require('@cmssy/types');
4
+
3
5
  // src/version.ts
4
- var CMSSY_CORE_VERSION = "18.0.0" ;
6
+ var CMSSY_CORE_VERSION = "19.1.0" ;
5
7
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
6
8
 
7
9
  // src/data/http.ts
@@ -208,8 +210,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
208
210
  label
209
211
  });
210
212
  }
211
-
212
- // src/data/queries.ts
213
213
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
214
214
  public {
215
215
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -222,11 +222,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
222
222
  notFoundPageId
223
223
  previewUrl
224
224
  branding {
225
- brandName
226
- logoUrl
227
- logoDarkUrl
228
- faviconUrl
229
- ogImageUrl
225
+ ${types.brandingFieldNames.join("\n ")}
230
226
  }
231
227
  }
232
228
  }
@@ -1,6 +1,6 @@
1
- export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from '../locale-JyBHqpAQ.cjs';
1
+ export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from '../locale-CsDPiYGF.cjs';
2
2
  export { CmssySiteLocales } from '@cmssy/types';
3
- import '../content-client-65N8ZRq9.cjs';
3
+ import '../content-client-DhcHP8ln.cjs';
4
4
 
5
5
  declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
6
6
 
@@ -1,6 +1,6 @@
1
- export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from '../locale-D9KI4bND.js';
1
+ export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from '../locale-BCguiP54.js';
2
2
  export { CmssySiteLocales } from '@cmssy/types';
3
- import '../content-client-65N8ZRq9.js';
3
+ import '../content-client-DhcHP8ln.js';
4
4
 
5
5
  declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
6
6
 
@@ -1,5 +1,7 @@
1
+ import { brandingFieldNames } from '@cmssy/types';
2
+
1
3
  // src/version.ts
2
- var CMSSY_CORE_VERSION = "18.0.0" ;
4
+ var CMSSY_CORE_VERSION = "19.1.0" ;
3
5
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
4
6
 
5
7
  // src/data/http.ts
@@ -206,8 +208,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
206
208
  label
207
209
  });
208
210
  }
209
-
210
- // src/data/queries.ts
211
211
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
212
212
  public {
213
213
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -220,11 +220,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
220
220
  notFoundPageId
221
221
  previewUrl
222
222
  branding {
223
- brandName
224
- logoUrl
225
- logoDarkUrl
226
- faviconUrl
227
- ogImageUrl
223
+ ${brandingFieldNames.join("\n ")}
228
224
  }
229
225
  }
230
226
  }
package/dist/internal.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  var types = require('@cmssy/types');
4
4
 
5
5
  // src/version.ts
6
- var CMSSY_CORE_VERSION = "18.0.0" ;
6
+ var CMSSY_CORE_VERSION = "19.1.0" ;
7
7
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
8
8
 
9
9
  // src/data/http.ts
@@ -427,8 +427,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
427
427
  label
428
428
  });
429
429
  }
430
-
431
- // src/data/queries.ts
432
430
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
433
431
  public {
434
432
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -441,11 +439,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
441
439
  notFoundPageId
442
440
  previewUrl
443
441
  branding {
444
- brandName
445
- logoUrl
446
- logoDarkUrl
447
- faviconUrl
448
- ogImageUrl
442
+ ${types.brandingFieldNames.join("\n ")}
449
443
  }
450
444
  }
451
445
  }
@@ -1128,6 +1122,28 @@ function localizeHref(href, locale) {
1128
1122
  return `${addLocalePrefix(bare, locale.current, locale)}${suffix}`;
1129
1123
  }
1130
1124
 
1125
+ // src/data/layout-store.ts
1126
+ function createCmssyLayoutStore() {
1127
+ return /* @__PURE__ */ new Map();
1128
+ }
1129
+ function layoutStoreKey(config, pageSlug, previewSecret) {
1130
+ return [
1131
+ resolveApiUrl(config.apiUrl),
1132
+ config.org ?? "",
1133
+ config.workspaceSlug,
1134
+ pageSlug,
1135
+ previewSecret ? "draft" : "published"
1136
+ ].join("\0");
1137
+ }
1138
+ function readThroughLayoutStore(store, key, load) {
1139
+ if (!store) return load();
1140
+ const pending = store.get(key);
1141
+ if (pending) return pending;
1142
+ const started = load();
1143
+ store.set(key, started);
1144
+ return started;
1145
+ }
1146
+
1131
1147
  // src/locale.ts
1132
1148
  var CMSSY_LOCALE_HEADER = "x-cmssy-locale";
1133
1149
  async function localeForPathname(config, pathname) {
@@ -1347,6 +1363,7 @@ exports.clearWorkspaceIdCache = clearWorkspaceIdCache;
1347
1363
  exports.cmssyCspHeaders = cmssyCspHeaders;
1348
1364
  exports.cmssySecretsMatch = cmssySecretsMatch;
1349
1365
  exports.collectFormIds = collectFormIds;
1366
+ exports.createCmssyLayoutStore = createCmssyLayoutStore;
1350
1367
  exports.fetchLayouts = fetchLayouts;
1351
1368
  exports.fetchPage = fetchPage;
1352
1369
  exports.fetchPageById = fetchPageById;
@@ -1356,11 +1373,13 @@ exports.fetchSiteConfig = fetchSiteConfig;
1356
1373
  exports.getBlockContentForLanguage = getBlockContentForLanguage;
1357
1374
  exports.isDevelopment = isDevelopment;
1358
1375
  exports.layoutRegionIds = layoutRegionIds;
1376
+ exports.layoutStoreKey = layoutStoreKey;
1359
1377
  exports.localeForPath = localeForPath;
1360
1378
  exports.localeForPathname = localeForPathname;
1361
1379
  exports.localizeHref = localizeHref;
1362
1380
  exports.localizedPath = localizedPath;
1363
1381
  exports.normalizeBlockContent = normalizeBlockContent;
1382
+ exports.readThroughLayoutStore = readThroughLayoutStore;
1364
1383
  exports.resolveApiUrl = resolveApiUrl;
1365
1384
  exports.resolveForms = resolveForms;
1366
1385
  exports.resolveInitialTarget = resolveInitialTarget;
@@ -1,13 +1,13 @@
1
- export { g as fetchLayouts, h as fetchPage, i as fetchPageById, j as fetchPageMeta, k as fetchPages, r as resolveApiUrl } from './content-client-65N8ZRq9.cjs';
2
- import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock } from '@cmssy/types';
1
+ export { g as fetchLayouts, h as fetchPage, j as fetchPageById, k as fetchPageMeta, l as fetchPages, r as resolveApiUrl } from './content-client-DhcHP8ln.cjs';
2
+ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
- import { G as GraphqlRequestOptions } from './locale-JyBHqpAQ.cjs';
5
- export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-JyBHqpAQ.cjs';
6
- import { Q as QueryScopedOptions } from './csp-BHjoSZ2p.cjs';
7
- export { F as cmssyCspHeaders, G as isDevelopment, H as layoutRegionIds, J as resolveInitialTarget, K as toCspOrigin } from './csp-BHjoSZ2p.cjs';
4
+ import { G as GraphqlRequestOptions } from './locale-CsDPiYGF.cjs';
5
+ export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-CsDPiYGF.cjs';
6
+ import { Q as QueryScopedOptions } from './csp-Dtp9S9TS.cjs';
7
+ export { F as cmssyCspHeaders, G as isDevelopment, H as layoutRegionIds, J as resolveInitialTarget, K as toCspOrigin } from './csp-Dtp9S9TS.cjs';
8
8
  export { localizedPath } from './internal/locale.cjs';
9
9
 
10
- declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
10
+ declare const SITE_CONFIG_QUERY: string;
11
11
  declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
12
12
  declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
13
13
  declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin\n }\n }\n }\n }\n}";
@@ -46,6 +46,11 @@ declare function resolveRelationContent(config: CmssyClientConfig, entries: Rela
46
46
  declare function collectFormIds(blocks: RawBlock[], schemas: BlockSchemaMap, locale: string, defaultLocale: string): string[];
47
47
  declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], schemas: BlockSchemaMap, locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
48
48
 
49
+ type CmssyLayoutStore = Map<string, Promise<CmssyLayoutGroup[]>>;
50
+ declare function createCmssyLayoutStore(): CmssyLayoutStore;
51
+ declare function layoutStoreKey(config: CmssyClientConfig, pageSlug: string, previewSecret: string | undefined): string;
52
+ declare function readThroughLayoutStore(store: CmssyLayoutStore | undefined, key: string, load: () => Promise<CmssyLayoutGroup[]>): Promise<CmssyLayoutGroup[]>;
53
+
49
54
  declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
50
55
 
51
56
  interface CmssyDeliveryOperation {
@@ -54,4 +59,4 @@ interface CmssyDeliveryOperation {
54
59
  }
55
60
  declare const CMSSY_DELIVERY_OPERATIONS: readonly CmssyDeliveryOperation[];
56
61
 
57
- export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, fetchSiteConfig, getBlockContentForLanguage, normalizeBlockContent, resolveForms, resolveRelationContent, resolveWorkspaceId };
62
+ export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId };
@@ -1,13 +1,13 @@
1
- export { g as fetchLayouts, h as fetchPage, i as fetchPageById, j as fetchPageMeta, k as fetchPages, r as resolveApiUrl } from './content-client-65N8ZRq9.js';
2
- import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock } from '@cmssy/types';
1
+ export { g as fetchLayouts, h as fetchPage, j as fetchPageById, k as fetchPageMeta, l as fetchPages, r as resolveApiUrl } from './content-client-DhcHP8ln.js';
2
+ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
- import { G as GraphqlRequestOptions } from './locale-D9KI4bND.js';
5
- export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-D9KI4bND.js';
6
- import { Q as QueryScopedOptions } from './csp-COFMUmsq.js';
7
- export { F as cmssyCspHeaders, G as isDevelopment, H as layoutRegionIds, J as resolveInitialTarget, K as toCspOrigin } from './csp-COFMUmsq.js';
4
+ import { G as GraphqlRequestOptions } from './locale-BCguiP54.js';
5
+ export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-BCguiP54.js';
6
+ import { Q as QueryScopedOptions } from './csp-AuptG-R-.js';
7
+ export { F as cmssyCspHeaders, G as isDevelopment, H as layoutRegionIds, J as resolveInitialTarget, K as toCspOrigin } from './csp-AuptG-R-.js';
8
8
  export { localizedPath } from './internal/locale.js';
9
9
 
10
- declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
10
+ declare const SITE_CONFIG_QUERY: string;
11
11
  declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
12
12
  declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
13
13
  declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin\n }\n }\n }\n }\n}";
@@ -46,6 +46,11 @@ declare function resolveRelationContent(config: CmssyClientConfig, entries: Rela
46
46
  declare function collectFormIds(blocks: RawBlock[], schemas: BlockSchemaMap, locale: string, defaultLocale: string): string[];
47
47
  declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], schemas: BlockSchemaMap, locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
48
48
 
49
+ type CmssyLayoutStore = Map<string, Promise<CmssyLayoutGroup[]>>;
50
+ declare function createCmssyLayoutStore(): CmssyLayoutStore;
51
+ declare function layoutStoreKey(config: CmssyClientConfig, pageSlug: string, previewSecret: string | undefined): string;
52
+ declare function readThroughLayoutStore(store: CmssyLayoutStore | undefined, key: string, load: () => Promise<CmssyLayoutGroup[]>): Promise<CmssyLayoutGroup[]>;
53
+
49
54
  declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
50
55
 
51
56
  interface CmssyDeliveryOperation {
@@ -54,4 +59,4 @@ interface CmssyDeliveryOperation {
54
59
  }
55
60
  declare const CMSSY_DELIVERY_OPERATIONS: readonly CmssyDeliveryOperation[];
56
61
 
57
- export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, fetchSiteConfig, getBlockContentForLanguage, normalizeBlockContent, resolveForms, resolveRelationContent, resolveWorkspaceId };
62
+ export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId };
package/dist/internal.js CHANGED
@@ -1,7 +1,7 @@
1
- import { DEFAULT_LAYOUT_REGIONS } from '@cmssy/types';
1
+ import { brandingFieldNames, DEFAULT_LAYOUT_REGIONS } from '@cmssy/types';
2
2
 
3
3
  // src/version.ts
4
- var CMSSY_CORE_VERSION = "18.0.0" ;
4
+ var CMSSY_CORE_VERSION = "19.1.0" ;
5
5
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
6
6
 
7
7
  // src/data/http.ts
@@ -425,8 +425,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
425
425
  label
426
426
  });
427
427
  }
428
-
429
- // src/data/queries.ts
430
428
  var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
431
429
  public {
432
430
  siteConfig(workspaceSlug: $workspaceSlug) {
@@ -439,11 +437,7 @@ var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
439
437
  notFoundPageId
440
438
  previewUrl
441
439
  branding {
442
- brandName
443
- logoUrl
444
- logoDarkUrl
445
- faviconUrl
446
- ogImageUrl
440
+ ${brandingFieldNames.join("\n ")}
447
441
  }
448
442
  }
449
443
  }
@@ -1126,6 +1120,28 @@ function localizeHref(href, locale) {
1126
1120
  return `${addLocalePrefix(bare, locale.current, locale)}${suffix}`;
1127
1121
  }
1128
1122
 
1123
+ // src/data/layout-store.ts
1124
+ function createCmssyLayoutStore() {
1125
+ return /* @__PURE__ */ new Map();
1126
+ }
1127
+ function layoutStoreKey(config, pageSlug, previewSecret) {
1128
+ return [
1129
+ resolveApiUrl(config.apiUrl),
1130
+ config.org ?? "",
1131
+ config.workspaceSlug,
1132
+ pageSlug,
1133
+ previewSecret ? "draft" : "published"
1134
+ ].join("\0");
1135
+ }
1136
+ function readThroughLayoutStore(store, key, load) {
1137
+ if (!store) return load();
1138
+ const pending = store.get(key);
1139
+ if (pending) return pending;
1140
+ const started = load();
1141
+ store.set(key, started);
1142
+ return started;
1143
+ }
1144
+
1129
1145
  // src/locale.ts
1130
1146
  var CMSSY_LOCALE_HEADER = "x-cmssy-locale";
1131
1147
  async function localeForPathname(config, pathname) {
@@ -1332,4 +1348,4 @@ function layoutRegionIds(layout) {
1332
1348
  return (layout?.regions ?? DEFAULT_LAYOUT_REGIONS).map((region) => region.id);
1333
1349
  }
1334
1350
 
1335
- export { CMSSY_DELIVERY_OPERATIONS, CMSSY_LOCALE_HEADER, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssyCspHeaders, cmssySecretsMatch, collectFormIds, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, getBlockContentForLanguage, isDevelopment, layoutRegionIds, localeForPath, localeForPathname, localizeHref, localizedPath, normalizeBlockContent, resolveApiUrl, resolveForms, resolveInitialTarget, resolveRelationContent, resolveSiteLocales, resolveWorkspaceId, splitCmssyLocale, splitLocaleFromPath, toCspOrigin };
1351
+ export { CMSSY_DELIVERY_OPERATIONS, CMSSY_LOCALE_HEADER, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssyCspHeaders, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, getBlockContentForLanguage, isDevelopment, layoutRegionIds, layoutStoreKey, localeForPath, localeForPathname, localizeHref, localizedPath, normalizeBlockContent, readThroughLayoutStore, resolveApiUrl, resolveForms, resolveInitialTarget, resolveRelationContent, resolveSiteLocales, resolveWorkspaceId, splitCmssyLocale, splitLocaleFromPath, toCspOrigin };
@@ -1,5 +1,5 @@
1
1
  import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
2
- import { F as FetchLike, R as RetryOption } from './content-client-65N8ZRq9.js';
2
+ import { F as FetchLike, R as RetryOption } from './content-client-DhcHP8ln.js';
3
3
 
4
4
  interface GraphqlRequestOptions {
5
5
  fetch?: FetchLike;
@@ -1,5 +1,5 @@
1
1
  import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
2
- import { F as FetchLike, R as RetryOption } from './content-client-65N8ZRq9.cjs';
2
+ import { F as FetchLike, R as RetryOption } from './content-client-DhcHP8ln.cjs';
3
3
 
4
4
  interface GraphqlRequestOptions {
5
5
  fetch?: FetchLike;
@@ -1,4 +1,4 @@
1
- import { F as FetchLike } from './content-client-65N8ZRq9.cjs';
1
+ import { F as FetchLike } from './content-client-DhcHP8ln.cjs';
2
2
  import { CmssyClientConfig } from '@cmssy/types';
3
3
 
4
4
  interface EditDiagnosticsConfig {
@@ -1,4 +1,4 @@
1
- import { F as FetchLike } from './content-client-65N8ZRq9.js';
1
+ import { F as FetchLike } from './content-client-DhcHP8ln.js';
2
2
  import { CmssyClientConfig } from '@cmssy/types';
3
3
 
4
4
  interface EditDiagnosticsConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "18.0.0",
3
+ "version": "19.1.0",
4
4
  "description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -87,7 +87,7 @@
87
87
  "vitest": "^2.1.0"
88
88
  },
89
89
  "dependencies": {
90
- "@cmssy/types": "0.54.0",
90
+ "@cmssy/types": "0.59.0",
91
91
  "jose": "^6.2.3"
92
92
  },
93
93
  "scripts": {