State Management
Core Principles
Basic State Operations
Accessing State
// Access the complete state
const orderState = orderNode.state.get();
// Access with transformation (focused state access)
const activeOrders = orderNode.state.get(state =>
(state.orders || {}).filter(order => order.status === "active")
);Transforming State
Composing Transformations
View System
Basic View Usage
Enhanced Collection
Scaling Patterns
Selective State Access
Domain Partitioning
Event-Driven State Synchronization
Chunked Processing
Advanced Patterns
State Versioning
Computed State
State-Based Event Generation
NATS JetStream Key-Value Store Integration
Best Practices
Keep State Focused
Use Immutable Patterns
Prefer Event Communication
Let Event Flow Drive State Changes
Last updated