@hellacardgames/speed 0.8.0 → 0.9.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 (43) hide show
  1. package/dist/ClientState-Dx8UvhMt.d.cts +111 -0
  2. package/dist/ClientState-Dx8UvhMt.d.cts.map +1 -0
  3. package/dist/ClientState-Dx8UvhMt.d.mts +111 -0
  4. package/dist/ClientState-Dx8UvhMt.d.mts.map +1 -0
  5. package/dist/client/index.cjs +60 -10
  6. package/dist/client/index.cjs.map +1 -1
  7. package/dist/client/index.d.cts +89 -14
  8. package/dist/client/index.d.cts.map +1 -1
  9. package/dist/client/index.d.mts +89 -14
  10. package/dist/client/index.d.mts.map +1 -1
  11. package/dist/client/index.mjs +60 -10
  12. package/dist/client/index.mjs.map +1 -1
  13. package/dist/manager/index.cjs +2 -2
  14. package/dist/manager/index.d.cts +140 -2
  15. package/dist/manager/index.d.cts.map +1 -0
  16. package/dist/manager/index.d.mts +140 -2
  17. package/dist/manager/index.d.mts.map +1 -0
  18. package/dist/manager/index.mjs +2 -2
  19. package/dist/manager-B7gHPSPL.cjs +823 -0
  20. package/dist/manager-B7gHPSPL.cjs.map +1 -0
  21. package/dist/manager-C6kRM9IW.mjs +818 -0
  22. package/dist/manager-C6kRM9IW.mjs.map +1 -0
  23. package/dist/server/index.cjs +45 -165
  24. package/dist/server/index.cjs.map +1 -1
  25. package/dist/server/index.d.cts +149 -3
  26. package/dist/server/index.d.cts.map +1 -0
  27. package/dist/server/index.d.mts +149 -3
  28. package/dist/server/index.d.mts.map +1 -0
  29. package/dist/server/index.mjs +45 -165
  30. package/dist/server/index.mjs.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/index-C5bT1Zzd.d.mts +0 -125
  33. package/dist/index-C5bT1Zzd.d.mts.map +0 -1
  34. package/dist/index-NySusLtY.d.cts +0 -125
  35. package/dist/index-NySusLtY.d.cts.map +0 -1
  36. package/dist/index-uaOvIhKT.d.cts +0 -247
  37. package/dist/index-uaOvIhKT.d.cts.map +0 -1
  38. package/dist/index-uaOvIhKT.d.mts +0 -247
  39. package/dist/index-uaOvIhKT.d.mts.map +0 -1
  40. package/dist/manager-BAxBCUOk.mjs +0 -790
  41. package/dist/manager-BAxBCUOk.mjs.map +0 -1
  42. package/dist/manager-C9oZYA47.cjs +0 -795
  43. package/dist/manager-C9oZYA47.cjs.map +0 -1
