@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,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ajv instances backing `parseSchema`.
|
|
3
|
+
*
|
|
4
|
+
* Every WebSocket frame, outbound envelope and HTTP body is validated here, so
|
|
5
|
+
* the hot path uses an instance that short-circuits at the first error
|
|
6
|
+
* (`allErrors: false`). `allErrors: true` costs at least 4.7x more: on one real
|
|
7
|
+
* `server-message` snapshot frame it measured 95.5 µs against 20.3 µs, and on a
|
|
8
|
+
* 13 KB mid-game snapshot frame 41.1 µs against 5.7 µs — in the first case more
|
|
9
|
+
* than ten times the cost of `JSON.parse`-ing the very frame being validated.
|
|
10
|
+
*
|
|
11
|
+
* The complete error list is still worth having, but only for a payload that
|
|
12
|
+
* already failed — and a failure throws, so it is off the hot path by
|
|
13
|
+
* construction. A second `allErrors: true` instance is therefore built lazily
|
|
14
|
+
* on the first failure and reused afterwards; building it eagerly would double
|
|
15
|
+
* this module's startup cost and heap for errors that usually never happen.
|
|
16
|
+
*/
|
|
17
|
+
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
18
|
+
import { sdkSchemaCommon, sdkSchemas } from '../generated/schemas.js';
|
|
19
|
+
/**
|
|
20
|
+
* Schemars emits non-standard numeric `format` keywords (uint8, uint16, ...) and
|
|
21
|
+
* `uuid` on string fields. We validate shape (required fields, discriminators,
|
|
22
|
+
* enum values, types) but intentionally skip numeric-range enforcement because
|
|
23
|
+
* the engine is the source of truth for those bounds. Treat these formats as
|
|
24
|
+
* always-valid so Ajv does not emit strict-mode warnings nor reject payloads.
|
|
25
|
+
*/
|
|
26
|
+
const SCHEMARS_FORMATS = [
|
|
27
|
+
'double',
|
|
28
|
+
'float',
|
|
29
|
+
'int16',
|
|
30
|
+
'int32',
|
|
31
|
+
'uint',
|
|
32
|
+
'uint8',
|
|
33
|
+
'uint16',
|
|
34
|
+
'uint32',
|
|
35
|
+
'uint64',
|
|
36
|
+
'uuid',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Builds one fully configured Ajv instance holding every generated schema.
|
|
40
|
+
*
|
|
41
|
+
* @param allErrors Whether validation collects every error or stops at the first.
|
|
42
|
+
*/
|
|
43
|
+
function createAjv(allErrors) {
|
|
44
|
+
const instance = new Ajv2020({
|
|
45
|
+
allErrors,
|
|
46
|
+
strict: false,
|
|
47
|
+
});
|
|
48
|
+
for (const format of SCHEMARS_FORMATS) {
|
|
49
|
+
instance.addFormat(format, true);
|
|
50
|
+
}
|
|
51
|
+
// The roots reference their shared definitions by absolute `$id` rather than
|
|
52
|
+
// inlining a private copy each, so the shared document has to be registered
|
|
53
|
+
// before them for those references to resolve.
|
|
54
|
+
instance.addSchema(sdkSchemaCommon);
|
|
55
|
+
for (const [name, schema] of Object.entries(sdkSchemas)) {
|
|
56
|
+
instance.addSchema(schema, name);
|
|
57
|
+
}
|
|
58
|
+
return instance;
|
|
59
|
+
}
|
|
60
|
+
/** Short-circuiting instance used for every successful validation. */
|
|
61
|
+
const fastAjv = createAjv(false);
|
|
62
|
+
/** Verbose instance, created on the first validation failure only. */
|
|
63
|
+
let verboseAjv;
|
|
64
|
+
/**
|
|
65
|
+
* Looks up the compiled fast validator for one generated schema name.
|
|
66
|
+
*
|
|
67
|
+
* @param name Generated schema name.
|
|
68
|
+
* @returns The validator, or `undefined` when no such schema is registered.
|
|
69
|
+
*/
|
|
70
|
+
export function getFastValidator(name) {
|
|
71
|
+
return fastAjv.getSchema(name);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Compiles the named schemas into the fast instance ahead of first use.
|
|
75
|
+
*
|
|
76
|
+
* Ajv compiles a registered schema the first time it is looked up, and that
|
|
77
|
+
* first compile drags in every shared definition it references — measured at
|
|
78
|
+
* ~215 ms for `server-message` against 2-42 ms for each schema after it. This
|
|
79
|
+
* exists so that cost can be paid at a moment of the caller's choosing rather
|
|
80
|
+
* than on the first frame off the wire. Unknown names are skipped; compiling
|
|
81
|
+
* an already-compiled schema is a no-op.
|
|
82
|
+
*
|
|
83
|
+
* @param names Generated schema names to compile.
|
|
84
|
+
*/
|
|
85
|
+
export function compileSchemas(names) {
|
|
86
|
+
for (const name of names) {
|
|
87
|
+
// A residual ~10 ms stays on the first frame regardless: Ajv emits
|
|
88
|
+
// JavaScript source, and the engine only parses each `$ref`ed sub-validator
|
|
89
|
+
// when a payload first reaches it. Exercising those would mean synthesizing
|
|
90
|
+
// a valid instance of every branch, which is not worth the ~4% left over.
|
|
91
|
+
fastAjv.getSchema(name);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Rebuilds the complete, human-readable detail list for a failed payload.
|
|
96
|
+
*
|
|
97
|
+
* The fast validator reports only the first error, so the payload is replayed
|
|
98
|
+
* through the verbose instance. Both instances hold the same schemas, so the
|
|
99
|
+
* replay is expected to fail again with every error; if it somehow passes, or
|
|
100
|
+
* reports nothing, the fast instance's own errors are used so the thrown error
|
|
101
|
+
* is never empty.
|
|
102
|
+
*
|
|
103
|
+
* @param name Generated schema name the payload failed against.
|
|
104
|
+
* @param value The payload that failed fast validation.
|
|
105
|
+
* @param fastErrors Errors reported by the fast validator.
|
|
106
|
+
*/
|
|
107
|
+
export function describeValidationErrors(name, value, fastErrors) {
|
|
108
|
+
verboseAjv ??= createAjv(true);
|
|
109
|
+
let errors = fastErrors ?? [];
|
|
110
|
+
const verbose = verboseAjv.getSchema(name);
|
|
111
|
+
if (verbose != null && !verbose(value)) {
|
|
112
|
+
const verboseErrors = verbose.errors ?? [];
|
|
113
|
+
if (verboseErrors.length > 0) {
|
|
114
|
+
errors = verboseErrors;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return errors.map((error) => {
|
|
118
|
+
const path = error.instancePath || '/';
|
|
119
|
+
return `${path} ${error.message ?? 'is invalid'}`;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forward-compatibility helper for tagged-union wire schemas.
|
|
3
|
+
*
|
|
4
|
+
* Every socket protocol in this SDK is a `oneOf` of branches pinned by a
|
|
5
|
+
* `type` const. The server may add a branch at any time, and a client built
|
|
6
|
+
* against an older contract must drop that frame rather than reject it —
|
|
7
|
+
* otherwise one new `ServerMessage` variant breaks every deployed client.
|
|
8
|
+
*
|
|
9
|
+
* A frame that is malformed in any other way is still a real contract
|
|
10
|
+
* violation and must keep failing validation loudly.
|
|
11
|
+
*/
|
|
12
|
+
import { type SchemaName } from '../generated/schemas.js';
|
|
13
|
+
/**
|
|
14
|
+
* Builds the discriminant sets for the named schemas ahead of first use.
|
|
15
|
+
*
|
|
16
|
+
* Collecting them walks every `oneOf` branch of a root schema, which for
|
|
17
|
+
* `server-message` is measured at ~10 ms — small next to the Ajv compile it
|
|
18
|
+
* sits beside, but it is the same kind of lazy cost landing on the same first
|
|
19
|
+
* frame, so warm-up covers both or it does not move the whole cost off the
|
|
20
|
+
* connect path.
|
|
21
|
+
*
|
|
22
|
+
* @param names Generated schema names to pre-scan.
|
|
23
|
+
*/
|
|
24
|
+
export declare function warmDiscriminants(names: readonly SchemaName[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Whether one payload carries a `type` this build's schema does not declare.
|
|
27
|
+
*
|
|
28
|
+
* Only a string `type` that no branch pins counts: a payload that is not an
|
|
29
|
+
* object, or that carries no usable discriminant at all, is left to normal
|
|
30
|
+
* validation so genuinely broken frames still surface as errors. A schema
|
|
31
|
+
* without discriminated branches never reports an unknown type.
|
|
32
|
+
*
|
|
33
|
+
* @param name Generated schema name the payload is destined for.
|
|
34
|
+
* @param value Parsed payload from the wire.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hasUnknownDiscriminant(name: SchemaName, value: unknown): boolean;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forward-compatibility helper for tagged-union wire schemas.
|
|
3
|
+
*
|
|
4
|
+
* Every socket protocol in this SDK is a `oneOf` of branches pinned by a
|
|
5
|
+
* `type` const. The server may add a branch at any time, and a client built
|
|
6
|
+
* against an older contract must drop that frame rather than reject it —
|
|
7
|
+
* otherwise one new `ServerMessage` variant breaks every deployed client.
|
|
8
|
+
*
|
|
9
|
+
* A frame that is malformed in any other way is still a real contract
|
|
10
|
+
* violation and must keep failing validation loudly.
|
|
11
|
+
*/
|
|
12
|
+
import { sdkSchemas } from '../generated/schemas.js';
|
|
13
|
+
/**
|
|
14
|
+
* Per-schema discriminant sets, derived from the generated schema on first use.
|
|
15
|
+
*
|
|
16
|
+
* Building these is a walk over every branch of a root schema, so it happens
|
|
17
|
+
* once per schema name and never per frame.
|
|
18
|
+
*/
|
|
19
|
+
const discriminantCache = new Map();
|
|
20
|
+
/**
|
|
21
|
+
* Collects every `type` const pinned by one root schema's `oneOf` branches.
|
|
22
|
+
*
|
|
23
|
+
* @param name Generated schema name.
|
|
24
|
+
*/
|
|
25
|
+
function collectDiscriminants(name) {
|
|
26
|
+
const schema = sdkSchemas[name];
|
|
27
|
+
const branches = Array.isArray(schema?.oneOf) ? schema.oneOf : [];
|
|
28
|
+
const values = new Set();
|
|
29
|
+
for (const branch of branches) {
|
|
30
|
+
const discriminant = branch?.properties?.type?.const;
|
|
31
|
+
if (typeof discriminant === 'string') {
|
|
32
|
+
values.add(discriminant);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return values;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Known `type` discriminants of one generated schema.
|
|
39
|
+
*
|
|
40
|
+
* @param name Generated schema name.
|
|
41
|
+
*/
|
|
42
|
+
function knownDiscriminants(name) {
|
|
43
|
+
let known = discriminantCache.get(name);
|
|
44
|
+
if (known == null) {
|
|
45
|
+
known = collectDiscriminants(name);
|
|
46
|
+
discriminantCache.set(name, known);
|
|
47
|
+
}
|
|
48
|
+
return known;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Builds the discriminant sets for the named schemas ahead of first use.
|
|
52
|
+
*
|
|
53
|
+
* Collecting them walks every `oneOf` branch of a root schema, which for
|
|
54
|
+
* `server-message` is measured at ~10 ms — small next to the Ajv compile it
|
|
55
|
+
* sits beside, but it is the same kind of lazy cost landing on the same first
|
|
56
|
+
* frame, so warm-up covers both or it does not move the whole cost off the
|
|
57
|
+
* connect path.
|
|
58
|
+
*
|
|
59
|
+
* @param names Generated schema names to pre-scan.
|
|
60
|
+
*/
|
|
61
|
+
export function warmDiscriminants(names) {
|
|
62
|
+
for (const name of names) {
|
|
63
|
+
if (sdkSchemas[name] != null) {
|
|
64
|
+
knownDiscriminants(name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Whether one payload carries a `type` this build's schema does not declare.
|
|
70
|
+
*
|
|
71
|
+
* Only a string `type` that no branch pins counts: a payload that is not an
|
|
72
|
+
* object, or that carries no usable discriminant at all, is left to normal
|
|
73
|
+
* validation so genuinely broken frames still surface as errors. A schema
|
|
74
|
+
* without discriminated branches never reports an unknown type.
|
|
75
|
+
*
|
|
76
|
+
* @param name Generated schema name the payload is destined for.
|
|
77
|
+
* @param value Parsed payload from the wire.
|
|
78
|
+
*/
|
|
79
|
+
export function hasUnknownDiscriminant(name, value) {
|
|
80
|
+
if (typeof value !== 'object' || value == null) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const discriminant = value.type;
|
|
84
|
+
if (typeof discriminant !== 'string') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const known = knownDiscriminants(name);
|
|
88
|
+
return known.size > 0 && !known.has(discriminant);
|
|
89
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The validation seam the SDK's network boundary talks to.
|
|
3
|
+
*
|
|
4
|
+
* Runtime schema validation is opt-in. This module is what makes "off" mean
|
|
5
|
+
* *absent* rather than *skipped*: it holds no schema, imports Ajv nowhere, and
|
|
6
|
+
* only depends on `SchemaTypeMap` / `SchemaName` as erased types. Every boundary
|
|
7
|
+
* (HTTP responses, HTTP request bodies, socket frames in both directions) goes
|
|
8
|
+
* through a `SchemaValidator` handed in at client construction, so a build that
|
|
9
|
+
* never asks for validation never references `../generated/schemas.js` nor
|
|
10
|
+
* `ajv`, and a bundler drops both — about 90% of the SDK's minified weight.
|
|
11
|
+
*
|
|
12
|
+
* The schema-backed implementation lives behind `createSchemaValidator()` in
|
|
13
|
+
* `../validators.js`; naming it is what pulls the schema map into a bundle.
|
|
14
|
+
*/
|
|
15
|
+
import type { SchemaName } from '../generated/schemas.js';
|
|
16
|
+
import type { SchemaTypeMap } from '../validators.js';
|
|
17
|
+
/**
|
|
18
|
+
* Validates SDK payloads at the network boundary.
|
|
19
|
+
*
|
|
20
|
+
* Pass one as `validate` to `createSimulatorClient` to turn boundary validation
|
|
21
|
+
* on. Custom implementations are supported: anything that narrows an unknown
|
|
22
|
+
* payload to the generated type — or throws — satisfies the contract.
|
|
23
|
+
*/
|
|
24
|
+
export interface SchemaValidator {
|
|
25
|
+
/**
|
|
26
|
+
* Narrows one payload to its generated type, throwing when it does not match.
|
|
27
|
+
*
|
|
28
|
+
* @param name Generated schema name.
|
|
29
|
+
* @param value Payload arriving from (or heading to) the wire.
|
|
30
|
+
*/
|
|
31
|
+
parse: <TName extends keyof SchemaTypeMap>(name: TName, value: unknown) => SchemaTypeMap[TName];
|
|
32
|
+
/**
|
|
33
|
+
* Whether one payload carries a `type` discriminant this build does not know.
|
|
34
|
+
*
|
|
35
|
+
* Tagged-union socket frames answering `true` here are dropped before
|
|
36
|
+
* `parse`, so a server that grows a message variant does not break older
|
|
37
|
+
* clients. Leave it undefined when the implementation cannot enumerate the
|
|
38
|
+
* known discriminants: frames then reach the dispatcher, which ignores any
|
|
39
|
+
* `type` it has no case for.
|
|
40
|
+
*
|
|
41
|
+
* @param name Generated schema name the payload is destined for.
|
|
42
|
+
* @param value Parsed payload from the wire.
|
|
43
|
+
*/
|
|
44
|
+
hasUnknownDiscriminant?: ((name: SchemaName, value: unknown) => boolean) | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Compiles the named schemas now, instead of when a payload first needs them.
|
|
47
|
+
*
|
|
48
|
+
* Schema-backed validation compiles lazily, and the first compile is by far
|
|
49
|
+
* the most expensive one because it pulls in the whole shared definition
|
|
50
|
+
* pool. Left alone that cost lands on the first frame a socket receives —
|
|
51
|
+
* during connect, on the browser's main thread. `createSimulatorClient`
|
|
52
|
+
* therefore calls this on an idle callback right after construction; call it
|
|
53
|
+
* yourself to warm a different set, or at a moment you choose.
|
|
54
|
+
*
|
|
55
|
+
* Implementations must be synchronous and safe to call repeatedly: a schema
|
|
56
|
+
* already compiled is a no-op. Leave it undefined when there is nothing to
|
|
57
|
+
* compile — the pass-through does, which is what makes warm-up free when
|
|
58
|
+
* validation is off.
|
|
59
|
+
*
|
|
60
|
+
* @param names Schemas to compile; defaults to the SDK's connect-path roots.
|
|
61
|
+
*/
|
|
62
|
+
warmUp?: ((names?: readonly SchemaName[]) => void) | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The default validator: a typed pass-through that checks nothing.
|
|
66
|
+
*
|
|
67
|
+
* `parse` is the identity, so payloads are trusted exactly as the server sent
|
|
68
|
+
* them (or as the caller built them). It reports no unknown discriminants,
|
|
69
|
+
* because without a schema map there is nothing to compare a `type` against —
|
|
70
|
+
* unknown frames therefore fall through to the message dispatchers, whose
|
|
71
|
+
* `switch` statements have no case for them and ignore them.
|
|
72
|
+
*/
|
|
73
|
+
export declare const passthroughValidator: SchemaValidator;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The validation seam the SDK's network boundary talks to.
|
|
3
|
+
*
|
|
4
|
+
* Runtime schema validation is opt-in. This module is what makes "off" mean
|
|
5
|
+
* *absent* rather than *skipped*: it holds no schema, imports Ajv nowhere, and
|
|
6
|
+
* only depends on `SchemaTypeMap` / `SchemaName` as erased types. Every boundary
|
|
7
|
+
* (HTTP responses, HTTP request bodies, socket frames in both directions) goes
|
|
8
|
+
* through a `SchemaValidator` handed in at client construction, so a build that
|
|
9
|
+
* never asks for validation never references `../generated/schemas.js` nor
|
|
10
|
+
* `ajv`, and a bundler drops both — about 90% of the SDK's minified weight.
|
|
11
|
+
*
|
|
12
|
+
* The schema-backed implementation lives behind `createSchemaValidator()` in
|
|
13
|
+
* `../validators.js`; naming it is what pulls the schema map into a bundle.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The default validator: a typed pass-through that checks nothing.
|
|
17
|
+
*
|
|
18
|
+
* `parse` is the identity, so payloads are trusted exactly as the server sent
|
|
19
|
+
* them (or as the caller built them). It reports no unknown discriminants,
|
|
20
|
+
* because without a schema map there is nothing to compare a `type` against —
|
|
21
|
+
* unknown frames therefore fall through to the message dispatchers, whose
|
|
22
|
+
* `switch` statements have no case for them and ignore them.
|
|
23
|
+
*/
|
|
24
|
+
export const passthroughValidator = {
|
|
25
|
+
parse: (_name, value) => value,
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moving the validator's first-compile cost off the connect path.
|
|
3
|
+
*
|
|
4
|
+
* Schema-backed validation compiles lazily. The first schema compiled pays for
|
|
5
|
+
* the whole shared definition pool — ~215 ms measured for `server-message`,
|
|
6
|
+
* against 2-42 ms for every schema after it — and without this it is the first
|
|
7
|
+
* server frame that pays it, which means during connect, on the main thread.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here references Ajv or the schema map: warm-up is requested through
|
|
10
|
+
* the injected validator's optional `warmUp`, so a client built without
|
|
11
|
+
* validation still drops both from the bundle.
|
|
12
|
+
*/
|
|
13
|
+
import type { SchemaValidator } from './validator.js';
|
|
14
|
+
/**
|
|
15
|
+
* Compiles a validator's connect-path schemas during idle time.
|
|
16
|
+
*
|
|
17
|
+
* A no-op when the validator has nothing to compile, which is the case for the
|
|
18
|
+
* pass-through the SDK uses by default. Never blocks the caller, and never
|
|
19
|
+
* produces a rejected promise: the work is synchronous, deferred, and its
|
|
20
|
+
* failures are swallowed because a failed warm-up only costs the lazy compile
|
|
21
|
+
* it was trying to avoid.
|
|
22
|
+
*
|
|
23
|
+
* @param validator Boundary validator configured on the client.
|
|
24
|
+
*/
|
|
25
|
+
export declare function scheduleValidatorWarmUp(validator: SchemaValidator): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moving the validator's first-compile cost off the connect path.
|
|
3
|
+
*
|
|
4
|
+
* Schema-backed validation compiles lazily. The first schema compiled pays for
|
|
5
|
+
* the whole shared definition pool — ~215 ms measured for `server-message`,
|
|
6
|
+
* against 2-42 ms for every schema after it — and without this it is the first
|
|
7
|
+
* server frame that pays it, which means during connect, on the main thread.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here references Ajv or the schema map: warm-up is requested through
|
|
10
|
+
* the injected validator's optional `warmUp`, so a client built without
|
|
11
|
+
* validation still drops both from the bundle.
|
|
12
|
+
*/
|
|
13
|
+
/** How long an idle callback may be deferred before it is forced to run. */
|
|
14
|
+
const WARM_UP_IDLE_TIMEOUT_MS = 2_000;
|
|
15
|
+
/**
|
|
16
|
+
* Compiles a validator's connect-path schemas during idle time.
|
|
17
|
+
*
|
|
18
|
+
* A no-op when the validator has nothing to compile, which is the case for the
|
|
19
|
+
* pass-through the SDK uses by default. Never blocks the caller, and never
|
|
20
|
+
* produces a rejected promise: the work is synchronous, deferred, and its
|
|
21
|
+
* failures are swallowed because a failed warm-up only costs the lazy compile
|
|
22
|
+
* it was trying to avoid.
|
|
23
|
+
*
|
|
24
|
+
* @param validator Boundary validator configured on the client.
|
|
25
|
+
*/
|
|
26
|
+
export function scheduleValidatorWarmUp(validator) {
|
|
27
|
+
const warmUp = validator.warmUp;
|
|
28
|
+
if (warmUp == null) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
scheduleIdleTask(() => {
|
|
32
|
+
try {
|
|
33
|
+
warmUp();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Warm-up is an optimization: whatever failed to compile here fails the
|
|
37
|
+
// same way on first use, where it is reported against a real payload.
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Runs one task after the current work, without holding the runtime open.
|
|
43
|
+
*
|
|
44
|
+
* Prefers `requestIdleCallback` so a browser can place the compile between
|
|
45
|
+
* frames; the timeout keeps a background tab from deferring it forever.
|
|
46
|
+
* Elsewhere a zero-delay timer is enough, `unref`ed so a Node process (or a
|
|
47
|
+
* test run) is never kept alive waiting for it.
|
|
48
|
+
*
|
|
49
|
+
* @param task Synchronous work to defer.
|
|
50
|
+
*/
|
|
51
|
+
function scheduleIdleTask(task) {
|
|
52
|
+
const idle = globalThis.requestIdleCallback;
|
|
53
|
+
if (typeof idle === 'function') {
|
|
54
|
+
idle(task, { timeout: WARM_UP_IDLE_TIMEOUT_MS });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const timer = setTimeout(task, 0);
|
|
58
|
+
timer.unref?.();
|
|
59
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { SimulatorReportListResponse, SimulatorReportResponse, CloseTournamentRoomRequest, AbandonMatchRequest, AbandonMatchResponse, AddLobbyAiPlayerRequest, ApiErrorResponse, CardCatalogRefreshResponse, CardsResponse, ClientMessage, CreateLimitedEventRequest, CreateLobbyRequest, CreateMetaWindowRequest, CreateMatchRequest, CreateTournamentRoomRequest, CreateTournamentTableRequest, ErrorPayload, FormatEventRequest, FormatEventResponse, GameCommand, GameEvent, GameState, GetMatchResponse, HealthResponse, JoinLimitedEventRequest, JoinLobbyRequest, JoinMatchRequest, JoinTournamentRoomRequest, JoinTournamentTableRequest, KickLobbyPlayerRequest, KickLobbySpectatorRequest, LeaveLobbyRequest, LeaveMatchRequest, LeaveMatchResponse, LeaveTournamentRoomRequest, LimitedEventAccessResponse, LimitedEventCommandRequest, LimitedEventPreflightResponse, LimitedEventResponse, LobbyAccessResponse, LobbyChatRequest, LobbyChatResponse, LobbyListResponse, LobbyListServerMessage, LobbyMatchmakingDecisionRequest, PrepareLobbyLimitedAiDecksRequest, LobbyResponse, LobbyServerMessage, LobbySyncRequest, ListActiveAiMatchesRequest, ListActiveAiMatchesResponse, MatchAccessResponse, MatchChatLookupResponse, MatchConnectionRole, MatchHistoryDeckStatsRequest, MatchHistoryDeckStatsResponse, MatchHistoryEntry, MatchHistoryListRequest, MatchHistoryListResponse, MatchHistoryReplayRequest, MatchHistoryReplayResponse, MatchHistoryRestoreRequest, RestoreHistoryResponse, MatchSavePayload, MatchSpectatorAccessResponse, MetaWindow, MetaWindowsResponse, LobbyMatchmakingRequest, ResolveCardIdsRequest, ResolveCardIdsResponse, RankedAdminStatus, RankedLeaderboardEntry, RankedLeaderboardQuery, RankedLeaderboardResponse, RankedMatchmakingView, RankedProfileRequest, RankedProfileResponse, RankedQueue, RematchMatchRequest, RematchMatchResponse, SaveMatchRequest, ReturnLobbyMatchRequest, ReturnTournamentMatchRequest, RestoreMatchSaveRequest, RestoreMatchSaveResponse, ServerMessage, AiStatusPayload, SetRankedAdmissionRequest, SetSimulatorMaintenanceRequest, SetAiPausedRequest, SimulatorAdminStatusResponse, SimulatorAvailabilityResponse, SpectateLobbyRequest, SpectateMatchRequest, StartLobbyLimitedMatchRequest, StartLobbyRequest, StartTournamentEventRequest, SubmitLobbyLimitedDeckRequest, SubmitMatchDeckRequest, SubmitMatchDeckResponse, SubmitTournamentDeckRequest, TournamentEventCommandRequest, TournamentRoomAccessResponse, TournamentRoomChatRequest, TournamentRoomChatResponse, TournamentRoomListResponse, TournamentRoomResponse, TournamentRoomServerMessage, TournamentRoomSyncRequest, UndoMatchRequest, UndoMatchResponse, UndoRespondMatchRequest, UpdateLobbyAiPlayerRequest, UpdateLobbyPlayerRequest, UpdateLobbySettingsRequest, UpdateTournamentRoomPlayerRequest, UpdateTournamentRoomSettingsRequest, WelcomePayload } from './generated/index.js';
|
|
2
|
+
import type { SchemaValidator } from './validators/validator.js';
|
|
3
|
+
/**
|
|
4
|
+
* Exact schema-to-type map generated from Rust public wire contracts.
|
|
5
|
+
*
|
|
6
|
+
* Keys match generated schema names. Values are the TypeScript types returned
|
|
7
|
+
* after runtime validation succeeds.
|
|
8
|
+
*
|
|
9
|
+
* @see https://simulator-sdk.my-swu.com/guide/versioning
|
|
10
|
+
*/
|
|
11
|
+
export interface SchemaTypeMap {
|
|
12
|
+
'simulator-report-list-response': SimulatorReportListResponse;
|
|
13
|
+
'simulator-report-response': SimulatorReportResponse;
|
|
14
|
+
'close-tournament-room-request': CloseTournamentRoomRequest;
|
|
15
|
+
'abandon-match-request': AbandonMatchRequest;
|
|
16
|
+
'abandon-match-response': AbandonMatchResponse;
|
|
17
|
+
'leave-match-request': LeaveMatchRequest;
|
|
18
|
+
'leave-match-response': LeaveMatchResponse;
|
|
19
|
+
'leave-tournament-room-request': LeaveTournamentRoomRequest;
|
|
20
|
+
'list-active-ai-matches-request': ListActiveAiMatchesRequest;
|
|
21
|
+
'list-active-ai-matches-response': ListActiveAiMatchesResponse;
|
|
22
|
+
'api-error-response': ApiErrorResponse;
|
|
23
|
+
'cards-response': CardsResponse;
|
|
24
|
+
'card-catalog-refresh-response': CardCatalogRefreshResponse;
|
|
25
|
+
'client-message': ClientMessage;
|
|
26
|
+
'create-limited-event-request': CreateLimitedEventRequest;
|
|
27
|
+
'create-lobby-request': CreateLobbyRequest;
|
|
28
|
+
'create-meta-window-request': CreateMetaWindowRequest;
|
|
29
|
+
'create-match-request': CreateMatchRequest;
|
|
30
|
+
'create-tournament-room-request': CreateTournamentRoomRequest;
|
|
31
|
+
'create-tournament-table-request': CreateTournamentTableRequest;
|
|
32
|
+
'error-payload': ErrorPayload;
|
|
33
|
+
'format-event-request': FormatEventRequest;
|
|
34
|
+
'format-event-response': FormatEventResponse;
|
|
35
|
+
'game-command': GameCommand;
|
|
36
|
+
'game-event': GameEvent;
|
|
37
|
+
'game-state': GameState;
|
|
38
|
+
'get-match-response': GetMatchResponse;
|
|
39
|
+
'health-response': HealthResponse;
|
|
40
|
+
'join-limited-event-request': JoinLimitedEventRequest;
|
|
41
|
+
'join-lobby-request': JoinLobbyRequest;
|
|
42
|
+
'join-match-request': JoinMatchRequest;
|
|
43
|
+
'join-tournament-room-request': JoinTournamentRoomRequest;
|
|
44
|
+
'join-tournament-table-request': JoinTournamentTableRequest;
|
|
45
|
+
'kick-lobby-player-request': KickLobbyPlayerRequest;
|
|
46
|
+
'kick-lobby-spectator-request': KickLobbySpectatorRequest;
|
|
47
|
+
'leave-lobby-request': LeaveLobbyRequest;
|
|
48
|
+
'limited-event-access-response': LimitedEventAccessResponse;
|
|
49
|
+
'limited-event-command-request': LimitedEventCommandRequest;
|
|
50
|
+
'limited-event-preflight-response': LimitedEventPreflightResponse;
|
|
51
|
+
'limited-event-response': LimitedEventResponse;
|
|
52
|
+
'add-lobby-ai-player-request': AddLobbyAiPlayerRequest;
|
|
53
|
+
'lobby-access-response': LobbyAccessResponse;
|
|
54
|
+
'lobby-chat-request': LobbyChatRequest;
|
|
55
|
+
'lobby-chat-response': LobbyChatResponse;
|
|
56
|
+
'lobby-list-response': LobbyListResponse;
|
|
57
|
+
'lobby-list-server-message': LobbyListServerMessage;
|
|
58
|
+
'lobby-matchmaking-decision-request': LobbyMatchmakingDecisionRequest;
|
|
59
|
+
'lobby-response': LobbyResponse;
|
|
60
|
+
'lobby-server-message': LobbyServerMessage;
|
|
61
|
+
'lobby-sync-request': LobbySyncRequest;
|
|
62
|
+
'match-access-response': MatchAccessResponse;
|
|
63
|
+
'match-chat-lookup-response': MatchChatLookupResponse;
|
|
64
|
+
'match-connection-role': MatchConnectionRole;
|
|
65
|
+
'match-history-deck-stats-request': MatchHistoryDeckStatsRequest;
|
|
66
|
+
'match-history-deck-stats-response': MatchHistoryDeckStatsResponse;
|
|
67
|
+
'match-history-entry': MatchHistoryEntry;
|
|
68
|
+
'match-history-list-request': MatchHistoryListRequest;
|
|
69
|
+
'match-history-list-response': MatchHistoryListResponse;
|
|
70
|
+
'match-history-replay-request': MatchHistoryReplayRequest;
|
|
71
|
+
'match-history-replay-response': MatchHistoryReplayResponse;
|
|
72
|
+
'match-history-restore-request': MatchHistoryRestoreRequest;
|
|
73
|
+
'restore-history-response': RestoreHistoryResponse;
|
|
74
|
+
'match-save-payload': MatchSavePayload;
|
|
75
|
+
'save-match-request': SaveMatchRequest;
|
|
76
|
+
'match-spectator-access-response': MatchSpectatorAccessResponse;
|
|
77
|
+
'meta-window': MetaWindow;
|
|
78
|
+
'meta-windows-response': MetaWindowsResponse;
|
|
79
|
+
'lobby-matchmaking-request': LobbyMatchmakingRequest;
|
|
80
|
+
'resolve-card-ids-request': ResolveCardIdsRequest;
|
|
81
|
+
'resolve-card-ids-response': ResolveCardIdsResponse;
|
|
82
|
+
'ranked-admin-status': RankedAdminStatus;
|
|
83
|
+
'ranked-leaderboard-entry': RankedLeaderboardEntry;
|
|
84
|
+
'ranked-leaderboard-query': RankedLeaderboardQuery;
|
|
85
|
+
'ranked-leaderboard-response': RankedLeaderboardResponse;
|
|
86
|
+
'ranked-matchmaking-view': RankedMatchmakingView;
|
|
87
|
+
'ranked-profile-request': RankedProfileRequest;
|
|
88
|
+
'ranked-profile-response': RankedProfileResponse;
|
|
89
|
+
'ranked-queue': RankedQueue;
|
|
90
|
+
'rematch-match-request': RematchMatchRequest;
|
|
91
|
+
'rematch-match-response': RematchMatchResponse;
|
|
92
|
+
'return-lobby-match-request': ReturnLobbyMatchRequest;
|
|
93
|
+
'return-tournament-match-request': ReturnTournamentMatchRequest;
|
|
94
|
+
'restore-match-save-request': RestoreMatchSaveRequest;
|
|
95
|
+
'restore-match-save-response': RestoreMatchSaveResponse;
|
|
96
|
+
'server-message': ServerMessage;
|
|
97
|
+
'set-ai-paused-request': SetAiPausedRequest;
|
|
98
|
+
'set-ai-paused-response': AiStatusPayload;
|
|
99
|
+
'set-ranked-admission-request': SetRankedAdmissionRequest;
|
|
100
|
+
'set-simulator-maintenance-request': SetSimulatorMaintenanceRequest;
|
|
101
|
+
'simulator-admin-status-response': SimulatorAdminStatusResponse;
|
|
102
|
+
'simulator-availability-response': SimulatorAvailabilityResponse;
|
|
103
|
+
'spectate-lobby-request': SpectateLobbyRequest;
|
|
104
|
+
'spectate-match-request': SpectateMatchRequest;
|
|
105
|
+
'start-lobby-limited-match-request': StartLobbyLimitedMatchRequest;
|
|
106
|
+
'prepare-lobby-limited-ai-decks-request': PrepareLobbyLimitedAiDecksRequest;
|
|
107
|
+
'start-lobby-request': StartLobbyRequest;
|
|
108
|
+
'start-tournament-event-request': StartTournamentEventRequest;
|
|
109
|
+
'submit-lobby-limited-deck-request': SubmitLobbyLimitedDeckRequest;
|
|
110
|
+
'submit-match-deck-request': SubmitMatchDeckRequest;
|
|
111
|
+
'submit-match-deck-response': SubmitMatchDeckResponse;
|
|
112
|
+
'submit-tournament-deck-request': SubmitTournamentDeckRequest;
|
|
113
|
+
'tournament-event-command-request': TournamentEventCommandRequest;
|
|
114
|
+
'tournament-room-access-response': TournamentRoomAccessResponse;
|
|
115
|
+
'tournament-room-chat-request': TournamentRoomChatRequest;
|
|
116
|
+
'tournament-room-chat-response': TournamentRoomChatResponse;
|
|
117
|
+
'tournament-room-list-response': TournamentRoomListResponse;
|
|
118
|
+
'tournament-room-response': TournamentRoomResponse;
|
|
119
|
+
'tournament-room-server-message': TournamentRoomServerMessage;
|
|
120
|
+
'tournament-room-sync-request': TournamentRoomSyncRequest;
|
|
121
|
+
'undo-match-request': UndoMatchRequest;
|
|
122
|
+
'undo-match-response': UndoMatchResponse;
|
|
123
|
+
'undo-respond-match-request': UndoRespondMatchRequest;
|
|
124
|
+
'update-lobby-ai-player-request': UpdateLobbyAiPlayerRequest;
|
|
125
|
+
'update-lobby-player-request': UpdateLobbyPlayerRequest;
|
|
126
|
+
'update-lobby-settings-request': UpdateLobbySettingsRequest;
|
|
127
|
+
'update-tournament-room-player-request': UpdateTournamentRoomPlayerRequest;
|
|
128
|
+
'update-tournament-room-settings-request': UpdateTournamentRoomSettingsRequest;
|
|
129
|
+
'welcome-payload': WelcomePayload;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Validates one unknown payload against one generated schema.
|
|
133
|
+
*
|
|
134
|
+
* Use this for custom transports, persisted payload checks, tests, or tools that
|
|
135
|
+
* need the same runtime validation the SDK applies at the network boundary.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { parseSchema } from '@my-swu/simulator-client'
|
|
140
|
+
*
|
|
141
|
+
* const health = parseSchema('health-response', { status: 'ok' })
|
|
142
|
+
* console.log(health.status)
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @see https://simulator-sdk.my-swu.com/guide/errors
|
|
146
|
+
* @see https://simulator-sdk.my-swu.com/guide/versioning
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseSchema<TName extends keyof SchemaTypeMap>(name: TName, value: unknown): SchemaTypeMap[TName];
|
|
149
|
+
/**
|
|
150
|
+
* Builds the schema-backed validator for `createSimulatorClient`.
|
|
151
|
+
*
|
|
152
|
+
* Boundary validation is off by default. Naming this function is what opts a
|
|
153
|
+
* build in — and what makes the generated schema map plus Ajv reachable from
|
|
154
|
+
* the client, which is roughly 90% of the SDK's minified bundle. Leave it
|
|
155
|
+
* unreferenced and a bundler removes both.
|
|
156
|
+
*
|
|
157
|
+
* The returned validator carries a `warmUp`, which `createSimulatorClient`
|
|
158
|
+
* schedules on an idle callback so the first schema compile does not land on
|
|
159
|
+
* the first server frame.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* import { createSchemaValidator, createSimulatorClient } from '@my-swu/simulator-client'
|
|
164
|
+
*
|
|
165
|
+
* const simulatorClient = createSimulatorClient({
|
|
166
|
+
* baseUrl: 'http://127.0.0.1:4000',
|
|
167
|
+
* validate: createSchemaValidator(),
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @see https://simulator-sdk.my-swu.com/guide/client-api
|
|
172
|
+
*/
|
|
173
|
+
export declare function createSchemaValidator(): SchemaValidator;
|