JSONL-based report adapter with append-only writes.

Features:

  • Writes events as JSONL entries to a single file per report type
  • Stream-based writes with backpressure handling
  • 15-second timeout protection for write operations
  • Automatic directory creation
  • Error handling via exitEmitter
  • Search metadata for filtering (symbol, strategy, exchange, frame, signalId, walkerName)

File format: ./dump/report/{reportName}.jsonl Each line contains: reportName, data, metadata, timestamp

Use this adapter for event logging and post-processing analytics.

Implements

Constructors

  • Creates a new JSONL report adapter instance.

    Parameters

    • reportName: keyof IReportTarget

      Type of report (backtest, live, walker, etc.)

    • OptionalbaseDir: string

      Base directory for report files, defaults to ./dump/report

    Returns ReportBase

Properties

_filePath: string

Absolute path to the JSONL file for this report type

_stream: WriteStream

WriteStream instance for append-only writes, null until initialized

"[WAIT_FOR_INIT_SYMBOL$1]": () => Promise<void> & ISingleshotClearable

Singleshot initialization function that creates directory and stream. Protected by singleshot to ensure one-time execution. Sets up error handler that emits to exitEmitter.

"[WRITE_SAFE_SYMBOL$1]": (line: string) => Promise<symbol | void>

Timeout-protected write function with backpressure handling. Waits for drain event if write buffer is full. Times out after 15 seconds and returns TIMEOUT_SYMBOL.

baseDir: string
reportName: keyof IReportTarget

Methods

  • Initializes the JSONL file and write stream. Safe to call multiple times - singleshot ensures one-time execution.

    Parameters

    • initial: boolean

      Whether this is the first initialization (informational only)

    Returns Promise<void>

    Promise that resolves when initialization is complete

  • Writes event data to JSONL file with metadata. Appends a single line with JSON object containing:

    • reportName: Type of report
    • data: Event data object
    • Search flags: symbol, strategyName, exchangeName, frameName, signalId, walkerName
    • timestamp: Current timestamp in milliseconds

    Type Parameters

    • T = any

    Parameters

    • data: T

      Event data object to write

    • options: IReportDumpOptions

      Metadata options for filtering and search

    Returns Promise<void>

    Error if stream not initialized or write timeout exceeded