These options are being passed in to the middleware as "params".
Method used to trigger this request.
The arguments passed into Prisma.
Where Prisma will be updating.
The name of the Prisma model the operation is running on.
Whether this is running in a transaction.
Options that can be passed into the PrismaSlug()
function.
Additional logic to perform after the slug has been generated.
Configure what happens when an error occurs generating a slug or finding the source.
By default, the error is printed to STDERR.
The function that is used to generate the slug for a given source string.
By default, this uses slugify()
.
The function to use for generating the source text to slugify. The string returned from this function will be used to generate the slug that is saved to the database.
By default, this will return the .name
key of the passed-in
object.
Determine whether to generate a slug for this particular record. By
default, this ensures that the params.action
is either "create" or
"delete".
Create a Prisma middleware that generates slugs in a field called
slug
for models that have a field called name
.
Optional configuration for the middleware
Generated using TypeDoc
Type definition for Prisma middleware functions.
The
T
type makes sure, that thereturn proceed
is not forgotten in the middleware implementation