Skip to content

MutationHandlerInstance

Exposes a Mutation on an App so that application code can invoke it with the same Grant checks, input parsing, and output marshalling the platform applies.

Calling handler asserts the Mutation’s Grants against the active context, parses the input against the declared input definition, runs the application handler, and marshals its result against the declared output. Reach a Mutation through ctx.apps.<app>.mutations.<key> inside a write execution.

Invoking a Mutation from a write execution

const company = await instance.execute('readwrite', { payload: {}, traceId }, async (ctx) => {
return await ctx.apps.hris.mutations.createCompany.handler({ code, title: `Company ${code}` }, ctx.apps.hris, ctx);
});

readonly definition: MutationDefinition

The compiled definition the handler was created from, including its Grants, input, and output.


readonly handler: MutationHandler

Invokes the Mutation with (input, current, ctx), applying Grant checks and input and output marshalling.


readonly prn: string

PRN identifying this Mutation within the definition.