@cmssy/core 11.4.0 → 11.4.2
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-Bzrk_BeO.d.cts → csp-CRixC_wl.d.cts} +3 -1
- package/dist/{csp-B7ElkvAp.d.ts → csp-DpG1NcSd.d.ts} +3 -1
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -11
- package/dist/internal.cjs +14 -11
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +14 -11
- package/package.json +1 -1
|
@@ -25,7 +25,9 @@ interface CmssyConfig {
|
|
|
25
25
|
*/
|
|
26
26
|
devToken?: string;
|
|
27
27
|
/**
|
|
28
|
-
* Origin allowed to frame your app in the editor
|
|
28
|
+
* Origin(s) allowed to frame your app in the editor: one origin, a list, or
|
|
29
|
+
* the comma-separated string an env var carries - all three are accepted, so
|
|
30
|
+
* `process.env.CMSSY_EDITOR_ORIGIN` can be passed through as-is. Defaults to
|
|
29
31
|
* {@link DEFAULT_CMSSY_EDITOR_ORIGINS}; set it only for self-hosted admins.
|
|
30
32
|
*/
|
|
31
33
|
editorOrigin?: string | string[];
|
|
@@ -25,7 +25,9 @@ interface CmssyConfig {
|
|
|
25
25
|
*/
|
|
26
26
|
devToken?: string;
|
|
27
27
|
/**
|
|
28
|
-
* Origin allowed to frame your app in the editor
|
|
28
|
+
* Origin(s) allowed to frame your app in the editor: one origin, a list, or
|
|
29
|
+
* the comma-separated string an env var carries - all three are accepted, so
|
|
30
|
+
* `process.env.CMSSY_EDITOR_ORIGIN` can be passed through as-is. Defaults to
|
|
29
31
|
* {@link DEFAULT_CMSSY_EDITOR_ORIGINS}; set it only for self-hosted admins.
|
|
30
32
|
*/
|
|
31
33
|
editorOrigin?: string | string[];
|
package/dist/index.cjs
CHANGED
|
@@ -7,10 +7,11 @@ var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
|
7
7
|
"https://cmssy.io",
|
|
8
8
|
"https://www.cmssy.io"
|
|
9
9
|
];
|
|
10
|
-
function
|
|
11
|
-
if (
|
|
12
|
-
const parts = raw.split(",").map((
|
|
10
|
+
function parseEditorOrigin(raw) {
|
|
11
|
+
if (raw === void 0) return void 0;
|
|
12
|
+
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((origin) => origin.trim()).filter((origin) => origin.length > 0);
|
|
13
13
|
if (parts.length === 0) return void 0;
|
|
14
|
+
if (Array.isArray(raw)) return parts;
|
|
14
15
|
return parts.length === 1 ? parts[0] : parts;
|
|
15
16
|
}
|
|
16
17
|
function isDevelopment() {
|
|
@@ -25,16 +26,18 @@ function rejectWildcardOutsideDevelopment(value) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
function resolveEditorOrigin(editorOrigin) {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if (editorOrigin !== void 0) {
|
|
30
|
+
const explicit = parseEditorOrigin(editorOrigin);
|
|
31
|
+
if (explicit === void 0) return DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
32
|
+
rejectWildcardOutsideDevelopment(explicit);
|
|
33
|
+
return explicit;
|
|
34
|
+
}
|
|
35
|
+
const fromEnv = typeof process !== "undefined" ? parseEditorOrigin(process.env.CMSSY_EDITOR_ORIGIN) : void 0;
|
|
36
|
+
if (fromEnv === void 0) {
|
|
30
37
|
return isDevelopment() ? "*" : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
31
38
|
}
|
|
32
|
-
rejectWildcardOutsideDevelopment(
|
|
33
|
-
|
|
34
|
-
const cleaned = value.filter((o) => o && o.trim().length > 0);
|
|
35
|
-
return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
36
|
-
}
|
|
37
|
-
return value.trim().length > 0 ? value : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
39
|
+
rejectWildcardOutsideDevelopment(fromEnv);
|
|
40
|
+
return fromEnv;
|
|
38
41
|
}
|
|
39
42
|
var REQUIRED_CONFIG_ENV = [
|
|
40
43
|
["org", "CMSSY_ORG_SLUG"],
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, P as PROTOCOL_VERSION, f as ParentReadyMessage, g as PatchMessage, h as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SelectMessage, i as applyCmssyCsp, j as createCmssyClient, k as defineCmssyConfig, l as isProtocolCompatible, n as normalizeOrigin, p as parseEditorMessage, m as postToEditor, r as resolveEditorOrigin } from './csp-
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, P as PROTOCOL_VERSION, f as ParentReadyMessage, g as PatchMessage, h as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SelectMessage, i as applyCmssyCsp, j as createCmssyClient, k as defineCmssyConfig, l as isProtocolCompatible, n as normalizeOrigin, p as parseEditorMessage, m as postToEditor, r as resolveEditorOrigin } from './csp-CRixC_wl.cjs';
|
|
2
2
|
export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref } from './locale-C7sA46qu.cjs';
|
|
3
3
|
export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-CJQ-nafm.cjs';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, P as PROTOCOL_VERSION, f as ParentReadyMessage, g as PatchMessage, h as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SelectMessage, i as applyCmssyCsp, j as createCmssyClient, k as defineCmssyConfig, l as isProtocolCompatible, n as normalizeOrigin, p as parseEditorMessage, m as postToEditor, r as resolveEditorOrigin } from './csp-
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, P as PROTOCOL_VERSION, f as ParentReadyMessage, g as PatchMessage, h as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SelectMessage, i as applyCmssyCsp, j as createCmssyClient, k as defineCmssyConfig, l as isProtocolCompatible, n as normalizeOrigin, p as parseEditorMessage, m as postToEditor, r as resolveEditorOrigin } from './csp-DpG1NcSd.js';
|
|
2
2
|
export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref } from './locale-Ox_qVlNy.js';
|
|
3
3
|
export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-CJQ-nafm.js';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,11 @@ var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
|
5
5
|
"https://cmssy.io",
|
|
6
6
|
"https://www.cmssy.io"
|
|
7
7
|
];
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
const parts = raw.split(",").map((
|
|
8
|
+
function parseEditorOrigin(raw) {
|
|
9
|
+
if (raw === void 0) return void 0;
|
|
10
|
+
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((origin) => origin.trim()).filter((origin) => origin.length > 0);
|
|
11
11
|
if (parts.length === 0) return void 0;
|
|
12
|
+
if (Array.isArray(raw)) return parts;
|
|
12
13
|
return parts.length === 1 ? parts[0] : parts;
|
|
13
14
|
}
|
|
14
15
|
function isDevelopment() {
|
|
@@ -23,16 +24,18 @@ function rejectWildcardOutsideDevelopment(value) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
function resolveEditorOrigin(editorOrigin) {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (editorOrigin !== void 0) {
|
|
28
|
+
const explicit = parseEditorOrigin(editorOrigin);
|
|
29
|
+
if (explicit === void 0) return DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
30
|
+
rejectWildcardOutsideDevelopment(explicit);
|
|
31
|
+
return explicit;
|
|
32
|
+
}
|
|
33
|
+
const fromEnv = typeof process !== "undefined" ? parseEditorOrigin(process.env.CMSSY_EDITOR_ORIGIN) : void 0;
|
|
34
|
+
if (fromEnv === void 0) {
|
|
28
35
|
return isDevelopment() ? "*" : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
29
36
|
}
|
|
30
|
-
rejectWildcardOutsideDevelopment(
|
|
31
|
-
|
|
32
|
-
const cleaned = value.filter((o) => o && o.trim().length > 0);
|
|
33
|
-
return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
34
|
-
}
|
|
35
|
-
return value.trim().length > 0 ? value : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
37
|
+
rejectWildcardOutsideDevelopment(fromEnv);
|
|
38
|
+
return fromEnv;
|
|
36
39
|
}
|
|
37
40
|
var REQUIRED_CONFIG_ENV = [
|
|
38
41
|
["org", "CMSSY_ORG_SLUG"],
|
package/dist/internal.cjs
CHANGED
|
@@ -1059,10 +1059,11 @@ var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
|
1059
1059
|
"https://cmssy.io",
|
|
1060
1060
|
"https://www.cmssy.io"
|
|
1061
1061
|
];
|
|
1062
|
-
function
|
|
1063
|
-
if (
|
|
1064
|
-
const parts = raw.split(",").map((
|
|
1062
|
+
function parseEditorOrigin(raw) {
|
|
1063
|
+
if (raw === void 0) return void 0;
|
|
1064
|
+
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((origin) => origin.trim()).filter((origin) => origin.length > 0);
|
|
1065
1065
|
if (parts.length === 0) return void 0;
|
|
1066
|
+
if (Array.isArray(raw)) return parts;
|
|
1066
1067
|
return parts.length === 1 ? parts[0] : parts;
|
|
1067
1068
|
}
|
|
1068
1069
|
function isDevelopment() {
|
|
@@ -1077,16 +1078,18 @@ function rejectWildcardOutsideDevelopment(value) {
|
|
|
1077
1078
|
}
|
|
1078
1079
|
}
|
|
1079
1080
|
function resolveEditorOrigin(editorOrigin) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1081
|
+
if (editorOrigin !== void 0) {
|
|
1082
|
+
const explicit = parseEditorOrigin(editorOrigin);
|
|
1083
|
+
if (explicit === void 0) return DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1084
|
+
rejectWildcardOutsideDevelopment(explicit);
|
|
1085
|
+
return explicit;
|
|
1083
1086
|
}
|
|
1084
|
-
|
|
1085
|
-
if (
|
|
1086
|
-
|
|
1087
|
-
return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1087
|
+
const fromEnv = typeof process !== "undefined" ? parseEditorOrigin(process.env.CMSSY_EDITOR_ORIGIN) : void 0;
|
|
1088
|
+
if (fromEnv === void 0) {
|
|
1089
|
+
return isDevelopment() ? "*" : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1088
1090
|
}
|
|
1089
|
-
|
|
1091
|
+
rejectWildcardOutsideDevelopment(fromEnv);
|
|
1092
|
+
return fromEnv;
|
|
1090
1093
|
}
|
|
1091
1094
|
|
|
1092
1095
|
// src/csp.ts
|
package/dist/internal.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyCl
|
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
4
|
import { G as GraphqlRequestOptions } from './locale-C7sA46qu.cjs';
|
|
5
5
|
export { C as CMSSY_LOCALE_HEADER, b as buildLocaleSwitchHref, a as localeForPath, c as localeForPathname, l as localizeHref, d as localizeHtmlLinks, s as splitCmssyLocale } from './locale-C7sA46qu.cjs';
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { o as cmssyCspHeaders, q as isDevelopment, s as resolveInitialTarget, t as toCspOrigin } from './csp-
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-CRixC_wl.cjs';
|
|
7
|
+
export { o as cmssyCspHeaders, q as isDevelopment, s as resolveInitialTarget, t as toCspOrigin } from './csp-CRixC_wl.cjs';
|
|
8
8
|
export { localesFromSiteConfig, localizedPath, resolveSiteLocales, splitLocaleFromPath } from './internal/locale.cjs';
|
|
9
9
|
|
|
10
10
|
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
package/dist/internal.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyCl
|
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
4
|
import { G as GraphqlRequestOptions } from './locale-Ox_qVlNy.js';
|
|
5
5
|
export { C as CMSSY_LOCALE_HEADER, b as buildLocaleSwitchHref, a as localeForPath, c as localeForPathname, l as localizeHref, d as localizeHtmlLinks, s as splitCmssyLocale } from './locale-Ox_qVlNy.js';
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { o as cmssyCspHeaders, q as isDevelopment, s as resolveInitialTarget, t as toCspOrigin } from './csp-
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-DpG1NcSd.js';
|
|
7
|
+
export { o as cmssyCspHeaders, q as isDevelopment, s as resolveInitialTarget, t as toCspOrigin } from './csp-DpG1NcSd.js';
|
|
8
8
|
export { localesFromSiteConfig, localizedPath, resolveSiteLocales, splitLocaleFromPath } from './internal/locale.js';
|
|
9
9
|
|
|
10
10
|
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
package/dist/internal.js
CHANGED
|
@@ -1057,10 +1057,11 @@ var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
|
1057
1057
|
"https://cmssy.io",
|
|
1058
1058
|
"https://www.cmssy.io"
|
|
1059
1059
|
];
|
|
1060
|
-
function
|
|
1061
|
-
if (
|
|
1062
|
-
const parts = raw.split(",").map((
|
|
1060
|
+
function parseEditorOrigin(raw) {
|
|
1061
|
+
if (raw === void 0) return void 0;
|
|
1062
|
+
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((origin) => origin.trim()).filter((origin) => origin.length > 0);
|
|
1063
1063
|
if (parts.length === 0) return void 0;
|
|
1064
|
+
if (Array.isArray(raw)) return parts;
|
|
1064
1065
|
return parts.length === 1 ? parts[0] : parts;
|
|
1065
1066
|
}
|
|
1066
1067
|
function isDevelopment() {
|
|
@@ -1075,16 +1076,18 @@ function rejectWildcardOutsideDevelopment(value) {
|
|
|
1075
1076
|
}
|
|
1076
1077
|
}
|
|
1077
1078
|
function resolveEditorOrigin(editorOrigin) {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1079
|
+
if (editorOrigin !== void 0) {
|
|
1080
|
+
const explicit = parseEditorOrigin(editorOrigin);
|
|
1081
|
+
if (explicit === void 0) return DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1082
|
+
rejectWildcardOutsideDevelopment(explicit);
|
|
1083
|
+
return explicit;
|
|
1081
1084
|
}
|
|
1082
|
-
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1085
|
-
return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1085
|
+
const fromEnv = typeof process !== "undefined" ? parseEditorOrigin(process.env.CMSSY_EDITOR_ORIGIN) : void 0;
|
|
1086
|
+
if (fromEnv === void 0) {
|
|
1087
|
+
return isDevelopment() ? "*" : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
1086
1088
|
}
|
|
1087
|
-
|
|
1089
|
+
rejectWildcardOutsideDevelopment(fromEnv);
|
|
1090
|
+
return fromEnv;
|
|
1088
1091
|
}
|
|
1089
1092
|
|
|
1090
1093
|
// src/csp.ts
|