@cmssy/core 16.2.1 → 16.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/index.cjs CHANGED
@@ -73,6 +73,10 @@ Set the listed environment variables (e.g. in .env.local) and restart the dev se
73
73
  return resolved;
74
74
  }
75
75
 
76
+ // src/version.ts
77
+ var CMSSY_CORE_VERSION = "16.4.0" ;
78
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
79
+
76
80
  // src/data/http.ts
77
81
  var CmssyRequestError = class extends Error {
78
82
  status;
@@ -208,7 +212,11 @@ async function postGraphql(url, query, variables, options) {
208
212
  url,
209
213
  {
210
214
  method: "POST",
211
- headers: { "content-type": "application/json", ...options.headers },
215
+ headers: {
216
+ "content-type": "application/json",
217
+ "user-agent": CMSSY_USER_AGENT,
218
+ ...options.headers
219
+ },
212
220
  body: JSON.stringify({ query, variables }),
213
221
  signal: options.signal
214
222
  },
package/dist/index.js CHANGED
@@ -72,6 +72,10 @@ Set the listed environment variables (e.g. in .env.local) and restart the dev se
72
72
  return resolved;
73
73
  }
74
74
 
75
+ // src/version.ts
76
+ var CMSSY_CORE_VERSION = "16.4.0" ;
77
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
78
+
75
79
  // src/data/http.ts
76
80
  var CmssyRequestError = class extends Error {
77
81
  status;
@@ -207,7 +211,11 @@ async function postGraphql(url, query, variables, options) {
207
211
  url,
208
212
  {
209
213
  method: "POST",
210
- headers: { "content-type": "application/json", ...options.headers },
214
+ headers: {
215
+ "content-type": "application/json",
216
+ "user-agent": CMSSY_USER_AGENT,
217
+ ...options.headers
218
+ },
211
219
  body: JSON.stringify({ query, variables }),
212
220
  signal: options.signal
213
221
  },
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ // src/version.ts
4
+ var CMSSY_CORE_VERSION = "16.4.0" ;
5
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
6
+
3
7
  // src/data/http.ts
4
8
  var CmssyRequestError = class extends Error {
5
9
  status;
@@ -135,7 +139,11 @@ async function postGraphql(url, query, variables, options) {
135
139
  url,
136
140
  {
137
141
  method: "POST",
138
- headers: { "content-type": "application/json", ...options.headers },
142
+ headers: {
143
+ "content-type": "application/json",
144
+ "user-agent": CMSSY_USER_AGENT,
145
+ ...options.headers
146
+ },
139
147
  body: JSON.stringify({ query, variables }),
140
148
  signal: options.signal
141
149
  },
@@ -1,3 +1,7 @@
1
+ // src/version.ts
2
+ var CMSSY_CORE_VERSION = "16.4.0" ;
3
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
4
+
1
5
  // src/data/http.ts
2
6
  var CmssyRequestError = class extends Error {
3
7
  status;
@@ -133,7 +137,11 @@ async function postGraphql(url, query, variables, options) {
133
137
  url,
134
138
  {
135
139
  method: "POST",
136
- headers: { "content-type": "application/json", ...options.headers },
140
+ headers: {
141
+ "content-type": "application/json",
142
+ "user-agent": CMSSY_USER_AGENT,
143
+ ...options.headers
144
+ },
137
145
  body: JSON.stringify({ query, variables }),
138
146
  signal: options.signal
139
147
  },
package/dist/internal.cjs CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  var types = require('@cmssy/types');
4
4
 
5
+ // src/version.ts
6
+ var CMSSY_CORE_VERSION = "16.4.0" ;
7
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
8
+
5
9
  // src/data/http.ts
6
10
  var CmssyRequestError = class extends Error {
7
11
  status;
@@ -137,7 +141,11 @@ async function postGraphql(url, query, variables, options) {
137
141
  url,
138
142
  {
139
143
  method: "POST",
140
- headers: { "content-type": "application/json", ...options.headers },
144
+ headers: {
145
+ "content-type": "application/json",
146
+ "user-agent": CMSSY_USER_AGENT,
147
+ ...options.headers
148
+ },
141
149
  body: JSON.stringify({ query, variables }),
142
150
  signal: options.signal
143
151
  },
package/dist/internal.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { DEFAULT_LAYOUT_REGIONS } from '@cmssy/types';
2
2
 
3
+ // src/version.ts
4
+ var CMSSY_CORE_VERSION = "16.4.0" ;
5
+ var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
6
+
3
7
  // src/data/http.ts
4
8
  var CmssyRequestError = class extends Error {
5
9
  status;
@@ -135,7 +139,11 @@ async function postGraphql(url, query, variables, options) {
135
139
  url,
136
140
  {
137
141
  method: "POST",
138
- headers: { "content-type": "application/json", ...options.headers },
142
+ headers: {
143
+ "content-type": "application/json",
144
+ "user-agent": CMSSY_USER_AGENT,
145
+ ...options.headers
146
+ },
139
147
  body: JSON.stringify({ query, variables }),
140
148
  signal: options.signal
141
149
  },
@@ -346,13 +346,26 @@ function parseOrigin(value) {
346
346
  return null;
347
347
  }
348
348
  }
349
+ var LOCAL_HOSTNAMES = ["localhost", "127.0.0.1"];
350
+ function previewUrlFix(devOrigin) {
351
+ let hostname = null;
352
+ try {
353
+ hostname = new URL(devOrigin).hostname;
354
+ } catch {
355
+ hostname = null;
356
+ }
357
+ if (hostname && LOCAL_HOSTNAMES.includes(hostname)) {
358
+ 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`;
359
+ }
360
+ return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
361
+ }
349
362
  function checkPreviewUrl(previewUrl, devOrigin) {
350
363
  const trimmed = previewUrl?.trim();
351
364
  if (!trimmed) {
352
365
  return {
353
366
  status: "fail",
354
367
  message: "no preview URL is set for this workspace",
355
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
368
+ fix: previewUrlFix(devOrigin)
356
369
  };
357
370
  }
358
371
  const previewOrigin = parseOrigin(trimmed);
@@ -360,7 +373,7 @@ function checkPreviewUrl(previewUrl, devOrigin) {
360
373
  return {
361
374
  status: "fail",
362
375
  message: `the workspace preview URL "${trimmed}" is not a valid URL`,
363
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
376
+ fix: previewUrlFix(devOrigin)
364
377
  };
365
378
  }
366
379
  const localOrigin = parseOrigin(devOrigin);
@@ -373,7 +386,7 @@ function checkPreviewUrl(previewUrl, devOrigin) {
373
386
  return {
374
387
  status: "fail",
375
388
  message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
376
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
389
+ fix: previewUrlFix(devOrigin)
377
390
  };
378
391
  }
379
392
  function frameAncestorSources(cspHeaderValue) {
package/dist/preflight.js CHANGED
@@ -344,13 +344,26 @@ function parseOrigin(value) {
344
344
  return null;
345
345
  }
346
346
  }
347
+ var LOCAL_HOSTNAMES = ["localhost", "127.0.0.1"];
348
+ function previewUrlFix(devOrigin) {
349
+ let hostname = null;
350
+ try {
351
+ hostname = new URL(devOrigin).hostname;
352
+ } catch {
353
+ hostname = null;
354
+ }
355
+ if (hostname && LOCAL_HOSTNAMES.includes(hostname)) {
356
+ 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`;
357
+ }
358
+ return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
359
+ }
347
360
  function checkPreviewUrl(previewUrl, devOrigin) {
348
361
  const trimmed = previewUrl?.trim();
349
362
  if (!trimmed) {
350
363
  return {
351
364
  status: "fail",
352
365
  message: "no preview URL is set for this workspace",
353
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
366
+ fix: previewUrlFix(devOrigin)
354
367
  };
355
368
  }
356
369
  const previewOrigin = parseOrigin(trimmed);
@@ -358,7 +371,7 @@ function checkPreviewUrl(previewUrl, devOrigin) {
358
371
  return {
359
372
  status: "fail",
360
373
  message: `the workspace preview URL "${trimmed}" is not a valid URL`,
361
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
374
+ fix: previewUrlFix(devOrigin)
362
375
  };
363
376
  }
364
377
  const localOrigin = parseOrigin(devOrigin);
@@ -371,7 +384,7 @@ function checkPreviewUrl(previewUrl, devOrigin) {
371
384
  return {
372
385
  status: "fail",
373
386
  message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
374
- fix: `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`
387
+ fix: previewUrlFix(devOrigin)
375
388
  };
376
389
  }
377
390
  function frameAncestorSources(cspHeaderValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "16.2.1",
3
+ "version": "16.4.0",
4
4
  "description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -87,7 +87,7 @@
87
87
  "vitest": "^2.1.0"
88
88
  },
89
89
  "dependencies": {
90
- "@cmssy/types": "0.43.0",
90
+ "@cmssy/types": "0.49.0",
91
91
  "jose": "^6.2.3"
92
92
  },
93
93
  "scripts": {