Guard configuration
A method decorator
@kosStateGuard({ allowedStates: ['ready'] })
async pourBeverage(bevId: string): Promise<void> {
// This method can only be called when currentState === 'ready'
this.transition('POUR');
await this.deviceService.dispense(bevId);
this.transition('COMPLETE');
}
Method decorator that guards a method with state validation. The decorated method can only be called when the state machine is in one of the allowed states.
IMPORTANT: This decorator gracefully handles uninitialized FSM: