recordOf
A record as an event carries it (JSON live, DAG-CBOR from the archive), as a release record if it is one.
import { parseReleaseRecord } from "#codebase/tcmts/records"; import type { ReleaseRecord } from "#codebase/tcmts/records"; import { parseRawRecord } from "@bsky/jetstream"; export function recordOf(raw: unknown): ReleaseRecord | undefined { try { return parseReleaseRecord(raw instanceof Uint8Array ? parseRawRecord(raw) : raw); } catch { return undefined; } }