@cmssy/core 19.3.1 → 19.3.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/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.3.1" ;
228
+ var CMSSY_CORE_VERSION = "19.3.2" ;
229
229
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
230
230
 
231
231
  // src/data/http.ts
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.3.1" ;
227
+ var CMSSY_CORE_VERSION = "19.3.2" ;
228
228
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
229
229
 
230
230
  // src/data/http.ts
@@ -154,7 +154,7 @@ function documentText(document) {
154
154
  }
155
155
 
156
156
  // src/version.ts
157
- var CMSSY_CORE_VERSION = "19.3.1" ;
157
+ var CMSSY_CORE_VERSION = "19.3.2" ;
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.3.1" ;
155
+ var CMSSY_CORE_VERSION = "19.3.2" ;
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.3.1" ;
157
+ var CMSSY_CORE_VERSION = "19.3.2" ;
158
158
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
159
159
 
160
160
  // src/data/http.ts
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.3.1" ;
155
+ var CMSSY_CORE_VERSION = "19.3.2" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/data/http.ts
@@ -151,6 +151,10 @@ function documentText(document) {
151
151
  );
152
152
  }
153
153
 
154
+ // src/version.ts
155
+ var CMSSY_CORE_VERSION = "19.3.2" ;
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: { "content-type": "application/json" },
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
- DRAFT_SECRET_VALID_QUERY,
460
- { workspaceSlug: config.workspaceSlug, secret }
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
- var LOCAL_HOSTNAMES = ["localhost", "127.0.0.1"];
504
- function previewUrlFix(devOrigin) {
505
- let hostname = null;
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
- hostname = new URL(devOrigin).hostname;
516
+ return isLocalHostname(new URL(origin).hostname);
508
517
  } catch {
509
- hostname = null;
518
+ return false;
510
519
  }
511
- if (hostname && LOCAL_HOSTNAMES.includes(hostname)) {
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.3.2" ;
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: { "content-type": "application/json" },
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
- DRAFT_SECRET_VALID_QUERY,
458
- { workspaceSlug: config.workspaceSlug, secret }
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
- var LOCAL_HOSTNAMES = ["localhost", "127.0.0.1"];
502
- function previewUrlFix(devOrigin) {
503
- let hostname = null;
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
- hostname = new URL(devOrigin).hostname;
514
+ return isLocalHostname(new URL(origin).hostname);
506
515
  } catch {
507
- hostname = null;
516
+ return false;
508
517
  }
509
- if (hostname && LOCAL_HOSTNAMES.includes(hostname)) {
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}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "19.3.1",
3
+ "version": "19.3.2",
4
4
  "description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
5
5
  "keywords": [
6
6
  "cmssy",