Skip to main content
Version: 1.x

@core/model-meta

The @core/model-meta plugin generates lightweight metadata for introspecting schema at runtime.

info

This plugin is always automatically included when zenstack generate is run. You only need to add it to your ZModel if you want to customize its options.

Installation

This plugin is built-in to ZenStack and does not need to be installed separately.

Options

NameTypeDescriptionRequiredDefault
outputStringOutput directory (relative to the path of ZModel)Nonode_modules/.zenstack
compileBooleanIf the generated TS code should be compiled to JSNotrue
preserveTsFilesBooleanIf the generated TS files should be preserved (after compiled to JS)Notrue if compile is set to false, otherwise false

Example

/schema.zmodel
plugin meta {
provider = '@core/model-meta'
output = 'src/lib/zenstack'
compile = false
}

Runtime APIs like enhance and withPolicy depend on the output of this plugin and by default load it from the default output location. If you customize the output location, you need to load and pass it manually:

const meta = require('./lib/zenstack/model-meta').default;
const db = enhance(prisma, { user }, undefined, meta);
Comments
Feel free to ask questions, give feedback, or report issues.

Don't Spam


You can edit/delete your comments by going directly to the discussion, clicking on the 'comments' link below