import mapObj from "map-obj" ; import assert from "node:assert" ; import { ReadonlyDeep , } from "type-fest" ; import CameraHelper from "../camera-helper.js" ; import { Command , CommandHandlerArgumentCameraHelper , CommandHandlerArgumentNames , } from "../types/command.js" ; import { UvccControls , } from "../types/controls.js" ; import flattenControlValues from "../utilities/flatten-control-values.js" ; export default class ExportCommand implements Command { constructor ( ) { assert . strictEqual ( arguments . length , 0 ) ; } async getArguments ( ) { return [ CommandHandlerArgumentCameraHelper , ] ; } async execute ( ... args ) { assert . strictEqual ( arguments . length , 1 ) ; const cameraHelper = args [ 0 ] as ReadonlyDeep < CameraHelper > ; const settableControls = await cameraHelper . getSettableControls ( ) ; const values = mapObj ( settableControls , ( settableControlName , settableControlValue ) => [ settableControlName , flattenControlValues ( settableControlValue ) , ] ) ; return values ; } }