@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.
Files changed (530) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +355 -0
  3. package/dist/actionable.d.ts +61 -0
  4. package/dist/actionable.js +91 -0
  5. package/dist/client.d.ts +157 -0
  6. package/dist/client.js +92 -0
  7. package/dist/connection/handshake.d.ts +30 -0
  8. package/dist/connection/handshake.js +62 -0
  9. package/dist/connection/options.d.ts +36 -0
  10. package/dist/connection/options.js +1 -0
  11. package/dist/connection/url.d.ts +55 -0
  12. package/dist/connection/url.js +46 -0
  13. package/dist/connection/wait.d.ts +22 -0
  14. package/dist/connection/wait.js +10 -0
  15. package/dist/connection.d.ts +110 -0
  16. package/dist/connection.js +358 -0
  17. package/dist/generated/index.d.ts +121 -0
  18. package/dist/generated/index.js +1 -0
  19. package/dist/generated/public-types.d.ts +2 -0
  20. package/dist/generated/public-types.js +1 -0
  21. package/dist/generated/schemas.d.ts +27 -0
  22. package/dist/generated/schemas.js +21264 -0
  23. package/dist/generated/types/abandon-match-request.d.ts +1 -0
  24. package/dist/generated/types/abandon-match-request.js +2 -0
  25. package/dist/generated/types/abandon-match-response.d.ts +1 -0
  26. package/dist/generated/types/abandon-match-response.js +2 -0
  27. package/dist/generated/types/add-lobby-ai-player-request.d.ts +1 -0
  28. package/dist/generated/types/add-lobby-ai-player-request.js +2 -0
  29. package/dist/generated/types/ai-driver-error-report-list-response.d.ts +1 -0
  30. package/dist/generated/types/ai-driver-error-report-list-response.js +2 -0
  31. package/dist/generated/types/ai-driver-error-report-response.d.ts +1 -0
  32. package/dist/generated/types/ai-driver-error-report-response.js +2 -0
  33. package/dist/generated/types/api-error-response.d.ts +1 -0
  34. package/dist/generated/types/api-error-response.js +2 -0
  35. package/dist/generated/types/card-catalog-refresh-response.d.ts +1 -0
  36. package/dist/generated/types/card-catalog-refresh-response.js +2 -0
  37. package/dist/generated/types/cards-response.d.ts +1 -0
  38. package/dist/generated/types/cards-response.js +2 -0
  39. package/dist/generated/types/client-message.d.ts +1 -0
  40. package/dist/generated/types/client-message.js +2 -0
  41. package/dist/generated/types/close-tournament-room-request.d.ts +1 -0
  42. package/dist/generated/types/close-tournament-room-request.js +2 -0
  43. package/dist/generated/types/common.d.ts +5361 -0
  44. package/dist/generated/types/common.js +2 -0
  45. package/dist/generated/types/covered-cards-response.d.ts +47 -0
  46. package/dist/generated/types/covered-cards-response.js +2 -0
  47. package/dist/generated/types/create-limited-event-request.d.ts +1 -0
  48. package/dist/generated/types/create-limited-event-request.js +2 -0
  49. package/dist/generated/types/create-lobby-request.d.ts +1 -0
  50. package/dist/generated/types/create-lobby-request.js +2 -0
  51. package/dist/generated/types/create-match-request.d.ts +1 -0
  52. package/dist/generated/types/create-match-request.js +2 -0
  53. package/dist/generated/types/create-meta-window-request.d.ts +1 -0
  54. package/dist/generated/types/create-meta-window-request.js +2 -0
  55. package/dist/generated/types/create-tournament-room-request.d.ts +1 -0
  56. package/dist/generated/types/create-tournament-room-request.js +2 -0
  57. package/dist/generated/types/create-tournament-table-request.d.ts +1 -0
  58. package/dist/generated/types/create-tournament-table-request.js +2 -0
  59. package/dist/generated/types/error-payload.d.ts +1 -0
  60. package/dist/generated/types/error-payload.js +2 -0
  61. package/dist/generated/types/format-event-request.d.ts +1 -0
  62. package/dist/generated/types/format-event-request.js +2 -0
  63. package/dist/generated/types/format-event-response.d.ts +1 -0
  64. package/dist/generated/types/format-event-response.js +2 -0
  65. package/dist/generated/types/game-command.d.ts +1 -0
  66. package/dist/generated/types/game-command.js +2 -0
  67. package/dist/generated/types/game-event.d.ts +1 -0
  68. package/dist/generated/types/game-event.js +2 -0
  69. package/dist/generated/types/game-state.d.ts +1 -0
  70. package/dist/generated/types/game-state.js +2 -0
  71. package/dist/generated/types/get-match-response.d.ts +1 -0
  72. package/dist/generated/types/get-match-response.js +2 -0
  73. package/dist/generated/types/health-response.d.ts +1 -0
  74. package/dist/generated/types/health-response.js +2 -0
  75. package/dist/generated/types/join-limited-event-request.d.ts +1 -0
  76. package/dist/generated/types/join-limited-event-request.js +2 -0
  77. package/dist/generated/types/join-lobby-request.d.ts +1 -0
  78. package/dist/generated/types/join-lobby-request.js +2 -0
  79. package/dist/generated/types/join-match-request.d.ts +1 -0
  80. package/dist/generated/types/join-match-request.js +2 -0
  81. package/dist/generated/types/join-tournament-room-request.d.ts +1 -0
  82. package/dist/generated/types/join-tournament-room-request.js +2 -0
  83. package/dist/generated/types/join-tournament-table-request.d.ts +1 -0
  84. package/dist/generated/types/join-tournament-table-request.js +2 -0
  85. package/dist/generated/types/kick-lobby-player-request.d.ts +1 -0
  86. package/dist/generated/types/kick-lobby-player-request.js +2 -0
  87. package/dist/generated/types/kick-lobby-spectator-request.d.ts +1 -0
  88. package/dist/generated/types/kick-lobby-spectator-request.js +2 -0
  89. package/dist/generated/types/leave-lobby-request.d.ts +1 -0
  90. package/dist/generated/types/leave-lobby-request.js +2 -0
  91. package/dist/generated/types/leave-match-request.d.ts +1 -0
  92. package/dist/generated/types/leave-match-request.js +2 -0
  93. package/dist/generated/types/leave-match-response.d.ts +1 -0
  94. package/dist/generated/types/leave-match-response.js +2 -0
  95. package/dist/generated/types/leave-tournament-room-request.d.ts +1 -0
  96. package/dist/generated/types/leave-tournament-room-request.js +2 -0
  97. package/dist/generated/types/limited-event-access-response.d.ts +1 -0
  98. package/dist/generated/types/limited-event-access-response.js +2 -0
  99. package/dist/generated/types/limited-event-command-request.d.ts +1 -0
  100. package/dist/generated/types/limited-event-command-request.js +2 -0
  101. package/dist/generated/types/limited-event-preflight-response.d.ts +1 -0
  102. package/dist/generated/types/limited-event-preflight-response.js +2 -0
  103. package/dist/generated/types/limited-event-response.d.ts +1 -0
  104. package/dist/generated/types/limited-event-response.js +2 -0
  105. package/dist/generated/types/list-active-ai-matches-request.d.ts +1 -0
  106. package/dist/generated/types/list-active-ai-matches-request.js +2 -0
  107. package/dist/generated/types/list-active-ai-matches-response.d.ts +1 -0
  108. package/dist/generated/types/list-active-ai-matches-response.js +2 -0
  109. package/dist/generated/types/lobby-access-response.d.ts +1 -0
  110. package/dist/generated/types/lobby-access-response.js +2 -0
  111. package/dist/generated/types/lobby-chat-request.d.ts +1 -0
  112. package/dist/generated/types/lobby-chat-request.js +2 -0
  113. package/dist/generated/types/lobby-chat-response.d.ts +1 -0
  114. package/dist/generated/types/lobby-chat-response.js +2 -0
  115. package/dist/generated/types/lobby-list-response.d.ts +1 -0
  116. package/dist/generated/types/lobby-list-response.js +2 -0
  117. package/dist/generated/types/lobby-list-server-message.d.ts +1 -0
  118. package/dist/generated/types/lobby-list-server-message.js +2 -0
  119. package/dist/generated/types/lobby-matchmaking-decision-request.d.ts +1 -0
  120. package/dist/generated/types/lobby-matchmaking-decision-request.js +2 -0
  121. package/dist/generated/types/lobby-matchmaking-request.d.ts +1 -0
  122. package/dist/generated/types/lobby-matchmaking-request.js +2 -0
  123. package/dist/generated/types/lobby-response.d.ts +1 -0
  124. package/dist/generated/types/lobby-response.js +2 -0
  125. package/dist/generated/types/lobby-server-message.d.ts +1 -0
  126. package/dist/generated/types/lobby-server-message.js +2 -0
  127. package/dist/generated/types/lobby-sync-request.d.ts +1 -0
  128. package/dist/generated/types/lobby-sync-request.js +2 -0
  129. package/dist/generated/types/match-access-response.d.ts +1 -0
  130. package/dist/generated/types/match-access-response.js +2 -0
  131. package/dist/generated/types/match-chat-lookup-response.d.ts +1 -0
  132. package/dist/generated/types/match-chat-lookup-response.js +2 -0
  133. package/dist/generated/types/match-connection-role.d.ts +1 -0
  134. package/dist/generated/types/match-connection-role.js +2 -0
  135. package/dist/generated/types/match-history-deck-stats-request.d.ts +1 -0
  136. package/dist/generated/types/match-history-deck-stats-request.js +2 -0
  137. package/dist/generated/types/match-history-deck-stats-response.d.ts +1 -0
  138. package/dist/generated/types/match-history-deck-stats-response.js +2 -0
  139. package/dist/generated/types/match-history-entry.d.ts +1 -0
  140. package/dist/generated/types/match-history-entry.js +2 -0
  141. package/dist/generated/types/match-history-list-request.d.ts +1 -0
  142. package/dist/generated/types/match-history-list-request.js +2 -0
  143. package/dist/generated/types/match-history-list-response.d.ts +1 -0
  144. package/dist/generated/types/match-history-list-response.js +2 -0
  145. package/dist/generated/types/match-history-replay-request.d.ts +1 -0
  146. package/dist/generated/types/match-history-replay-request.js +2 -0
  147. package/dist/generated/types/match-history-replay-response.d.ts +1 -0
  148. package/dist/generated/types/match-history-replay-response.js +2 -0
  149. package/dist/generated/types/match-history-restore-request.d.ts +1 -0
  150. package/dist/generated/types/match-history-restore-request.js +2 -0
  151. package/dist/generated/types/match-save-payload.d.ts +1 -0
  152. package/dist/generated/types/match-save-payload.js +2 -0
  153. package/dist/generated/types/match-spectator-access-response.d.ts +1 -0
  154. package/dist/generated/types/match-spectator-access-response.js +2 -0
  155. package/dist/generated/types/meta-window.d.ts +1 -0
  156. package/dist/generated/types/meta-window.js +2 -0
  157. package/dist/generated/types/meta-windows-response.d.ts +1 -0
  158. package/dist/generated/types/meta-windows-response.js +2 -0
  159. package/dist/generated/types/prepare-lobby-limited-ai-decks-request.d.ts +1 -0
  160. package/dist/generated/types/prepare-lobby-limited-ai-decks-request.js +2 -0
  161. package/dist/generated/types/random-lobby-matchmaking-request.d.ts +173 -0
  162. package/dist/generated/types/random-lobby-matchmaking-request.js +2 -0
  163. package/dist/generated/types/ranked-admin-status.d.ts +1 -0
  164. package/dist/generated/types/ranked-admin-status.js +2 -0
  165. package/dist/generated/types/ranked-leaderboard-entry.d.ts +1 -0
  166. package/dist/generated/types/ranked-leaderboard-entry.js +2 -0
  167. package/dist/generated/types/ranked-leaderboard-query.d.ts +1 -0
  168. package/dist/generated/types/ranked-leaderboard-query.js +2 -0
  169. package/dist/generated/types/ranked-leaderboard-response.d.ts +1 -0
  170. package/dist/generated/types/ranked-leaderboard-response.js +2 -0
  171. package/dist/generated/types/ranked-matchmaking-request.d.ts +137 -0
  172. package/dist/generated/types/ranked-matchmaking-request.js +2 -0
  173. package/dist/generated/types/ranked-matchmaking-view.d.ts +1 -0
  174. package/dist/generated/types/ranked-matchmaking-view.js +2 -0
  175. package/dist/generated/types/ranked-profile-request.d.ts +1 -0
  176. package/dist/generated/types/ranked-profile-request.js +2 -0
  177. package/dist/generated/types/ranked-profile-response.d.ts +1 -0
  178. package/dist/generated/types/ranked-profile-response.js +2 -0
  179. package/dist/generated/types/ranked-queue.d.ts +1 -0
  180. package/dist/generated/types/ranked-queue.js +2 -0
  181. package/dist/generated/types/ready-tournament-table-request.d.ts +7 -0
  182. package/dist/generated/types/ready-tournament-table-request.js +2 -0
  183. package/dist/generated/types/rematch-match-request.d.ts +1 -0
  184. package/dist/generated/types/rematch-match-request.js +2 -0
  185. package/dist/generated/types/rematch-match-response.d.ts +1 -0
  186. package/dist/generated/types/rematch-match-response.js +2 -0
  187. package/dist/generated/types/resolve-card-ids-request.d.ts +1 -0
  188. package/dist/generated/types/resolve-card-ids-request.js +2 -0
  189. package/dist/generated/types/resolve-card-ids-response.d.ts +1 -0
  190. package/dist/generated/types/resolve-card-ids-response.js +2 -0
  191. package/dist/generated/types/restore-history-response.d.ts +1 -0
  192. package/dist/generated/types/restore-history-response.js +2 -0
  193. package/dist/generated/types/restore-match-save-request.d.ts +1 -0
  194. package/dist/generated/types/restore-match-save-request.js +2 -0
  195. package/dist/generated/types/restore-match-save-response.d.ts +1 -0
  196. package/dist/generated/types/restore-match-save-response.js +2 -0
  197. package/dist/generated/types/return-lobby-match-request.d.ts +1 -0
  198. package/dist/generated/types/return-lobby-match-request.js +2 -0
  199. package/dist/generated/types/return-tournament-match-request.d.ts +1 -0
  200. package/dist/generated/types/return-tournament-match-request.js +2 -0
  201. package/dist/generated/types/save-match-request.d.ts +1 -0
  202. package/dist/generated/types/save-match-request.js +2 -0
  203. package/dist/generated/types/server-message.d.ts +1 -0
  204. package/dist/generated/types/server-message.js +2 -0
  205. package/dist/generated/types/set-ai-paused-request.d.ts +1 -0
  206. package/dist/generated/types/set-ai-paused-request.js +2 -0
  207. package/dist/generated/types/set-ai-paused-response.d.ts +1 -0
  208. package/dist/generated/types/set-ai-paused-response.js +2 -0
  209. package/dist/generated/types/set-ranked-admission-request.d.ts +1 -0
  210. package/dist/generated/types/set-ranked-admission-request.js +2 -0
  211. package/dist/generated/types/set-simulator-maintenance-request.d.ts +1 -0
  212. package/dist/generated/types/set-simulator-maintenance-request.js +2 -0
  213. package/dist/generated/types/simulator-admin-status-response.d.ts +1 -0
  214. package/dist/generated/types/simulator-admin-status-response.js +2 -0
  215. package/dist/generated/types/simulator-availability-response.d.ts +1 -0
  216. package/dist/generated/types/simulator-availability-response.js +2 -0
  217. package/dist/generated/types/simulator-report-list-response.d.ts +1 -0
  218. package/dist/generated/types/simulator-report-list-response.js +2 -0
  219. package/dist/generated/types/simulator-report-response.d.ts +1 -0
  220. package/dist/generated/types/simulator-report-response.js +2 -0
  221. package/dist/generated/types/spectate-lobby-request.d.ts +1 -0
  222. package/dist/generated/types/spectate-lobby-request.js +2 -0
  223. package/dist/generated/types/spectate-match-request.d.ts +1 -0
  224. package/dist/generated/types/spectate-match-request.js +2 -0
  225. package/dist/generated/types/start-lobby-limited-match-request.d.ts +1 -0
  226. package/dist/generated/types/start-lobby-limited-match-request.js +2 -0
  227. package/dist/generated/types/start-lobby-request.d.ts +1 -0
  228. package/dist/generated/types/start-lobby-request.js +2 -0
  229. package/dist/generated/types/start-tournament-event-request.d.ts +1 -0
  230. package/dist/generated/types/start-tournament-event-request.js +2 -0
  231. package/dist/generated/types/stats-response.d.ts +5 -0
  232. package/dist/generated/types/stats-response.js +2 -0
  233. package/dist/generated/types/submit-lobby-limited-deck-request.d.ts +1 -0
  234. package/dist/generated/types/submit-lobby-limited-deck-request.js +2 -0
  235. package/dist/generated/types/submit-match-deck-request.d.ts +1 -0
  236. package/dist/generated/types/submit-match-deck-request.js +2 -0
  237. package/dist/generated/types/submit-match-deck-response.d.ts +1 -0
  238. package/dist/generated/types/submit-match-deck-response.js +2 -0
  239. package/dist/generated/types/submit-tournament-deck-request.d.ts +1 -0
  240. package/dist/generated/types/submit-tournament-deck-request.js +2 -0
  241. package/dist/generated/types/tournament-event-command-request.d.ts +1 -0
  242. package/dist/generated/types/tournament-event-command-request.js +2 -0
  243. package/dist/generated/types/tournament-room-access-response.d.ts +1 -0
  244. package/dist/generated/types/tournament-room-access-response.js +2 -0
  245. package/dist/generated/types/tournament-room-chat-request.d.ts +1 -0
  246. package/dist/generated/types/tournament-room-chat-request.js +2 -0
  247. package/dist/generated/types/tournament-room-chat-response.d.ts +1 -0
  248. package/dist/generated/types/tournament-room-chat-response.js +2 -0
  249. package/dist/generated/types/tournament-room-list-response.d.ts +1 -0
  250. package/dist/generated/types/tournament-room-list-response.js +2 -0
  251. package/dist/generated/types/tournament-room-response.d.ts +1 -0
  252. package/dist/generated/types/tournament-room-response.js +2 -0
  253. package/dist/generated/types/tournament-room-server-message.d.ts +1 -0
  254. package/dist/generated/types/tournament-room-server-message.js +2 -0
  255. package/dist/generated/types/tournament-room-sync-request.d.ts +1 -0
  256. package/dist/generated/types/tournament-room-sync-request.js +2 -0
  257. package/dist/generated/types/undo-match-request.d.ts +1 -0
  258. package/dist/generated/types/undo-match-request.js +2 -0
  259. package/dist/generated/types/undo-match-response.d.ts +1 -0
  260. package/dist/generated/types/undo-match-response.js +2 -0
  261. package/dist/generated/types/undo-respond-match-request.d.ts +1 -0
  262. package/dist/generated/types/undo-respond-match-request.js +2 -0
  263. package/dist/generated/types/update-lobby-ai-player-request.d.ts +1 -0
  264. package/dist/generated/types/update-lobby-ai-player-request.js +2 -0
  265. package/dist/generated/types/update-lobby-player-request.d.ts +1 -0
  266. package/dist/generated/types/update-lobby-player-request.js +2 -0
  267. package/dist/generated/types/update-lobby-settings-request.d.ts +1 -0
  268. package/dist/generated/types/update-lobby-settings-request.js +2 -0
  269. package/dist/generated/types/update-tournament-room-player-request.d.ts +1 -0
  270. package/dist/generated/types/update-tournament-room-player-request.js +2 -0
  271. package/dist/generated/types/update-tournament-room-settings-request.d.ts +1 -0
  272. package/dist/generated/types/update-tournament-room-settings-request.js +2 -0
  273. package/dist/generated/types/update-tournament-table-deck-request.d.ts +123 -0
  274. package/dist/generated/types/update-tournament-table-deck-request.js +2 -0
  275. package/dist/generated/types/welcome-payload.d.ts +1 -0
  276. package/dist/generated/types/welcome-payload.js +2 -0
  277. package/dist/generated/version.d.ts +16 -0
  278. package/dist/generated/version.js +16 -0
  279. package/dist/http/abort.d.ts +57 -0
  280. package/dist/http/abort.js +60 -0
  281. package/dist/http/json.d.ts +13 -0
  282. package/dist/http/json.js +24 -0
  283. package/dist/http/options.d.ts +40 -0
  284. package/dist/http/options.js +1 -0
  285. package/dist/http/request.d.ts +64 -0
  286. package/dist/http/request.js +182 -0
  287. package/dist/http/validated-json.d.ts +9 -0
  288. package/dist/http/validated-json.js +14 -0
  289. package/dist/index.d.ts +39 -0
  290. package/dist/index.js +10 -0
  291. package/dist/internal/abort-error.d.ts +91 -0
  292. package/dist/internal/abort-error.js +62 -0
  293. package/dist/internal/authenticated-socket-session.d.ts +63 -0
  294. package/dist/internal/authenticated-socket-session.js +170 -0
  295. package/dist/internal/emitter.d.ts +18 -0
  296. package/dist/internal/emitter.js +34 -0
  297. package/dist/internal/errors.d.ts +233 -0
  298. package/dist/internal/errors.js +238 -0
  299. package/dist/internal/limits.d.ts +13 -0
  300. package/dist/internal/limits.js +13 -0
  301. package/dist/internal/reconnect-backoff.d.ts +33 -0
  302. package/dist/internal/reconnect-backoff.js +25 -0
  303. package/dist/internal/socket-frame.d.ts +43 -0
  304. package/dist/internal/socket-frame.js +47 -0
  305. package/dist/internal/transport.d.ts +78 -0
  306. package/dist/internal/transport.js +18 -0
  307. package/dist/internal/websocket-event.d.ts +15 -0
  308. package/dist/internal/websocket-event.js +31 -0
  309. package/dist/local/assets.d.ts +96 -0
  310. package/dist/local/assets.js +235 -0
  311. package/dist/local/client.d.ts +32 -0
  312. package/dist/local/client.js +211 -0
  313. package/dist/local/engine.d.ts +79 -0
  314. package/dist/local/engine.js +6 -0
  315. package/dist/local/index.d.ts +20 -0
  316. package/dist/local/index.js +17 -0
  317. package/dist/local/offline-engine.d.ts +46 -0
  318. package/dist/local/offline-engine.js +74 -0
  319. package/dist/local/protocol.d.ts +95 -0
  320. package/dist/local/protocol.js +10 -0
  321. package/dist/local/routing.d.ts +52 -0
  322. package/dist/local/routing.js +193 -0
  323. package/dist/local/server/ai-scheduler.d.ts +31 -0
  324. package/dist/local/server/ai-scheduler.js +93 -0
  325. package/dist/local/server/http-router.d.ts +35 -0
  326. package/dist/local/server/http-router.js +185 -0
  327. package/dist/local/server/index.d.ts +16 -0
  328. package/dist/local/server/index.js +140 -0
  329. package/dist/local/server/sockets.d.ts +25 -0
  330. package/dist/local/server/sockets.js +141 -0
  331. package/dist/local/wasm-engine.d.ts +61 -0
  332. package/dist/local/wasm-engine.js +63 -0
  333. package/dist/local/worker-boot.d.ts +17 -0
  334. package/dist/local/worker-boot.js +76 -0
  335. package/dist/local/worker.d.ts +6 -0
  336. package/dist/local/worker.js +9 -0
  337. package/dist/match-session/access.d.ts +6 -0
  338. package/dist/match-session/access.js +8 -0
  339. package/dist/match-session/controller.d.ts +63 -0
  340. package/dist/match-session/controller.js +513 -0
  341. package/dist/match-session/errors.d.ts +3 -0
  342. package/dist/match-session/errors.js +34 -0
  343. package/dist/match-session/methods.d.ts +433 -0
  344. package/dist/match-session/methods.js +1 -0
  345. package/dist/match-session/session-state.d.ts +235 -0
  346. package/dist/match-session/session-state.js +1 -0
  347. package/dist/match-session/types.d.ts +56 -0
  348. package/dist/match-session/types.js +1 -0
  349. package/dist/match-session.d.ts +3 -0
  350. package/dist/match-session.js +1 -0
  351. package/dist/messages.d.ts +195 -0
  352. package/dist/messages.js +240 -0
  353. package/dist/resources/admin.d.ts +63 -0
  354. package/dist/resources/admin.js +75 -0
  355. package/dist/resources/card-deck-json.d.ts +11 -0
  356. package/dist/resources/card-deck-json.js +164 -0
  357. package/dist/resources/card-resolution.d.ts +9 -0
  358. package/dist/resources/card-resolution.js +21 -0
  359. package/dist/resources/card-resource.d.ts +157 -0
  360. package/dist/resources/card-resource.js +28 -0
  361. package/dist/resources/card-types.d.ts +203 -0
  362. package/dist/resources/card-types.js +1 -0
  363. package/dist/resources/cards.d.ts +3 -0
  364. package/dist/resources/cards.js +1 -0
  365. package/dist/resources/limited-event-types.d.ts +252 -0
  366. package/dist/resources/limited-event-types.js +1 -0
  367. package/dist/resources/limited-events.d.ts +7 -0
  368. package/dist/resources/limited-events.js +49 -0
  369. package/dist/resources/lobbies.d.ts +53 -0
  370. package/dist/resources/lobbies.js +50 -0
  371. package/dist/resources/lobby-list-session.d.ts +13 -0
  372. package/dist/resources/lobby-list-session.js +198 -0
  373. package/dist/resources/lobby-session.d.ts +9 -0
  374. package/dist/resources/lobby-session.js +59 -0
  375. package/dist/resources/lobby-types.d.ts +357 -0
  376. package/dist/resources/lobby-types.js +1 -0
  377. package/dist/resources/match-history.d.ts +49 -0
  378. package/dist/resources/match-history.js +34 -0
  379. package/dist/resources/match-types.d.ts +448 -0
  380. package/dist/resources/match-types.js +1 -0
  381. package/dist/resources/matches.d.ts +16 -0
  382. package/dist/resources/matches.js +109 -0
  383. package/dist/resources/ranked.d.ts +24 -0
  384. package/dist/resources/ranked.js +47 -0
  385. package/dist/resources/session.d.ts +62 -0
  386. package/dist/resources/session.js +26 -0
  387. package/dist/resources/system.d.ts +51 -0
  388. package/dist/resources/system.js +9 -0
  389. package/dist/resources/tournament-room-session.d.ts +9 -0
  390. package/dist/resources/tournament-room-session.js +53 -0
  391. package/dist/resources/tournament-room-types.d.ts +44 -0
  392. package/dist/resources/tournament-room-types.js +1 -0
  393. package/dist/resources/tournament-rooms.d.ts +33 -0
  394. package/dist/resources/tournament-rooms.js +33 -0
  395. package/dist/session.d.ts +56 -0
  396. package/dist/session.js +1 -0
  397. package/dist/types.d.ts +73 -0
  398. package/dist/types.js +27 -0
  399. package/dist/validators/ajv.d.ts +51 -0
  400. package/dist/validators/ajv.js +121 -0
  401. package/dist/validators/discriminants.d.ts +36 -0
  402. package/dist/validators/discriminants.js +89 -0
  403. package/dist/validators/validator.d.ts +73 -0
  404. package/dist/validators/validator.js +26 -0
  405. package/dist/validators/warm-up.d.ts +25 -0
  406. package/dist/validators/warm-up.js +59 -0
  407. package/dist/validators.d.ts +173 -0
  408. package/dist/validators.js +85 -0
  409. package/package.json +88 -0
  410. package/schema/abandon-match-request.schema.json +15 -0
  411. package/schema/abandon-match-response.schema.json +15 -0
  412. package/schema/add-lobby-ai-player-request.schema.json +53 -0
  413. package/schema/api-error-response.schema.json +13 -0
  414. package/schema/card-catalog-refresh-response.schema.json +31 -0
  415. package/schema/cards-response.schema.json +17 -0
  416. package/schema/client-message.schema.json +203 -0
  417. package/schema/close-tournament-room-request.schema.json +18 -0
  418. package/schema/common.schema.json +14129 -0
  419. package/schema/create-limited-event-request.schema.json +60 -0
  420. package/schema/create-lobby-request.schema.json +67 -0
  421. package/schema/create-match-request.schema.json +124 -0
  422. package/schema/create-meta-window-request.schema.json +27 -0
  423. package/schema/create-tournament-room-request.schema.json +104 -0
  424. package/schema/create-tournament-table-request.schema.json +14 -0
  425. package/schema/error-payload.schema.json +34 -0
  426. package/schema/format-event-request.schema.json +20 -0
  427. package/schema/format-event-response.schema.json +15 -0
  428. package/schema/game-command.schema.json +775 -0
  429. package/schema/game-event.schema.json +2012 -0
  430. package/schema/game-state.schema.json +273 -0
  431. package/schema/get-match-response.schema.json +13 -0
  432. package/schema/health-response.schema.json +13 -0
  433. package/schema/join-limited-event-request.schema.json +6 -0
  434. package/schema/join-lobby-request.schema.json +40 -0
  435. package/schema/join-match-request.schema.json +79 -0
  436. package/schema/join-tournament-room-request.schema.json +39 -0
  437. package/schema/join-tournament-table-request.schema.json +14 -0
  438. package/schema/kick-lobby-player-request.schema.json +13 -0
  439. package/schema/kick-lobby-spectator-request.schema.json +14 -0
  440. package/schema/leave-lobby-request.schema.json +13 -0
  441. package/schema/leave-match-request.schema.json +15 -0
  442. package/schema/leave-match-response.schema.json +15 -0
  443. package/schema/leave-tournament-room-request.schema.json +14 -0
  444. package/schema/limited-event-access-response.schema.json +34 -0
  445. package/schema/limited-event-command-request.schema.json +20 -0
  446. package/schema/limited-event-preflight-response.schema.json +25 -0
  447. package/schema/limited-event-response.schema.json +15 -0
  448. package/schema/list-active-ai-matches-request.schema.json +23 -0
  449. package/schema/list-active-ai-matches-response.schema.json +17 -0
  450. package/schema/lobby-access-response.schema.json +31 -0
  451. package/schema/lobby-chat-request.schema.json +17 -0
  452. package/schema/lobby-chat-response.schema.json +17 -0
  453. package/schema/lobby-list-response.schema.json +16 -0
  454. package/schema/lobby-list-server-message.schema.json +49 -0
  455. package/schema/lobby-matchmaking-decision-request.schema.json +13 -0
  456. package/schema/lobby-matchmaking-request.schema.json +80 -0
  457. package/schema/lobby-response.schema.json +13 -0
  458. package/schema/lobby-server-message.schema.json +155 -0
  459. package/schema/lobby-sync-request.schema.json +13 -0
  460. package/schema/manifest.json +124 -0
  461. package/schema/match-access-response.schema.json +32 -0
  462. package/schema/match-chat-lookup-response.schema.json +34 -0
  463. package/schema/match-connection-role.schema.json +9 -0
  464. package/schema/match-history-deck-stats-request.schema.json +26 -0
  465. package/schema/match-history-deck-stats-response.schema.json +17 -0
  466. package/schema/match-history-entry.schema.json +78 -0
  467. package/schema/match-history-list-request.schema.json +48 -0
  468. package/schema/match-history-list-response.schema.json +25 -0
  469. package/schema/match-history-replay-request.schema.json +17 -0
  470. package/schema/match-history-replay-response.schema.json +14 -0
  471. package/schema/match-history-restore-request.schema.json +23 -0
  472. package/schema/match-save-payload.schema.json +71 -0
  473. package/schema/match-spectator-access-response.schema.json +22 -0
  474. package/schema/meta-window.schema.json +37 -0
  475. package/schema/meta-windows-response.schema.json +24 -0
  476. package/schema/prepare-lobby-limited-ai-decks-request.schema.json +14 -0
  477. package/schema/ranked-admin-status.schema.json +43 -0
  478. package/schema/ranked-leaderboard-entry.schema.json +61 -0
  479. package/schema/ranked-leaderboard-query.schema.json +34 -0
  480. package/schema/ranked-leaderboard-response.schema.json +23 -0
  481. package/schema/ranked-matchmaking-view.schema.json +15 -0
  482. package/schema/ranked-profile-request.schema.json +21 -0
  483. package/schema/ranked-profile-response.schema.json +59 -0
  484. package/schema/ranked-queue.schema.json +12 -0
  485. package/schema/rematch-match-request.schema.json +20 -0
  486. package/schema/rematch-match-response.schema.json +61 -0
  487. package/schema/resolve-card-ids-request.schema.json +17 -0
  488. package/schema/resolve-card-ids-response.schema.json +16 -0
  489. package/schema/restore-history-response.schema.json +15 -0
  490. package/schema/restore-match-save-request.schema.json +20 -0
  491. package/schema/restore-match-save-response.schema.json +29 -0
  492. package/schema/return-lobby-match-request.schema.json +13 -0
  493. package/schema/return-tournament-match-request.schema.json +14 -0
  494. package/schema/route-manifest.json +1014 -0
  495. package/schema/save-match-request.schema.json +15 -0
  496. package/schema/server-message.schema.json +192 -0
  497. package/schema/set-ai-paused-request.schema.json +19 -0
  498. package/schema/set-ai-paused-response.schema.json +18 -0
  499. package/schema/set-ranked-admission-request.schema.json +15 -0
  500. package/schema/set-simulator-maintenance-request.schema.json +20 -0
  501. package/schema/simulator-admin-status-response.schema.json +37 -0
  502. package/schema/simulator-availability-response.schema.json +27 -0
  503. package/schema/simulator-report-list-response.schema.json +23 -0
  504. package/schema/simulator-report-response.schema.json +77 -0
  505. package/schema/spectate-lobby-request.schema.json +32 -0
  506. package/schema/spectate-match-request.schema.json +32 -0
  507. package/schema/start-lobby-limited-match-request.schema.json +13 -0
  508. package/schema/start-lobby-request.schema.json +13 -0
  509. package/schema/start-tournament-event-request.schema.json +14 -0
  510. package/schema/submit-lobby-limited-deck-request.schema.json +33 -0
  511. package/schema/submit-match-deck-request.schema.json +45 -0
  512. package/schema/submit-match-deck-response.schema.json +14 -0
  513. package/schema/submit-tournament-deck-request.schema.json +34 -0
  514. package/schema/tournament-event-command-request.schema.json +18 -0
  515. package/schema/tournament-room-access-response.schema.json +32 -0
  516. package/schema/tournament-room-chat-request.schema.json +18 -0
  517. package/schema/tournament-room-chat-response.schema.json +18 -0
  518. package/schema/tournament-room-list-response.schema.json +17 -0
  519. package/schema/tournament-room-response.schema.json +14 -0
  520. package/schema/tournament-room-server-message.schema.json +127 -0
  521. package/schema/tournament-room-sync-request.schema.json +14 -0
  522. package/schema/undo-match-request.schema.json +14 -0
  523. package/schema/undo-match-response.schema.json +14 -0
  524. package/schema/undo-respond-match-request.schema.json +19 -0
  525. package/schema/update-lobby-ai-player-request.schema.json +65 -0
  526. package/schema/update-lobby-player-request.schema.json +81 -0
  527. package/schema/update-lobby-settings-request.schema.json +70 -0
  528. package/schema/update-tournament-room-player-request.schema.json +45 -0
  529. package/schema/update-tournament-room-settings-request.schema.json +33 -0
  530. package/schema/welcome-payload.schema.json +38 -0
