Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Prisma v5 #11

Closed
jaaneh opened this issue Jul 24, 2023 · 8 comments
Closed

Not compatible with Prisma v5 #11

jaaneh opened this issue Jul 24, 2023 · 8 comments

Comments

@jaaneh
Copy link

jaaneh commented Jul 24, 2023

Hey, trying to get this working with v5 and saw #10 was merged. However, it doesn't seem to be functional with this still.

Prisma v4.16.2 works fine with no errors.

Prisma v5.0.0:
image

Here's my prisma setup

import { PrismaClient } from "@prisma/client"
import pagination from "prisma-extension-pagination"

const prismaClient = new PrismaClient()
const prisma = prismaClient.$extends(pagination)

export default prisma
@jaaneh
Copy link
Author

jaaneh commented Jul 24, 2023

Actually, using a setup like this seems to work, but adding it to all models is causing issues.

import { PrismaClient } from "@prisma/client"
import { paginate } from "prisma-extension-pagination"

const prismaClient = new PrismaClient()
const prisma = prismaClient.$extends({
  model: {
    book: {
      paginate
    }
  }
})

export default prisma

@jaaneh
Copy link
Author

jaaneh commented Jul 24, 2023

Also going to hijack my own issue to ask if it's possible to add config globally. For example, I want to add includePageCount: true as default to all responses, and instead disable it for the few where I may not want it.

@deptyped
Copy link
Owner

Hi, it looks like a problem with module resolution. Can you provide your tsconfig?

Also going to hijack my own issue to ask if it's possible to add config globally. For example, I want to add includePageCount: true as default to all responses, and instead disable it for the few where I may not want it.

No, this is not implemented yet.

@jaaneh
Copy link
Author

jaaneh commented Jul 24, 2023

Hi, it looks like a problem with module resolution. Can you provide your tsconfig?

Sure. Here you are

{
  "compilerOptions": {
    "module": "commonjs",
    "allowSyntheticDefaultImports": true,
    "target": "esnext",
    "noImplicitAny": true,
    "esModuleInterop": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "sourceMap": true,
    "outDir": "dist",
    "baseUrl": "src",
    "strict": true,
    "typeRoots": ["types"]
  },
  "include": ["src/**/*", "types"],
  "exclude": ["node_modules"]
}

@deptyped
Copy link
Owner

@jaaneh Can you test version 0.4.1? Should be fixed now

@jaaneh
Copy link
Author

jaaneh commented Jul 25, 2023

Can you test version 0.4.1? Should be fixed now

Unfortunately looks like it's still an issue. I'm extending all to get around it for now.

import { PrismaClient } from "@prisma/client"
import { paginate } from "prisma-extension-pagination"

const prisma = new PrismaClient().$extends({
  model: {
    $allModels: {
      paginate
    }
  }
})

@deptyped
Copy link
Owner

@jaaneh Can you test 0.4.2?

If still not working please check this minimal reproducible example, works for me
https://github.com/deptyped/prisma-extension-pagination-issue-11

@jaaneh
Copy link
Author

jaaneh commented Jul 25, 2023

@jaaneh Can you test 0.4.2?

0.4.2 works! 🎉 Thank you for fixing so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants