Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
If the client generator has different output folder then running generate throws error if schema contains enum.
For eg if we have the schema like below
generator client {
provider = "prisma-client-js"
output = "../../../../node_modules/.prisma/abc-client"
previewFeatures = ["fullTextSearch"]
}
datasource db {
provider = "postgresql"
url = env("DB_URL")
}
enum Role {
SUPER_ADMIN
ADMIN
USER
}
It throws errors while running npx zenstack generate
node_modules/.pnpm/@zenstackhq+runtime@1.0.0-alpha.126_@prisma+client@4.15.0/node_modules/.zenstack/policy.ts:3:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Role'.
3 import { Role } from "@prisma/client";
~~~~
node_modules/.pnpm/@zenstackhq+runtime@1.0.0-alpha.126_@prisma+client@4.15.0/node_modules/.zenstack/policy.ts:4:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Status'.
4 import { Status } from "@prisma/client";
~~~~~~
✖ Running plugin Access Policy
: Error compiling generated code
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
ZenStack version: 1.0.0-alpha.126
Prisma version: 4.15.0
Database type: Postgresql
Additional context
If we remove the enum from the schema it complies fine and works as expected
Thanks for filing this @bphkns. Yes, there are caveats when configuring prisma with a custom output location. Let me look into more details on how much a fix involves.
Description and expected behavior
If the client generator has different output folder then running generate throws error if schema contains enum.
For eg if we have the schema like below
It throws errors while running
npx zenstack generate
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context If we remove the enum from the schema it complies fine and works as expected