Merge branch 'tristan/refactor-types-api' into 'master'

Refactor types api

See merge request BuildStream/buildstream!870