import { AggregateFactory, CommandHandlerFactory, Messages, ProjectionQuery, ProjectionRecord, ProjectorFactory, Snapshot, State } from "../types"; export type HttpStatusCode = 200 | 400 | 401 | 403 | 404 | 409 | 500; export type HttpResponse = { status: HttpStatusCode; statusText?: string; result?: T; error?: { message: string; details?: any; stack?: string; }; }; export declare const Ok: (result?: any) => HttpResponse; export declare const BadRequest: (message?: string, details?: any) => HttpResponse; export declare const Unauthorized: (message?: string) => HttpResponse; export declare const Forbidden: (message?: string) => HttpResponse; export declare const NotFound: (message?: string) => HttpResponse; export declare const Conflict: (message?: string) => HttpResponse; export declare const InternalServerError: (message?: string, stack?: string) => HttpResponse; /** * Converts error to HttpResponse with error */ export declare const httpError: (error: unknown) => HttpResponse; export type Proxy = { command: (factory: CommandHandlerFactory, stream: string, name: N, data: C[N], expectedVersion?: number) => Promise>>; load: (factory: AggregateFactory, stream: string) => Promise> | undefined>; query: (factory: ProjectorFactory, query: ProjectionQuery) => Promise[]>>; }; /** * Http api proxy * * @param apiUrl api host url * @param options fetch options * @param responseMapper optional reponse body mapper */ export declare const HttpProxy: (apiUrl: string, options?: RequestInit, responseMapper?: (response: any) => HttpResponse) => Proxy; //# sourceMappingURL=http.d.ts.map