2.2.0 • Published 8 months ago

prisma-schema-dsl v2.2.0

Weekly downloads
39
License
MIT
Repository
-
Last release
8 months ago

Node.js CI

JavaScript interface for Prisma Schema DSL

Installation

npm install prisma-schema-dsl

API

Print

print(schema: Schema): Promise<string>

Prints Prisma schema file from AST. The schema is formatted using prisma-format.

Builders

createSchema(models: Model[], dataSource?: DataSource): Schema

Creates a schema AST object

createEnum(name: string, values: string[], documentation?: string): Enum

  • Creates an enum AST object
  • Validates given name argument

createModel(name: string, fields: Array<ScalarField | ObjectField>): Model

  • Creates a model AST object
  • Validates given name argument

createScalarField(name: string, type: ScalarType, isList: boolean = false, isRequired: boolean = false, isUnique: boolean = false, isId: boolean = false, isUpdatedAt: boolean = false, default: | null | boolean | CallExpression | number | string = null): ScalarField

  • Creates a scalar field AST object
  • Validates given name argument

createObjectField(name: string, type: string, isList: boolean = false, isRequired: boolean = false, relationName: string | null = null, relationToFields: string[] = [], relationToReferences: string[] = [], relationOnDelete: "NONE" = "NONE"): ObjectField

  • Creates an object field AST object
  • Validates given name argument

createDataSource(name: string, provider: DataSourceProvider, url: string | DataSourceURLEnv): DataSource

Creates a data source AST object

Development

  • Clone the repository git clone git@github.com:amplication/prisma-schema-dsl.git
  • Make sure to use npm@7 npm i -g npm@7
  • Install the dependencies npm install
  • Run tests npm test

Created with <3 by amplication

2.2.0

8 months ago

2.1.2

12 months ago

2.1.1

12 months ago

2.1.4

8 months ago

2.1.3

9 months ago

2.1.6

8 months ago

2.1.5

8 months ago

2.1.0

12 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

1.2.0

1 year ago

1.1.8-alpha.1

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.2.6

1 year ago

1.1.7-alpha.1

1 year ago

1.1.7

1 year ago

1.2.5

1 year ago

1.1.6

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.5

3 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago