@cmssy/core 19.31.1 → 19.33.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.
@@ -179,9 +179,11 @@ interface ShortcutMessage {
179
179
  protocolVersion: number;
180
180
  action: ShortcutAction;
181
181
  }
182
+ type InvisibleReason = "empty" | "transparent";
182
183
  interface InvisibleBlock {
183
184
  blockId: string;
184
185
  blockType: string;
186
+ reason: InvisibleReason;
185
187
  }
186
188
  interface InvisibleBlocksMessage {
187
189
  type: "cmssy:invisible-blocks";
@@ -267,4 +269,4 @@ declare function toCspOrigin(origin: string): string;
267
269
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
268
270
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
269
271
 
270
- export { type AppToEditorMessage as A, type BoundsMessage as B, type CmssyRecordSort as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, FORM_QUERY as F, type ViewportMessage as G, applyCmssyCsp as H, type InvisibleBlock as I, createCmssyClient as J, defineCmssyConfig as K, defineCmssyLayout as L, MODEL_DEFINITIONS_QUERY as M, isProtocolCompatible as N, normalizeOrigin as O, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SITE_CONFIG_QUERY as S, parseEditorMessage as T, postToEditor as U, type VariablesParameter as V, resolveEditorOrigin as W, MODEL_RECORDS_QUERY as a, SUBMIT_FORM_MUTATION as b, cmssyCspHeaders as c, type ClickMessage as d, type CmssyClient as e, type CmssyConfig as f, type CmssyCspOptions as g, type CmssyEnvConfig as h, isDevelopment as i, type CmssyLayout as j, type CmssyRegion as k, layoutRegionIds as l, type CmssyRegionOf as m, type CmssyRegionSettings as n, type CmssyRegionSettingsOf as o, type InvisibleBlocksMessage as p, type ParentReadyMessage as q, resolveInitialTarget as r, type PatchMessage as s, toCspOrigin as t, type PostTarget as u, SHORTCUT_ACTIONS as v, type ScopedVariables as w, type SelectMessage as x, type ShortcutAction as y, type ShortcutMessage as z };
272
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type CmssyRecordSort as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, FORM_QUERY as F, type ShortcutMessage as G, type ViewportMessage as H, type InvisibleBlock as I, applyCmssyCsp as J, createCmssyClient as K, defineCmssyConfig as L, MODEL_DEFINITIONS_QUERY as M, defineCmssyLayout as N, isProtocolCompatible as O, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SITE_CONFIG_QUERY as S, normalizeOrigin as T, parseEditorMessage as U, type VariablesParameter as V, postToEditor as W, resolveEditorOrigin as X, MODEL_RECORDS_QUERY as a, SUBMIT_FORM_MUTATION as b, cmssyCspHeaders as c, type ClickMessage as d, type CmssyClient as e, type CmssyConfig as f, type CmssyCspOptions as g, type CmssyEnvConfig as h, isDevelopment as i, type CmssyLayout as j, type CmssyRegion as k, layoutRegionIds as l, type CmssyRegionOf as m, type CmssyRegionSettings as n, type CmssyRegionSettingsOf as o, type InvisibleBlocksMessage as p, type InvisibleReason as q, resolveInitialTarget as r, type ParentReadyMessage as s, toCspOrigin as t, type PatchMessage as u, type PostTarget as v, SHORTCUT_ACTIONS as w, type ScopedVariables as x, type SelectMessage as y, type ShortcutAction as z };
@@ -179,9 +179,11 @@ interface ShortcutMessage {
179
179
  protocolVersion: number;
180
180
  action: ShortcutAction;
181
181
  }
182
+ type InvisibleReason = "empty" | "transparent";
182
183
  interface InvisibleBlock {
183
184
  blockId: string;
184
185
  blockType: string;
186
+ reason: InvisibleReason;
185
187
  }
