trainfabric 0.1.51 → 0.1.52
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 +12 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9364,7 +9364,7 @@ function buildComputeSpec(options) {
|
|
|
9364
9364
|
|
|
9365
9365
|
// src/index.ts
|
|
9366
9366
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
9367
|
-
var CLI_VERSION = "0.1.
|
|
9367
|
+
var CLI_VERSION = "0.1.52";
|
|
9368
9368
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
9369
9369
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
9370
9370
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9718,8 +9718,8 @@ function printInvoiceSummary(invoices) {
|
|
|
9718
9718
|
console.log(`${invoice.id}${invoice.runId ? ` (${invoice.runId})` : ""}`);
|
|
9719
9719
|
console.log(` status: ${invoice.status}`);
|
|
9720
9720
|
console.log(` amount due: ${formatUsd(invoice.amountDueUsd)}`);
|
|
9721
|
-
if (typeof invoice.customerChargeUsd === "number") {
|
|
9722
|
-
console.log(` run charge: ${formatUsd(invoice.customerChargeUsd)}`);
|
|
9721
|
+
if (typeof invoice.usageChargeUsd === "number" || typeof invoice.customerChargeUsd === "number") {
|
|
9722
|
+
console.log(` run charge: ${formatUsd(invoice.usageChargeUsd ?? invoice.customerChargeUsd)}`);
|
|
9723
9723
|
}
|
|
9724
9724
|
if (typeof invoice.creditAppliedUsd === "number") {
|
|
9725
9725
|
console.log(` credits applied: ${formatUsd(invoice.creditAppliedUsd)}`);
|
|
@@ -10416,7 +10416,7 @@ program2.command("deployments:delete").argument("<deploymentId>").description("D
|
|
|
10416
10416
|
program2.command("billing:summary").option("--json", "print raw JSON output; this is the default").description("Fetch billing summary").action(async () => {
|
|
10417
10417
|
printJson(await createClient(loadConfig()).billing.getSummary());
|
|
10418
10418
|
});
|
|
10419
|
-
program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").option("--run <runId>", "filter usage records to one run").description("List billing usage records").action(async (options) => {
|
|
10419
|
+
program2.command("billing:usage").option("--json", "print raw JSON output; this is the default").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").option("--run <runId>", "filter usage records to one run").description("List billing usage records").action(async (options) => {
|
|
10420
10420
|
const runId = normalizeOptionalId(options.run, "run", "Run ID");
|
|
10421
10421
|
const unit = normalizeOptionalBillingUnit(options.unit);
|
|
10422
10422
|
const client = createClient(loadConfig());
|
|
@@ -10425,7 +10425,14 @@ program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seco
|
|
|
10425
10425
|
printJson(unit ? { ...summary, unit, usage: summary.usage.filter((entry) => entry.unit === unit) } : summary);
|
|
10426
10426
|
return;
|
|
10427
10427
|
}
|
|
10428
|
-
|
|
10428
|
+
const usage = await client.billing.getUsage(unit);
|
|
10429
|
+
printJson({
|
|
10430
|
+
recordCount: usage.length,
|
|
10431
|
+
responseShape: "usage_summary",
|
|
10432
|
+
runId: null,
|
|
10433
|
+
unit: unit ?? "all",
|
|
10434
|
+
usage
|
|
10435
|
+
});
|
|
10429
10436
|
});
|
|
10430
10437
|
program2.command("billing:invoices").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable invoice reconciliation summary").description("List invoices").action(async (options) => {
|
|
10431
10438
|
const invoices = await createClient(loadConfig()).billing.listInvoices();
|