trucoshi 5.1.1 → 5.2.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/README.md CHANGED
@@ -47,8 +47,8 @@ Proba la demo actual en [Trucoshi](https://trucoshi.com)
47
47
  [x] Socket server
48
48
  [x] Unit tests
49
49
  [x] Bitcoin Lightning integration
50
+ [x] Historial de partidas
50
51
  [ ] Cantar flor
51
- [ ] Historial de partidas
52
52
  [ ] Torneos
53
53
 
54
54
  # Donations
package/dist/events.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EMatchState } from "@trucoshi/prisma";
2
2
  import { SocketError } from "./server";
3
- import { IAccountDetails, IChatMessage, ILobbyOptions, IMatchDetails, IMatchPreviousHand, IPlayedCard, IPublicChatRoom, IPublicMatch, IPublicMatchInfo, ISaidCommand, IUserData, IWaitingPlayData, IWaitingSayData } from "./types";
3
+ import { IAccountDetails, IChatMessage, ILobbyOptions, IMatchDetails, IMatchPreviousHand, IPublicChatRoom, IPublicMatch, IPublicMatchInfo, IUserData, IWaitingPlayData, IWaitingSayData } from "./types";
4
4
  import { User } from "lightning-accounts";
5
5
  export type IEventCallback<T = {}> = (args: {
6
6
  success: boolean;
@@ -9,14 +9,13 @@ export type IEventCallback<T = {}> = (args: {
9
9
  export declare enum EServerEvent {
10
10
  PONG = "PONG",
11
11
  SET_SESSION = "SET_SESSION",
12
+ REFRESH_IDENTITY = "REFRESH_IDENTITY",
12
13
  PREVIOUS_HAND = "PREVIOUS_HAND",
13
14
  UPDATE_MATCH = "UPDATE_MATCH",
14
15
  MATCH_DELETED = "MATCH_DELETED",
15
16
  WAITING_PLAY = "WAITING_PLAY",
16
17
  KICK_PLAYER = "PLAYER_KICKED",
17
18
  UPDATE_ACTIVE_MATCHES = "UPDATE_ACTIVE_MATCHES",
18
- PLAYER_USED_CARD = "PLAYER_USED_CARD",
19
- PLAYER_SAID_COMMAND = "PLAYER_SAID_COMMAND",
20
19
  WAITING_POSSIBLE_SAY = "WAITING_POSSIBLE_SAY",
21
20
  UPDATE_CHAT = "UPDAET_CHAT"
22
21
  }
@@ -26,13 +25,12 @@ export interface ServerToClientEvents {
26
25
  [EServerEvent.UPDATE_CHAT]: (room: IPublicChatRoom, message?: IChatMessage) => void;
27
26
  [EServerEvent.UPDATE_ACTIVE_MATCHES]: (activeMatches: IPublicMatchInfo[]) => void;
28
27
  [EServerEvent.UPDATE_MATCH]: (match: IPublicMatch, callback?: () => void) => void;
29
- [EServerEvent.PLAYER_USED_CARD]: (match: IPublicMatch, card: IPlayedCard) => void;
30
- [EServerEvent.PLAYER_SAID_COMMAND]: (match: IPublicMatch, command: ISaidCommand) => void;
31
28
  [EServerEvent.KICK_PLAYER]: (match: IPublicMatch, session: string, reason?: string) => void;
32
29
  [EServerEvent.MATCH_DELETED]: (matchSessionId: string) => void;
33
30
  [EServerEvent.SET_SESSION]: (userData: IUserData, serverVersion: string, activeMatches: Array<IPublicMatchInfo>) => void;
34
31
  [EServerEvent.WAITING_POSSIBLE_SAY]: (match: IPublicMatch, callback: (data: IWaitingSayData) => void) => void;
35
32
  [EServerEvent.WAITING_PLAY]: (match: IPublicMatch, callback: (data: IWaitingPlayData) => void) => void;
33
+ [EServerEvent.REFRESH_IDENTITY]: (userId: number, callback: (identityJwt: string | null) => void) => void;
36
34
  }
37
35
  export declare enum EClientEvent {
38
36
  LOGIN = "LOGIN",
@@ -61,7 +59,7 @@ export interface ClientToServerEvents {
61
59
  match?: IPublicMatch;
62
60
  activeMatches?: IPublicMatchInfo[];
63
61
  }>) => void;
64
- [EClientEvent.SET_MATCH_OPTIONS]: (identityJwt: string | null, matchSessionId: string, options: Partial<ILobbyOptions>, callback: IEventCallback<{
62
+ [EClientEvent.SET_MATCH_OPTIONS]: (matchSessionId: string, options: Partial<ILobbyOptions>, callback: IEventCallback<{
65
63
  match?: IPublicMatch;
66
64
  activeMatches?: IPublicMatchInfo[];
67
65
  }>) => void;
@@ -72,7 +70,7 @@ export interface ClientToServerEvents {
72
70
  match?: IPublicMatch;
73
71
  activeMatches?: IPublicMatchInfo[];
74
72
  }>) => void;
75
- [EClientEvent.START_MATCH]: (identityJwt: string | null, matchSessionId: string, callback: IEventCallback<{
73
+ [EClientEvent.START_MATCH]: (matchSessionId: string, callback: IEventCallback<{
76
74
  matchSessionId?: string;
77
75
  }>) => void;
78
76
  [EClientEvent.KICK_PLAYER]: (matchSessionId: string, key: string, callback: IEventCallback) => void;
package/dist/events.js CHANGED
@@ -2,14 +2,13 @@ export var EServerEvent;
2
2
  (function (EServerEvent) {
3
3
  EServerEvent["PONG"] = "PONG";
4
4
  EServerEvent["SET_SESSION"] = "SET_SESSION";
5
+ EServerEvent["REFRESH_IDENTITY"] = "REFRESH_IDENTITY";
5
6
  EServerEvent["PREVIOUS_HAND"] = "PREVIOUS_HAND";
6
7
  EServerEvent["UPDATE_MATCH"] = "UPDATE_MATCH";
7
8
  EServerEvent["MATCH_DELETED"] = "MATCH_DELETED";
8
9
  EServerEvent["WAITING_PLAY"] = "WAITING_PLAY";
9
10
  EServerEvent["KICK_PLAYER"] = "PLAYER_KICKED";
10
11
  EServerEvent["UPDATE_ACTIVE_MATCHES"] = "UPDATE_ACTIVE_MATCHES";
11
- EServerEvent["PLAYER_USED_CARD"] = "PLAYER_USED_CARD";
12
- EServerEvent["PLAYER_SAID_COMMAND"] = "PLAYER_SAID_COMMAND";
13
12
  EServerEvent["WAITING_POSSIBLE_SAY"] = "WAITING_POSSIBLE_SAY";
14
13
  EServerEvent["UPDATE_CHAT"] = "UPDAET_CHAT";
15
14
  })(EServerEvent || (EServerEvent = {}));
@@ -1,4 +1,4 @@
1
- export const PLAYER_ABANDON_TIMEOUT = 1000 * 45;
1
+ export const PLAYER_ABANDON_TIMEOUT = 1000 * 60;
2
2
  export const PLAYER_TURN_TIMEOUT = 1000 * 30;
3
3
  export const PREVIOUS_HAND_ACK_TIMEOUT = 1000 * 5;
4
4
  export const CARDS = {
package/dist/types.d.ts CHANGED
@@ -143,6 +143,7 @@ export type IWaitingSayData = {
143
143
  };
144
144
  export type IWaitingSayCallback = (data: IWaitingSayData) => void | null;
145
145
  export declare enum GAME_ERROR {
146
+ INVALID_IDENTITY = "INVALID_IDENTITY",
146
147
  UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
147
148
  FORBIDDEN = "FORBIDDEN",
148
149
  NOT_FOUND = "NOT_FOUND",
package/dist/types.js CHANGED
@@ -54,6 +54,7 @@ export var EHandState;
54
54
  })(EHandState || (EHandState = {}));
55
55
  export var GAME_ERROR;
56
56
  (function (GAME_ERROR) {
57
+ GAME_ERROR["INVALID_IDENTITY"] = "INVALID_IDENTITY";
57
58
  GAME_ERROR["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
58
59
  GAME_ERROR["FORBIDDEN"] = "FORBIDDEN";
59
60
  GAME_ERROR["NOT_FOUND"] = "NOT_FOUND";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trucoshi",
3
- "version": "5.1.1",
3
+ "version": "5.2.1",
4
4
  "description": "Lightning Truco Server",
5
5
  "main": "dist/types.js",
6
6
  "license": "GPL-3.0",