Leinster maintained their unbeaten league record with an 11th straight success in a hard-fought 22-19 win over Ospreys in Swansea.