@cmssy/core 19.32.0 → 19.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{csp-BERb4adx.d.cts → csp-BI4BNbR8.d.cts} +1 -0
- package/dist/{csp-EaQufK8P.d.ts → csp-DVzAKOYz.d.ts} +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +2 -1
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +39 -3
- package/dist/internal.d.cts +5 -3
- package/dist/internal.d.ts +5 -3
- package/dist/internal.js +39 -4
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +2 -2
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.
|
|
228
|
+
var CMSSY_CORE_VERSION = "19.34.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-
|
|
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-
|
|
1
|
+
import { C as CmssyRecordSort } from './csp-BI4BNbR8.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-BI4BNbR8.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-
|
|
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-
|
|
1
|
+
import { C as CmssyRecordSort } from './csp-DVzAKOYz.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-DVzAKOYz.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.
|
|
227
|
+
var CMSSY_CORE_VERSION = "19.34.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", {
|
package/dist/internal/locale.cjs
CHANGED
package/dist/internal/locale.js
CHANGED
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.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.34.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -652,13 +652,14 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
|
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
}`);
|
|
655
|
-
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
|
|
655
|
+
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $after: String, $populate: [String!], $previewSecret: String) {
|
|
656
656
|
public {
|
|
657
657
|
model {
|
|
658
|
-
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
|
|
658
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, after: $after, populate: $populate, previewSecret: $previewSecret) {
|
|
659
659
|
items { id modelId data status createdAt updatedAt }
|
|
660
660
|
total
|
|
661
661
|
hasMore
|
|
662
|
+
nextCursor
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
665
|
}
|
|
@@ -844,6 +845,15 @@ function walkBlockFields(values, schema, visit, options = {}, path = []) {
|
|
|
844
845
|
});
|
|
845
846
|
continue;
|
|
846
847
|
}
|
|
848
|
+
if (field.type === "object") {
|
|
849
|
+
const itemSchema = field.itemSchema;
|
|
850
|
+
const stored = values[key];
|
|
851
|
+
if (!itemSchema || !isRecord(stored)) continue;
|
|
852
|
+
const group = options.copyRows ? { ...stored } : stored;
|
|
853
|
+
if (options.copyRows) values[key] = group;
|
|
854
|
+
walkBlockFields(group, itemSchema, visit, options, [...path, key]);
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
847
857
|
visit(values, key, field, path);
|
|
848
858
|
}
|
|
849
859
|
}
|
|
@@ -1272,6 +1282,31 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
1272
1282
|
};
|
|
1273
1283
|
}
|
|
1274
1284
|
|
|
1285
|
+
// src/show-when-targets.ts
|
|
1286
|
+
function unreachableShowWhenTargets(blockType, schema, path = []) {
|
|
1287
|
+
return Object.entries(schema).flatMap(([key, field]) => {
|
|
1288
|
+
const at = [...path, key].join(".");
|
|
1289
|
+
const own = field.showWhen ? unreachable(schema, key, field, path.length === 0) : null;
|
|
1290
|
+
const problems = own ? [
|
|
1291
|
+
`cmssy: block "${blockType}" field "${at}" has showWhen on ${JSON.stringify(field.showWhen?.field)}, ${own}`
|
|
1292
|
+
] : [];
|
|
1293
|
+
const nested = field.itemSchema ? unreachableShowWhenTargets(blockType, field.itemSchema, [...path, key]) : [];
|
|
1294
|
+
return [...problems, ...nested];
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function unreachable(schema, key, field, topLevel) {
|
|
1298
|
+
const target = field.showWhen?.field;
|
|
1299
|
+
if (typeof target !== "string" || target === key) {
|
|
1300
|
+
return "which is not a field next to it";
|
|
1301
|
+
}
|
|
1302
|
+
const sibling = Object.hasOwn(schema, target) ? schema[target] : void 0;
|
|
1303
|
+
if (!sibling) return "which is not a field next to it";
|
|
1304
|
+
if (topLevel && bucketOf(sibling) !== bucketOf(field)) {
|
|
1305
|
+
return `which is on the ${bucketOf(sibling)} tab, not the ${bucketOf(field)} tab`;
|
|
1306
|
+
}
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1275
1310
|
// src/bridge/messages.ts
|
|
1276
1311
|
function normalizeOrigin(origin) {
|
|
1277
1312
|
const trimmed = origin.trim();
|
|
@@ -1519,3 +1554,4 @@ exports.resolveWorkspaceId = resolveWorkspaceId;
|
|
|
1519
1554
|
exports.splitCmssyLocale = splitCmssyLocale;
|
|
1520
1555
|
exports.splitLocaleFromPath = splitLocaleFromPath;
|
|
1521
1556
|
exports.toCspOrigin = toCspOrigin;
|
|
1557
|
+
exports.unreachableShowWhenTargets = unreachableShowWhenTargets;
|
package/dist/internal.d.cts
CHANGED
|
@@ -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-
|
|
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-
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-BI4BNbR8.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-BI4BNbR8.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 };
|
package/dist/internal.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-DVzAKOYz.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-DVzAKOYz.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.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.34.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -650,13 +650,14 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
}`);
|
|
653
|
-
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
|
|
653
|
+
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $after: String, $populate: [String!], $previewSecret: String) {
|
|
654
654
|
public {
|
|
655
655
|
model {
|
|
656
|
-
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
|
|
656
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, after: $after, populate: $populate, previewSecret: $previewSecret) {
|
|
657
657
|
items { id modelId data status createdAt updatedAt }
|
|
658
658
|
total
|
|
659
659
|
hasMore
|
|
660
|
+
nextCursor
|
|
660
661
|
}
|
|
661
662
|
}
|
|
662
663
|
}
|
|
@@ -842,6 +843,15 @@ function walkBlockFields(values, schema, visit, options = {}, path = []) {
|
|
|
842
843
|
});
|
|
843
844
|
continue;
|
|
844
845
|
}
|
|
846
|
+
if (field.type === "object") {
|
|
847
|
+
const itemSchema = field.itemSchema;
|
|
848
|
+
const stored = values[key];
|
|
849
|
+
if (!itemSchema || !isRecord(stored)) continue;
|
|
850
|
+
const group = options.copyRows ? { ...stored } : stored;
|
|
851
|
+
if (options.copyRows) values[key] = group;
|
|
852
|
+
walkBlockFields(group, itemSchema, visit, options, [...path, key]);
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
845
855
|
visit(values, key, field, path);
|
|
846
856
|
}
|
|
847
857
|
}
|
|
@@ -1270,6 +1280,31 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
1270
1280
|
};
|
|
1271
1281
|
}
|
|
1272
1282
|
|
|
1283
|
+
// src/show-when-targets.ts
|
|
1284
|
+
function unreachableShowWhenTargets(blockType, schema, path = []) {
|
|
1285
|
+
return Object.entries(schema).flatMap(([key, field]) => {
|
|
1286
|
+
const at = [...path, key].join(".");
|
|
1287
|
+
const own = field.showWhen ? unreachable(schema, key, field, path.length === 0) : null;
|
|
1288
|
+
const problems = own ? [
|
|
1289
|
+
`cmssy: block "${blockType}" field "${at}" has showWhen on ${JSON.stringify(field.showWhen?.field)}, ${own}`
|
|
1290
|
+
] : [];
|
|
1291
|
+
const nested = field.itemSchema ? unreachableShowWhenTargets(blockType, field.itemSchema, [...path, key]) : [];
|
|
1292
|
+
return [...problems, ...nested];
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
function unreachable(schema, key, field, topLevel) {
|
|
1296
|
+
const target = field.showWhen?.field;
|
|
1297
|
+
if (typeof target !== "string" || target === key) {
|
|
1298
|
+
return "which is not a field next to it";
|
|
1299
|
+
}
|
|
1300
|
+
const sibling = Object.hasOwn(schema, target) ? schema[target] : void 0;
|
|
1301
|
+
if (!sibling) return "which is not a field next to it";
|
|
1302
|
+
if (topLevel && bucketOf(sibling) !== bucketOf(field)) {
|
|
1303
|
+
return `which is on the ${bucketOf(sibling)} tab, not the ${bucketOf(field)} tab`;
|
|
1304
|
+
}
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1273
1308
|
// src/bridge/messages.ts
|
|
1274
1309
|
function normalizeOrigin(origin) {
|
|
1275
1310
|
const trimmed = origin.trim();
|
|
@@ -1478,4 +1513,4 @@ function layoutRegionIds(layout) {
|
|
|
1478
1513
|
return (layout?.regions ?? DEFAULT_LAYOUT_REGIONS).map((region) => region.id);
|
|
1479
1514
|
}
|
|
1480
1515
|
|
|
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 };
|
|
1516
|
+
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 };
|
package/dist/preflight.cjs
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.34.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.
|
|
153
|
+
var CMSSY_CORE_VERSION = "19.34.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.
|
|
3
|
+
"version": "19.34.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.
|
|
93
|
+
"@cmssy/types": "0.77.0",
|
|
94
94
|
"jose": "^6.2.3"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|