186
188
  interface InvisibleBlocksMessage {
187
189
  type: "cmssy:invisible-blocks";
@@ -267,4 +269,4 @@ declare function toCspOrigin(origin: string): string;
267
269
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
268
270
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
269
271
 
270
- export { type AppToEditorMessage as A, type BoundsMessage as B, type CmssyRecordSort as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, FORM_QUERY as F, type ViewportMessage as G, applyCmssyCsp as H, type InvisibleBlock as I, createCmssyClient as J, defineCmssyConfig as K, defineCmssyLayout as L, MODEL_DEFINITIONS_QUERY as M, isProtocolCompatible as N, normalizeOrigin as O, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SITE_CONFIG_QUERY as S, parseEditorMessage as T, postToEditor as U, type VariablesParameter as V, resolveEditorOrigin as W, MODEL_RECORDS_QUERY as a, SUBMIT_FORM_MUTATION as b, cmssyCspHeaders as c, type ClickMessage as d, type CmssyClient as e, type CmssyConfig as f, type CmssyCspOptions as g, type CmssyEnvConfig as h, isDevelopment as i, type CmssyLayout as j, type CmssyRegion as k, layoutRegionIds as l, type CmssyRegionOf as m, type CmssyRegionSettings as n, type CmssyRegionSettingsOf as o, type InvisibleBlocksMessage as p, type ParentReadyMessage as q, resolveInitialTarget as r, type PatchMessage as s, toCspOrigin as t, type PostTarget as u, SHORTCUT_ACTIONS as v, type ScopedVariables as w, type SelectMessage as x, type ShortcutAction as y, type ShortcutMessage as z };
272
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type CmssyRecordSort as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, FORM_QUERY as F, type ShortcutMessage as G, type ViewportMessage as H, type InvisibleBlock as I, applyCmssyCsp as J, createCmssyClient as K, defineCmssyConfig as L, MODEL_DEFINITIONS_QUERY as M, defineCmssyLayout as N, isProtocolCompatible as O, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SITE_CONFIG_QUERY as S, normalizeOrigin as T, parseEditorMessage as U, type VariablesParameter as V, postToEditor as W, resolveEditorOrigin as X, MODEL_RECORDS_QUERY as a, SUBMIT_FORM_MUTATION as b, cmssyCspHeaders as c, type ClickMessage as d, type CmssyClient as e, type CmssyConfig as f, type CmssyCspOptions as g, type CmssyEnvConfig as h, isDevelopment as i, type CmssyLayout as j, type CmssyRegion as k, layoutRegionIds as l, type CmssyRegionOf as m, type CmssyRegionSettings as n, type CmssyRegionSettingsOf as o, type InvisibleBlocksMessage as p, type InvisibleReason as q, resolveInitialTarget as r, type ParentReadyMessage as s, toCspOrigin as t, type PatchMessage as u, type PostTarget as v, SHORTCUT_ACTIONS as w, type ScopedVariables as x, type SelectMessage as y, type ShortcutAction as z };
package/dist/index.cjs CHANGED
@@ -225,7 +225,7 @@ function documentText(document2) {
225
225
  }
226
226
 
227
227
  // src/version.ts
228
- var CMSSY_CORE_VERSION = "19.31.1" ;
228
+ var CMSSY_CORE_VERSION = "19.33.0" ;
229
229
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
230
230
 
231
231
  // src/data/http.ts
