Creates a function with an input schema.
API
declare function createRuntimeFunction<
ArgsSchema extends s.HashbrownType ,
ResultSchema extends s.HashbrownType ,
>(cfg: {
name: string;
description: string;
args: ArgsSchema;
result: ResultSchema;
handler: (
input: s.Infer <ArgsSchema>,
abortSignal?: AbortSignal ,
) =>
| s.Infer <ResultSchema>
| Promise <
s.Infer <ResultSchema>
>;
}): RuntimeFunctionRef <
s.Infer <ArgsSchema>,
s.Infer <ResultSchema>
>;RuntimeFunctionRef<s.Infer<ArgsSchema>, s.Infer<ResultSchema>>@paramcfg:{
name: string;
description: string;
args: ArgsSchema;
result: ResultSchema;
handler: (input: s.Infer<ArgsSchema>, abortSignal?: AbortSignal) => s.Infer<ResultSchema> | Promise<s.Infer<ResultSchema>>;
}The configuration for the function containing: - name: The name of the function - description: The description of the function - args: The input schema of the function - result: The result schema of the function - handler: The handler of the function
@typeArgsSchemas.HashbrownType@typeResultSchemas.HashbrownType@returnsRuntimeFunctionRef<s.Infer<ArgsSchema>, s.Infer<ResultSchema>>API
declare function createRuntimeFunction<
ResultSchema extends s.HashbrownType ,
>(cfg: {
name: string;
description: string;
result: ResultSchema;
handler: (
abortSignal?: AbortSignal ,
) =>
| s.Infer <ResultSchema>
| Promise <
s.Infer <ResultSchema>
>;
}): RuntimeFunctionRef <
null,
s.Infer <ResultSchema>
>;RuntimeFunctionRef<null, s.Infer<ResultSchema>>@paramcfg:{
name: string;
description: string;
result: ResultSchema;
handler: (abortSignal?: AbortSignal) => s.Infer<ResultSchema> | Promise<s.Infer<ResultSchema>>;
}The configuration for the function containing: - name: The name of the function - description: The description of the function - result: The result schema of the function - handler: The handler of the function
@typeResultSchemas.HashbrownType@returnsRuntimeFunctionRef<null, s.Infer<ResultSchema>>API
declare function createRuntimeFunction<
ArgsSchema extends s.HashbrownType ,
>(cfg: {
name: string;
description: string;
args: ArgsSchema;
handler: (
args: s.Infer <ArgsSchema>,
abortSignal?: AbortSignal ,
) => void | Promise <void>;
}): RuntimeFunctionRef <
s.Infer <ArgsSchema>,
void
>;RuntimeFunctionRef<s.Infer<ArgsSchema>, void>@paramcfg:{
name: string;
description: string;
args: ArgsSchema;
handler: (args: s.Infer<ArgsSchema>, abortSignal?: AbortSignal) => void | Promise<void>;
}The configuration for the function containing: - name: The name of the function - description: The description of the function - args: The args schema of the function - handler: The handler of the function
@typeArgsSchemas.HashbrownType@returnsRuntimeFunctionRef<s.Infer<ArgsSchema>, void>API
declare function createRuntimeFunction(cfg: {
name: string;
description: string;
handler: (
abortSignal?: AbortSignal ,
) => void | Promise <void>;
}): RuntimeFunctionRef <null, void>;RuntimeFunctionRef<null, void>@paramcfg:{
name: string;
description: string;
handler: (abortSignal?: AbortSignal) => void | Promise<void>;
}The configuration for the function containing: - name: The name of the function - description: The description of the function - handler: The handler of the function, which returns void or a promise thereof
@returnsRuntimeFunctionRef<null, void>