Developer — model schema
The TypeScript contract for a model — ModelJSON, the one recursive NodeJSON shape (OperationJSON | ContainerJSON), and the ValueMethod/EntityMethod unions that bound which lane a method may live in. Shown verbatim from packages/parametric/src/schema.ts.
expression
type expression = string // any JS expression: arithmetic, parameter key refs, Math.* calls, ternary, arrow functions; literal text single-quoted ('Oak')ValueMethod
type ValueMethod = "angle" | "arrayLength" | "boolean" | "color" | "createLayer" | "createMaterial" | "function" | "length" | "loadFont" | "loadImage" | "loadModel" | "number" | "text"EntityMethod
type EntityMethod = "addMesh" | "applyLayer" | "applyMaterial" | "arcCenterStartEnd" | "arcTangentEnd" | "arcThreePoints" | "arrayCurve" | "arrayDistances" | "arrayLinear" | "arrayRadial" | "circle" | "clone" | "cubicBezier" | "curveChamfer" | "curveExtrude" | "curveFillet" | "curveIntersect" | "curveOffset" | "curveReverse" | "curveSelfUnion" | "curveSplit" | "curveSubtract" | "curveThicken" | "curveUnion" | "edgeChamfer" | "edgeFillet" | "ellipseArc" | "extrude" | "faceExtrude" | "faceLattice" | "faceOffset" | "faceReverse" | "groupExplode" | "loft" | "looseToGroup" | "makeGroup" | "mirror" | "move" | "name" | "nurbsCurve" | "patchFromCorners" | "patchFromCurve" | "placeModel" | "pointEntity" | "polygon" | "polyline" | "quadraticBezier" | "rectangle" | "resize" | "revolve" | "rotate" | "solidIntersect" | "solidSelfUnion" | "solidSubtract" | "solidUnion" | "spline" | "sweep" | "textCurve" | "visible"Method
type Method = ValueMethod | EntityMethodModelJSON
type ModelJSON = {
id?: string
title: string
camera?: CameraJSON
parameters?: NodeJSON[]
operations?: NodeJSON[]
unit: {
length: "mm" | "cm" | "m" | "in" | "ft" /* default: "mm" */
area?: "mm2" | "cm2" | "m2" | "in2" | "ft2"
volume?: "mm3" | "cm3" | "m3" | "in3" | "ft3" | "L"
mass?: "mg" | "g" | "kg" | "lb" | "oz"
} /* default: {"length":"mm"} */
}CameraJSON
type CameraJSON = {
type?: "perspective" | "orthographic"
position: unknown[]
target: unknown[]
zoom?: number
}NodeJSON
type NodeJSON = OperationJSON | ContainerJSONOperationJSON
type OperationJSON = {
key?: string
label?: expression
enabled?: expression
method: Method
args?: ArgumentJSON[]
}ContainerJSON
type ContainerJSON = {
key?: string
label?: expression
enabled?: expression
operations: (OperationJSON | ContainerJSON)[]
}ArgumentJSON
type ArgumentJSON = {
key: string
input: string
label?: string
min?: expression
max?: expression
step?: expression
options?: OptionJSON[]
}OptionJSON
type OptionJSON = {
label: string
input: expression
}JS_RESERVED
// JS globals in expression scope — using as node key shadows the global
const JS_RESERVED = ["Math","Number","String","Boolean","Array","Object","isNaN","parseFloat","parseInt"] as constJS_KEYWORDS
// ECMAScript reserved words & special identifiers — forbidden as node keys
const JS_KEYWORDS = ["break","case","catch","continue","debugger","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with","class","const","enum","export","extends","import","let","static","super","yield","async","await","implements","interface","package","private","protected","public","of","null","true","false","undefined","NaN","Infinity","arguments","eval"] as constReserved node keys
These names cannot be used as a parameter, operation, or container key. The Zod schema rejects them at parse time; the engine throws on setKey().
Built-in parameter keys(forbidden on operation/container keys only — these ARE valid parameter keys)
lengthXlengthYlengthZmateriallayerComputation namespaces(Point.*, Vector.*, Curve.*, etc.)
AxisCurveFacePlanePointSurfaceVectorJavaScript globals(available in every expression — shadowing them would break expressions)
MathNumberStringBooleanArrayObjectisNaNparseFloatparseIntJavaScript keywords(language keywords & special identifiers — illegal as expression variable names)
breakcasecatchcontinuedebuggerdefaultdeletedoelsefinallyforfunctionifininstanceofnewreturnswitchthisthrowtrytypeofvarvoidwhilewithclassconstenumexportextendsimportletstaticsuperyieldasyncawaitimplementsinterfacepackageprivateprotectedpublicofnulltruefalseundefinedNaNInfinityargumentseval