Header menu logo Xanthos

Serialization Module

Provides helpers for decoding and encoding JV-Link payloads into strongly typed domain records.

Functions and values

Function or value Description

deserialiseOdds payload

Full Usage: deserialiseOdds payload

Parameters:
    payload : byte[] - UTF-8 or Shift-JIS encoded JSON byte array.

Returns: Result<RaceOdds list, XanthosError> A list of RaceOdds or a XanthosError.

Deserialises odds snapshots from JSON. This is an alias for parseOdds.

payload : byte[]

UTF-8 or Shift-JIS encoded JSON byte array.

Returns: Result<RaceOdds list, XanthosError>

A list of RaceOdds or a XanthosError.

parseOdds payload

Full Usage: parseOdds payload

Parameters:
    payload : byte[] - Raw bytes returned by JV-Link.

Returns: Result<RaceOdds list, XanthosError> A list of RaceOdds or a XanthosError.

Decodes JV odds payloads (Shift-JIS or UTF-8) expressed as JSON into strongly typed snapshots.

payload : byte[]

Raw bytes returned by JV-Link.

Returns: Result<RaceOdds list, XanthosError>

A list of RaceOdds or a XanthosError.

parseRaceCard payload

Full Usage: parseRaceCard payload

Parameters:
    payload : byte[] - Raw bytes returned by JV-Link.

Returns: Result<RaceInfo list, XanthosError> A list of RaceInfo or a XanthosError.

Decodes JV race card payloads (Shift-JIS or UTF-8) expressed as JSON into strongly typed records.

payload : byte[]

Raw bytes returned by JV-Link.

Returns: Result<RaceInfo list, XanthosError>

A list of RaceInfo or a XanthosError.

parseWatchEvent rawKey

Full Usage: parseWatchEvent rawKey

Parameters:
    rawKey : string - The raw key string from JVWatchEvent callback.

Returns: WatchEvent A WatchEvent with parsed fields including event type, meeting date, course code, etc.

Parses a raw JV watch event key string into a typed WatchEvent.

JVWatchEvent returns keys in formats like "0B12RA20240101010112..." where:

  • 0B12/0B11/0B16 = dataspec prefix indicating event category
  • RA/JC/WE/CC/AV/TC = record type (optional)
  • yyyyMMdd = meeting date
  • JJ = course/venue code
  • RR = race number

rawKey : string

The raw key string from JVWatchEvent callback.

Returns: WatchEvent

A WatchEvent with parsed fields including event type, meeting date, course code, etc.

serialiseOdds snapshots

Full Usage: serialiseOdds snapshots

Parameters:
    snapshots : RaceOdds list - The odds snapshots to serialise.

Returns: Result<byte[], XanthosError> UTF-8 encoded JSON byte array or a XanthosError.

Serialises odds snapshots to JSON for persistence or caching scenarios. The output format is compatible with parseOdds.

snapshots : RaceOdds list

The odds snapshots to serialise.

Returns: Result<byte[], XanthosError>

UTF-8 encoded JSON byte array or a XanthosError.

Type something to start searching.