@@ -1,125 +0,0 @@
1
- import { c as Manager, m as ClientState, p as GameEvent } from "./index-uaOvIhKT.cjs";
2
- //#region src/server/Server.d.ts
3
- type CreateGameResult = {
4
- readonly success: true;
5
- readonly gameId: string;
6
- readonly playerId: string;
7
- } | {
8
- readonly success: false;
9
- readonly error: "maxGamesReached";
10
- };
11
- type DrawCardResult = {
12
- readonly success: true;
13
- } | {
14
- readonly success: false;
15
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
16
- };
17
- type GetClientStateAndClearEventsResult = {
18
- readonly success: true;
19
- readonly state: ClientState;
20
- } | {
21
- readonly success: false;
22
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound";
23
- };
24
- type GetEventsAndClearAcknowledgedResult = {
25
- readonly success: true;
26
- readonly events: readonly GameEvent[];
27
- } | {
28
- readonly success: false;
29
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound";
30
- };
31
- type GetJoinableGamesResult = {
32
- readonly games: readonly {
33
- readonly id: string;
34
- readonly numPlayers: number;
35
- }[];
36
- };
37
- type JoinGameResult = {
38
- readonly success: true;
39
- readonly playerId: string;
40
- } | {
41
- readonly success: false;
42
- readonly error: "invalidInput" | "gameNotFound" | "invalidStatus" | "maxPlayersReached" | "alreadyInGame";
43
- };
44
- type LeaveGameResult = {
45
- readonly success: true;
46
- } | {
47
- readonly success: false;
48
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound";
49
- };
50
- type PlayCardResult = {
51
- readonly success: true;
52
- } | {
53
- readonly success: false;
54
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
55
- };
56
- type ReportNoPlayableCardsResult = {
57
- readonly success: true;
58
- } | {
59
- readonly success: false;
60
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
61
- };
62
- type SendChatResult = {
63
- readonly success: true;
64
- } | {
65
- readonly success: false;
66
- readonly error: "invalidInput" | "gameNotFound" | "playerNotFound";
67
- };
68
- type StartGameResult = {
69
- readonly success: true;
70
- } | {
71
- readonly success: false;
72
- readonly error: "invalidInput" | "gameNotFound" | "invalidStatus" | "playerNotFound" | "playerNotAdmin" | "minPlayersNotReached";
73
- };
74
- declare class Server {
75
- private readonly manager;
76
- readonly actions: readonly [{
77
- readonly path: "/createGame";
78
- readonly action: (userId: string, username: string) => CreateGameResult;
79
- }, {
80
- readonly path: "/drawCard";
81
- readonly action: (input: unknown) => DrawCardResult;
82
- }, {
83
- readonly path: "/getClientStateAndClearEvents";
84
- readonly action: (input: unknown) => GetClientStateAndClearEventsResult;
85
- }, {
86
- readonly path: "/getEventsAndClearAcknowledged";
87
- readonly action: (input: unknown) => GetEventsAndClearAcknowledgedResult;
88
- }, {
89
- readonly path: "/getJoinableGames";
90
- readonly action: () => GetJoinableGamesResult;
91
- }, {
92
- readonly path: "/joinGame";
93
- readonly action: (input: unknown, userId: string, username: string) => JoinGameResult;
94
- }, {
95
- readonly path: "/leaveGame";
96
- readonly action: (input: unknown) => LeaveGameResult;
97
- }, {
98
- readonly path: "/playCard";
99
- readonly action: (input: unknown) => PlayCardResult;
100
- }, {
101
- readonly path: "/reportNoPlayableCards";
102
- readonly action: (input: unknown) => ReportNoPlayableCardsResult;
103
- }, {
104
- readonly path: "/sendChat";
105
- readonly action: (input: unknown) => SendChatResult;
106
- }, {
107
- readonly path: "/startGame";
108
- readonly action: (input: unknown) => StartGameResult;
109
- }];
110
- constructor(...args: ConstructorParameters<typeof Manager>);
111
- private createGame;
112
- private drawCard;
113
- private getClientStateAndClearEvents;
114
- private getEventsAndClearAcknowledged;
115
- private getJoinableGames;
116
- private joinGame;
117
- private leaveGame;
118
- private playCard;
119
- private reportNoPlayableCards;
120
- private sendChat;
121
- private startGame;
122
- }
123
- //#endregion
124
- export { GetJoinableGamesResult as a, PlayCardResult as c, Server as d, StartGameResult as f, GetEventsAndClearAcknowledgedResult as i, ReportNoPlayableCardsResult as l, DrawCardResult as n, JoinGameResult as o, GetClientStateAndClearEventsResult as r, LeaveGameResult as s, CreateGameResult as t, SendChatResult as u };
125
- //# sourceMappingURL=index-NySusLtY.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-NySusLtY.d.cts","names":[],"sources":["../src/server/Server.ts"],"mappings":";;KAIY;WAEG;WACA;WACA;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;KAUH;WAEG;WACA,OAAO;;WAGP;WACA;;KAGH;WAEG;WACA,iBAAiB;;WAGjB;WACA;;KAGH;WACD;aACE;aACA;;;KAID;WAEG;WACA;;WAGA;WACA;;KAQH;WAEG;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;KAUH;WAEG;;WAGA;WACA;;KAWH;WAEG;;WAGA;WACA;;KAGH;WAEG;;WAGA;WACA;;cAiFF;mBACM;WAER;;aA2BkB,SAAA,gBAAM,qBAAqB;;;aAI9B,SAAA,mBAAU;;;aASzB,SAAA,mBACN;;;aAUM,SAAA,mBACN;;;aASyB,cAAA;;;aAKnB,SAAA,gBAAO,gBACA,qBAEb;;;aAQsB,SAAA,mBAAU;;;aAQX,SAAA,mBAAU;;;aAQG,SAAA,mBAAU;;;aAQvB,SAAA,mBAAU;;;aAQT,SAAA,mBAAU;;EAtFvB,eAAG,MAAM,6BAA6B;UAI1C;UAIA;UAQA;UAWA;UAWA;UAIA;UAYA;UAQA;UAQA;UAQA;UAQA"}
@@ -1,247 +0,0 @@
1
- import { ManagerBase } from "@hellacardgames/lib";
2
- //#region src/manager/types/Card.d.ts
3
- type Card = {
4
- readonly id: string;
5
- readonly rank: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;
6
- readonly suite: "clubs" | "diamonds" | "hearts" | "spades";
7
- };
8
- //#endregion
9
- //#region src/manager/types/ChatMessage.d.ts
10
- type ChatMessage = {
11
- readonly id: string;
12
- readonly username: string;
13
- readonly text: string;
14
- };
15
- //#endregion
16
- //#region src/manager/types/ClientState.d.ts
17
- type ClientState = {
18
- readonly status: "created" | "started" | "completed" | "forfeited";
19
- readonly gameId: string;
20
- readonly playerId: string;
21
- readonly username: string;
22
- readonly players: readonly Player$1[];
23
- readonly expiresAt: number;
24
- readonly chatMessages: readonly ChatMessage[];
25
- readonly hand: readonly Card[];
26
- readonly canPlayAt: number | null;
27
- };
28
- type Player$1 = {
29
- readonly username: string;
30
- readonly handSize: number;
31
- readonly drawPileSize: number;
32
- readonly sidePileSize: number;
33
- readonly centerPileTopCard: Card | null;
34
- };
35
- //#endregion
36
- //#region src/manager/types/GameEvent.d.ts
37
- type GameEvent = {
38
- readonly type: "canPlayAtUpdated";
39
- readonly id: string;
40
- readonly canPlayAt: number;
41
- } | {
42
- readonly type: "cardDrawnFromSidePileToCenterPile";
43
- readonly id: string;
44
- readonly username: string;
45
- readonly card: Card;
46
- } | {
47
- readonly type: "cardPlayed";
48
- readonly id: string;
49
- readonly username: string;
50
- readonly card: Card;
51
- readonly isForOtherPlayerPile: boolean;
52
- } | {
53
- readonly type: "chat";
54
- readonly id: string;
55
- readonly message: ChatMessage;
56
- } | {
57
- readonly type: "drewCard";
58
- readonly id: string;
59
- readonly card: Card;
60
- } | {
61
- readonly type: "expirationUpdated";
62
- readonly id: string;
63
- readonly expiresAt: number;
64
- } | {
65
- readonly type: "gameCompleted";
66
- readonly id: string;
67
- } | {
68
- readonly type: "gameForfeited";
69
- readonly id: string;
70
- } | {
71
- readonly type: "gameStarted";
72
- readonly id: string;
73
- } | {
74
- readonly type: "handInitialized";
75
- readonly id: string;
76
- readonly cards: readonly Card[];
77
- } | {
78
- readonly type: "playerCenterPileInitialized";
79
- readonly id: string;
80
- readonly username: string;
81
- readonly card: Card;
82
- } | {
83
- readonly type: "playerDrawPileInitialized";
84
- readonly id: string;
85
- readonly username: string;
86
- readonly numCards: number;
87
- } | {
88
- readonly type: "playerDrewCard";
89
- readonly id: string;
90
- readonly username: string;
91
- } | {
92
- readonly type: "playerHandInitialized";
93
- readonly id: string;
94
- readonly username: string;
95
- readonly numCards: number;
96
- } | {
97
- readonly type: "playerJoined";
98
- readonly id: string;
99
- readonly username: string;
100
- } | {
101
- readonly type: "playerLeft";
102
- readonly id: string;
103
- readonly username: string;
104
- } | {
105
- readonly type: "playerSidePileInitialized";
106
- readonly id: string;
107
- readonly username: string;
108
- readonly numCards: number;
109
- };
110
- //#endregion
111
- //#region src/manager/types/Player.d.ts
112
- type Player = {
113
- readonly id: string;
114
- readonly userId: string;
115
- readonly username: string;
116
- readonly events: GameEvent[];
117
- readonly hand: Card[];
118
- readonly drawPile: Card[];
119
- readonly sidePile: Card[];
120
- readonly centerPile: Card[];
121
- hasNoPlayableCards: boolean;
122
- };
123
- //#endregion
124
- //#region src/manager/types/Game.d.ts
125
- type Game = CreatedGame | StartedGame | CompletedGame | ForfeitedGame;
126
- type CreatedGame = {
127
- readonly status: "created";
128
- readonly id: string;
129
- readonly createdAt: number;
130
- readonly expiresAt: number;
131
- readonly chatMessages: ChatMessage[];
132
- readonly players: Player[];
133
- };
134
- type StartedGame = {
135
- readonly status: "started";
136
- readonly id: string;
137
- readonly createdAt: number;
138
- expiresAt: number;
139
- readonly chatMessages: ChatMessage[];
140
- readonly players: Player[];
141
- canPlayAt: number;
142
- };
143
- type CompletedGame = {
144
- readonly status: "completed";
145
- readonly id: string;
146
- readonly createdAt: number;
147
- readonly expiresAt: number;
148
- readonly chatMessages: ChatMessage[];
149
- readonly players: Player[];
150
- };
151
- type ForfeitedGame = {
152
- readonly status: "forfeited";
153
- readonly id: string;
154
- readonly createdAt: number;
155
- readonly expiresAt: number;
156
- readonly chatMessages: ChatMessage[];
157
- readonly players: Player[];
158
- };
159
- //#endregion
160
- //#region src/manager/Manager.d.ts
161
- type CreateGameResult = {
162
- readonly success: true;
163
- readonly gameId: string;
164
- readonly playerId: string;
165
- } | {
166
- readonly success: false;
167
- readonly error: "maxGamesReached";
168
- };
169
- type DrawCardResult = {
170
- readonly success: true;
171
- } | {
172
- readonly success: false;
173
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
174
- };
175
- type GetClientStateAndClearEventsResult = {
176
- readonly success: true;
177
- readonly state: ClientState;
178
- } | {
179
- readonly success: false;
180
- readonly error: "gameNotFound" | "playerNotFound";
181
- };
182
- type GetEventsAndClearAcknowledgedResult = {
183
- readonly success: true;
184
- readonly events: readonly GameEvent[];
185
- } | {
186
- readonly success: false;
187
- readonly error: "gameNotFound" | "playerNotFound";
188
- };
189
- type GetJoinableGamesResult = {
190
- readonly games: readonly {
191
- readonly id: string;
192
- readonly numPlayers: number;
193
- }[];
194
- };
195
- type JoinGameResult = {
196
- readonly success: true;
197
- readonly playerId: string;
198
- } | {
199
- readonly success: false;
200
- readonly error: "gameNotFound" | "invalidStatus" | "maxPlayersReached" | "alreadyInGame";
201
- };
202
- type LeaveGameResult = {
203
- readonly success: true;
204
- } | {
205
- readonly success: false;
206
- readonly error: "gameNotFound" | "playerNotFound";
207
- };
208
- type PlayCardResult = {
209
- readonly success: true;
210
- } | {
211
- readonly success: false;
212
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
213
- };
214
- type ReportNoPlayableCardsResult = {
215
- readonly success: true;
216
- } | {
217
- readonly success: false;
218
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
219
- };
220
- type SendChatResult = {
221
- readonly success: true;
222
- } | {
223
- readonly success: false;
224
- readonly error: "gameNotFound" | "playerNotFound";
225
- };
226
- type StartGameResult = {
227
- readonly success: true;
228
- } | {
229
- readonly success: false;
230
- readonly error: "gameNotFound" | "invalidStatus" | "playerNotFound" | "playerNotAdmin" | "minPlayersNotReached";
231
- };
232
- declare class Manager extends ManagerBase<Game> {
233
- createGame(userId: string, username: string): CreateGameResult;
234
- drawCard(gameId: string, playerId: string): DrawCardResult;
235
- getClientStateAndClearEvents(gameId: string, playerId: string): GetClientStateAndClearEventsResult;
236
- getEventsAndClearAcknowledged(gameId: string, playerId: string, lastReadId: string | null): GetEventsAndClearAcknowledgedResult;
237
- getJoinableGames(): GetJoinableGamesResult;
238
- joinGame(gameId: string, userId: string, username: string): JoinGameResult;
239
- leaveGame(gameId: string, playerId: string): LeaveGameResult;
240
- playCard(gameId: string, playerId: string, cardId: string, isForOtherPlayerPile: boolean): PlayCardResult;
241
- reportNoPlayableCards(gameId: string, playerId: string): ReportNoPlayableCardsResult;
242
- sendChat(gameId: string, playerId: string, text: string): SendChatResult;
243
- startGame(gameId: string, playerId: string): StartGameResult;
244
- }
245
- //#endregion
246
- 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 };
247
- //# sourceMappingURL=index-uaOvIhKT.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-uaOvIhKT.d.cts","names":[],"sources":["../src/manager/types/Card.ts","../src/manager/types/ChatMessage.ts","../src/manager/types/ClientState.ts","../src/manager/types/GameEvent.ts","../src/manager/types/Player.ts","../src/manager/types/Game.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;;;;KCxFH;WACD;WACA;WACA;WACA,QAAQ;WACR,MAAM;WACN,UAAU;WACV,UAAU;WACV,YAAY;EACrB;;;;KCTU,OAAO,cAAc,cAAc,gBAAgB;KAE1D;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;KAGf;WACM;WACA;WACA;EACT;WACS,cAAc;WACd,SAAS;EAClB;;KAGG;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;KAGf;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;;;KCnBR;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,gBAAgB,YAAY;EACvC,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,247 +0,0 @@
1
- import { ManagerBase } from "@hellacardgames/lib";
2
- //#region src/manager/types/Card.d.ts
3
- type Card = {
4
- readonly id: string;
5
- readonly rank: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14;
6
- readonly suite: "clubs" | "diamonds" | "hearts" | "spades";
7
- };
8
- //#endregion
9
- //#region src/manager/types/ChatMessage.d.ts
10
- type ChatMessage = {
11
- readonly id: string;
12
- readonly username: string;
13
- readonly text: string;
14
- };
15
- //#endregion
16
- //#region src/manager/types/ClientState.d.ts
17
- type ClientState = {
18
- readonly status: "created" | "started" | "completed" | "forfeited";
19
- readonly gameId: string;
20
- readonly playerId: string;
21
- readonly username: string;
22
- readonly players: readonly Player$1[];
23
- readonly expiresAt: number;
24
- readonly chatMessages: readonly ChatMessage[];
25
- readonly hand: readonly Card[];
26
- readonly canPlayAt: number | null;
27
- };
28
- type Player$1 = {
29
- readonly username: string;
30
- readonly handSize: number;
31
- readonly drawPileSize: number;
32
- readonly sidePileSize: number;
33
- readonly centerPileTopCard: Card | null;
34
- };
35
- //#endregion
36
- //#region src/manager/types/GameEvent.d.ts
37
- type GameEvent = {
38
- readonly type: "canPlayAtUpdated";
39
- readonly id: string;
40
- readonly canPlayAt: number;
41
- } | {
42
- readonly type: "cardDrawnFromSidePileToCenterPile";
43
- readonly id: string;
44
- readonly username: string;
45
- readonly card: Card;
46
- } | {
47
- readonly type: "cardPlayed";
48
- readonly id: string;
49
- readonly username: string;
50
- readonly card: Card;
51
- readonly isForOtherPlayerPile: boolean;
52
- } | {
53
- readonly type: "chat";
54
- readonly id: string;
55
- readonly message: ChatMessage;
56
- } | {
57
- readonly type: "drewCard";
58
- readonly id: string;
59
- readonly card: Card;
60
- } | {
61
- readonly type: "expirationUpdated";
62
- readonly id: string;
63
- readonly expiresAt: number;
64
- } | {
65
- readonly type: "gameCompleted";
66
- readonly id: string;
67
- } | {
68
- readonly type: "gameForfeited";
69
- readonly id: string;
70
- } | {
71
- readonly type: "gameStarted";
72
- readonly id: string;
73
- } | {
74
- readonly type: "handInitialized";
75
- readonly id: string;
76
- readonly cards: readonly Card[];
77
- } | {
78
- readonly type: "playerCenterPileInitialized";
79
- readonly id: string;
80
- readonly username: string;
81
- readonly card: Card;
82
- } | {
83
- readonly type: "playerDrawPileInitialized";
84
- readonly id: string;
85
- readonly username: string;
86
- readonly numCards: number;
87
- } | {
88
- readonly type: "playerDrewCard";
89
- readonly id: string;
90
- readonly username: string;
91
- } | {
92
- readonly type: "playerHandInitialized";
93
- readonly id: string;
94
- readonly username: string;
95
- readonly numCards: number;
96
- } | {
97
- readonly type: "playerJoined";
98
- readonly id: string;
99
- readonly username: string;
100
- } | {
101
- readonly type: "playerLeft";
102
- readonly id: string;
103
- readonly username: string;
104
- } | {
105
- readonly type: "playerSidePileInitialized";
106
- readonly id: string;
107
- readonly username: string;
108
- readonly numCards: number;
109
- };
110
- //#endregion
111
- //#region src/manager/types/Player.d.ts
112
- type Player = {
113
- readonly id: string;
114
- readonly userId: string;
115
- readonly username: string;
116
- readonly events: GameEvent[];
117
- readonly hand: Card[];
118
- readonly drawPile: Card[];
119
- readonly sidePile: Card[];
120
- readonly centerPile: Card[];
121
- hasNoPlayableCards: boolean;
122
- };
123
- //#endregion
124
- //#region src/manager/types/Game.d.ts
125
- type Game = CreatedGame | StartedGame | CompletedGame | ForfeitedGame;
126
- type CreatedGame = {
127
- readonly status: "created";
128
- readonly id: string;
129
- readonly createdAt: number;
130
- readonly expiresAt: number;
131
- readonly chatMessages: ChatMessage[];
132
- readonly players: Player[];
133
- };
134
- type StartedGame = {
135
- readonly status: "started";
136
- readonly id: string;
137
- readonly createdAt: number;
138
- expiresAt: number;
139
- readonly chatMessages: ChatMessage[];
140
- readonly players: Player[];
141
- canPlayAt: number;
142
- };
143
- type CompletedGame = {
144
- readonly status: "completed";
145
- readonly id: string;
146
- readonly createdAt: number;
147
- readonly expiresAt: number;
148
- readonly chatMessages: ChatMessage[];
149
- readonly players: Player[];
150
- };
151
- type ForfeitedGame = {
152
- readonly status: "forfeited";
153
- readonly id: string;
154
- readonly createdAt: number;
155
- readonly expiresAt: number;
156
- readonly chatMessages: ChatMessage[];
157
- readonly players: Player[];
158
- };
159
- //#endregion
160
- //#region src/manager/Manager.d.ts
161
- type CreateGameResult = {
162
- readonly success: true;
163
- readonly gameId: string;
164
- readonly playerId: string;
165
- } | {
166
- readonly success: false;
167
- readonly error: "maxGamesReached";
168
- };
169
- type DrawCardResult = {
170
- readonly success: true;
171
- } | {
172
- readonly success: false;
173
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
174
- };
175
- type GetClientStateAndClearEventsResult = {
176
- readonly success: true;
177
- readonly state: ClientState;
178
- } | {
179
- readonly success: false;
180
- readonly error: "gameNotFound" | "playerNotFound";
181
- };
182
- type GetEventsAndClearAcknowledgedResult = {
183
- readonly success: true;
184
- readonly events: readonly GameEvent[];
185
- } | {
186
- readonly success: false;
187
- readonly error: "gameNotFound" | "playerNotFound";
188
- };
189
- type GetJoinableGamesResult = {
190
- readonly games: readonly {
191
- readonly id: string;
192
- readonly numPlayers: number;
193
- }[];
194
- };
195
- type JoinGameResult = {
196
- readonly success: true;
197
- readonly playerId: string;
198
- } | {
199
- readonly success: false;
200
- readonly error: "gameNotFound" | "invalidStatus" | "maxPlayersReached" | "alreadyInGame";
201
- };
202
- type LeaveGameResult = {
203
- readonly success: true;
204
- } | {
205
- readonly success: false;
206
- readonly error: "gameNotFound" | "playerNotFound";
207
- };
208
- type PlayCardResult = {
209
- readonly success: true;
210
- } | {
211
- readonly success: false;
212
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
213
- };
214
- type ReportNoPlayableCardsResult = {
215
- readonly success: true;
216
- } | {
217
- readonly success: false;
218
- readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
219
- };
220
- type SendChatResult = {
221
- readonly success: true;
222
- } | {
223
- readonly success: false;
224
- readonly error: "gameNotFound" | "playerNotFound";
225
- };
226
- type StartGameResult = {
227
- readonly success: true;
228
- } | {
229
- readonly success: false;
230
- readonly error: "gameNotFound" | "invalidStatus" | "playerNotFound" | "playerNotAdmin" | "minPlayersNotReached";
231
- };
232
- declare class Manager extends ManagerBase<Game> {
233
- createGame(userId: string, username: string): CreateGameResult;
234
- drawCard(gameId: string, playerId: string): DrawCardResult;
235
- getClientStateAndClearEvents(gameId: string, playerId: string): GetClientStateAndClearEventsResult;
236
- getEventsAndClearAcknowledged(gameId: string, playerId: string, lastReadId: string | null): GetEventsAndClearAcknowledgedResult;
237
- getJoinableGames(): GetJoinableGamesResult;
238
- joinGame(gameId: string, userId: string, username: string): JoinGameResult;
239
- leaveGame(gameId: string, playerId: string): LeaveGameResult;
240
- playCard(gameId: string, playerId: string, cardId: string, isForOtherPlayerPile: boolean): PlayCardResult;
241
- reportNoPlayableCards(gameId: string, playerId: string): ReportNoPlayableCardsResult;
242
- sendChat(gameId: string, playerId: string, text: string): SendChatResult;
243
- startGame(gameId: string, playerId: string): StartGameResult;
244
- }
245
- //#endregion
246
- 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 };
247
- //# sourceMappingURL=index-uaOvIhKT.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-uaOvIhKT.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/types/Player.ts","../src/manager/types/Game.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;;;;KCxFH;WACD;WACA;WACA;WACA,QAAQ;WACR,MAAM;WACN,UAAU;WACV,UAAU;WACV,YAAY;EACrB;;;;KCTU,OAAO,cAAc,cAAc,gBAAgB;KAE1D;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;KAGf;WACM;WACA;WACA;EACT;WACS,cAAc;WACd,SAAS;EAClB;;KAGG;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;KAGf;WACM;WACA;WACA;WACA;WACA,cAAc;WACd,SAAS;;;;KCnBR;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,gBAAgB,YAAY;EACvC,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"}