@cmssy/core 12.7.1 → 12.9.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.
@@ -12,6 +12,7 @@ interface RetryPolicy {
12
12
  maxRetryAfterMs?: number;
13
13
  retryStatuses?: number[];
14
14
  }
15
+ declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
15
16
 
16
17
  declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
17
18
  declare function resolveApiUrl(apiUrl: string | undefined): string;
@@ -44,4 +45,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
44
45
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
45
46
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
46
47
 
47
- export { CmssyRequestError as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryPolicy as R, type FetchLikeResponse as a, type FetchPageOptions as b, fetchPage as c, fetchPageById as d, fetchPageMeta as e, fetchLayouts as f, fetchPages as g, resolveApiUrl as r };
48
+ export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryPolicy as R, CmssyRequestError as a, type FetchLikeResponse as b, type FetchPageOptions as c, fetchPage as d, fetchPageById as e, fetchLayouts as f, fetchPageMeta as g, fetchPages as h, resolveApiUrl as r };
@@ -12,6 +12,7 @@ interface RetryPolicy {
12
12
  maxRetryAfterMs?: number;
13
13
  retryStatuses?: number[];
14
14
  }
15
+ declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
15
16
 
16
17
  declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
17
18
  declare function resolveApiUrl(apiUrl: string | undefined): string;
@@ -44,4 +45,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
44
45
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
45
46
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
46
47
 
47
- export { CmssyRequestError as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryPolicy as R, type FetchLikeResponse as a, type FetchPageOptions as b, fetchPage as c, fetchPageById as d, fetchPageMeta as e, fetchLayouts as f, fetchPages as g, resolveApiUrl as r };
48
+ export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryPolicy as R, CmssyRequestError as a, type FetchLikeResponse as b, type FetchPageOptions as c, fetchPage as d, fetchPageById as e, fetchLayouts as f, fetchPageMeta as g, fetchPages as h, resolveApiUrl as r };
@@ -1,5 +1,5 @@
1
1
  import { CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
2
- import { G as GraphqlRequestOptions } from './locale-DQZ80cew.js';
2
+ import { G as GraphqlRequestOptions } from './locale-jxsO_8YF.js';
3
3
 
4
4
  declare const DEFAULT_CMSSY_EDITOR_ORIGINS: string[];
5
5
  declare function isDevelopment(): boolean;
@@ -142,7 +142,13 @@ interface DragEndMessage {
142
142
  type: "cmssy:drag-end";
143
143
  protocolVersion: number;
144
144
  }
145
- type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
145
+ interface ViewportMessage {
146
+ type: "cmssy:viewport";
147
+ protocolVersion: number;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage | ViewportMessage;
146
152
  declare function isProtocolCompatible(version: number): boolean;
147
153
 
148
154
  interface PostTarget {
@@ -167,4 +173,4 @@ declare function toCspOrigin(origin: string): string;
167
173
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
168
174
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
169
175
 
170
- export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
176
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type ViewportMessage as V, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
@@ -1,5 +1,5 @@
1
1
  import { CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
2
- import { G as GraphqlRequestOptions } from './locale-BS61R-fF.cjs';
2
+ import { G as GraphqlRequestOptions } from './locale-BM2fwE3O.cjs';
3
3
 
4
4
  declare const DEFAULT_CMSSY_EDITOR_ORIGINS: string[];
5
5
  declare function isDevelopment(): boolean;
@@ -142,7 +142,13 @@ interface DragEndMessage {
142
142
  type: "cmssy:drag-end";
143
143
  protocolVersion: number;
144
144
  }
145
- type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
145
+ interface ViewportMessage {
146
+ type: "cmssy:viewport";
147
+ protocolVersion: number;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage | ViewportMessage;
146
152
  declare function isProtocolCompatible(version: number): boolean;
147
153
 
148
154
  interface PostTarget {
@@ -167,4 +173,4 @@ declare function toCspOrigin(origin: string): string;
167
173
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
168
174
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
169
175
 
170
- export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
176
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type ViewportMessage as V, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
package/dist/index.cjs CHANGED
@@ -85,6 +85,7 @@ var CmssyRequestError = class extends Error {
85
85
  }
86
86
  };
87
87
  var DEFAULT_RETRY_STATUSES = [429, 503];
88
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
88
89
  function retryAfterMs(response) {
89
90
  const raw = response.headers?.get("retry-after");
90
91
  if (!raw) return null;
@@ -118,7 +119,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
118
119
  const maxRetries = retry.maxRetries ?? 3;
119
120
  const baseDelayMs = retry.baseDelayMs ?? 300;
120
121
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
121
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
122
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
122
123
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
123
124
  let response = await doFetch(url, init);
124
125
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -639,6 +640,9 @@ function isOriginAllowed(origin, allowed) {
639
640
  return expected === "*" || expected === actual;
640
641
  });
641
642
  }
643
+ function isSize(value) {
644
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
645
+ }
642
646
  function isObject(value) {
643
647
  return typeof value === "object" && value !== null && !Array.isArray(value);
644
648
  }
@@ -695,6 +699,13 @@ function parseEditorMessage(data, origin, expectedOrigin) {
695
699
  } : null;
696
700
  case "cmssy:drag-end":
697
701
  return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:drag-end", protocolVersion: PROTOCOL_VERSION } : null;
702
+ case "cmssy:viewport":
703
+ return isSize(data.width) && isSize(data.height) && data.protocolVersion === PROTOCOL_VERSION ? {
704
+ type: "cmssy:viewport",
705
+ protocolVersion: PROTOCOL_VERSION,
706
+ width: data.width,
707
+ height: data.height
708
+ } : null;
698
709
  default:
699
710
  return null;
700
711
  }
@@ -890,6 +901,7 @@ Object.defineProperty(exports, "layoutPositionValues", {
890
901
  exports.CMSSY_EDIT_HEADER = CMSSY_EDIT_HEADER;
891
902
  exports.CMSSY_EDIT_QUERY_PARAM = CMSSY_EDIT_QUERY_PARAM;
892
903
  exports.CMSSY_LOCALE_HEADER = CMSSY_LOCALE_HEADER;
904
+ exports.CMSSY_RATE_LIMIT_WINDOW_MS = CMSSY_RATE_LIMIT_WINDOW_MS;
893
905
  exports.CMSSY_SECRET_QUERY_PARAM = CMSSY_SECRET_QUERY_PARAM;
894
906
  exports.CmssyRequestError = CmssyRequestError;
895
907
  exports.CmssyWebhookError = CmssyWebhookError;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
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 CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-BsHNLfJ1.cjs';
2
- export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-BS61R-fF.cjs';
3
- export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-BPpRfq0h.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 CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, V as ViewportMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-BMP9bAZ9.cjs';
2
+ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-BM2fwE3O.cjs';
3
+ export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, b as FetchLikeResponse, c as FetchPageOptions, R as RetryPolicy } from './content-client-COeyYJl1.cjs';
4
4
  import * as _cmssy_types from '@cmssy/types';
5
5
  import { FieldOptions, TypedField, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
6
  export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, LayoutPosition, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, layoutPositionValues } from '@cmssy/types';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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 CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-DrkfGO99.js';
2
- export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-DQZ80cew.js';
3
- export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-BPpRfq0h.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 CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, V as ViewportMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-BDE0cAZL.js';
2
+ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-jxsO_8YF.js';
3
+ export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, b as FetchLikeResponse, c as FetchPageOptions, R as RetryPolicy } from './content-client-COeyYJl1.js';
4
4
  import * as _cmssy_types from '@cmssy/types';
5
5
  import { FieldOptions, TypedField, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
6
6
  export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, LayoutPosition, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, layoutPositionValues } from '@cmssy/types';
package/dist/index.js CHANGED
@@ -83,6 +83,7 @@ var CmssyRequestError = class extends Error {
83
83
  }
84
84
  };
85
85
  var DEFAULT_RETRY_STATUSES = [429, 503];
86
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
86
87
  function retryAfterMs(response) {
87
88
  const raw = response.headers?.get("retry-after");
88
89
  if (!raw) return null;
@@ -116,7 +117,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
116
117
  const maxRetries = retry.maxRetries ?? 3;
117
118
  const baseDelayMs = retry.baseDelayMs ?? 300;
118
119
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
119
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
120
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
120
121
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
121
122
  let response = await doFetch(url, init);
122
123
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -637,6 +638,9 @@ function isOriginAllowed(origin, allowed) {
637
638
  return expected === "*" || expected === actual;
638
639
  });
639
640
  }
641
+ function isSize(value) {
642
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
643
+ }
640
644
  function isObject(value) {
641
645
  return typeof value === "object" && value !== null && !Array.isArray(value);
642
646
  }
@@ -693,6 +697,13 @@ function parseEditorMessage(data, origin, expectedOrigin) {
693
697
  } : null;
694
698
  case "cmssy:drag-end":
695
699
  return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:drag-end", protocolVersion: PROTOCOL_VERSION } : null;
700
+ case "cmssy:viewport":
701
+ return isSize(data.width) && isSize(data.height) && data.protocolVersion === PROTOCOL_VERSION ? {
702
+ type: "cmssy:viewport",
703
+ protocolVersion: PROTOCOL_VERSION,
704
+ width: data.width,
705
+ height: data.height
706
+ } : null;
696
707
  default:
697
708
  return null;
698
709
  }
