@studyportals/sp-r2d2
Version:
A framework that contains various components used when developing projects that will be deployed via AWS λ.
52 lines (51 loc) • 1.88 kB
TypeScript
import { IResult } from '@studyportals/sp-r2d2-interface';
import { AuthorizationError, ValidationError, ExecutionError } from '../../../application';
/**
* Offers the necessary functionality to send a response
* back to the Lambda call initiator.
*/
export interface IResponseSender {
/**
* Sends a pong in response to the given ping.
*
* @param ping The ping whose response is to be sent.
*/
sendPong(ping: any): Promise<unknown>;
/**
* Sends the given uncaught error.
*
* @param error The uncaught error for whom a response is to be sent.
*/
sendUncaughtError(error: Error): Promise<unknown>;
/**
* Sends the given error, encountered while trying to authorize the request.
*
* @param error The authorization error for whom a response is to be sent.
*/
sendRequestAuthorizationError(error: AuthorizationError): Promise<unknown>;
/**
* Sends the request outcome, reached without executing the handler due to an ignored event
*
* @param event The event which has been ignored
*/
sendEventIgnored(event: any): Promise<unknown>;
/**
* Sends the given error, encountered while validating the request's content.
*
* @param error The validation error for whom a response is to be sent.
*/
sendRequestValidationError(error: ValidationError): Promise<unknown>;
/**
* Sends the given error, encountered while executing the request.
*
* @param error The execution error for whom a response is to be sent.
*/
sendRequestExecutionError(error: ExecutionError): Promise<unknown>;
/**
* Sends the request execution's outcome, reached without
* encountering any errors.
*
* @param outcome The outcome the request's execution.
*/
sendExecutionOutcome(outcome: IResult): Promise<unknown>;
}