hashbrown

useRuntimeFunction

Creates a function with an input schema.

API

export declare function useRuntimeFunction<
  ArgsSchema extends  s.HashbrownType ,
  ResultSchema extends  s.HashbrownType ,
>(cfg: {
  name: string;
  description: string;
  deps:  DependencyList ;
  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>
>;
useRuntimeFunction
RuntimeFunctionRef<s.Infer<ArgsSchema>, s.Infer<ResultSchema>>
@paramcfg:
{
    name: string;
    description: string;
    deps: DependencyList;
    args: ArgsSchema;
    result: ResultSchema;
    handler: (input: s.Infer<ArgsSchema>, abortSignal?: AbortSignal) => s.Infer<ResultSchema> | Promise<s.Infer<ResultSchema>>;
}

The configuration for the function.

@typeArgsSchema
s.HashbrownType
@typeResultSchema
s.HashbrownType
@returns
RuntimeFunctionRef<s.Infer<ArgsSchema>, s.Infer<ResultSchema>>

useRuntimeFunction

Creates a function without an input schema.

API

export declare function useRuntimeFunction<
  ResultSchema extends  s.HashbrownType ,
>(cfg: {
  name: string;
  description: string;
  deps:  DependencyList ;
  result: ResultSchema;
  handler: (
    abortSignal?:  AbortSignal ,
  ) => 
    | s.Infer <ResultSchema>
    |  Promise <
         s.Infer <ResultSchema>
      >;
}):  RuntimeFunctionRef <
  null,
   s.Infer <ResultSchema>
>;
useRuntimeFunction
RuntimeFunctionRef<null, s.Infer<ResultSchema>>
@paramcfg:
{
    name: string;
    description: string;
    deps: DependencyList;
    result: ResultSchema;
    handler: (abortSignal?: AbortSignal) => s.Infer<ResultSchema> | Promise<s.Infer<ResultSchema>>;
}

The configuration for the function.

@typeResultSchema
s.HashbrownType
@returns
RuntimeFunctionRef<null, s.Infer<ResultSchema>>

useRuntimeFunction

Creates a function with an input schema.

API

export declare function useRuntimeFunction<
  ArgsSchema extends  s.HashbrownType ,
>(cfg: {
  name: string;
  description: string;
  deps:  DependencyList ;
  args: ArgsSchema;
  handler: (
    args:  s.Infer <ArgsSchema>,
    abortSignal?:  AbortSignal ,
  ) => void |  Promise <void>;
}):  RuntimeFunctionRef <
   s.Infer <ArgsSchema>,
  void
>;
useRuntimeFunction
RuntimeFunctionRef<s.Infer<ArgsSchema>, void>
@paramcfg:
{
    name: string;
    description: string;
    deps: DependencyList;
    args: ArgsSchema;
    handler: (args: s.Infer<ArgsSchema>, abortSignal?: AbortSignal) => void | Promise<void>;
}

The configuration for the function.

@typeArgsSchema
s.HashbrownType
@returns
RuntimeFunctionRef<s.Infer<ArgsSchema>, void>

useRuntimeFunction

Creates a function without input or output schema.

API

export declare function useRuntimeFunction(cfg: {
  name: string;
  description: string;
  deps:  DependencyList ;
  handler: (
    abortSignal?:  AbortSignal ,
  ) => void |  Promise <void>;
}):  RuntimeFunctionRef <null, void>;
useRuntimeFunction
RuntimeFunctionRef<null, void>
@paramcfg:
{
    name: string;
    description: string;
    deps: DependencyList;
    handler: (abortSignal?: AbortSignal) => void | Promise<void>;
}

The configuration for the function.

@returns
RuntimeFunctionRef<null, void>