API Reference

Key exports and types from @constela/core

Key Exports

ExportDescription
ProgramTypeScript type for the root program structure
ViewNodeUnion type for all view node types
ExpressionUnion type for all expression types
ActionDefinitionType for action definitions
ActionStepUnion type for all step types
validateProgramFunction to validate a program against the schema
ProgramSchemaZod schema for runtime validation

Type Definitions

Program

The root type for a Constela program:

typescript
interface Program {
  version: string;
  state?: Record<string, StateField>;
  actions?: ActionDefinition[];
  view: ViewNode;
  components?: Record<string, ComponentDefinition>;
  styles?: Record<string, StylePreset>;
  imports?: Record<string, string>;
  connections?: Record<string, ConnectionDefinition>;
}

validateProgram

Validates a program against the Constela schema:

typescript
function validateProgram(program: unknown): ValidationResult;

interface ValidationResult {
  success: boolean;
  errors?: ValidationError[];
}