HandlerOptions
Shorthand input and output declarations accepted when adding a Mutation or Query.
Remarks
Section titled “Remarks”The shorthand is expanded onto the operation’s InputBuilder and OutputBuilder
before the operation builder is returned, so a spec can still refine the result through
operation.input and operation.output.
Example
Section titled “Example”Declaring a mandatory id and an Item result
app.addMutation('unarchive', { input: { id: 'id!' }, output: [category, moment] }, async (input, _current, ctx) => { const item = await ctx.getItem(input.id); return item?.unarchive();});Extended by
Section titled “Extended by”Properties
Section titled “Properties”input?
Section titled “input?”
readonlyoptionalinput?:InputDefinition|Record<string, PrimitiveDataType | MandatoryPrimitiveDataType>
Input Properties keyed by name, each given as a primitive data type. A trailing ! marks the
Property mandatory, for example 'id!'. When omitted, the operation declares no input.
Default Value
Section titled “Default Value”undefinedoutput?
Section titled “output?”
readonlyoptionaloutput?:PrimitiveDataType|OutputDefinition|TemplateBuilder|TemplateBuilder[] |TemplateDefinition|TemplateDefinition[] |"template"
Result shape of the operation. A data type such as 'boolean' declares a single value, one
Template (as a TemplateBuilder or Definition) declares an Item of that Template, an
array of Templates declares an Item of any of them, 'template' declares a Template
Definition, and an OutputDefinition is used as declared.
When omitted, the operation returns nothing.
Default Value
Section titled “Default Value”undefined