@@ -0,0 +1,62 @@
1
+ import type { MatchSession, MatchSessionAccess, MatchSessionOptions } from '../match-session.js';
2
+ import type { WebSocketFactory } from '../internal/transport.js';
3
+ import type { SchemaValidator } from '../validators/validator.js';
4
+ import type { MatchesResource } from './matches.js';
5
+ /**
6
+ * Session resource for creating SDK-owned match sessions.
7
+ *
8
+ * A `MatchSession` stores private access, owns one live socket at a time, and
9
+ * keeps renderable token-free state for UI consumers.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { createSimulatorClient } from '@my-swu/simulator-client'
14
+ *
15
+ * const simulatorClient = createSimulatorClient({
16
+ * baseUrl: 'http://127.0.0.1:4000',
17
+ * })
18
+ * const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
19
+ *
20
+ * const matchSession = simulatorClient.session.create(hostAccess)
21
+ * console.log(matchSession.connectionState)
22
+ * ```
23
+ *
24
+ * @see https://simulator-sdk.my-swu.com/guide/match-session
25
+ */
26
+ export interface SessionResource {
27
+ /**
28
+ * Creates one idle or access-seeded match session.
29
+ *
30
+ * Seed with access when you already created or joined a match. Omit access
31
+ * when the session will call `createMatch()` or `joinMatch()` itself.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { createSimulatorClient } from '@my-swu/simulator-client'
36
+ *
37
+ * const simulatorClient = createSimulatorClient({
38
+ * baseUrl: 'http://127.0.0.1:4000',
39
+ * })
40
+ * const hostAccess = { matchId: 'match_123', seatToken: 'seat_token_123' }
41
+ *
42
+ * const matchSession = simulatorClient.session.create(hostAccess)
43
+ * await matchSession.connect()
44
+ * ```
45
+ *
46
+ * @see https://simulator-sdk.my-swu.com/guide/match-lifecycle#session
47
+ */
48
+ create(access?: MatchSessionAccess, options?: MatchSessionOptions): MatchSession;
49
+ }
50
+ /** Dependencies required by the session resource. */
51
+ export interface SessionResourceOptions {
52
+ /** HTTP match resource used by session lifecycle helpers. */
53
+ matches: MatchesResource;
54
+ /** Boundary validator applied to match socket frames and envelopes. */
55
+ validate?: SchemaValidator | undefined;
56
+ /** Optional socket factory for runtimes without global `WebSocket`. */
57
+ webSocketFactory?: WebSocketFactory | undefined;
58
+ /** Base WebSocket URL ending at `/ws`. */
59
+ wsUrl: string;
60
+ }
61
+ /** Creates the high-level match session resource. */
62
+ export declare function createSessionResource(options: SessionResourceOptions): SessionResource;
@@ -0,0 +1,26 @@
1
+ import { MatchConnection } from '../connection.js';
2
+ import { MatchSessionController } from '../match-session.js';
3
+ /** Creates the high-level match session resource. */
4
+ export function createSessionResource(options) {
5
+ return {
6
+ create: (access, sessionOptions) => new MatchSessionController({
7
+ access,
8
+ matches: options.matches,
9
+ openConnection: (connectionAccess, connectOptions) => MatchConnection.connect({
10
+ matchId: connectionAccess.matchId,
11
+ ...connectionAccessToken(connectionAccess),
12
+ wsUrl: options.wsUrl,
13
+ ...(options.validate == null ? {} : { validate: options.validate }),
14
+ ...(connectOptions?.handshakeTimeoutMs == null ? {} : { handshakeTimeoutMs: connectOptions.handshakeTimeoutMs }),
15
+ ...(options.webSocketFactory == null ? {} : { webSocketFactory: options.webSocketFactory }),
16
+ }),
17
+ options: sessionOptions,
18
+ }),
19
+ };
20
+ }
21
+ /** Extracts the socket credential from a player or spectator access object. */
22
+ function connectionAccessToken(access) {
23
+ return 'spectatorToken' in access
24
+ ? { spectatorToken: access.spectatorToken }
25
+ : { seatToken: access.seatToken };
26
+ }
@@ -0,0 +1,51 @@
1
+ import type { HealthResponse, SimulatorAvailabilityResponse } from '../generated/index.js';
2
+ import type { SimulatorRequestOptions } from '../http/options.js';
3
+ import type { EngineHttpRequester } from '../http/request.js';
4
+ /**
5
+ * System-level API methods.
6
+ *
7
+ * Use these calls for lightweight reachability checks and operational status
8
+ * before starting match flows.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { createSimulatorClient } from '@my-swu/simulator-client'
13
+ *
14
+ * const simulatorClient = createSimulatorClient({
15
+ * baseUrl: 'http://127.0.0.1:4000',
16
+ * })
17
+ *
18
+ * const health = await simulatorClient.system.health()
19
+ * console.log(health.status)
20
+ * ```
21
+ *
22
+ * @see https://simulator-sdk.my-swu.com/guide/http-client
23
+ */
24
+ export interface SystemResource {
25
+ /**
26
+ * Calls the simulator liveness probe.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { createSimulatorClient } from '@my-swu/simulator-client'
31
+ *
32
+ * const simulatorClient = createSimulatorClient({
33
+ * baseUrl: 'http://127.0.0.1:4000',
34
+ * })
35
+ *
36
+ * const health = await simulatorClient.system.health()
37
+ * console.log(health.status)
38
+ * ```
39
+ *
40
+ * @see https://simulator-sdk.my-swu.com/guide/http-client#health-checks
41
+ */
42
+ health(options?: SimulatorRequestOptions): Promise<HealthResponse>;
43
+ /**
44
+ * Returns whether the simulator is accepting new matches/sessions.
45
+ */
46
+ availability(options?: SimulatorRequestOptions): Promise<SimulatorAvailabilityResponse>;
47
+ }
48
+ /**
49
+ * Creates the system resource client.
50
+ */
51
+ export declare function createSystemResource(requester: EngineHttpRequester): SystemResource;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Creates the system resource client.
3
+ */
4
+ export function createSystemResource(requester) {
5
+ return {
6
+ health: options => requester.request('health-response', '/health', {}, options),
7
+ availability: options => requester.request('simulator-availability-response', '/api/availability', {}, options),
8
+ };
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { WebSocketFactory } from '../internal/transport.js';
2
+ import type { SchemaValidator } from '../validators/validator.js';
3
+ import type { TournamentRoomAccessInput, TournamentRoomAccessResponse, TournamentRoomSession } from './tournament-room-types.js';
4
+ export declare function createTournamentRoomSession(options: {
5
+ access: TournamentRoomAccessInput | TournamentRoomAccessResponse;
6
+ validate?: SchemaValidator | undefined;
7
+ webSocketFactory: WebSocketFactory;
8
+ wsUrl: string;
9
+ }): TournamentRoomSession;
@@ -0,0 +1,53 @@
1
+ import { AuthenticatedSocketSessionController, authenticatedSocketUrl, } from '../internal/authenticated-socket-session.js';
2
+ import { simulatorSocketErrorPayload } from '../internal/errors.js';
3
+ export function createTournamentRoomSession(options) {
4
+ return new TournamentRoomSessionController({
5
+ access: normalizeTournamentRoomAccess(options.access),
6
+ webSocketFactory: options.webSocketFactory,
7
+ wsUrl: options.wsUrl,
8
+ ...(options.validate == null ? {} : { validate: options.validate }),
9
+ });
10
+ }
11
+ function normalizeTournamentRoomAccess(access) {
12
+ return {
13
+ roomId: access.roomId,
14
+ playerToken: access.playerToken,
15
+ };
16
+ }
17
+ class TournamentRoomSessionController extends AuthenticatedSocketSessionController {
18
+ constructor(options) {
19
+ super({
20
+ messageSchema: 'tournament-room-server-message',
21
+ playerToken: options.access.playerToken,
22
+ socketError: info => simulatorSocketErrorPayload(info),
23
+ socketUrl: authenticatedSocketUrl(options.wsUrl, `tournament-rooms/${encodeURIComponent(options.access.roomId)}`),
24
+ webSocketFactory: options.webSocketFactory,
25
+ ...(options.validate == null ? {} : { validate: options.validate }),
26
+ });
27
+ }
28
+ handleServerMessage(message) {
29
+ switch (message.type) {
30
+ case 'welcome':
31
+ this.emit('welcome', message.payload);
32
+ break;
33
+ case 'snapshot':
34
+ this.setSnapshot(message.payload);
35
+ break;
36
+ case 'chatMessage':
37
+ this.emit('chatMessage', message.payload);
38
+ break;
39
+ case 'playerPresence':
40
+ this.emit('playerPresence', message.payload);
41
+ break;
42
+ case 'matchReady':
43
+ this.emit('matchReady', message.payload);
44
+ break;
45
+ case 'error':
46
+ this.pushError(message.payload);
47
+ break;
48
+ case 'pong':
49
+ this.emit('pong', message.payload);
50
+ break;
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,44 @@
1
+ import type { CloseTournamentRoomRequest, CreateTournamentRoomRequest, CreateTournamentTableRequest, JoinTournamentRoomRequest, JoinTournamentTableRequest, LeaveTournamentRoomRequest, ReturnTournamentMatchRequest, StartTournamentEventRequest, SubmitTournamentDeckRequest, TournamentEventCommandRequest, TournamentRoomAccessResponse, TournamentRoomChatRequest, TournamentRoomChatResponse, TournamentRoomListResponse, TournamentRoomResponse, TournamentRoomServerMessage, TournamentRoomSyncRequest, UpdateTournamentRoomPlayerRequest, UpdateTournamentRoomSettingsRequest } from '../generated/index.js';
2
+ import type { PublicTournamentRoomSummary } from '../generated/types/tournament-room-list-response.js';
3
+ import type { TournamentRoomSnapshot } from '../generated/types/tournament-room-response.js';
4
+ import type { ErrorPayload, LobbyChatMessage, TournamentRoomMatchReadyPayload, TournamentRoomWelcomePayload } from '../generated/types/tournament-room-server-message.js';
5
+ import type { ConnectionState } from '../session.js';
6
+ import type { RoomPlayerPresenceEvent } from './lobby-types.js';
7
+ export type { CloseTournamentRoomRequest, CreateTournamentRoomRequest, CreateTournamentTableRequest, JoinTournamentRoomRequest, JoinTournamentTableRequest, LeaveTournamentRoomRequest, ReturnTournamentMatchRequest, StartTournamentEventRequest, SubmitTournamentDeckRequest, TournamentEventCommandRequest, TournamentRoomAccessResponse, TournamentRoomChatRequest, TournamentRoomChatResponse, TournamentRoomListResponse, TournamentRoomResponse, TournamentRoomServerMessage, TournamentRoomSyncRequest, UpdateTournamentRoomPlayerRequest, UpdateTournamentRoomSettingsRequest, };
8
+ export type { PublicTournamentRoomSummary, TournamentRoomSnapshot };
9
+ export type { RoomPlayerPresenceEvent } from './lobby-types.js';
10
+ /** Minimal private tournament room credentials. */
11
+ export interface TournamentRoomAccessInput {
12
+ roomId: string;
13
+ playerToken: string;
14
+ }
15
+ /** Events emitted by a tournament room websocket session. */
16
+ export interface TournamentRoomSessionEvents {
17
+ welcome: TournamentRoomWelcomePayload;
18
+ snapshot: TournamentRoomSnapshot;
19
+ chatMessage: LobbyChatMessage;
20
+ playerPresence: RoomPlayerPresenceEvent;
21
+ matchReady: TournamentRoomMatchReadyPayload;
22
+ error: ErrorPayload;
23
+ pong: Extract<TournamentRoomServerMessage, {
24
+ type: 'pong';
25
+ }>['payload'];
26
+ message: TournamentRoomServerMessage;
27
+ connectionState: ConnectionState;
28
+ change: {
29
+ connectionState: ConnectionState;
30
+ errors: readonly ErrorPayload[];
31
+ snapshot: TournamentRoomSnapshot | undefined;
32
+ };
33
+ }
34
+ /** Live tournament room websocket controller. */
35
+ export interface TournamentRoomSession {
36
+ readonly connectionState: ConnectionState;
37
+ readonly errorMessages: readonly string[];
38
+ readonly errors: readonly TournamentRoomSessionEvents['error'][];
39
+ readonly snapshot: TournamentRoomSnapshot | undefined;
40
+ connect(): Promise<TournamentRoomSession>;
41
+ close(): void;
42
+ on<TKey extends keyof TournamentRoomSessionEvents>(event: TKey, listener: (value: TournamentRoomSessionEvents[TKey]) => void): () => void;
43
+ ping(nonce?: string): void;
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { SimulatorRequestOptions } from '../http/options.js';
2
+ import type { EngineHttpRequester } from '../http/request.js';
3
+ import type { WebSocketFactory } from '../internal/transport.js';
4
+ import type { SchemaValidator } from '../validators/validator.js';
5
+ import type { CloseTournamentRoomRequest, CreateTournamentRoomRequest, CreateTournamentTableRequest, JoinTournamentRoomRequest, JoinTournamentTableRequest, LeaveTournamentRoomRequest, ReturnTournamentMatchRequest, StartTournamentEventRequest, SubmitTournamentDeckRequest, TournamentEventCommandRequest, TournamentRoomAccessInput, TournamentRoomAccessResponse, TournamentRoomChatRequest, TournamentRoomChatResponse, TournamentRoomListResponse, TournamentRoomResponse, TournamentRoomSession, TournamentRoomSnapshot, TournamentRoomSyncRequest, UpdateTournamentRoomPlayerRequest, UpdateTournamentRoomSettingsRequest } from './tournament-room-types.js';
6
+ export type * from './tournament-room-types.js';
7
+ export interface TournamentRoomsResource {
8
+ create(request: CreateTournamentRoomRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
9
+ list(options?: SimulatorRequestOptions): Promise<TournamentRoomListResponse>;
10
+ get(roomId: string, options?: SimulatorRequestOptions): Promise<TournamentRoomSnapshot>;
11
+ join(roomId: string, request: JoinTournamentRoomRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
12
+ sync(roomId: string, request: TournamentRoomSyncRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
13
+ updatePlayer(roomId: string, request: UpdateTournamentRoomPlayerRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
14
+ updateSettings(roomId: string, request: UpdateTournamentRoomSettingsRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
15
+ sendChat(roomId: string, request: TournamentRoomChatRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomChatResponse>;
16
+ startEvent(roomId: string, request: StartTournamentEventRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
17
+ applyEventCommand(roomId: string, request: TournamentEventCommandRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
18
+ submitDeck(roomId: string, request: SubmitTournamentDeckRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
19
+ createTable(roomId: string, request: CreateTournamentTableRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
20
+ joinTable(roomId: string, tableId: string, request: JoinTournamentTableRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
21
+ returnMatch(roomId: string, request: ReturnTournamentMatchRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
22
+ leave(roomId: string, request: LeaveTournamentRoomRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomAccessResponse>;
23
+ close(roomId: string, request: CloseTournamentRoomRequest, options?: SimulatorRequestOptions): Promise<TournamentRoomResponse>;
24
+ createSession(access: TournamentRoomAccessInput | TournamentRoomAccessResponse): TournamentRoomSession;
25
+ }
26
+ export interface TournamentRoomsResourceOptions {
27
+ requester: EngineHttpRequester;
28
+ /** Boundary validator applied to the tournament-room socket. */
29
+ validate?: SchemaValidator | undefined;
30
+ webSocketFactory?: WebSocketFactory | undefined;
31
+ wsUrl: string;
32
+ }
33
+ export declare function createTournamentRoomsResource(options: TournamentRoomsResourceOptions): TournamentRoomsResource;
@@ -0,0 +1,33 @@
1
+ import { createValidatedJsonPost } from '../http/validated-json.js';
2
+ import { getDefaultWebSocketFactory } from '../internal/transport.js';
3
+ import { createTournamentRoomSession } from './tournament-room-session.js';
4
+ export function createTournamentRoomsResource(options) {
5
+ const { requester } = options;
6
+ const webSocketFactory = options.webSocketFactory ?? getDefaultWebSocketFactory();
7
+ const jsonPost = createValidatedJsonPost(requester);
8
+ return {
9
+ applyEventCommand: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/event/commands`, jsonPost('tournament-event-command-request', request), options),
10
+ create: (request, options) => requester.request('tournament-room-access-response', '/api/tournament-rooms', jsonPost('create-tournament-room-request', request), options),
11
+ close: (roomId, request, options) => requester.request('tournament-room-response', `/api/tournament-rooms/${roomId}/close`, jsonPost('close-tournament-room-request', request), options),
12
+ createSession: access => createTournamentRoomSession({
13
+ access,
14
+ webSocketFactory,
15
+ wsUrl: options.wsUrl,
16
+ ...(options.validate == null ? {} : { validate: options.validate }),
17
+ }),
18
+ createTable: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/tables`, jsonPost('create-tournament-table-request', request), options),
19
+ get: (roomId, options) => requester.request('tournament-room-response', `/api/tournament-rooms/${roomId}`, {}, options)
20
+ .then(response => response.snapshot),
21
+ join: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/join`, jsonPost('join-tournament-room-request', request), options),
22
+ joinTable: (roomId, tableId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/tables/${tableId}/join`, jsonPost('join-tournament-table-request', request), options),
23
+ list: options => requester.request('tournament-room-list-response', '/api/tournament-rooms', {}, options),
24
+ leave: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/leave`, jsonPost('leave-tournament-room-request', request), options),
25
+ returnMatch: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/return-match`, jsonPost('return-tournament-match-request', request), options),
26
+ sendChat: (roomId, request, options) => requester.request('tournament-room-chat-response', `/api/tournament-rooms/${roomId}/chat`, jsonPost('tournament-room-chat-request', request), options),
27
+ startEvent: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/start-event`, jsonPost('start-tournament-event-request', request), options),
28
+ submitDeck: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/deck`, jsonPost('submit-tournament-deck-request', request), options),
29
+ sync: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/sync`, jsonPost('tournament-room-sync-request', request), options),
30
+ updatePlayer: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/players/me`, jsonPost('update-tournament-room-player-request', request), options),
31
+ updateSettings: (roomId, request, options) => requester.request('tournament-room-access-response', `/api/tournament-rooms/${roomId}/settings`, jsonPost('update-tournament-room-settings-request', request), options),
32
+ };
33
+ }
@@ -0,0 +1,56 @@
1
+ import type { AiStatusPayload, ErrorPayload, GameEvent, GameState, ServerMessage, WelcomePayload } from './generated/index.js';
2
+ import type { CardInteractionCue, MatchHistoryFeedEntry, MatchHistorySnapshot } from './generated/types/server-message.js';
3
+ /**
4
+ * Transport lifecycle state for one simulator socket session.
5
+ *
6
+ * `idle` means no socket has been opened yet, `connecting` means handshake is
7
+ * in progress, `open` means messages can flow, and `closed` means no active
8
+ * socket is attached.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import type { ConnectionState } from '@my-swu/simulator-client'
13
+ *
14
+ * const currentConnectionState: ConnectionState = 'idle'
15
+ * console.log(currentConnectionState)
16
+ * ```
17
+ *
18
+ * @see https://simulator-sdk.my-swu.com/guide/match-session
19
+ */
20
+ export type ConnectionState = 'idle' | 'connecting' | 'open' | 'closed';
21
+ /**
22
+ * Payload emitted on each server `pong` frame.
23
+ *
24
+ * The `nonce` echoes back whatever was sent in the matching `ping`, allowing
25
+ * consumers to measure round-trip latency.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import type { PongPayload } from '@my-swu/simulator-client'
30
+ *
31
+ * const latencyPong: PongPayload = { nonce: 'latency-check-1' }
32
+ * console.log(latencyPong.nonce)
33
+ * ```
34
+ *
35
+ * @see https://simulator-sdk.my-swu.com/guide/websocket#pong
36
+ */
37
+ export interface PongPayload {
38
+ nonce?: string | null;
39
+ [k: string]: unknown;
40
+ }
41
+ /**
42
+ * Internal typed event map used by the raw match socket connection.
43
+ */
44
+ export interface MatchConnectionEvents {
45
+ aiStatus: AiStatusPayload;
46
+ connectionState: ConnectionState;
47
+ error: ErrorPayload;
48
+ event: GameEvent;
49
+ interactionCue: CardInteractionCue;
50
+ historyEntry: MatchHistoryFeedEntry;
51
+ historySnapshot: MatchHistorySnapshot;
52
+ message: ServerMessage;
53
+ pong: PongPayload;
54
+ snapshot: GameState;
55
+ welcome: WelcomePayload;
56
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Hand-written re-exports for the inner view types defined inside the
3
+ * generated response files.
4
+ *
5
+ * The JSON Schema generator emits a separate `.ts` file per HTTP response
6
+ * (`get-match-response.ts`, `match-access-response.ts`,
7
+ * `format-event-response.ts`, …) and inlines every nested `$defs`
8
+ * definition into each one; the dedupe pass then collapses the copies into
9
+ * `generated/types/common.ts` and leaves the per-response files as pure
10
+ * re-exports. Nothing in that pipeline decides which nested types are
11
+ * *public*, so this module names them: each alias is sourced from the
12
+ * response module the type most obviously belongs to
13
+ * (`get-match-response.ts` mirrors `/api/matches/:id` and owns the gameplay
14
+ * views). Consumers that previously had to recover these via indexed access
15
+ * (`GameState["players"][number]`, `NonNullable<SeatState["hand"]>[number]`,
16
+ * …) can now `import type` directly from the SDK root.
17
+ *
18
+ * The set is closed under reference: if a type exported here names another
19
+ * generated type in one of its fields, that one is exported too, so a
20
+ * consumer never lands on an unnameable shape one level down.
21
+ *
22
+ * Add new aliases here when consumers ask for them — do not edit the
23
+ * generated files (they are rewritten on every `pnpm sdk:generate`) — and
24
+ * add the same name to the `./types.js` block in `index.ts`, which
25
+ * `test/type-smoke.test.ts` enforces.
26
+ */
27
+ export type { AiDifficulty, AiOpponentConfig, AiTrilogyFormatMode, FormatSetupInput, MatchScenarioInput, MctsConfigOverride, } from "./generated/types/create-match-request.js";
28
+ export type { AbilityWindow, ActionAbilitySource, ActionAbilityView, ActiveEffectDescriptionView, ActiveEffectView, AbilityTarget, AttachmentMode, AttackChoiceView, AttackTarget, AvailableAttackView, CapturedUnitView, CaptureOptionsView, CaptureSelection, CardArena, CardChoiceResourcePaymentOptionView, CardInstanceView, ConstructedFormat, CurrentAttackStateView, CurrentAttackView, DeckRegistrationView, DelayedEffectDescriptionView, DelayedEffectTimingView, DelayedEffectView, DistributionAssignment, DistributionDamageKindView, DistributionItemView, DistributionTargetView, DistributionTokenKindView, DynamicPowerLimit, EffectCardScopeView, EffectDurationView, EffectRestrictionView, EffectSourceView, EffectTargetView, ExploitOptionsView, FormatSeatView, GameTimerActiveClockView, GameTimerReserveView, GameTimerStateView, HiddenCardChoiceMode, HiddenZoneKind, InitiativeChoiceReason, InitiativeState, InstructedAttackView, LeaderActionView, LeaderDeployActionView, LeaderDeployCostView, LeaderDeployMode, LeaderDeployThresholdBonus, LeaderStateView, LimitedEventView, MatchEndReason, MatchFormat, MatchPhase, MatchResult, MatchSeriesView, MatchStatus, ModeChoiceView, NamedCardEffectDescriptionView, PendingAbilityAspectChoiceView, PendingAbilityAttackChoiceView, PendingAbilityCardChoiceView, PendingAbilityFamily, PendingAbilityModeChoiceView, PendingAbilityNameChoiceView, PendingAbilityOrderAbilityView, PendingAbilityOrderChoiceView, PendingAbilityOrderGroupView, PendingAbilityView, PendingChoiceView, PendingDistributionView, PendingUndoRequest, PlayActionView, PlayCardSourceView, PlayCardZone, PlayerTargetPattern, PresenceFilter, PromptState, RejectedPlayView, RelationFilter, ResourceCardView, ResourcePaymentOptionView, Seat, SeatDirection, SeatOfferIntent, SeatState, SelectionScope, SeriesEndReason, SeriesGameRecord, SeriesResultView, SharedCounterState, SmuggleActionView, SmuggleKind, TargetGroupPurpose, TargetSelectionGroup, TargetSelectionPlanView, TriggerWindowView, TwinSunsCounter, TwinSunsCountersView, UndoRequestReason, UniquenessFilter, UnitAbilitySuppressionView, UnitExtremum, UnitFilter, UnitStateView, UpgradeStateView, } from "./generated/types/get-match-response.js";
29
+ export type { AspectCount } from "./generated/types/cards-response.js";
30
+ export type { CloseTournamentRoomActiveMatches } from "./generated/types/close-tournament-room-request.js";
31
+ export type { CardDrawSource, TurnPassSource, UnitDefeatCause, } from "./generated/types/game-event.js";
32
+ export type { LimitedEventPreflightIssue } from "./generated/types/limited-event-preflight-response.js";
33
+ export type { DraftRoundConfig, LimitedCardSlot, LimitedCardTreatment, LimitedDeckSourceView, LimitedEventKind, LimitedEventPhaseView, LimitedEventSeatView, LimitedEventViewerView, LimitedPackCardView, } from "./generated/types/limited-event-response.js";
34
+ export type { ActiveAiMatchLimitScope } from "./generated/types/list-active-ai-matches-request.js";
35
+ export type { ActiveAiMatchRecoveryEntry } from "./generated/types/list-active-ai-matches-response.js";
36
+ export type { LobbyWelcomePayload } from "./generated/types/lobby-server-message.js";
37
+ export type { MatchHistoryDeckSummary } from "./generated/types/match-history-entry.js";
38
+ export type { MatchSaveSeat, UnitCopiedCardEntry, } from "./generated/types/match-save-payload.js";
39
+ export type { CardReferenceMatchView } from "./generated/types/resolve-card-ids-response.js";
40
+ export type { MaintenanceStatus, SimulatorRuntimeStats, } from "./generated/types/simulator-admin-status-response.js";
41
+ export type { TournamentRoomPrivateView } from "./generated/types/tournament-room-access-response.js";
42
+ export type { TournamentRoomPlayerView, TournamentRoomStatus, TournamentTableStatus, TournamentTableView, } from "./generated/types/tournament-room-response.js";
43
+ export type { TournamentRoomMatchReadyPayload, TournamentRoomWelcomePayload, } from "./generated/types/tournament-room-server-message.js";
44
+ export type { AiSeatStatusPayload } from "./generated/types/welcome-payload.js";
45
+ /**
46
+ * The SDK exposes `PromptState` as a tagged union (`"lobbyReady" | { mulligan: … } | …`),
47
+ * which is correct but inconvenient for UIs that walk every prompt
48
+ * variant with optional chaining and gate each branch with a separate
49
+ * `if (prompt.chooseAbilityCards) { … }`.
50
+ *
51
+ * `PromptShape` flattens the union into a record where every variant is
52
+ * an optional field. Consumers can read `prompt.chooseAbilityCards`
53
+ * without first narrowing through the discriminator. Cast a runtime
54
+ * `PromptState` to `PromptShape` at the boundary of UI code:
55
+ *
56
+ * ```ts
57
+ * import type { PromptShape, PromptState } from "@my-swu/simulator-client";
58
+ * const promptState: PromptState = {
59
+ * chooseAbilityCards: { abilityId: 1, max: 1, min: 1, seat: "one" },
60
+ * };
61
+ * const promptView = promptState as PromptShape;
62
+ * if (promptView.chooseAbilityCards) {
63
+ * // … access promptView.chooseAbilityCards.{abilityId,max,min,seat}
64
+ * }
65
+ * ```
66
+ *
67
+ * This is unsafe for fan-out narrowing (you can read every field on the
68
+ * `"lobbyReady"` branch and TypeScript won't catch it), so prefer the
69
+ * discriminated union when you need exhaustiveness checking.
70
+ */
71
+ export type PromptShape = {
72
+ [K in Exclude<import("./generated/types/get-match-response.js").PromptState, string> as keyof K]?: K[keyof K];
73
+ };
package/dist/types.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Hand-written re-exports for the inner view types defined inside the
3
+ * generated response files.
4
+ *
5
+ * The JSON Schema generator emits a separate `.ts` file per HTTP response
6
+ * (`get-match-response.ts`, `match-access-response.ts`,
7
+ * `format-event-response.ts`, …) and inlines every nested `$defs`
8
+ * definition into each one; the dedupe pass then collapses the copies into
9
+ * `generated/types/common.ts` and leaves the per-response files as pure
10
+ * re-exports. Nothing in that pipeline decides which nested types are
11
+ * *public*, so this module names them: each alias is sourced from the
12
+ * response module the type most obviously belongs to
13
+ * (`get-match-response.ts` mirrors `/api/matches/:id` and owns the gameplay
14
+ * views). Consumers that previously had to recover these via indexed access
15
+ * (`GameState["players"][number]`, `NonNullable<SeatState["hand"]>[number]`,
16
+ * …) can now `import type` directly from the SDK root.
17
+ *
18
+ * The set is closed under reference: if a type exported here names another
19
+ * generated type in one of its fields, that one is exported too, so a
20
+ * consumer never lands on an unnameable shape one level down.
21
+ *
22
+ * Add new aliases here when consumers ask for them — do not edit the
23
+ * generated files (they are rewritten on every `pnpm sdk:generate`) — and
24
+ * add the same name to the `./types.js` block in `index.ts`, which
25
+ * `test/type-smoke.test.ts` enforces.
26
+ */
27
+ export {};
@@ -0,0 +1,51 @@
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 { type ErrorObject } from 'ajv/dist/2020.js';
18
+ /**
19
+ * Looks up the compiled fast validator for one generated schema name.
20
+ *
21
+ * @param name Generated schema name.
22
+ * @returns The validator, or `undefined` when no such schema is registered.
23
+ */
24
+ export declare function getFastValidator(name: string): import("ajv/dist/core.js").AnyValidateFunction<unknown> | undefined;
25
+ /**
26
+ * Compiles the named schemas into the fast instance ahead of first use.
27
+ *
28
+ * Ajv compiles a registered schema the first time it is looked up, and that
29
+ * first compile drags in every shared definition it references — measured at
30
+ * ~215 ms for `server-message` against 2-42 ms for each schema after it. This
31
+ * exists so that cost can be paid at a moment of the caller's choosing rather
32
+ * than on the first frame off the wire. Unknown names are skipped; compiling
33
+ * an already-compiled schema is a no-op.
34
+ *
35
+ * @param names Generated schema names to compile.
36
+ */
37
+ export declare function compileSchemas(names: readonly string[]): void;
38
+ /**
39
+ * Rebuilds the complete, human-readable detail list for a failed payload.
40
+ *
41
+ * The fast validator reports only the first error, so the payload is replayed
42
+ * through the verbose instance. Both instances hold the same schemas, so the
43
+ * replay is expected to fail again with every error; if it somehow passes, or
44
+ * reports nothing, the fast instance's own errors are used so the thrown error
45
+ * is never empty.
46
+ *
47
+ * @param name Generated schema name the payload failed against.
48
+ * @param value The payload that failed fast validation.
49
+ * @param fastErrors Errors reported by the fast validator.
50
+ */
51
+ export declare function describeValidationErrors(name: string, value: unknown, fastErrors: ErrorObject[] | null | undefined): string[];