refactor(cloudfunc) buildFromJSON