Skip to content

Type Reference

This page documents all TypeScript types exported by @omega-flow/editor and @omega-flow/types.

Core Types (@omega-flow/types)

Workflow

typescript
interface Workflow {
  id: string;
  name: string;
  flow: {
    nodes: Node[];
    edges: Edge[];
  };
  options: WorkflowOptions;
}

The main workflow definition containing the flow graph and metadata.

PropertyTypeDescription
idstringUnique workflow identifier
namestringHuman-readable workflow name
flow{ nodes, edges }The workflow graph
optionsWorkflowOptionsConfiguration options

WorkflowOptions

typescript
interface WorkflowOptions {
  frequency?: WorkflowFrequency;
  [key: string]: any;
}

Workflow configuration options.

PropertyTypeDescription
frequencyWorkflowFrequencyExecution frequency settings

WorkflowFrequency

typescript
interface WorkflowFrequency {
  type: "one_time" | "every_rematch";
  interval?: number;
}

Controls how often a subject can enter/re-enter a workflow.

PropertyTypeDescription
type"one_time" | "every_rematch"Frequency type
intervalnumberInterval in seconds (for every_rematch)

Frequency Types:

  • one_time - Subject enters only the first time they meet trigger conditions
  • every_rematch - Subject can re-enter at specified intervals

WorkflowStatus

typescript
enum WorkflowStatus {
  Idle = "idle",
  Waiting = "waiting",
  Processing = "processing",
  Transforming = "transforming",
  Completed = "completed",
}

Workflow execution states.

StatusDescription
idleInitial state, workflow not started
waitingRunning, waiting for events
processingCurrently processing an event
transformingMoving between nodes
completedWorkflow finished

Node

typescript
// Re-exported from @xyflow/react
interface Node {
  id: string;
  type?: string;
  position: { x: number; y: number };
  data: Record<string, unknown>;
  // ...other ReactFlow node properties
}

A node in the workflow graph. Uses ReactFlow's Node type.


Edge

typescript
// Re-exported from @xyflow/react
interface Edge {
  id: string;
  source: string;
  target: string;
  sourceHandle?: string;
  targetHandle?: string;
  // ...other ReactFlow edge properties
}

A connection between nodes. Uses ReactFlow's Edge type.


Event

typescript
interface Event {
  id: string;
  time: number;
  type: string;
  data?: any;
}

An event that can trigger or progress a workflow.

PropertyTypeDescription
idstringUnique event identifier
timenumberTimestamp (Unix ms)
typestringEvent type for matching
dataanyOptional payload data

Context

typescript
interface Context {
  workflowId: string;
  instanceId: string;
  currentNodeId: string | null;
  nodeState: NodeState;
  history: WorkflowHistoryItem[];
  isCompleted?: boolean;
  startedAt: number;
}

Execution state for a workflow instance.

PropertyTypeDescription
workflowIdstringWhich workflow this instance runs
instanceIdstringUnique instance identifier
currentNodeIdstring | nullNode currently waiting for events
nodeStateNodeStateState data for nodes
historyWorkflowHistoryItem[]Execution history
isCompletedbooleanWhether workflow finished
startedAtnumberStart timestamp (Unix ms)

NodeState

typescript
interface NodeState {
  [key: string]: any;
}

Flexible key-value storage for node state.


WorkflowHistoryItem

typescript
interface WorkflowHistoryItem {
  time: number;
  type: "started" | "step" | "completed";
  fromNodeId?: string | null;
  toNodeId?: string | null;
}

A record of workflow execution events.

PropertyTypeDescription
timenumberWhen this occurred
typestringType of history event
fromNodeIdstring | nullSource node
toNodeIdstring | nullDestination node

Editor Types (@omega-flow/editor)

NodeTypeDefinition

typescript
interface NodeTypeDefinition {
  type: string;
  label: string;
  description?: string;
  Icon?: ComponentType<{ size?: number }>;
  defaultData: Record<string, unknown>;
  sourceHandles: HandleDefinition[];
  targetHandles: HandleDefinition[];
  ViewComponent: ComponentType<NodeViewProps>;
  DetailComponent: ComponentType<NodeDetailProps>;
}

Complete definition of a node type.

PropertyTypeDescription
typestringUnique type identifier
labelstringDisplay name
descriptionstringTooltip/description text
IconComponentTypeIcon component
defaultDataRecordInitial data for new nodes
sourceHandlesHandleDefinition[]Output handles
targetHandlesHandleDefinition[]Input handles
ViewComponentComponentTypeCanvas render component
DetailComponentComponentTypeProperties panel component

HandleDefinition

typescript
interface HandleDefinition {
  id: string;
  label?: string;
}

Definition for a connection handle on a node.

PropertyTypeDescription
idstringHandle identifier
labelstringDisplay label

NodeViewProps

typescript
type NodeViewProps = NodeProps; // From @xyflow/react

Props passed to node view components (on canvas). Extends ReactFlow's NodeProps.

Key properties:

  • id: string - Node ID
  • data: Record<string, unknown> - Node data
  • selected: boolean - Selection state
  • dragging: boolean - Drag state

NodeDetailProps

typescript
interface NodeDetailProps {
  node: Node;
  onChange: (data: Record<string, unknown>) => void;
}

Props passed to node detail components (properties panel).

