Documentation
    Preparing search index...

    Function validateReplayRecording

    • Validates an arbitrary value as a §34 replay document and returns it in canonical form.

      The result is a fresh, deep-frozen object holding only the fields this format defines, built in a fixed key order — so re-encoding it is byte-stable, and no unknown field from an untrusted document survives into the player.

      The declared formatVersion is re-derived rather than copied: the result carries the lowest version that can express it (see LATEST_REPLAY_FORMAT_VERSION), so validation is idempotent and a configuration-free document is spelled exactly as MINIMUM_REPLAY_FORMAT_VERSION always spelled it.

      Parameters

      • value: unknown

        the candidate document (typically JSON.parse output)

      Returns ReplayRecording

      the canonical, frozen recording

      FourError SERIALIZATION_VERSION_MISMATCH if formatVersion is not one of SUPPORTED_REPLAY_FORMAT_VERSIONS, or if the document declares a version too low for the fields it carries — §34's "refuses to run" applied to the envelope itself

      TypeError if any field is missing, mistyped, or out of range; the message names the field's path