@cmssy/core 19.3.1 → 19.4.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-BdigosQo.d.ts → csp-AofUvsVZ.d.ts} +1 -1
- package/dist/{csp-GwcubV3k.d.cts → csp-eQsMxVsg.d.cts} +1 -1
- package/dist/index.cjs +15 -1
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +14 -3
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.d.cts +1 -1
- package/dist/internal/locale.d.ts +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +1 -1
- package/dist/{locale-BGUsgy8p.d.ts → locale-BHRDFyNF.d.ts} +1 -1
- package/dist/{locale-DLGQgiu5.d.cts → locale-DmMO2Cwk.d.cts} +1 -1
- package/dist/preflight.cjs +30 -12
- package/dist/preflight.js +30 -12
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import {
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-BHRDFyNF.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import {
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-DmMO2Cwk.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
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.4.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -701,6 +701,17 @@ function buildBlockManifest(blocks, options = {}) {
|
|
|
701
701
|
regions: options.regions ? layoutRegionsToBridge(options.regions) : null
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
+
function isFormFieldVisible(field, values) {
|
|
705
|
+
return types.evaluateFieldConditionGroup(field.showWhen, values);
|
|
706
|
+
}
|
|
707
|
+
function visibleFormFields(fields2, values) {
|
|
708
|
+
return fields2.filter((field) => isFormFieldVisible(field, values));
|
|
709
|
+
}
|
|
710
|
+
function isFormFieldRequired(field, values) {
|
|
711
|
+
if (!isFormFieldVisible(field, values)) return false;
|
|
712
|
+
if (field.validation?.required === true) return true;
|
|
713
|
+
return field.requiredWhen != null && types.evaluateFieldConditionGroup(field.requiredWhen, values);
|
|
714
|
+
}
|
|
704
715
|
|
|
705
716
|
// src/data/localize-href.ts
|
|
706
717
|
var PROTOCOL_OR_RELATIVE = /^([a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
@@ -1149,6 +1160,8 @@ exports.defineCmssyConfig = defineCmssyConfig;
|
|
|
1149
1160
|
exports.defineCmssyLayout = defineCmssyLayout;
|
|
1150
1161
|
exports.fields = fields;
|
|
1151
1162
|
exports.graphqlRequest = graphqlRequest;
|
|
1163
|
+
exports.isFormFieldRequired = isFormFieldRequired;
|
|
1164
|
+
exports.isFormFieldVisible = isFormFieldVisible;
|
|
1152
1165
|
exports.isProtocolCompatible = isProtocolCompatible;
|
|
1153
1166
|
exports.isTransientRequestError = isTransientRequestError;
|
|
1154
1167
|
exports.isVerifiedEditUrl = isVerifiedEditUrl;
|
|
@@ -1170,3 +1183,4 @@ exports.resolveEditorOrigin = resolveEditorOrigin;
|
|
|
1170
1183
|
exports.typedOperation = typedOperation;
|
|
1171
1184
|
exports.verifyCmssyEditToken = verifyCmssyEditToken;
|
|
1172
1185
|
exports.verifyCmssyWebhook = verifyCmssyWebhook;
|
|
1186
|
+
exports.visibleFormFields = visibleFormFields;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-
|
|
2
|
-
export {
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-eQsMxVsg.cjs';
|
|
2
|
+
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-DmMO2Cwk.cjs';
|
|
3
3
|
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy, i as isTransientRequestError } from './content-client-DhcHP8ln.cjs';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
|
-
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
5
|
+
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, 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, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -124,6 +124,11 @@ declare function buildBlockManifest(blocks: readonly BlockManifestSource[], opti
|
|
|
124
124
|
regions?: readonly LayoutRegion[] | null;
|
|
125
125
|
}): BlockManifest;
|
|
126
126
|
|
|
127
|
+
type ConditionalFormField = Pick<CmssyFormField, "showWhen" | "requiredWhen" | "validation">;
|
|
128
|
+
declare function isFormFieldVisible(field: Pick<ConditionalFormField, "showWhen">, values: Record<string, unknown>): boolean;
|
|
129
|
+
declare function visibleFormFields<F extends Pick<ConditionalFormField, "showWhen">>(fields: readonly F[], values: Record<string, unknown>): F[];
|
|
130
|
+
declare function isFormFieldRequired(field: ConditionalFormField, values: Record<string, unknown>): boolean;
|
|
131
|
+
|
|
127
132
|
declare const CMSSY_EDIT_HEADER = "x-cmssy-edit";
|
|
128
133
|
declare const CMSSY_EDIT_QUERY_PARAM = "cmssyEdit";
|
|
129
134
|
declare const CMSSY_SECRET_QUERY_PARAM = "cmssySecret";
|
|
@@ -155,4 +160,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
155
160
|
}
|
|
156
161
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
157
162
|
|
|
158
|
-
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
|
|
163
|
+
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-
|
|
2
|
-
export {
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-AofUvsVZ.js';
|
|
2
|
+
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-BHRDFyNF.js';
|
|
3
3
|
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyRequestError, c as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, d as FetchLikeResponse, e as FetchPageOptions, R as RetryOption, f as RetryPolicy, i as isTransientRequestError } from './content-client-DhcHP8ln.js';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
|
-
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
5
|
+
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, 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, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -124,6 +124,11 @@ declare function buildBlockManifest(blocks: readonly BlockManifestSource[], opti
|
|
|
124
124
|
regions?: readonly LayoutRegion[] | null;
|
|
125
125
|
}): BlockManifest;
|
|
126
126
|
|
|
127
|
+
type ConditionalFormField = Pick<CmssyFormField, "showWhen" | "requiredWhen" | "validation">;
|
|
128
|
+
declare function isFormFieldVisible(field: Pick<ConditionalFormField, "showWhen">, values: Record<string, unknown>): boolean;
|
|
129
|
+
declare function visibleFormFields<F extends Pick<ConditionalFormField, "showWhen">>(fields: readonly F[], values: Record<string, unknown>): F[];
|
|
130
|
+
declare function isFormFieldRequired(field: ConditionalFormField, values: Record<string, unknown>): boolean;
|
|
131
|
+
|
|
127
132
|
declare const CMSSY_EDIT_HEADER = "x-cmssy-edit";
|
|
128
133
|
declare const CMSSY_EDIT_QUERY_PARAM = "cmssyEdit";
|
|
129
134
|
declare const CMSSY_SECRET_QUERY_PARAM = "cmssySecret";
|
|
@@ -155,4 +160,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
155
160
|
}
|
|
156
161
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
157
162
|
|
|
158
|
-
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook };
|
|
163
|
+
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { brandingFieldNames, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX } from '@cmssy/types';
|
|
1
|
+
import { brandingFieldNames, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
2
2
|
export { MediaType, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
@@ -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.4.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -700,6 +700,17 @@ function buildBlockManifest(blocks, options = {}) {
|
|
|
700
700
|
regions: options.regions ? layoutRegionsToBridge(options.regions) : null
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
+
function isFormFieldVisible(field, values) {
|
|
704
|
+
return evaluateFieldConditionGroup(field.showWhen, values);
|
|
705
|
+
}
|
|
706
|
+
function visibleFormFields(fields2, values) {
|
|
707
|
+
return fields2.filter((field) => isFormFieldVisible(field, values));
|
|
708
|
+
}
|
|
709
|
+
function isFormFieldRequired(field, values) {
|
|
710
|
+
if (!isFormFieldVisible(field, values)) return false;
|
|
711
|
+
if (field.validation?.required === true) return true;
|
|
712
|
+
return field.requiredWhen != null && evaluateFieldConditionGroup(field.requiredWhen, values);
|
|
713
|
+
}
|
|
703
714
|
|
|
704
715
|
// src/data/localize-href.ts
|
|
705
716
|
var PROTOCOL_OR_RELATIVE = /^([a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
@@ -1114,4 +1125,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1114
1125
|
return parsed;
|
|
1115
1126
|
}
|
|
1116
1127
|
|
|
1117
|
-
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook };
|
|
1128
|
+
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/internal/locale.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-DmMO2Cwk.cjs';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
3
|
import '../content-client-DhcHP8ln.cjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-BHRDFyNF.js';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
3
|
import '../content-client-DhcHP8ln.js';
|
|
4
4
|
|
package/dist/internal/locale.js
CHANGED
package/dist/internal.cjs
CHANGED
package/dist/internal.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { g as fetchLayouts, h as fetchPage, j as fetchPageById, k as fetchPageMeta, l as fetchPages, r as resolveApiUrl } from './content-client-DhcHP8ln.cjs';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-
|
|
4
|
+
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-DmMO2Cwk.cjs';
|
|
5
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-DmMO2Cwk.cjs';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-eQsMxVsg.cjs';
|
|
7
|
+
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-eQsMxVsg.cjs';
|
|
8
8
|
export { localizedPath } from './internal/locale.cjs';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { g as fetchLayouts, h as fetchPage, j as fetchPageById, k as fetchPageMeta, l as fetchPages, r as resolveApiUrl } from './content-client-DhcHP8ln.js';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-
|
|
4
|
+
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-BHRDFyNF.js';
|
|
5
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-BHRDFyNF.js';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-AofUvsVZ.js';
|
|
7
|
+
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-AofUvsVZ.js';
|
|
8
8
|
export { localizedPath } from './internal/locale.js';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.js
CHANGED
|
@@ -36,4 +36,4 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
|
|
|
36
36
|
}>;
|
|
37
37
|
declare function localeForPath(config: CmssyClientConfig, path: string | string[]): Promise<string>;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G, CMSSY_LOCALE_HEADER as a, type CmssyOperation as b, type CmssyTypedDocument as c, localeForPath as d, localeForPathname as e, resolveSiteLocales as f, graphqlRequest as g, splitLocaleFromPath as h, localizeHref as l, resolveCmssyLocale as r, splitCmssyLocale as s, typedOperation as t };
|
|
@@ -36,4 +36,4 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
|
|
|
36
36
|
}>;
|
|
37
37
|
declare function localeForPath(config: CmssyClientConfig, path: string | string[]): Promise<string>;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G, CMSSY_LOCALE_HEADER as a, type CmssyOperation as b, type CmssyTypedDocument as c, localeForPath as d, localeForPathname as e, resolveSiteLocales as f, graphqlRequest as g, splitLocaleFromPath as h, localizeHref as l, resolveCmssyLocale as r, splitCmssyLocale as s, typedOperation as t };
|
package/dist/preflight.cjs
CHANGED
|
@@ -151,6 +151,10 @@ function documentText(document) {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
// src/version.ts
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.4.0" ;
|
|
156
|
+
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
|
+
|
|
154
158
|
// src/content/content-client.ts
|
|
155
159
|
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
156
160
|
function resolveApiUrl(apiUrl) {
|
|
@@ -348,7 +352,10 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
348
352
|
try {
|
|
349
353
|
response = await doFetch(url, {
|
|
350
354
|
method: "POST",
|
|
351
|
-
headers: {
|
|
355
|
+
headers: {
|
|
356
|
+
"content-type": "application/json",
|
|
357
|
+
"user-agent": CMSSY_USER_AGENT
|
|
358
|
+
},
|
|
352
359
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
353
360
|
});
|
|
354
361
|
} catch (error) {
|
|
@@ -454,11 +461,10 @@ async function checkDraftSecret(config) {
|
|
|
454
461
|
fix: `copy the draft secret from ${SETTINGS_PATH}`
|
|
455
462
|
};
|
|
456
463
|
}
|
|
457
|
-
const outcome = await postPreflightQuery(
|
|
458
|
-
config,
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
);
|
|
464
|
+
const outcome = await postPreflightQuery(config, DRAFT_SECRET_VALID_QUERY, {
|
|
465
|
+
workspaceSlug: config.workspaceSlug,
|
|
466
|
+
secret
|
|
467
|
+
});
|
|
462
468
|
if (outcome.kind === "network") {
|
|
463
469
|
return {
|
|
464
470
|
status: "unknown",
|
|
@@ -500,15 +506,20 @@ function parseOrigin(value) {
|
|
|
500
506
|
return null;
|
|
501
507
|
}
|
|
502
508
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
function isLocalHostname(hostname) {
|
|
510
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
511
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "::1";
|
|
512
|
+
}
|
|
513
|
+
function isLocalOrigin(origin) {
|
|
514
|
+
if (!origin) return false;
|
|
506
515
|
try {
|
|
507
|
-
|
|
516
|
+
return isLocalHostname(new URL(origin).hostname);
|
|
508
517
|
} catch {
|
|
509
|
-
|
|
518
|
+
return false;
|
|
510
519
|
}
|
|
511
|
-
|
|
520
|
+
}
|
|
521
|
+
function previewUrlFix(devOrigin) {
|
|
522
|
+
if (isLocalOrigin(parseOrigin(devOrigin))) {
|
|
512
523
|
return `toggle dev mode in the editor and enter ${devOrigin} there - ${SETTINGS_PATH} holds the shared preview URL of the DEPLOYED site, not your machine`;
|
|
513
524
|
}
|
|
514
525
|
return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
|
|
@@ -537,6 +548,13 @@ function checkPreviewUrl(previewUrl, devOrigin) {
|
|
|
537
548
|
message: `the workspace preview URL matches ${devOrigin}`
|
|
538
549
|
};
|
|
539
550
|
}
|
|
551
|
+
if (isLocalOrigin(localOrigin)) {
|
|
552
|
+
return {
|
|
553
|
+
status: "unknown",
|
|
554
|
+
message: `the workspace preview URL is ${previewOrigin}; whether the editor reaches ${devOrigin} depends on the dev-mode switch, which overrides the shared preview URL and cannot be read from here`,
|
|
555
|
+
fix: previewUrlFix(devOrigin)
|
|
556
|
+
};
|
|
557
|
+
}
|
|
540
558
|
return {
|
|
541
559
|
status: "fail",
|
|
542
560
|
message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
|
package/dist/preflight.js
CHANGED
|
@@ -149,6 +149,10 @@ function documentText(document) {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// src/version.ts
|
|
153
|
+
var CMSSY_CORE_VERSION = "19.4.0" ;
|
|
154
|
+
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
155
|
+
|
|
152
156
|
// src/content/content-client.ts
|
|
153
157
|
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
154
158
|
function resolveApiUrl(apiUrl) {
|
|
@@ -346,7 +350,10 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
346
350
|
try {
|
|
347
351
|
response = await doFetch(url, {
|
|
348
352
|
method: "POST",
|
|
349
|
-
headers: {
|
|
353
|
+
headers: {
|
|
354
|
+
"content-type": "application/json",
|
|
355
|
+
"user-agent": CMSSY_USER_AGENT
|
|
356
|
+
},
|
|
350
357
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
351
358
|
});
|
|
352
359
|
} catch (error) {
|
|
@@ -452,11 +459,10 @@ async function checkDraftSecret(config) {
|
|
|
452
459
|
fix: `copy the draft secret from ${SETTINGS_PATH}`
|
|
453
460
|
};
|
|
454
461
|
}
|
|
455
|
-
const outcome = await postPreflightQuery(
|
|
456
|
-
config,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
);
|
|
462
|
+
const outcome = await postPreflightQuery(config, DRAFT_SECRET_VALID_QUERY, {
|
|
463
|
+
workspaceSlug: config.workspaceSlug,
|
|
464
|
+
secret
|
|
465
|
+
});
|
|
460
466
|
if (outcome.kind === "network") {
|
|
461
467
|
return {
|
|
462
468
|
status: "unknown",
|
|
@@ -498,15 +504,20 @@ function parseOrigin(value) {
|
|
|
498
504
|
return null;
|
|
499
505
|
}
|
|
500
506
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
507
|
+
function isLocalHostname(hostname) {
|
|
508
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
509
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "::1";
|
|
510
|
+
}
|
|
511
|
+
function isLocalOrigin(origin) {
|
|
512
|
+
if (!origin) return false;
|
|
504
513
|
try {
|
|
505
|
-
|
|
514
|
+
return isLocalHostname(new URL(origin).hostname);
|
|
506
515
|
} catch {
|
|
507
|
-
|
|
516
|
+
return false;
|
|
508
517
|
}
|
|
509
|
-
|
|
518
|
+
}
|
|
519
|
+
function previewUrlFix(devOrigin) {
|
|
520
|
+
if (isLocalOrigin(parseOrigin(devOrigin))) {
|
|
510
521
|
return `toggle dev mode in the editor and enter ${devOrigin} there - ${SETTINGS_PATH} holds the shared preview URL of the DEPLOYED site, not your machine`;
|
|
511
522
|
}
|
|
512
523
|
return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
|
|
@@ -535,6 +546,13 @@ function checkPreviewUrl(previewUrl, devOrigin) {
|
|
|
535
546
|
message: `the workspace preview URL matches ${devOrigin}`
|
|
536
547
|
};
|
|
537
548
|
}
|
|
549
|
+
if (isLocalOrigin(localOrigin)) {
|
|
550
|
+
return {
|
|
551
|
+
status: "unknown",
|
|
552
|
+
message: `the workspace preview URL is ${previewOrigin}; whether the editor reaches ${devOrigin} depends on the dev-mode switch, which overrides the shared preview URL and cannot be read from here`,
|
|
553
|
+
fix: previewUrlFix(devOrigin)
|
|
554
|
+
};
|
|
555
|
+
}
|
|
538
556
|
return {
|
|
539
557
|
status: "fail",
|
|
540
558
|
message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
|