updatable
updatable<
TSchema>(schema):TSchema
Defined in: packages/pipeline-zod/src/updatable.ts:51
Marks a command field as updatable: a change the command requests, which field-level authorization must check.
createCommand lists the marked fields of the top-level object as
the class’s static updatableFields, the list of fields to pass to
field-level authorization. A field without the mark is never in that list,
so mark every field the handler writes.
The mark survives the checks and wrappers chained after it (.min(),
.optional(), .nullable(), .default(), .transform()) and
.partial() on the object. It is set on a copy, so a schema shared with
other commands stays unmarked.
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameters
Section titled “Parameters”schema
Section titled “schema”TSchema
The field schema to mark.
Returns
Section titled “Returns”TSchema
A marked copy of schema, with the same type.
Example
Section titled “Example”export class UpdateRoleCommand extends createCommand( z.object({ id: z.uuid(), name: z.string().trim().apply(updatable).min(3), }),) {}
UpdateRoleCommand.updatableFields; // ['name']