prisma-datamodel
Advanced tools
Comparing version 1.32.0-alpha.5 to 1.32.0-alpha.6
{ | ||
"name": "prisma-datamodel", | ||
"version": "1.32.0-alpha.5", | ||
"version": "1.32.0-alpha.6", | ||
"description": "Transform prisma datamodel SDL into graphql-js SDL", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,7 +7,7 @@ # prisma-datamodel | ||
* Data structures to represent datamodels in memory: `ISDL`, `IGQLType`, `IGQLField`. These data structures are documented inline. The data structures might be self referencing, and all operations in this library guarantee to keep the references valid. | ||
* Constants for known primitive types: `TypeIdentifier`, `TypeIdentifiers` | ||
* Classes to parse data models from strings into the internal format: `Parser`, with the factory class`DefaultParser` | ||
* Classes to render data models to strings, from the internal format: `Renderer`, with the factory class `Default Renderer` | ||
* Auxiliary functions: `cloneSchema` to safely clone an `ISDL`structure, `toposort`to sort a datamodel in topological order. | ||
- Data structures to represent datamodels in memory: `ISDL`, `IGQLType`, `IGQLField`. These data structures are documented inline. The data structures might be self referencing, and all operations in this library guarantee to keep the references valid. | ||
- Constants for known primitive types: `TypeIdentifier`, `TypeIdentifiers` | ||
- Classes to parse data models from strings into the internal format: `Parser`, with the factory class`DefaultParser` | ||
- Classes to render data models to strings, from the internal format: `Renderer`, with the factory class `Default Renderer` | ||
- Auxiliary functions: `cloneSchema` to safely clone an `ISDL`structure, `toposort`to sort a datamodel in topological order. | ||
@@ -20,3 +20,3 @@ ### Different Database Types | ||
The parser is capable of parsing both datamodel formats, and even models with mixed directives from both standards. For rendering, a flag can be passed which indicates the datamodel format to follow. | ||
The parser is capable of parsing both datamodel formats, and even models with mixed directives from both standards. For rendering, a flag can be passed which indicates the datamodel format to follow. | ||
@@ -38,11 +38,17 @@ ### Modifying a Model | ||
// Do something with the model | ||
for(const type of model.types) { | ||
console.log(`${type.name} has ${type.fields.length} fields and ${type.indices.length} indexes`) | ||
for (const type of model.types) { | ||
console.log( | ||
`${type.name} has ${type.fields.length} fields and ${ | ||
type.indices.length | ||
} indexes`, | ||
) | ||
} | ||
const enableDatamodel1_1 = true | ||
const renderer = DefaultRenderer.create(DatabaseType.postgres, enableDatamodel1_1) | ||
const renderer = DefaultRenderer.create( | ||
DatabaseType.postgres, | ||
enableDatamodel1_1, | ||
) | ||
const renderedAsString = renderer.render(model) | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208806
52