assertPrismaField
function assertPrismaField(field): string;Defined in: pagination-prisma.ts:47
Validate a Prisma scalar field name used by the keyset adapter: a single
identifier ([a-zA-Z_][a-zA-Z0-9_]*), no dots or relation paths.
toPrismaKeyset runs every mapped field through it. Field mappings
must be server-owned and should never come from request data.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
field |
string |
Returns
Section titled “Returns”string
The same field, unchanged, when valid.
Throws
Section titled “Throws”If field is not a plain identifier.
Example
Section titled “Example”import { assertPrismaField } from "@xtandard/lib/pagination/prisma";
assertPrismaField("createdAt"); // "createdAt"assertPrismaField("author.name"); // throws: invalid field "author.name"