@@ -877,4 +888,4 @@ async function verifyCmssyWebhook(options) {
877
888
  return parsed;
878
889
  }
879
890
 
880
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, createCmssyClient, defineCmssyConfig, fields, graphqlRequest, isProtocolCompatible, isVerifiedEditUrl, localizeHref, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor, resolveCmssyLocale, resolveEditorOrigin, verifyCmssyWebhook };
891
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, createCmssyClient, defineCmssyConfig, fields, graphqlRequest, isProtocolCompatible, isVerifiedEditUrl, localizeHref, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor, resolveCmssyLocale, resolveEditorOrigin, verifyCmssyWebhook };
@@ -12,6 +12,7 @@ var CmssyRequestError = class extends Error {
12
12
  }
13
13
  };
14
14
  var DEFAULT_RETRY_STATUSES = [429, 503];
15
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
15
16
  function retryAfterMs(response) {
16
17
  const raw = response.headers?.get("retry-after");
17
18
  if (!raw) return null;
@@ -45,7 +46,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
45
46
  const maxRetries = retry.maxRetries ?? 3;
46
47
  const baseDelayMs = retry.baseDelayMs ?? 300;
47
48
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
48
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
49
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
49
50
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
50
51
  let response = await doFetch(url, init);
51
52
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -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-BS61R-fF.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-BM2fwE3O.cjs';
2
2
  export { CmssySiteLocales } from '@cmssy/types';
3
- import '../content-client-BPpRfq0h.cjs';
3
+ import '../content-client-COeyYJl1.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-DQZ80cew.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-jxsO_8YF.js';
2
2
  export { CmssySiteLocales } from '@cmssy/types';
3
- import '../content-client-BPpRfq0h.js';
3
+ import '../content-client-COeyYJl1.js';
4
4
 
5
5
  declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
6
6
 
@@ -10,6 +10,7 @@ var CmssyRequestError = class extends Error {
10
10
  }
11
11
  };
12
12
  var DEFAULT_RETRY_STATUSES = [429, 503];
