import type { IAction, IActorArgs, IActorOutput, IActorTest, Mediate } from '@comunica/core'; import { Actor, Mediator } from '@comunica/core'; import type { Expression, IEvalContext, IInternalEvaluator, TermExpression } from '@comunica/types'; import type { Algebra as Alg } from '@comunica/utils-algebra'; /** * A comunica actor for function factory events. * * Actor types: * * Input: IActionFunctions: A request to receive a function implementation for a given function name * and potentially the function arguments. * * Test: * * Output: IActorFunctionsOutput: A function implementation. * * @see IActionFunctionFactory * @see IActorFunctionFactoryOutput */ export declare abstract class ActorFunctionFactory extends Actor { /** * @param args - * \ @defaultNested { a } bus * \ @defaultNested {Creation of function evaluator failed: no configured actor was able to evaluate function ${action.functionName}} busFailMessage */ constructor(args: IActorFunctionFactoryArgs); abstract run(action: T): Promise; } export interface IExpressionFunction { apply: (evalContext: IEvalContext) => Promise; /** * The arity of the function will be checked when parsing and preparing a function. * This allows us to check if the query is correct even before we process any bindings. */ checkArity: (args: Expression[]) => boolean; } export interface ITermFunction extends IExpressionFunction { supportsTermExpressions: true; applyOnTerms: (args: TermExpression[], exprEval: IInternalEvaluator) => TermExpression; } export interface IActionFunctionFactory extends IAction { /** * The name of the function to retrieve. Can be any string, a function name, or a URL. */ functionName: string; /** * The arguments of the function, if they are known, and don't change. */ arguments?: Alg.Expression[]; /** * Whether the function should return a term expression. */ requireTermExpression?: boolean; } export interface IActorFunctionFactoryOutput extends IActorOutput, IExpressionFunction { } export interface IActorFunctionFactoryOutputTerm extends IActorOutput, ITermFunction { } export type IActorFunctionFactoryArgs = IActorArgs; export type MediatorFunctionFactoryUnsafe = Mediate; export declare abstract class MediatorFunctionFactory extends Mediator, IActionFunctionFactory, IActorTest, IActorFunctionFactoryOutput> { abstract mediate: (action: T) => Promise; }