apiblaze 0.17.5 → 0.17.6

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 +7 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -440,12 +440,15 @@ async function admin(call) {
440
440
  }
441
441
  return data;
442
442
  }
443
+ function usdStr(cents) {
444
+ const wholeCents = Math.abs(cents - Math.round(cents)) < 1e-9;
445
+ return (cents / 100).toFixed(wholeCents ? 2 : 4);
446
+ }
443
447
  function formatBilling(billing) {
444
448
  const b = billing;
445
449
  if (!b || typeof b.charged_cents !== "number") return null;
446
- const usd = b.charged_cents >= 1 || b.charged_cents === 0 ? (b.charged_cents / 100).toFixed(2) : (b.charged_cents / 100).toFixed(4);
447
- const rem = typeof b.credits_remaining === "number" ? ` \xB7 $${(b.credits_remaining / 100).toFixed(2)} credit left` : "";
448
- return `\u{1F4B3} Charged $${usd}${rem}`;
450
+ const rem = typeof b.credits_remaining === "number" ? ` \xB7 $${usdStr(b.credits_remaining)} credit left` : "";
451
+ return `\u{1F4B3} Charged $${usdStr(b.charged_cents)}${rem}`;
449
452
  }
450
453
  function maybePrintBilling(data) {
451
454
  const line = formatBilling(data?.billing);
@@ -693,7 +696,7 @@ var import_commander = require("commander");
693
696
  var import_chalk35 = __toESM(require("chalk"));
694
697
 
695
698
  // package.json
696
- var version = "0.17.5";
699
+ var version = "0.17.6";
697
700
 
698
701
  // src/index.ts
699
702
  init_types();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.17.5",
3
+ "version": "0.17.6",
4
4
  "description": "APIblaze CLI + sidecar — manage API proxies, run dev tunnels, and route a Next.js app's egress through APIblaze with one command",
5
5
  "keywords": [
6
6
  "apiblaze",