Niche dimensionality links biodiversity and invasibility of microbial communities