PropertyTypeDescription
nodeNodeThe node being edited
onChange(data) => voidUpdate node data callback

WorkflowEditorState

typescript
interface WorkflowEditorState {
  workflow: Workflow | null;
  nodes: Node[];
  edges: Edge[];
  options: WorkflowOptions;
  name: string;
  selectedNodeId: string | null;
  isDirty: boolean;
  nodeTypes: Map<string, NodeTypeDefinition>;
}

Editor state managed by context.


WorkflowEditorActions

typescript
interface WorkflowEditorActions {
  loadWorkflow: (workflow: Workflow) => void;
  resetWorkflow: () => void;
  addNode: (type: string, position: { x: number; y: number }) => void;
  updateNode: (nodeId: string, data: Record<string, unknown>) => void;
  updateNodePosition: (nodeId: string, position: { x: number; y: number }) => void;
  removeNode: (nodeId: string) => void;
  selectNode: (nodeId: string | null) => void;
  addEdge: (connection: Connection) => void;
  removeEdge: (edgeId: string) => void;
  setName: (name: string) => void;
  setOptions: (options: WorkflowOptions) => void;
  registerNodeType: (definition: NodeTypeDefinition) => void;
  getWorkflow: () => Workflow;
  markClean: () => void;
  onNodesChange: (changes: unknown[]) => void;
  onEdgesChange: (changes: unknown[]) => void;
  onConnect: (connection: unknown) => void;
}

Actions available in the editor context.


WorkflowEditorContextValue

typescript
interface WorkflowEditorContextValue
  extends WorkflowEditorState,
    WorkflowEditorActions {}

Complete context value combining state and actions.


Component Props

WorkflowEditorProps

typescript
interface WorkflowEditorProps {
  children: ReactNode;
  workflow?: Workflow;
  nodeTypes?: NodeTypeDefinition[];
  onWorkflowChange?: (workflow: Workflow) => void;
  onDirtyChange?: (isDirty: boolean) => void;
  translationFn?: TranslationFunction;
  translations?: TranslationDictionary;
}
PropertyTypeDescription
translationFnTranslationFunctionCustom translation function (replaces built-in resolver)
translationsTranslationDictionaryDictionary merged on top of defaults (ignored when translationFn is set)

See Localization for usage details.

NodesPanelProps

typescript
interface NodesPanelProps {
  className?: string;
  showDescriptions?: boolean;
  filter?: (nodeType: NodeTypeDefinition) => boolean;
  renderItem?: (nodeType: NodeTypeDefinition) => ReactNode;
}

DetailPanelProps

typescript
interface DetailPanelProps {
  className?: string;
  emptyMessage?: ReactNode;
  showNodeType?: boolean;
  showNodeId?: boolean;
}

OptionsPanelProps

typescript
interface OptionsPanelProps {
  className?: string;
  showFrequency?: boolean;
  customOptions?: ReactNode;
}

ControlPanelProps

typescript
interface ControlPanelProps {
  className?: string;
  showName?: boolean;
  showSaveButton?: boolean;
  saveButtonLabel?: string;
  onSave?: () => Promise<void>;
  renderActions?: (context: { isDirty: boolean; workflow: Workflow }) => ReactNode;
}

BaseNodeViewProps

typescript
interface BaseNodeViewProps {
  id: string;
  data: Record<string, unknown>;
  selected?: boolean;
  label: string;
  color?: string;
  icon?: React.ReactNode;
  sourceHandles?: HandleDefinition[];
  targetHandles?: HandleDefinition[];
  children?: React.ReactNode;
}

Primitive Props

See Primitives API for form field prop types:

  • FieldProps
  • TextFieldProps
  • NumberFieldProps
  • SelectFieldProps
  • SelectOption
  • CheckboxFieldProps
  • TextAreaFieldProps
  • DurationFieldProps
  • JsonFieldProps
  • FieldGroupProps

JSON Schemas

The @omega-flow/types package exports JSON schemas for validation:

typescript
import {
  WorkflowSchema,
  EventSchema,
  ContextSchema,
} from "@omega-flow/types";

Use with Ajv for runtime validation:

typescript
import Ajv from "ajv";
import { WorkflowSchema } from "@omega-flow/types";

const ajv = new Ajv();
const validate = ajv.compile(WorkflowSchema);

if (!validate(workflow)) {
  console.error("Invalid workflow:", validate.errors);
}

Localization Types

TranslationFunction

typescript
type TranslationFunction = (
  key: string,
  params?: Record<string, string>
) => string;

The core function signature for translating strings. Accepts a dot-separated key and optional interpolation parameters ().


TranslationDictionary

typescript
type TranslationDictionary = Record<string, string>;

A flat mapping of keys to translation strings. Supports interpolation placeholders.


TranslationProviderProps

typescript
interface TranslationProviderProps {
  children: ReactNode;
  translationFn?: TranslationFunction;
  translations?: TranslationDictionary;
}

Props for the TranslationProvider component (used internally by WorkflowEditor).


Utility Functions

nodeHasType

typescript
function nodeHasType(node: Node): node is Node & { type: string };

Type guard to check if a node has a type property.

typescript
import { nodeHasType } from "@omega-flow/types";

if (nodeHasType(node)) {
  console.log(node.type); // TypeScript knows type exists
}