UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

26 lines (25 loc) 797 B
import { HttpStatus } from './HttpStatus'; import { List } from '../types/List'; import { Json } from '../types/Json'; import { Result } from '../types/Result'; export type RestResult = { data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json; }; error?: { code: number; message: string; errorCount: number; errors: List<Result>; }; }; export declare const rest: { toData: (status: HttpStatus, items?: Json[], totalItems?: number, meta?: Json) => RestResult; toError: (status: HttpStatus, errors?: Result[]) => RestResult; to: (payload?: any | any[], status?: HttpStatus) => RestResult; }; export declare const isRestResult: (r: unknown) => r is RestResult;