myio-js-library 0.1.590 → 0.1.592
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 +173 -4
- package/dist/index.d.cts +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +173 -4
- package/dist/myio-js-library.umd.js +173 -4
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -990,7 +990,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
990
990
|
// package.json
|
|
991
991
|
var package_default = {
|
|
992
992
|
name: "myio-js-library",
|
|
993
|
-
version: "0.1.
|
|
993
|
+
version: "0.1.592",
|
|
994
994
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
995
995
|
license: "MIT",
|
|
996
996
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -21716,7 +21716,7 @@ async function valuateDomainMoney(opts) {
|
|
|
21716
21716
|
const timezone = opts.timezone || TARIFF_DEFAULT_TIMEZONE;
|
|
21717
21717
|
const devices = (opts.devices || []).filter((d) => d && d.key && isMoneyConvertibleGroup(opts.domain, d.group));
|
|
21718
21718
|
const categoryByKey = /* @__PURE__ */ new Map();
|
|
21719
|
-
for (const d of devices) categoryByKey.set(d.key, resolveMoneyCategory(opts.rule, d.group));
|
|
21719
|
+
for (const d of devices) categoryByKey.set(d.key, d.category || resolveMoneyCategory(opts.rule, d.group));
|
|
21720
21720
|
const categories = Array.from(new Set(Array.from(categoryByKey.values()).filter(Boolean)));
|
|
21721
21721
|
const trees = {};
|
|
21722
21722
|
const years = yearsSpanned(opts.startTs, opts.endTs, timezone);
|
|
@@ -63427,7 +63427,8 @@ var TariffApiError = class extends Error {
|
|
|
63427
63427
|
};
|
|
63428
63428
|
function joinUrl(baseUrl, basePath, path) {
|
|
63429
63429
|
const b = baseUrl.replace(/\/+$/, "");
|
|
63430
|
-
|
|
63430
|
+
let bp = basePath ? `/${basePath.replace(/^\/+|\/+$/g, "")}` : "";
|
|
63431
|
+
if (bp && b.toLowerCase().endsWith(bp.toLowerCase())) bp = "";
|
|
63431
63432
|
const p = path.startsWith("/") ? path : `/${path}`;
|
|
63432
63433
|
return `${b}${bp}${p}`;
|
|
63433
63434
|
}
|
|
@@ -64257,6 +64258,14 @@ var DeviceProfileTab = class {
|
|
|
64257
64258
|
if (!client) throw new Error("GCDR n\xE3o configurado.");
|
|
64258
64259
|
const updated = await client.setDeviceCategory(this.gcdrDeviceId(), value || null);
|
|
64259
64260
|
this.tariff = { ...this.tariff, current: updated.id ? updated.tariffCategory : value || null };
|
|
64261
|
+
try {
|
|
64262
|
+
window.dispatchEvent(
|
|
64263
|
+
new CustomEvent("myio:tariffs-updated", {
|
|
64264
|
+
detail: { source: "device-category", deviceId: this.gcdrDeviceId(), category: value || null, ts: Date.now() }
|
|
64265
|
+
})
|
|
64266
|
+
);
|
|
64267
|
+
} catch {
|
|
64268
|
+
}
|
|
64260
64269
|
} else if (kind === "entity-label") {
|
|
64261
64270
|
await this.saveEntityField({ label: value });
|
|
64262
64271
|
} else if (kind === "entity-profile") {
|
|
@@ -180548,6 +180557,15 @@ var CSS5 = `
|
|
|
180548
180557
|
--cscard-switch-on:#2563eb;
|
|
180549
180558
|
--cscard-danger:#dc2626;
|
|
180550
180559
|
--cscard-select-ring:#7c3aed;
|
|
180560
|
+
/* health axis (GCDR RFC-0085) \u2014 ONLY the dot of the v3 badge and the
|
|
180561
|
+
"Sistema" pills. Deliberately never the border or the header wash:
|
|
180562
|
+
those two already belong to entityStatus and connectivity. */
|
|
180563
|
+
--cscard-health-ok:#22c55e;
|
|
180564
|
+
--cscard-health-warn:#f59e0b;
|
|
180565
|
+
--cscard-health-bad:#ef4444;
|
|
180566
|
+
--cscard-health-silent:#94a3b8;
|
|
180567
|
+
--cscard-health-pill-bg:#f1f5f9;
|
|
180568
|
+
--cscard-health-pill-fg:#334155;
|
|
180551
180569
|
box-sizing:border-box;
|
|
180552
180570
|
position:relative;
|
|
180553
180571
|
display:flex;flex-direction:row;
|
|
@@ -180586,6 +180604,8 @@ var CSS5 = `
|
|
|
180586
180604
|
--cscard-border-active-glow:rgba(34,197,94,.4);
|
|
180587
180605
|
--cscard-border-inactive:#475569;
|
|
180588
180606
|
--cscard-switch-off:#475569;
|
|
180607
|
+
--cscard-health-pill-bg:#1e2d45;
|
|
180608
|
+
--cscard-health-pill-fg:#cbd5e1;
|
|
180589
180609
|
}
|
|
180590
180610
|
|
|
180591
180611
|
/* \u2500\u2500 registry axis: card border follows entityStatus, not connectivity \u2500\u2500 */
|
|
@@ -180665,6 +180685,44 @@ var CSS5 = `
|
|
|
180665
180685
|
font:700 9px 'Nunito', system-ui, sans-serif;background:var(--cscard-unknown-bg);
|
|
180666
180686
|
color:var(--cscard-muted);margin-left:4px;
|
|
180667
180687
|
}
|
|
180688
|
+
|
|
180689
|
+
/* \u2500\u2500 health badge (GCDR RFC-0085): "\u25CF v3 rc14.1.24" right after the
|
|
180690
|
+
connectivity badge. The dot is the ::before so the pill's text stays the
|
|
180691
|
+
plain "v3 <firmware>" an operator scans for during a rollout; the health
|
|
180692
|
+
status lives in the dot colour only (healthy/degraded/unhealthy/silent). */
|
|
180693
|
+
.myio-cscard__health-badge{
|
|
180694
|
+
display:inline-flex;align-items:center;gap:4px;padding:1px 7px;border-radius:999px;
|
|
180695
|
+
font:800 10px 'Nunito', system-ui, sans-serif;background:var(--cscard-health-pill-bg);
|
|
180696
|
+
color:var(--cscard-health-pill-fg);margin-left:4px;white-space:nowrap;cursor:default;
|
|
180697
|
+
}
|
|
180698
|
+
.myio-cscard__health-badge::before{
|
|
180699
|
+
content:'';width:6px;height:6px;border-radius:50%;display:inline-block;flex-shrink:0;
|
|
180700
|
+
background:var(--cscard-health-silent);
|
|
180701
|
+
}
|
|
180702
|
+
.myio-cscard__health-badge--healthy::before{background:var(--cscard-health-ok);}
|
|
180703
|
+
.myio-cscard__health-badge--degraded::before{background:var(--cscard-health-warn);}
|
|
180704
|
+
.myio-cscard__health-badge--unhealthy::before{background:var(--cscard-health-bad);}
|
|
180705
|
+
.myio-cscard__health-badge--silent::before{background:var(--cscard-health-silent);}
|
|
180706
|
+
.myio-cscard__health-badge--silent{color:var(--cscard-muted);}
|
|
180707
|
+
.myio-cscard__health-mismatch{font-weight:800;margin-left:1px;}
|
|
180708
|
+
|
|
180709
|
+
/* \u2500\u2500 "Sistema" row (GCDR RFC-0085): three pills under Status \u2014 temperature
|
|
180710
|
+
(amber tint), uptime (blue tint), load (grey). Informational only (O-10:
|
|
180711
|
+
no thresholds yet), so the tints are fixed per pill, not per value. */
|
|
180712
|
+
.myio-cscard__system .myio-cscard__value{display:inline-flex;align-items:center;gap:4px;}
|
|
180713
|
+
.myio-cscard__syspill{
|
|
180714
|
+
display:inline-flex;align-items:center;gap:3px;padding:1px 7px;border-radius:999px;
|
|
180715
|
+
font:700 10px 'Nunito', system-ui, sans-serif;background:var(--cscard-health-pill-bg);
|
|
180716
|
+
color:var(--cscard-health-pill-fg);white-space:nowrap;cursor:default;
|
|
180717
|
+
}
|
|
180718
|
+
.myio-cscard__syspill--temperature{background:var(--cscard-warning-bg);color:var(--cscard-warning);}
|
|
180719
|
+
.myio-cscard__syspill--uptime{background:var(--cscard-online-bg);color:var(--cscard-online);}
|
|
180720
|
+
.myio-cscard__syspill--load{background:var(--cscard-unknown-bg);color:var(--cscard-unknown);}
|
|
180721
|
+
.myio-cscard[data-theme="dark"] .myio-cscard__syspill--temperature{color:#fbbf24;}
|
|
180722
|
+
.myio-cscard[data-theme="dark"] .myio-cscard__syspill--uptime{color:#93c5fd;}
|
|
180723
|
+
.myio-cscard[data-theme="dark"] .myio-cscard__syspill--load{color:var(--cscard-muted);}
|
|
180724
|
+
.myio-cscard--compact .myio-cscard__system{min-height:18px;padding:1px 0;}
|
|
180725
|
+
.myio-cscard--compact .myio-cscard__syspill{padding:0 6px;font-size:9.5px;}
|
|
180668
180726
|
.myio-cscard__divergence-flag{
|
|
180669
180727
|
display:inline-flex;align-items:center;justify-content:center;margin-left:4px;cursor:pointer;
|
|
180670
180728
|
font-size:11px;line-height:1;border-radius:6px;padding:1px 3px;
|
|
@@ -181172,6 +181230,11 @@ var STALE_BADGE_TEXT = {
|
|
|
181172
181230
|
pt: "desatualizado",
|
|
181173
181231
|
en: "stale"
|
|
181174
181232
|
};
|
|
181233
|
+
var DEFAULT_HEALTH_LABELS = {
|
|
181234
|
+
pt: { badge: "v3", system: "Sistema", silentSince: "sem resposta desde {when}" },
|
|
181235
|
+
en: { badge: "v3", system: "System", silentSince: "silent since {when}" }
|
|
181236
|
+
};
|
|
181237
|
+
var HEALTH_REGISTRY_WORD = { pt: "cadastro", en: "registry" };
|
|
181175
181238
|
var LATENCY_TREND_FLAT_THRESHOLD_MS = 100;
|
|
181176
181239
|
function latencyTrend(current, previous) {
|
|
181177
181240
|
if (previous == null) return null;
|
|
@@ -181238,6 +181301,30 @@ function formatDuration5(ms) {
|
|
|
181238
181301
|
const minutes = totalMin % 60;
|
|
181239
181302
|
return hours > 0 ? `${hours}h${minutes}min` : `${minutes}min`;
|
|
181240
181303
|
}
|
|
181304
|
+
function formatUptime2(seconds) {
|
|
181305
|
+
const totalMin = Math.max(0, Math.floor(seconds / 60));
|
|
181306
|
+
if (totalMin < 60) return `${totalMin}min`;
|
|
181307
|
+
const totalHours = Math.floor(totalMin / 60);
|
|
181308
|
+
if (totalHours < 24) return `${totalHours}h${String(totalMin % 60).padStart(2, "0")}`;
|
|
181309
|
+
const days = Math.floor(totalHours / 24);
|
|
181310
|
+
return `${days}d ${String(totalHours % 24).padStart(2, "0")}h`;
|
|
181311
|
+
}
|
|
181312
|
+
function formatLoad(load, language) {
|
|
181313
|
+
const fixed = load.toFixed(2);
|
|
181314
|
+
return language === "pt" ? fixed.replace(".", ",") : fixed;
|
|
181315
|
+
}
|
|
181316
|
+
function isFiniteNumber(v) {
|
|
181317
|
+
return typeof v === "number" && Number.isFinite(v);
|
|
181318
|
+
}
|
|
181319
|
+
function isHealthSilent(h3) {
|
|
181320
|
+
if (!h3.checkedAt) return false;
|
|
181321
|
+
const checked = Date.parse(h3.checkedAt);
|
|
181322
|
+
if (Number.isNaN(checked)) return false;
|
|
181323
|
+
if (!h3.successAt) return true;
|
|
181324
|
+
const success = Date.parse(h3.successAt);
|
|
181325
|
+
if (Number.isNaN(success)) return false;
|
|
181326
|
+
return checked > success;
|
|
181327
|
+
}
|
|
181241
181328
|
var CentralStatusCard = class _CentralStatusCard {
|
|
181242
181329
|
el;
|
|
181243
181330
|
params;
|
|
@@ -181348,6 +181435,85 @@ var CentralStatusCard = class _CentralStatusCard {
|
|
|
181348
181435
|
const defaults = this.language() === "en" ? DEFAULT_LABELS_EN : DEFAULT_LABELS_PT;
|
|
181349
181436
|
return { ...defaults, ...this.params.labels || {} };
|
|
181350
181437
|
}
|
|
181438
|
+
healthLabels() {
|
|
181439
|
+
return { ...DEFAULT_HEALTH_LABELS[this.language()], ...this.params.labels?.health || {} };
|
|
181440
|
+
}
|
|
181441
|
+
/**
|
|
181442
|
+
* `● v3 <firmware>` pill (GCDR RFC-0085 §5.5/§5.6) — rendered right after
|
|
181443
|
+
* the connectivity badge, ONLY when `support === 'SUPPORTED'`. The health
|
|
181444
|
+
* status lives in the dot colour (healthy/degraded/unhealthy), grey when
|
|
181445
|
+
* the last probe failed; the text is the firmware an operator scans for
|
|
181446
|
+
* during a rollout. "≠" follows the version when the registry disagrees.
|
|
181447
|
+
* It never touches data-connectivity / data-status, so the frame and the
|
|
181448
|
+
* header wash keep following their own two axes.
|
|
181449
|
+
*/
|
|
181450
|
+
healthBadgeHtml(nowMs) {
|
|
181451
|
+
const h3 = this.params.health;
|
|
181452
|
+
if (!h3 || h3.support !== "SUPPORTED") return "";
|
|
181453
|
+
const hl = this.healthLabels();
|
|
181454
|
+
const lang = this.language();
|
|
181455
|
+
const firmware = h3.firmware ? String(h3.firmware) : "";
|
|
181456
|
+
const silent = isHealthSilent(h3);
|
|
181457
|
+
const mismatch = !!(h3.registryFirmware && firmware && h3.registryFirmware !== firmware);
|
|
181458
|
+
const modifier = silent ? "silent" : h3.status ? h3.status : "";
|
|
181459
|
+
const text2 = firmware ? `${hl.badge} ${firmware}` : hl.badge;
|
|
181460
|
+
const titleParts = [hl.badge];
|
|
181461
|
+
if (!silent && h3.status) titleParts.push(h3.status);
|
|
181462
|
+
if (firmware) titleParts.push(firmware);
|
|
181463
|
+
if (mismatch) titleParts.push(`\u2260 ${HEALTH_REGISTRY_WORD[lang]} ${h3.registryFirmware}`);
|
|
181464
|
+
if (silent) titleParts.push(hl.silentSince.replace("{when}", formatSince(h3.successAt, nowMs, lang)));
|
|
181465
|
+
const title = titleParts.join(" \xB7 ");
|
|
181466
|
+
return `<span class="myio-cscard__health-badge${modifier ? ` myio-cscard__health-badge--${modifier}` : ""}" data-role="health-badge" data-health-status="${escAttr6(
|
|
181467
|
+
silent ? "silent" : h3.status || ""
|
|
181468
|
+
)}" title="${escAttr6(title)}" aria-label="${escAttr6(title)}">${escAttr6(text2)}${mismatch ? ` <span class="myio-cscard__health-mismatch" aria-hidden="true">\u2260</span>` : ""}</span>`;
|
|
181469
|
+
}
|
|
181470
|
+
/**
|
|
181471
|
+
* "Sistema" row (GCDR RFC-0085 §5.5 mock-up verdict): the three system
|
|
181472
|
+
* pills got their own row under Status because, on the Status row itself,
|
|
181473
|
+
* they squeezed the switch and the ⓘ. Each pill is omitted when its value
|
|
181474
|
+
* is null; the row is omitted when `system` is null or has nothing to show.
|
|
181475
|
+
*/
|
|
181476
|
+
systemRowHtml() {
|
|
181477
|
+
const h3 = this.params.health;
|
|
181478
|
+
if (!h3 || h3.support !== "SUPPORTED" || !h3.system) return "";
|
|
181479
|
+
const sys = h3.system;
|
|
181480
|
+
const lang = this.language();
|
|
181481
|
+
const en = lang === "en";
|
|
181482
|
+
const pills = [];
|
|
181483
|
+
if (isFiniteNumber(sys.temperatureC)) {
|
|
181484
|
+
const label = en ? "temperature" : "temperatura";
|
|
181485
|
+
pills.push(
|
|
181486
|
+
`<span class="myio-cscard__syspill myio-cscard__syspill--temperature" data-role="system-temperature" title="${escAttr6(
|
|
181487
|
+
label
|
|
181488
|
+
)}" aria-label="${escAttr6(`${label}: ${Math.round(sys.temperatureC)} \xB0C`)}">\u{1F321} ${Math.round(sys.temperatureC)} \xB0C</span>`
|
|
181489
|
+
);
|
|
181490
|
+
}
|
|
181491
|
+
if (isFiniteNumber(sys.uptimeSeconds)) {
|
|
181492
|
+
const label = "uptime";
|
|
181493
|
+
const value = formatUptime2(sys.uptimeSeconds);
|
|
181494
|
+
pills.push(
|
|
181495
|
+
`<span class="myio-cscard__syspill myio-cscard__syspill--uptime" data-role="system-uptime" title="${escAttr6(
|
|
181496
|
+
label
|
|
181497
|
+
)}" aria-label="${escAttr6(`${label}: ${value}`)}">\u23F1 ${escAttr6(value)}</span>`
|
|
181498
|
+
);
|
|
181499
|
+
}
|
|
181500
|
+
if (isFiniteNumber(sys.load1m)) {
|
|
181501
|
+
const label = en ? "load (1 min)" : "carga (1 min)";
|
|
181502
|
+
const value = formatLoad(sys.load1m, lang);
|
|
181503
|
+
pills.push(
|
|
181504
|
+
`<span class="myio-cscard__syspill myio-cscard__syspill--load" data-role="system-load" title="${escAttr6(
|
|
181505
|
+
label
|
|
181506
|
+
)}" aria-label="${escAttr6(`${label}: ${value}`)}">\u2699 ${escAttr6(value)}</span>`
|
|
181507
|
+
);
|
|
181508
|
+
}
|
|
181509
|
+
if (pills.length === 0) return "";
|
|
181510
|
+
const hl = this.healthLabels();
|
|
181511
|
+
return `<div class="myio-cscard__row myio-cscard__system">
|
|
181512
|
+
${this.iconHtml("system", "\u{1F9E9}")}
|
|
181513
|
+
<span class="myio-cscard__label">${escAttr6(hl.system)}</span>
|
|
181514
|
+
<span class="myio-cscard__value">${pills.join("")}</span>
|
|
181515
|
+
</div>`;
|
|
181516
|
+
}
|
|
181351
181517
|
/**
|
|
181352
181518
|
* Icon markup for a decorative row icon. Icons are never the sole semantic
|
|
181353
181519
|
* signal (see "Icons are decorative, not semantic") — every row still shows
|
|
@@ -181675,6 +181841,8 @@ var CentralStatusCard = class _CentralStatusCard {
|
|
|
181675
181841
|
const probeText = probe ? `${escAttr6(probe.label)}${probe.latencyMs != null ? ` <span class="myio-cscard__muted">${probe.latencyMs}ms</span>${latencyTrendHtml}` : ""}` : null;
|
|
181676
181842
|
const statusChecked = p.entityStatus === "ACTIVE";
|
|
181677
181843
|
const statusDisabled = this.statusBusy || !!p.statusReadonly;
|
|
181844
|
+
const healthBadgeHtml = this.healthBadgeHtml(nowMs);
|
|
181845
|
+
const systemRowHtml = this.systemRowHtml();
|
|
181678
181846
|
const compactEvidenceLine = variant === "compact" ? `<div class="myio-cscard__evidence-line">${devicesText ? escAttr6(devicesText) : ""}${probeText ? (devicesText ? " \xB7 " : "") + probeText : ""}</div>` : "";
|
|
181679
181847
|
this.el.innerHTML = `
|
|
181680
181848
|
${alarmBadgeHtml}
|
|
@@ -181695,7 +181863,7 @@ var CentralStatusCard = class _CentralStatusCard {
|
|
|
181695
181863
|
<span class="myio-cscard__label">${escAttr6(l.connectivity)}</span>
|
|
181696
181864
|
<span class="myio-cscard__badge myio-cscard__badge--${connectivity}" role="status">${escAttr6(
|
|
181697
181865
|
connLabel
|
|
181698
|
-
)}</span>${staleBadge}${divergenceFlagHtml}
|
|
181866
|
+
)}</span>${healthBadgeHtml}${staleBadge}${divergenceFlagHtml}
|
|
181699
181867
|
</div>
|
|
181700
181868
|
|
|
181701
181869
|
<div class="myio-cscard__row myio-cscard__monitoring">
|
|
@@ -181748,6 +181916,7 @@ var CentralStatusCard = class _CentralStatusCard {
|
|
|
181748
181916
|
)}</span>
|
|
181749
181917
|
${this.statusError ? `<span class="myio-cscard__err" role="alert" aria-live="assertive">${escAttr6(this.statusError)}</span>` : `<span class="myio-cscard__err" role="alert" aria-live="assertive" hidden></span>`}
|
|
181750
181918
|
</div>
|
|
181919
|
+
${systemRowHtml}
|
|
181751
181920
|
</section>
|
|
181752
181921
|
</div>
|
|
181753
181922
|
</div>
|
package/dist/index.d.cts
CHANGED
|
@@ -17174,6 +17174,11 @@ interface MoneyDevice {
|
|
|
17174
17174
|
key: string;
|
|
17175
17175
|
/** Dashboard group (`lojas`, `areacomum`, `entrada`, …). */
|
|
17176
17176
|
group: string;
|
|
17177
|
+
/**
|
|
17178
|
+
* Tariff category of the device itself (GCDR `device.tariffCategory`, RFC-0081). When set it
|
|
17179
|
+
* wins over `rule`; empty → falls back to the rule. Non-convertible groups (Q8) stay physical.
|
|
17180
|
+
*/
|
|
17181
|
+
category?: string | null;
|
|
17177
17182
|
}
|
|
17178
17183
|
type QtyMap = Map<string, number> | Record<string, number>;
|
|
17179
17184
|
interface ValuateDomainOptions {
|
|
@@ -29726,6 +29731,47 @@ interface CentralDivergence {
|
|
|
29726
29731
|
/** Worker-proposed status. */
|
|
29727
29732
|
proposed: string;
|
|
29728
29733
|
}
|
|
29734
|
+
/** `health_support` of GCDR RFC-0085 — whether the central answers `/v3/health`. */
|
|
29735
|
+
type CentralHealthSupport = 'SUPPORTED' | 'UNSUPPORTED' | 'UNREACHABLE' | 'UNKNOWN';
|
|
29736
|
+
/** `status` of the `/v3/health` body — drives the dot colour of the v3 badge. */
|
|
29737
|
+
type CentralHealthStatus = 'healthy' | 'degraded' | 'unhealthy';
|
|
29738
|
+
/** `system.*` of the last health snapshot — the three "Sistema" pills. */
|
|
29739
|
+
interface CentralHealthSystem {
|
|
29740
|
+
/** SoC temperature in °C — rendered as an integer, e.g. "63 °C". */
|
|
29741
|
+
temperatureC?: number | null;
|
|
29742
|
+
/** Seconds since boot — rendered as "12min" / "15h48" / "3d 02h". */
|
|
29743
|
+
uptimeSeconds?: number | null;
|
|
29744
|
+
/** 1-minute load average — two decimals in the card's locale ("0,83" pt / "0.83" en). */
|
|
29745
|
+
load1m?: number | null;
|
|
29746
|
+
}
|
|
29747
|
+
/**
|
|
29748
|
+
* Health probe of GCDR RFC-0085 (amendment to RFC-0231). Nothing is rendered
|
|
29749
|
+
* unless `support === 'SUPPORTED'` — absence IS the signal: on a list of
|
|
29750
|
+
* cards, "the ones with a second badge are on the new build". The badge
|
|
29751
|
+
* never colours the card frame or the header (those are the two existing
|
|
29752
|
+
* axes: border = entityStatus, header wash + badge = connectivity).
|
|
29753
|
+
*/
|
|
29754
|
+
interface CentralHealthInfo {
|
|
29755
|
+
support: CentralHealthSupport;
|
|
29756
|
+
/** Dot colour: green `healthy`, amber `degraded`, red `unhealthy`. */
|
|
29757
|
+
status?: CentralHealthStatus | null;
|
|
29758
|
+
/** Firmware reported by the central — badge text "v3 rc14.1.24" (just "v3" when null). */
|
|
29759
|
+
firmware?: string | null;
|
|
29760
|
+
/** Firmware of the registry — when set and different from `firmware`, a "≠" follows the version and both go in the title. */
|
|
29761
|
+
registryFirmware?: string | null;
|
|
29762
|
+
/** ISO — last probe attempt. */
|
|
29763
|
+
checkedAt?: string | null;
|
|
29764
|
+
/** ISO — last OK probe. `checkedAt` later than `successAt` = last probe failed → grey dot + "silent since" title. */
|
|
29765
|
+
successAt?: string | null;
|
|
29766
|
+
/** "Sistema" row under Status; hidden when null. */
|
|
29767
|
+
system?: CentralHealthSystem | null;
|
|
29768
|
+
}
|
|
29769
|
+
/** i18n of the health badge + "Sistema" row. `{when}` is interpolated in `silentSince`. */
|
|
29770
|
+
interface CentralStatusCardHealthLabels {
|
|
29771
|
+
badge?: string;
|
|
29772
|
+
system?: string;
|
|
29773
|
+
silentSince?: string;
|
|
29774
|
+
}
|
|
29729
29775
|
/**
|
|
29730
29776
|
* Worker/history vocabulary (`orchestrator_devices_status_history`) —
|
|
29731
29777
|
* DELIBERATELY NOT the same union as `CentralConnectivity` (ONLINE/OFFLINE/
|
|
@@ -29853,6 +29899,7 @@ interface CentralStatusCardLabels {
|
|
|
29853
29899
|
reportButton?: string;
|
|
29854
29900
|
settingsButton?: string;
|
|
29855
29901
|
selectCheckbox?: string;
|
|
29902
|
+
health?: CentralStatusCardHealthLabels;
|
|
29856
29903
|
}
|
|
29857
29904
|
/**
|
|
29858
29905
|
* Event passed to onMonitoringToggle. `next` is the requested state, `previous`
|
|
@@ -29955,6 +30002,13 @@ interface CreateCentralStatusCardParams {
|
|
|
29955
30002
|
showDivergence?: boolean;
|
|
29956
30003
|
/** Show the 🔄 force-sync button (default: false; cockpit passes true). */
|
|
29957
30004
|
showForceSync?: boolean;
|
|
30005
|
+
/**
|
|
30006
|
+
* Health probe of GCDR RFC-0085: `● v3 <firmware>` badge next to the
|
|
30007
|
+
* connectivity badge + a "Sistema" row (🌡 temp · ⏱ uptime · ⚙ load) right
|
|
30008
|
+
* under Status. Rendered ONLY when `support === 'SUPPORTED'`; omit (or pass
|
|
30009
|
+
* any other `support`) to keep today's look. Never colours the frame.
|
|
30010
|
+
*/
|
|
30011
|
+
health?: CentralHealthInfo | null;
|
|
29958
30012
|
/**
|
|
29959
30013
|
* Wires the 📈 timeline button next to Monitoramento — opens a modal with a
|
|
29960
30014
|
* period selector (24h/7d/30d/90d), a stacked connectivity bar, and the raw
|
|
@@ -29986,7 +30040,7 @@ interface CreateCentralStatusCardParams {
|
|
|
29986
30040
|
* are NEVER the sole semantic signal (see Accessibility / "icons are
|
|
29987
30041
|
* decorative"). Omit to use the theme defaults; pass `false`/'' to render none.
|
|
29988
30042
|
*/
|
|
29989
|
-
icons?: Partial<Record<'connectivity' | 'monitoring' | 'status' | 'forceSync' | 'lastAttempt' | 'lastSuccess' | 'probe' | 'devices' | 'divergence' | 'timeline' | 'dashboard' | 'report' | 'settings', string | HTMLElement | false>>;
|
|
30043
|
+
icons?: Partial<Record<'connectivity' | 'monitoring' | 'status' | 'forceSync' | 'lastAttempt' | 'lastSuccess' | 'probe' | 'devices' | 'divergence' | 'timeline' | 'dashboard' | 'report' | 'settings' | 'system', string | HTMLElement | false>>;
|
|
29990
30044
|
/** Persist the Monitoramento flag (boolean: next = true means monitoring ON). */
|
|
29991
30045
|
onMonitoringToggle?: (e: CentralMonitoringToggleEvent) => Promise<void>;
|
|
29992
30046
|
/** Persist the Status flag ('ACTIVE' | 'INACTIVE' string union — never a boolean). */
|
package/dist/index.d.ts
CHANGED
|
@@ -17174,6 +17174,11 @@ interface MoneyDevice {
|
|
|
17174
17174
|
key: string;
|
|
17175
17175
|
/** Dashboard group (`lojas`, `areacomum`, `entrada`, …). */
|
|
17176
17176
|
group: string;
|
|
17177
|
+
/**
|
|
17178
|
+
* Tariff category of the device itself (GCDR `device.tariffCategory`, RFC-0081). When set it
|
|
17179
|
+
* wins over `rule`; empty → falls back to the rule. Non-convertible groups (Q8) stay physical.
|
|
17180
|
+
*/
|
|
17181
|
+
category?: string | null;
|
|
17177
17182
|
}
|
|
17178
17183
|
type QtyMap = Map<string, number> | Record<string, number>;
|
|
17179
17184
|
interface ValuateDomainOptions {
|
|
@@ -29726,6 +29731,47 @@ interface CentralDivergence {
|
|
|
29726
29731
|
/** Worker-proposed status. */
|
|
29727
29732
|
proposed: string;
|
|
29728
29733
|
}
|
|
29734
|
+
/** `health_support` of GCDR RFC-0085 — whether the central answers `/v3/health`. */
|
|
29735
|
+
type CentralHealthSupport = 'SUPPORTED' | 'UNSUPPORTED' | 'UNREACHABLE' | 'UNKNOWN';
|
|
29736
|
+
/** `status` of the `/v3/health` body — drives the dot colour of the v3 badge. */
|
|
29737
|
+
type CentralHealthStatus = 'healthy' | 'degraded' | 'unhealthy';
|
|
29738
|
+
/** `system.*` of the last health snapshot — the three "Sistema" pills. */
|
|
29739
|
+
interface CentralHealthSystem {
|
|
29740
|
+
/** SoC temperature in °C — rendered as an integer, e.g. "63 °C". */
|
|
29741
|
+
temperatureC?: number | null;
|
|
29742
|
+
/** Seconds since boot — rendered as "12min" / "15h48" / "3d 02h". */
|
|
29743
|
+
uptimeSeconds?: number | null;
|
|
29744
|
+
/** 1-minute load average — two decimals in the card's locale ("0,83" pt / "0.83" en). */
|
|
29745
|
+
load1m?: number | null;
|
|
29746
|
+
}
|
|
29747
|
+
/**
|
|
29748
|
+
* Health probe of GCDR RFC-0085 (amendment to RFC-0231). Nothing is rendered
|
|
29749
|
+
* unless `support === 'SUPPORTED'` — absence IS the signal: on a list of
|
|
29750
|
+
* cards, "the ones with a second badge are on the new build". The badge
|
|
29751
|
+
* never colours the card frame or the header (those are the two existing
|
|
29752
|
+
* axes: border = entityStatus, header wash + badge = connectivity).
|
|
29753
|
+
*/
|
|
29754
|
+
interface CentralHealthInfo {
|
|
29755
|
+
support: CentralHealthSupport;
|
|
29756
|
+
/** Dot colour: green `healthy`, amber `degraded`, red `unhealthy`. */
|
|
29757
|
+
status?: CentralHealthStatus | null;
|
|
29758
|
+
/** Firmware reported by the central — badge text "v3 rc14.1.24" (just "v3" when null). */
|
|
29759
|
+
firmware?: string | null;
|
|
29760
|
+
/** Firmware of the registry — when set and different from `firmware`, a "≠" follows the version and both go in the title. */
|
|
29761
|
+
registryFirmware?: string | null;
|
|
29762
|
+
/** ISO — last probe attempt. */
|
|
29763
|
+
checkedAt?: string | null;
|
|
29764
|
+
/** ISO — last OK probe. `checkedAt` later than `successAt` = last probe failed → grey dot + "silent since" title. */
|
|
29765
|
+
successAt?: string | null;
|
|
29766
|
+
/** "Sistema" row under Status; hidden when null. */
|
|
29767
|
+
system?: CentralHealthSystem | null;
|
|
29768
|
+
}
|
|
29769
|
+
/** i18n of the health badge + "Sistema" row. `{when}` is interpolated in `silentSince`. */
|
|
29770
|
+
interface CentralStatusCardHealthLabels {
|
|
29771
|
+
badge?: string;
|
|
29772
|
+
system?: string;
|
|
29773
|
+
silentSince?: string;
|
|
29774
|
+
}
|
|
29729
29775
|
/**
|
|
29730
29776
|
* Worker/history vocabulary (`orchestrator_devices_status_history`) —
|
|
29731
29777
|
* DELIBERATELY NOT the same union as `CentralConnectivity` (ONLINE/OFFLINE/
|
|
@@ -29853,6 +29899,7 @@ interface CentralStatusCardLabels {
|
|
|
29853
29899
|
reportButton?: string;
|
|
29854
29900
|
settingsButton?: string;
|
|
29855
29901
|
selectCheckbox?: string;
|
|
29902
|
+
health?: CentralStatusCardHealthLabels;
|
|
29856
29903
|
}
|
|
29857
29904
|
/**
|
|
29858
29905
|
* Event passed to onMonitoringToggle. `next` is the requested state, `previous`
|
|
@@ -29955,6 +30002,13 @@ interface CreateCentralStatusCardParams {
|
|
|
29955
30002
|
showDivergence?: boolean;
|
|
29956
30003
|
/** Show the 🔄 force-sync button (default: false; cockpit passes true). */
|
|
29957
30004
|
showForceSync?: boolean;
|
|
30005
|
+
/**
|
|
30006
|
+
* Health probe of GCDR RFC-0085: `● v3 <firmware>` badge next to the
|
|
30007
|
+
* connectivity badge + a "Sistema" row (🌡 temp · ⏱ uptime · ⚙ load) right
|
|
30008
|
+
* under Status. Rendered ONLY when `support === 'SUPPORTED'`; omit (or pass
|
|
30009
|
+
* any other `support`) to keep today's look. Never colours the frame.
|
|
30010
|
+
*/
|
|
30011
|
+
health?: CentralHealthInfo | null;
|
|
29958
30012
|
/**
|
|
29959
30013
|
* Wires the 📈 timeline button next to Monitoramento — opens a modal with a
|
|
29960
30014
|
* period selector (24h/7d/30d/90d), a stacked connectivity bar, and the raw
|
|
@@ -29986,7 +30040,7 @@ interface CreateCentralStatusCardParams {
|
|
|
29986
30040
|
* are NEVER the sole semantic signal (see Accessibility / "icons are
|
|
29987
30041
|
* decorative"). Omit to use the theme defaults; pass `false`/'' to render none.
|
|
29988
30042
|
*/
|
|
29989
|
-
icons?: Partial<Record<'connectivity' | 'monitoring' | 'status' | 'forceSync' | 'lastAttempt' | 'lastSuccess' | 'probe' | 'devices' | 'divergence' | 'timeline' | 'dashboard' | 'report' | 'settings', string | HTMLElement | false>>;
|
|
30043
|
+
icons?: Partial<Record<'connectivity' | 'monitoring' | 'status' | 'forceSync' | 'lastAttempt' | 'lastSuccess' | 'probe' | 'devices' | 'divergence' | 'timeline' | 'dashboard' | 'report' | 'settings' | 'system', string | HTMLElement | false>>;
|
|
29990
30044
|
/** Persist the Monitoramento flag (boolean: next = true means monitoring ON). */
|
|
29991
30045
|
onMonitoringToggle?: (e: CentralMonitoringToggleEvent) => Promise<void>;
|
|
29992
30046
|
/** Persist the Status flag ('ACTIVE' | 'INACTIVE' string union — never a boolean). */
|