zenstackhq / zenstack

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.
https://zenstack.dev
MIT License
2.07k stars 89 forks source link

Zenstack VSCode plugin import from a NPM package leads to `Cannot find model file` error #1626

Open Tsimopak opened 2 months ago

Tsimopak commented 2 months ago

Zenstack plugin import from a npm package leads to Cannot find model file (although it does work when trying to do npx zenstack generate) Plugin version: v2.3.0

An easy way to reproduce in case you need a npm package: npm install @dptickets2/common

then in schema.zmodel file:

import '@dptickets2/common/models/outbox'

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")}

The issue is quite annoying because right now in vscode, i have an error indication that reflects on my whole repository.

Tsimopak commented 2 months ago

Another issue - from some reason the assumption is that i must have in my npm module a schema.zmodel, specifically with schema name, even if it's not being used and u make also other zmodel fiels and include only them.