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:
@ -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(
|
||||
|
||||
Reference in New Issue
Block a user