BREAKING CHANGE(core): Add multi-UPS support and group management; update CLI, configuration and documentation to support multiple UPS devices with group modes

This commit is contained in:
2025-03-28 16:19:43 +00:00
parent bd3042de25
commit 0e55f22dad
10 changed files with 2381 additions and 780 deletions

1
ts/helpers/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './shortid.js';

22
ts/helpers/shortid.ts Normal file
View File

@ -0,0 +1,22 @@
/**
* Generate a short unique ID of 6 alphanumeric characters
* @returns A 6-character alphanumeric string
*/
export function shortId(): string {
// Define the character set: a-z, A-Z, 0-9
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
// Generate cryptographically secure random values
const randomValues = new Uint8Array(6);
crypto.getRandomValues(randomValues);
// Map each random value to a character in our set
let result = '';
for (let i = 0; i < 6; i++) {
// Use modulo to map the random byte to a character index
const index = randomValues[i] % chars.length;
result += chars[index];
}
return result;
}