(#838) - added db.sync API

Based on @garbados PR1071. Additionally updates usage of a clone() function to utils.extend(), exposes a global sync.cancel, and replaces <code>replications</code> prototype.