{"dist":{"shasum":"9cfafe89e62d5ab8d9406f8ec8616ad1819e5ef3","tarball":"https://registry.npmjs.org/prisma-datamodel/-/prisma-datamodel-1.30.0-beta.tgz","fileCount":69,"integrity":"sha512-u9bWccsetJ6iSgi20bY3X2tZLmbGuDp2MPxQ7jeNU6gw28CWzeEQ+YjVZDHIu2w7axX4+QV7A8hGrL7IqWHl5g==","signatures":[{"sig":"MEUCIQCnDn2xC7I1acY9v3CGNzN2ahyE8pwyUBNf26Beh4i1cwIgcN98pwUseZwj0S1kU1pZgeR67OTagLlFq7gsT0OcftA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204252,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJckkfkCRA9TVsSAnZWagAAdDMP/034bCEFF9WEUnh3kDnZ\ngyUFM0tVn2gl49QbjWcKwoLFIBMA4iyE7uZgl47ux8K59wYuBP6hQkl/IJ5q\nDbnoGXdoSGDP201F9sWaq95/UW0jWl/EkR8B9eu3iF1YA5vty+6cSLOq4ZDX\n673OpeQBnYN00FM52by5YVI6PzYiTMyERaOiQ1dJMCtRc0F54LFJDZgmtIl2\nAtEUxGc2VNOSiAa3qdZTCFPCHULGzC4OdGsSy3s1bxAuUeTCbNdrS11PDMxw\ni3YmEnf7LtPdKBkBky6zAJZsftzvZZgTRG6XQ31Mp1wD73D2tgP7slpfsT5j\nR3i3w+tNQoUQZYdpWZtWQ8rQCIMwf1zseF5jkx1o4eD2pTA2uxxsUtSCLqZa\nV4gZvp453C9F9V45tSMlTihZZ9md4JuoIHsoE4/ApHNB3F9T0/0M/HwJanj6\nf0qwEWWwWH1bA1H3bo8KzTJON7ThnE8irJLwEfGSDo7Qf82IHQ0OpC+CuLj2\nuwOLjTVSH+s2QsiWDz3ZBiYr/eOU5OfcjaWBtByUYhShbm1SRuZJK0F+4ccZ\nnq1hqCnEhLXyuKFA2E7jA4ON4EGOkPggsrpFWxU5YWvizDvFCLyqlQIsNKJh\nAWjtzV2mmeWy7GkO4tNe46iQkx5NwuvtRZ0NnUqOaE7rI5zR0dVo6m420BBU\ni/3o\r\n=CSKv\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"testRegex":"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$","transform":{"^.+\\.tsx?$":"ts-jest"},"moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"testPathIgnorePatterns":["/node_modules/","helpers.ts"]},"main":"dist/index.js","name":"prisma-datamodel","author":{"name":"Emanuel Jöbstl"},"readme":"# prisma-datamodel\n\nThe Prisma Datamodel package forms the foundation of all datamodel related tasks in the CLI.\n\n### Components\n\n* 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.\n* Constants for known primitive types: `TypeIdentifier`, `TypeIdentifiers`\n* Classes to parse data models from strings into the internal format: `Parser`, with the factory class`DefaultParser`\n* Classes to render data models to strings, from the internal format: `Renderer`, with the factory class `Default Renderer`\n* Auxiliary functions: `cloneSchema` to safely clone an `ISDL`structure, `toposort`to sort a datamodel in topological order.\n\n### Different Database Types\n\nWhen creating a parser or renderer, a flag that indicates the database type has to be passed. The internal representation is guaranteed to be consistent between different databases. It is possible to parse a mongo schema and render a postgres schema without any transformations in between.\n\n### Datamodel V1 vs. V1.1\n\nThe 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. \n\n### Modifying a Model\n\nThe types `ISDL`, `IGQLType` and `IGQLField` are designed to allow convenient analysis and transformation. Most notably, they may contain circular references (for representing related types and indexes). Therefor, these types are **mutable**, and care has to be taken when modifying them, for example by cloning them using `cloneSchema`.\n\nWhen adding or removing a type, it is important to also update all referring fields or indexes, otherwise other transformations or the rendering process might break.\n\n### Usage\n\nBasic example:\n\n```typescript\nconst parser = DefaultParser.create(DatabaseType.mongo)\nconst model = parser.parse(datamodelAsString)\n\n// Do something with the model\nfor(const type of model.types) {\n    console.log(`${type.name} has ${type.fields.length} fields and ${type.indices.length} indexes`)\n}\n\nconst enableDatamodel1_1 = true\nconst renderer = DefaultRenderer.create(DatabaseType.postgres, enableDatamodel1_1)\n\nconst renderedAsString = renderer.render(model)\n```\n\n","license":"Apache-2.0","scripts":{"test":"rm -rf dist && jest","build":"tsc -d"},"typings":"dist/index.d.ts","_npmUser":{"name":"timsuchanek","email":"tim.suchanek@gmail.com"},"_npmVersion":"6.4.1","description":"Transform prisma datamodel SDL into graphql-js SDL","directories":{},"maintainers":[{"name":"timsuchanek","email":"tim.suchanek@gmail.com"}],"_nodeVersion":"8.15.1","dependencies":{"graphql":"^14.0.2","popsicle":"10","pluralize":"^7.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.5.0","ts-jest":"^23.1.4","jest-cli":"^23.6.0","typescript":"^3.2.2","@types/jest":"^23.3.1","tslint-eslint-rules":"^5.4.0","tslint-config-prettier":"^1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/prisma-datamodel_1.30.0-beta_1553090532139_0.2330818129837653","host":"s3://npm-registry-packages"},"_id":"prisma-datamodel@1.30.0-beta","version":"1.30.0-beta"}