import Middleware, { DispatchDelegate } from '../middleware'; import { CommandMessage, ActionMessage, Entry } from '../messages'; import { ServerEnvelope } from './http-client'; import DataSource from '../data-source'; export declare type StateBag = { [key: string]: any; }; export declare type ClientCommand = { [key: string]: object; }; export declare type ClientAction = { key: string; content: any; }; export interface HttpMiddlewareOptions { onError?: (error: string) => Entry; } /** * Middleware for stateless remote service using http. */ export declare class HttpMiddleware implements Middleware { private options; private connected; private latestLocalState; private localStateLookup; private globalState; private queuedCommand; private httpClient; private eventSubscriptions; private commandEbb; constructor(projectionPath: string, options?: HttpMiddlewareOptions); name: string; connect: (next: DispatchDelegate, dataSource: DataSource) => (data: any) => void; disconnect: (next: DispatchDelegate) => (data: any) => void; command: (next: DispatchDelegate, dataSource: DataSource) => (message: CommandMessage) => void; respond: (next: DispatchDelegate, dataSource: DataSource) => (message: ActionMessage) => void; /** * Writes a `ServerEnvelope` to the specified `DataSource`. */ writeServerEnvelope(envelope: ServerEnvelope, dataSource: DataSource): void; } //# sourceMappingURL=http-middleware.d.ts.map