import assert from "node:assert" ; import { ReadonlyDeep , } from "type-fest" ; import { UvcControl , } from "uvc-control" ; export interface MappedUvcDevice { readonly name : string ; readonly vendor : number ; readonly product : number ; readonly address : number ; } export default class UvcDeviceLister { constructor ( private readonly UvcControl ) { assert . strictEqual ( arguments . length , 1 ) ; assert ( typeof this . UvcControl === "function" ) ; } async get ( ) { const devices = await this . UvcControl . discover ( ) ; const output = devices . map ( ( device ) => ( { name : device . name , vendor : device . deviceDescriptor . idVendor , product : device . deviceDescriptor . idProduct , address : device . deviceAddress , } ) ) ; return output ; } }