-
-
Notifications
You must be signed in to change notification settings - Fork 37
feature: prisma ast #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
feature: prisma ast #144
Conversation
- Replaced DMMFModels with ASTModels in encryption and middleware logic. - Updated schema analysis to use @mrleebo/prisma-ast for parsing Prisma schemas. - Introduced new functions for parsing encrypted and hash annotations. - Adjusted tests to reflect changes in schema parsing and model descriptors. - Deprecated DMMFDocument in favor of schemaPath in Configuration. - Enhanced error handling for cursor and field types in schema analysis.
|
Looks like the GitHub Actions workflow needs a little update before we can run it.. |
|
I don't know if it will be solved, but I upgraded it to v4 anyway. |
Co-authored-by: François Best <[email protected]>
Pull Request Test Coverage Report for Build 17791208893Details
💛 - Coveralls |
franky47
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this will be a breaking change though, could you add a migration step in the docs please?
I'll have to do a pass on the CI process separately, I recently hardened my NPM account due to the supply chain attacks and I need to update this project's settings accordingly.
… and migrate to AST-based schema parsing
Edited how to migrate from v1.x to v2.x and how to use it |
franky47
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll see if I can setup pkg.pr.new here to give you a preview build to play with.
|
The automatic comment from pkg.pr.new failed, but here is the preview build: npm install https://pkg.pr.new/prisma-field-encryption@f84e373Hopefully subsequent pushes will be enough to trigger it. |
|
any updates on this? |
|
We recently tried this pull request, but we had some problem with it. I believe it didn't handle multi-file schemas correctly, I'll ask my colleague for futher info. |
ahh, thanks for the response! |
|
Hi all, Hope that helps! |
Resolves: #143 #142
This pull request refactors the codebase to use Prisma schema AST parsing instead of the Prisma DMMF format, simplifying model analysis and removing dependencies on Prisma internals. It introduces a new AST-based analysis module, updates dependencies, and migrates tests and core logic to use the new approach. The changes improve maintainability and compatibility with Prisma by relying on the open-source
@mrleebo/prisma-astlibrary.Migration to AST-based schema analysis:
Replaced the DMMF-based model analysis in
src/dmmf.tswith a new AST-based implementation insrc/ast.ts, using@mrleebo/prisma-astfor parsing Prisma schema files. The newanalyseSchemaandanalyseSchemaFilefunctions provide model analysis based on schema comments and attributes, and the types were updated fromDMMFModelstoASTModels. [1] [2] [3]Updated all usages of the model analysis types and functions in
src/encryption.tsand other modules to use the new AST-based types and functions (ASTModelsinstead ofDMMFModels). [1] [2] [3]Dependency updates and cleanup:
Removed the dependency on
@prisma/internalsand added@mrleebo/prisma-asttopackage.json. Also updated thebinfield for correct CLI usage. [1] [2]Changed the Yarn node linker to
node-modulesfor compatibility. (.yarnrc.yml)Test migration and improvements:
src/dmmf.test.tsand added new, comprehensive AST-based tests insrc/ast.test.ts, covering annotation parsing and schema analysis. [1] [2]File renaming and code organization:
src/dmmf.tstosrc/ast.tsto reflect the new AST-based approach.References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]