@@ -1166,6 +1166,7 @@ var fields = {
1166
1166
  media: (opts = {}) => build("media", opts),
1167
1167
  pageSelector: (opts = {}) => build("pageSelector", opts),
1168
1168
  repeater: (opts) => build("repeater", opts),
1169
+ object: (opts) => build("object", opts),
1169
1170
  relation: (opts) => {
1170
1171
  const { model, mode, ...rest } = opts;
1171
1172
  return build("relation", {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CmssyRecordSort } from './csp-CDQ84XTt.cjs';
2
- export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, P as PROTOCOL_VERSION, q as ParentReadyMessage, s as PatchMessage, u as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, v as SHORTCUT_ACTIONS, w as ScopedVariables, x as SelectMessage, y as ShortcutAction, z as ShortcutMessage, V as VariablesParameter, G as ViewportMessage, H as applyCmssyCsp, J as createCmssyClient, K as defineCmssyConfig, L as defineCmssyLayout, N as isProtocolCompatible, O as normalizeOrigin, T as parseEditorMessage, U as postToEditor, W as resolveEditorOrigin } from './csp-CDQ84XTt.cjs';
1
+ import { C as CmssyRecordSort } from './csp-BERb4adx.cjs';
2
+ export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-BERb4adx.cjs';
3
3
  import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-CUk6dYTo.cjs';
4
4
  export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-CUk6dYTo.cjs';
5
5
  import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-EAeHiBv2.cjs';
@@ -261,7 +261,7 @@ declare function maintenanceRefusal(error: unknown): CmssyMaintenanceRefusal | n
261
261
  type Declared<O> = O extends {
262
262
  required: true;
263
263
  } ? true : false;
264
- type BaseFieldOptions = Pick<FieldOptions, "label" | "defaultValue" | "helperText" | "required" | "placeholder" | "tab" | "localized"> & {
264
+ type BaseFieldOptions = Pick<FieldOptions, "label" | "defaultValue" | "helperText" | "required" | "placeholder" | "tab" | "localized" | "showWhen"> & {
265
265
  validation?: FieldValidation;
266
266
  };
267
267
  type ItemCountOptions = Pick<FieldOptions, "minItems" | "maxItems">;
@@ -270,6 +270,7 @@ type MultiselectFieldOptions = ChoiceFieldOptions & ItemCountOptions;
270
270
  type MediaFieldOptions = BaseFieldOptions & Pick<FieldOptions, "multiple" | "acceptedTypes" | "accept" | "maxSize" | "aspectRatio" | "aspectRatios">;
271
271
  type PageSelectorFieldOptions = BaseFieldOptions & Pick<FieldOptions, "multiple" | "pageType">;
272
272
  type RepeaterFieldOptions = BaseFieldOptions & Pick<FieldOptions, "itemSchema" | "minItems" | "maxItems" | "itemLabel" | "addButtonLabel" | "collapsible">;
273
+ type ObjectFieldOptions = BaseFieldOptions & Required<Pick<FieldOptions, "itemSchema">>;
273
274
  type TableFieldOptions = BaseFieldOptions & Pick<FieldOptions, "maxColumns">;
274
275
  type RelationFieldOptions = BaseFieldOptions & ItemCountOptions & {
275
276
  model: string;
@@ -296,6 +297,9 @@ type MediaValue<O> = ResolvedMediaValue<O extends {
296
297
  type RepeaterValue<O> = O extends {
297
298
  itemSchema: infer Schema extends BlockPropsSchema;
298
299
  } ? InferBlockContent<Schema>[] : Record<string, unknown>[];
300
+ type ObjectValue<O> = O extends {
301
+ itemSchema: infer Schema extends BlockPropsSchema;
302
+ } ? InferBlockContent<Schema> : Record<string, unknown>;
299
303
  type RelationValue<O> = O extends {
300
304
  mode: "all";
301
305
  } | {
@@ -331,6 +335,7 @@ declare const fields: {
331
335
  media: <const O extends MediaOnly<O>>(opts?: O) => TypedField<MediaValue<O>, Declared<O>>;
332
336
  pageSelector: <const O extends Only<O, PageSelectorFieldOptions, "pageSelector">>(opts?: O) => TypedField<PageSelectorValue<O>, Declared<O>>;
333
337
  repeater: <const O extends Only<O, RepeaterFieldOptions, "repeater">>(opts: O) => TypedField<RepeaterValue<O>, Declared<O>>;
338
+ object: <const O extends Only<O, ObjectFieldOptions, "object">>(opts: O) => TypedField<ObjectValue<O>, Declared<O>>;
334
339
  relation: <const O extends Only<O, RelationFieldOptions, "relation">>(opts: O) => TypedField<RelationValue<O>, Declared<O>>;
335
340
  };
336
341
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CmssyRecordSort } from './csp-DoY_JZ4u.js';
2
- export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, P as PROTOCOL_VERSION, q as ParentReadyMessage, s as PatchMessage, u as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, v as SHORTCUT_ACTIONS, w as ScopedVariables, x as SelectMessage, y as ShortcutAction, z as ShortcutMessage, V as VariablesParameter, G as ViewportMessage, H as applyCmssyCsp, J as createCmssyClient, K as defineCmssyConfig, L as defineCmssyLayout, N as isProtocolCompatible, O as normalizeOrigin, T as parseEditorMessage, U as postToEditor, W as resolveEditorOrigin } from './csp-DoY_JZ4u.js';
1
+ import { C as CmssyRecordSort } from './csp-EaQufK8P.js';
2
+ export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-EaQufK8P.js';
3
3
  import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-Ds2uJX5V.js';
4
4
  export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-Ds2uJX5V.js';
5
5
  import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-EAeHiBv2.js';
@@ -261,7 +261,7 @@ declare function maintenanceRefusal(error: unknown): CmssyMaintenanceRefusal | n
261
261
  type Declared<O> = O extends {
262
262
  required: true;
263
263
  } ? true : false;
264
- type BaseFieldOptions = Pick<FieldOptions, "label" | "defaultValue" | "helperText" | "required" | "placeholder" | "tab" | "localized"> & {
264
+ type BaseFieldOptions = Pick<FieldOptions, "label" | "defaultValue" | "helperText" | "required" | "placeholder" | "tab" | "localized" | "showWhen"> & {
265
265
  validation?: FieldValidation;
266
266
  };
267
267
  type ItemCountOptions = Pick<FieldOptions, "minItems" | "maxItems">;
@@ -270,6 +270,7 @@ type MultiselectFieldOptions = ChoiceFieldOptions & ItemCountOptions;
270
270
  type MediaFieldOptions = BaseFieldOptions & Pick<FieldOptions, "multiple" | "acceptedTypes" | "accept" | "maxSize" | "aspectRatio" | "aspectRatios">;
271
271
  type PageSelectorFieldOptions = BaseFieldOptions & Pick<FieldOptions, "multiple" | "pageType">;
272
272
  type RepeaterFieldOptions = BaseFieldOptions & Pick<FieldOptions, "itemSchema" | "minItems" | "maxItems" | "itemLabel" | "addButtonLabel" | "collapsible">;
273
+ type ObjectFieldOptions = BaseFieldOptions & Required<Pick<FieldOptions, "itemSchema">>;
273
274
  type TableFieldOptions = BaseFieldOptions & Pick<FieldOptions, "maxColumns">;
274
275
  type RelationFieldOptions = BaseFieldOptions & ItemCountOptions & {
275
276
  model: string;
@@ -296,6 +297,9 @@ type MediaValue<O> = ResolvedMediaValue<O extends {
296
297
  type RepeaterValue<O> = O extends {
297
298
  itemSchema: infer Schema extends BlockPropsSchema;
298
299
  } ? InferBlockContent<Schema>[] : Record<string, unknown>[];
300
+ type ObjectValue<O> = O extends {
301
+ itemSchema: infer Schema extends BlockPropsSchema;
302
+ } ? InferBlockContent<Schema> : Record<string, unknown>;
299
303
  type RelationValue<O> = O extends {
300
304
  mode: "all";
301
305
  } | {
@@ -331,6 +335,7 @@ declare const fields: {
331
335
  media: <const O extends MediaOnly<O>>(opts?: O) => TypedField<MediaValue<O>, Declared<O>>;
332
336
  pageSelector: <const O extends Only<O, PageSelectorFieldOptions, "pageSelector">>(opts?: O) => TypedField<PageSelectorValue<O>, Declared<O>>;
333
337
  repeater: <const O extends Only<O, RepeaterFieldOptions, "repeater">>(opts: O) => TypedField<RepeaterValue<O>, Declared<O>>;
338
+ object: <const O extends Only<O, ObjectFieldOptions, "object">>(opts: O) => TypedField<ObjectValue<O>, Declared<O>>;
334
339
  relation: <const O extends Only<O, RelationFieldOptions, "relation">>(opts: O) => TypedField<RelationValue<O>, Declared<O>>;
335
340
  };
336
341
 
package/dist/index.js CHANGED
@@ -224,7 +224,7 @@ function documentText(document2) {
224
224
  }
225
225
 
226
226
  // src/version.ts
227
- var CMSSY_CORE_VERSION = "19.31.1" ;
227
+ var CMSSY_CORE_VERSION = "19.33.0" ;
228
228
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
229
229
 
230
230
  // src/data/http.ts
@@ -1165,6 +1165,7 @@ var fields = {
1165
1165
  media: (opts = {}) => build("media", opts),
1166
1166
  pageSelector: (opts = {}) => build("pageSelector", opts),
1167
1167
  repeater: (opts) => build("repeater", opts),
1168
+ object: (opts) => build("object", opts),
1168
1169
  relation: (opts) => {
1169
1170
  const { model, mode, ...rest } = opts;
1170
1171
  return build("relation", {
@@ -154,7 +154,7 @@ function documentText(document) {
154
154
  }
155
155
 
156
156
  // src/version.ts
157
- var CMSSY_CORE_VERSION = "19.31.1" ;
157
+ var CMSSY_CORE_VERSION = "19.33.0" ;
158
158
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
159
159
 
160
160
  // src/data/http.ts
@@ -152,7 +152,7 @@ function documentText(document) {
152
152
  }
153
153
 
154
154
  // src/version.ts
155
- var CMSSY_CORE_VERSION = "19.31.1" ;
155
+ var CMSSY_CORE_VERSION = "19.33.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/data/http.ts
package/dist/internal.cjs CHANGED
@@ -154,7 +154,7 @@ function documentText(document2) {
154
154
  }
155
155
 
156
156
  // src/version.ts
157
- var CMSSY_CORE_VERSION = "19.31.1" ;
157
+ var CMSSY_CORE_VERSION = "19.33.0" ;
158
158
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
159
159
 
160
160
  // src/data/http.ts
@@ -844,6 +844,15 @@ function walkBlockFields(values, schema, visit, options = {}, path = []) {
844
844
  });
845
845
  continue;
846
846
  }
847
+ if (field.type === "object") {
848
+ const itemSchema = field.itemSchema;
849
+ const stored = values[key];
850
+ if (!itemSchema || !isRecord(stored)) continue;
851
+ const group = options.copyRows ? { ...stored } : stored;
852
+ if (options.copyRows) values[key] = group;
853
+ walkBlockFields(group, itemSchema, visit, options, [...path, key]);
854
+ continue;
855
+ }
847
856
  visit(values, key, field, path);
848
857
  }
849
858
  }
@@ -1272,6 +1281,31 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
1272
1281
  };
1273
1282
  }
1274
1283
 
1284
+ // src/show-when-targets.ts
1285
+ function unreachableShowWhenTargets(blockType, schema, path = []) {
1286
+ return Object.entries(schema).flatMap(([key, field]) => {
1287
+ const at = [...path, key].join(".");
1288
+ const own = field.showWhen ? unreachable(schema, key, field, path.length === 0) : null;
1289
+ const problems = own ? [
1290
+ `cmssy: block "${blockType}" field "${at}" has showWhen on ${JSON.stringify(field.showWhen?.field)}, ${own}`
1291
+ ] : [];
1292
+ const nested = field.itemSchema ? unreachableShowWhenTargets(blockType, field.itemSchema, [...path, key]) : [];
1293
+ return [...problems, ...nested];
1294
+ });
1295
+ }
1296
+ function unreachable(schema, key, field, topLevel) {
1297
+ const target = field.showWhen?.field;
1298
+ if (typeof target !== "string" || target === key) {
1299
+ return "which is not a field next to it";
1300
+ }
1301
+ const sibling = Object.hasOwn(schema, target) ? schema[target] : void 0;
1302
+ if (!sibling) return "which is not a field next to it";
1303
+ if (topLevel && bucketOf(sibling) !== bucketOf(field)) {
1304
+ return `which is on the ${bucketOf(sibling)} tab, not the ${bucketOf(field)} tab`;
1305
+ }
1306
+ return null;
1307
+ }
1308
+
1275
1309
  // src/bridge/messages.ts
1276
1310
  function normalizeOrigin(origin) {
1277
1311
  const trimmed = origin.trim();
@@ -1519,3 +1553,4 @@ exports.resolveWorkspaceId = resolveWorkspaceId;
1519
1553
  exports.splitCmssyLocale = splitCmssyLocale;
1520
1554
  exports.splitLocaleFromPath = splitLocaleFromPath;
1521
1555
  exports.toCspOrigin = toCspOrigin;
1556
+ exports.unreachableShowWhenTargets = unreachableShowWhenTargets;
@@ -4,8 +4,8 @@ import { G as GraphqlRequestOptions } from './locale-CUk6dYTo.cjs';
4
4
  export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-CUk6dYTo.cjs';
5
5
  import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
6
6
  export { CmssySiteLocales } from '@cmssy/types';
7
- import { Q as QueryScopedOptions } from './csp-CDQ84XTt.cjs';
8
- export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-CDQ84XTt.cjs';
7
+ import { Q as QueryScopedOptions } from './csp-BERb4adx.cjs';
8
+ export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-BERb4adx.cjs';
9
9
  export { localizedPath } from './internal/locale.cjs';
10
10
 
11
11
  declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
@@ -46,6 +46,8 @@ declare function createCmssyLayoutStore(): CmssyLayoutStore;
46
46
  declare function layoutStoreKey(config: CmssyClientConfig, pageSlug: string, previewSecret: string | undefined): string;
47
47
  declare function readThroughLayoutStore(store: CmssyLayoutStore | undefined, key: string, load: () => Promise<CmssyLayoutGroup[]>): Promise<CmssyLayoutGroup[]>;
48
48
 
49
+ declare function unreachableShowWhenTargets(blockType: string, schema: Record<string, FieldDefinition>, path?: readonly string[]): string[];
50
+
49
51
  declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
50
52
 
51
53
  interface CmssyDeliveryOperation {
@@ -54,4 +56,4 @@ interface CmssyDeliveryOperation {
54
56
  }
55
57
  declare const CMSSY_DELIVERY_OPERATIONS: readonly CmssyDeliveryOperation[];
56
58
 
57
- export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, type RelationContentEntry, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId };
59
+ export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, type RelationContentEntry, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId, unreachableShowWhenTargets };
@@ -4,8 +4,8 @@ import { G as GraphqlRequestOptions } from './locale-Ds2uJX5V.js';
4
4
  export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-Ds2uJX5V.js';
5
5
  import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
6
6
  export { CmssySiteLocales } from '@cmssy/types';
7
- import { Q as QueryScopedOptions } from './csp-DoY_JZ4u.js';
8
- export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-DoY_JZ4u.js';
7
+ import { Q as QueryScopedOptions } from './csp-EaQufK8P.js';
8
+ export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-EaQufK8P.js';
9
9
  export { localizedPath } from './internal/locale.js';
10
10
 
11
11
  declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
@@ -46,6 +46,8 @@ declare function createCmssyLayoutStore(): CmssyLayoutStore;
46
46
  declare function layoutStoreKey(config: CmssyClientConfig, pageSlug: string, previewSecret: string | undefined): string;
47
47
  declare function readThroughLayoutStore(store: CmssyLayoutStore | undefined, key: string, load: () => Promise<CmssyLayoutGroup[]>): Promise<CmssyLayoutGroup[]>;
48
48
 
49
+ declare function unreachableShowWhenTargets(blockType: string, schema: Record<string, FieldDefinition>, path?: readonly string[]): string[];
50
+
49
51
  declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
50
52
 
51
53
  interface CmssyDeliveryOperation {
@@ -54,4 +56,4 @@ interface CmssyDeliveryOperation {
54
56
  }
55
57
  declare const CMSSY_DELIVERY_OPERATIONS: readonly CmssyDeliveryOperation[];
56
58
 
57
- export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, type RelationContentEntry, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId };
59
+ export { type BlockSchemaMap, CMSSY_DELIVERY_OPERATIONS, type CmssyLayoutStore, type RelationContentEntry, asBucket, buildBlockContext, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, createCmssyLayoutStore, fetchSiteConfig, getBlockContentForLanguage, layoutStoreKey, normalizeBlockContent, readThroughLayoutStore, resolveForms, resolveRelationContent, resolveWorkspaceId, unreachableShowWhenTargets };
package/dist/internal.js CHANGED
@@ -152,7 +152,7 @@ function documentText(document2) {
152
152
  }
153
153
 
154
154
  // src/version.ts
155
- var CMSSY_CORE_VERSION = "19.31.1" ;
155
+ var CMSSY_CORE_VERSION = "19.33.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/data/http.ts
@@ -842,6 +842,15 @@ function walkBlockFields(values, schema, visit, options = {}, path = []) {
842
842
  });
843
843
  continue;
844
844
  }
845
+ if (field.type === "object") {
846
+ const itemSchema = field.itemSchema;
847
+ const stored = values[key];
848
+ if (!itemSchema || !isRecord(stored)) continue;
849
+ const group = options.copyRows ? { ...stored } : stored;
850
+ if (options.copyRows) values[key] = group;
851
+ walkBlockFields(group, itemSchema, visit, options, [...path, key]);
852
+ continue;
853
+ }
845
854
  visit(values, key, field, path);
846
855
  }
847
856
  }
@@ -1270,6 +1279,31 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
1270
1279
  };
1271
1280
  }