13
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
13
14
  function retryAfterMs(response) {
14
15
  const raw = response.headers?.get("retry-after");
15
16
  if (!raw) return null;
@@ -43,7 +44,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
43
44
  const maxRetries = retry.maxRetries ?? 3;
44
45
  const baseDelayMs = retry.baseDelayMs ?? 300;
45
46
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
46
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
47
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
47
48
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
48
49
  let response = await doFetch(url, init);
49
50
  for (let attempt = 0; attempt < maxRetries; attempt++) {
package/dist/internal.cjs CHANGED
@@ -12,6 +12,7 @@ var CmssyRequestError = class extends Error {
12
12
  }
13
13
  };
14
14
  var DEFAULT_RETRY_STATUSES = [429, 503];
15
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
15
16
  function retryAfterMs(response) {
16
17
  const raw = response.headers?.get("retry-after");
17
18
  if (!raw) return null;
@@ -45,7 +46,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
45
46
  const maxRetries = retry.maxRetries ?? 3;
46
47
  const baseDelayMs = retry.baseDelayMs ?? 300;
47
48
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
48
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
49
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
49
50
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
50
51
  let response = await doFetch(url, init);
51
52
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -1,10 +1,10 @@
1
- export { f as fetchLayouts, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-BPpRfq0h.cjs';
1
+ export { f as fetchLayouts, d as fetchPage, e as fetchPageById, g as fetchPageMeta, h as fetchPages, r as resolveApiUrl } from './content-client-COeyYJl1.cjs';
2
2
  import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock } from '@cmssy/types';
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
- import { G as GraphqlRequestOptions } from './locale-BS61R-fF.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-BS61R-fF.cjs';
6
- import { Q as QueryScopedOptions } from './csp-BsHNLfJ1.cjs';
7
- export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-BsHNLfJ1.cjs';
4
+ import { G as GraphqlRequestOptions } from './locale-BM2fwE3O.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-BM2fwE3O.cjs';
6
+ import { Q as QueryScopedOptions } from './csp-BMP9bAZ9.cjs';
7
+ export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-BMP9bAZ9.cjs';
8
8
  export { localizedPath } from './internal/locale.cjs';
9
9
 
10
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}";
@@ -1,10 +1,10 @@
1
- export { f as fetchLayouts, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-BPpRfq0h.js';
1
+ export { f as fetchLayouts, d as fetchPage, e as fetchPageById, g as fetchPageMeta, h as fetchPages, r as resolveApiUrl } from './content-client-COeyYJl1.js';
2
2
  import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, CmssySiteConfig, FieldDefinition, RawBlock } from '@cmssy/types';
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
- import { G as GraphqlRequestOptions } from './locale-DQZ80cew.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-DQZ80cew.js';
6
- import { Q as QueryScopedOptions } from './csp-DrkfGO99.js';
7
- export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-DrkfGO99.js';
4
+ import { G as GraphqlRequestOptions } from './locale-jxsO_8YF.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-jxsO_8YF.js';
6
+ import { Q as QueryScopedOptions } from './csp-BDE0cAZL.js';
7
+ export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-BDE0cAZL.js';
8
8
  export { localizedPath } from './internal/locale.js';
9
9
 
10
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}";
package/dist/internal.js CHANGED
@@ -10,6 +10,7 @@ var CmssyRequestError = class extends Error {
10
10
  }
11
11
  };
12
12
  var DEFAULT_RETRY_STATUSES = [429, 503];
13
+ var CMSSY_RATE_LIMIT_WINDOW_MS = 6e4;
13
14
  function retryAfterMs(response) {
14
15
  const raw = response.headers?.get("retry-after");
15
16
  if (!raw) return null;
@@ -43,7 +44,7 @@ async function fetchWithRetry(doFetch, url, init, retry) {
43
44
  const maxRetries = retry.maxRetries ?? 3;
44
45
  const baseDelayMs = retry.baseDelayMs ?? 300;
45
46
  const maxDelayMs = retry.maxDelayMs ?? 3e3;
46
- const maxRetryAfterMs = retry.maxRetryAfterMs ?? 1e4;
47
+ const maxRetryAfterMs = retry.maxRetryAfterMs ?? CMSSY_RATE_LIMIT_WINDOW_MS;
47
48
  const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
48
49
  let response = await doFetch(url, init);
49
50
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -1,5 +1,5 @@
1
1
  import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
2
- import { F as FetchLike, R as RetryPolicy } from './content-client-BPpRfq0h.cjs';
2
+ import { F as FetchLike, R as RetryPolicy } from './content-client-COeyYJl1.cjs';
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 RetryPolicy } from './content-client-BPpRfq0h.js';
2
+ import { F as FetchLike, R as RetryPolicy } from './content-client-COeyYJl1.js';
3
3
 
4
4
  interface GraphqlRequestOptions {
5
5
  fetch?: FetchLike;
@@ -1,4 +1,4 @@
1
- import { F as FetchLike } from './content-client-BPpRfq0h.cjs';
1
+ import { F as FetchLike } from './content-client-COeyYJl1.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-BPpRfq0h.js';
1
+ import { F as FetchLike } from './content-client-COeyYJl1.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": "12.7.1",
3
+ "version": "12.9.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",