import { EventKey, OffsetMap, TestEvent, Timestamp, Where } from '@actyx/sdk'; import { SnapshotStore } from '@actyx/sdk/lib/snapshotStore'; import { Observable } from '../node_modules/rxjs'; import { Fish } from '.'; import { FishErrorContext, FishName, Semantics, SnapshotFormat } from './types'; export declare type NumberFishEvent = number | 'padding'; export declare type NumberFishState = number[]; export declare type RawEvent = Readonly<{ payload: NumberFishEvent; timestamp: number; source: string; tags?: string[]; }>; export declare type LastPublished = Readonly<{ timestamp: number; psn: number; sequence: number; }>; export declare const testFishSemantics: string; export declare const testFishName: string; export declare const testFishId: { entityType: string; name: string; version: number; }; export declare type EventFactory = { mkEvent: (raw: RawEvent) => TestEvent[]; mkEvents: (raw: RawEvent[]) => TestEvent[]; }; export declare const eventFactory: () => { mkEvent: (raw: RawEvent) => TestEvent; mkEvents: (raw: RawEvent[]) => TestEvent[]; }; export declare const mkNumberFish: (semanticSnapshot?: ((ev: NumberFishEvent) => boolean) | undefined, where?: Where) => Fish; export declare type SnapshotData = Readonly<{ semantics: Semantics; name: FishName; key: EventKey; offsets: OffsetMap; horizon: EventKey | undefined; cycle: number; version: number; tag: string; blob: string; }>; export declare const mkSnapshot: (state: NumberFishState, time: number, horizon?: number | undefined, offsetMap?: Record | undefined, version?: number | undefined) => SnapshotData; declare type SnapShotTestSetup = { latestSnap: () => Promise<{ state: any; offsets: OffsetMap; eventKey: Readonly<{ lamport: number; offset: number; stream: string; }>; horizon: Readonly<{ lamport: number; offset: number; stream: string; }> | undefined; cycle: number; } | undefined>; latestErr: () => FishErrorContext | null; snapshotStore: SnapshotStore; applyAndGetState: (events: TestEvent[]) => Promise; observe: Observable; pubEvents: (events: TestEvent[]) => void; wakeup: () => Promise; }; export declare const snapshotTestSetup: (fish: Fish, storedEvents?: TestEvent[] | undefined, storedSnapshots?: readonly Readonly<{ semantics: Semantics; name: FishName; key: EventKey; offsets: OffsetMap; horizon: EventKey | undefined; cycle: number; version: number; tag: string; blob: string; }>[] | undefined) => Promise>; export declare const semanticSnap: (ev: NumberFishEvent) => boolean; export declare const localSnap: (version: number) => SnapshotFormat; export declare type FishTestFn = (fish: Fish) => Promise; export declare type TestFish = [string, Fish]; export declare const forFishes: (...fishesToTest: TestFish[]) => (what: string, fishTest: FishTestFn) => void; declare type MkNumberEvent = { val: number; source: string; tAdd: (t: Timestamp) => Timestamp; }; declare type MkPadding = { numEvents: number; source: string; tAdd: (t: Timestamp) => Timestamp; }; export declare type MkEvent = MkNumberEvent | MkPadding; export declare type SnapshotStride = 'large' | 'medium' | 'small'; export declare const emitter: (source: string) => { (val: number): { val: number; source: string; tAdd: (t: Timestamp) => number; }; triggerLocalSnapshot(stride?: SnapshotStride): { numEvents: number; source: string; tAdd: (t: Timestamp) => number; }; ageSnapshotsOverMinAge(): { numEvents: number; source: string; tAdd: (t: Timestamp) => number; }; }; export declare type Timeline = { all: TestEvent[]; of: (...sources: string[]) => TestEvent[]; }; export declare const mkTimeline: (...events: MkEvent[]) => Timeline; export declare const offsets: (...eventsBySource: TestEvent[][]) => {}; export {};