1272
1281
 
1282
+ // src/show-when-targets.ts
1283
+ function unreachableShowWhenTargets(blockType, schema, path = []) {
1284
+ return Object.entries(schema).flatMap(([key, field]) => {
1285
+ const at = [...path, key].join(".");
1286
+ const own = field.showWhen ? unreachable(schema, key, field, path.length === 0) : null;
1287
+ const problems = own ? [
1288
+ `cmssy: block "${blockType}" field "${at}" has showWhen on ${JSON.stringify(field.showWhen?.field)}, ${own}`
1289
+ ] : [];
1290
+ const nested = field.itemSchema ? unreachableShowWhenTargets(blockType, field.itemSchema, [...path, key]) : [];
1291
+ return [...problems, ...nested];
1292
+ });
1293
+ }
1294
+ function unreachable(schema, key, field, topLevel) {
1295
+ const target = field.showWhen?.field;
1296
+ if (typeof target !== "string" || target === key) {
1297
+ return "which is not a field next to it";
1298
+ }
1299
+ const sibling = Object.hasOwn(schema, target) ? schema[target] : void 0;
1300
+ if (!sibling) return "which is not a field next to it";
1301
+ if (topLevel && bucketOf(sibling) !== bucketOf(field)) {
1302
+ return `which is on the ${bucketOf(sibling)} tab, not the ${bucketOf(field)} tab`;
1303
+ }
1304
+ return null;
1305
+ }
1306
+
1273
1307
  // src/bridge/messages.ts
