systeminformation 6.0.0-beta.0 → 6.0.0-beta.2

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.
@@ -458,11 +458,19 @@ export type OsData = {
458
458
  servicepack: string;
459
459
  uefi: boolean;
460
460
  installDate: Date | null;
461
+ lastUpdate: Date | null;
461
462
  displayServer: string;
463
+ awake: boolean;
464
+ hwAcceleration: string[];
462
465
  hypervizor?: boolean;
463
466
  remoteSession?: boolean;
464
467
  hypervisor?: boolean;
465
468
  };
469
+ export type InetPublicIpData = {
470
+ ip4: string;
471
+ ip6: string;
472
+ ms: number;
473
+ };
466
474
  export type UuidData = {
467
475
  os: string;
468
476
  hardware: string;
@@ -476,33 +484,56 @@ export type VersionData = {
476
484
  systemOpensslLib?: string;
477
485
  node?: string;
478
486
  v8?: string;
479
- npm?: string;
480
- yarn?: string;
481
- pm2?: string;
482
- gulp?: string;
483
- grunt?: string;
487
+ angular?: string;
488
+ apache?: string;
489
+ bash?: string;
490
+ bun?: string;
491
+ cargo?: string;
492
+ composer?: string;
493
+ curl?: string;
494
+ deno?: string;
495
+ docker?: string;
496
+ dockerCompose?: string;
497
+ dotnet?: string;
498
+ fish?: string;
499
+ gcc?: string;
484
500
  git?: string;
485
- tsc?: string;
486
- mysql?: string;
487
- redis?: string;
501
+ go?: string;
502
+ gradle?: string;
503
+ grunt?: string;
504
+ gulp?: string;
505
+ herd?: string;
506
+ homebrew?: string;
507
+ java?: string;
508
+ laravel?: string;
509
+ maven?: string;
488
510
  mongodb?: string;
511
+ mysql?: string;
489
512
  nginx?: string;
513
+ npm?: string;
514
+ perl?: string;
490
515
  php?: string;
491
- docker?: string;
516
+ pip?: string;
517
+ pip3?: string;
518
+ pm2?: string;
519
+ podman?: string;
492
520
  postfix?: string;
493
521
  postgresql?: string;
494
- perl?: string;
522
+ powershell?: string;
495
523
  python?: string;
496
524
  python3?: string;
497
- pip?: string;
498
- pip3?: string;
499
- java?: string;
500
- gcc?: string;
525
+ rails?: string;
526
+ redis?: string;
527
+ ruby?: string;
528
+ rust?: string;
529
+ sqlite3?: string;
530
+ tsc?: string;
531
+ vi?: string;
532
+ vim?: string;
501
533
  virtualbox?: string;
502
- dotnet?: string;
503
- composer?: string;
504
- herd?: string;
505
- laravel?: string;
534
+ vue?: string;
535
+ yarn?: string;
536
+ zsh?: string;
506
537
  };
507
538
  export type SystemData = {
508
539
  manufacturer: string;
@@ -573,6 +604,7 @@ export type FsBlockDevicesData = {
573
604
  size: number;
574
605
  physical: string;
575
606
  uuid: string;
607
+ guid: string;
576
608
  label: string;
577
609
  model: string;
578
610
  serial: string;
@@ -1 +1,2 @@
1
+ export declare const parseLastUpdate: (stdout: string) => Date | null;
1
2
  export declare const osInfo: () => Promise<import("../common/types").OsData>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.osInfo = void 0;
3
+ exports.osInfo = exports.parseLastUpdate = void 0;
4
4
  const common_1 = require("../common");
5
5
  const codepage_1 = require("../common/codepage");
6
6
  const defaults_1 = require("../common/defaults");
@@ -16,10 +16,35 @@ const getInstallDate = async () => {
16
16
  return null;
17
17
  }
18
18
  };
19
+ const parseLastUpdate = (stdout) => {
20
+ let date = null;
21
+ (stdout || '').split('</dict>').forEach((entry) => {
22
+ const name = entry.match(/<key>displayName<\/key>\s*<string>([^<]*)<\/string>/);
23
+ const value = entry.match(/<key>date<\/key>\s*<date>([^<]*)<\/date>/);
24
+ if (!name || !value || !/^macOS\b/i.test(name[1].trim())) {
25
+ return;
26
+ }
27
+ const entryDate = new Date(value[1]);
28
+ if (!Number.isNaN(entryDate.getTime()) && (!date || entryDate.getTime() > date.getTime())) {
29
+ date = entryDate;
30
+ }
31
+ });
32
+ return date;
33
+ };
34
+ exports.parseLastUpdate = parseLastUpdate;
35
+ const getLastUpdate = async () => {
36
+ const { stdout } = await (0, exec_1.execSave)('plutil -convert xml1 -o - /Library/Receipts/InstallHistory.plist 2>/dev/null');
37
+ return (0, exports.parseLastUpdate)(stdout || '');
38
+ };
19
39
  const getDisplayServer = async () => {
20
40
  const { stdout } = await (0, exec_1.execSave)('pgrep WindowServer 2>/dev/null');
21
41
  return (stdout || '').trim() ? 'quartz' : '';
22
42
  };
43
+ const getAwake = async () => {
44
+ const { stdout } = await (0, exec_1.execSave)('pmset -g systemstate 2>/dev/null');
45
+ const line = (stdout || '').split('\n').find((l) => l.toLowerCase().includes('system capabilities'));
46
+ return line ? line.includes('Graphics') : true;
47
+ };
23
48
  const getCodename = (release) => {
24
49
  let codename = 'macOS';
25
50
  switch (true) {
@@ -77,6 +102,9 @@ const getCodename = (release) => {
77
102
  case release.startsWith('26.'):
78
103
  codename = 'Tahoe';
79
104
  break;
105
+ case release.startsWith('27.'):
106
+ codename = 'Golden Gate';
107
+ break;
80
108
  default:
81
109
  codename = 'macOS';
82
110
  }
@@ -101,7 +129,9 @@ const osInfo = async () => {
101
129
  uefi: true,
102
130
  codepage: (0, codepage_1.getCodepage)(),
103
131
  installDate: await getInstallDate(),
104
- displayServer: await getDisplayServer()
132
+ lastUpdate: await getLastUpdate(),
133
+ displayServer: await getDisplayServer(),
134
+ awake: await getAwake()
105
135
  };
106
136
  }
107
137
  catch { }
@@ -32,7 +32,7 @@ export declare const getDynamicData: (srv?: string, iface?: string) => Promise<{
32
32
  uptime: number;
33
33
  timezone: string;
34
34
  timezoneName: string;
35
- };
35
+ } | null;
36
36
  node: string;
37
37
  v8: string;
38
38
  cpuCurrentSpeed: import("./common/types").CpuCurrentSpeedObject;
@@ -60,7 +60,7 @@ export declare const getAllData: (srv?: string, iface?: string) => Promise<{
60
60
  uptime: number;
61
61
  timezone: string;
62
62
  timezoneName: string;
63
- };
63
+ } | null;
64
64
  node: string;
65
65
  v8: string;
66
66
  cpuCurrentSpeed: import("./common/types").CpuCurrentSpeedObject;
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export { getStaticData, getDynamicData, getAllData } from './get-data';
25
25
  export { gpu } from './gpu';
26
26
  export { inetChecksite } from './inet-checksite';
27
27
  export { inetLatency } from './inet-latency';
28
+ export { inetPublicIp } from './inet-public-ip';
28
29
  export { keyboard } from './keyboard';
29
30
  export { mem } from './mem';
30
31
  export { memLayout } from './mem-layout';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printer = exports.pci = exports.osInfo = exports.observe = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.getAllData = exports.getDynamicData = exports.getStaticData = exports.get = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
4
- exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = void 0;
3
+ exports.pci = exports.osInfo = exports.observe = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetPublicIp = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.getAllData = exports.getDynamicData = exports.getStaticData = exports.get = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
4
+ exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = void 0;
5
5
  var audio_1 = require("./audio");
6
6
  Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
7
7
  var baseboard_1 = require("./baseboard");
@@ -64,6 +64,8 @@ var inet_checksite_1 = require("./inet-checksite");
64
64
  Object.defineProperty(exports, "inetChecksite", { enumerable: true, get: function () { return inet_checksite_1.inetChecksite; } });
65
65
  var inet_latency_1 = require("./inet-latency");
66
66
  Object.defineProperty(exports, "inetLatency", { enumerable: true, get: function () { return inet_latency_1.inetLatency; } });
67
+ var inet_public_ip_1 = require("./inet-public-ip");
68
+ Object.defineProperty(exports, "inetPublicIp", { enumerable: true, get: function () { return inet_public_ip_1.inetPublicIp; } });
67
69
  var keyboard_1 = require("./keyboard");
68
70
  Object.defineProperty(exports, "keyboard", { enumerable: true, get: function () { return keyboard_1.keyboard; } });
69
71
  var mem_1 = require("./mem");
@@ -0,0 +1,2 @@
1
+ import type { InetPublicIpData } from './common/types';
2
+ export declare const inetPublicIp: (timeout?: number) => Promise<InetPublicIpData>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inetPublicIp = void 0;
4
+ const common_1 = require("./common");
5
+ const internet_1 = require("./common/internet");
6
+ const inetPublicIp = async (timeout) => {
7
+ await (0, common_1.nextTick)();
8
+ return (0, internet_1.publicIp)(timeout);
9
+ };
10
+ exports.inetPublicIp = inetPublicIp;
@@ -1,2 +1,15 @@
1
1
  import { GpuData } from '../common/types';
2
+ type DrmMetrics = {
3
+ busAddress: string;
4
+ utilizationGpu: number | null;
5
+ memoryTotal: number | null;
6
+ memoryUsed: number | null;
7
+ temperatureGpu: number | null;
8
+ powerDraw: number | null;
9
+ powerLimit: number | null;
10
+ clockCore: number | null;
11
+ };
12
+ export declare const drmDevices: (drmPath?: string) => Promise<DrmMetrics[]>;
13
+ export declare const mergeControllerDrm: (controller: GpuData, drm?: DrmMetrics) => GpuData;
2
14
  export declare const gpu: () => Promise<GpuData[]>;
15
+ export {};
package/dist/linux/gpu.js CHANGED
@@ -1,11 +1,117 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gpu = void 0;
3
+ exports.gpu = exports.mergeControllerDrm = exports.drmDevices = void 0;
4
+ const promises_1 = require("fs/promises");
4
5
  const common_1 = require("../common");
5
6
  const const_1 = require("../common/const");
6
7
  const exec_1 = require("../common/exec");
7
8
  const nvidia_1 = require("../common/nvidia");
8
9
  const raspberry_1 = require("../common/raspberry");
10
+ const readSysfs = async (file) => {
11
+ try {
12
+ return (await (0, promises_1.readFile)(file, 'utf8')).trim();
13
+ }
14
+ catch {
15
+ return '';
16
+ }
17
+ };
18
+ const readSysfsNumber = async (files, divisor = 1) => {
19
+ for (const file of files) {
20
+ const value = Number.parseFloat(await readSysfs(file));
21
+ if (!Number.isNaN(value)) {
22
+ return value / divisor;
23
+ }
24
+ }
25
+ return null;
26
+ };
27
+ const parseAmdClock = (stdout) => {
28
+ const line = stdout.split('\n').find((l) => l.includes('*'));
29
+ const value = line ? Number.parseFloat(line.replace(/^\d+:\s*/, '')) : Number.NaN;
30
+ return Number.isNaN(value) ? null : value;
31
+ };
32
+ const drmDevices = async (drmPath = '/sys/class/drm') => {
33
+ const devices = [];
34
+ let cards = [];
35
+ try {
36
+ cards = (await (0, promises_1.readdir)(drmPath)).filter((entry) => /^card\d+$/.test(entry));
37
+ }
38
+ catch {
39
+ return devices;
40
+ }
41
+ for (const card of cards) {
42
+ const cardPath = `${drmPath}/${card}`;
43
+ const devicePath = `${cardPath}/device`;
44
+ let busAddress = '';
45
+ try {
46
+ busAddress = ((await (0, promises_1.readlink)(devicePath)).split('/').pop() || '').replace(/^0000:/, '');
47
+ }
48
+ catch {
49
+ continue;
50
+ }
51
+ if (!/^[\da-f]{2}:[\da-f]{2}\.[\da-f]$/i.test(busAddress)) {
52
+ continue;
53
+ }
54
+ let hwmon = [];
55
+ try {
56
+ hwmon = (await (0, promises_1.readdir)(`${devicePath}/hwmon`)).map((node) => `${devicePath}/hwmon/${node}`);
57
+ }
58
+ catch { }
59
+ const clockCore = await readSysfsNumber([
60
+ `${cardPath}/gt_act_freq_mhz`,
61
+ `${cardPath}/gt_cur_freq_mhz`,
62
+ `${cardPath}/gt/gt0/rps_act_freq_mhz`,
63
+ `${devicePath}/tile0/gt0/freq0/act_freq`,
64
+ `${devicePath}/tile0/gt0/freq0/cur_freq`
65
+ ]);
66
+ devices.push({
67
+ busAddress,
68
+ utilizationGpu: await readSysfsNumber([`${devicePath}/gpu_busy_percent`]),
69
+ memoryTotal: await readSysfsNumber([`${devicePath}/mem_info_vram_total`], 1024 * 1024),
70
+ memoryUsed: await readSysfsNumber([`${devicePath}/mem_info_vram_used`], 1024 * 1024),
71
+ temperatureGpu: await readSysfsNumber(hwmon.map((node) => `${node}/temp1_input`), 1000),
72
+ powerDraw: await readSysfsNumber(hwmon.map((node) => `${node}/power1_input`), 1000000),
73
+ powerLimit: await readSysfsNumber(hwmon.map((node) => `${node}/power1_max`), 1000000),
74
+ clockCore: clockCore !== null ? clockCore : parseAmdClock(await readSysfs(`${devicePath}/pp_dpm_sclk`))
75
+ });
76
+ }
77
+ return devices;
78
+ };
79
+ exports.drmDevices = drmDevices;
80
+ const mergeControllerDrm = (controller, drm) => {
81
+ if (!drm) {
82
+ return controller;
83
+ }
84
+ if (controller.utilizationGpu === undefined && drm.utilizationGpu !== null) {
85
+ controller.utilizationGpu = drm.utilizationGpu;
86
+ }
87
+ if (controller.memoryTotal === undefined && drm.memoryTotal) {
88
+ controller.memoryTotal = drm.memoryTotal;
89
+ if (controller.vram === null) {
90
+ controller.vram = drm.memoryTotal;
91
+ controller.vramDynamic = false;
92
+ }
93
+ }
94
+ if (controller.memoryUsed === undefined && drm.memoryUsed !== null) {
95
+ controller.memoryUsed = drm.memoryUsed;
96
+ if (controller.memoryFree === undefined && drm.memoryTotal) {
97
+ controller.memoryFree = drm.memoryTotal - drm.memoryUsed;
98
+ }
99
+ }
100
+ if (controller.temperatureGpu === undefined && drm.temperatureGpu !== null) {
101
+ controller.temperatureGpu = drm.temperatureGpu;
102
+ }
103
+ if (controller.powerDraw === undefined && drm.powerDraw !== null) {
104
+ controller.powerDraw = drm.powerDraw;
105
+ }
106
+ if (controller.powerLimit === undefined && drm.powerLimit !== null) {
107
+ controller.powerLimit = drm.powerLimit;
108
+ }
109
+ if (controller.clockCore === undefined && drm.clockCore !== null) {
110
+ controller.clockCore = drm.clockCore;
111
+ }
112
+ return controller;
113
+ };
114
+ exports.mergeControllerDrm = mergeControllerDrm;
9
115
  const parseLinesLinuxControllers = async (lines) => {
10
116
  const controllers = [];
11
117
  let currentController = {
@@ -258,6 +364,10 @@ const gpu = async () => {
258
364
  return (0, nvidia_1.mergeControllerNvidia)(controller, nvidiaData.find((contr) => contr.pciBus && controller.busAddress && contr.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {});
259
365
  });
260
366
  }
367
+ const drmData = await (0, exports.drmDevices)();
368
+ if (drmData.length) {
369
+ result = result.map((controller) => (0, exports.mergeControllerDrm)(controller, drmData.find((device) => controller.busAddress && device.busAddress.toLowerCase() === controller.busAddress.toLowerCase())));
370
+ }
261
371
  try {
262
372
  ({ stdout } = await (0, exec_1.execSave)('clinfo --raw'));
263
373
  const lines = stdout.split('\n');
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.osInfo = void 0;
4
- const exec_1 = require("../common/exec");
5
- const defaults_1 = require("../common/defaults");
6
- const mappings_1 = require("../common/mappings");
7
4
  const common_1 = require("../common");
8
- const uuid_1 = require("./uuid");
9
5
  const codepage_1 = require("../common/codepage");
10
- const files_1 = require("../common/files");
11
6
  const const_1 = require("../common/const");
7
+ const defaults_1 = require("../common/defaults");
8
+ const exec_1 = require("../common/exec");
9
+ const files_1 = require("../common/files");
10
+ const mappings_1 = require("../common/mappings");
11
+ const uuid_1 = require("./uuid");
12
12
  const getInstallDate = async () => {
13
13
  try {
14
14
  const { stdout } = await (0, exec_1.exec)('stat -c %W / 2>/dev/null', const_1.execOptsLinux);
@@ -38,6 +38,15 @@ const getInstallDate = async () => {
38
38
  catch { }
39
39
  return null;
40
40
  };
41
+ const getLastUpdate = async () => {
42
+ const paths = '/var/log/apt/history.log /var/log/dpkg.log /var/lib/rpm/rpmdb.sqlite /var/lib/rpm/Packages /var/log/dnf.rpm.log /var/log/yum.log /var/log/zypp/history /var/log/pacman.log /lib/apk/db/installed /var/db/pkg';
43
+ const { stdout } = await (0, exec_1.execSave)(`stat -c %Y ${paths} 2>/dev/null`, const_1.execOptsLinux);
44
+ const times = (stdout || '')
45
+ .split('\n')
46
+ .map((line) => parseInt(line.trim(), 10))
47
+ .filter((sec) => sec > 0);
48
+ return times.length ? new Date(Math.max(...times) * 1000) : null;
49
+ };
41
50
  const getDisplayServer = async () => {
42
51
  if (const_1.ANDROID) {
43
52
  const { stdout } = await (0, exec_1.execSave)('pgrep -f surfaceflinger 2>/dev/null || ps -A 2>/dev/null | grep surfaceflinger', const_1.execOptsLinux);
@@ -54,7 +63,7 @@ const linuxIsUefi = async () => {
54
63
  return true;
55
64
  }
56
65
  else {
57
- const { stdout } = await (0, exec_1.exec)('dmesg | grep -E "EFI v"', const_1.execOptsLinux);
66
+ const { stdout } = await (0, exec_1.execSave)('dmesg | grep -E "EFI v"', const_1.execOptsLinux);
58
67
  return stdout.split('\n').length > 0 && stdout.indexOf('EFI') >= 0;
59
68
  }
60
69
  };
@@ -88,6 +97,7 @@ const parseOsInfo = async (stdout, defaults) => {
88
97
  uefi: await linuxIsUefi(),
89
98
  serial: (await (0, uuid_1.uuid)()).os,
90
99
  installDate: await getInstallDate(),
100
+ lastUpdate: await getLastUpdate(),
91
101
  displayServer: await getDisplayServer()
92
102
  };
93
103
  };
@@ -1,6 +1,6 @@
1
- export declare const nixTime: () => {
1
+ export declare const nixTime: () => Promise<{
2
2
  current: number;
3
3
  uptime: number;
4
4
  timezone: string;
5
5
  timezoneName: string;
6
- } | null;
6
+ } | null>;
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nixTime = void 0;
4
4
  const node_os_1 = require("node:os");
5
- const child_process_1 = require("child_process");
6
- const nixTime = () => {
5
+ const exec_1 = require("../common/exec");
6
+ const nixTime = async () => {
7
7
  try {
8
- const stdout = (0, child_process_1.execSync)('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null');
8
+ const { stdout } = await (0, exec_1.execSave)('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null');
9
9
  const lines = stdout.toString().split(node_os_1.EOL);
10
10
  if (lines.length > 3 && !lines[0]) {
11
11
  lines.shift();
package/dist/time.d.ts CHANGED
@@ -3,4 +3,4 @@ export declare const time: () => Promise<{
3
3
  uptime: number;
4
4
  timezone: string;
5
5
  timezoneName: string;
6
- }>;
6
+ } | null>;
package/dist/versions.js CHANGED
@@ -54,6 +54,7 @@ const versions = async (apps) => {
54
54
  powershell: '',
55
55
  python3: '',
56
56
  python: '',
57
+ rails: '',
57
58
  redis: '',
58
59
  ruby: '',
59
60
  rust: '',
@@ -61,6 +62,7 @@ const versions = async (apps) => {
61
62
  tsc: '',
62
63
  virtualbox: '',
63
64
  vi: '',
65
+ vim: '',
64
66
  vue: '',
65
67
  yarn: '',
66
68
  zsh: ''
@@ -1112,6 +1114,32 @@ const versions = async (apps) => {
1112
1114
  functionProcessed();
1113
1115
  });
1114
1116
  }
1117
+ if (Object.keys(appsObj.versions).includes('rails')) {
1118
+ (0, exec_1.exec)('rails -v')
1119
+ .then((res) => {
1120
+ if (res.stdout) {
1121
+ const version = res.stdout.split('\n')[0].match(/^Rails\s+(\d+(\.\d+)*)/i);
1122
+ appsObj.versions.rails = version ? version[1] : '';
1123
+ }
1124
+ functionProcessed();
1125
+ })
1126
+ .catch(() => {
1127
+ functionProcessed();
1128
+ });
1129
+ }
1130
+ if (Object.keys(appsObj.versions).includes('vim')) {
1131
+ (0, exec_1.exec)('vim --version')
1132
+ .then((res) => {
1133
+ if (res.stdout) {
1134
+ const version = res.stdout.split('\n')[0].match(/\d+(\.\d+)+/);
1135
+ appsObj.versions.vim = version ? version[0] : '';
1136
+ }
1137
+ functionProcessed();
1138
+ })
1139
+ .catch(() => {
1140
+ functionProcessed();
1141
+ });
1142
+ }
1115
1143
  }
1116
1144
  catch (e) {
1117
1145
  return appsObj.versions;
@@ -1,2 +1,3 @@
1
1
  import type { FsBlockDevicesData } from '../common/types';
2
+ export declare const parseBlockDevices: (logicalDisks: any[], volumes: any[]) => FsBlockDevicesData[];
2
3
  export declare const blockDevices: () => Promise<FsBlockDevicesData[]>;
@@ -1,11 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.blockDevices = void 0;
3
+ exports.blockDevices = exports.parseBlockDevices = void 0;
4
4
  const common_1 = require("../common");
5
5
  const filesys_1 = require("../common/filesys");
6
6
  const windows_1 = require("../common/windows");
7
- const parseBlockDevices = (logicalDisks) => {
7
+ const parseBlockDevices = (logicalDisks, volumes) => {
8
8
  const drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM'];
9
+ const guids = {};
10
+ volumes.forEach((volume) => {
11
+ const driveLetter = String(volume?.DriveLetter || '').toUpperCase();
12
+ if (driveLetter && volume.DeviceID) {
13
+ guids[driveLetter] = volume.DeviceID;
14
+ }
15
+ });
9
16
  const data = [];
10
17
  logicalDisks.forEach((logicalDisk) => {
11
18
  if (logicalDisk && logicalDisk.DriveType != null) {
@@ -19,6 +26,7 @@ const parseBlockDevices = (logicalDisks) => {
19
26
  size: (0, common_1.toInt)(logicalDisk.Size),
20
27
  physical: drivetype >= 0 && drivetype <= 6 ? drivetypes[drivetype] : drivetypes[0],
21
28
  uuid: logicalDisk.VolumeSerialNumber || '',
29
+ guid: guids[String(logicalDisk.Caption || '').toUpperCase()] || '',
22
30
  label: logicalDisk.VolumeName || '',
23
31
  model: '',
24
32
  serial: logicalDisk.VolumeSerialNumber || '',
@@ -31,14 +39,16 @@ const parseBlockDevices = (logicalDisks) => {
31
39
  });
32
40
  return data;
33
41
  };
42
+ exports.parseBlockDevices = parseBlockDevices;
34
43
  const blockDevices = async () => {
35
44
  await (0, common_1.nextTick)();
36
45
  try {
37
- const [logicalDisks, diskDrives] = await Promise.all([
46
+ const [logicalDisks, diskDrives, volumes] = await Promise.all([
38
47
  windows_1.ps.exec('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | ConvertTo-Json'),
39
- windows_1.ps.exec("Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L='Partitions'; E={$_.GetRelated('Win32_DiskPartition').GetRelated('Win32_LogicalDisk') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl")
48
+ windows_1.ps.exec("Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L='Partitions'; E={$_.GetRelated('Win32_DiskPartition').GetRelated('Win32_LogicalDisk') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl"),
49
+ windows_1.ps.exec('Get-CimInstance -ClassName Win32_Volume | select DriveLetter,DeviceID | ConvertTo-Json').catch(() => null)
40
50
  ]);
41
- const data = parseBlockDevices((0, windows_1.psArray)(logicalDisks));
51
+ const data = (0, exports.parseBlockDevices)((0, windows_1.psArray)(logicalDisks), (0, windows_1.psArray)(volumes));
42
52
  return (0, filesys_1.matchDevicesWin)(data, String(diskDrives).split(/\n\s*\n/));
43
53
  }
44
54
  catch {
@@ -7,6 +7,23 @@ const exec_1 = require("../common/exec");
7
7
  const filesys_1 = require("../common/filesys");
8
8
  const mappings_1 = require("../common/mappings");
9
9
  const windows_1 = require("../common/windows");
10
+ const hasControlCharacters = (str) => /\p{Cc}/u.test(str);
11
+ const diskSerialNum = (device) => {
12
+ const serialNum = String(device.SerialNumber || '').trim();
13
+ if (!hasControlCharacters(serialNum)) {
14
+ return serialNum;
15
+ }
16
+ const instanceId = String(device.PNPDeviceId || '')
17
+ .trim()
18
+ .split('\\')[2];
19
+ if (instanceId) {
20
+ const parts = instanceId.split('&');
21
+ if (parts.length === 2 && parts[1] === '0') {
22
+ return parts[0];
23
+ }
24
+ }
25
+ return serialNum;
26
+ };
10
27
  const diskLayout = async () => {
11
28
  await (0, common_1.nextTick)();
12
29
  const result = [];
@@ -35,7 +52,7 @@ const diskLayout = async () => {
35
52
  tracksPerCylinder: (0, common_1.toInt)(device.TracksPerCylinder),
36
53
  sectorsPerTrack: (0, common_1.toInt)(device.SectorsPerTrack),
37
54
  firmwareRevision: String(device.FirmwareRevision || '').trim(),
38
- serialNum: String(device.SerialNumber || '').trim(),
55
+ serialNum: diskSerialNum(device),
39
56
  interfaceType: String(device.InterfaceType || '').trim(),
40
57
  smartStatus: status === 'ok' ? 'Ok' : status === 'degraded' ? 'Degraded' : status === 'pred fail' ? 'Predicted Failure' : 'Unknown',
41
58
  temperature: null
@@ -10,13 +10,16 @@ const disksIO = async () => {
10
10
  if ((filesys_1._disk_io && !filesys_1._disk_io.ms) || (filesys_1._disk_io && filesys_1._disk_io.ms && Date.now() - filesys_1._disk_io.ms >= 500)) {
11
11
  const defaults = (0, common_1.cloneObj)(defaults_1.initDiskIo);
12
12
  try {
13
- const data = await windows_1.ps.exec("Get-CimInstance Win32_PerfRawData_PerfDisk_PhysicalDisk -Filter \"Name='_Total'\" | Select-Object DiskReadsPersec,DiskWritesPersec | ConvertTo-Json");
13
+ const data = await windows_1.ps.exec("Get-CimInstance Win32_PerfRawData_PerfDisk_PhysicalDisk -Filter \"Name='_Total'\" | Select-Object DiskReadsPersec,DiskWritesPersec,PercentDiskReadTime,PercentDiskWriteTime,PercentDiskTime | ConvertTo-Json");
14
14
  if (!data) {
15
15
  return defaults;
16
16
  }
17
17
  const rIO = (0, common_1.toInt)(data.DiskReadsPersec);
18
18
  const wIO = (0, common_1.toInt)(data.DiskWritesPersec);
19
- return (0, filesys_1.calcDiskIO)(rIO, wIO, 0, 0, 0);
19
+ const rWaitTime = (0, common_1.toInt)(data.PercentDiskReadTime) / 10000;
20
+ const wWaitTime = (0, common_1.toInt)(data.PercentDiskWriteTime) / 10000;
21
+ const tWaitTime = (0, common_1.toInt)(data.PercentDiskTime) / 10000;
22
+ return (0, filesys_1.calcDiskIO)(rIO, wIO, rWaitTime, wWaitTime, tWaitTime);
20
23
  }
21
24
  catch {
22
25
  return defaults;
@@ -32,6 +32,7 @@ const osInfo = async () => {
32
32
  workload.push(windows_1.ps.exec('reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" /v DisplayVersion'));
33
33
  workload.push(windows_1.ps.exec("(Get-CimInstance Win32_OperatingSystem).InstallDate.ToString('yyyy-MM-ddTHH:mm:ss')"));
34
34
  workload.push(windows_1.ps.exec('[bool](Get-Process dwm -ErrorAction SilentlyContinue)'));
35
+ workload.push(windows_1.ps.exec("Get-HotFix | Where-Object { $_.Description -match 'Update' } | Sort-Object InstalledOn -Descending | Select-Object -First 1 -ExpandProperty InstalledOn | ForEach-Object { $_.ToString('yyyy-MM-ddTHH:mm:ss') }"));
35
36
  const data = await Promise.allSettled(workload).then((results) => results.map((result) => (result.status === 'fulfilled' ? result.value : null)));
36
37
  const lines = data[0] ? data[0].toString().split('\r\n') : [''];
37
38
  result.distro = (0, common_1.getValue)(lines, 'Caption', ':').trim();
@@ -58,6 +59,10 @@ const osInfo = async () => {
58
59
  result.installDate = Number.isNaN(installDate.getTime()) ? null : installDate;
59
60
  }
60
61
  result.displayServer = data[5] && data[5].toString().toLowerCase().indexOf('true') >= 0 ? 'dwm' : '';
62
+ if (data[6]) {
63
+ const lastUpdate = new Date(data[6].toString().trim());
64
+ result.lastUpdate = Number.isNaN(lastUpdate.getTime()) ? null : lastUpdate;
65
+ }
61
66
  }
62
67
  catch { }
63
68
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "6.0.0-beta.0",
3
+ "version": "6.0.0-beta.2",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",