@hellacardgames/speed 0.5.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.cts.map +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/index-BRtLpRz1.d.mts +125 -0
- package/dist/index-BRtLpRz1.d.mts.map +1 -0
- package/dist/index-BvZyhFek.d.cts +125 -0
- package/dist/index-BvZyhFek.d.cts.map +1 -0
- package/dist/{index-BilCO_4a.d.cts → index-xmcja9Bl.d.cts} +91 -60
- package/dist/index-xmcja9Bl.d.cts.map +1 -0
- package/dist/{index-BilCO_4a.d.mts → index-xmcja9Bl.d.mts} +91 -60
- package/dist/index-xmcja9Bl.d.mts.map +1 -0
- package/dist/manager/index.cjs +2 -12
- package/dist/manager/index.d.cts +2 -2
- package/dist/manager/index.d.mts +2 -2
- package/dist/manager/index.mjs +2 -2
- package/dist/manager-8x5AFyzq.mjs +790 -0
- package/dist/manager-8x5AFyzq.mjs.map +1 -0
- package/dist/manager-BxLMVu_o.cjs +795 -0
- package/dist/manager-BxLMVu_o.cjs.map +1 -0
- package/dist/server/index.cjs +141 -157
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.mjs +141 -157
- package/dist/server/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/index-BilCO_4a.d.cts.map +0 -1
- package/dist/index-BilCO_4a.d.mts.map +0 -1
- package/dist/index-DSPZZlhq.d.cts +0 -143
- package/dist/index-DSPZZlhq.d.cts.map +0 -1
- package/dist/index-S-oO1z9X.d.mts +0 -143
- package/dist/index-S-oO1z9X.d.mts.map +0 -1
- package/dist/manager-CPmezdJa.mjs +0 -834
- package/dist/manager-CPmezdJa.mjs.map +0 -1
- package/dist/manager-DErQ_XUq.cjs +0 -899
- package/dist/manager-DErQ_XUq.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/client/Client.ts"],"sourcesContent":["import type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n} from \"../server/index.js\";\n\nexport class Client {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async createGame(accessToken: string): Promise<CreateGameResult> {\n const response = await fetch(`${this.baseUrl}/createGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n const result = await response.json();\n return result;\n }\n\n async drawCard(gameId: string, playerId: string): Promise<DrawCardResult> {\n const response = await fetch(`${this.baseUrl}/drawCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async getClientStateAndClearEvents(\n gameId: string,\n playerId: string,\n ): Promise<GetClientStateAndClearEventsResult> {\n const response = await fetch(\n `${this.baseUrl}/getClientStateAndClearEvents`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getEventsAndClearAcknowledged(\n gameId: string,\n playerId: string,\n lastReadId: string | null,\n ): Promise<GetEventsAndClearAcknowledgedResult> {\n const response = await fetch(\n `${this.baseUrl}/getEventsAndClearAcknowledged`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, lastReadId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getJoinableGames(): Promise<GetJoinableGamesResult> {\n const response = await fetch(`${this.baseUrl}/getJoinableGames`, {\n method: \"POST\",\n });\n const result = await response.json();\n return result;\n }\n\n async joinGame(gameId: string, accessToken: string): Promise<JoinGameResult> {\n const response = await fetch(`${this.baseUrl}/joinGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId }),\n });\n const result = await response.json();\n return result;\n }\n\n async leaveGame(gameId: string, playerId: string): Promise<LeaveGameResult> {\n const response = await fetch(`${this.baseUrl}/leaveGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async playCard(\n gameId: string,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n ): Promise<PlayCardResult> {\n const response = await fetch(`${this.baseUrl}/playCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, cardId, isForOtherPlayerPile }),\n });\n const result = await response.json();\n return result;\n }\n\n async reportNoPlayableCards(\n gameId: string,\n playerId: string,\n ): Promise<ReportNoPlayableCardsResult> {\n const response = await fetch(`${this.baseUrl}/reportNoPlayableCards`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async sendChat(\n gameId: string,\n playerId: string,\n text: string,\n ): Promise<SendChatResult> {\n const response = await fetch(`${this.baseUrl}/sendChat`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, text }),\n });\n const result = await response.json();\n return result;\n }\n\n async startGame(gameId: string, playerId: string): Promise<StartGameResult> {\n const response = await fetch(`${this.baseUrl}/startGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/client/Client.ts"],"sourcesContent":["import type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n} from \"../server/index.js\";\n\nexport type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n};\n\nexport class Client {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async createGame(accessToken: string): Promise<CreateGameResult> {\n const response = await fetch(`${this.baseUrl}/createGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n const result = await response.json();\n return result;\n }\n\n async drawCard(gameId: string, playerId: string): Promise<DrawCardResult> {\n const response = await fetch(`${this.baseUrl}/drawCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async getClientStateAndClearEvents(\n gameId: string,\n playerId: string,\n ): Promise<GetClientStateAndClearEventsResult> {\n const response = await fetch(\n `${this.baseUrl}/getClientStateAndClearEvents`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getEventsAndClearAcknowledged(\n gameId: string,\n playerId: string,\n lastReadId: string | null,\n ): Promise<GetEventsAndClearAcknowledgedResult> {\n const response = await fetch(\n `${this.baseUrl}/getEventsAndClearAcknowledged`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, lastReadId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getJoinableGames(): Promise<GetJoinableGamesResult> {\n const response = await fetch(`${this.baseUrl}/getJoinableGames`, {\n method: \"POST\",\n });\n const result = await response.json();\n return result;\n }\n\n async joinGame(gameId: string, accessToken: string): Promise<JoinGameResult> {\n const response = await fetch(`${this.baseUrl}/joinGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId }),\n });\n const result = await response.json();\n return result;\n }\n\n async leaveGame(gameId: string, playerId: string): Promise<LeaveGameResult> {\n const response = await fetch(`${this.baseUrl}/leaveGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async playCard(\n gameId: string,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n ): Promise<PlayCardResult> {\n const response = await fetch(`${this.baseUrl}/playCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, cardId, isForOtherPlayerPile }),\n });\n const result = await response.json();\n return result;\n }\n\n async reportNoPlayableCards(\n gameId: string,\n playerId: string,\n ): Promise<ReportNoPlayableCardsResult> {\n const response = await fetch(`${this.baseUrl}/reportNoPlayableCards`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async sendChat(\n gameId: string,\n playerId: string,\n text: string,\n ): Promise<SendChatResult> {\n const response = await fetch(`${this.baseUrl}/sendChat`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, text }),\n });\n const result = await response.json();\n return result;\n }\n\n async startGame(gameId: string, playerId: string): Promise<StartGameResult> {\n const response = await fetch(`${this.baseUrl}/startGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n}\n"],"mappings":";;AA4BA,IAAa,SAAb,MAAoB;CAClB;CAEA,YAAY,SAAiB;EAC3B,KAAK,UAAU;CACjB;CAEA,MAAM,WAAW,aAAgD;EAQ/D,OAAO,OADc,MANE,MAAM,GAAG,KAAK,QAAQ,cAAc;GACzD,QAAQ;GACR,SAAS,EACP,eAAe,UAAU,cAC3B;EACF,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,SAAS,QAAgB,UAA2C;EASxE,OAAO,OADc,MAPE,MAAM,GAAG,KAAK,QAAQ,YAAY;GACvD,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;GAAS,CAAC;EAC3C,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,6BACJ,QACA,UAC6C;EAY7C,OAAO,OADc,MAVE,MACrB,GAAG,KAAK,QAAQ,gCAChB;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;GAAS,CAAC;EAC3C,CACF,EAAA,CAC8B,KAAK;CAErC;CAEA,MAAM,8BACJ,QACA,UACA,YAC8C;EAY9C,OAAO,OADc,MAVE,MACrB,GAAG,KAAK,QAAQ,iCAChB;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;IAAU;GAAW,CAAC;EACvD,CACF,EAAA,CAC8B,KAAK;CAErC;CAEA,MAAM,mBAAoD;EAKxD,OAAO,OADc,MAHE,MAAM,GAAG,KAAK,QAAQ,oBAAoB,EAC/D,QAAQ,OACV,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,SAAS,QAAgB,aAA8C;EAU3E,OAAO,OADc,MARE,MAAM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;GAAS,CAAC;EAC3C,CAAC,EAAA,CAC6B,KAAK;CAErC;AACF"}
|
package/dist/client/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as Card, h as ChatMessage, m as ClientState, p as GameEvent } from "../index-xmcja9Bl.cjs";
|
|
2
|
+
import { a as GetJoinableGamesResult, c as PlayCardResult, f as StartGameResult, i as GetEventsAndClearAcknowledgedResult, l as ReportNoPlayableCardsResult, n as DrawCardResult, o as JoinGameResult, r as GetClientStateAndClearEventsResult, s as LeaveGameResult, t as CreateGameResult, u as SendChatResult } from "../index-BvZyhFek.cjs";
|
|
3
3
|
//#region src/client/Client.d.ts
|
|
4
4
|
declare class Client {
|
|
5
5
|
private readonly baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/client/Client.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/client/Client.ts"],"mappings":";;;cA4Ba;mBACM;EAEL,YAAA;EAIN,WAAW,sBAAsB,QAAQ;EAWzC,SAAS,gBAAgB,mBAAmB,QAAQ;EAYpD,6BACJ,gBACA,mBACC,QAAQ;EAeL,8BACJ,gBACA,kBACA,4BACC,QAAQ;EAeL,oBAAoB,QAAQ;EAQ5B,SAAS,gBAAgB,sBAAsB,QAAQ;EAavD,UAAU,gBAAgB,mBAAmB,QAAQ;EAYrD,SACJ,gBACA,kBACA,gBACA,gCACC,QAAQ;EAYL,sBACJ,gBACA,mBACC,QAAQ;EAYL,SACJ,gBACA,kBACA,eACC,QAAQ;EAYL,UAAU,gBAAgB,mBAAmB,QAAQ"}
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as Card, h as ChatMessage, m as ClientState, p as GameEvent } from "../index-xmcja9Bl.mjs";
|
|
2
|
+
import { a as GetJoinableGamesResult, c as PlayCardResult, f as StartGameResult, i as GetEventsAndClearAcknowledgedResult, l as ReportNoPlayableCardsResult, n as DrawCardResult, o as JoinGameResult, r as GetClientStateAndClearEventsResult, s as LeaveGameResult, t as CreateGameResult, u as SendChatResult } from "../index-BRtLpRz1.mjs";
|
|
3
3
|
//#region src/client/Client.d.ts
|
|
4
4
|
declare class Client {
|
|
5
5
|
private readonly baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/client/Client.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/client/Client.ts"],"mappings":";;;cA4Ba;mBACM;EAEL,YAAA;EAIN,WAAW,sBAAsB,QAAQ;EAWzC,SAAS,gBAAgB,mBAAmB,QAAQ;EAYpD,6BACJ,gBACA,mBACC,QAAQ;EAeL,8BACJ,gBACA,kBACA,4BACC,QAAQ;EAeL,oBAAoB,QAAQ;EAQ5B,SAAS,gBAAgB,sBAAsB,QAAQ;EAavD,UAAU,gBAAgB,mBAAmB,QAAQ;EAYrD,SACJ,gBACA,kBACA,gBACA,gCACC,QAAQ;EAYL,sBACJ,gBACA,mBACC,QAAQ;EAYL,SACJ,gBACA,kBACA,eACC,QAAQ;EAYL,UAAU,gBAAgB,mBAAmB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/client/Client.ts"],"sourcesContent":["import type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n} from \"../server/index.js\";\n\nexport class Client {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async createGame(accessToken: string): Promise<CreateGameResult> {\n const response = await fetch(`${this.baseUrl}/createGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n const result = await response.json();\n return result;\n }\n\n async drawCard(gameId: string, playerId: string): Promise<DrawCardResult> {\n const response = await fetch(`${this.baseUrl}/drawCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async getClientStateAndClearEvents(\n gameId: string,\n playerId: string,\n ): Promise<GetClientStateAndClearEventsResult> {\n const response = await fetch(\n `${this.baseUrl}/getClientStateAndClearEvents`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getEventsAndClearAcknowledged(\n gameId: string,\n playerId: string,\n lastReadId: string | null,\n ): Promise<GetEventsAndClearAcknowledgedResult> {\n const response = await fetch(\n `${this.baseUrl}/getEventsAndClearAcknowledged`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, lastReadId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getJoinableGames(): Promise<GetJoinableGamesResult> {\n const response = await fetch(`${this.baseUrl}/getJoinableGames`, {\n method: \"POST\",\n });\n const result = await response.json();\n return result;\n }\n\n async joinGame(gameId: string, accessToken: string): Promise<JoinGameResult> {\n const response = await fetch(`${this.baseUrl}/joinGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId }),\n });\n const result = await response.json();\n return result;\n }\n\n async leaveGame(gameId: string, playerId: string): Promise<LeaveGameResult> {\n const response = await fetch(`${this.baseUrl}/leaveGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async playCard(\n gameId: string,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n ): Promise<PlayCardResult> {\n const response = await fetch(`${this.baseUrl}/playCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, cardId, isForOtherPlayerPile }),\n });\n const result = await response.json();\n return result;\n }\n\n async reportNoPlayableCards(\n gameId: string,\n playerId: string,\n ): Promise<ReportNoPlayableCardsResult> {\n const response = await fetch(`${this.baseUrl}/reportNoPlayableCards`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async sendChat(\n gameId: string,\n playerId: string,\n text: string,\n ): Promise<SendChatResult> {\n const response = await fetch(`${this.baseUrl}/sendChat`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, text }),\n });\n const result = await response.json();\n return result;\n }\n\n async startGame(gameId: string, playerId: string): Promise<StartGameResult> {\n const response = await fetch(`${this.baseUrl}/startGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/client/Client.ts"],"sourcesContent":["import type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n} from \"../server/index.js\";\n\nexport type {\n CreateGameResult,\n DrawCardResult,\n GetClientStateAndClearEventsResult,\n GetEventsAndClearAcknowledgedResult,\n GetJoinableGamesResult,\n JoinGameResult,\n LeaveGameResult,\n PlayCardResult,\n ReportNoPlayableCardsResult,\n SendChatResult,\n StartGameResult,\n};\n\nexport class Client {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async createGame(accessToken: string): Promise<CreateGameResult> {\n const response = await fetch(`${this.baseUrl}/createGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n const result = await response.json();\n return result;\n }\n\n async drawCard(gameId: string, playerId: string): Promise<DrawCardResult> {\n const response = await fetch(`${this.baseUrl}/drawCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async getClientStateAndClearEvents(\n gameId: string,\n playerId: string,\n ): Promise<GetClientStateAndClearEventsResult> {\n const response = await fetch(\n `${this.baseUrl}/getClientStateAndClearEvents`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getEventsAndClearAcknowledged(\n gameId: string,\n playerId: string,\n lastReadId: string | null,\n ): Promise<GetEventsAndClearAcknowledgedResult> {\n const response = await fetch(\n `${this.baseUrl}/getEventsAndClearAcknowledged`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, lastReadId }),\n },\n );\n const result = await response.json();\n return result;\n }\n\n async getJoinableGames(): Promise<GetJoinableGamesResult> {\n const response = await fetch(`${this.baseUrl}/getJoinableGames`, {\n method: \"POST\",\n });\n const result = await response.json();\n return result;\n }\n\n async joinGame(gameId: string, accessToken: string): Promise<JoinGameResult> {\n const response = await fetch(`${this.baseUrl}/joinGame`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId }),\n });\n const result = await response.json();\n return result;\n }\n\n async leaveGame(gameId: string, playerId: string): Promise<LeaveGameResult> {\n const response = await fetch(`${this.baseUrl}/leaveGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async playCard(\n gameId: string,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n ): Promise<PlayCardResult> {\n const response = await fetch(`${this.baseUrl}/playCard`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, cardId, isForOtherPlayerPile }),\n });\n const result = await response.json();\n return result;\n }\n\n async reportNoPlayableCards(\n gameId: string,\n playerId: string,\n ): Promise<ReportNoPlayableCardsResult> {\n const response = await fetch(`${this.baseUrl}/reportNoPlayableCards`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n\n async sendChat(\n gameId: string,\n playerId: string,\n text: string,\n ): Promise<SendChatResult> {\n const response = await fetch(`${this.baseUrl}/sendChat`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId, text }),\n });\n const result = await response.json();\n return result;\n }\n\n async startGame(gameId: string, playerId: string): Promise<StartGameResult> {\n const response = await fetch(`${this.baseUrl}/startGame`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ gameId, playerId }),\n });\n const result = await response.json();\n return result;\n }\n}\n"],"mappings":";AA4BA,IAAa,SAAb,MAAoB;CAClB;CAEA,YAAY,SAAiB;EAC3B,KAAK,UAAU;CACjB;CAEA,MAAM,WAAW,aAAgD;EAQ/D,OAAO,OADc,MANE,MAAM,GAAG,KAAK,QAAQ,cAAc;GACzD,QAAQ;GACR,SAAS,EACP,eAAe,UAAU,cAC3B;EACF,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,SAAS,QAAgB,UAA2C;EASxE,OAAO,OADc,MAPE,MAAM,GAAG,KAAK,QAAQ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AK,QAAQ,YAAY;GACvD,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;IAAU;IAAQ;GAAqB,CAAC;EACzE,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,sBACJ,QACA,UACsC;EAStC,OAAO,OADc,MAPE,MAAM,GAAG,KAAK,QAAQ,yBAAyB;GACpE,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;GAAS,CAAC;EAC3C,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,SACJ,QACA,UACA,MACyB;EASzB,OAAO,OADc,MAPE,MAAM,GAAG,KAAK,QAAQ,YAAY;GACvD,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;IAAU;GAAK,CAAC;EACjD,CAAC,EAAA,CAC6B,KAAK;CAErC;CAEA,MAAM,UAAU,QAAgB,UAA4C;EAS1E,OAAO,OADc,MAPE,MAAM,GAAG,KAAK,QAAQ,aAAa;GACxD,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU;IAAE;IAAQ;GAAS,CAAC;EAC3C,CAAC,EAAA,CAC6B,KAAK;CAErC;AACF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { c as Manager, m as ClientState, p as GameEvent } from "./index-xmcja9Bl.mjs";
|
|
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-BRtLpRz1.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BRtLpRz1.d.mts","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"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { c as Manager, m as ClientState, p as GameEvent } from "./index-xmcja9Bl.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-BvZyhFek.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BvZyhFek.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,23 +1,4 @@
|
|
|
1
|
-
|
|
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
|
|
1
|
+
import { ManagerBase } from "@hellacardgames/lib";
|
|
21
2
|
//#region src/manager/types/Card.d.ts
|
|
22
3
|
type Card = {
|
|
23
4
|
readonly id: string;
|
|
@@ -38,13 +19,13 @@ type ClientState = {
|
|
|
38
19
|
readonly gameId: string;
|
|
39
20
|
readonly playerId: string;
|
|
40
21
|
readonly username: string;
|
|
41
|
-
readonly players: readonly Player[];
|
|
22
|
+
readonly players: readonly Player$1[];
|
|
42
23
|
readonly expiresAt: number;
|
|
43
24
|
readonly chatMessages: readonly ChatMessage[];
|
|
44
25
|
readonly hand: readonly Card[];
|
|
45
26
|
readonly canPlayAt: number | null;
|
|
46
27
|
};
|
|
47
|
-
type Player = {
|
|
28
|
+
type Player$1 = {
|
|
48
29
|
readonly username: string;
|
|
49
30
|
readonly handSize: number;
|
|
50
31
|
readonly drawPileSize: number;
|
|
@@ -52,16 +33,6 @@ type Player = {
|
|
|
52
33
|
readonly centerPileTopCard: Card | null;
|
|
53
34
|
};
|
|
54
35
|
//#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
36
|
//#region src/manager/types/GameEvent.d.ts
|
|
66
37
|
type GameEvent = {
|
|
67
38
|
readonly type: "canPlayAtUpdated";
|
|
@@ -137,7 +108,77 @@ type GameEvent = {
|
|
|
137
108
|
readonly numCards: number;
|
|
138
109
|
};
|
|
139
110
|
//#endregion
|
|
140
|
-
//#region src/manager/
|
|
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 = OpenGame | StartedGame | CompletedGame | ForfeitedGame;
|
|
126
|
+
type OpenGame = {
|
|
127
|
+
readonly status: "open";
|
|
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
|
+
};
|
|
141
182
|
type GetEventsAndClearAcknowledgedResult = {
|
|
142
183
|
readonly success: true;
|
|
143
184
|
readonly events: readonly GameEvent[];
|
|
@@ -145,19 +186,12 @@ type GetEventsAndClearAcknowledgedResult = {
|
|
|
145
186
|
readonly success: false;
|
|
146
187
|
readonly error: "gameNotFound" | "playerNotFound";
|
|
147
188
|
};
|
|
148
|
-
declare function getEventsAndClearAcknowledged(gameId: string, playerId: string, lastReadId: string | null): GetEventsAndClearAcknowledgedResult;
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/manager/actions/getJoinableGames.d.ts
|
|
151
189
|
type GetJoinableGamesResult = {
|
|
152
|
-
readonly success: true;
|
|
153
190
|
readonly games: readonly {
|
|
154
191
|
readonly id: string;
|
|
155
192
|
readonly numPlayers: number;
|
|
156
193
|
}[];
|
|
157
194
|
};
|
|
158
|
-
declare function getJoinableGames(): GetJoinableGamesResult;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/manager/actions/joinGame.d.ts
|
|
161
195
|
type JoinGameResult = {
|
|
162
196
|
readonly success: true;
|
|
163
197
|
readonly playerId: string;
|
|
@@ -165,52 +199,49 @@ type JoinGameResult = {
|
|
|
165
199
|
readonly success: false;
|
|
166
200
|
readonly error: "gameNotFound" | "invalidStatus" | "maxPlayersReached" | "alreadyInGame";
|
|
167
201
|
};
|
|
168
|
-
declare function joinGame(gameId: string, userId: string, username: string): JoinGameResult;
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/manager/actions/leaveGame.d.ts
|
|
171
202
|
type LeaveGameResult = {
|
|
172
203
|
readonly success: true;
|
|
173
204
|
} | {
|
|
174
205
|
readonly success: false;
|
|
175
206
|
readonly error: "gameNotFound" | "playerNotFound";
|
|
176
207
|
};
|
|
177
|
-
declare function leaveGame(gameId: string, playerId: string): LeaveGameResult;
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/manager/actions/playCard.d.ts
|
|
180
208
|
type PlayCardResult = {
|
|
181
209
|
readonly success: true;
|
|
182
210
|
} | {
|
|
183
211
|
readonly success: false;
|
|
184
212
|
readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
|
|
185
213
|
};
|
|
186
|
-
declare function playCard(gameId: string, playerId: string, cardId: string, isForOtherPlayerPile: boolean): PlayCardResult;
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/manager/actions/reportNoPlayableCards.d.ts
|
|
189
214
|
type ReportNoPlayableCardsResult = {
|
|
190
215
|
readonly success: true;
|
|
191
216
|
} | {
|
|
192
217
|
readonly success: false;
|
|
193
218
|
readonly error: "gameNotFound" | "playerNotFound" | "invalidStatus" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
|
|
194
219
|
};
|
|
195
|
-
declare function reportNoPlayableCards(gameId: string, playerId: string): ReportNoPlayableCardsResult;
|
|
196
|
-
//#endregion
|
|
197
|
-
//#region src/manager/actions/sendChat.d.ts
|
|
198
220
|
type SendChatResult = {
|
|
199
221
|
readonly success: true;
|
|
200
222
|
} | {
|
|
201
223
|
readonly success: false;
|
|
202
224
|
readonly error: "gameNotFound" | "playerNotFound";
|
|
203
225
|
};
|
|
204
|
-
declare function sendChat(gameId: string, playerId: string, text: string): SendChatResult;
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/manager/actions/startGame.d.ts
|
|
207
226
|
type StartGameResult = {
|
|
208
227
|
readonly success: true;
|
|
209
228
|
} | {
|
|
210
229
|
readonly success: false;
|
|
211
|
-
readonly error: "gameNotFound" | "
|
|
212
|
-
};
|
|
213
|
-
declare
|
|
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
|
+
}
|
|
214
245
|
//#endregion
|
|
215
|
-
export {
|
|
216
|
-
//# sourceMappingURL=index-
|
|
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-xmcja9Bl.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-xmcja9Bl.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;WAC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