API Reference
Use this page for the main public API. The generated API pages are still available when exact signatures matter.
Main entry points
| Export | Purpose |
|---|---|
createSimulatorClient | Canonical factory for the namespaced SDK client. |
SimulatorClient | Public client type holding every resource below. |
MatchSession | Stateful helper for one seat WebSocket session. |
parseSchema | Runtime validator for generated wire schemas. |
EngineHttpError | Non-2xx HTTP error with request and body context. |
SdkValidationError | Schema validation failure for requests, responses, or socket frames. |
Resource types
One property per resource on SimulatorClient. Exact method signatures live in the generated API, which is regenerated from the source and never drifts.
| Property | Resource type | Covers |
|---|---|---|
admin | AdminResource | Maintenance, ranked admission, AI pause status. |
cards | CardsResource | Card metadata, catalog, id resolution, deck JSON import. |
limitedEvents | LimitedEventsResource | Sealed pools and Draft pods, including preflight(). |
lobbies | LobbiesResource | Pre-match lobbies, the public lobby list socket, matchmaking. |
matchHistory | MatchHistoryResource | Server-owned history, replays, deck stats. |
matches | MatchesResource | Match lifecycle, decks, undo, save/restore, format events. |
session | SessionResource | One live MatchSession per seat token. |
system | SystemResource | health() and availability() startup gates. |
tournamentRooms | TournamentRoomsResource | Tournament rooms, tables, and their sockets. |
Generated protocol types
Protocol types are exported from the package root and from the generated subpath:
import type { GameCommand, GameEvent, GameState } from '@my-swu/simulator-client/generated'JSON schema files are available as package assets:
import clientMessageSchema from '@my-swu/simulator-client/schema/client-message.schema.json'The root export set is closed under reference
Every public wire view is nameable from the package root. If an exported type names another generated type in one of its fields, that one is exported too, so walking into a payload never lands on a shape you cannot write down. Indexed-access workarounds such as NonNullable<SeatState["hand"]>[number] are no longer needed — import the inner type directly:
import type { CardInstanceView, TargetSelectionGroup } from '@my-swu/simulator-client'
// Nested wire views are named types, not reconstructed indexed accesses.
declare const handCard: CardInstanceView
declare const targetGroup: TargetSelectionGroup
console.log(handCard.cardInstanceId, targetGroup.validTargets.length)Three types that were previously reachable only through a resource method's signature are now importable by name:
LimitedEventPreflight— whatlimitedEvents.preflight()returns.CloseTournamentRoomRequest— the bodytournamentRooms.close()sends.PrepareLobbyLimitedAiDecksRequest— the bodylobbies.prepareLimitedAiDecks()sends.
CurrentAttackView is also reachable from the root now; it was previously declared but never re-exported.
The generated API is the authoritative list of exported names and their field shapes. These pages link to it rather than transcribing it, because a transcribed list goes stale on the next schema change.
Regenerating reference docs
pnpm docs:apiThe root docs:build script runs this before VitePress builds the site.
