@qrvey/function-gateway
Version:
 
32 lines (26 loc) • 1.31 kB
TypeScript
interface IFunctionMappingReturn {
lambda?: any;
rest?: any;
}
interface IFunctionMapping {
[functionName: string]: (params: unknown) => IFunctionMappingReturn;
}
declare const VALID_FUNCTION_MAPPING_TYPE: readonly ["lambda", "rest"];
type FunctionMappingType = (typeof VALID_FUNCTION_MAPPING_TYPE)[number];
interface IFunctionOptions {
mappingType?: FunctionMappingType;
}
declare class FunctionGatewayService {
/**
* Invokes a function with the specified parameters and options.
*
* @param functionName - The name of the function to invoke.
* @param params - This parameters is passed to the functionMapping config.
* @param functionMapping - An object that maps function names to function implementations. This object should conform to the `IFunctionMapping` interface.
* @param options - An object containing additional options for invoking the function. This may include settings such as the mappingType ('lambda' or 'rest').
*
* @returns - Returns a promise that resolves with the result of the invoked function or rejects with an error if the invocation fails.
*/
static invoke(functionName: string, params: unknown, functionMapping: IFunctionMapping, options?: IFunctionOptions): Promise<any>;
}
export { FunctionGatewayService };