Calling a Series of Effects Keyed in an Object

morning ☀️ I have kinda noobie questions: Is there a way to run a series of effects that are key'd in an object. Say I have an object like:
const api = {
  allProjects: () => Effect.runSync(Effect.sync(()=>{...})),
  getProject: (id: string) => Effect.runSync(Effect.sync(()=>{...})),
}

At the moment I need to use Effect.runSync() on each prop to get something I can run on the edge of my logic, but this is a bit verbose and what if I want to pipe a provider into all of them at once 🤔

I'm wondering if there is a way to have something like:
const apiLayer = Effect._(()=>{      // <- this part I'm not sure about
  allProjects: () => Effect.sync(()=>{...}),
  getProject: (id: string) => Effect.sync(()=>{...}),
})

const api = Effect.runPromise(apiLayer.pipe(Effect.provider(FileRepository.Live))) // <- so i can pass things here as needed for mocking


Any help is much appreciated. 🙏
Was this page helpful?