Object-relational mapping for javascript objects