@paljs/plugins
Introduction
GraphQL plugins for Prisma that provide automatic field selection optimization. The main export, PrismaSelect, analyzes GraphQL queries and generates optimized Prisma select/include objects — only fetching the fields actually requested.
Installation
Peer Dependencies
@prisma/client^6 or ^7graphql^15 || ^16
PrismaSelect
Basic Usage
Typed Usage (v9)
With @paljs/generator, you get a ModelsObject type that eliminates any:
With Default Fields
Always include specific fields regardless of the GraphQL query:
With Field Exclusion
Prevent sensitive fields from being selected:
Function-Based Configuration
Dynamic defaults and exclusions based on the current selection:
Prisma 7 — DMMF Changes
In Prisma 7, Prisma.dmmf is no longer exported. PrismaSelect uses DMMF for field validation (filtering invalid fields before they reach Prisma).
Without DMMF: PrismaSelect still works — it generates select objects but skips field validation. Invalid fields may cause Prisma runtime errors.
With generated DMMF (recommended):
This is the recommended approach for Prisma 7. The @paljs/generator captures DMMF during prisma generate and outputs it as a JSON file.
sdlInputs
Generates SDL input type definitions from Prisma DMMF. Useful for SDL-first GraphQL servers: