@solidactions/cli 3.22.0 → 3.24.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.
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.escapeJsonDisplayText = escapeJsonDisplayText;
6
7
  exports.sanitizeDisplayText = sanitizeDisplayText;
7
8
  exports.formatRevisionSummary = formatRevisionSummary;
8
9
  exports.revisionSha = revisionSha;
@@ -20,7 +21,17 @@ const path_1 = __importDefault(require("path"));
20
21
  const child_process_1 = require("child_process");
21
22
  const form_data_1 = __importDefault(require("form-data"));
22
23
  const table_1 = require("./table");
23
- const DISPLAY_FORMATTING = /[\x00-\x1f\x7f\u061c\u200b-\u200f\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g;
24
+ const DISPLAY_FORMATTING = /[\x00-\x1f\x7f-\x9f\u061c\u200b-\u200f\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g;
25
+ /**
26
+ * Escape every character of the shared display-formatting class as a `\uXXXX`
27
+ * sequence inside an already-serialised JSON string, so terminal-unsafe
28
+ * characters never reach stdout raw while `JSON.parse` still recovers the
29
+ * exact values (cli#189). Machine-readable values are untouched, only their
30
+ * encoding.
31
+ */
32
+ function escapeJsonDisplayText(serialised) {
33
+ return serialised.replace(DISPLAY_FORMATTING, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
34
+ }
24
35
  const SHA_PATTERN = /^[0-9a-f]{7,64}$/i;
25
36
  const STRICT_ISO_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
26
37
  function displayValue(value, maxLength) {
@@ -14,6 +14,7 @@ exports.resolveWorkspaceInput = resolveWorkspaceInput;
14
14
  const axios_1 = __importDefault(require("axios"));
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
16
  const readline_1 = __importDefault(require("readline"));
17
+ const api_1 = require("./api");
17
18
  /**
18
19
  * Workspaces whose slug or name contains the input (or is contained in it), case-insensitively —
19
20
  * offered after a miss, never selected (cli#112). Reverse containment only counts for
@@ -302,7 +303,16 @@ async function resolveWorkspaceInput(config, input) {
302
303
  ({ workspaces, scope } = await fetchWorkspaces(config));
303
304
  }
304
305
  catch (error) {
305
- console.error(chalk_1.default.red('Failed to list workspaces:'), error.response?.data?.message || error.message);
306
+ const status = error.response?.status;
307
+ if (status === 401) {
308
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
309
+ }
310
+ else if (status) {
311
+ console.error(chalk_1.default.red((0, api_1.formatApiFailure)(status, error.response.data)));
312
+ }
313
+ else {
314
+ console.error(chalk_1.default.red(`Connection failed: ${error.message}`));
315
+ }
306
316
  process.exit(1);
307
317
  }
308
318
  const result = classifyWorkspaceInput(input, workspaces);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidactions/cli",
3
- "version": "3.22.0",
3
+ "version": "3.24.0",
4
4
  "description": "SolidActions CLI - Deploy and manage workflow automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {