@robinmordasiewicz/f5xc-xcsh 1.0.91-2601030338 → 1.0.91-2601030421
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.js +65 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47052,8 +47052,8 @@ function getLogoModeFromEnv(envPrefix) {
|
|
|
47052
47052
|
var CLI_NAME = "xcsh";
|
|
47053
47053
|
var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
|
|
47054
47054
|
function getVersion() {
|
|
47055
|
-
if ("v1.0.91-
|
|
47056
|
-
return "v1.0.91-
|
|
47055
|
+
if ("v1.0.91-2601030421") {
|
|
47056
|
+
return "v1.0.91-2601030421";
|
|
47057
47057
|
}
|
|
47058
47058
|
if (process.env.XCSH_VERSION) {
|
|
47059
47059
|
return process.env.XCSH_VERSION;
|
|
@@ -149137,6 +149137,23 @@ var SubscriptionClient = class {
|
|
|
149137
149137
|
return `/api/web/namespaces/${namespace}/usage/invoice_pdf?invoice_id=${invoiceId}`;
|
|
149138
149138
|
}
|
|
149139
149139
|
// ============ Overview / Reports ============
|
|
149140
|
+
/**
|
|
149141
|
+
* Parse error message from API error and create APIError object
|
|
149142
|
+
*/
|
|
149143
|
+
createAPIError(endpoint, error) {
|
|
149144
|
+
if (error instanceof Error) {
|
|
149145
|
+
const match = error.message.match(/:\s*(\d+)\s*-\s*(.+)$/);
|
|
149146
|
+
if (match && match[1] && match[2]) {
|
|
149147
|
+
return {
|
|
149148
|
+
endpoint,
|
|
149149
|
+
statusCode: parseInt(match[1], 10),
|
|
149150
|
+
message: match[2].trim()
|
|
149151
|
+
};
|
|
149152
|
+
}
|
|
149153
|
+
return { endpoint, message: error.message };
|
|
149154
|
+
}
|
|
149155
|
+
return { endpoint, message: String(error) };
|
|
149156
|
+
}
|
|
149140
149157
|
/**
|
|
149141
149158
|
* Get subscription overview (combines multiple API calls)
|
|
149142
149159
|
*/
|
|
@@ -149149,8 +149166,13 @@ var SubscriptionClient = class {
|
|
|
149149
149166
|
this.listPaymentMethods()
|
|
149150
149167
|
]);
|
|
149151
149168
|
const overview = {};
|
|
149169
|
+
const errors = [];
|
|
149152
149170
|
if (plan.status === "fulfilled") {
|
|
149153
149171
|
overview.plan = plan.value;
|
|
149172
|
+
} else {
|
|
149173
|
+
errors.push(
|
|
149174
|
+
this.createAPIError("usage_plans/current", plan.reason)
|
|
149175
|
+
);
|
|
149154
149176
|
}
|
|
149155
149177
|
if (addons.status === "fulfilled") {
|
|
149156
149178
|
const addonList = addons.value;
|
|
@@ -149162,6 +149184,8 @@ var SubscriptionClient = class {
|
|
|
149162
149184
|
available: addonList.filter((a) => a.status === "AVAILABLE").length,
|
|
149163
149185
|
total: addonList.length
|
|
149164
149186
|
};
|
|
149187
|
+
} else {
|
|
149188
|
+
errors.push(this.createAPIError("addon_services", addons.reason));
|
|
149165
149189
|
}
|
|
149166
149190
|
if (quotaUsage.status === "fulfilled") {
|
|
149167
149191
|
const usage = quotaUsage.value.usage ?? [];
|
|
@@ -149173,9 +149197,15 @@ var SubscriptionClient = class {
|
|
|
149173
149197
|
total: usage.length,
|
|
149174
149198
|
critical_quotas: critical
|
|
149175
149199
|
};
|
|
149200
|
+
} else {
|
|
149201
|
+
errors.push(this.createAPIError("quota/usage", quotaUsage.reason));
|
|
149176
149202
|
}
|
|
149177
149203
|
if (currentUsage.status === "fulfilled") {
|
|
149178
149204
|
overview.current_usage = currentUsage.value;
|
|
149205
|
+
} else {
|
|
149206
|
+
errors.push(
|
|
149207
|
+
this.createAPIError("current_usage", currentUsage.reason)
|
|
149208
|
+
);
|
|
149179
149209
|
}
|
|
149180
149210
|
if (paymentMethods.status === "fulfilled") {
|
|
149181
149211
|
const methods = paymentMethods.value;
|
|
@@ -149183,6 +149213,16 @@ var SubscriptionClient = class {
|
|
|
149183
149213
|
overview.billing_status = {
|
|
149184
149214
|
payment_method_status: primary?.status ?? "NO_PAYMENT_METHOD"
|
|
149185
149215
|
};
|
|
149216
|
+
} else {
|
|
149217
|
+
errors.push(
|
|
149218
|
+
this.createAPIError(
|
|
149219
|
+
"billing/payment_methods",
|
|
149220
|
+
paymentMethods.reason
|
|
149221
|
+
)
|
|
149222
|
+
);
|
|
149223
|
+
}
|
|
149224
|
+
if (errors.length > 0) {
|
|
149225
|
+
overview.errors = errors;
|
|
149186
149226
|
}
|
|
149187
149227
|
return overview;
|
|
149188
149228
|
}
|
|
@@ -149247,6 +149287,11 @@ function progressBar(percentage, width = 10) {
|
|
|
149247
149287
|
const empty = width - filled;
|
|
149248
149288
|
return "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
149249
149289
|
}
|
|
149290
|
+
function truncateMiddle(str, maxLen) {
|
|
149291
|
+
if (str.length <= maxLen) return str;
|
|
149292
|
+
const half = Math.floor((maxLen - 3) / 2);
|
|
149293
|
+
return str.slice(0, half) + "..." + str.slice(-(maxLen - half - 3));
|
|
149294
|
+
}
|
|
149250
149295
|
var showCommand3 = {
|
|
149251
149296
|
name: "show",
|
|
149252
149297
|
description: "Display comprehensive subscription overview including plan tier, addon summary, quota utilization, and current billing period usage. Provides a quick snapshot of your F5 XC subscription status.",
|
|
@@ -149318,6 +149363,24 @@ var showCommand3 = {
|
|
|
149318
149363
|
`\u2502 Payment Status: ${padEnd2(pmStatus, 38)} \u2502`
|
|
149319
149364
|
);
|
|
149320
149365
|
}
|
|
149366
|
+
if (overview.errors && overview.errors.length > 0) {
|
|
149367
|
+
lines.push(
|
|
149368
|
+
"\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"
|
|
149369
|
+
);
|
|
149370
|
+
lines.push(
|
|
149371
|
+
`\u2502 \u26A0\uFE0F API Errors (${overview.errors.length}):${padEnd2("", 36)} \u2502`
|
|
149372
|
+
);
|
|
149373
|
+
for (const error of overview.errors) {
|
|
149374
|
+
const statusInfo = error.statusCode ? ` [${error.statusCode}]` : "";
|
|
149375
|
+
const errorMsg = truncateMiddle(
|
|
149376
|
+
`${error.endpoint}${statusInfo}`,
|
|
149377
|
+
52
|
|
149378
|
+
);
|
|
149379
|
+
lines.push(
|
|
149380
|
+
`\u2502 \u2022 ${padEnd2(errorMsg, 50)} \u2502`
|
|
149381
|
+
);
|
|
149382
|
+
}
|
|
149383
|
+
}
|
|
149321
149384
|
lines.push(
|
|
149322
149385
|
"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"
|
|
149323
149386
|
);
|