Flow photochemical routes to indoles and 8-membered lactones, and their application in target synthesis