(argv: ArgumentsCamelCase<CommandArgs>)
| 77 | })) |
| 78 | |
| 79 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 80 | const command = await apiOrganizationCommand(argv) |
| 81 | |
| 82 | const id = await chooseDeviceProfile(command, argv.id) |
| 83 | const executeUpdate: ActionFunction<void, DeviceDefinitionRequest, DeviceDefinition> = async (_, data) => { |
| 84 | const profileData = { ...data } |
| 85 | delete profileData.view |
| 86 | |
| 87 | const presentationData = data.view |
| 88 | ? augmentPresentation(data.view) |
| 89 | : await generateDefaultConfig(command.client, id, profileData) |
| 90 | |
| 91 | const presentation = await command.client.presentation.create(presentationData) |
| 92 | if (!profileData.metadata) { |
| 93 | profileData.metadata = {} |
| 94 | } |
| 95 | profileData.metadata.vid = presentation.presentationId |
| 96 | profileData.metadata.mnmn = presentation.manufacturerName |
| 97 | const profile = await command.client.deviceProfiles.update(id, cleanupForUpdate(profileData)) |
| 98 | |
| 99 | return { ...profile, presentation: prunePresentation(presentation) } |
| 100 | } |
| 101 | await inputAndOutputItem( |
| 102 | command, |
| 103 | { buildTableOutput: data => buildTableOutput(command.tableGenerator, data, { includeViewInfo: true }) }, |
| 104 | executeUpdate, |
| 105 | ) |
| 106 | } |
| 107 | |
| 108 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 109 | export default cmd |
nothing calls this directly
no test coverage detected