trucoshi 2.2.1 → 2.3.1

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/types.d.ts CHANGED
@@ -2,7 +2,17 @@ import { User } from "lightning-accounts";
2
2
  import { CARDS, IHand } from "./lib";
3
3
  import { IUserData } from "./server";
4
4
  import { SocketError } from "./server/classes/SocketError";
5
+ import { Match, MatchHand, MatchPlayer, UserStats } from "@prisma/client";
5
6
  export { CARDS, CARDS_HUMAN_READABLE, BURNT_CARD } from "./lib/constants";
7
+ export interface IMatchDetails extends Match {
8
+ players: Array<Pick<MatchPlayer, "id" | "accountId" | "teamIdx" | "name" | "idx">>;
9
+ hands: Array<MatchHand>;
10
+ }
11
+ export interface IAccountDetails {
12
+ stats: UserStats | null;
13
+ account: User | null;
14
+ matches: Array<Match>;
15
+ }
6
16
  export declare enum EMatchState {
7
17
  UNREADY = "UNREADY",
8
18
  READY = "READY",
@@ -150,6 +160,8 @@ export declare enum EClientEvent {
150
160
  LOGOUT = "LOGOUT",
151
161
  LEAVE_MATCH = "LEAVE_MATCH",
152
162
  CREATE_MATCH = "CREATE_MATCH",
163
+ FETCH_ACCOUNT_DETAILS = "FETCH_ACCOUNT_DETAILS",
164
+ FETCH_MATCH_DETAILS = "FETCH_MATCH_DETAILS",
153
165
  SET_MATCH_OPTIONS = "SET_MATCH_OPTIONS",
154
166
  LIST_MATCHES = "LIST_MATCHES",
155
167
  JOIN_MATCH = "JOIN_MATCH",
@@ -180,12 +192,16 @@ export interface ClientToServerEvents {
180
192
  match?: IPublicMatch;
181
193
  activeMatches?: IPublicMatchInfo[];
182
194
  }>) => void;
183
- [EClientEvent.START_MATCH]: (identityJwt: string | null, matchId: string, callback: IEventCallback<{
195
+ [EClientEvent.START_MATCH]: (identityJwt: string | null, matchSessionId: string, callback: IEventCallback<{
184
196
  matchSessionId?: string;
185
197
  }>) => void;
186
- [EClientEvent.FETCH_MATCH]: (matchId: string, callback: IEventCallback<{
198
+ [EClientEvent.FETCH_MATCH]: (matchSessionId: string, callback: IEventCallback<{
187
199
  match: IPublicMatch | null;
188
200
  }>) => void;
201
+ [EClientEvent.FETCH_MATCH_DETAILS]: (matchId: number, callback: IEventCallback<{
202
+ match: IMatchDetails | null;
203
+ }>) => void;
204
+ [EClientEvent.FETCH_ACCOUNT_DETAILS]: (accountId: number, callback: IEventCallback<IAccountDetails>) => void;
189
205
  [EClientEvent.LIST_MATCHES]: (filters: {
190
206
  state?: Array<EMatchState>;
191
207
  }, callback: IEventCallback<{
package/dist/types.js CHANGED
@@ -71,6 +71,8 @@ export var EClientEvent;
71
71
  EClientEvent["LOGOUT"] = "LOGOUT";
72
72
  EClientEvent["LEAVE_MATCH"] = "LEAVE_MATCH";
73
73
  EClientEvent["CREATE_MATCH"] = "CREATE_MATCH";
74
+ EClientEvent["FETCH_ACCOUNT_DETAILS"] = "FETCH_ACCOUNT_DETAILS";
75
+ EClientEvent["FETCH_MATCH_DETAILS"] = "FETCH_MATCH_DETAILS";
74
76
  EClientEvent["SET_MATCH_OPTIONS"] = "SET_MATCH_OPTIONS";
75
77
  EClientEvent["LIST_MATCHES"] = "LIST_MATCHES";
76
78
  EClientEvent["JOIN_MATCH"] = "JOIN_MATCH";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trucoshi",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
4
  "description": "Lightning Truco Server",
5
5
  "main": "dist/types.js",
6
6
  "license": "GPL-3.0",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "scripts": {
18
18
  "start": "nodemon",
19
- "start:e2e": "dotenv -e .env.e2e -- nodemon",
19
+ "start:e2e": "yarn build && dotenv -e .env.e2e -- node ./bin/trucoshi-server ",
20
20
  "profiler": "yarn build && node --prof ./bin/trucoshi-server",
21
21
  "build": "yarn run rimraf ./build && yarn run tsc --project . && yarn build:dist",
22
22
  "build:dist": "yarn run rimraf ./dist && yarn run tsc --project ./tsconfig.dist.json",