Closed jaaneh closed 1 year ago
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
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.
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.
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"]
}
@jaaneh Can you test version 0.4.1? Should be fixed now
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
}
}
})
@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 Can you test 0.4.2?
0.4.2 works! 🎉 Thank you for fixing so quickly.
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:
Here's my prisma setup