{"dist":{"shasum":"90aeed32679c1cc41f647a8af8c1ae65700889a2","tarball":"https://registry.npmjs.org/prisma-datamodel/-/prisma-datamodel-1.36.0-test.1.tgz","fileCount":72,"integrity":"sha512-2k5jJYhFR/5nTH739gPu8m3LQUbaUAn0J+pFnLU4yKClocR+Pi3f+5mh9tW3TSk1y74iVT+a5/y/1JKSdTy1cw==","signatures":[{"sig":"MEUCIFzE/M2GJSVtaF5VOSt7H86YGz5K/lcwlkIB1J7cb0twAiEA494TtfpDuoLyVrm+zK6Aw7SVwscSr1vCioHqHirKkJ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":216659,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc+4zICRA9TVsSAnZWagAAYqUQAIiml+Gv4mgXtMgrsjFc\nWxLN7X5Bpw4LHGUMiEpo7JRnPRNDWmSeatS3hY3Hj5M0Ve684sfVqHPn3pC0\nX8x2DnqOaJH4mn5++8J0ouy3KPyCRV/EibN9vFFJMjWNhCWxZ2BQhhP/L4Yp\nIIm+rk8a68xHUNddV/LPJjukI4dCm0T0T+KaRk60mgLmjNXt8QYkqQY6LUGc\nR4/+Vx+wTGLQqEr9Igk3l2fIW9k6tCWAgiNizIQyHrZ3VY8jdFQkgzc12EhG\nlTORGeYbAPh0yEe/1DQHnmO78e74q2LAbxL/S19eXG5umKyaGrxNysik+3F0\nTU1s78fAxy41lSAuNdSUUlEi+dGRmYYT7Z3/WUgLusB/xrJq875NWs/HHITT\ndpP2F0OdF1cMVVJN7x6Jn2trdZykwWSpYkB6hD//yvAEG+4slwO0/zVlQymh\n3sSdtoUvNgTwz/ly8us31zazCncUiiXPGz6uWDa+YTicBNTB/0d2DA7DuAxk\n94ndXG0ASpHr9KV7hQFVh35wcJS1U1HoW8qqKaSJXIFccsWtGDg1KSSSO5Sh\nJaDcj9jHqlPYeAnfkF42CoWi41bF9JXu+xBLgHycNY9eUVVQ0BxuHlq+zIuD\nC1i7Eyp8DkdCq0pEzgBrkDvM3L3kT10cRlZ+TZDLArlsZnuAOv0t5RFFxY57\n4NF+\r\n=7MrJ\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(\n    `${type.name} has ${type.fields.length} fields and ${\n      type.indices.length\n    } indexes`,\n  )\n}\n\nconst enableDatamodel1_1 = true\nconst renderer = DefaultRenderer.create(\n  DatabaseType.postgres,\n  enableDatamodel1_1,\n)\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.7.0","description":"Transform prisma datamodel SDL into graphql-js SDL","directories":{},"maintainers":[{"name":"timsuchanek","email":"tim.suchanek@gmail.com"}],"_nodeVersion":"11.15.0","dependencies":{"debug":"^4.1.1","graphql":"^14.3.0","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.36.0-test.1_1559989448266_0.18611468893099503","host":"s3://npm-registry-packages"},"_id":"prisma-datamodel@1.36.0-test.1","version":"1.36.0-test.1"}