Skip to content

Redwood package for RedwoodJS V7 #1553

@ladderschool

Description

@ladderschool

Description and expected behavior
Using the official package to integrate ZenStack into a RedwoodJS project does not currently work.
https://www.npmjs.com/package/@zenstackhq/redwood

Environment (please complete the following information):

  • ZenStack version: [2.2.1]
  • Prisma version: [5.7.0]
  • Redwood version: [7.7.2]

Additional context
When V7 came out for Redwood they migrated the global context. It is now found under @redwoodjs/context. If you change the module in the zenstack.d.ts file you can use ZenStack with RedwoodJS V7+. I have confirmed that all features work including delegated types, ACL and the CLI commands.

- declare module '@redwoodjs/graphql-server' {
+ declare module '@redwoodjs/context' {
  interface GlobalContext {
    db: PrismaClient
    currentUser?: Overwrite<UndefinedRoles, InferredCurrentUser>
  }
}

Also I found that after running the setup package command my paths were incorrect:

    "zenstack": {
        "schema": "db\\schema.zmodel",
        "prisma": "db\\schema.prisma"
    }

should be:

    "zenstack": {
        "schema": "db/schema.zmodel",
        "prisma": "db/schema.prisma"
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions