Skip to content
ParaShape

Functions

Every namespace function, builtin, constant, keyword literal, property, array/string method and operator an expression can use, live from engine_catalog's Catalog — name, parameters (with value type and optionality) and return type, read off each vocabulary's own data table (crates/model/src/expression/namespaces/*.rs, builtins.rs's MATH_FUNCTIONS/NUMBER_FUNCTIONS/OBJECT_FUNCTIONS/ARRAY_FUNCTIONS/GLOBAL_FUNCTIONS, eval.rs's ARRAY_METHODS/STRING_METHODS/PROPERTIES/BLOCKED_KEYS, value.rs's KEYWORD_LITERALS, parser.rs's BINARY_OPERATORS/UNARY_OPERATORS), never off the closure bodies or hand-written match arms — a name can never be documented without being callable, or callable without being listed. This is every root expression::mod::Namespaces::lookup resolves, every fixed member name Value::member resolves, every keyword literal, and every member name it refuses outright — the full set of identifiers a stored expression can legally reference, and the set it is refused.

// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ConstantSignature } from "./ConstantSignature.js";
import type { ExpressionBudgets } from "./ExpressionBudgets.js";
import type { FunctionSignature } from "./FunctionSignature.js";
import type { KeywordSignature } from "./KeywordSignature.js";
import type { NamespaceDefinition } from "./NamespaceDefinition.js";
import type { NodeDefinition } from "./NodeDefinition.js";
import type { OperatorsCatalog } from "./OperatorsCatalog.js";
import type { PropertySignature } from "./PropertySignature.js";
import type { ShadingCapability } from "./ShadingCapability.js";

/**
 * `engine_catalog`'s wire shape: the node table, the shading→capability
 * table (`document::vocabulary::SHADINGS`) a shading picker reads to grey
 * out exposure for a mode that cannot meter, and the full expression
 * vocabulary — namespace/builtin function tables, constants, keyword
 * literals, array/string methods, operators, properties, blocked member
 * names, and the sandbox's numeric budgets. Session-free. Named
 * `ShadingCapability` because `scene::Shading` is the mode-name enum.
 */
export type Catalog = { 
/**
 * derived — every registered node's definition.
 */
nodes: Array<NodeDefinition>, 
/**
 * derived — the shading→capability table.
 */
shadings: Array<ShadingCapability>, 
/**
 * derived — every expression namespace's function table, in
 * `expression::namespaces::NAMES` order.
 */
namespaces: Array<NamespaceDefinition>, 
/**
 * derived — the five builtin function groups (`Math`, `Number`,
 * `Object`, `Array`, `Global`), in `expression::builtins::BUILTIN_NAMES`
 * order. `Number`/`Array` each appear twice across `builtins`/`Global`
 * when a root is both an object with members and itself callable — see
 * `expression::builtins::GLOBAL_FUNCTIONS`'s doc comment.
 */
builtins: Array<NamespaceDefinition>, 
/**
 * derived — `Math`'s and `Number`'s numeric constants (`Math.PI`,
 * `Number.EPSILON`, …), which are values, not functions, so `builtins`
 * cannot carry them.
 */
constants: Array<ConstantSignature>, 
/**
 * derived — every `Value::Array` method, in
 * `expression::eval::ARRAY_METHODS` order.
 */
arrayMethods: Array<FunctionSignature>, 
/**
 * derived — every `Value::Text` method, in
 * `expression::eval::STRING_METHODS` order.
 */
stringMethods: Array<FunctionSignature>, 
/**
 * derived — the binary and unary operator tables.
 */
operators: OperatorsCatalog, 
/**
 * derived — fixed member names `Value::member` (`expression/value.rs`)
 * resolves directly, outside every method/function table above (a
 * plain field read, no call) — `expression::value::PROPERTIES`.
 */
properties: Array<PropertySignature>, 
/**
 * derived — every keyword literal (`true`, `false`, `null`,
 * `undefined`) the parser/evaluator resolve without a scope lookup —
 * `expression::value::KEYWORD_LITERALS`.
 */
keywords: Array<KeywordSignature>, 
/**
 * derived — member names `Value::member` refuses outright (a JS
 * prototype sandbox-escape name) — what a stored expression is REFUSED,
 * not what it is granted — `expression::eval::BLOCKED_KEYS`.
 */
blockedMemberNames: Array<string>, 
/**
 * derived — the expression sandbox's numeric budgets (`eval.rs`/
 * `parser.rs`/`document::model`'s own `pub const`s).
 */
budgets: ExpressionBudgets, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { FunctionSignature } from "./FunctionSignature.js";

/**
 * One expression namespace (`Point`, `Arc`, …) — its function table, mirrored
 * off `expression::namespaces::functions_of` without the `call` fn pointer,
 * which does not serialize.
 */
export type NamespaceDefinition = { 
/**
 * identity — the namespace root name (`Point.distance` reads as `Point`
 * + `distance`).
 */
name: string, 
/**
 * derived — every member function this namespace exposes.
 */
functions: Array<FunctionSignature>, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ParameterSignature } from "./ParameterSignature.js";

/**
 * One `expression::namespaces::FunctionDefinition` without its `call` fn
 * pointer — the serializable half `Catalog.namespaces` mirrors.
 */
export type FunctionSignature = { 
/**
 * identity — the member name (`Point.distance`'s `distance`).
 */
name: string, 
/**
 * derived — the function's own parameters, in call order.
 */
parameters: Array<ParameterSignature>, 
/**
 * derived — the value-type word the function returns.
 */
returns: string, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `expression::namespaces::ParameterDefinition`, mirrored for the wire.
 */
export type ParameterSignature = { 
/**
 * identity — the parameter's name.
 */
name: string, 
/**
 * derived — the value-type word (`document::vocabulary::TYPE_REGISTRY`
 * where one applies, else the closest `Value` variant name).
 */
valueType: string, 
/**
 * derived — whether the closure tolerates this argument being absent.
 */
optional: boolean, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `Math`- or `Number`-style numeric constant, mirrored off
 * `expression::builtins::ConstantDefinition` for the wire.
 */
export type ConstantSignature = { 
/**
 * identity — which root this constant hangs on (`Math`, `Number`).
 */
object: string, 
/**
 * identity — the constant's name (`Math.PI`'s `PI`).
 */
name: string, 
/**
 * derived — the constant's numeric value.
 */
value: number, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `expression::value::PropertyDefinition`, mirrored for the wire —
 * `Value::member`'s hand-kept record, since `value.rs` itself is not a
 * data table.
 */
export type PropertySignature = { 
/**
 * identity — the value-type word of the receiver this property reads
 * from (`array`, `string`).
 */
receiver: string, 
/**
 * identity — the property's name (`length`).
 */
name: string, 
/**
 * derived — the value-type word this property reads back.
 */
returns: string, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `expression::value::KeywordDefinition`, mirrored for the wire.
 */
export type KeywordSignature = { 
/**
 * identity — the keyword's name (`true`, `null`, …).
 */
name: string, 
/**
 * derived — the value-type word this keyword evaluates to.
 */
valueType: string, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BinaryOperatorSignature } from "./BinaryOperatorSignature.js";
import type { UnaryOperatorSignature } from "./UnaryOperatorSignature.js";

/**
 * `Catalog.operators`'s wire shape: the binary and unary operator tables.
 */
export type OperatorsCatalog = { 
/**
 * derived — every binary operator, in
 * `expression::parser::BINARY_OPERATORS` order.
 */
binary: Array<BinaryOperatorSignature>, 
/**
 * derived — every unary operator, in
 * `expression::parser::UNARY_OPERATORS` order.
 */
unary: Array<UnaryOperatorSignature>, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `expression::parser::BinaryOperatorDefinition`, mirrored for the wire.
 */
export type BinaryOperatorSignature = { 
/**
 * identity — the operator's token text (`+`, `**`, `===`, …).
 */
token: string, 
/**
 * derived — precedence tier; higher binds tighter.
 */
precedence: number, 
/**
 * derived — whether the operator groups right-to-left (`**` is the
 * only one).
 */
rightAssociative: boolean, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * One `expression::parser::UnaryOperatorDefinition`, mirrored for the wire.
 */
export type UnaryOperatorSignature = { 
/**
 * identity — the operator's token text (`+`, `-`, `!`, `~`).
 */
token: string, };
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * The expression sandbox's DoS-guard budgets, mirrored off each `pub const`
 * at its own definition site — none of these live in this module.
 */
export type ExpressionBudgets = { 
/**
 * derived — `expression::eval::EVAL_STEP_BUDGET`.
 */
evalStepBudget: bigint, 
/**
 * derived — `expression::eval::MAX_ARRAY_LENGTH`.
 */
maxArrayLength: number, 
/**
 * derived — `expression::eval::MAX_CALL_DEPTH`.
 */
maxCallDepth: number, 
/**
 * derived — `expression::parser::EXPR_MAX_AST_DEPTH`.
 */
exprMaxAstDepth: number, 
/**
 * derived — `expression::parser::EXPR_MAX_LENGTH` (SSOT `document::model::EXPR_MAX_LENGTH`).
 */
exprMaxLength: number, };

12 namespaces, 51 functions, 51 builtins, 16 constants, 4 keywords, 15 array methods, 19 string methods, 16 binary + 4 unary operators, 2 properties, 7 blocked member names. Every root name the interpreter accepts inside a stored expression is one of these — a name can never be documented without being callable, or callable without being listed.

Point

functionparametersreturns
Point.distancefrom: point, to: pointnumber
Point.midpointfrom: point, to: pointpoint
Point.interpolatefrom: point, to: point, fraction: numberpoint
Point.translatepoint: point, offset: vectorpoint

Vector

functionparametersreturns
Vector.lengthvector: vectornumber
Vector.normalizevector: vectorvector
Vector.dota: vector, b: vectornumber
Vector.crossa: vector, b: vectorvector
Vector.anglea: vector, b: vectornumber
Vector.adda: vector, b: vectorvector
Vector.subtracta: vector, b: vectorvector
Vector.scalevector: vector, factor: numbervector
Vector.betweenfrom: vector, to: vectorvector

Plane

functionparametersreturns
Plane.fromPointNormalpoint: point, normal: vectorplane
Plane.pointplane: planepoint
Plane.normalplane: planevector
Plane.distanceplane: plane, query point: pointnumber

Line

functionparametersreturns
Line.fromPointDirectionorigin: point, direction: vectorline
Line.fromTwoPointsfrom point: point, to point: pointline
Line.originline: linepoint
Line.directionline: linevector
Line.pointAtline: line, distance: numberpoint

Transformation

functionparametersreturns
Transformation.translationvector: vectortransform
Transformation.rotationaxis origin: point, axis direction: vector, angle: numbertransform
Transformation.scalingsx: number, sy: number, sz: numbertransform
Transformation.composea: transform, b: transformtransform
Transformation.invertmatrix: transformtransform
Transformation.applymatrix: transform, point: pointpoint
Transformation.applyVectormatrix: transform, vector: vectorvector

Color

functionparametersreturns
Color.mixfrom: color, to: color, fraction: number?color
Color.darkencolor: color, step: number?color
Color.lightencolor: color, step: number?color
Color.saturatecolor: color, step: number?color
Color.rotatecolor: color, degrees: number?color
Color.hslhue: number, saturation: number?, lightness: number?color
Color.rgbred: number, green: number, blue: numbercolor
Color.alphacolor: color, value: numbercolor
Color.contrastbackground: color, dark: color?, light: color?color
Color.luminancecolor: colornumber

Format

functionparametersreturns
Format.currencyvalue: number, code: string?, locale: string?string
Format.numbervalue: number, decimals: number?, locale: string?string
Format.percentvalue: number, decimals: number?, locale: string?string
Format.datevalue: number | string, locale: string?, style: string?string

Arc

functionparametersreturns
Arc.fromCentercenter: point, normal: vector, radius: number, start angle: number, end angle: numbercurve
Arc.threePointsstart point: point, middle point: point, end point: pointcurve
Arc.tangentEndstart point: point, tangent: vector, end point: pointcurve

Ellipse

functionparametersreturns
Ellipse.fromCentercenter: point, normal: vector, radiusX: number, radiusY: number, xAxis: vector, start angle: number, end angle: numbercurve

Bezier

functionparametersreturns
Bezier.cubicstart point: point, control1 point: point, control2 point: point, end point: pointcurve
Bezier.quadraticstart point: point, control point: point, end point: pointcurve

Nurbs

functionparametersreturns
Nurbs.curvecontrol points: point[], weights: number[], knots: number[], degree: numbercurve

Spline

functionparametersreturns
Spline.throughpoints: point[], closed: boolean?, degree: number?curve

builtins

A root that is both an object with members AND itself callable (Number, Array) appears twice: once here under its own name, once under Global for its call form — both are real, accepted surfaces.

Math

functionparametersreturns
Math.absvalue: numbernumber
Math.signvalue: numbernumber
Math.floorvalue: numbernumber
Math.ceilvalue: numbernumber
Math.roundvalue: numbernumber
Math.truncvalue: numbernumber
Math.froundvalue: numbernumber
Math.clz32value: numbernumber
Math.imula: number, b: numbernumber
Math.sqrtvalue: numbernumber
Math.cbrtvalue: numbernumber
Math.expvalue: numbernumber
Math.expm1value: numbernumber
Math.logvalue: numbernumber
Math.log2value: numbernumber
Math.log10value: numbernumber
Math.log1pvalue: numbernumber
Math.sinvalue: numbernumber
Math.cosvalue: numbernumber
Math.tanvalue: numbernumber
Math.asinvalue: numbernumber
Math.acosvalue: numbernumber
Math.atanvalue: numbernumber
Math.sinhvalue: numbernumber
Math.coshvalue: numbernumber
Math.tanhvalue: numbernumber
Math.asinhvalue: numbernumber
Math.acoshvalue: numbernumber
Math.atanhvalue: numbernumber
Math.atan2y: number, x: numbernumber
Math.powbase: number, exponent: numbernumber
Math.minvalues: number?number
Math.maxvalues: number?number
Math.hypotvalues: number?number
Math.random—number

Number

functionparametersreturns
Number.isIntegervalue: anyboolean
Number.isFinitevalue: anyboolean
Number.isNaNvalue: anyboolean
Number.parseFloattext: string?number
Number.parseInttext: string?, radix: number?number

Object

functionparametersreturns
Object.keysobject: object?array
Object.valuesobject: object?array
Object.entriesobject: object?array

Array

functionparametersreturns
Array.fromsource: array?, mapFn: function?array

Global

functionparametersreturns
isNaNvalue: number?boolean
parseFloattext: string?number
parseInttext: string?, radix: number?number
Numbervalue: number?number
Stringvalue: string?string
Booleanvalue: boolean?boolean
Arrayvalues: any?array

constants

Numeric constants — values, not functions. object names which root each hangs on.

constantvalue
Math.PI3.141592653589793
Math.E2.718281828459045
Math.LN20.6931471805599453
Math.LN102.302585092994046
Math.LOG2E1.4426950408889634
Math.LOG10E0.4342944819032518
Math.SQRT21.4142135623730951
Math.SQRT1_20.7071067811865476
Number.MAX_SAFE_INTEGER9007199254740991
Number.MIN_SAFE_INTEGER-9007199254740991
Number.MAX_VALUE1.7976931348623157e+308
Number.MIN_VALUE2.2250738585072014e-308
Number.EPSILON2.220446049250313e-16
Number.POSITIVE_INFINITYInfinity
Number.NEGATIVE_INFINITY-Infinity
Number.NaNNaN

properties

Fixed member names resolved directly by Value::member (crates/model/src/expression/value.rs) — a plain field read, never a call, so it carries no parameters.

propertyreturns
<array>.lengthnumber
<string>.lengthnumber

keywords

Bare identifier-shaped tokens the parser (true/false) or the evaluator (null/undefined) resolve to a fixed value without a scope lookup — expression::value::KEYWORD_LITERALS.

keywordvalue type
trueboolean
falseboolean
nullnull
undefinednull

rejected member names

Member names Value::member refuses outright as a JS prototype sandbox-escape (expression::eval::BLOCKED_KEYS) — what a stored expression is REFUSED, not what it is granted.

name
constructor
__proto__
prototype
__defineGetter__
__defineSetter__
__lookupGetter__
__lookupSetter__

array methods

Every Value::Array method (arr.map(...), …); <array> stands for the receiver. length is a property, not a method call, and is not listed here.

functionparametersreturns
<array>.mapcallback: functionarray
<array>.filtercallback: functionarray
<array>.reducecallback: function, initialValue: any?any
<array>.findcallback: functionany
<array>.findIndexcallback: functionnumber
<array>.somecallback: functionboolean
<array>.everycallback: functionboolean
<array>.includessearchElement: any?boolean
<array>.indexOfsearchElement: any?number
<array>.slicestart: number?, end: number?array
<array>.concatvalues: any?array
<array>.joinseparator: string?string
<array>.flatdepth: number?array
<array>.atindex: number?any
<array>.reverse—array

string methods

Every Value::Text method (text.slice(...), …); <string> stands for the receiver. length is a property, not a method call, and is not listed here.

functionparametersreturns
<string>.charAtindex: number?string
<string>.atindex: number?any
<string>.indexOfsearchValue: string?number
<string>.slicestart: number?, end: number?string
<string>.splitseparator: string?array
<string>.includessearchValue: string?boolean
<string>.startsWithsearchValue: string?boolean
<string>.endsWithsearchValue: string?boolean
<string>.toUpperCase—string
<string>.toLowerCase—string
<string>.trim—string
<string>.trimStart—string
<string>.trimEnd—string
<string>.replacepattern: string?, replacement: string?string
<string>.replaceAllpattern: string?, replacement: string?string
<string>.repeatcount: number?string
<string>.padStarttargetLength: number?, padString: string?string
<string>.padEndtargetLength: number?, padString: string?string
<string>.concatvalues: any?string

operators

tokenprecedenceassociativity
||2left
&&3left
==4left
===4left
!=4left
!==4left
<5left
<=5left
>5left
>=5left
+6left
-6left
*7left
/7left
%7left
**8right

Unary (all bind at the same, highest precedence):

token
+
-
!
~

budgets

The expression sandbox's numeric DoS-guard budgets — every hostile expression is still user JSON.

budgetvaluesource
evalStepBudget100000crates/model/src/expression/eval.rs EVAL_STEP_BUDGET
maxArrayLength1000000crates/model/src/expression/eval.rs MAX_ARRAY_LENGTH
maxCallDepth64crates/model/src/expression/eval.rs MAX_CALL_DEPTH
exprMaxAstDepth100crates/model/src/expression/parser.rs EXPR_MAX_AST_DEPTH
exprMaxLength8000crates/model/src/document/model.rs EXPR_MAX_LENGTH
📖 7 min read