@actyx/sdk
Version:
Actyx SDK
30 lines (29 loc) • 1.18 kB
TypeScript
import { Observable } from '../../node_modules/rxjs';
import { SnapshotStore } from '../snapshotStore';
import { FixedStart, MsgType, SerializedStateSnap, Where } from '../types';
import { EventStore } from './eventStore';
import { Event, Events } from './types';
export declare type StateMsg = {
type: MsgType.state;
snapshot: SerializedStateSnap;
};
export declare type EventsMsg = {
type: MsgType.events;
events: Events;
caughtUp: boolean;
};
export declare type TimeTravelMsg = {
type: MsgType.timetravel;
trigger: Event;
high: Event;
};
export declare type EventsOrTimetravel = StateMsg | EventsMsg | TimeTravelMsg;
export declare type SubscribeMonotonic = (fishId: SessionId, subscriptions: Where<unknown>, attemptStartFrom?: FixedStart) => Observable<EventsOrTimetravel>;
declare type SessionId = string;
/**
* Create a new endpoint, based on the given EventStore and SnapshotStore.
* The returned function itself is stateless between subsequent calls --
* all state is within the EventStore itself.
*/
export declare const eventsMonotonicEmulated: (eventStore: EventStore, snapshotStore: SnapshotStore) => SubscribeMonotonic;
export {};