1274
1308
  function normalizeOrigin(origin) {
1275
1309
  const trimmed = origin.trim();
@@ -1478,4 +1512,4 @@ function layoutRegionIds(layout) {
1478
1512
  return (layout?.regions ?? DEFAULT_LAYOUT_REGIONS).map((region) => region.id);
1479
1513
  }
1480
1514
 
1481
- 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 };
1515
+ 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, unreachableShowWhenTargets };
@@ -152,7 +152,7 @@ function documentText(document) {
152
152
  }
153
153
 
154
154
  // src/version.ts
155
- var CMSSY_CORE_VERSION = "19.31.1" ;
155
+ var CMSSY_CORE_VERSION = "19.33.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/content/content-client.ts
package/dist/preflight.js CHANGED
@@ -150,7 +150,7 @@ function documentText(document) {
150
150
  }
151
151
 
152
152
  // src/version.ts
153
- var CMSSY_CORE_VERSION = "19.31.1" ;
153
+ var CMSSY_CORE_VERSION = "19.33.0" ;
154
154
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
155
155
 
156
156
  // src/content/content-client.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "19.31.1",
3
+ "version": "19.33.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -90,7 +90,7 @@
90
90
  "vitest": "^2.1.0"
91
91
  },
92
92
  "dependencies": {
93
- "@cmssy/types": "0.75.1",
93
+ "@cmssy/types": "0.76.0",
94
94
  "jose": "^6.2.3"
95
95
  },
96
96
  "scripts": {