@anolilab/prisma-schema-reader
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

A prisma schema reader and object transformation


Daniel Bannert's open source work is supported by the community on GitHub Sponsors


Installation

Use npm or yarn to install

    npm install @anolilab/prisma-schema-reader --save

Or

    yarn add @anolilab/prisma-schema-reader

Usage

Basic usage

import { SchemaToObjectTransformer } from "@anolilab/prisma-schema-reader";

const prismaSchemaPath = "path to your prisma.schema";

const transformer = new SchemaToObjectTransformer(prismaSchemaPath);

transformer.transform();

The transformer will return a JSON object based on the prisma schema.

{
  "enums": [
    {
      "fields": [
        "ADMIN",
        "USER",
      ],
      "name": "Role",
    },
    ...
  ],
  "models": [
    {
      "documentation": "",
      "fields": [
        {
          "documentation": "",
          "isId": true,
          "kind": "scalar",
          "list": false,
          "map": undefined,
          "name": "id",
          "relationField": false,
          "required": true,
          "type": "Int",
          "unique": false,
        },
      ]
    },
    ...
  ],
}

Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.

Supported Node.js Versions

Libraries in this ecosystem make a best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The anolilab zod-prisma is open-sourced software licensed under the MIT license

Package Sidebar

Install

npm i @anolilab/prisma-schema-reader

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

42.6 kB

Total Files

13

Last publish

Collaborators

  • prisis