@hellacardgames/speed 0.5.3 → 0.6.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 (39) hide show
  1. package/dist/client/index.cjs.map +1 -1
  2. package/dist/client/index.d.cts +2 -2
  3. package/dist/client/index.d.cts.map +1 -1
  4. package/dist/client/index.d.mts +2 -2
  5. package/dist/client/index.d.mts.map +1 -1
  6. package/dist/client/index.mjs.map +1 -1
  7. package/dist/index-FveApXzq.d.cts +124 -0
  8. package/dist/index-FveApXzq.d.cts.map +1 -0
  9. package/dist/index-J8s2QklC.d.mts +124 -0
  10. package/dist/index-J8s2QklC.d.mts.map +1 -0
  11. package/dist/{index-BilCO_4a.d.cts → index-YAYbNr-s.d.cts} +42 -58
  12. package/dist/index-YAYbNr-s.d.cts.map +1 -0
  13. package/dist/{index-BilCO_4a.d.mts → index-YAYbNr-s.d.mts} +42 -58
  14. package/dist/index-YAYbNr-s.d.mts.map +1 -0
  15. package/dist/manager/index.cjs +2 -12
  16. package/dist/manager/index.d.cts +2 -2
  17. package/dist/manager/index.d.mts +2 -2
  18. package/dist/manager/index.mjs +2 -2
  19. package/dist/manager-BOymBQ4E.mjs +817 -0
  20. package/dist/manager-BOymBQ4E.mjs.map +1 -0
  21. package/dist/manager-BpKvQbcp.cjs +822 -0
  22. package/dist/manager-BpKvQbcp.cjs.map +1 -0
  23. package/dist/server/index.cjs +138 -157
  24. package/dist/server/index.cjs.map +1 -1
  25. package/dist/server/index.d.cts +3 -3
  26. package/dist/server/index.d.mts +3 -3
  27. package/dist/server/index.mjs +138 -157
  28. package/dist/server/index.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/index-BilCO_4a.d.cts.map +0 -1
  31. package/dist/index-BilCO_4a.d.mts.map +0 -1
  32. package/dist/index-DSPZZlhq.d.cts +0 -143
  33. package/dist/index-DSPZZlhq.d.cts.map +0 -1
  34. package/dist/index-S-oO1z9X.d.mts +0 -143
  35. package/dist/index-S-oO1z9X.d.mts.map +0 -1
  36. package/dist/manager-CPmezdJa.mjs +0 -834
  37. package/dist/manager-CPmezdJa.mjs.map +0 -1
  38. package/dist/manager-DErQ_XUq.cjs +0 -899
  39. package/dist/manager-DErQ_XUq.cjs.map +0 -1
@@ -1,23 +1,3 @@
1
- //#region src/manager/actions/createGame.d.ts
2
- type CreateGameResult = {
3
- readonly success: true;
4
- readonly gameId: string;
5
- readonly playerId: string;
6
- } | {
7
- readonly success: false;
8
- readonly error: "maxGamesReached";
9
- };
10
- declare function createGame(userId: string, username: string): CreateGameResult;
11
- //#endregion
12
- //#region src/manager/actions/drawCard.d.ts
13
- type DrawCardResult = {
14
- readonly success: true;
15
- } | {
16
- readonly success: false;
17
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
18
- };
19
- declare function drawCard(gameId: string, playerId: string): DrawCardResult;
20
- //#endregion
21
1
  //#region src/manager/types/Card.d.ts
22
2
  type Card = {
23
3
  readonly id: string;
@@ -52,16 +32,6 @@ type Player = {
52
32
  readonly centerPileTopCard: Card | null;
53
33
  };
54
34
  //#endregion
55
- //#region src/manager/actions/getClientStateAndClearEvents.d.ts
56
- type GetClientStateAndClearEventsResult = {
57
- readonly success: true;
58
- readonly state: ClientState;
59
- } | {
60
- readonly success: false;
61
- readonly error: "gameNotFound" | "playerNotFound";
62
- };
63
- declare function getClientStateAndClearEvents(gameId: string, playerId: string): GetClientStateAndClearEventsResult;
64
- //#endregion
65
35
  //#region src/manager/types/GameEvent.d.ts
66
36
  type GameEvent = {
67
37
  readonly type: "canPlayAtUpdated";
@@ -137,7 +107,28 @@ type GameEvent = {
137
107
  readonly numCards: number;
138
108
  };
139
109
  //#endregion
140
- //#region src/manager/actions/getEventsAndClearAcknowledged.d.ts
110
+ //#region src/manager/Manager.d.ts
111
+ type CreateGameResult = {
112
+ readonly success: true;
113
+ readonly gameId: string;
114
+ readonly playerId: string;
115
+ } | {
116
+ readonly success: false;
117
+ readonly error: "maxGamesReached";
118
+ };
119
+ type DrawCardResult = {
120
+ readonly success: true;
121
+ } | {
122
+ readonly success: false;
123
+ readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
124
+ };
125
+ type GetClientStateAndClearEventsResult = {
126
+ readonly success: true;
127
+ readonly state: ClientState;
128
+ } | {
129
+ readonly success: false;
130
+ readonly error: "gameNotFound" | "playerNotFound";
131
+ };
141
132
  type GetEventsAndClearAcknowledgedResult = {
142
133
  readonly success: true;
143
134
  readonly events: readonly GameEvent[];
@@ -145,19 +136,12 @@ type GetEventsAndClearAcknowledgedResult = {
145
136
  readonly success: false;
146
137
  readonly error: "gameNotFound" | "playerNotFound";
147
138
  };
148
- declare function getEventsAndClearAcknowledged(gameId: string, playerId: string, lastReadId: string | null): GetEventsAndClearAcknowledgedResult;
149
- //#endregion
150
- //#region src/manager/actions/getJoinableGames.d.ts
151
139
  type GetJoinableGamesResult = {
152
- readonly success: true;
153
140
  readonly games: readonly {
154
141
  readonly id: string;
155
142
  readonly numPlayers: number;
156
143
  }[];
157
144
  };
158
- declare function getJoinableGames(): GetJoinableGamesResult;
159
- //#endregion
160
- //#region src/manager/actions/joinGame.d.ts
161
145
  type JoinGameResult = {
162
146
  readonly success: true;
163
147
  readonly playerId: string;
@@ -165,52 +149,52 @@ type JoinGameResult = {
165
149
  readonly success: false;
166
150
  readonly error: "gameNotFound" | "invalidStatus" | "maxPlayersReached" | "alreadyInGame";
167
151
  };
168
- declare function joinGame(gameId: string, userId: string, username: string): JoinGameResult;
169
- //#endregion
170
- //#region src/manager/actions/leaveGame.d.ts
171
152
  type LeaveGameResult = {
172
153
  readonly success: true;
173
154
  } | {
174
155
  readonly success: false;
175
156
  readonly error: "gameNotFound" | "playerNotFound";
176
157
  };
177
- declare function leaveGame(gameId: string, playerId: string): LeaveGameResult;
178
- //#endregion
179
- //#region src/manager/actions/playCard.d.ts
180
158
  type PlayCardResult = {
181
159
  readonly success: true;
182
160
  } | {
183
161
  readonly success: false;
184
162
  readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
185
163
  };
186
- declare function playCard(gameId: string, playerId: string, cardId: string, isForOtherPlayerPile: boolean): PlayCardResult;
187
- //#endregion
188
- //#region src/manager/actions/reportNoPlayableCards.d.ts
189
164
  type ReportNoPlayableCardsResult = {
190
165
  readonly success: true;
191
166
  } | {
192
167
  readonly success: false;
193
168
  readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
194
169
  };
195
- declare function reportNoPlayableCards(gameId: string, playerId: string): ReportNoPlayableCardsResult;
196
- //#endregion
197
- //#region src/manager/actions/sendChat.d.ts
198
170
  type SendChatResult = {
199
171
  readonly success: true;
200
172
  } | {
201
173
  readonly success: false;
202
174
  readonly error: "gameNotFound" | "playerNotFound";
203
175
  };
204
- declare function sendChat(gameId: string, playerId: string, text: string): SendChatResult;
205
- //#endregion
206
- //#region src/manager/actions/startGame.d.ts
207
176
  type StartGameResult = {
208
177
  readonly success: true;
209
178
  } | {
210
179
  readonly success: false;
211
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "playerNotAdmin" | "minPlayersNotReached";
212
- };
213
- declare function startGame(gameId: string, playerId: string): StartGameResult;
180
+ readonly error: "gameNotFound" | "invalidStatus" | "playerNotFound" | "playerNotAdmin" | "minPlayersNotReached";
181
+ };
182
+ declare class Manager {
183
+ private readonly games;
184
+ private readonly watchdog;
185
+ constructor();
186
+ createGame(userId: string, username: string): CreateGameResult;
187
+ drawCard(gameId: string, playerId: string): DrawCardResult;
188
+ getClientStateAndClearEvents(gameId: string, playerId: string): GetClientStateAndClearEventsResult;
189
+ getEventsAndClearAcknowledged(gameId: string, playerId: string, lastReadId: string | null): GetEventsAndClearAcknowledgedResult;
190
+ getJoinableGames(): GetJoinableGamesResult;
191
+ joinGame(gameId: string, userId: string, username: string): JoinGameResult;
192
+ leaveGame(gameId: string, playerId: string): LeaveGameResult;
193
+ playCard(gameId: string, playerId: string, cardId: string, isForOtherPlayerPile: boolean): PlayCardResult;
194
+ reportNoPlayableCards(gameId: string, playerId: string): ReportNoPlayableCardsResult;
195
+ sendChat(gameId: string, playerId: string, text: string): SendChatResult;
196
+ startGame(gameId: string, playerId: string): StartGameResult;
197
+ }
214
198
  //#endregion
215
- export { leaveGame as a, getEventsAndClearAcknowledged as c, ClientState as d, ChatMessage as f, createGame as h, playCard as i, GameEvent as l, drawCard as m, sendChat as n, joinGame as o, Card as p, reportNoPlayableCards as r, getJoinableGames as s, startGame as t, getClientStateAndClearEvents as u };
216
- //# sourceMappingURL=index-BilCO_4a.d.mts.map
199
+ export { GetJoinableGamesResult as a, Manager as c, SendChatResult as d, StartGameResult as f, Card as g, ChatMessage as h, GetEventsAndClearAcknowledgedResult as i, PlayCardResult as l, ClientState as m, DrawCardResult as n, JoinGameResult as o, GameEvent as p, GetClientStateAndClearEventsResult as r, LeaveGameResult as s, CreateGameResult as t, ReportNoPlayableCardsResult as u };
200
+ //# sourceMappingURL=index-YAYbNr-s.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-YAYbNr-s.d.mts","names":[],"sources":["../src/manager/types/Card.ts","../src/manager/types/ChatMessage.ts","../src/manager/types/ClientState.ts","../src/manager/types/GameEvent.ts","../src/manager/Manager.ts"],"mappings":";KAAY;WACD;WACA;WACA;;;;KCHC;WACD;WACA;WACA;;;;KCAC;WACD;WACA;WACA;WACA;WACA,kBAAkB;WAClB;WACA,uBAAuB;WACvB,eAAe;WACf;;KAGN;WACM;WACA;WACA;WACA;WACA,mBAAmB;;;;KCjBlB;WAEG;WACA;WACA;;WAGA;WACA;WACA;WACA,MAAM;;WAGN;WACA;WACA;WACA,MAAM;WACN;;WAGA;WACA;WACA,SAAS;;WAGT;WACA;WACA,MAAM;;WAGN;WACA;WACA;;WAGA;WACA;;WAGA;WACA;;WAGA;WACA;;WAGA;WACA;WACA,gBAAgB;;WAGhB;WACA;WACA;WACA,MAAM;;WAGN;WACA;WACA;WACA;;WAGA;WACA;WACA;;WAGA;WACA;WACA;WACA;;WAGA;WACA;WACA;;WAGA;WACA;WACA;;WAGA;WACA;WACA;WACA;;;;KCtEH;WAEG;WACA;WACA;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;KASH;WAEG;WACA,OAAO;;WAGP;WACA;;KAGH;WAEG;WACA,iBAAiB;;WAGjB;WACA;;KAGH;WACD;aACE;aACA;;;KAID;WAEG;WACA;;WAGA;WACA;;KAOH;WAEG;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;KASH;WAEG;;WAGA;WACA;;KAUH;WAEG;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;cAQF;mBACM;mBACA;;EAQjB,WAAW,gBAAgB,mBAAmB;EA4B9C,SAAS,gBAAgB,mBAAmB;EA8B5C,6BACE,gBACA,mBACC;EAgCH,8BACE,gBACA,kBACA,4BACC;EAgBH,oBAAoB;EAWpB,SAAS,gBAAgB,gBAAgB,mBAAmB;EA8B5D,UAAU,gBAAgB,mBAAmB;EAkC7C,SACE,gBACA,kBACA,gBACA,gCACC;EAwDH,sBACE,gBACA,mBACC;EAuFH,SAAS,gBAAgB,kBAAkB,eAAe;EAmB1D,UAAU,gBAAgB,mBAAmB"}
@@ -1,13 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_manager = require("../manager-DErQ_XUq.cjs");
3
- exports.createGame = require_manager.createGame;
4
- exports.drawCard = require_manager.drawCard;
5
- exports.getClientStateAndClearEvents = require_manager.getClientStateAndClearEvents;
6
- exports.getEventsAndClearAcknowledged = require_manager.getEventsAndClearAcknowledged;
7
- exports.getJoinableGames = require_manager.getJoinableGames;
8
- exports.joinGame = require_manager.joinGame;
9
- exports.leaveGame = require_manager.leaveGame;
10
- exports.playCard = require_manager.playCard;
11
- exports.reportNoPlayableCards = require_manager.reportNoPlayableCards;
12
- exports.sendChat = require_manager.sendChat;
13
- exports.startGame = require_manager.startGame;
2
+ const require_manager = require("../manager-BpKvQbcp.cjs");
3
+ exports.Manager = require_manager.Manager;
@@ -1,2 +1,2 @@
1
- import { a as leaveGame, c as getEventsAndClearAcknowledged, d as ClientState, f as ChatMessage, h as createGame, i as playCard, l as GameEvent, m as drawCard, n as sendChat, o as joinGame, p as Card, r as reportNoPlayableCards, s as getJoinableGames, t as startGame, u as getClientStateAndClearEvents } from "../index-BilCO_4a.cjs";
2
- export { type Card, type ChatMessage, type ClientState, type GameEvent, createGame, drawCard, getClientStateAndClearEvents, getEventsAndClearAcknowledged, getJoinableGames, joinGame, leaveGame, playCard, reportNoPlayableCards, sendChat, startGame };
1
+ import { a as GetJoinableGamesResult, c as Manager, d as SendChatResult, f as StartGameResult, g as Card, h as ChatMessage, i as GetEventsAndClearAcknowledgedResult, l as PlayCardResult, m as ClientState, n as DrawCardResult, o as JoinGameResult, p as GameEvent, r as GetClientStateAndClearEventsResult, s as LeaveGameResult, t as CreateGameResult, u as ReportNoPlayableCardsResult } from "../index-YAYbNr-s.cjs";
2
+ export { type Card, type ChatMessage, type ClientState, type CreateGameResult, type DrawCardResult, type GameEvent, type GetClientStateAndClearEventsResult, type GetEventsAndClearAcknowledgedResult, type GetJoinableGamesResult, type JoinGameResult, type LeaveGameResult, Manager, type PlayCardResult, type ReportNoPlayableCardsResult, type SendChatResult, type StartGameResult };
@@ -1,2 +1,2 @@
1
- import { a as leaveGame, c as getEventsAndClearAcknowledged, d as ClientState, f as ChatMessage, h as createGame, i as playCard, l as GameEvent, m as drawCard, n as sendChat, o as joinGame, p as Card, r as reportNoPlayableCards, s as getJoinableGames, t as startGame, u as getClientStateAndClearEvents } from "../index-BilCO_4a.mjs";
2
- export { type Card, type ChatMessage, type ClientState, type GameEvent, createGame, drawCard, getClientStateAndClearEvents, getEventsAndClearAcknowledged, getJoinableGames, joinGame, leaveGame, playCard, reportNoPlayableCards, sendChat, startGame };
1
+ import { a as GetJoinableGamesResult, c as Manager, d as SendChatResult, f as StartGameResult, g as Card, h as ChatMessage, i as GetEventsAndClearAcknowledgedResult, l as PlayCardResult, m as ClientState, n as DrawCardResult, o as JoinGameResult, p as GameEvent, r as GetClientStateAndClearEventsResult, s as LeaveGameResult, t as CreateGameResult, u as ReportNoPlayableCardsResult } from "../index-YAYbNr-s.mjs";
2
+ export { type Card, type ChatMessage, type ClientState, type CreateGameResult, type DrawCardResult, type GameEvent, type GetClientStateAndClearEventsResult, type GetEventsAndClearAcknowledgedResult, type GetJoinableGamesResult, type JoinGameResult, type LeaveGameResult, Manager, type PlayCardResult, type ReportNoPlayableCardsResult, type SendChatResult, type StartGameResult };
@@ -1,2 +1,2 @@
1
- import { a as leaveGame, c as getEventsAndClearAcknowledged, d as createGame, i as playCard, l as getClientStateAndClearEvents, n as sendChat, o as joinGame, r as reportNoPlayableCards, s as getJoinableGames, t as startGame, u as drawCard } from "../manager-CPmezdJa.mjs";
2
- export { createGame, drawCard, getClientStateAndClearEvents, getEventsAndClearAcknowledged, getJoinableGames, joinGame, leaveGame, playCard, reportNoPlayableCards, sendChat, startGame };
1
+ import { t as Manager } from "../manager-BOymBQ4E.mjs";
2
+ export { Manager };