/** * Common interfaces for data processing operations. */ import { Either } from "monet"; /** Content returned from a fetch. items and a timestamp. */ export interface Content { items: Array; timestamp?: Date; } /** Capture error information. */ export interface ErrorInfo { error?: Error; message?: string; timestamp?: Date; } /** * Status may be provided prior to a result being produced. */ export interface Status { inProgress: boolean; name: string; message?: string; timestamp?: Date; } /** Makes a status and automatically sets the timestamp to now. */ export declare function mkStatus(inProgress: boolean, name: string, message?: string): { inProgress: boolean; name: string; message: string | undefined; timestamp: Date; }; /** Result of fetch. Left is error. */ export declare type Result = Either>; /** * Smart constructors for Result instances. If you don't * use `E=ErrorInfo` you will need to create your own if you want. */ export declare const ResultOps: { ok: (c: Content) => Either>; error: (e: ErrorInfo) => Either>; errorNow: (error: Error, message?: string | undefined) => Either>; okNow: (items?: T[]) => Either>; }; /** * A type often used when retrieving results that then get * indexed by name. You'll probably wrap non-null results * in a Maybe so you have `Maybe` which * you then filter and map (e.g. `collect` or `reduce`). */ export declare type NamedArrayTuple = [string, Array];