Update kittycad lib (#363)

* Update kittycad lib

* Change output for output["output.obj"]

* Update vitest

* Update e2e snaps

* Disable two tests

* Investigation
This commit is contained in:
Pierre Jacquier
2023-09-01 05:02:16 -04:00
committed by GitHub
parent 3ca2f9763c
commit 6423e06113
8 changed files with 143 additions and 100 deletions

View File

@ -8,16 +8,20 @@ import {
import { Buffer } from 'buffer'
export const extensionToSrcFormat: {
[extension: string]: FileImportFormat_type
[extension: string]: FileImportFormat_type | 'fbx' | 'sldprt'
} = {
dae: 'dae',
dxf: 'dxf',
// expected one of `fbx`, `gltf`, `obj`, `ply`, `sldprt`, `step`, `stl`
fbx: 'fbx',
gltf: 'gltf',
obj: 'obj',
stl: 'stl',
ply: 'ply',
sldprt: 'sldprt',
stp: 'step',
step: 'step',
svg: 'svg',
stl: 'stl',
// Disabled in new format api
// dae: 'dae',
}
export function isFilenameSupported(filename: string): boolean {
@ -71,11 +75,11 @@ async function convert(
src_format: extensionToSrcFormat[extension],
output_format: outputFormat as FileExportFormat_type,
})
if ('error_code' in response) throw response
const { status, id, output } = response
console.log(`File conversion id: ${id}`)
console.log(`File conversion status: ${status}`)
return output
const key = `source.${outputFormat}`
if ('error_code' in response || !response.outputs[key]) throw response
const { status, id, outputs } = response
console.log(`File conversion: ${id}, ${status}`)
return outputs[key]
}
export async function getFileDiff(