Exploring Transaction Injection to Avoid Interface Pollution: Seeking Feedback on Potential Issues

Hello, experimenting with injecting transactions so interfaces are not polluted. Could you please point out potential problems with this approach?

export const runInsideTransaction = <E, A>(effect: Effect.Effect<A, E, PrismaClientTx>) =>
    PrismaClient.pipe(
        Effect.flatMap(prisma =>
            prisma.wrap(_ =>
                _.$transaction(tx =>
                    effect.pipe(
                        Effect.provide(PrismaClientTxLayer),
                        Effect.provide(Context.make(PrismaTx, tx)),
                        appRunPromise,
                    ),
                ),
            ),
        ),
    )


some tests: https://gist.github.com/yanisurbis/fa2db89e0143a9a3fda1108eb3b1f715
Was this page helpful?