Skip to main content
Version: 10.x

Interface: ProcedureBuilder<TParams>

Type parameters

Parameter
TParams extends ProcedureParams

Methods

input()

input<$Parser>(schema): ProcedureBuilder< {_config: TParams["_config"]; _ctx_out: TParams["_ctx_out"]; _input_in: OverwriteIfDefined< TParams["_input_in"], inferParser< $Parser >["in"] >; _input_out: OverwriteIfDefined< TParams["_input_out"], inferParser< $Parser >["out"] >; _meta: TParams["_meta"]; _output_in: TParams["_output_in"]; _output_out: TParams["_output_out"];} >

Add an input parser to the procedure.

Type parameters

Parameter
$Parser extends Parser

Parameters

ParameterType
schemaTParams["_input_out"] extends typeof unsetMarker ? $Parser : inferParser< $Parser >["out"] extends undefined | Record< string, unknown > ? TParams["_input_out"] extends undefined | Record< string, unknown > ? undefined extends any[any] ? undefined extends any[any] ? $Parser : "Cannot chain an optional parser to a required parser" : $Parser : "All input parsers did not resolve to an object" : "All input parsers did not resolve to an object"

Returns

ProcedureBuilder< {_config: TParams["_config"]; _ctx_out: TParams["_ctx_out"]; _input_in: OverwriteIfDefined< TParams["_input_in"], inferParser< $Parser >["in"] >; _input_out: OverwriteIfDefined< TParams["_input_out"], inferParser< $Parser >["out"] >; _meta: TParams["_meta"]; _output_in: TParams["_output_in"]; _output_out: TParams["_output_out"];} >

Source

packages/server/src/core/internals/procedureBuilder.ts:89


meta()

meta(meta): ProcedureBuilder< TParams >

Add a meta data to the procedure.

Parameters

ParameterType
metaTParams["_meta"]

Returns

ProcedureBuilder< TParams >

Source

packages/server/src/core/internals/procedureBuilder.ts:134


mutation()

mutation<$Output>(resolver): BuildProcedure< "mutation", TParams, $Output >

Mutation procedure

Type parameters

Parameter
$Output

Parameters

ParameterType
resolver(opts) => MaybePromise< DefaultValue< TParams["_output_in"], $Output > >

Returns

BuildProcedure< "mutation", TParams, $Output >

Source

packages/server/src/core/internals/procedureBuilder.ts:164


output()

output<$Parser>(schema): ProcedureBuilder< {_config: TParams["_config"]; _ctx_out: TParams["_ctx_out"]; _input_in: TParams["_input_in"]; _input_out: TParams["_input_out"]; _meta: TParams["_meta"]; _output_in: inferParser< $Parser >["in"]; _output_out: inferParser< $Parser >["out"];} >

Add an output parser to the procedure.

Type parameters

Parameter
$Parser extends Parser

Parameters

ParameterType
schema$Parser

Returns

ProcedureBuilder< {_config: TParams["_config"]; _ctx_out: TParams["_ctx_out"]; _input_in: TParams["_input_in"]; _input_out: TParams["_input_out"]; _meta: TParams["_meta"]; _output_in: inferParser< $Parser >["in"]; _output_out: inferParser< $Parser >["out"];} >

Source

packages/server/src/core/internals/procedureBuilder.ts:120


query()

query<$Output>(resolver): BuildProcedure< "query", TParams, $Output >

Query procedure

Type parameters

Parameter
$Output

Parameters

ParameterType
resolver(opts) => MaybePromise< DefaultValue< TParams["_output_in"], $Output > >

Returns

BuildProcedure< "query", TParams, $Output >

Source

packages/server/src/core/internals/procedureBuilder.ts:155


subscription()

subscription<$Output>(resolver): BuildProcedure< "subscription", TParams, $Output >

Mutation procedure

Type parameters

Parameter
$Output

Parameters

ParameterType
resolver(opts) => MaybePromise< DefaultValue< TParams["_output_in"], $Output > >

Returns

BuildProcedure< "subscription", TParams, $Output >

Source

packages/server/src/core/internals/procedureBuilder.ts:173


unstable_concat()

unstable_concat<$ProcedureBuilder>(proc): $ProcedureBuilder extends ProcedureBuilder< $TParams > ? CreateProcedureReturnInput< TParams, $TParams > : never

Extend the procedure with another procedure.

Warning

The TypeScript inference fails when chaining concatenated procedures.

Type parameters

Parameter
$ProcedureBuilder extends ProcedureBuilder< any, $ProcedureBuilder >

Parameters

ParameterType
proc$ProcedureBuilder

Returns

$ProcedureBuilder extends ProcedureBuilder< $TParams > ? CreateProcedureReturnInput< TParams, $TParams > : never

Source

packages/server/src/core/internals/procedureBuilder.ts:147


use()

use<$Params>(fn): CreateProcedureReturnInput< TParams, $Params >

Add a middleware to the procedure.

Type parameters

Parameter
$Params extends ProcedureParams< AnyRootConfig, unknown, unknown, unknown, unknown, unknown, unknown, $Params >

Parameters

ParameterType
fnMiddlewareBuilder< TParams, $Params > | MiddlewareFunction< TParams, $Params >

Returns

CreateProcedureReturnInput< TParams, $Params >

Source

packages/server/src/core/internals/procedureBuilder.ts:138


Generated using TypeDoc and typedoc-plugin-markdown