@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,448 @@
|
|
|
1
|
+
import type { AiStatusPayload, CreateMatchRequest, GameState, JoinMatchRequest, ListActiveAiMatchesRequest, ListActiveAiMatchesResponse, MatchAccessResponse, MatchSpectatorAccessResponse, MatchSavePayload, RematchMatchResponse, RestoreMatchSaveResponse, SpectateMatchRequest, SubmitMatchDeckRequest } from '../generated/index.js';
|
|
2
|
+
import type { FormatEventCommand } from '../generated/types/format-event-request.js';
|
|
3
|
+
import type { SimulatorRequestOptions } from '../http/options.js';
|
|
4
|
+
/**
|
|
5
|
+
* Access token and private snapshot returned after creating or joining a match.
|
|
6
|
+
*
|
|
7
|
+
* Keep `seatToken` private. It authorizes one player seat for socket and format
|
|
8
|
+
* event calls.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createSimulatorClient, type MatchAccess } from '@my-swu/simulator-client'
|
|
13
|
+
*
|
|
14
|
+
* const simulatorClient = createSimulatorClient({
|
|
15
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
16
|
+
* })
|
|
17
|
+
* const premierHostDeck = {
|
|
18
|
+
* leader: 46102,
|
|
19
|
+
* leaders: [],
|
|
20
|
+
* base: 308,
|
|
21
|
+
* cards: Array.from({ length: 50 }, () => 45),
|
|
22
|
+
* sideboard: [],
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* const hostAccess: MatchAccess = await simulatorClient.matches.create({
|
|
26
|
+
* format: 'premier',
|
|
27
|
+
* playerCount: 2,
|
|
28
|
+
* hostDeck: premierHostDeck,
|
|
29
|
+
* hostName: 'Host',
|
|
30
|
+
* hostAuthenticated: false,
|
|
31
|
+
* historyIdentities: [],
|
|
32
|
+
* aiOpponents: [],
|
|
33
|
+
* })
|
|
34
|
+
* console.log(hostAccess.matchId)
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle
|
|
38
|
+
*/
|
|
39
|
+
export type MatchAccess = MatchAccessResponse;
|
|
40
|
+
export type MatchSpectatorAccess = MatchSpectatorAccessResponse;
|
|
41
|
+
/**
|
|
42
|
+
* Public reference to one match.
|
|
43
|
+
*
|
|
44
|
+
* Use this shape for routes, lobby sharing, or join flows where no private seat
|
|
45
|
+
* credential should be exposed.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import type { MatchReference } from '@my-swu/simulator-client'
|
|
50
|
+
*
|
|
51
|
+
* const matchReference: MatchReference = { matchId: 'match_123' }
|
|
52
|
+
* console.log(matchReference.matchId)
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle
|
|
56
|
+
*/
|
|
57
|
+
export interface MatchReference {
|
|
58
|
+
/**
|
|
59
|
+
* Public match id.
|
|
60
|
+
*/
|
|
61
|
+
matchId: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Minimal data needed to open one match socket.
|
|
65
|
+
*
|
|
66
|
+
* This is the small persisted shape needed for reconnecting one private seat.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import type { MatchAccessInput } from '@my-swu/simulator-client'
|
|
71
|
+
*
|
|
72
|
+
* const reconnectAccess: MatchAccessInput = {
|
|
73
|
+
* matchId: 'match_123',
|
|
74
|
+
* seatToken: 'seat_token_123',
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
* console.log(reconnectAccess.matchId)
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @see https://simulator-sdk.my-swu.com/guide/reconnect
|
|
81
|
+
*/
|
|
82
|
+
export interface MatchAccessInput extends MatchReference {
|
|
83
|
+
/**
|
|
84
|
+
* Private token authorizing one seat.
|
|
85
|
+
*/
|
|
86
|
+
seatToken: string;
|
|
87
|
+
/**
|
|
88
|
+
* Resolved seed for a private solo-vs-AI match, retained across reconnects.
|
|
89
|
+
*/
|
|
90
|
+
replaySeed?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface MatchSpectatorAccessInput extends MatchReference {
|
|
93
|
+
/**
|
|
94
|
+
* Private token authorizing read-only spectator access.
|
|
95
|
+
*/
|
|
96
|
+
spectatorToken: string;
|
|
97
|
+
}
|
|
98
|
+
export type MatchConnectionAccessInput = MatchAccessInput | MatchSpectatorAccessInput;
|
|
99
|
+
/**
|
|
100
|
+
* Match resource API methods.
|
|
101
|
+
*
|
|
102
|
+
* Use this resource for HTTP-only match lifecycle calls. For a stateful socket
|
|
103
|
+
* wrapper, create a `MatchSession` through `client.session`.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
108
|
+
*
|
|
109
|
+
* const simulatorClient = createSimulatorClient({
|
|
110
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
111
|
+
* })
|
|
112
|
+
*
|
|
113
|
+
* const premierHostDeck = {
|
|
114
|
+
* leader: 46102,
|
|
115
|
+
* leaders: [],
|
|
116
|
+
* base: 308,
|
|
117
|
+
* cards: Array.from({ length: 50 }, () => 45),
|
|
118
|
+
* sideboard: [],
|
|
119
|
+
* }
|
|
120
|
+
* const hostAccess = await simulatorClient.matches.create({
|
|
121
|
+
* format: 'premier',
|
|
122
|
+
* playerCount: 2,
|
|
123
|
+
* hostDeck: premierHostDeck,
|
|
124
|
+
* hostName: 'Host',
|
|
125
|
+
* hostAuthenticated: false,
|
|
126
|
+
* historyIdentities: [],
|
|
127
|
+
* aiOpponents: [],
|
|
128
|
+
* })
|
|
129
|
+
*
|
|
130
|
+
* console.log(hostAccess.matchId)
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle
|
|
134
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-session
|
|
135
|
+
*/
|
|
136
|
+
export interface MatchesResource {
|
|
137
|
+
/** Records an intentional player departure without conceding the match. */
|
|
138
|
+
leave(access: MatchAccessInput, options?: SimulatorRequestOptions): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Permanently abandons a host-owned solo AI match.
|
|
141
|
+
*
|
|
142
|
+
* Started matches record a host concession before the server removes the
|
|
143
|
+
* runtime. Ordinary socket disconnects remain resumable and do not call this
|
|
144
|
+
* endpoint.
|
|
145
|
+
*/
|
|
146
|
+
abandon(access: MatchAccessInput, options?: SimulatorRequestOptions): Promise<void>;
|
|
147
|
+
/** Lists caller-owned resumable AI matches retaining a blocked quota slot. */
|
|
148
|
+
listActiveAi(request: ListActiveAiMatchesRequest, options?: SimulatorRequestOptions): Promise<ListActiveAiMatchesResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Applies one out-of-game format command such as sideboarding or Trilogy selection.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
155
|
+
*
|
|
156
|
+
* const simulatorClient = createSimulatorClient({
|
|
157
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
158
|
+
* })
|
|
159
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
160
|
+
*
|
|
161
|
+
* const nextGameSnapshot = await simulatorClient.matches.applyFormatEvent(
|
|
162
|
+
* hostAccess,
|
|
163
|
+
* { type: 'readyNextGame', ready: true },
|
|
164
|
+
* )
|
|
165
|
+
*
|
|
166
|
+
* console.log(nextGameSnapshot.phase)
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay#out-of-game-commands
|
|
170
|
+
*/
|
|
171
|
+
applyFormatEvent(access: MatchAccessInput, command: FormatEventCommand, options?: SimulatorRequestOptions): Promise<GameState>;
|
|
172
|
+
/**
|
|
173
|
+
* Creates one match and returns host access.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
178
|
+
*
|
|
179
|
+
* const simulatorClient = createSimulatorClient({
|
|
180
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
181
|
+
* })
|
|
182
|
+
* const premierHostDeck = {
|
|
183
|
+
* leader: 46102,
|
|
184
|
+
* leaders: [],
|
|
185
|
+
* base: 308,
|
|
186
|
+
* cards: Array.from({ length: 50 }, () => 45),
|
|
187
|
+
* sideboard: [],
|
|
188
|
+
* }
|
|
189
|
+
*
|
|
190
|
+
* const hostAccess = await simulatorClient.matches.create({
|
|
191
|
+
* format: 'premier',
|
|
192
|
+
* playerCount: 2,
|
|
193
|
+
* hostDeck: premierHostDeck,
|
|
194
|
+
* hostName: 'Host',
|
|
195
|
+
* hostAuthenticated: false,
|
|
196
|
+
* historyIdentities: [],
|
|
197
|
+
* aiOpponents: [],
|
|
198
|
+
* })
|
|
199
|
+
*
|
|
200
|
+
* console.log(hostAccess.seat)
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#create
|
|
204
|
+
*/
|
|
205
|
+
create(request: CreateMatchRequest, options?: SimulatorRequestOptions): Promise<MatchAccess>;
|
|
206
|
+
/**
|
|
207
|
+
* Fetches the public match projection.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
212
|
+
*
|
|
213
|
+
* const simulatorClient = createSimulatorClient({
|
|
214
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
215
|
+
* })
|
|
216
|
+
*
|
|
217
|
+
* const publicMatchSnapshot = await simulatorClient.matches.get('match_123')
|
|
218
|
+
* console.log(publicMatchSnapshot.phase)
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* @see https://simulator-sdk.my-swu.com/guide/http-client
|
|
222
|
+
*/
|
|
223
|
+
get(match: string | MatchReference, options?: SimulatorRequestOptions): Promise<GameState>;
|
|
224
|
+
/**
|
|
225
|
+
* Joins an existing match as the next open seat.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
230
|
+
*
|
|
231
|
+
* const simulatorClient = createSimulatorClient({
|
|
232
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
233
|
+
* })
|
|
234
|
+
* const premierGuestDeck = {
|
|
235
|
+
* leader: 46107,
|
|
236
|
+
* leaders: [],
|
|
237
|
+
* base: 309,
|
|
238
|
+
* cards: Array.from({ length: 50 }, () => 35),
|
|
239
|
+
* sideboard: [],
|
|
240
|
+
* }
|
|
241
|
+
*
|
|
242
|
+
* const guestAccess = await simulatorClient.matches.join(
|
|
243
|
+
* { matchId: 'match_123' },
|
|
244
|
+
* {
|
|
245
|
+
* deck: premierGuestDeck,
|
|
246
|
+
* name: 'Guest',
|
|
247
|
+
* authenticated: false,
|
|
248
|
+
* historyIdentities: [],
|
|
249
|
+
* },
|
|
250
|
+
* )
|
|
251
|
+
*
|
|
252
|
+
* console.log(guestAccess.seat)
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#join
|
|
256
|
+
*/
|
|
257
|
+
join(match: MatchReference, request: JoinMatchRequest, options?: SimulatorRequestOptions): Promise<MatchAccess>;
|
|
258
|
+
/**
|
|
259
|
+
* Joins an existing match as a read-only spectator.
|
|
260
|
+
*/
|
|
261
|
+
spectate(match: MatchReference, request: SpectateMatchRequest, options?: SimulatorRequestOptions): Promise<MatchSpectatorAccess>;
|
|
262
|
+
/**
|
|
263
|
+
* Submits (or replaces) the deck of a joined seat while the match is
|
|
264
|
+
* still gathering players.
|
|
265
|
+
*
|
|
266
|
+
* Pairs with a deck-less `join` (omit `deck` in the join request) — the
|
|
267
|
+
* seat reserves its slot first and registers the deck here. The seat
|
|
268
|
+
* cannot mark itself ready until a deck has been submitted, and the
|
|
269
|
+
* deck locks in once the seat is ready.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
274
|
+
*
|
|
275
|
+
* const simulatorClient = createSimulatorClient({
|
|
276
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
277
|
+
* })
|
|
278
|
+
*
|
|
279
|
+
* const guestAccess = await simulatorClient.matches.join({ matchId: 'match_123' }, {
|
|
280
|
+
* name: 'Guest',
|
|
281
|
+
* authenticated: false,
|
|
282
|
+
* historyIdentities: [],
|
|
283
|
+
* })
|
|
284
|
+
* const premierGuestDeck = {
|
|
285
|
+
* leader: 46107,
|
|
286
|
+
* leaders: [],
|
|
287
|
+
* base: 309,
|
|
288
|
+
* cards: Array.from({ length: 50 }, () => 35),
|
|
289
|
+
* sideboard: [],
|
|
290
|
+
* }
|
|
291
|
+
*
|
|
292
|
+
* const guestMatchSnapshot = await simulatorClient.matches.submitDeck(guestAccess, {
|
|
293
|
+
* deck: premierGuestDeck,
|
|
294
|
+
* })
|
|
295
|
+
* console.log(guestMatchSnapshot.players[1]?.deckSubmitted)
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#join
|
|
299
|
+
*/
|
|
300
|
+
submitDeck(access: MatchAccessInput, request: Omit<SubmitMatchDeckRequest, 'seatToken'>, options?: SimulatorRequestOptions): Promise<GameState>;
|
|
301
|
+
/**
|
|
302
|
+
* Rolls back the latest accepted player action for one match.
|
|
303
|
+
*
|
|
304
|
+
* The returned snapshot is the authoritative private view for the supplied
|
|
305
|
+
* seat after rollback.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
310
|
+
*
|
|
311
|
+
* const simulatorClient = createSimulatorClient({
|
|
312
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
313
|
+
* })
|
|
314
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
315
|
+
*
|
|
316
|
+
* const restoredMatchSnapshot = await simulatorClient.matches.undo(hostAccess)
|
|
317
|
+
* console.log(restoredMatchSnapshot.phase)
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
321
|
+
*/
|
|
322
|
+
undo(access: MatchAccessInput, options?: SimulatorRequestOptions): Promise<GameState>;
|
|
323
|
+
/**
|
|
324
|
+
* Answers the pending undo approval request for one match.
|
|
325
|
+
*
|
|
326
|
+
* Approving as the last outstanding seat applies the undo; declining
|
|
327
|
+
* cancels it. A response sent by the original requester withdraws the
|
|
328
|
+
* request regardless of `approve`.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
333
|
+
*
|
|
334
|
+
* const simulatorClient = createSimulatorClient({
|
|
335
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
336
|
+
* })
|
|
337
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
338
|
+
*
|
|
339
|
+
* const undoMatchSnapshot = await simulatorClient.matches.respondUndo(hostAccess, true)
|
|
340
|
+
* console.log(undoMatchSnapshot.pendingUndo)
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
344
|
+
*/
|
|
345
|
+
respondUndo(access: MatchAccessInput, approve: boolean, options?: SimulatorRequestOptions): Promise<GameState>;
|
|
346
|
+
/**
|
|
347
|
+
* Offers, accepts, or declines a rematch against the same opponent.
|
|
348
|
+
*
|
|
349
|
+
* Both seats call this. The first one gets `status: 'waiting'`; once every
|
|
350
|
+
* seat has asked, `series.rematchReady` flips on the match snapshot and each
|
|
351
|
+
* seat calls again to claim its own `status: 'ready'` access to the new
|
|
352
|
+
* match. Repeat claims return the same access, so a reconnecting client can
|
|
353
|
+
* safely ask again. Passing `accept: false` declines, and withdraws this
|
|
354
|
+
* seat's own offer.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
359
|
+
*
|
|
360
|
+
* const simulatorClient = createSimulatorClient({
|
|
361
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
362
|
+
* })
|
|
363
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
364
|
+
*
|
|
365
|
+
* const rematch = await simulatorClient.matches.rematch(hostAccess, true)
|
|
366
|
+
* if (rematch.status === 'ready') {
|
|
367
|
+
* console.log(rematch.access.matchId)
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
372
|
+
*/
|
|
373
|
+
rematch(access: MatchAccessInput, accept: boolean, options?: SimulatorRequestOptions): Promise<RematchMatchResponse>;
|
|
374
|
+
/**
|
|
375
|
+
* Pauses or resumes an attached AI opponent for one match.
|
|
376
|
+
*
|
|
377
|
+
* The response reports each AI-controlled seat and its pause state. Non-AI
|
|
378
|
+
* matches accept the request and return an empty `seats` list.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```ts
|
|
382
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
383
|
+
*
|
|
384
|
+
* const simulatorClient = createSimulatorClient({
|
|
385
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
386
|
+
* })
|
|
387
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
388
|
+
*
|
|
389
|
+
* const status = await simulatorClient.matches.setAiPaused(hostAccess, true)
|
|
390
|
+
* console.log(status.seats.every(seat => seat.paused))
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @see https://simulator-sdk.my-swu.com/guide/driving-gameplay
|
|
394
|
+
*/
|
|
395
|
+
setAiPaused(access: MatchAccessInput, paused: boolean, options?: SimulatorRequestOptions): Promise<AiStatusPayload>;
|
|
396
|
+
/**
|
|
397
|
+
* Captures a full state snapshot of an authorized, finished match.
|
|
398
|
+
*
|
|
399
|
+
* The returned object contains the engine's `MatchState` plus the
|
|
400
|
+
* per-seat decks needed to rebuild the catalog at restore time. SDK
|
|
401
|
+
* consumers persist it however they like — clipboard, file download,
|
|
402
|
+
* IndexedDB, server upload — the simulator does not store it.
|
|
403
|
+
*
|
|
404
|
+
* Unlike the older debug replay snapshot, this works for AI-opponent
|
|
405
|
+
* matches and does not need to replay any commands at restore time.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* import { createSimulatorClient } from '@my-swu/simulator-client'
|
|
410
|
+
*
|
|
411
|
+
* const simulatorClient = createSimulatorClient({
|
|
412
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
413
|
+
* })
|
|
414
|
+
*
|
|
415
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
416
|
+
*
|
|
417
|
+
* const save = await simulatorClient.matches.save(hostAccess)
|
|
418
|
+
* localStorage.setItem('swu-save', JSON.stringify(save))
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* @see https://simulator-sdk.my-swu.com/guide/save-restore
|
|
422
|
+
*/
|
|
423
|
+
save(access: MatchAccessInput, options?: SimulatorRequestOptions): Promise<MatchSavePayload>;
|
|
424
|
+
/**
|
|
425
|
+
* Restores a previously saved match into a fresh live session.
|
|
426
|
+
*
|
|
427
|
+
* Returns the new match id and per-seat access tokens — the original
|
|
428
|
+
* tokens are not preserved, so SDK consumers should treat the returned
|
|
429
|
+
* session as freshly created.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```ts
|
|
433
|
+
* import { createSimulatorClient, type MatchSavePayload } from '@my-swu/simulator-client'
|
|
434
|
+
*
|
|
435
|
+
* const simulatorClient = createSimulatorClient({
|
|
436
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
437
|
+
* })
|
|
438
|
+
*
|
|
439
|
+
* const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
|
|
440
|
+
* const persisted = JSON.parse(localStorage.getItem('swu-save') ?? '{}') as MatchSavePayload
|
|
441
|
+
* const restored = await simulatorClient.matches.restore(hostAccess, persisted)
|
|
442
|
+
* console.log(restored.matchId, restored.accesses.length)
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* @see https://simulator-sdk.my-swu.com/guide/save-restore
|
|
446
|
+
*/
|
|
447
|
+
restore(source: MatchAccessInput, save: MatchSavePayload, options?: SimulatorRequestOptions): Promise<RestoreMatchSaveResponse>;
|
|
448
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EngineHttpRequester } from '../http/request.js';
|
|
2
|
+
import type { MatchesResource } from './match-types.js';
|
|
3
|
+
export type * from './match-types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Dependencies needed by the match resource.
|
|
6
|
+
*/
|
|
7
|
+
export interface MatchesResourceOptions {
|
|
8
|
+
/**
|
|
9
|
+
* HTTP requester shared with other resources.
|
|
10
|
+
*/
|
|
11
|
+
requester: EngineHttpRequester;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates the match resource client.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createMatchesResource(options: MatchesResourceOptions): MatchesResource;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsonBody, jsonHeaders } from '../http/json.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the match resource client.
|
|
4
|
+
*/
|
|
5
|
+
export function createMatchesResource(options) {
|
|
6
|
+
const { requester } = options;
|
|
7
|
+
return {
|
|
8
|
+
leave: (access, options) => requester.request('leave-match-response', `/api/matches/${matchIdFrom(access)}/leave`, {
|
|
9
|
+
body: jsonBody(requester.validate('leave-match-request', { seatToken: access.seatToken })),
|
|
10
|
+
headers: jsonHeaders(),
|
|
11
|
+
method: 'POST',
|
|
12
|
+
}, options).then(() => undefined),
|
|
13
|
+
abandon: (access, options) => requester.request('abandon-match-response', `/api/matches/${matchIdFrom(access)}/abandon`, {
|
|
14
|
+
body: jsonBody(requester.validate('abandon-match-request', {
|
|
15
|
+
seatToken: access.seatToken,
|
|
16
|
+
})),
|
|
17
|
+
headers: jsonHeaders(),
|
|
18
|
+
method: 'POST',
|
|
19
|
+
}, options).then(() => undefined),
|
|
20
|
+
listActiveAi: (request, options) => requester.request('list-active-ai-matches-response', '/api/matches/active-ai', {
|
|
21
|
+
body: jsonBody(requester.validate('list-active-ai-matches-request', request)),
|
|
22
|
+
headers: jsonHeaders(),
|
|
23
|
+
method: 'POST',
|
|
24
|
+
}, options),
|
|
25
|
+
applyFormatEvent: (access, command, options) => requester.request('format-event-response', `/api/matches/${matchIdFrom(access)}/format-events`, {
|
|
26
|
+
body: jsonBody(requester.validate('format-event-request', {
|
|
27
|
+
command,
|
|
28
|
+
seatToken: access.seatToken,
|
|
29
|
+
})),
|
|
30
|
+
headers: jsonHeaders(),
|
|
31
|
+
method: 'POST',
|
|
32
|
+
}, options).then(response => response.snapshot),
|
|
33
|
+
create: (request, options) => requester.request('match-access-response', '/api/matches', {
|
|
34
|
+
body: jsonBody(requester.validate('create-match-request', request)),
|
|
35
|
+
headers: jsonHeaders(),
|
|
36
|
+
method: 'POST',
|
|
37
|
+
}, options),
|
|
38
|
+
get: (match, options) => requester.request('get-match-response', `/api/matches/${matchIdFrom(match)}`, {}, options)
|
|
39
|
+
.then(response => response.snapshot),
|
|
40
|
+
join: (match, request, options) => requester.request('match-access-response', `/api/matches/${matchIdFrom(match)}/join`, {
|
|
41
|
+
body: jsonBody(requester.validate('join-match-request', request)),
|
|
42
|
+
headers: jsonHeaders(),
|
|
43
|
+
method: 'POST',
|
|
44
|
+
}, options),
|
|
45
|
+
spectate: (match, request, options) => requester.request('match-spectator-access-response', `/api/matches/${matchIdFrom(match)}/spectate`, {
|
|
46
|
+
body: jsonBody(requester.validate('spectate-match-request', request)),
|
|
47
|
+
headers: jsonHeaders(),
|
|
48
|
+
method: 'POST',
|
|
49
|
+
}, options),
|
|
50
|
+
submitDeck: (access, request, options) => requester.request('submit-match-deck-response', `/api/matches/${matchIdFrom(access)}/deck`, {
|
|
51
|
+
body: jsonBody(requester.validate('submit-match-deck-request', {
|
|
52
|
+
...request,
|
|
53
|
+
seatToken: access.seatToken,
|
|
54
|
+
})),
|
|
55
|
+
headers: jsonHeaders(),
|
|
56
|
+
method: 'POST',
|
|
57
|
+
}, options).then(response => response.snapshot),
|
|
58
|
+
undo: (access, options) => requester.request('undo-match-response', `/api/matches/${matchIdFrom(access)}/undo`, {
|
|
59
|
+
body: jsonBody(requester.validate('undo-match-request', {
|
|
60
|
+
seatToken: access.seatToken,
|
|
61
|
+
})),
|
|
62
|
+
headers: jsonHeaders(),
|
|
63
|
+
method: 'POST',
|
|
64
|
+
}, options).then(response => response.snapshot),
|
|
65
|
+
respondUndo: (access, approve, options) => requester.request('undo-match-response', `/api/matches/${matchIdFrom(access)}/undo/respond`, {
|
|
66
|
+
body: jsonBody(requester.validate('undo-respond-match-request', {
|
|
67
|
+
approve,
|
|
68
|
+
seatToken: access.seatToken,
|
|
69
|
+
})),
|
|
70
|
+
headers: jsonHeaders(),
|
|
71
|
+
method: 'POST',
|
|
72
|
+
}, options).then(response => response.snapshot),
|
|
73
|
+
rematch: (access, accept, options) => requester.request('rematch-match-response', `/api/matches/${matchIdFrom(access)}/rematch`, {
|
|
74
|
+
body: jsonBody(requester.validate('rematch-match-request', {
|
|
75
|
+
accept,
|
|
76
|
+
seatToken: access.seatToken,
|
|
77
|
+
})),
|
|
78
|
+
headers: jsonHeaders(),
|
|
79
|
+
method: 'POST',
|
|
80
|
+
}, options),
|
|
81
|
+
setAiPaused: (access, paused, options) => requester.request('set-ai-paused-response', `/api/matches/${matchIdFrom(access)}/ai/pause`, {
|
|
82
|
+
body: jsonBody(requester.validate('set-ai-paused-request', {
|
|
83
|
+
paused,
|
|
84
|
+
seatToken: access.seatToken,
|
|
85
|
+
})),
|
|
86
|
+
headers: jsonHeaders(),
|
|
87
|
+
method: 'POST',
|
|
88
|
+
}, options),
|
|
89
|
+
save: (access, options) => requester.request('match-save-payload', `/api/matches/${matchIdFrom(access)}/save`, {
|
|
90
|
+
body: jsonBody(requester.validate('save-match-request', { seatToken: access.seatToken })),
|
|
91
|
+
headers: jsonHeaders(),
|
|
92
|
+
method: 'POST',
|
|
93
|
+
}, options),
|
|
94
|
+
restore: (source, save, options) => requester.request('restore-match-save-response', '/api/matches/restore', {
|
|
95
|
+
body: jsonBody(requester.validate('restore-match-save-request', {
|
|
96
|
+
save,
|
|
97
|
+
seatToken: source.seatToken,
|
|
98
|
+
})),
|
|
99
|
+
headers: jsonHeaders(),
|
|
100
|
+
method: 'POST',
|
|
101
|
+
}, options),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Reads a match id from either a public id string or match reference object.
|
|
106
|
+
*/
|
|
107
|
+
function matchIdFrom(match) {
|
|
108
|
+
return typeof match === 'string' ? match : match.matchId;
|
|
109
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MetaWindowsResponse, RankedLeaderboardQuery, RankedLeaderboardResponse, RankedMatchmakingRequest, RankedProfileRequest, RankedProfileResponse } from '../generated/index.js';
|
|
2
|
+
import type { EngineHttpRequester } from '../http/request.js';
|
|
3
|
+
import type { LobbyAccessResponse } from './lobby-types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Optional filters and pagination controls for a ranked leaderboard request.
|
|
6
|
+
*/
|
|
7
|
+
export type RankedLeaderboardOptions = RankedLeaderboardQuery;
|
|
8
|
+
/**
|
|
9
|
+
* Ranked matchmaking, profile, and leaderboard APIs.
|
|
10
|
+
*/
|
|
11
|
+
export interface RankedResource {
|
|
12
|
+
/** Returns every ranked meta window and identifies the currently active window. */
|
|
13
|
+
metaWindows(): Promise<MetaWindowsResponse>;
|
|
14
|
+
/** Returns the authenticated account's placement-safe profile for one meta window. */
|
|
15
|
+
profile(request: RankedProfileRequest): Promise<RankedProfileResponse>;
|
|
16
|
+
/** Returns one paginated, placement-complete leaderboard for a meta window. */
|
|
17
|
+
leaderboard(windowId: string, options?: RankedLeaderboardOptions): Promise<RankedLeaderboardResponse>;
|
|
18
|
+
/** Enters the verified account into a ranked matchmaking queue. */
|
|
19
|
+
matchmakeRanked(request: RankedMatchmakingRequest): Promise<LobbyAccessResponse>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates the ranked API resource.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createRankedResource(requester: EngineHttpRequester): RankedResource;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsonBody, jsonHeaders } from '../http/json.js';
|
|
2
|
+
import { parseSchema } from '../validators.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the ranked API resource.
|
|
5
|
+
*/
|
|
6
|
+
export function createRankedResource(requester) {
|
|
7
|
+
return {
|
|
8
|
+
metaWindows: () => requester.request('meta-windows-response', '/api/ranked/meta-windows'),
|
|
9
|
+
profile: request => requester.request('ranked-profile-response', '/api/ranked/profile', jsonPost('ranked-profile-request', request)),
|
|
10
|
+
leaderboard: (windowId, options) => requester.request('ranked-leaderboard-response', leaderboardPath(windowId, options ?? {})),
|
|
11
|
+
matchmakeRanked: request => requestResource(requester, 'lobby-access-response', '/api/lobbies/matchmaking/ranked', jsonPost('ranked-matchmaking-request', request)),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds a ranked leaderboard path from validated optional query parameters.
|
|
16
|
+
*/
|
|
17
|
+
function leaderboardPath(windowId, options) {
|
|
18
|
+
const query = parseSchema('ranked-leaderboard-query', options);
|
|
19
|
+
const parameters = new URLSearchParams();
|
|
20
|
+
if (query.queue != null) {
|
|
21
|
+
parameters.set('queue', query.queue);
|
|
22
|
+
}
|
|
23
|
+
if (query.offset != null) {
|
|
24
|
+
parameters.set('offset', String(query.offset));
|
|
25
|
+
}
|
|
26
|
+
if (query.limit != null) {
|
|
27
|
+
parameters.set('limit', String(query.limit));
|
|
28
|
+
}
|
|
29
|
+
const suffix = parameters.size === 0 ? '' : `?${parameters.toString()}`;
|
|
30
|
+
return `/api/ranked/meta-windows/${encodeURIComponent(windowId)}/leaderboard${suffix}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Builds a JSON POST request after validating the body against an SDK schema.
|
|
34
|
+
*/
|
|
35
|
+
function jsonPost(schemaName, body) {
|
|
36
|
+
return {
|
|
37
|
+
body: jsonBody(parseSchema(schemaName, body)),
|
|
38
|
+
headers: jsonHeaders(),
|
|
39
|
+
method: 'POST',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validates a response with a generated schema before returning a curated DTO type.
|
|
44
|
+
*/
|
|
45
|
+
function requestResource(requester, schemaName, pathname, init) {
|
|
46
|
+
return requester.request(schemaName, pathname, init);
|
|
47
|
+
}
|