Type Reference
This page documents all TypeScript types exported by @omega-flow/editor and @omega-flow/types.
Core Types (@omega-flow/types)
Workflow
interface Workflow {
id: string;
name: string;
flow: {
nodes: Node[];
edges: Edge[];
};
options: WorkflowOptions;
}The main workflow definition containing the flow graph and metadata.
| Property | Type | Description |
|---|---|---|
id | string | Unique workflow identifier |
name | string | Human-readable workflow name |
flow | { nodes, edges } | The workflow graph |
options | WorkflowOptions | Configuration options |
WorkflowOptions
interface WorkflowOptions {
frequency?: WorkflowFrequency;
[key: string]: any;
}Workflow configuration options.
| Property | Type | Description |
|---|---|---|
frequency | WorkflowFrequency | Execution frequency settings |
WorkflowFrequency
interface WorkflowFrequency {
type: "one_time" | "every_rematch";
interval?: number;
}Controls how often a subject can enter/re-enter a workflow.
| Property | Type | Description |
|---|---|---|
type | "one_time" | "every_rematch" | Frequency type |
interval | number | Interval in seconds (for every_rematch) |
Frequency Types:
one_time- Subject enters only the first time they meet trigger conditionsevery_rematch- Subject can re-enter at specified intervals
WorkflowStatus
enum WorkflowStatus {
Idle = "idle",
Waiting = "waiting",
Processing = "processing",
Transforming = "transforming",
Completed = "completed",
}Workflow execution states.
| Status | Description |
|---|---|
idle | Initial state, workflow not started |
waiting | Running, waiting for events |
processing | Currently processing an event |
transforming | Moving between nodes |
completed | Workflow finished |
Node
// 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
// 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
interface Event {
id: string;
time: number;
type: string;
data?: any;
}An event that can trigger or progress a workflow.
| Property | Type | Description |
|---|---|---|
id | string | Unique event identifier |
time | number | Timestamp (Unix ms) |
type | string | Event type for matching |
data | any | Optional payload data |
Context
interface Context {
workflowId: string;
instanceId: string;
currentNodeId: string | null;
nodeState: NodeState;
history: WorkflowHistoryItem[];
isCompleted?: boolean;
startedAt: number;
}Execution state for a workflow instance.
| Property | Type | Description |
|---|---|---|
workflowId | string | Which workflow this instance runs |
instanceId | string | Unique instance identifier |
currentNodeId | string | null | Node currently waiting for events |
nodeState | NodeState | State data for nodes |
history | WorkflowHistoryItem[] | Execution history |
isCompleted | boolean | Whether workflow finished |
startedAt | number | Start timestamp (Unix ms) |
NodeState
interface NodeState {
[key: string]: any;
}Flexible key-value storage for node state.
WorkflowHistoryItem
interface WorkflowHistoryItem {
time: number;
type: "started" | "step" | "completed";
fromNodeId?: string | null;
toNodeId?: string | null;
}A record of workflow execution events.
| Property | Type | Description |
|---|---|---|
time | number | When this occurred |
type | string | Type of history event |
fromNodeId | string | null | Source node |
toNodeId | string | null | Destination node |
Editor Types (@omega-flow/editor)
NodeTypeDefinition
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.
| Property | Type | Description |
|---|---|---|
type | string | Unique type identifier |
label | string | Display name |
description | string | Tooltip/description text |
Icon | ComponentType | Icon component |
defaultData | Record | Initial data for new nodes |
sourceHandles | HandleDefinition[] | Output handles |
targetHandles | HandleDefinition[] | Input handles |
ViewComponent | ComponentType | Canvas render component |
DetailComponent | ComponentType | Properties panel component |
HandleDefinition
interface HandleDefinition {
id: string;
label?: string;
}Definition for a connection handle on a node.
| Property | Type | Description |
|---|---|---|
id | string | Handle identifier |
label | string | Display label |
NodeViewProps
type NodeViewProps = NodeProps; // From @xyflow/reactProps passed to node view components (on canvas). Extends ReactFlow's NodeProps.
Key properties:
id: string- Node IDdata: Record<string, unknown>- Node dataselected: boolean- Selection statedragging: boolean- Drag state
NodeDetailProps
interface NodeDetailProps {
node: Node;
onChange: (data: Record<string, unknown>) => void;
}Props passed to node detail components (properties panel).
| Property | Type | Description |
|---|---|---|
node | Node | The node being edited |
onChange | (data) => void | Update node data callback |
WorkflowEditorState
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
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
interface WorkflowEditorContextValue
extends WorkflowEditorState,
WorkflowEditorActions {}Complete context value combining state and actions.
Component Props
WorkflowEditorProps
interface WorkflowEditorProps {
children: ReactNode;
workflow?: Workflow;
nodeTypes?: NodeTypeDefinition[];
onWorkflowChange?: (workflow: Workflow) => void;
onDirtyChange?: (isDirty: boolean) => void;
translationFn?: TranslationFunction;
translations?: TranslationDictionary;
}| Property | Type | Description |
|---|---|---|
translationFn | TranslationFunction | Custom translation function (replaces built-in resolver) |
translations | TranslationDictionary | Dictionary merged on top of defaults (ignored when translationFn is set) |
See Localization for usage details.
NodesPanelProps
interface NodesPanelProps {
className?: string;
showDescriptions?: boolean;
filter?: (nodeType: NodeTypeDefinition) => boolean;
renderItem?: (nodeType: NodeTypeDefinition) => ReactNode;
}DetailPanelProps
interface DetailPanelProps {
className?: string;
emptyMessage?: ReactNode;
showNodeType?: boolean;
showNodeId?: boolean;
}OptionsPanelProps
interface OptionsPanelProps {
className?: string;
showFrequency?: boolean;
customOptions?: ReactNode;
}ControlPanelProps
interface ControlPanelProps {
className?: string;
showName?: boolean;
showSaveButton?: boolean;
saveButtonLabel?: string;
onSave?: () => Promise<void>;
renderActions?: (context: { isDirty: boolean; workflow: Workflow }) => ReactNode;
}BaseNodeViewProps
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:
FieldPropsTextFieldPropsNumberFieldPropsSelectFieldPropsSelectOptionCheckboxFieldPropsTextAreaFieldPropsDurationFieldPropsJsonFieldPropsFieldGroupProps
JSON Schemas
The @omega-flow/types package exports JSON schemas for validation:
import {
WorkflowSchema,
EventSchema,
ContextSchema,
} from "@omega-flow/types";Use with Ajv for runtime validation:
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
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
type TranslationDictionary = Record<string, string>;A flat mapping of keys to translation strings. Supports interpolation placeholders.
TranslationProviderProps
interface TranslationProviderProps {
children: ReactNode;
translationFn?: TranslationFunction;
translations?: TranslationDictionary;
}Props for the TranslationProvider component (used internally by WorkflowEditor).
Utility Functions
nodeHasType
function nodeHasType(node: Node): node is Node & { type: string };Type guard to check if a node has a type property.
import { nodeHasType } from "@omega-flow/types";
if (nodeHasType(node)) {
console.log(node.type); // TypeScript knows type exists
}