Skip to content
Français

readJournal

import { readJournal } from "@elie-laloum/outpost";

Return a journal’s events in chronological order, reading its index at exactly reference.revision. Rejects with TransportConflict when the index has moved or a segment is missing, and with an error on a cycle or when maxEntries or maxBytes is exceeded.

Complete example and detailed rules.

  • optionsRequired
    ReadJournalOptions
    Transport, pinned journal index revision and traversal bound.
  • options.referenceRequired
    TransportReference
    Journal index reference, usually DispatchResult.logReference; the index must still have this revision.
  • options.maxEntriesOptional
    number | undefined
    Most events to read, default 100000; a longer chain rejects.
  • options.maxBytesOptional
    number | undefined
    Total bytes of event segments to read, default 64 MiB; exceeding it rejects.
  • options.transporterRequired
    Transport
    Caller-owned object transport used by the store or operation. Closing a workflow or sandbox does not close this transport.

Promise<readonly unknown[]>

export declare function readJournal(
  options: ReadJournalOptions,
): Promise<readonly unknown[]>;