ProcedureBuilder<TParams>
Type parameters
TParams
extendsProcedureParams
Methods
input()
Add an input parser to the procedure.
Signature
ts
input<$Parser>(schema: TParams["_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"): 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"];}>;
ts
input<$Parser>(schema: TParams["_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"): 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"];}>;
Type parameters
$Parser
extendsParser
Parameters
Name | Type |
---|---|
schema | TParams ["_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"
];
}>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:88
meta()
Add a meta data to the procedure.
Signature
ts
meta(meta: TParams["_meta"]): ProcedureBuilder<TParams>;
ts
meta(meta: TParams["_meta"]): ProcedureBuilder<TParams>;
Parameters
Name | Type |
---|---|
meta | TParams ["_meta" ] |
Returns
ProcedureBuilder
<TParams
>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:133
mutation()
Mutation procedure
Signature
ts
mutation<$Output>(resolver: Function): BuildProcedure<"mutation", TParams, $Output>;
ts
mutation<$Output>(resolver: Function): BuildProcedure<"mutation", TParams, $Output>;
Type parameters
$Output
Parameters
Name | Type |
---|---|
resolver | (opts : ResolveOptions <TParams >) => MaybePromise <DefaultValue <TParams ["_output_in" ], $Output >> |
Returns
BuildProcedure
<"mutation"
, TParams
, $Output
>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:163
output()
Add an output parser to the procedure.
Signature
ts
output<$Parser>(schema: $Parser): 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"];}>;
ts
output<$Parser>(schema: $Parser): 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"];}>;
Type parameters
$Parser
extendsParser
Parameters
Name | Type |
---|---|
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"
];
}>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:119
query()
Query procedure
Signature
ts
query<$Output>(resolver: Function): BuildProcedure<"query", TParams, $Output>;
ts
query<$Output>(resolver: Function): BuildProcedure<"query", TParams, $Output>;
Type parameters
$Output
Parameters
Name | Type |
---|---|
resolver | (opts : ResolveOptions <TParams >) => MaybePromise <DefaultValue <TParams ["_output_in" ], $Output >> |
Returns
BuildProcedure
<"query"
, TParams
, $Output
>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:154
subscription()
Mutation procedure
Signature
ts
subscription<$Output>(resolver: Function): BuildProcedure<"subscription", TParams, $Output>;
ts
subscription<$Output>(resolver: Function): BuildProcedure<"subscription", TParams, $Output>;
Type parameters
$Output
Parameters
Name | Type |
---|---|
resolver | (opts : ResolveOptions <TParams >) => MaybePromise <DefaultValue <TParams ["_output_in" ], $Output >> |
Returns
BuildProcedure
<"subscription"
, TParams
, $Output
>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:172
unstable_concat()
Extend the procedure with another procedure.
Warning
The TypeScript inference fails when chaining concatenated procedures.
Signature
ts
unstable_concat<$ProcedureBuilder>(proc: $ProcedureBuilder): $ProcedureBuilder extends ProcedureBuilder<$TParams> ? CreateProcedureReturnInput<TParams, $TParams> : never;
ts
unstable_concat<$ProcedureBuilder>(proc: $ProcedureBuilder): $ProcedureBuilder extends ProcedureBuilder<$TParams> ? CreateProcedureReturnInput<TParams, $TParams> : never;
Type parameters
$ProcedureBuilder
extendsProcedureBuilder
<any
,$ProcedureBuilder
>
Parameters
Name | Type |
---|---|
proc | $ProcedureBuilder |
Returns
$ProcedureBuilder
extends ProcedureBuilder
<$TParams
> ? CreateProcedureReturnInput
<TParams
, $TParams
> : never
Defined in: packages/server/src/core/internals/procedureBuilder.ts:146
use()
Add a middleware to the procedure.
Signature
ts
use<$Params>(fn: MiddlewareBuilder<TParams, $Params> | MiddlewareFunction<TParams, $Params>): CreateProcedureReturnInput<TParams, $Params>;
ts
use<$Params>(fn: MiddlewareBuilder<TParams, $Params> | MiddlewareFunction<TParams, $Params>): CreateProcedureReturnInput<TParams, $Params>;
Type parameters
$Params
extendsProcedureParams
<AnyRootConfig
,unknown
,unknown
,unknown
,unknown
,unknown
,unknown
,$Params
>
Parameters
Name | Type |
---|---|
fn | MiddlewareBuilder <TParams , $Params > | MiddlewareFunction <TParams , $Params > |
Returns
CreateProcedureReturnInput
<TParams
, $Params
>
Defined in: packages/server/src/core/internals/procedureBuilder.ts:137