Only works for Model and not embedded Type?
zmays opened this issue · comments
using mongodb and so a lot of our encrypted fields are in embedded documents, which are done by Type instead of Model: https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-composite-types
I've added this lib, but only get encryption on fields defined in Models.
Supporting types on your roadmap? Want a pr for it?
Sure, if you feel like going for a PR for this, go ahead!
This will probably require adjusting the DMMF parser to look for those Type definitions, and see how to connect that to the visitor system, which visits each node of a query to look for leaves to encrypt/decrypt, with the knowledge of what model it's currently looking at.
I'm running npm link to test some changes I made, but the require('@prisma/client').Prisma.dmmf in extensions.ts is returning undefined when I run it with my repo - ran into this before?
This is usually a sign that you need to generate the Prisma client with prisma generate
, to get the required DMMF.
FYI, if you want to explore the object structure more easily, you can use import { getDMMF } from '@prisma/internals'
, feed it the contents of your schema, and dump the result into a JSON file.
Thanks, it is definitely generated, I'm guessing it is trying to import from the package node_modules, instead of the source repo I linked the package to
Yeah with npm link it may not work exactly as intended in a regular dependency install. Feel free to locally point the require
to a correct relative path.
Hey sorry this has hit the backburner for me at the moment