@meshwatch/backend-core
Version:
Meshwatch backend core services.
13 lines (12 loc) • 676 B
TypeScript
import { Boom } from '@meshwatch/types';
export declare type ServiceResponse<T> = {
statusCode: number;
body: T;
};
declare abstract class BaseService {
protected errorServiceResponse: <K>(error: Error) => ServiceResponse<Boom<import("../validation/types").FormErrors<K>>>;
protected serviceResponseFromBoom: <K>(boom: Boom<K>) => ServiceResponse<Boom<import("../validation/types").FormErrors<K>>>;
protected serviceResponse: <T>(body: T) => ServiceResponse<T>;
protected tryExecute: <T>(f: () => Promise<ServiceResponse<T>>) => Promise<ServiceResponse<T | Boom<import("../validation/types").FormErrors<T>>>>;
}
export default BaseService;