olivierwilkinson / prisma-extension-soft-delete

Prisma extension for adding soft delete to Prisma models, even when using nested queries
Apache License 2.0
93 stars 13 forks source link

Regression in v1.0.1 #22

Open KittyGiraudel opened 6 months ago

KittyGiraudel commented 6 months ago

Hello and thank you for your work on this extension. 👋

I am afraid the recent release of v1.0.1 introduced a significant regression. We author some of our type resolvers like this, to return nested entities:

import { Resolvers } from '../../generated';

export const ProjectType: Resolvers = {
  Project: {
    template: (project, _, { prisma }) => prisma.project.findUniqueOrThrow({ where: { id: project.id } }).template(),
    theme: (project, _, { prisma }) => prisma.project.findUniqueOrThrow({ where: { id: project.id } }).theme(),
    music: (project, _, { prisma }) => prisma.project.findUniqueOrThrow({ where: { id: project.id } }).music(),
};

Unfortunately, with the latest update, we get the following errors:

prisma.project.findUniqueOrThrow(...).template is not a function prisma.project.findUniqueOrThrow(...).theme is not a function prisma.project.findUniqueOrThrow(...).music is not a function

I assume the problem occurred in https://github.com/olivierwilkinson/prisma-extension-soft-delete/commit/0cb041c3839180a6391b72114ab8399ad0c2f80e.

Let me know if I can provide more details. Cheers! :)

olivierwilkinson commented 6 months ago

Heya,

thank you for bringing this to my attention! You are correct, I've broken the Fluent API entirely.

I was really debating whether to make that commit a breaking change or not, and landed on the wrong side of that debate clearly... I'm sorry if I caused you any disruption!

I'll look into this soon, and if I can't fix it then I will revert the commit you mentioned.

Thanks again for raising this 🙌

JClackett commented 2 weeks ago

Any idea if this will be fixed in a newer release?