@my-swu/simulator-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +355 -0
- package/dist/actionable.d.ts +61 -0
- package/dist/actionable.js +91 -0
- package/dist/client.d.ts +157 -0
- package/dist/client.js +92 -0
- package/dist/connection/handshake.d.ts +30 -0
- package/dist/connection/handshake.js +62 -0
- package/dist/connection/options.d.ts +36 -0
- package/dist/connection/options.js +1 -0
- package/dist/connection/url.d.ts +55 -0
- package/dist/connection/url.js +46 -0
- package/dist/connection/wait.d.ts +22 -0
- package/dist/connection/wait.js +10 -0
- package/dist/connection.d.ts +110 -0
- package/dist/connection.js +358 -0
- package/dist/generated/index.d.ts +121 -0
- package/dist/generated/index.js +1 -0
- package/dist/generated/public-types.d.ts +2 -0
- package/dist/generated/public-types.js +1 -0
- package/dist/generated/schemas.d.ts +27 -0
- package/dist/generated/schemas.js +21264 -0
- package/dist/generated/types/abandon-match-request.d.ts +1 -0
- package/dist/generated/types/abandon-match-request.js +2 -0
- package/dist/generated/types/abandon-match-response.d.ts +1 -0
- package/dist/generated/types/abandon-match-response.js +2 -0
- package/dist/generated/types/add-lobby-ai-player-request.d.ts +1 -0
- package/dist/generated/types/add-lobby-ai-player-request.js +2 -0
- package/dist/generated/types/ai-driver-error-report-list-response.d.ts +1 -0
- package/dist/generated/types/ai-driver-error-report-list-response.js +2 -0
- package/dist/generated/types/ai-driver-error-report-response.d.ts +1 -0
- package/dist/generated/types/ai-driver-error-report-response.js +2 -0
- package/dist/generated/types/api-error-response.d.ts +1 -0
- package/dist/generated/types/api-error-response.js +2 -0
- package/dist/generated/types/card-catalog-refresh-response.d.ts +1 -0
- package/dist/generated/types/card-catalog-refresh-response.js +2 -0
- package/dist/generated/types/cards-response.d.ts +1 -0
- package/dist/generated/types/cards-response.js +2 -0
- package/dist/generated/types/client-message.d.ts +1 -0
- package/dist/generated/types/client-message.js +2 -0
- package/dist/generated/types/close-tournament-room-request.d.ts +1 -0
- package/dist/generated/types/close-tournament-room-request.js +2 -0
- package/dist/generated/types/common.d.ts +5361 -0
- package/dist/generated/types/common.js +2 -0
- package/dist/generated/types/covered-cards-response.d.ts +47 -0
- package/dist/generated/types/covered-cards-response.js +2 -0
- package/dist/generated/types/create-limited-event-request.d.ts +1 -0
- package/dist/generated/types/create-limited-event-request.js +2 -0
- package/dist/generated/types/create-lobby-request.d.ts +1 -0
- package/dist/generated/types/create-lobby-request.js +2 -0
- package/dist/generated/types/create-match-request.d.ts +1 -0
- package/dist/generated/types/create-match-request.js +2 -0
- package/dist/generated/types/create-meta-window-request.d.ts +1 -0
- package/dist/generated/types/create-meta-window-request.js +2 -0
- package/dist/generated/types/create-tournament-room-request.d.ts +1 -0
- package/dist/generated/types/create-tournament-room-request.js +2 -0
- package/dist/generated/types/create-tournament-table-request.d.ts +1 -0
- package/dist/generated/types/create-tournament-table-request.js +2 -0
- package/dist/generated/types/error-payload.d.ts +1 -0
- package/dist/generated/types/error-payload.js +2 -0
- package/dist/generated/types/format-event-request.d.ts +1 -0
- package/dist/generated/types/format-event-request.js +2 -0
- package/dist/generated/types/format-event-response.d.ts +1 -0
- package/dist/generated/types/format-event-response.js +2 -0
- package/dist/generated/types/game-command.d.ts +1 -0
- package/dist/generated/types/game-command.js +2 -0
- package/dist/generated/types/game-event.d.ts +1 -0
- package/dist/generated/types/game-event.js +2 -0
- package/dist/generated/types/game-state.d.ts +1 -0
- package/dist/generated/types/game-state.js +2 -0
- package/dist/generated/types/get-match-response.d.ts +1 -0
- package/dist/generated/types/get-match-response.js +2 -0
- package/dist/generated/types/health-response.d.ts +1 -0
- package/dist/generated/types/health-response.js +2 -0
- package/dist/generated/types/join-limited-event-request.d.ts +1 -0
- package/dist/generated/types/join-limited-event-request.js +2 -0
- package/dist/generated/types/join-lobby-request.d.ts +1 -0
- package/dist/generated/types/join-lobby-request.js +2 -0
- package/dist/generated/types/join-match-request.d.ts +1 -0
- package/dist/generated/types/join-match-request.js +2 -0
- package/dist/generated/types/join-tournament-room-request.d.ts +1 -0
- package/dist/generated/types/join-tournament-room-request.js +2 -0
- package/dist/generated/types/join-tournament-table-request.d.ts +1 -0
- package/dist/generated/types/join-tournament-table-request.js +2 -0
- package/dist/generated/types/kick-lobby-player-request.d.ts +1 -0
- package/dist/generated/types/kick-lobby-player-request.js +2 -0
- package/dist/generated/types/kick-lobby-spectator-request.d.ts +1 -0
- package/dist/generated/types/kick-lobby-spectator-request.js +2 -0
- package/dist/generated/types/leave-lobby-request.d.ts +1 -0
- package/dist/generated/types/leave-lobby-request.js +2 -0
- package/dist/generated/types/leave-match-request.d.ts +1 -0
- package/dist/generated/types/leave-match-request.js +2 -0
- package/dist/generated/types/leave-match-response.d.ts +1 -0
- package/dist/generated/types/leave-match-response.js +2 -0
- package/dist/generated/types/leave-tournament-room-request.d.ts +1 -0
- package/dist/generated/types/leave-tournament-room-request.js +2 -0
- package/dist/generated/types/limited-event-access-response.d.ts +1 -0
- package/dist/generated/types/limited-event-access-response.js +2 -0
- package/dist/generated/types/limited-event-command-request.d.ts +1 -0
- package/dist/generated/types/limited-event-command-request.js +2 -0
- package/dist/generated/types/limited-event-preflight-response.d.ts +1 -0
- package/dist/generated/types/limited-event-preflight-response.js +2 -0
- package/dist/generated/types/limited-event-response.d.ts +1 -0
- package/dist/generated/types/limited-event-response.js +2 -0
- package/dist/generated/types/list-active-ai-matches-request.d.ts +1 -0
- package/dist/generated/types/list-active-ai-matches-request.js +2 -0
- package/dist/generated/types/list-active-ai-matches-response.d.ts +1 -0
- package/dist/generated/types/list-active-ai-matches-response.js +2 -0
- package/dist/generated/types/lobby-access-response.d.ts +1 -0
- package/dist/generated/types/lobby-access-response.js +2 -0
- package/dist/generated/types/lobby-chat-request.d.ts +1 -0
- package/dist/generated/types/lobby-chat-request.js +2 -0
- package/dist/generated/types/lobby-chat-response.d.ts +1 -0
- package/dist/generated/types/lobby-chat-response.js +2 -0
- package/dist/generated/types/lobby-list-response.d.ts +1 -0
- package/dist/generated/types/lobby-list-response.js +2 -0
- package/dist/generated/types/lobby-list-server-message.d.ts +1 -0
- package/dist/generated/types/lobby-list-server-message.js +2 -0
- package/dist/generated/types/lobby-matchmaking-decision-request.d.ts +1 -0
- package/dist/generated/types/lobby-matchmaking-decision-request.js +2 -0
- package/dist/generated/types/lobby-matchmaking-request.d.ts +1 -0
- package/dist/generated/types/lobby-matchmaking-request.js +2 -0
- package/dist/generated/types/lobby-response.d.ts +1 -0
- package/dist/generated/types/lobby-response.js +2 -0
- package/dist/generated/types/lobby-server-message.d.ts +1 -0
- package/dist/generated/types/lobby-server-message.js +2 -0
- package/dist/generated/types/lobby-sync-request.d.ts +1 -0
- package/dist/generated/types/lobby-sync-request.js +2 -0
- package/dist/generated/types/match-access-response.d.ts +1 -0
- package/dist/generated/types/match-access-response.js +2 -0
- package/dist/generated/types/match-chat-lookup-response.d.ts +1 -0
- package/dist/generated/types/match-chat-lookup-response.js +2 -0
- package/dist/generated/types/match-connection-role.d.ts +1 -0
- package/dist/generated/types/match-connection-role.js +2 -0
- package/dist/generated/types/match-history-deck-stats-request.d.ts +1 -0
- package/dist/generated/types/match-history-deck-stats-request.js +2 -0
- package/dist/generated/types/match-history-deck-stats-response.d.ts +1 -0
- package/dist/generated/types/match-history-deck-stats-response.js +2 -0
- package/dist/generated/types/match-history-entry.d.ts +1 -0
- package/dist/generated/types/match-history-entry.js +2 -0
- package/dist/generated/types/match-history-list-request.d.ts +1 -0
- package/dist/generated/types/match-history-list-request.js +2 -0
- package/dist/generated/types/match-history-list-response.d.ts +1 -0
- package/dist/generated/types/match-history-list-response.js +2 -0
- package/dist/generated/types/match-history-replay-request.d.ts +1 -0
- package/dist/generated/types/match-history-replay-request.js +2 -0
- package/dist/generated/types/match-history-replay-response.d.ts +1 -0
- package/dist/generated/types/match-history-replay-response.js +2 -0
- package/dist/generated/types/match-history-restore-request.d.ts +1 -0
- package/dist/generated/types/match-history-restore-request.js +2 -0
- package/dist/generated/types/match-save-payload.d.ts +1 -0
- package/dist/generated/types/match-save-payload.js +2 -0
- package/dist/generated/types/match-spectator-access-response.d.ts +1 -0
- package/dist/generated/types/match-spectator-access-response.js +2 -0
- package/dist/generated/types/meta-window.d.ts +1 -0
- package/dist/generated/types/meta-window.js +2 -0
- package/dist/generated/types/meta-windows-response.d.ts +1 -0
- package/dist/generated/types/meta-windows-response.js +2 -0
- package/dist/generated/types/prepare-lobby-limited-ai-decks-request.d.ts +1 -0
- package/dist/generated/types/prepare-lobby-limited-ai-decks-request.js +2 -0
- package/dist/generated/types/random-lobby-matchmaking-request.d.ts +173 -0
- package/dist/generated/types/random-lobby-matchmaking-request.js +2 -0
- package/dist/generated/types/ranked-admin-status.d.ts +1 -0
- package/dist/generated/types/ranked-admin-status.js +2 -0
- package/dist/generated/types/ranked-leaderboard-entry.d.ts +1 -0
- package/dist/generated/types/ranked-leaderboard-entry.js +2 -0
- package/dist/generated/types/ranked-leaderboard-query.d.ts +1 -0
- package/dist/generated/types/ranked-leaderboard-query.js +2 -0
- package/dist/generated/types/ranked-leaderboard-response.d.ts +1 -0
- package/dist/generated/types/ranked-leaderboard-response.js +2 -0
- package/dist/generated/types/ranked-matchmaking-request.d.ts +137 -0
- package/dist/generated/types/ranked-matchmaking-request.js +2 -0
- package/dist/generated/types/ranked-matchmaking-view.d.ts +1 -0
- package/dist/generated/types/ranked-matchmaking-view.js +2 -0
- package/dist/generated/types/ranked-profile-request.d.ts +1 -0
- package/dist/generated/types/ranked-profile-request.js +2 -0
- package/dist/generated/types/ranked-profile-response.d.ts +1 -0
- package/dist/generated/types/ranked-profile-response.js +2 -0
- package/dist/generated/types/ranked-queue.d.ts +1 -0
- package/dist/generated/types/ranked-queue.js +2 -0
- package/dist/generated/types/ready-tournament-table-request.d.ts +7 -0
- package/dist/generated/types/ready-tournament-table-request.js +2 -0
- package/dist/generated/types/rematch-match-request.d.ts +1 -0
- package/dist/generated/types/rematch-match-request.js +2 -0
- package/dist/generated/types/rematch-match-response.d.ts +1 -0
- package/dist/generated/types/rematch-match-response.js +2 -0
- package/dist/generated/types/resolve-card-ids-request.d.ts +1 -0
- package/dist/generated/types/resolve-card-ids-request.js +2 -0
- package/dist/generated/types/resolve-card-ids-response.d.ts +1 -0
- package/dist/generated/types/resolve-card-ids-response.js +2 -0
- package/dist/generated/types/restore-history-response.d.ts +1 -0
- package/dist/generated/types/restore-history-response.js +2 -0
- package/dist/generated/types/restore-match-save-request.d.ts +1 -0
- package/dist/generated/types/restore-match-save-request.js +2 -0
- package/dist/generated/types/restore-match-save-response.d.ts +1 -0
- package/dist/generated/types/restore-match-save-response.js +2 -0
- package/dist/generated/types/return-lobby-match-request.d.ts +1 -0
- package/dist/generated/types/return-lobby-match-request.js +2 -0
- package/dist/generated/types/return-tournament-match-request.d.ts +1 -0
- package/dist/generated/types/return-tournament-match-request.js +2 -0
- package/dist/generated/types/save-match-request.d.ts +1 -0
- package/dist/generated/types/save-match-request.js +2 -0
- package/dist/generated/types/server-message.d.ts +1 -0
- package/dist/generated/types/server-message.js +2 -0
- package/dist/generated/types/set-ai-paused-request.d.ts +1 -0
- package/dist/generated/types/set-ai-paused-request.js +2 -0
- package/dist/generated/types/set-ai-paused-response.d.ts +1 -0
- package/dist/generated/types/set-ai-paused-response.js +2 -0
- package/dist/generated/types/set-ranked-admission-request.d.ts +1 -0
- package/dist/generated/types/set-ranked-admission-request.js +2 -0
- package/dist/generated/types/set-simulator-maintenance-request.d.ts +1 -0
- package/dist/generated/types/set-simulator-maintenance-request.js +2 -0
- package/dist/generated/types/simulator-admin-status-response.d.ts +1 -0
- package/dist/generated/types/simulator-admin-status-response.js +2 -0
- package/dist/generated/types/simulator-availability-response.d.ts +1 -0
- package/dist/generated/types/simulator-availability-response.js +2 -0
- package/dist/generated/types/simulator-report-list-response.d.ts +1 -0
- package/dist/generated/types/simulator-report-list-response.js +2 -0
- package/dist/generated/types/simulator-report-response.d.ts +1 -0
- package/dist/generated/types/simulator-report-response.js +2 -0
- package/dist/generated/types/spectate-lobby-request.d.ts +1 -0
- package/dist/generated/types/spectate-lobby-request.js +2 -0
- package/dist/generated/types/spectate-match-request.d.ts +1 -0
- package/dist/generated/types/spectate-match-request.js +2 -0
- package/dist/generated/types/start-lobby-limited-match-request.d.ts +1 -0
- package/dist/generated/types/start-lobby-limited-match-request.js +2 -0
- package/dist/generated/types/start-lobby-request.d.ts +1 -0
- package/dist/generated/types/start-lobby-request.js +2 -0
- package/dist/generated/types/start-tournament-event-request.d.ts +1 -0
- package/dist/generated/types/start-tournament-event-request.js +2 -0
- package/dist/generated/types/stats-response.d.ts +5 -0
- package/dist/generated/types/stats-response.js +2 -0
- package/dist/generated/types/submit-lobby-limited-deck-request.d.ts +1 -0
- package/dist/generated/types/submit-lobby-limited-deck-request.js +2 -0
- package/dist/generated/types/submit-match-deck-request.d.ts +1 -0
- package/dist/generated/types/submit-match-deck-request.js +2 -0
- package/dist/generated/types/submit-match-deck-response.d.ts +1 -0
- package/dist/generated/types/submit-match-deck-response.js +2 -0
- package/dist/generated/types/submit-tournament-deck-request.d.ts +1 -0
- package/dist/generated/types/submit-tournament-deck-request.js +2 -0
- package/dist/generated/types/tournament-event-command-request.d.ts +1 -0
- package/dist/generated/types/tournament-event-command-request.js +2 -0
- package/dist/generated/types/tournament-room-access-response.d.ts +1 -0
- package/dist/generated/types/tournament-room-access-response.js +2 -0
- package/dist/generated/types/tournament-room-chat-request.d.ts +1 -0
- package/dist/generated/types/tournament-room-chat-request.js +2 -0
- package/dist/generated/types/tournament-room-chat-response.d.ts +1 -0
- package/dist/generated/types/tournament-room-chat-response.js +2 -0
- package/dist/generated/types/tournament-room-list-response.d.ts +1 -0
- package/dist/generated/types/tournament-room-list-response.js +2 -0
- package/dist/generated/types/tournament-room-response.d.ts +1 -0
- package/dist/generated/types/tournament-room-response.js +2 -0
- package/dist/generated/types/tournament-room-server-message.d.ts +1 -0
- package/dist/generated/types/tournament-room-server-message.js +2 -0
- package/dist/generated/types/tournament-room-sync-request.d.ts +1 -0
- package/dist/generated/types/tournament-room-sync-request.js +2 -0
- package/dist/generated/types/undo-match-request.d.ts +1 -0
- package/dist/generated/types/undo-match-request.js +2 -0
- package/dist/generated/types/undo-match-response.d.ts +1 -0
- package/dist/generated/types/undo-match-response.js +2 -0
- package/dist/generated/types/undo-respond-match-request.d.ts +1 -0
- package/dist/generated/types/undo-respond-match-request.js +2 -0
- package/dist/generated/types/update-lobby-ai-player-request.d.ts +1 -0
- package/dist/generated/types/update-lobby-ai-player-request.js +2 -0
- package/dist/generated/types/update-lobby-player-request.d.ts +1 -0
- package/dist/generated/types/update-lobby-player-request.js +2 -0
- package/dist/generated/types/update-lobby-settings-request.d.ts +1 -0
- package/dist/generated/types/update-lobby-settings-request.js +2 -0
- package/dist/generated/types/update-tournament-room-player-request.d.ts +1 -0
- package/dist/generated/types/update-tournament-room-player-request.js +2 -0
- package/dist/generated/types/update-tournament-room-settings-request.d.ts +1 -0
- package/dist/generated/types/update-tournament-room-settings-request.js +2 -0
- package/dist/generated/types/update-tournament-table-deck-request.d.ts +123 -0
- package/dist/generated/types/update-tournament-table-deck-request.js +2 -0
- package/dist/generated/types/welcome-payload.d.ts +1 -0
- package/dist/generated/types/welcome-payload.js +2 -0
- package/dist/generated/version.d.ts +16 -0
- package/dist/generated/version.js +16 -0
- package/dist/http/abort.d.ts +57 -0
- package/dist/http/abort.js +60 -0
- package/dist/http/json.d.ts +13 -0
- package/dist/http/json.js +24 -0
- package/dist/http/options.d.ts +40 -0
- package/dist/http/options.js +1 -0
- package/dist/http/request.d.ts +64 -0
- package/dist/http/request.js +182 -0
- package/dist/http/validated-json.d.ts +9 -0
- package/dist/http/validated-json.js +14 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +10 -0
- package/dist/internal/abort-error.d.ts +91 -0
- package/dist/internal/abort-error.js +62 -0
- package/dist/internal/authenticated-socket-session.d.ts +63 -0
- package/dist/internal/authenticated-socket-session.js +170 -0
- package/dist/internal/emitter.d.ts +18 -0
- package/dist/internal/emitter.js +34 -0
- package/dist/internal/errors.d.ts +233 -0
- package/dist/internal/errors.js +238 -0
- package/dist/internal/limits.d.ts +13 -0
- package/dist/internal/limits.js +13 -0
- package/dist/internal/reconnect-backoff.d.ts +33 -0
- package/dist/internal/reconnect-backoff.js +25 -0
- package/dist/internal/socket-frame.d.ts +43 -0
- package/dist/internal/socket-frame.js +47 -0
- package/dist/internal/transport.d.ts +78 -0
- package/dist/internal/transport.js +18 -0
- package/dist/internal/websocket-event.d.ts +15 -0
- package/dist/internal/websocket-event.js +31 -0
- package/dist/local/assets.d.ts +96 -0
- package/dist/local/assets.js +235 -0
- package/dist/local/client.d.ts +32 -0
- package/dist/local/client.js +211 -0
- package/dist/local/engine.d.ts +79 -0
- package/dist/local/engine.js +6 -0
- package/dist/local/index.d.ts +20 -0
- package/dist/local/index.js +17 -0
- package/dist/local/offline-engine.d.ts +46 -0
- package/dist/local/offline-engine.js +74 -0
- package/dist/local/protocol.d.ts +95 -0
- package/dist/local/protocol.js +10 -0
- package/dist/local/routing.d.ts +52 -0
- package/dist/local/routing.js +193 -0
- package/dist/local/server/ai-scheduler.d.ts +31 -0
- package/dist/local/server/ai-scheduler.js +93 -0
- package/dist/local/server/http-router.d.ts +35 -0
- package/dist/local/server/http-router.js +185 -0
- package/dist/local/server/index.d.ts +16 -0
- package/dist/local/server/index.js +140 -0
- package/dist/local/server/sockets.d.ts +25 -0
- package/dist/local/server/sockets.js +141 -0
- package/dist/local/wasm-engine.d.ts +61 -0
- package/dist/local/wasm-engine.js +63 -0
- package/dist/local/worker-boot.d.ts +17 -0
- package/dist/local/worker-boot.js +76 -0
- package/dist/local/worker.d.ts +6 -0
- package/dist/local/worker.js +9 -0
- package/dist/match-session/access.d.ts +6 -0
- package/dist/match-session/access.js +8 -0
- package/dist/match-session/controller.d.ts +63 -0
- package/dist/match-session/controller.js +513 -0
- package/dist/match-session/errors.d.ts +3 -0
- package/dist/match-session/errors.js +34 -0
- package/dist/match-session/methods.d.ts +433 -0
- package/dist/match-session/methods.js +1 -0
- package/dist/match-session/session-state.d.ts +235 -0
- package/dist/match-session/session-state.js +1 -0
- package/dist/match-session/types.d.ts +56 -0
- package/dist/match-session/types.js +1 -0
- package/dist/match-session.d.ts +3 -0
- package/dist/match-session.js +1 -0
- package/dist/messages.d.ts +195 -0
- package/dist/messages.js +240 -0
- package/dist/resources/admin.d.ts +63 -0
- package/dist/resources/admin.js +75 -0
- package/dist/resources/card-deck-json.d.ts +11 -0
- package/dist/resources/card-deck-json.js +164 -0
- package/dist/resources/card-resolution.d.ts +9 -0
- package/dist/resources/card-resolution.js +21 -0
- package/dist/resources/card-resource.d.ts +157 -0
- package/dist/resources/card-resource.js +28 -0
- package/dist/resources/card-types.d.ts +203 -0
- package/dist/resources/card-types.js +1 -0
- package/dist/resources/cards.d.ts +3 -0
- package/dist/resources/cards.js +1 -0
- package/dist/resources/limited-event-types.d.ts +252 -0
- package/dist/resources/limited-event-types.js +1 -0
- package/dist/resources/limited-events.d.ts +7 -0
- package/dist/resources/limited-events.js +49 -0
- package/dist/resources/lobbies.d.ts +53 -0
- package/dist/resources/lobbies.js +50 -0
- package/dist/resources/lobby-list-session.d.ts +13 -0
- package/dist/resources/lobby-list-session.js +198 -0
- package/dist/resources/lobby-session.d.ts +9 -0
- package/dist/resources/lobby-session.js +59 -0
- package/dist/resources/lobby-types.d.ts +357 -0
- package/dist/resources/lobby-types.js +1 -0
- package/dist/resources/match-history.d.ts +49 -0
- package/dist/resources/match-history.js +34 -0
- package/dist/resources/match-types.d.ts +448 -0
- package/dist/resources/match-types.js +1 -0
- package/dist/resources/matches.d.ts +16 -0
- package/dist/resources/matches.js +109 -0
- package/dist/resources/ranked.d.ts +24 -0
- package/dist/resources/ranked.js +47 -0
- package/dist/resources/session.d.ts +62 -0
- package/dist/resources/session.js +26 -0
- package/dist/resources/system.d.ts +51 -0
- package/dist/resources/system.js +9 -0
- package/dist/resources/tournament-room-session.d.ts +9 -0
- package/dist/resources/tournament-room-session.js +53 -0
- package/dist/resources/tournament-room-types.d.ts +44 -0
- package/dist/resources/tournament-room-types.js +1 -0
- package/dist/resources/tournament-rooms.d.ts +33 -0
- package/dist/resources/tournament-rooms.js +33 -0
- package/dist/session.d.ts +56 -0
- package/dist/session.js +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.js +27 -0
- package/dist/validators/ajv.d.ts +51 -0
- package/dist/validators/ajv.js +121 -0
- package/dist/validators/discriminants.d.ts +36 -0
- package/dist/validators/discriminants.js +89 -0
- package/dist/validators/validator.d.ts +73 -0
- package/dist/validators/validator.js +26 -0
- package/dist/validators/warm-up.d.ts +25 -0
- package/dist/validators/warm-up.js +59 -0
- package/dist/validators.d.ts +173 -0
- package/dist/validators.js +85 -0
- package/package.json +88 -0
- package/schema/abandon-match-request.schema.json +15 -0
- package/schema/abandon-match-response.schema.json +15 -0
- package/schema/add-lobby-ai-player-request.schema.json +53 -0
- package/schema/api-error-response.schema.json +13 -0
- package/schema/card-catalog-refresh-response.schema.json +31 -0
- package/schema/cards-response.schema.json +17 -0
- package/schema/client-message.schema.json +203 -0
- package/schema/close-tournament-room-request.schema.json +18 -0
- package/schema/common.schema.json +14129 -0
- package/schema/create-limited-event-request.schema.json +60 -0
- package/schema/create-lobby-request.schema.json +67 -0
- package/schema/create-match-request.schema.json +124 -0
- package/schema/create-meta-window-request.schema.json +27 -0
- package/schema/create-tournament-room-request.schema.json +104 -0
- package/schema/create-tournament-table-request.schema.json +14 -0
- package/schema/error-payload.schema.json +34 -0
- package/schema/format-event-request.schema.json +20 -0
- package/schema/format-event-response.schema.json +15 -0
- package/schema/game-command.schema.json +775 -0
- package/schema/game-event.schema.json +2012 -0
- package/schema/game-state.schema.json +273 -0
- package/schema/get-match-response.schema.json +13 -0
- package/schema/health-response.schema.json +13 -0
- package/schema/join-limited-event-request.schema.json +6 -0
- package/schema/join-lobby-request.schema.json +40 -0
- package/schema/join-match-request.schema.json +79 -0
- package/schema/join-tournament-room-request.schema.json +39 -0
- package/schema/join-tournament-table-request.schema.json +14 -0
- package/schema/kick-lobby-player-request.schema.json +13 -0
- package/schema/kick-lobby-spectator-request.schema.json +14 -0
- package/schema/leave-lobby-request.schema.json +13 -0
- package/schema/leave-match-request.schema.json +15 -0
- package/schema/leave-match-response.schema.json +15 -0
- package/schema/leave-tournament-room-request.schema.json +14 -0
- package/schema/limited-event-access-response.schema.json +34 -0
- package/schema/limited-event-command-request.schema.json +20 -0
- package/schema/limited-event-preflight-response.schema.json +25 -0
- package/schema/limited-event-response.schema.json +15 -0
- package/schema/list-active-ai-matches-request.schema.json +23 -0
- package/schema/list-active-ai-matches-response.schema.json +17 -0
- package/schema/lobby-access-response.schema.json +31 -0
- package/schema/lobby-chat-request.schema.json +17 -0
- package/schema/lobby-chat-response.schema.json +17 -0
- package/schema/lobby-list-response.schema.json +16 -0
- package/schema/lobby-list-server-message.schema.json +49 -0
- package/schema/lobby-matchmaking-decision-request.schema.json +13 -0
- package/schema/lobby-matchmaking-request.schema.json +80 -0
- package/schema/lobby-response.schema.json +13 -0
- package/schema/lobby-server-message.schema.json +155 -0
- package/schema/lobby-sync-request.schema.json +13 -0
- package/schema/manifest.json +124 -0
- package/schema/match-access-response.schema.json +32 -0
- package/schema/match-chat-lookup-response.schema.json +34 -0
- package/schema/match-connection-role.schema.json +9 -0
- package/schema/match-history-deck-stats-request.schema.json +26 -0
- package/schema/match-history-deck-stats-response.schema.json +17 -0
- package/schema/match-history-entry.schema.json +78 -0
- package/schema/match-history-list-request.schema.json +48 -0
- package/schema/match-history-list-response.schema.json +25 -0
- package/schema/match-history-replay-request.schema.json +17 -0
- package/schema/match-history-replay-response.schema.json +14 -0
- package/schema/match-history-restore-request.schema.json +23 -0
- package/schema/match-save-payload.schema.json +71 -0
- package/schema/match-spectator-access-response.schema.json +22 -0
- package/schema/meta-window.schema.json +37 -0
- package/schema/meta-windows-response.schema.json +24 -0
- package/schema/prepare-lobby-limited-ai-decks-request.schema.json +14 -0
- package/schema/ranked-admin-status.schema.json +43 -0
- package/schema/ranked-leaderboard-entry.schema.json +61 -0
- package/schema/ranked-leaderboard-query.schema.json +34 -0
- package/schema/ranked-leaderboard-response.schema.json +23 -0
- package/schema/ranked-matchmaking-view.schema.json +15 -0
- package/schema/ranked-profile-request.schema.json +21 -0
- package/schema/ranked-profile-response.schema.json +59 -0
- package/schema/ranked-queue.schema.json +12 -0
- package/schema/rematch-match-request.schema.json +20 -0
- package/schema/rematch-match-response.schema.json +61 -0
- package/schema/resolve-card-ids-request.schema.json +17 -0
- package/schema/resolve-card-ids-response.schema.json +16 -0
- package/schema/restore-history-response.schema.json +15 -0
- package/schema/restore-match-save-request.schema.json +20 -0
- package/schema/restore-match-save-response.schema.json +29 -0
- package/schema/return-lobby-match-request.schema.json +13 -0
- package/schema/return-tournament-match-request.schema.json +14 -0
- package/schema/route-manifest.json +1014 -0
- package/schema/save-match-request.schema.json +15 -0
- package/schema/server-message.schema.json +192 -0
- package/schema/set-ai-paused-request.schema.json +19 -0
- package/schema/set-ai-paused-response.schema.json +18 -0
- package/schema/set-ranked-admission-request.schema.json +15 -0
- package/schema/set-simulator-maintenance-request.schema.json +20 -0
- package/schema/simulator-admin-status-response.schema.json +37 -0
- package/schema/simulator-availability-response.schema.json +27 -0
- package/schema/simulator-report-list-response.schema.json +23 -0
- package/schema/simulator-report-response.schema.json +77 -0
- package/schema/spectate-lobby-request.schema.json +32 -0
- package/schema/spectate-match-request.schema.json +32 -0
- package/schema/start-lobby-limited-match-request.schema.json +13 -0
- package/schema/start-lobby-request.schema.json +13 -0
- package/schema/start-tournament-event-request.schema.json +14 -0
- package/schema/submit-lobby-limited-deck-request.schema.json +33 -0
- package/schema/submit-match-deck-request.schema.json +45 -0
- package/schema/submit-match-deck-response.schema.json +14 -0
- package/schema/submit-tournament-deck-request.schema.json +34 -0
- package/schema/tournament-event-command-request.schema.json +18 -0
- package/schema/tournament-room-access-response.schema.json +32 -0
- package/schema/tournament-room-chat-request.schema.json +18 -0
- package/schema/tournament-room-chat-response.schema.json +18 -0
- package/schema/tournament-room-list-response.schema.json +17 -0
- package/schema/tournament-room-response.schema.json +14 -0
- package/schema/tournament-room-server-message.schema.json +127 -0
- package/schema/tournament-room-sync-request.schema.json +14 -0
- package/schema/undo-match-request.schema.json +14 -0
- package/schema/undo-match-response.schema.json +14 -0
- package/schema/undo-respond-match-request.schema.json +19 -0
- package/schema/update-lobby-ai-player-request.schema.json +65 -0
- package/schema/update-lobby-player-request.schema.json +81 -0
- package/schema/update-lobby-settings-request.schema.json +70 -0
- package/schema/update-tournament-room-player-request.schema.json +45 -0
- package/schema/update-tournament-room-settings-request.schema.json +33 -0
- package/schema/welcome-payload.schema.json +38 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import type { FormatEventCommand } from '../generated/types/format-event-request.js';
|
|
2
|
+
import type { CardInteractionCueRequest } from '../generated/types/client-message.js';
|
|
3
|
+
import type { CreateMatchRequest, GameCommand, GameState, JoinMatchRequest, SpectateMatchRequest } from '../generated/index.js';
|
|
4
|
+
import type { MatchAccess, MatchReference, MatchSpectatorAccess } from '../resources/matches.js';
|
|
5
|
+
import type { MatchSessionAccess, MatchSessionConnectOptions, MatchSessionEvents, MatchSessionSnapshotPredicate, MatchSessionWaitOptions } from './session-state.js';
|
|
6
|
+
import type { MatchSession } from './types.js';
|
|
7
|
+
/** Stateful actions exposed by one SDK-owned match session. */
|
|
8
|
+
export interface MatchSessionMethods {
|
|
9
|
+
/**
|
|
10
|
+
* Opens a socket using existing or supplied private access.
|
|
11
|
+
*
|
|
12
|
+
* Call this after seeding access from `matches.create()`, `matches.join()`,
|
|
13
|
+
* `matches.spectate()`, `createMatch()`, `joinMatch()`, or `spectateMatch()`.
|
|
14
|
+
* Resolves after welcome and snapshot.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
19
|
+
*
|
|
20
|
+
* async function resumeMatch(matchSession: MatchSession) {
|
|
21
|
+
* await matchSession.connect({
|
|
22
|
+
* matchId: 'match_123',
|
|
23
|
+
* seatToken: 'seat_token_123',
|
|
24
|
+
* })
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* console.log(resumeMatch)
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#lifecycle
|
|
31
|
+
*/
|
|
32
|
+
connect(access?: MatchSessionAccess, options?: MatchSessionConnectOptions): Promise<MatchSession>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a host match, stores private access, and connects.
|
|
35
|
+
*
|
|
36
|
+
* Use this when one UI action should create a match and start live state.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
41
|
+
*
|
|
42
|
+
* const premierHostDeck = {
|
|
43
|
+
* leader: 46102,
|
|
44
|
+
* leaders: [],
|
|
45
|
+
* base: 308,
|
|
46
|
+
* cards: Array.from({ length: 50 }, () => 45),
|
|
47
|
+
* sideboard: [],
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* async function hostPremier(matchSession: MatchSession) {
|
|
51
|
+
* return matchSession.createMatch({
|
|
52
|
+
* format: 'premier',
|
|
53
|
+
* playerCount: 2,
|
|
54
|
+
* hostDeck: premierHostDeck,
|
|
55
|
+
* hostName: 'Host',
|
|
56
|
+
* hostAuthenticated: false,
|
|
57
|
+
* historyIdentities: [],
|
|
58
|
+
* aiOpponents: [],
|
|
59
|
+
* })
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* console.log(hostPremier)
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#create
|
|
66
|
+
*/
|
|
67
|
+
createMatch(request: CreateMatchRequest, options?: MatchSessionConnectOptions): Promise<MatchAccess>;
|
|
68
|
+
/**
|
|
69
|
+
* Joins a match, stores private access, and connects.
|
|
70
|
+
*
|
|
71
|
+
* Use this for guest tabs or players entering through a shared match id.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
76
|
+
*
|
|
77
|
+
* const premierGuestDeck = {
|
|
78
|
+
* leader: 46107,
|
|
79
|
+
* leaders: [],
|
|
80
|
+
* base: 309,
|
|
81
|
+
* cards: Array.from({ length: 50 }, () => 35),
|
|
82
|
+
* sideboard: [],
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* async function joinPremier(matchSession: MatchSession) {
|
|
86
|
+
* return matchSession.joinMatch('match_123', {
|
|
87
|
+
* deck: premierGuestDeck,
|
|
88
|
+
* name: 'Guest',
|
|
89
|
+
* authenticated: false,
|
|
90
|
+
* historyIdentities: [],
|
|
91
|
+
* })
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* console.log(joinPremier)
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#join
|
|
98
|
+
*/
|
|
99
|
+
joinMatch(match: string | MatchReference, request: JoinMatchRequest, options?: MatchSessionConnectOptions): Promise<MatchAccess>;
|
|
100
|
+
/**
|
|
101
|
+
* Spectates a match, stores private read-only access, and connects.
|
|
102
|
+
*
|
|
103
|
+
* Use this for viewers entering through a shared match id without taking a
|
|
104
|
+
* player seat.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
109
|
+
*
|
|
110
|
+
* async function spectatePremier(matchSession: MatchSession) {
|
|
111
|
+
* return matchSession.spectateMatch('match_123', {
|
|
112
|
+
* name: 'Spectator',
|
|
113
|
+
* authenticated: false,
|
|
114
|
+
* })
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
* console.log(spectatePremier)
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#spectate
|
|
121
|
+
*/
|
|
122
|
+
spectateMatch(match: string | MatchReference, request: SpectateMatchRequest, options?: MatchSessionConnectOptions): Promise<MatchSpectatorAccess>;
|
|
123
|
+
/**
|
|
124
|
+
* Closes the active socket.
|
|
125
|
+
*
|
|
126
|
+
* Listeners stay registered, and stored access remains available for
|
|
127
|
+
* `reconnect()`.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
132
|
+
*
|
|
133
|
+
* function leaveView(matchSession: MatchSession) {
|
|
134
|
+
* matchSession.close()
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* console.log(leaveView)
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#close
|
|
141
|
+
*/
|
|
142
|
+
close(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Reopens the socket using the stored private access.
|
|
145
|
+
*
|
|
146
|
+
* Closes the old socket, opens a new one, waits for handshake, then syncs.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
151
|
+
*
|
|
152
|
+
* async function restoreSocket(matchSession: MatchSession) {
|
|
153
|
+
* await matchSession.reconnect({ handshakeTimeoutMs: 10_000 })
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* console.log(restoreSocket)
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @see https://simulator-sdk.my-swu.com/guide/reconnect
|
|
160
|
+
*/
|
|
161
|
+
reconnect(options?: MatchSessionConnectOptions): Promise<MatchSession>;
|
|
162
|
+
/**
|
|
163
|
+
* Sends one ready message for the current seat.
|
|
164
|
+
*
|
|
165
|
+
* Use this in lobby and setup phases when a seat must acknowledge readiness.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
170
|
+
*
|
|
171
|
+
* function markSeatReady(matchSession: MatchSession) {
|
|
172
|
+
* matchSession.ready()
|
|
173
|
+
* }
|
|
174
|
+
*
|
|
175
|
+
* console.log(markSeatReady)
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay#ready-and-setup
|
|
179
|
+
*/
|
|
180
|
+
ready(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Requests rollback of the latest accepted player action.
|
|
183
|
+
*
|
|
184
|
+
* Any valid seat token may send undo. When the undo needs no approval, the
|
|
185
|
+
* server restores the previous snapshot and emits one or more `undoApplied`
|
|
186
|
+
* events. In matches with other human seats, a sensitive undo (hidden
|
|
187
|
+
* information was revealed, or another player acted since) is recorded on
|
|
188
|
+
* `GameState.pendingUndo` with an `undoRequested` event instead, and only
|
|
189
|
+
* applies once every other human seat approves via {@link respondUndo}. In
|
|
190
|
+
* AI matches, one human undo also consumes any AI responses that happened
|
|
191
|
+
* after that human action, pauses the AI, then automatically resumes it
|
|
192
|
+
* after the next successful human mutation.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
197
|
+
*
|
|
198
|
+
* function undoLastAction(matchSession: MatchSession) {
|
|
199
|
+
* matchSession.undo()
|
|
200
|
+
* }
|
|
201
|
+
*
|
|
202
|
+
* console.log(undoLastAction)
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
206
|
+
*/
|
|
207
|
+
undo(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Answers the pending undo approval request.
|
|
210
|
+
*
|
|
211
|
+
* Approving as the last outstanding seat applies the undo; declining
|
|
212
|
+
* cancels it (`undoDeclined`). A response sent by the original requester
|
|
213
|
+
* withdraws the request regardless of `approve` (`undoCancelled`).
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
218
|
+
*
|
|
219
|
+
* function approvePendingUndo(matchSession: MatchSession) {
|
|
220
|
+
* matchSession.respondUndo(true)
|
|
221
|
+
* }
|
|
222
|
+
*
|
|
223
|
+
* console.log(approvePendingUndo)
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
227
|
+
*/
|
|
228
|
+
respondUndo(approve: boolean): void;
|
|
229
|
+
/**
|
|
230
|
+
* Pauses or resumes an attached AI opponent.
|
|
231
|
+
*
|
|
232
|
+
* This is session-level manual control only; it does not mutate gameplay
|
|
233
|
+
* state. Undo-created AI pauses resume automatically after the next
|
|
234
|
+
* successful human mutation.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
239
|
+
*
|
|
240
|
+
* function resumeAi(matchSession: MatchSession) {
|
|
241
|
+
* matchSession.setAiPaused(false)
|
|
242
|
+
* }
|
|
243
|
+
*
|
|
244
|
+
* console.log(resumeAi)
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
248
|
+
*/
|
|
249
|
+
setAiPaused(paused: boolean): void;
|
|
250
|
+
/**
|
|
251
|
+
* Sends one request for the latest server snapshot.
|
|
252
|
+
*
|
|
253
|
+
* Use after reconnects, tab restores, or missed UI updates.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```ts
|
|
257
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
258
|
+
*
|
|
259
|
+
* function requestFreshState(matchSession: MatchSession) {
|
|
260
|
+
* matchSession.sync()
|
|
261
|
+
* }
|
|
262
|
+
*
|
|
263
|
+
* console.log(requestFreshState)
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @see https://simulator-sdk.my-swu.com/guide/websocket#sync-request
|
|
267
|
+
*/
|
|
268
|
+
sync(): void;
|
|
269
|
+
/**
|
|
270
|
+
* Sends one ping frame with an optional nonce echoed by `pong`.
|
|
271
|
+
*
|
|
272
|
+
* Use the nonce to match a pong to one latency measurement.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
277
|
+
*
|
|
278
|
+
* function measureLatency(matchSession: MatchSession) {
|
|
279
|
+
* matchSession.ping('latency-check-1')
|
|
280
|
+
* }
|
|
281
|
+
*
|
|
282
|
+
* console.log(measureLatency)
|
|
283
|
+
* ```
|
|
284
|
+
*
|
|
285
|
+
* @see https://simulator-sdk.my-swu.com/guide/websocket#ping
|
|
286
|
+
*/
|
|
287
|
+
ping(nonce?: string | null): void;
|
|
288
|
+
/**
|
|
289
|
+
* Sends one typed gameplay command for the current prompt.
|
|
290
|
+
*
|
|
291
|
+
* Invalid command shapes fail SDK validation before a socket frame is sent.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
296
|
+
*
|
|
297
|
+
* function passAction(matchSession: MatchSession) {
|
|
298
|
+
* matchSession.sendCommand('pass')
|
|
299
|
+
* }
|
|
300
|
+
*
|
|
301
|
+
* console.log(passAction)
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
305
|
+
*/
|
|
306
|
+
sendCommand(command: GameCommand): void;
|
|
307
|
+
/**
|
|
308
|
+
* Sends one typed out-of-game format command for series flows.
|
|
309
|
+
*
|
|
310
|
+
* Use for match-series actions such as readying for the next game.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
315
|
+
*
|
|
316
|
+
* function readyForSeriesGame(matchSession: MatchSession) {
|
|
317
|
+
* matchSession.sendFormatEvent({ type: 'readyNextGame' })
|
|
318
|
+
* }
|
|
319
|
+
*
|
|
320
|
+
* console.log(readyForSeriesGame)
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay#out-of-game-commands
|
|
324
|
+
*/
|
|
325
|
+
sendFormatEvent(command: FormatEventCommand): void;
|
|
326
|
+
/**
|
|
327
|
+
* Sends one host-authorized AI Trilogy format command.
|
|
328
|
+
*
|
|
329
|
+
* Use this only for manual Player vs AI Trilogy ban/pick flows. The server
|
|
330
|
+
* applies accepted commands to the AI seat after validating the sender.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
335
|
+
*
|
|
336
|
+
* function chooseAiBan(matchSession: MatchSession) {
|
|
337
|
+
* matchSession.sendAiFormatEvent({ type: 'banTrilogyDeck', deckIndex: 1 })
|
|
338
|
+
* }
|
|
339
|
+
*
|
|
340
|
+
* console.log(chooseAiBan)
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay#out-of-game-commands
|
|
344
|
+
*/
|
|
345
|
+
sendAiFormatEvent(command: FormatEventCommand): void;
|
|
346
|
+
/**
|
|
347
|
+
* Sends one in-match chat message.
|
|
348
|
+
*
|
|
349
|
+
* The server trims and caps the message, then broadcasts it as a match
|
|
350
|
+
* history entry to connected seats.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
355
|
+
*
|
|
356
|
+
* function chat(matchSession: MatchSession) {
|
|
357
|
+
* matchSession.sendChat('ready?')
|
|
358
|
+
* }
|
|
359
|
+
*
|
|
360
|
+
* console.log(chat)
|
|
361
|
+
* ```
|
|
362
|
+
*
|
|
363
|
+
* @see https://simulator-sdk.my-swu.com/guide/websocket
|
|
364
|
+
*/
|
|
365
|
+
sendChat(message: string): void;
|
|
366
|
+
/**
|
|
367
|
+
* Sends one transient hand-card interaction cue.
|
|
368
|
+
*
|
|
369
|
+
* Use this for live hover/drag presentation. The server broadcasts it to
|
|
370
|
+
* connected viewers without changing authoritative gameplay state.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```ts
|
|
374
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
375
|
+
*
|
|
376
|
+
* function showRemoteHover(matchSession: MatchSession) {
|
|
377
|
+
* matchSession.sendInteractionCue({
|
|
378
|
+
* kind: 'handCard',
|
|
379
|
+
* index: 0,
|
|
380
|
+
* state: 'hover',
|
|
381
|
+
* })
|
|
382
|
+
* }
|
|
383
|
+
*
|
|
384
|
+
* console.log(showRemoteHover)
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @see https://simulator-sdk.my-swu.com/guide/websocket
|
|
388
|
+
*/
|
|
389
|
+
sendInteractionCue(cue: CardInteractionCueRequest): void;
|
|
390
|
+
/**
|
|
391
|
+
* Registers one typed event listener and returns an unsubscribe function.
|
|
392
|
+
*
|
|
393
|
+
* Event listeners stay registered across reconnects. Unsubscribe on unmount.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
398
|
+
*
|
|
399
|
+
* function watchState(matchSession: MatchSession) {
|
|
400
|
+
* return matchSession.on('snapshot', actionSnapshot => {
|
|
401
|
+
* console.log(actionSnapshot.phase)
|
|
402
|
+
* })
|
|
403
|
+
* }
|
|
404
|
+
*
|
|
405
|
+
* console.log(watchState)
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#events
|
|
409
|
+
*/
|
|
410
|
+
on<TKey extends keyof MatchSessionEvents>(event: TKey, listener: (value: MatchSessionEvents[TKey]) => void): () => void;
|
|
411
|
+
/**
|
|
412
|
+
* Resolves with the current or next matching snapshot.
|
|
413
|
+
*
|
|
414
|
+
* Checks current state first, then waits for future snapshots until timeout.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* import type { MatchSession } from '@my-swu/simulator-client'
|
|
419
|
+
*
|
|
420
|
+
* async function waitForAction(matchSession: MatchSession) {
|
|
421
|
+
* return matchSession.waitForSnapshot(
|
|
422
|
+
* matchSnapshot => matchSnapshot.phase === 'action',
|
|
423
|
+
* { timeoutMs: 5_000 },
|
|
424
|
+
* )
|
|
425
|
+
* }
|
|
426
|
+
*
|
|
427
|
+
* console.log(waitForAction)
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#waiting
|
|
431
|
+
*/
|
|
432
|
+
waitForSnapshot(predicate?: MatchSessionSnapshotPredicate, options?: MatchSessionWaitOptions): Promise<GameState>;
|
|
433
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { AiStatusPayload, ErrorPayload, GameEvent, GameState, ServerMessage, WelcomePayload } from '../generated/index.js';
|
|
2
|
+
import type { Seat } from '../generated/types/create-match-request.js';
|
|
3
|
+
import type { CardInteractionCue, MatchHistoryFeedEntry, MatchHistorySnapshot } from '../generated/types/server-message.js';
|
|
4
|
+
import type { MatchAccess, MatchConnectionAccessInput, MatchSpectatorAccess } from '../resources/matches.js';
|
|
5
|
+
import type { ConnectionState, PongPayload } from '../session.js';
|
|
6
|
+
/**
|
|
7
|
+
* Seat identifier exposed by live match session state.
|
|
8
|
+
*
|
|
9
|
+
* Values identify the player seat controlled by this session, not an auth
|
|
10
|
+
* credential.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { MatchSeat } from '@my-swu/simulator-client'
|
|
15
|
+
*
|
|
16
|
+
* const activeSeat: MatchSeat = 'one'
|
|
17
|
+
* console.log(activeSeat)
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session
|
|
21
|
+
*/
|
|
22
|
+
export type MatchSeat = Seat;
|
|
23
|
+
/**
|
|
24
|
+
* Access shape accepted by a match session.
|
|
25
|
+
*
|
|
26
|
+
* Full `MatchAccess` responses can seed snapshot and seat state immediately.
|
|
27
|
+
* Minimal `MatchAccessInput` values are enough to connect or reconnect.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { MatchSessionAccess } from '@my-swu/simulator-client'
|
|
32
|
+
*
|
|
33
|
+
* const reconnectAccess: MatchSessionAccess = {
|
|
34
|
+
* matchId: 'match_123',
|
|
35
|
+
* seatToken: 'seat_token_123',
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* console.log(reconnectAccess.matchId)
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see https://simulator-sdk.my-swu.com/guide/reconnect
|
|
42
|
+
*/
|
|
43
|
+
export type MatchSessionAccess = MatchAccess | MatchSpectatorAccess | MatchConnectionAccessInput;
|
|
44
|
+
/**
|
|
45
|
+
* Predicate used by `waitForSnapshot`.
|
|
46
|
+
*
|
|
47
|
+
* Return `true` when the current or next snapshot is acceptable for the caller.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import type { MatchSessionSnapshotPredicate } from '@my-swu/simulator-client'
|
|
52
|
+
*
|
|
53
|
+
* const waitsForAction: MatchSessionSnapshotPredicate =
|
|
54
|
+
* matchSnapshot => matchSnapshot.phase === 'action'
|
|
55
|
+
*
|
|
56
|
+
* console.log(waitsForAction)
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#waiting
|
|
60
|
+
*/
|
|
61
|
+
export type MatchSessionSnapshotPredicate = (snapshot: GameState) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Options for waiting on session snapshots.
|
|
64
|
+
*
|
|
65
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#waiting
|
|
66
|
+
*/
|
|
67
|
+
export interface MatchSessionWaitOptions {
|
|
68
|
+
/** Milliseconds to wait before rejecting. */
|
|
69
|
+
timeoutMs?: number | undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Options for opening or reopening one match session socket.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import type { MatchSessionConnectOptions } from '@my-swu/simulator-client'
|
|
77
|
+
*
|
|
78
|
+
* const connectOptions: MatchSessionConnectOptions = {
|
|
79
|
+
* handshakeTimeoutMs: 10_000,
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* console.log(connectOptions.handshakeTimeoutMs)
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @see https://simulator-sdk.my-swu.com/guide/reconnect
|
|
86
|
+
*/
|
|
87
|
+
export interface MatchSessionConnectOptions {
|
|
88
|
+
/** Milliseconds to wait for welcome plus first snapshot. */
|
|
89
|
+
handshakeTimeoutMs?: number | undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Automatic reconnect policy for abnormal match socket closes.
|
|
93
|
+
*/
|
|
94
|
+
export interface MatchSessionAutoReconnectPolicy {
|
|
95
|
+
/** Maximum reconnect attempts before emitting an SDK error. */
|
|
96
|
+
maxRetries?: number | undefined;
|
|
97
|
+
/** Delay before the first retry in milliseconds. */
|
|
98
|
+
initialDelayMs?: number | undefined;
|
|
99
|
+
/** Maximum backoff delay in milliseconds. */
|
|
100
|
+
maxDelayMs?: number | undefined;
|
|
101
|
+
/** Multiplier applied to each subsequent delay. */
|
|
102
|
+
backoffFactor?: number | undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Automatic reconnect setting for one match session.
|
|
106
|
+
*/
|
|
107
|
+
export type MatchSessionAutoReconnectOptions = boolean | MatchSessionAutoReconnectPolicy;
|
|
108
|
+
/** Progress of automatic recovery after an abnormal match socket close. */
|
|
109
|
+
export type MatchSessionReconnectState = {
|
|
110
|
+
phase: 'idle';
|
|
111
|
+
} | {
|
|
112
|
+
phase: 'waiting';
|
|
113
|
+
attempt: number;
|
|
114
|
+
maxAttempts: number;
|
|
115
|
+
delayMs: number;
|
|
116
|
+
} | {
|
|
117
|
+
phase: 'connecting';
|
|
118
|
+
attempt: number;
|
|
119
|
+
maxAttempts: number;
|
|
120
|
+
} | {
|
|
121
|
+
phase: 'exhausted';
|
|
122
|
+
attempts: number;
|
|
123
|
+
maxAttempts: number;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Options for creating one SDK-owned match session.
|
|
127
|
+
*
|
|
128
|
+
* These options configure session-owned state, event retention, and default
|
|
129
|
+
* socket handshake behavior.
|
|
130
|
+
*
|
|
131
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session
|
|
132
|
+
*/
|
|
133
|
+
export interface MatchSessionOptions extends MatchSessionConnectOptions {
|
|
134
|
+
/** Opt-in automatic reconnect policy for abnormal socket closes. */
|
|
135
|
+
autoReconnect?: MatchSessionAutoReconnectOptions | undefined;
|
|
136
|
+
/** Maximum number of recent game events retained by the session. */
|
|
137
|
+
maxEventHistory?: number | undefined;
|
|
138
|
+
/** Maximum number of recent errors retained by the session. */
|
|
139
|
+
maxErrorHistory?: number | undefined;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Public, token-free state snapshot for one match session.
|
|
143
|
+
*
|
|
144
|
+
* This state can be stored in UI state managers because it intentionally omits
|
|
145
|
+
* the private `seatToken`.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* import type { MatchSessionState } from '@my-swu/simulator-client'
|
|
150
|
+
*
|
|
151
|
+
* const idleState: MatchSessionState = {
|
|
152
|
+
* connectionState: 'idle',
|
|
153
|
+
* errors: [],
|
|
154
|
+
* events: [],
|
|
155
|
+
* history: [],
|
|
156
|
+
* errorMessages: [],
|
|
157
|
+
* }
|
|
158
|
+
*
|
|
159
|
+
* console.log(idleState.connectionState)
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session
|
|
163
|
+
*/
|
|
164
|
+
export interface MatchSessionState {
|
|
165
|
+
/** Latest AI attachment/pause status announced by the server. */
|
|
166
|
+
aiStatus?: AiStatusPayload | undefined;
|
|
167
|
+
/** Current transport state. */
|
|
168
|
+
connectionState: ConnectionState;
|
|
169
|
+
/** Recent engine or SDK errors. */
|
|
170
|
+
errors: readonly ErrorPayload[];
|
|
171
|
+
/** Recent game events, trimmed to the configured history limit. */
|
|
172
|
+
events: readonly GameEvent[];
|
|
173
|
+
/** Recent match history entries supplied by the server. */
|
|
174
|
+
history: readonly MatchHistoryFeedEntry[];
|
|
175
|
+
/** Human-readable error summaries. */
|
|
176
|
+
errorMessages: readonly string[];
|
|
177
|
+
/** Public match id when one is known. */
|
|
178
|
+
matchId?: string | undefined;
|
|
179
|
+
/** Automatic reconnect progress, when recovering from an abnormal close. */
|
|
180
|
+
reconnectState?: MatchSessionReconnectState | undefined;
|
|
181
|
+
/** Latest authoritative private snapshot for this seat. */
|
|
182
|
+
snapshot?: GameState | undefined;
|
|
183
|
+
/** Seat controlled by this session when known. */
|
|
184
|
+
seat?: MatchSeat | undefined;
|
|
185
|
+
/** Latest welcome payload when the socket handshake has completed. */
|
|
186
|
+
welcome?: WelcomePayload | undefined;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Typed event map emitted by `MatchSession`.
|
|
190
|
+
*
|
|
191
|
+
* Register listeners through `matchSession.on()`. Each listener returns an
|
|
192
|
+
* unsubscribe function.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import type { GameState, MatchSessionEvents } from '@my-swu/simulator-client'
|
|
197
|
+
*
|
|
198
|
+
* const renderSnapshot = (matchSnapshot: GameState) => {
|
|
199
|
+
* console.log(matchSnapshot.phase)
|
|
200
|
+
* }
|
|
201
|
+
* const snapshotEventName: keyof MatchSessionEvents = 'snapshot'
|
|
202
|
+
*
|
|
203
|
+
* console.log(snapshotEventName, renderSnapshot)
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session#events
|
|
207
|
+
*/
|
|
208
|
+
export interface MatchSessionEvents {
|
|
209
|
+
/** Emitted when the server reports AI attachment or pause status. */
|
|
210
|
+
aiStatus: AiStatusPayload;
|
|
211
|
+
/** Emitted after any public session state changes. */
|
|
212
|
+
change: MatchSessionState;
|
|
213
|
+
/** Emitted when the transport state changes. */
|
|
214
|
+
connectionState: ConnectionState;
|
|
215
|
+
/** Emitted when an engine or SDK error is recorded. */
|
|
216
|
+
error: ErrorPayload;
|
|
217
|
+
/** Emitted for each live game event. */
|
|
218
|
+
event: GameEvent;
|
|
219
|
+
/** Emitted for each transient hand-card interaction cue. */
|
|
220
|
+
interactionCue: CardInteractionCue;
|
|
221
|
+
/** Emitted when the server sends a full recent match-history snapshot. */
|
|
222
|
+
historySnapshot: MatchHistorySnapshot;
|
|
223
|
+
/** Emitted when the server sends one new match-history entry. */
|
|
224
|
+
historyEntry: MatchHistoryFeedEntry;
|
|
225
|
+
/** Emitted for every decoded server message. */
|
|
226
|
+
message: ServerMessage;
|
|
227
|
+
/** Emitted for each socket pong. */
|
|
228
|
+
pong: PongPayload;
|
|
229
|
+
/** Emitted when automatic reconnect progress changes. */
|
|
230
|
+
reconnectState: MatchSessionReconnectState;
|
|
231
|
+
/** Emitted when a new authoritative snapshot arrives. */
|
|
232
|
+
snapshot: GameState;
|
|
233
|
+
/** Emitted when the socket welcome payload arrives. */
|
|
234
|
+
welcome: WelcomePayload;
|
|
235
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|