/** * convert.ts — backward-compatibility shim. * * The real conversion code lives in ./extract.ts. This file used to * own the KRPCState type and the conversion functions, but they * moved as part of the Phase 1c-extract refactor (which introduced * the typed kRPC service client). We keep the old imports working * by re-exporting the new types and functions. * * New code should import from ./extract.ts directly. */ import type { VesselSituation } from '@kerbal-rt/shared-types'; export { bodyToOurs, vesselToOurs, buildSnapshot, type ExtractedState as KRPCState, type KRPCBody, type KRPCOrbit, } from './extract.js'; // Re-export the situation mapper. The new extract.ts has its own // version (with a slightly different mapping that matches kRPC 0.5.x // exactly). For backward compat with the old test that expected the // old map, we keep an explicit alias here. const LEGACY_SITUATION_MAP: Record = { 0: 'UNKNOWN', 1: 'ORBITING', 2: 'ESCAPING', 3: 'LANDED', 4: 'SPLASHED', 5: 'PRELAUNCH', 6: 'FLYING', 7: 'SUB_ORBITAL', 8: 'DOCKED', }; /** Legacy situation mapper used by older tests. Prefer the one in * extract.ts for new code. */ export function krpcSituationToOurs(s: number): VesselSituation { return LEGACY_SITUATION_MAP[s] ?? 'UNKNOWN'; }