Project native FreeBSD packages, interfaces, hardware and login observations

This commit is contained in:
2026-11-19 20:06:56 +01:00
parent d05caf6fd3
commit b7d9046996
3 changed files with 47 additions and 1 deletions
+9 -1
View File
@@ -14,7 +14,15 @@ function values(value: unknown) {
return Array.isArray(value) ? value.flatMap(value => text(value) ?? []) : [];
}
function observation(device: RecordValue, name: string) {
function observation(device: RecordValue, name: string): RecordValue | undefined {
if (device.source_id === 'opnsense.base') {
const inv = object(device.inventory);
if (name === 'hardware' || name === 'os') return { data: inv.hardware };
const report = object(inv[name]);
if (report.status === 'ok' || report.status === 'partial')
return { data: report.entries, truncated: report.status === 'partial' };
return undefined;
}
const observations = object(device.inventory).observations;
return Array.isArray(observations) ? observations.map(object).find(item =>
item.quality === 'valid' && (item.scope === 'linux.' + name || item.scope === 'windows.' + name)