@suveren/gateway 0.31.3 → 0.32.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.
- package/dist/mcp-server/http.mjs +13 -6
- package/dist/ui/assets/index-BCAc8h7B.js +123 -0
- package/dist/ui/assets/index-BWCRFqkv.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/profiles/customers/0.11.profile.json +186 -0
- package/profiles/delegation/0.5.profile.json +194 -0
- package/profiles/deploy/0.12.profile.json +177 -0
- package/profiles/index.json +7 -1
- package/profiles/publish/0.7.profile.json +187 -0
- package/profiles/purchase/0.8.profile.json +235 -0
- package/profiles/reporting/0.4.profile.json +98 -0
- package/dist/ui/assets/index-CC9U7Luz.css +0 -1
- package/dist/ui/assets/index-CfPjctPy.js +0 -123
package/dist/mcp-server/http.mjs
CHANGED
|
@@ -3417,6 +3417,9 @@ function getConsumptionState(auth, executionLog, profile) {
|
|
|
3417
3417
|
now,
|
|
3418
3418
|
boundActionTypes(fieldName, fieldDef)
|
|
3419
3419
|
);
|
|
3420
|
+
const unit = fieldDef.unit;
|
|
3421
|
+
const frameCurrency = auth.frame.currency;
|
|
3422
|
+
const currency = bt.kind !== "cumulative_sum" ? void 0 : typeof frameCurrency === "string" && /^[A-Z]{3}$/.test(frameCurrency) ? frameCurrency : typeof unit === "string" && unit.startsWith("currency:") ? unit.slice("currency:".length) : void 0;
|
|
3420
3423
|
entries.push({
|
|
3421
3424
|
// displayName FIRST: description is prose meant for a human reading the
|
|
3422
3425
|
// profile, and rendering it here produced a paragraph where a label
|
|
@@ -3427,20 +3430,23 @@ function getConsumptionState(auth, executionLog, profile) {
|
|
|
3427
3430
|
window: bt.window,
|
|
3428
3431
|
field: fieldName,
|
|
3429
3432
|
kind: bt.kind === "cumulative_sum" ? "sum" : "count",
|
|
3430
|
-
of: bt.kind === "cumulative_sum" ? bt.of : void 0
|
|
3433
|
+
of: bt.kind === "cumulative_sum" ? bt.of : void 0,
|
|
3434
|
+
...currency ? { currency } : {}
|
|
3431
3435
|
});
|
|
3432
3436
|
}
|
|
3433
3437
|
return entries;
|
|
3434
3438
|
}
|
|
3435
|
-
|
|
3439
|
+
function formatSum(value, currency) {
|
|
3440
|
+
if (currency) return `${value.toFixed(2)} ${currency}`;
|
|
3441
|
+
return String(Number(value.toFixed(6)));
|
|
3442
|
+
}
|
|
3436
3443
|
function formatConsumptionCompact(entries) {
|
|
3437
3444
|
if (entries.length === 0) return "";
|
|
3438
3445
|
const parts = [];
|
|
3439
3446
|
for (const entry of entries) {
|
|
3440
3447
|
if (entry.limit === null) continue;
|
|
3441
3448
|
if (entry.kind === "sum") {
|
|
3442
|
-
|
|
3443
|
-
parts.push(`${prefix}${entry.current}/${prefix}${entry.limit} ${entry.window}`);
|
|
3449
|
+
parts.push(`${formatSum(entry.current, entry.currency)}/${formatSum(entry.limit, entry.currency)} ${entry.window}`);
|
|
3444
3450
|
} else {
|
|
3445
3451
|
parts.push(`${entry.current}/${entry.limit} ${entry.window}`);
|
|
3446
3452
|
}
|
|
@@ -3451,9 +3457,10 @@ function formatConsumptionFull(entries) {
|
|
|
3451
3457
|
if (entries.length === 0) return "";
|
|
3452
3458
|
const lines = [];
|
|
3453
3459
|
for (const entry of entries) {
|
|
3454
|
-
const limitStr = entry.limit !== null ? String(entry.limit) : "unlimited";
|
|
3460
|
+
const limitStr = entry.limit !== null ? entry.kind === "sum" ? formatSum(entry.limit, entry.currency) : String(entry.limit) : "unlimited";
|
|
3461
|
+
const currentStr = entry.kind === "sum" ? formatSum(entry.current, entry.currency) : String(entry.current);
|
|
3455
3462
|
const label = `${entry.label}:`;
|
|
3456
|
-
lines.push(` ${label.padEnd(30)} ${
|
|
3463
|
+
lines.push(` ${label.padEnd(30)} ${currentStr} / ${limitStr}`);
|
|
3457
3464
|
}
|
|
3458
3465
|
return lines.join("\n");
|
|
3459
3466
|
}
|