@cmssy/core 11.5.0 → 11.5.1

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/testing.cjs CHANGED
@@ -141,39 +141,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
141
141
  });
142
142
  }
143
143
 
144
- // src/data/queries.ts
145
- var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
146
- public {
147
- siteConfig(workspaceSlug: $workspaceSlug) {
148
- id
149
- workspaceId
150
- siteName
151
- defaultLanguage
152
- enabledLanguages
153
- enabledFeatures
154
- notFoundPageId
155
- previewUrl
156
- branding {
157
- brandName
158
- logoUrl
159
- logoDarkUrl
160
- faviconUrl
161
- ogImageUrl
162
- }
163
- }
164
- }
165
- }`;
166
-
167
- // src/data/site-locales.ts
168
- function localesFromSiteConfig(siteConfig) {
169
- const defaultLocale = siteConfig?.defaultLanguage || "en";
170
- const enabled = siteConfig?.enabledLanguages ?? [];
171
- return {
172
- defaultLocale,
173
- locales: enabled.length > 0 ? enabled : [defaultLocale]
174
- };
175
- }
176
-
177
144
  // src/preflight.ts
178
145
  var ALLOWED_FRAME_HOSTS = ["cmssy.io", "www.cmssy.io"];
179
146
  function frameAncestorSources(cspHeaderValue) {
@@ -269,29 +236,6 @@ async function workspaceHasLayoutBlocks(workspace, pageSlug) {
269
236
  return null;
270
237
  }
271
238
  }
272
- async function derivedLocalizedPath(workspace, path) {
273
- try {
274
- const data = await graphqlRequest(
275
- workspace,
276
- SITE_CONFIG_QUERY,
277
- { workspaceSlug: workspace.workspaceSlug },
278
- { public: true, retry: {} },
279
- "edit smoke: site locales"
280
- );
281
- const { defaultLocale, locales } = localesFromSiteConfig(
282
- data.public?.siteConfig ?? null
283
- );
284
- const locale = locales.find((candidate) => candidate !== defaultLocale);
285
- if (!locale) return { kind: "none" };
286
- const routed = withoutEditPrefix(path);
287
- const [first] = routed.split("/").filter(Boolean);
288
- if (first && locales.includes(first)) return { kind: "none" };
289
- const suffix = routed === "/" || routed === "" ? "" : routed.replace(/\/+$/, "");
290
- return { kind: "derived", locale, localizedPath: `/${locale}${suffix}` };
291
- } catch {
292
- return { kind: "unavailable" };
293
- }
294
- }
295
239
  async function checkCmssyEditMode(options) {
296
240
  const { baseUrl, secret, path = "/" } = options;
297
241
  const failures = [];
@@ -345,20 +289,13 @@ async function checkCmssyEditMode(options) {
345
289
  }
346
290
  }
347
291
  const query = `cmssyEdit=1&cmssySecret=${encodeURIComponent(secret)}`;
348
- const asked = options.localizedPath;
349
- const derived = !asked && options.workspace ? await derivedLocalizedPath(options.workspace, path) : { kind: "none" };
350
- if (derived.kind === "unavailable") {
351
- failures.push(
352
- `the delivery API would not say which languages ${options.workspace?.workspaceSlug} enables, so the preview's language went unchecked. That is the check three releases shipped a wrong-language preview past - a green run here does not mean it works.`
353
- );
354
- }
355
- const localizedPath = asked ?? (derived.kind === "derived" ? derived.localizedPath : void 0);
292
+ const { localizedPath } = options;
356
293
  if (localizedPath) {
357
- const locale = options.localizedLocale ?? (derived.kind === "derived" ? derived.locale : localeOf(localizedPath));
294
+ const locale = options.localizedLocale ?? localeOf(localizedPath);
358
295
  const localized = await html(url(`${localizedPath}?${query}`));
359
296
  if (localized.status !== 200) {
360
297
  failures.push(
361
- derived.kind === "derived" ? `edit ${localizedPath}: expected 200, got ${localized.status}. The workspace enables "${locale}", so the language went unchecked - pass localizedPath if this site spells the language some other way.` : `edit ${localizedPath}: expected 200, got ${localized.status}`
298
+ `edit ${localizedPath}: expected 200, got ${localized.status}`
362
299
  );
363
300
  } else {
364
301
  if (!EDITOR_MARKER.test(localized.body)) {
@@ -6,11 +6,13 @@ interface EditSmokeOptions {
6
6
  /** A published page to exercise. Defaults to "/". */
7
7
  path?: string;
8
8
  /**
9
- * The same page under a language prefix, e.g. "/no". Pass it on a site whose
10
- * URLs carry the language, and the check also proves the preview renders in
11
- * THAT language rather than the default one - by reading `<html lang>`, which
12
- * is a contract, unlike a word from the page's copy that an editor can change
13
- * at any time.
9
+ * The same page under a language prefix, e.g. "/no". The caller states it
10
+ * because only the caller knows how its site spells a language; asking a
11
+ * workspace would tie this check to content that can change or be deleted.
12
+ *
13
+ * Given it, the check also proves the preview renders in THAT language rather
14
+ * than the default one - by reading `<html lang>`, which is a contract,
15
+ * unlike a word from the page's copy that an editor can change at any time.
14
16
  */
15
17
  localizedPath?: string;
16
18
  /**
package/dist/testing.d.ts CHANGED
@@ -6,11 +6,13 @@ interface EditSmokeOptions {
6
6
  /** A published page to exercise. Defaults to "/". */
7
7
  path?: string;
8
8
  /**
9
- * The same page under a language prefix, e.g. "/no". Pass it on a site whose
10
- * URLs carry the language, and the check also proves the preview renders in
11
- * THAT language rather than the default one - by reading `<html lang>`, which
12
- * is a contract, unlike a word from the page's copy that an editor can change
13
- * at any time.
9
+ * The same page under a language prefix, e.g. "/no". The caller states it
10
+ * because only the caller knows how its site spells a language; asking a
11
+ * workspace would tie this check to content that can change or be deleted.
12
+ *
13
+ * Given it, the check also proves the preview renders in THAT language rather
14
+ * than the default one - by reading `<html lang>`, which is a contract,
15
+ * unlike a word from the page's copy that an editor can change at any time.
14
16
  */
15
17
  localizedPath?: string;
16
18
  /**
package/dist/testing.js CHANGED
@@ -139,39 +139,6 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
139
139
  });
140
140
  }
141
141
 
142
- // src/data/queries.ts
143
- var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
144
- public {
145
- siteConfig(workspaceSlug: $workspaceSlug) {
146
- id
147
- workspaceId
148
- siteName
149
- defaultLanguage
150
- enabledLanguages
151
- enabledFeatures
152
- notFoundPageId
153
- previewUrl
154
- branding {
155
- brandName
156
- logoUrl
157
- logoDarkUrl
158
- faviconUrl
159
- ogImageUrl
160
- }
161
- }
162
- }
163
- }`;
164
-
165
- // src/data/site-locales.ts
166
- function localesFromSiteConfig(siteConfig) {
167
- const defaultLocale = siteConfig?.defaultLanguage || "en";
168
- const enabled = siteConfig?.enabledLanguages ?? [];
169
- return {
170
- defaultLocale,
171
- locales: enabled.length > 0 ? enabled : [defaultLocale]
172
- };
173
- }
174
-
175
142
  // src/preflight.ts
176
143
  var ALLOWED_FRAME_HOSTS = ["cmssy.io", "www.cmssy.io"];
177
144
  function frameAncestorSources(cspHeaderValue) {
@@ -267,29 +234,6 @@ async function workspaceHasLayoutBlocks(workspace, pageSlug) {
267
234
  return null;
268
235
  }
269
236
  }
270
- async function derivedLocalizedPath(workspace, path) {
271
- try {
272
- const data = await graphqlRequest(
273
- workspace,
274
- SITE_CONFIG_QUERY,
275
- { workspaceSlug: workspace.workspaceSlug },
276
- { public: true, retry: {} },
277
- "edit smoke: site locales"
278
- );
279
- const { defaultLocale, locales } = localesFromSiteConfig(
280
- data.public?.siteConfig ?? null
281
- );
282
- const locale = locales.find((candidate) => candidate !== defaultLocale);
283
- if (!locale) return { kind: "none" };
284
- const routed = withoutEditPrefix(path);
285
- const [first] = routed.split("/").filter(Boolean);
286
- if (first && locales.includes(first)) return { kind: "none" };
287
- const suffix = routed === "/" || routed === "" ? "" : routed.replace(/\/+$/, "");
288
- return { kind: "derived", locale, localizedPath: `/${locale}${suffix}` };
289
- } catch {
290
- return { kind: "unavailable" };
291
- }
292
- }
293
237
  async function checkCmssyEditMode(options) {
294
238
  const { baseUrl, secret, path = "/" } = options;
295
239
  const failures = [];
@@ -343,20 +287,13 @@ async function checkCmssyEditMode(options) {
343
287
  }
344
288
  }
345
289
  const query = `cmssyEdit=1&cmssySecret=${encodeURIComponent(secret)}`;
346
- const asked = options.localizedPath;
347
- const derived = !asked && options.workspace ? await derivedLocalizedPath(options.workspace, path) : { kind: "none" };
348
- if (derived.kind === "unavailable") {
349
- failures.push(
350
- `the delivery API would not say which languages ${options.workspace?.workspaceSlug} enables, so the preview's language went unchecked. That is the check three releases shipped a wrong-language preview past - a green run here does not mean it works.`
351
- );
352
- }
353
- const localizedPath = asked ?? (derived.kind === "derived" ? derived.localizedPath : void 0);
290
+ const { localizedPath } = options;
354
291
  if (localizedPath) {
355
- const locale = options.localizedLocale ?? (derived.kind === "derived" ? derived.locale : localeOf(localizedPath));
292
+ const locale = options.localizedLocale ?? localeOf(localizedPath);
356
293
  const localized = await html(url(`${localizedPath}?${query}`));
357
294
  if (localized.status !== 200) {
358
295
  failures.push(
359
- derived.kind === "derived" ? `edit ${localizedPath}: expected 200, got ${localized.status}. The workspace enables "${locale}", so the language went unchecked - pass localizedPath if this site spells the language some other way.` : `edit ${localizedPath}: expected 200, got ${localized.status}`
296
+ `edit ${localizedPath}: expected 200, got ${localized.status}`
360
297
  );
361
298
  } else {
362
299
  if (!EDITOR_MARKER.test(localized.body)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "11.5.0",
3
+ "version": "11.5.1",
4
4
  "description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
5
5
  "keywords": [
6
6
  "cmssy",