Convert to vitest and node to v20 (plus spec update) (#136)

* YOYO NEW API SPEC!

* tweak things

* convert to vitest

* tweak build

* update base url

* Generated new lib

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
Jess Frazelle
2023-08-01 15:11:46 -07:00
committed by GitHub
parent bc579c7962
commit fc59e66b14
27 changed files with 1734 additions and 1864 deletions

View File

@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-node@v3.5.1
with:
node-version: '16'
node-version: '20.5.0'
cache: 'yarn'
- run: yarn install
- run: yarn gen
@ -24,7 +24,7 @@ jobs:
- run: yarn test
env:
KITTYCAD_TOKEN: ${{ secrets.KITTYCAD_TOKEN }}
BASE_URL: "https://dev.api.kittycad.io/"
BASE_URL: "https://api.dev.kittycad.io/"
- name: check for changes
id: git-check
run: |

View File

@ -14,10 +14,10 @@ async function example() {
describe('Testing ai.create_image_to_3d', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
const examplePromise = example();
const timeoutPromise = new Promise((r) =>
setTimeout(() => r('timeout'), 450),
);
expect(await Promise.any([examplePromise, timeoutPromise])).toBe('timeout');
});
});

View File

@ -3,6 +3,7 @@ import { file } from '../../src/index.js';
async function example() {
const response = await file.create_file_center_of_mass({
output_unit: 'ft',
src_format: 'obj',
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -4,6 +4,8 @@ import { file } from '../../src/index.js';
async function example() {
const response = await file.create_file_density({
material_mass: 7,
material_mass_unit: 'g',
output_unit: 'kg:m3',
src_format: 'obj',
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -4,6 +4,8 @@ import { file } from '../../src/index.js';
async function example() {
const response = await file.create_file_mass({
material_density: 7,
material_density_unit: 'lb:ft3',
output_unit: 'kg',
src_format: 'obj',
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -3,6 +3,7 @@ import { file } from '../../src/index.js';
async function example() {
const response = await file.create_file_surface_area({
output_unit: 'dm2',
src_format: 'obj',
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -3,6 +3,7 @@ import { file } from '../../src/index.js';
async function example() {
const response = await file.create_file_volume({
output_unit: 'ft3',
src_format: 'obj',
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -2,8 +2,8 @@ import { unit } from '../../src/index.js';
async function example() {
const response = await unit.get_area_unit_conversion({
input_unit: 'acres',
output_unit: 'hectares',
input_unit: 'cm2',
output_unit: 'dm2',
value: 7,
});
if ('error_code' in response) throw response;

View File

@ -2,8 +2,8 @@ import { unit } from '../../src/index.js';
async function example() {
const response = await unit.get_length_unit_conversion({
input_unit: 'centimetres',
output_unit: 'decimetres',
input_unit: 'cm',
output_unit: 'ft',
value: 7,
});
if ('error_code' in response) throw response;

View File

@ -2,8 +2,8 @@ import { unit } from '../../src/index.js';
async function example() {
const response = await unit.get_mass_unit_conversion({
input_unit: 'carats',
output_unit: 'grains',
input_unit: 'g',
output_unit: 'kg',
value: 7,
});
if ('error_code' in response) throw response;

View File

@ -2,8 +2,8 @@ import { unit } from '../../src/index.js';
async function example() {
const response = await unit.get_volume_unit_conversion({
input_unit: 'cubic_centimetres',
output_unit: 'cubic_feet',
input_unit: 'cm3',
output_unit: 'ft3',
value: 7,
});
if ('error_code' in response) throw response;

View File

@ -7,6 +7,8 @@ describe('Testing create_file_mass', () => {
it("shouldn't throw", async () => {
const response = await file.create_file_mass({
src_format: 'obj',
material_density_unit: 'kg:m3',
output_unit: 'g',
material_density: 0.007,
body: await fsp.readFile('./example.obj', 'base64'),
});
@ -20,6 +22,8 @@ describe('Testing create_file_mass', () => {
const response = await file.create_file_mass({
client,
src_format: 'obj',
material_density_unit: 'kg:m3',
output_unit: 'g',
material_density: 0.007,
body: await fsp.readFile('./example.obj', 'base64'),
});

View File

@ -1,24 +0,0 @@
export default {
testEnvironment: 'node',
preset: 'ts-jest',
globals: {
'ts-jest': {
useESM: true,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.(m)?js$': '$1',
},
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(m)?ts$',
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**/*.ts',
'src/**/*.mts',
'!src/**/*.d.ts',
'!src/**/*.d.mts',
],
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
};

View File

@ -243,7 +243,7 @@
"op": "add",
"path": "/paths/~1unit~1conversion~1volume~1{input_unit}~1{output_unit}/get/x-typescript",
"value": {
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_volume_unit_conversion({\n input_unit: 'cubic_centimetres',\n output_unit: 'cubic_feet',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_volume_unit_conversion({\n input_unit: 'cm3',\n output_unit: 'ft3',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -283,7 +283,7 @@
"op": "add",
"path": "/paths/~1unit~1conversion~1mass~1{input_unit}~1{output_unit}/get/x-typescript",
"value": {
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_mass_unit_conversion({\n input_unit: 'carats',\n output_unit: 'grains',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_mass_unit_conversion({\n input_unit: 'g',\n output_unit: 'kg',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -291,7 +291,7 @@
"op": "add",
"path": "/paths/~1unit~1conversion~1length~1{input_unit}~1{output_unit}/get/x-typescript",
"value": {
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_length_unit_conversion({\n input_unit: 'centimetres',\n output_unit: 'decimetres',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_length_unit_conversion({\n input_unit: 'cm',\n output_unit: 'ft',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -331,7 +331,7 @@
"op": "add",
"path": "/paths/~1unit~1conversion~1area~1{input_unit}~1{output_unit}/get/x-typescript",
"value": {
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_area_unit_conversion({\n input_unit: 'acres',\n output_unit: 'hectares',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_area_unit_conversion({\n input_unit: 'cm2',\n output_unit: 'dm2',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -427,7 +427,7 @@
"op": "add",
"path": "/paths/~1file~1volume/post/x-typescript",
"value": {
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_volume({\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_volume({\n output_unit: 'ft3',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -435,7 +435,7 @@
"op": "add",
"path": "/paths/~1file~1surface-area/post/x-typescript",
"value": {
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_surface_area({\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_surface_area({\n output_unit: 'dm2',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -443,7 +443,7 @@
"op": "add",
"path": "/paths/~1file~1mass/post/x-typescript",
"value": {
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_mass({\n material_density: 7,\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_mass({\n material_density: 7,\n material_density_unit: 'lb:ft3',\n output_unit: 'kg',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -459,7 +459,7 @@
"op": "add",
"path": "/paths/~1file~1density/post/x-typescript",
"value": {
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_density({\n material_mass: 7,\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_density({\n material_mass: 7,\n material_mass_unit: 'g',\n output_unit: 'kg:m3',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
@ -475,7 +475,7 @@
"op": "add",
"path": "/paths/~1file~1center-of-mass/post/x-typescript",
"value": {
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_center_of_mass({\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_center_of_mass({\n output_unit: 'ft',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},

View File

@ -34,46 +34,47 @@
"dist"
],
"engines": {
"node": ">= 16.13 <19"
"node": ">= 16.13"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.18.9",
"@babel/preset-typescript": "^7.18.6",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/jest": "~27.5",
"@types/node": "~18",
"@types/jest": "^29.5.3",
"@types/node": "~20",
"@types/node-fetch": "^2.6.4",
"@typescript-eslint/eslint-plugin": "~5.46",
"@typescript-eslint/parser": "~5.26",
"eslint": "^8.29.0",
"eslint-config-prettier": "~8.5",
"eslint-plugin-jest": "~26.2",
"fast-json-patch": "^3.1.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"rimraf": "~3.0",
"rollup": "^2.79.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.32.1",
"ts-jest": "~28.0",
"tsutils": "~3.21",
"typescript": "~4.7"
"typescript": "~4.7",
"vitest": "^0.33.0"
},
"scripts": {
"build:js": "rollup -c",
"build:types": "tsc --emitDeclarationOnly",
"build": "rimraf dist && npm run build:types && npm run build:js",
"gen": "ts-node ./src/modelsGen.ts && prettier --config .prettierrc --write './src' './__tests__' './kittycad.ts.patch.json'",
"test": "jest",
"tsc": "tsc"
"gen": "node --experimental-loader ts-node/esm.mjs ./src/modelsGen.ts && yarn fmt",
"test": "vitest",
"tsc": "tsc",
"fmt": "prettier --config .prettierrc --write './src' './__tests__' './kittycad.ts.patch.json' './rollup.config.js'"
},
"author": "Kurt Hutten <kurt@kittycad.io>",
"license": "MIT",
"dependencies": {
"node-fetch": "2.6.7",
"node-fetch": "3.3.2",
"openapi-types": "^12.0.0",
"ts-node": "^10.9.1",
"tslib": "~2.4"

View File

@ -1,11 +1,11 @@
import { babel } from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import pkg from './package.json'
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
const extensions = ['.js', '.ts']
const extensions = ['.js', '.ts'];
const plugins = [
json(),
@ -15,7 +15,7 @@ const plugins = [
extensions,
}),
terser(),
]
];
export default [
{
@ -33,12 +33,6 @@ export default [
file: pkg.main,
format: 'cjs',
},
],
plugins,
},
{
input: 'src/index.ts',
output: [
{
name: pkg.name,
file: pkg.browser,
@ -47,4 +41,4 @@ export default [
],
plugins,
},
]
];

876
spec.json

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,14 @@ import fetch from 'node-fetch';
import {
FileCenterOfMass_type,
Error_type,
UnitLength_type,
FileImportFormat_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_file_center_of_mass_params {
client?: Client;
output_unit: UnitLength_type;
src_format: FileImportFormat_type;
body: string;
}
@ -16,10 +18,11 @@ type Create_file_center_of_mass_return = FileCenterOfMass_type | Error_type;
export default async function create_file_center_of_mass({
client,
output_unit,
src_format,
body,
}: Create_file_center_of_mass_params): Promise<Create_file_center_of_mass_return> {
const url = `/file/center-of-mass?src_format=${src_format}`;
const url = `/file/center-of-mass?output_unit=${output_unit}&src_format=${src_format}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client

View File

@ -2,6 +2,8 @@ import fetch from 'node-fetch';
import {
FileDensity_type,
Error_type,
UnitMass_type,
UnitDensity_type,
FileImportFormat_type,
} from '../../models.js';
import { Client } from '../../client.js';
@ -9,6 +11,8 @@ import { Client } from '../../client.js';
interface Create_file_density_params {
client?: Client;
material_mass: number;
material_mass_unit: UnitMass_type;
output_unit: UnitDensity_type;
src_format: FileImportFormat_type;
body: string;
}
@ -18,10 +22,12 @@ type Create_file_density_return = FileDensity_type | Error_type;
export default async function create_file_density({
client,
material_mass,
material_mass_unit,
output_unit,
src_format,
body,
}: Create_file_density_params): Promise<Create_file_density_return> {
const url = `/file/density?material_mass=${material_mass}&src_format=${src_format}`;
const url = `/file/density?material_mass=${material_mass}&material_mass_unit=${material_mass_unit}&output_unit=${output_unit}&src_format=${src_format}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client

View File

@ -2,6 +2,8 @@ import fetch from 'node-fetch';
import {
FileMass_type,
Error_type,
UnitDensity_type,
UnitMass_type,
FileImportFormat_type,
} from '../../models.js';
import { Client } from '../../client.js';
@ -9,6 +11,8 @@ import { Client } from '../../client.js';
interface Create_file_mass_params {
client?: Client;
material_density: number;
material_density_unit: UnitDensity_type;
output_unit: UnitMass_type;
src_format: FileImportFormat_type;
body: string;
}
@ -18,10 +22,12 @@ type Create_file_mass_return = FileMass_type | Error_type;
export default async function create_file_mass({
client,
material_density,
material_density_unit,
output_unit,
src_format,
body,
}: Create_file_mass_params): Promise<Create_file_mass_return> {
const url = `/file/mass?material_density=${material_density}&src_format=${src_format}`;
const url = `/file/mass?material_density=${material_density}&material_density_unit=${material_density_unit}&output_unit=${output_unit}&src_format=${src_format}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client

View File

@ -2,12 +2,14 @@ import fetch from 'node-fetch';
import {
FileSurfaceArea_type,
Error_type,
UnitArea_type,
FileImportFormat_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_file_surface_area_params {
client?: Client;
output_unit: UnitArea_type;
src_format: FileImportFormat_type;
body: string;
}
@ -16,10 +18,11 @@ type Create_file_surface_area_return = FileSurfaceArea_type | Error_type;
export default async function create_file_surface_area({
client,
output_unit,
src_format,
body,
}: Create_file_surface_area_params): Promise<Create_file_surface_area_return> {
const url = `/file/surface-area?src_format=${src_format}`;
const url = `/file/surface-area?output_unit=${output_unit}&src_format=${src_format}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client

View File

@ -2,12 +2,14 @@ import fetch from 'node-fetch';
import {
FileVolume_type,
Error_type,
UnitVolume_type,
FileImportFormat_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_file_volume_params {
client?: Client;
output_unit: UnitVolume_type;
src_format: FileImportFormat_type;
body: string;
}
@ -16,10 +18,11 @@ type Create_file_volume_return = FileVolume_type | Error_type;
export default async function create_file_volume({
client,
output_unit,
src_format,
body,
}: Create_file_volume_params): Promise<Create_file_volume_return> {
const url = `/file/volume?src_format=${src_format}`;
const url = `/file/volume?output_unit=${output_unit}&src_format=${src_format}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client

View File

@ -271,7 +271,6 @@ export default async function apiGen(lookup: any) {
'users.get_user_front_hash_self',
'oauth2.oauth2_provider_callback',
'apps.apps_github_webhook',
'ai.create_image_to_3d',
].includes(`${tag.trim()}.${operationId.trim()}`)
) {
// these test are expected to fail
@ -280,7 +279,9 @@ export default async function apiGen(lookup: any) {
[/const examplePromise = example(.|\n)+?.toBe\('timeout'\)/g, ''],
]);
} else if (
['ai.create_text_to_3d'].includes(`${tag.trim()}.${operationId.trim()}`)
['ai.create_text_to_3d', 'ai.create_image_to_3d'].includes(
`${tag.trim()}.${operationId.trim()}`,
)
) {
exampleTemplate = replacer(exampleTemplate, [
['expect(await example()).toBeTruthy();', ''],

View File

@ -237,6 +237,7 @@ export type AsyncApiCallOutput_type =
This is the same as the API call ID. */
id: Uuid_type;
/*{
"deprecated": true,
"format": "byte",
"nullable": true,
"title": "String",
@ -271,9 +272,14 @@ This is the same as the API call ID. */
}
| {
/*{
"format": "double"
"deprecated": true,
"nullable": true,
"description": "The resulting center of mass. This is deprecated and will be removed in a future release. Use `centers_of_mass` instead."
}*/
center_of_mass: number[];
center_of_mass: Point3d_type;
centers_of_mass: {
[key: string]: Point3d_type;
} /* The center of mass for each mesh in the file. The key of the hash map is the mesh name. */;
/*{
"format": "date-time",
"nullable": true,
@ -289,6 +295,7 @@ This is the same as the API call ID. */
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitLength_type /* The output unit for the center of mass. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -319,10 +326,23 @@ This is the same as the API call ID. */
This is the same as the API call ID. */
id: Uuid_type;
/* format:double, nullable:true, description:The resulting mass. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting mass. This is deprecated and will be removed in a future release, use `masses` instead."
}*/
mass?: number;
/* default:0, format:float, description:The material density as denoted by the user. */
masses: {
[key: string]: /*{
"format": "double"
}*/
number;
};
/* default:0, format:double, description:The material density as denoted by the user. */
material_density: number;
material_density_unit: UnitDensity_type /* The material density unit. */;
output_unit: UnitMass_type /* The output unit for the mass. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -353,6 +373,7 @@ This is the same as the API call ID. */
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitVolume_type /* The output unit for the volume. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -366,8 +387,19 @@ This is the same as the API call ID. */
/* format:date-time, title:DateTime, description:The time and date the API call was last updated. */
updated_at: string;
user_id: string /* The user ID of the user who created the API call. */;
/* format:double, nullable:true, description:The resulting volume. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting volume. This is deprecated and will be removed in a future release. Use `volumes` instead."
}*/
volume?: number;
volumes: {
[key: string]: /*{
"format": "double"
}*/
number;
};
}
| {
/*{
@ -379,7 +411,18 @@ This is the same as the API call ID. */
completed_at?: string;
/* format:date-time, title:DateTime, description:The time and date the API call was created. */
created_at: string;
/* format:double, nullable:true, description:The resulting density. */
densities: {
[key: string]: /*{
"format": "double"
}*/
number;
};
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting density. This is deprecated and will be removed in a future release, use `densities` instead."
}*/
density?: number;
/* nullable:true, description:The error the function returned, if any. */
error?: string;
@ -387,8 +430,10 @@ This is the same as the API call ID. */
This is the same as the API call ID. */
id: Uuid_type;
/* default:0, format:float, description:The material mass as denoted by the user. */
/* default:0, format:double, description:The material mass as denoted by the user. */
material_mass: number;
material_mass_unit: UnitMass_type /* The material mass unit. */;
output_unit: UnitDensity_type /* The output unit for the density. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -419,6 +464,7 @@ This is the same as the API call ID. */
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitArea_type /* The output unit for the surface area. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -428,8 +474,19 @@ This is the same as the API call ID. */
}*/
started_at?: string;
status: ApiCallStatus_type /* The status of the API call. */;
/* format:double, nullable:true, description:The resulting surface area. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting surface area. This is deprecated and will be removed in a future release. Use `surface_areas` instead."
}*/
surface_area?: number;
surface_areas: {
[key: string]: /*{
"format": "double"
}*/
number;
};
type: 'FileSurfaceArea';
/* format:date-time, title:DateTime, description:The time and date the API call was last updated. */
updated_at: string;
@ -1497,9 +1554,14 @@ export interface Extrude_type {
export interface FileCenterOfMass_type {
/*{
"format": "double"
"deprecated": true,
"nullable": true,
"description": "The resulting center of mass. This is deprecated and will be removed in a future release. Use `centers_of_mass` instead."
}*/
center_of_mass: number[];
center_of_mass: Point3d_type;
centers_of_mass: {
[key: string]: Point3d_type;
} /* The center of mass for each mesh in the file. The key of the hash map is the mesh name. */;
/*{
"format": "date-time",
"nullable": true,
@ -1515,6 +1577,7 @@ export interface FileCenterOfMass_type {
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitLength_type /* The output unit for the center of mass. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -1546,6 +1609,7 @@ export interface FileConversion_type {
This is the same as the API call ID. */
id: Uuid_type;
/*{
"deprecated": true,
"format": "byte",
"nullable": true,
"title": "String",
@ -1588,7 +1652,18 @@ export interface FileDensity_type {
completed_at?: string;
/* format:date-time, title:DateTime, description:The time and date the API call was created. */
created_at: string;
/* format:double, nullable:true, description:The resulting density. */
densities: {
[key: string]: /*{
"format": "double"
}*/
number;
};
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting density. This is deprecated and will be removed in a future release, use `densities` instead."
}*/
density?: number;
/* nullable:true, description:The error the function returned, if any. */
error?: string;
@ -1596,8 +1671,10 @@ export interface FileDensity_type {
This is the same as the API call ID. */
id: Uuid_type;
/* default:0, format:float, description:The material mass as denoted by the user. */
/* default:0, format:double, description:The material mass as denoted by the user. */
material_mass: number;
material_mass_unit: UnitMass_type /* The material mass unit. */;
output_unit: UnitDensity_type /* The output unit for the density. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -1614,7 +1691,6 @@ This is the same as the API call ID. */
export type FileExportFormat_type =
| 'dae'
| 'dxf'
| 'fbx'
| 'fbxb'
| 'gltf'
@ -1625,7 +1701,6 @@ export type FileExportFormat_type =
export type FileImportFormat_type =
| 'dae'
| 'dxf'
| 'fbx'
| 'gltf'
| 'obj'
@ -1649,10 +1724,23 @@ export interface FileMass_type {
This is the same as the API call ID. */
id: Uuid_type;
/* format:double, nullable:true, description:The resulting mass. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting mass. This is deprecated and will be removed in a future release, use `masses` instead."
}*/
mass?: number;
/* default:0, format:float, description:The material density as denoted by the user. */
masses: {
[key: string]: /*{
"format": "double"
}*/
number;
};
/* default:0, format:double, description:The material density as denoted by the user. */
material_density: number;
material_density_unit: UnitDensity_type /* The material density unit. */;
output_unit: UnitMass_type /* The output unit for the mass. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -1683,6 +1771,7 @@ export interface FileSurfaceArea_type {
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitArea_type /* The output unit for the surface area. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -1692,8 +1781,19 @@ This is the same as the API call ID. */
}*/
started_at?: string;
status: ApiCallStatus_type /* The status of the API call. */;
/* format:double, nullable:true, description:The resulting surface area. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting surface area. This is deprecated and will be removed in a future release. Use `surface_areas` instead."
}*/
surface_area?: number;
surface_areas: {
[key: string]: /*{
"format": "double"
}*/
number;
};
/* format:date-time, title:DateTime, description:The time and date the API call was last updated. */
updated_at: string;
user_id: string /* The user ID of the user who created the API call. */;
@ -1719,6 +1819,7 @@ export interface FileVolume_type {
This is the same as the API call ID. */
id: Uuid_type;
output_unit: UnitVolume_type /* The output unit for the volume. */;
src_format: FileImportFormat_type /* The source format of the file. */;
/*{
"format": "date-time",
@ -1731,8 +1832,19 @@ This is the same as the API call ID. */
/* format:date-time, title:DateTime, description:The time and date the API call was last updated. */
updated_at: string;
user_id: string /* The user ID of the user who created the API call. */;
/* format:double, nullable:true, description:The resulting volume. */
/*{
"deprecated": true,
"format": "double",
"nullable": true,
"description": "The resulting volume. This is deprecated and will be removed in a future release. Use `volumes` instead."
}*/
volume?: number;
volumes: {
[key: string]: /*{
"format": "double"
}*/
number;
};
}
export interface Gateway_type {
@ -1787,6 +1899,17 @@ Defaults to the [KittyCAD co-ordinate system].
[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html */
coords: System_type;
type: 'Obj';
units: UnitLength_type /* The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. */;
}
| {
/* Co-ordinate system of input data.
Defaults to the [KittyCAD co-ordinate system].
[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html */
coords: System_type;
type: 'Ply';
units: UnitLength_type /* The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. */;
}
| {
/* Co-ordinate system of input data.
@ -1796,6 +1919,7 @@ Defaults to the [KittyCAD co-ordinate system].
[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html */
coords: System_type;
type: 'Stl';
units: UnitLength_type /* The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. */;
};
export interface Invoice_type {
@ -2063,6 +2187,27 @@ export type ModelingCmd_type =
interaction: CameraDragInteractionType_type /* The type of camera drag interaction. */;
window: Point2d_type /* The final mouse position. */;
};
}
| {
DefaultCameraLookAt: {
center: Point3d_type /* What the camera is looking at. Center of the camera's field of vision */;
up: Point3d_type /* Which way is "up", from the camera's point of view. */;
vantage: Point3d_type /* Where the camera is positioned */;
};
}
| {
DefaultCameraEnableSketchMode: {
/* format:float, description:How far to the sketching plane? */
distance_to_plane: number;
origin: Point3d_type /* What's the origin of the sketching plane? */;
ortho: boolean /* Should the camera use orthographic projection? In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera. */;
x_axis: Point3d_type /* Which 3D axis of the scene should be the X axis of the sketching plane? */;
y_axis: Point3d_type /* Which 3D axis of the scene should be the Y axis of the sketching plane? */;
};
}
| 'DefaultCameraDisableSketchMode'
| {
Export: { format: OutputFormat_type /* The file format to export to. */ };
};
export type ModelingCmdId_type =
@ -2166,6 +2311,16 @@ Defaults to the [KittyCAD co-ordinate system].
Defaults to the [KittyCAD co-ordinate system].
[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html */
coords: System_type;
storage: Storage_type /* The storage for the output PLY file. */;
type: 'Ply';
}
| {
/* Co-ordinate system of output data.
Defaults to the [KittyCAD co-ordinate system].
[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html */
coords: System_type;
type: 'Step';
@ -2431,20 +2586,14 @@ This is the same as the API call ID. */
}
export type UnitArea_type =
| 'acres'
| 'hectares'
| 'square_centimetres'
| 'square_decimetres'
| 'square_feet'
| 'square_hectometres'
| 'square_inches'
| 'square_kilometres'
| 'square_metres'
| 'square_micrometres'
| 'square_miles'
| 'square_millimetres'
| 'square_nanometres'
| 'square_yards';
| 'cm2'
| 'dm2'
| 'ft2'
| 'in2'
| 'km2'
| 'm2'
| 'mm2'
| 'yd2';
export interface UnitAreaConversion_type {
/*{
@ -2522,6 +2671,8 @@ This is the same as the API call ID. */
user_id: string /* The user ID of the user who created the API call. */;
}
export type UnitDensity_type = 'lb:ft3' | 'kg:m3';
export type UnitEnergy_type =
| 'btu'
| 'electronvolts'
@ -2654,20 +2805,7 @@ This is the same as the API call ID. */
user_id: string /* The user ID of the user who created the API call. */;
}
export type UnitLength_type =
| 'centimetres'
| 'decimetres'
| 'feet'
| 'furlongs'
| 'hectometres'
| 'inches'
| 'kilometres'
| 'metres'
| 'micrometres'
| 'miles'
| 'millimetres'
| 'nanometres'
| 'yards';
export type UnitLength_type = 'cm' | 'ft' | 'in' | 'm' | 'mm' | 'yd';
export interface UnitLengthConversion_type {
/*{
@ -2704,22 +2842,7 @@ This is the same as the API call ID. */
user_id: string /* The user ID of the user who created the API call. */;
}
export type UnitMass_type =
| 'carats'
| 'grains'
| 'grams'
| 'kilograms'
| 'long_tons'
| 'metric_tons'
| 'micrograms'
| 'milligrams'
| 'ounces'
| 'pennyweights'
| 'pounds'
| 'short_tons'
| 'stones'
| 'troy_ounces'
| 'troy_pounds';
export type UnitMass_type = 'g' | 'kg' | 'lb';
export interface UnitMassConversion_type {
/*{
@ -2923,25 +3046,15 @@ This is the same as the API call ID. */
}
export type UnitVolume_type =
| 'cubic_centimetres'
| 'cubic_feet'
| 'cubic_inches'
| 'cubic_metres'
| 'cubic_yards'
| 'cups'
| 'drams'
| 'drops'
| 'fluid_ounces'
| 'fluid_ounces_uk'
| 'gallons'
| 'gallons_uk'
| 'litres'
| 'millilitres'
| 'pints'
| 'pints_uk'
| 'quarts'
| 'tablespoons'
| 'teaspoons';
| 'cm3'
| 'ft3'
| 'in3'
| 'm3'
| 'yd3'
| 'usfloz'
| 'usgal'
| 'l'
| 'ml';
export interface UnitVolumeConversion_type {
/*{
@ -3176,6 +3289,7 @@ export interface Models {
UnitAreaConversion_type: UnitAreaConversion_type;
UnitCurrent_type: UnitCurrent_type;
UnitCurrentConversion_type: UnitCurrentConversion_type;
UnitDensity_type: UnitDensity_type;
UnitEnergy_type: UnitEnergy_type;
UnitEnergyConversion_type: UnitEnergyConversion_type;
UnitForce_type: UnitForce_type;

View File

@ -4,7 +4,7 @@
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"lib": ["ES2022"],
"lib": ["ES2022", "DOM"],
"rootDir": ".",
"outDir": "build",
"allowSyntheticDefaultImports": true,
@ -27,6 +27,6 @@
"include": ["src/**/*", "__tests__/**/*"],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node",
"experimentalSpecifierResolution": "node"
}
}

9
vitest.config.ts Normal file
View File

@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
globals: true, // makes this work with jest default globals `describe, expect` etc
exclude: ['build/**/*', 'node_modules/**/*'],
testTimeout: 10000,
},
})

2267
yarn.lock

File diff suppressed because it is too large Load Diff