diff --git a/src/dmmf.ts b/src/dmmf.ts index d310342..2a19eb9 100644 --- a/src/dmmf.ts +++ b/src/dmmf.ts @@ -30,7 +30,7 @@ const supportedCursorTypes = ['Int', 'String', 'BigInt'] export function analyseDMMF(input: DMMFDocument): DMMFModels { const dmmf = dmmfDocumentParser.parse(input) - const allModels = dmmf.datamodel.models + const allModels = [...dmmf.datamodel.models, ...dmmf.datamodel.types]; return allModels.reduce((output, model) => { const idField = model.fields.find( diff --git a/src/encryption.ts b/src/encryption.ts index 8ba0fea..7940da3 100644 --- a/src/encryption.ts +++ b/src/encryption.ts @@ -146,6 +146,7 @@ export function decryptOnRead( const model = models[params.model!] if ( Object.keys(model.fields).length === 0 && + Object.keys(model.connections).length === 0 && !params.args?.include && !params.args?.select ) { diff --git a/src/types.ts b/src/types.ts index 61c05b5..ec91a46 100644 --- a/src/types.ts +++ b/src/types.ts @@ -54,7 +54,8 @@ export const dmmfDocumentParser = z .object({ datamodel: z .object({ - models: z.array(dmmfModelParser).readonly() + models: z.array(dmmfModelParser).readonly(), + types: z.array(dmmfModelParser).readonly() }) .readonly() })