@cmssy/cli 19.0.0 → 19.1.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2388,6 +2388,18 @@ function publicEndpoint(env, org, workspace) {
2388
2388
  const base = apiUrl.replace(/\/graphql\/?$/, "").replace(/\/+$/, "");
2389
2389
  return `${base}/public/${org}/${workspace}/graphql`;
2390
2390
  }
2391
+ async function refusalReason(response) {
2392
+ let body;
2393
+ try {
2394
+ body = await response.json();
2395
+ } catch {
2396
+ return void 0;
2397
+ }
2398
+ const errors = body === null ? void 0 : body.errors;
2399
+ if (!Array.isArray(errors)) return void 0;
2400
+ const said = errors.map((error) => error?.message).filter((message) => typeof message === "string" && message.length > 0);
2401
+ return said.length > 0 ? said.join("; ") : void 0;
2402
+ }
2391
2403
  async function request(deps, endpoint, query, variables) {
2392
2404
  let response;
2393
2405
  try {
@@ -2405,7 +2417,7 @@ async function request(deps, endpoint, query, variables) {
2405
2417
  if (!response.ok) {
2406
2418
  throw new CliError(
2407
2419
  `the delivery API answered ${response.status}`,
2408
- "check CMSSY_ORG_SLUG and CMSSY_WORKSPACE_SLUG - they form the delivery path"
2420
+ await refusalReason(response) ?? "check CMSSY_ORG_SLUG and CMSSY_WORKSPACE_SLUG - they form the delivery path"
2409
2421
  );
2410
2422
  }
2411
2423
  const body = await response.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/cli",
3
- "version": "19.0.0",
3
+ "version": "19.1.1",
4
4
  "description": "The cmssy CLI: `cmssy init` wires cmssy into an existing Next.js, Astro or React Router app; `cmssy link` connects it to a workspace and verifies the editor wiring.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "esbuild": "^0.27.7",
31
- "@cmssy/core": "19.0.0"
31
+ "@cmssy/core": "19.1.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",