{"_id":"@loancrate/prisma-schema-parser","_rev":"6-f83f6608a64e73aebb635b5f134873d5","name":"@loancrate/prisma-schema-parser","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"@loancrate/prisma-schema-parser","version":"1.0.0","keywords":["parser","prisma","schema"],"author":{"name":"Trevor Robinson"},"license":"ISC","_id":"@loancrate/prisma-schema-parser@1.0.0","maintainers":[{"name":"trevorr","email":"trevor@scurrilous.com"},{"name":"scb","email":"me@spencer.sx"},{"name":"andrew-loancrate","email":"andrew@loancrate.com"}],"homepage":"https://github.com/loancrate/prisma-schema-parser#readme","bugs":{"url":"https://github.com/loancrate/prisma-schema-parser/issues"},"dist":{"shasum":"a51ffb547a9f2a63438cdc7875d2a25009f01edd","tarball":"https://registry.npmjs.org/@loancrate/prisma-schema-parser/-/prisma-schema-parser-1.0.0.tgz","fileCount":35,"integrity":"sha512-JmAdRIy9xcIBiol4sl1mIL8ZHEXAeDZKLpAABxCmb8/jXmv4D5540DHZz0AxyTsvUgf1p4IlqTj1Ugtkypg3PA==","signatures":[{"sig":"MEQCIGaT6CmtFEME1fguDhPTxPyI8aoBa44pxr+DTQEK7fGNAiBON+KyrhHlZh8z4NFL7DrktO3C507YX9bJ6Yx2J/hwtQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":212597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjI3EWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmomBhAAn4TLImBhXUntD7WD0PPpHDRAcxIOFTdXy72vjHFVmLZrakA0\r\nmnwjpMaGwVpYC0KyxmJXk92Pp2WOUFimHflc3f4dBZaO2pxyBqVV56be1320\r\nviVWxV5UGjH7YX2gF1rbo0Rrw0/xysHE7sJ1Qnt7ZCfeyzht4kvPcdtl65C2\r\nG5F1xNfsbnG/J5gqX/nzgi62fDUdhDnJxjy+KDYKcqycO3PJGunRDiYkcgBJ\r\ntoTgDy4JuCWVVks9SNmg2Zuokgtg0YiM0ZVXKrPJrsAw61u29XYPb0Ro9wVP\r\nVkUCpuhewQEvXVu+F81MPtM/cPHxYjv7vOCtDZ8klSI0Lr4pOop9ZsJRv+sD\r\nt1F28N0dFirFre0z1zZB7Rlb1tShpEg9NO0WU/sHJMjTXh+ee+tfv6NG8vU9\r\nBbW9CFHUpMVYpJUE5ELk7B+QCQvC7lH7fQrHG4VMXZaNYjn1n11JPMlHCOaq\r\nU34SOowYgyj7eseKeri+ff412O6hHnFGWWd/TN0OIUUwwMOTrWsRVEy8A8pr\r\nR9wny0wKrp8W/Otj/zELQoTwyWaeS/JpQ93s6DMhNMb9mg8zYYtyPhovi6No\r\ntAZHQeWhlW9+MSJkL5s9FfvpLBj4gORbg+fdLTBni1i+wr3B+P90H5BXY3iE\r\nFC4XuZWnSnnEJcBry76OZU3CGoF+yZ7Ij20=\r\n=Lonv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"15f349e0e5de7b8aeafc826214966446100c8d73","scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"rm -rf dist && tsc --project tsconfig.build.json","prepare":"npm run generate-peggy && npm run build","prettier":"prettier . --write","generate-peggy":"./scripts/generate-peggy.sh","prepublishOnly":"npm run test && npm run lint"},"_npmUser":{"name":"trevorr","email":"trevor@scurrilous.com"},"repository":{"url":"git+https://github.com/loancrate/prisma-schema-parser.git","type":"git"},"_npmVersion":"8.5.0","description":"Prisma Schema Parser","directories":{},"lint-staged":{"*.ts":"eslint","*.{ts,md}":"prettier --list-different"},"_nodeVersion":"16.14.2","dependencies":{"no-case":"^3.0.4","type-fest":"^2.19.0","error-cause":"^1.0.4","catch-unknown":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.3","husky":"^8.0.1","peggy":"^2.0.1","eslint":"^8.20.0","ts-jest":"^28.0.7","prettier":"^2.7.1","typescript":"^4.7.4","@types/jest":"^28.1.6","@types/node":"^18.0.6","lint-staged":"^13.0.3","@tsconfig/node16":"^1.0.3","@types/error-cause":"^1.0.1","@typescript-eslint/parser":"^5.30.7","@typescript-eslint/eslint-plugin":"^5.30.7"},"_npmOperationalInternal":{"tmp":"tmp/prisma-schema-parser_1.0.0_1663267093809_0.8669133772553033","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@loancrate/prisma-schema-parser","version":"2.0.0","keywords":["parser","prisma","schema"],"author":{"name":"Trevor Robinson"},"license":"ISC","_id":"@loancrate/prisma-schema-parser@2.0.0","maintainers":[{"name":"trevorr","email":"trevor@scurrilous.com"},{"name":"scb","email":"me@spencer.sx"},{"name":"andrew-loancrate","email":"andrew@loancrate.com"}],"homepage":"https://github.com/loancrate/prisma-schema-parser#readme","bugs":{"url":"https://github.com/loancrate/prisma-schema-parser/issues"},"dist":{"shasum":"c745349e8470b4e02aa5562df1d1dfca293b3ee5","tarball":"https://registry.npmjs.org/@loancrate/prisma-schema-parser/-/prisma-schema-parser-2.0.0.tgz","fileCount":35,"integrity":"sha512-5x/7p6nHQ5fy2r4AmrjhmIKYc89RN+7vg8WG5Sr0sPhajINNdTKirxXgyHmf6ernm6/QU3HURolFsZPccw+7mg==","signatures":[{"sig":"MEQCIE6TPsopu5Dafe++YoL6EBA9dMsc9nghU56wf3b6einDAiBIcPJt8nCKyNXVem6lH5qx2iqHO953YtwYde4jjnBftQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214203,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKzicACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEqg/9FMHC/GCJw8KKbKba3MixzKyzN1IZMI5HeVJkM3TWzki0Lkjc\r\nQI3bYOO2Ihbu+BEIGA1iJmyXLka8o8egyLA8LhLURawV5JnK0RYb71eEqpCp\r\nnE6x5WaKZeyVieozALSwIwIsdSTRk06vmT79QBckY0BR9s1EhR5uaI5B63YK\r\njb4GrnUpLLbliKcgwWPnJ33H6R4jUd9jLo4D9mWsQbkPX1OGd3zTFIXqwwlH\r\nCbM0NJ1YQkxOPQjjGUSxgqOnR+kt5r8PMQICbvU7o35+o6opLgJpRcnE0oGe\r\nfh73AKKIEja82lb3bPOh1xqivq2SubFmK5eN7rAKozYfrxvQt/RlDqKcXsI9\r\nx6SnBaL3q57N8YWMp/yo/0SjiBa26u1Ppx98uIBoBLHPcABNye6DB/pwVuPY\r\n8o2Rg+AanxjNEU5XsZBmtoGQa/90DI8NI9mM+f+OAaFYP7T+IjQ0RpD1c0/v\r\nlbFsBBRrhbceO9VGoBQSjRSxL94QOtc8rD8aiS4+8hTkigXBP5cP7CqrkObs\r\nNj+HXGKljmmBw87K3VJil30+XlAveJRwc02lGBdc14hvEbBIGcWAFtrTy1Y2\r\nW97IwsiEXtXzudOOobN5aypOPyJ70piAJpMdJUoXGs2waxE/xGgq0DqudwQp\r\nE15JgQI4AhyH9hfcy0XnZJEFa4LO7bGPUhY=\r\n=7Q0A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"575c798bcbb5d1e5298d7dc3b12de87640400375","scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"rm -rf dist && tsc --project tsconfig.build.json","prepare":"npm run generate-peggy && npm run build","prettier":"prettier . --write","generate-peggy":"./scripts/generate-peggy.sh","prepublishOnly":"npm run test && npm run lint"},"_npmUser":{"name":"trevorr","email":"trevor@scurrilous.com"},"repository":{"url":"git+https://github.com/loancrate/prisma-schema-parser.git","type":"git"},"_npmVersion":"8.5.0","description":"Prisma Schema Parser","directories":{},"lint-staged":{"*.ts":"eslint","*.{ts,md}":"prettier --list-different"},"_nodeVersion":"16.14.2","dependencies":{"no-case":"^3.0.4","type-fest":"^2.19.0","error-cause":"^1.0.4","catch-unknown":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.3","husky":"^8.0.1","peggy":"^2.0.1","eslint":"^8.20.0","ts-jest":"^28.0.7","prettier":"^2.7.1","typescript":"^4.7.4","@types/jest":"^28.1.6","@types/node":"^18.0.6","lint-staged":"^13.0.3","@tsconfig/node16":"^1.0.3","@types/error-cause":"^1.0.1","@typescript-eslint/parser":"^5.30.7","@typescript-eslint/eslint-plugin":"^5.30.7"},"_npmOperationalInternal":{"tmp":"tmp/prisma-schema-parser_2.0.0_1663776924332_0.05451700955123817","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"@loancrate/prisma-schema-parser","version":"3.0.0","keywords":["parser","prisma","schema"],"author":{"name":"Trevor Robinson"},"license":"ISC","_id":"@loancrate/prisma-schema-parser@3.0.0","maintainers":[{"name":"scb","email":"me@spencer.sx"},{"name":"andrew-loancrate","email":"andrew@loancrate.com"},{"name":"trevorr","email":"trevor@scurrilous.com"}],"homepage":"https://github.com/loancrate/prisma-schema-parser#readme","bugs":{"url":"https://github.com/loancrate/prisma-schema-parser/issues"},"dist":{"shasum":"e7474b8ea323d27ae77bf72b04fef69070c3fbf8","tarball":"https://registry.npmjs.org/@loancrate/prisma-schema-parser/-/prisma-schema-parser-3.0.0.tgz","fileCount":35,"integrity":"sha512-SpzJE4043yqM5jDnSh18n6R8mzN4wiRgcZ2cMphgJPiqm01MC4OycVZc8D1FVtC0Sh2vt1k6+TsI9fowI9/VRQ==","signatures":[{"sig":"MEQCIEEiDpdd14nBO3DAxpIYt93ehIgOSRsCPHH3oFneePOjAiBH3P1NZLsdbg58eQu0eA9pkKuv3CqZNjWQq5UzXfpvrg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220278},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"f53ce05842c234f99d8987757deec89865065f2c","scripts":{"lint":"eslint src","test":"jest","build":"rm -rf dist && tsc --project tsconfig.build.json","prepare":"npm run generate-peggy && npm run build","prettier":"prettier . --write","generate-peggy":"./scripts/generate-peggy.sh","prepublishOnly":"npm run test && npm run lint"},"_npmUser":{"name":"trevorr","email":"trevor@scurrilous.com"},"repository":{"url":"git+https://github.com/loancrate/prisma-schema-parser.git","type":"git"},"_npmVersion":"10.9.0","description":"Prisma Schema Parser","directories":{},"lint-staged":{"*.ts":"eslint","*.{ts,md}":"prettier --list-different"},"_nodeVersion":"22.11.0","dependencies":{"no-case":"^3.0.4","type-fest":"^4.30.2","error-cause":"^1.0.8","catch-unknown":"^2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.7","peggy":"^4.2.0","eslint":"^9.17.0","ts-jest":"^29.2.5","prettier":"^3.4.2","typescript":"^5.7.2","@types/jest":"^29.5.14","@types/node":"^22.10.2","lint-staged":"^15.2.11","@tsconfig/node22":"^22.0.0","@types/error-cause":"^1.0.4","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.18.1"},"_npmOperationalInternal":{"tmp":"tmp/prisma-schema-parser_3.0.0_1734489628148_0.01553916618522777","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2022-09-15T18:38:13.742Z","modified":"2026-08-18T01:20:09.064Z","1.0.0":"2022-09-15T18:38:14.025Z","2.0.0":"2022-09-21T16:15:24.566Z","3.0.0":"2024-12-18T02:40:28.319Z"},"bugs":{"url":"https://github.com/loancrate/prisma-schema-parser/issues"},"author":{"name":"Trevor Robinson"},"license":"ISC","homepage":"https://github.com/loancrate/prisma-schema-parser#readme","keywords":["parser","prisma","schema"],"repository":{"url":"git+https://github.com/loancrate/prisma-schema-parser.git","type":"git"},"description":"Prisma Schema Parser","maintainers":[{"email":"andrew@loancrate.com","name":"andrew-loancrate"},{"email":"trevor@scurrilous.com","name":"trevorr"}],"readme":"# Prisma Schema Parser and Formatter\n\nTypescript library for parsing, traversing, and formatting\n[Prisma schema](https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference) files.\nBased on the [PEG](https://en.wikipedia.org/wiki/Parsing_expression_grammar)\n[grammar](https://github.com/prisma/prisma-engines/blob/main/libs/datamodel/schema-ast/src/parser/datamodel.pest) in the Prisma source\n(ported from [pest](https://pest.rs/) to [PEG.js](https://pegjs.org/)),\nits goal is to parse any valid Prisma schema.\nUnit tests ensure 100% coverage of the hand-written Typescript code and the rule code generated by PEG.js.\n(There is a small amount of error reporting and unused feature code in the generated parser that is either unreachable or infeasible to test.)\n\n## Goals\n\n- Parse and format any valid Prisma schema\n- Provide a complete and statically typed abstract syntax tree (AST)\n- Support legacy features like type aliases and GraphQL-style required type and list syntax\n- Preserve all non-whitespace constructs in the source, including comments\n- Preserve the source location of all high-level constructs\n- Provide utility functions to traverse and analyze the AST\n\n### Non-goals\n\n- Continued parsing of invalid schemas beyond the first syntax error\n- Validation of the schema, such as type resolution or database-specific features\n- Preservation of whitespace\n\n## Installation\n\n```sh\nnpm add @loancrate/prisma-schema-parser\n```\n\n## Usage\n\n```ts\nimport { readFileSync } from \"fs\";\nimport { formatAst, parsePrismaSchema } from \"@loancrate/prisma-schema-parser\";\n\nconst ast = parsePrismaSchema(\n  readFileSync(\"test-data/schema.prisma\", { encoding: \"utf8\" }),\n);\n// ... manipulate the schema ...\nconsole.log(formatAst(ast));\n```\n\n## License\n\nThis library is available under the [ISC license](LICENSE).\n","readmeFilename":"README.md"}