@robinmordasiewicz/f5xc-xcsh 6.40.0 → 6.42.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.
Files changed (2) hide show
  1. package/dist/index.js +32 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45354,8 +45354,8 @@ function getLogoModeFromEnv(envPrefix) {
45354
45354
  var CLI_NAME = "xcsh";
45355
45355
  var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
45356
45356
  function getVersion() {
45357
- if ("6.40.0") {
45358
- return "6.40.0";
45357
+ if ("6.42.0") {
45358
+ return "6.42.0";
45359
45359
  }
45360
45360
  if (process.env.XCSH_VERSION) {
45361
45361
  return process.env.XCSH_VERSION;
@@ -45821,6 +45821,9 @@ var APIClient = class {
45821
45821
  this._validationError = "No API token configured";
45822
45822
  return { valid: false, error: this._validationError };
45823
45823
  }
45824
+ if (this.debug) {
45825
+ console.error(`DEBUG: Validating token against ${this.serverUrl}`);
45826
+ }
45824
45827
  try {
45825
45828
  await this.get("/api/web/namespaces");
45826
45829
  this._isValidated = true;
@@ -45839,7 +45842,7 @@ var APIClient = class {
45839
45842
  this._validationError = `Validation failed: HTTP ${error.statusCode}`;
45840
45843
  }
45841
45844
  } else {
45842
- this._validationError = "Validation failed: Unknown error";
45845
+ this._validationError = `Validation failed: ${error instanceof Error ? error.message : "Unknown error"}`;
45843
45846
  }
45844
45847
  return { valid: false, error: this._validationError };
45845
45848
  }
@@ -49024,6 +49027,21 @@ function colorizeLogoLine(line) {
49024
49027
  }
49025
49028
  return result;
49026
49029
  }
49030
+ function wrapText4(text, maxWidth) {
49031
+ const words = text.split(" ");
49032
+ const lines = [];
49033
+ let currentLine = "";
49034
+ for (const word of words) {
49035
+ if (currentLine.length + word.length + 1 <= maxWidth) {
49036
+ currentLine += (currentLine ? " " : "") + word;
49037
+ } else {
49038
+ if (currentLine) lines.push(currentLine);
49039
+ currentLine = word;
49040
+ }
49041
+ }
49042
+ if (currentLine) lines.push(currentLine);
49043
+ return lines;
49044
+ }
49027
49045
  function printImageBanner(imageSeq, imageHeight, imageWidth) {
49028
49046
  const BOX = {
49029
49047
  topLeft: "\u256D",
@@ -49037,11 +49055,7 @@ function printImageBanner(imageSeq, imageHeight, imageWidth) {
49037
49055
  const INNER_WIDTH = TOTAL_WIDTH - 2;
49038
49056
  const IMAGE_COL_WIDTH = 1 + imageWidth + 1;
49039
49057
  const TEXT_COL_WIDTH = INNER_WIDTH - IMAGE_COL_WIDTH;
49040
- const HELP_LINES = [
49041
- "Type 'help' for commands",
49042
- "Run 'namespace <ns>' to set",
49043
- "Press Ctrl+C twice to exit"
49044
- ];
49058
+ const HELP_LINES = wrapText4(CLI_DESCRIPTION_MEDIUM, TEXT_COL_WIDTH - 2);
49045
49059
  const helpStartRow = Math.floor((imageHeight - HELP_LINES.length) / 2);
49046
49060
  const title = ` ${CLI_FULL_NAME} v${CLI_VERSION} `;
49047
49061
  const leftDashes = 3;
@@ -49091,11 +49105,8 @@ function printAsciiBanner() {
49091
49105
  const logoWidth = Math.max(...logoLines.map((l) => [...l].length));
49092
49106
  const TOTAL_WIDTH = Math.max(80, logoWidth + 4);
49093
49107
  const INNER_WIDTH = TOTAL_WIDTH - 2;
49094
- const HELP_LINES = [
49095
- "Type 'help' for commands",
49096
- "Run 'namespace <ns>' to set",
49097
- "Press Ctrl+C twice to exit"
49098
- ];
49108
+ const helpColumnWidth = INNER_WIDTH - logoWidth - 1;
49109
+ const HELP_LINES = wrapText4(CLI_DESCRIPTION_MEDIUM, helpColumnWidth - 2);
49099
49110
  const HELP_START_ROW = 8;
49100
49111
  const title = ` ${CLI_FULL_NAME} v${CLI_VERSION} `;
49101
49112
  const leftDashes = 3;
@@ -49112,7 +49123,6 @@ function printAsciiBanner() {
49112
49123
  const helpText = helpIndex >= 0 && helpIndex < HELP_LINES.length ? HELP_LINES[helpIndex] ?? "" : "";
49113
49124
  const paddedLogo = logoLine.padEnd(logoWidth);
49114
49125
  const coloredLogo = colorizeLogoLine(paddedLogo);
49115
- const helpColumnWidth = INNER_WIDTH - logoWidth - 1;
49116
49126
  const paddedHelp = helpText.padEnd(helpColumnWidth);
49117
49127
  output.push(
49118
49128
  colorRed(BOX.vertical) + coloredLogo + " " + colorBoldWhite(paddedHelp) + colorRed(BOX.vertical)
@@ -49143,11 +49153,7 @@ function getBannerLines(logoMode, useImage) {
49143
49153
  const logoWidth = Math.max(...logoLines.map((l) => [...l].length));
49144
49154
  const TOTAL_WIDTH = Math.max(80, logoWidth + 4);
49145
49155
  const INNER_WIDTH = TOTAL_WIDTH - 2;
49146
- const HELP_LINES = [
49147
- "Type 'help' for commands",
49148
- "Run 'namespace <ns>' to set",
49149
- "Press Ctrl+C twice to exit"
49150
- ];
49156
+ const helpColumnWidth = INNER_WIDTH - logoWidth - 1;
49151
49157
  const title = ` ${CLI_FULL_NAME} v${CLI_VERSION} `;
49152
49158
  const leftDashes = 3;
49153
49159
  const rightDashes = TOTAL_WIDTH - 1 - leftDashes - title.length - 1;
@@ -49168,8 +49174,12 @@ function getBannerLines(logoMode, useImage) {
49168
49174
  const imageWidth = F5_LOGO_DISPLAY_WIDTH;
49169
49175
  const IMAGE_COL_WIDTH = 1 + imageWidth + 1;
49170
49176
  const TEXT_COL_WIDTH = INNER_WIDTH - IMAGE_COL_WIDTH;
49177
+ const HELP_LINES2 = wrapText4(
49178
+ CLI_DESCRIPTION_MEDIUM,
49179
+ TEXT_COL_WIDTH - 2
49180
+ );
49171
49181
  const helpStartRow = Math.floor(
49172
- (imageHeight - HELP_LINES.length) / 2
49182
+ (imageHeight - HELP_LINES2.length) / 2
49173
49183
  );
49174
49184
  let bannerStr = "";
49175
49185
  bannerStr += "\n";
@@ -49179,7 +49189,7 @@ function getBannerLines(logoMode, useImage) {
49179
49189
  bannerStr += colorRed(BOX.vertical) + " ".repeat(INNER_WIDTH) + colorRed(BOX.vertical) + "\n";
49180
49190
  for (let row = 0; row < imageHeight; row++) {
49181
49191
  const helpIndex = row - helpStartRow;
49182
- const helpText = helpIndex >= 0 && helpIndex < HELP_LINES.length ? HELP_LINES[helpIndex] ?? "" : "";
49192
+ const helpText = helpIndex >= 0 && helpIndex < HELP_LINES2.length ? HELP_LINES2[helpIndex] ?? "" : "";
49183
49193
  const imageSpace = " ".repeat(IMAGE_COL_WIDTH);
49184
49194
  const paddedHelp = helpText.padEnd(TEXT_COL_WIDTH);
49185
49195
  bannerStr += colorRed(BOX.vertical) + imageSpace + colorBoldWhite(paddedHelp) + colorRed(BOX.vertical) + "\n";
@@ -49198,6 +49208,7 @@ function getBannerLines(logoMode, useImage) {
49198
49208
  }
49199
49209
  }
49200
49210
  const HELP_START_ROW = 8;
49211
+ const HELP_LINES = wrapText4(CLI_DESCRIPTION_MEDIUM, helpColumnWidth - 2);
49201
49212
  output.push("");
49202
49213
  output.push(
49203
49214
  colorRed(BOX.topLeft + BOX.horizontal.repeat(leftDashes)) + colorBoldWhite(title) + colorRed(
@@ -49210,7 +49221,6 @@ function getBannerLines(logoMode, useImage) {
49210
49221
  const helpText = helpIndex >= 0 && helpIndex < HELP_LINES.length ? HELP_LINES[helpIndex] ?? "" : "";
49211
49222
  const paddedLogo = logoLine.padEnd(logoWidth);
49212
49223
  const coloredLogo = colorizeLogoLine(paddedLogo);
49213
- const helpColumnWidth = INNER_WIDTH - logoWidth - 1;
49214
49224
  const paddedHelp = helpText.padEnd(helpColumnWidth);
49215
49225
  output.push(
49216
49226
  colorRed(BOX.vertical) + coloredLogo + " " + colorBoldWhite(paddedHelp) + colorRed(BOX.vertical)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinmordasiewicz/f5xc-xcsh",
3
- "version": "6.40.0",
3
+ "version": "6.42.0",
4
4
  "description": "F5 Distributed Cloud Shell - Interactive CLI for F5 XC",
5
5
  "type": "module",
6
6
  "bin": {