Registry / database / prisma-schema-dsl-types

prisma-schema-dsl-types

JSON →
library1.1.2jsnpmunverified

Provides TypeScript type definitions for prisma-schema-dsl, enabling typed AST manipulation of Prisma schema files. Current version 1.1.2, release schedule follows prisma-schema-dsl. Differentiator: tightly coupled to the prisma-schema-dsl library for building and transforming Prisma schema ASTs with full type safety.

npm install prisma-schema-dsl-types
INSTALL
IMPORT
SIG · PRISMA-SCHEMA-DSL-
P
prisma-schema-dsl-types
databasejavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PrismaSchema
✓ import { PrismaSchema } from 'prisma-schema-dsl-types'
✗ import { PrismaSchema } from 'prisma-schema-dsl'
Types are exported from this separate package, not from prisma-schema-dsl itself.
Model
✓ import { Model } from 'prisma-schema-dsl-types'
✗ const { Model } = require('prisma-schema-dsl-types')
ESM-only package; use import statements. CommonJS require is unsupported.
Field
✓ import type { Field } from 'prisma-schema-dsl-types'
✗ import { Field } from 'prisma-schema-dsl-types'
Field is a type and can be imported with 'import type' for compile-time only usage.

Creates a typed Prisma schema AST for a User model with id and email fields, then logs the JSON representation.

import { PrismaSchema, Model, Field, FieldType, Attribute } from 'prisma-schema-dsl-types'; const schema: PrismaSchema = { models: [], enums: [], }; const model: Model = { name: 'User', fields: [ { name: 'id', type: FieldType.String, isRequired: true, isId: true, attributes: [ { name: 'default', args: [{ type: 'string', value: 'autoincrement()' }] }, ], }, { name: 'email', type: FieldType.String, isRequired: true, isUnique: true, }, ], attributes: [ { name: 'map', args: [{ type: 'string', value: 'users' }] }, ], }; schema.models.push(model); console.log(JSON.stringify(schema, null, 2));
Debug
Known issues
deprecatedFieldType is deprecated in favor of using string literals for field types.
fix
Use string type names directly, e.g., 'String' instead of FieldType.String.
affects: >=1.0.0
gotchaESM-only package; CommonJS require will not work.
fix
Use ES module import syntax. If using Node.js, ensure package.json has "type": "module" or use .mjs extension.
affects: >=1.0.0
breakingThe Field interface properties have changed: 'isUnique' is now optional and moved to attributes with @unique.
fix
Use Attribute with name 'unique' instead of isUnique field property.
affects: >=1.1.0
Errors
Common errors & fixes
Cannot find module 'prisma-schema-dsl-types' or its corresponding type declarations.
Package not installed or version mismatch with prisma-schema-dsl.
fix
npm install prisma-schema-dsl-types@1.1.2
TS2322: Type '{ name: string; type: string; ... }' is not assignable to type 'Field'.
Missing required properties or incorrect property types.
fix
Check Field type definition: ensure all required fields (name, type, isRequired) are present and correct.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources