Skip to content

API Reference ​

Use this page for the main public API. The generated API pages are still available when exact signatures matter.

Main entry points ​

ExportPurpose
createSimulatorClientCanonical factory for the namespaced SDK client.
SimulatorClientPublic client type holding every resource below.
MatchSessionStateful helper for one seat WebSocket session.
parseSchemaRuntime validator for generated wire schemas.
EngineHttpErrorNon-2xx HTTP error with request and body context.
SdkValidationErrorSchema 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.

PropertyResource typeCovers
adminAdminResourceMaintenance, ranked admission, AI pause status.
cardsCardsResourceCard metadata, catalog, id resolution, deck JSON import.
limitedEventsLimitedEventsResourceSealed pools and Draft pods, including preflight().
lobbiesLobbiesResourcePre-match lobbies, the public lobby list socket, matchmaking.
matchHistoryMatchHistoryResourceServer-owned history, replays, deck stats.
matchesMatchesResourceMatch lifecycle, decks, undo, save/restore, format events.
sessionSessionResourceOne live MatchSession per seat token.
systemSystemResourcehealth() and availability() startup gates.
tournamentRoomsTournamentRoomsResourceTournament rooms, tables, and their sockets.

Generated protocol types ​

Protocol types are exported from the package root and from the generated subpath:

ts
import type { 
GameCommand
,
GameEvent
, GameState } from '@my-swu/simulator-client/generated'

JSON schema files are available as package assets:

ts
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:

ts
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 — what limitedEvents.preflight() returns.
  • CloseTournamentRoomRequest — the body tournamentRooms.close() sends.
  • PrepareLobbyLimitedAiDecksRequest — the body lobbies.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 ​

bash
pnpm docs:api

The root docs:build script runs this before VitePress builds the site.

Released under the MIT License.