Measurement of prompt open-charm production cross sections in proton-proton collisions at $\sqrt{s} = $ 13 TeV