trucoshi 3.0.0 → 4.0.3
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/events.d.ts +94 -0
- package/dist/events.js +34 -0
- package/dist/types.d.ts +14 -103
- package/dist/types.js +1 -55
- package/package.json +8 -2
- package/prisma/client/index-browser.d.ts +0 -184
- package/prisma/client/index-browser.js +0 -205
- package/prisma/client/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
- package/prisma/client/package.json +0 -6
- package/prisma/client/runtime/index-browser.d.ts +0 -322
- package/prisma/client/runtime/index-browser.js +0 -2410
- package/prisma/client/runtime/index.d.ts +0 -2716
- package/prisma/client/runtime/library.d.ts +0 -1
- package/prisma/client/runtime/library.js +0 -209
- package/prisma/migrations/20240109031536_init/migration.sql +0 -82
- package/prisma/migrations/20240109033400_truco_winner_optional/migration.sql +0 -2
- package/prisma/migrations/20240110222804_player_session/migration.sql +0 -3
- package/prisma/migrations/20240110222816_remove_default/migration.sql +0 -2
- package/prisma/migrations/20240111032135_match_session_id/migration.sql +0 -2
- package/prisma/migrations/20240111032250_remove_match_session_id/migration.sql +0 -8
- package/prisma/migrations/20240126035758_/migration.sql +0 -28
- package/prisma/migrations/20240126035829_/migration.sql +0 -3
- package/prisma/migrations/migration_lock.toml +0 -3
- package/prisma/schema.prisma +0 -91
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { EMatchState } from "@trucoshi/prisma";
|
|
2
|
+
import { SocketError } from "./server";
|
|
3
|
+
import { IAccountDetails, IChatMessage, ILobbyOptions, IMatchDetails, IMatchPreviousHand, IPlayedCard, IPublicChatRoom, IPublicMatch, IPublicMatchInfo, ISaidCommand, IUserData, IWaitingPlayData, IWaitingSayData } from "./types";
|
|
4
|
+
import { User } from "lightning-accounts";
|
|
5
|
+
export type IEventCallback<T = {}> = (args: {
|
|
6
|
+
success: boolean;
|
|
7
|
+
error?: SocketError;
|
|
8
|
+
} & T) => void;
|
|
9
|
+
export declare enum EServerEvent {
|
|
10
|
+
PONG = "PONG",
|
|
11
|
+
SET_SESSION = "SET_SESSION",
|
|
12
|
+
PREVIOUS_HAND = "PREVIOUS_HAND",
|
|
13
|
+
UPDATE_MATCH = "UPDATE_MATCH",
|
|
14
|
+
MATCH_DELETED = "MATCH_DELETED",
|
|
15
|
+
WAITING_PLAY = "WAITING_PLAY",
|
|
16
|
+
KICK_PLAYER = "PLAYER_KICKED",
|
|
17
|
+
UPDATE_ACTIVE_MATCHES = "UPDATE_ACTIVE_MATCHES",
|
|
18
|
+
PLAYER_USED_CARD = "PLAYER_USED_CARD",
|
|
19
|
+
PLAYER_SAID_COMMAND = "PLAYER_SAID_COMMAND",
|
|
20
|
+
WAITING_POSSIBLE_SAY = "WAITING_POSSIBLE_SAY",
|
|
21
|
+
UPDATE_CHAT = "UPDAET_CHAT"
|
|
22
|
+
}
|
|
23
|
+
export interface ServerToClientEvents {
|
|
24
|
+
[EServerEvent.PONG]: (serverTime: number, clientTime: number) => void;
|
|
25
|
+
[EServerEvent.PREVIOUS_HAND]: (value: IMatchPreviousHand, callback: () => void) => void;
|
|
26
|
+
[EServerEvent.UPDATE_CHAT]: (room: IPublicChatRoom, message?: IChatMessage) => void;
|
|
27
|
+
[EServerEvent.UPDATE_ACTIVE_MATCHES]: (activeMatches: IPublicMatchInfo[]) => void;
|
|
28
|
+
[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
|
+
[EServerEvent.KICK_PLAYER]: (match: IPublicMatch, session: string, reason?: string) => void;
|
|
32
|
+
[EServerEvent.MATCH_DELETED]: (matchSessionId: string) => void;
|
|
33
|
+
[EServerEvent.SET_SESSION]: (userData: IUserData, serverVersion: string, activeMatches: Array<IPublicMatchInfo>) => void;
|
|
34
|
+
[EServerEvent.WAITING_POSSIBLE_SAY]: (match: IPublicMatch, callback: (data: IWaitingSayData) => void) => void;
|
|
35
|
+
[EServerEvent.WAITING_PLAY]: (match: IPublicMatch, callback: (data: IWaitingPlayData) => void) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare enum EClientEvent {
|
|
38
|
+
LOGIN = "LOGIN",
|
|
39
|
+
LOGOUT = "LOGOUT",
|
|
40
|
+
LEAVE_MATCH = "LEAVE_MATCH",
|
|
41
|
+
CREATE_MATCH = "CREATE_MATCH",
|
|
42
|
+
FETCH_ACCOUNT_DETAILS = "FETCH_ACCOUNT_DETAILS",
|
|
43
|
+
FETCH_MATCH_DETAILS = "FETCH_MATCH_DETAILS",
|
|
44
|
+
SET_MATCH_OPTIONS = "SET_MATCH_OPTIONS",
|
|
45
|
+
LIST_MATCHES = "LIST_MATCHES",
|
|
46
|
+
JOIN_MATCH = "JOIN_MATCH",
|
|
47
|
+
START_MATCH = "START_MATCH",
|
|
48
|
+
SET_PLAYER_READY = "SET_PLAYER_READY",
|
|
49
|
+
FETCH_MATCH = "FETCH_MATCH",
|
|
50
|
+
KICK_PLAYER = "KICK_PLAYER",
|
|
51
|
+
CHAT = "CHAT",
|
|
52
|
+
PING = "PING",
|
|
53
|
+
SAY = "SAY"
|
|
54
|
+
}
|
|
55
|
+
export interface ClientToServerEvents {
|
|
56
|
+
[EClientEvent.LOGOUT]: (callback: IEventCallback<{}>) => void;
|
|
57
|
+
[EClientEvent.PING]: (clientTime: number) => void;
|
|
58
|
+
[EClientEvent.CHAT]: (matchId: string, msg: string, callback: () => void) => void;
|
|
59
|
+
[EClientEvent.LEAVE_MATCH]: (matchId: string, callback?: IEventCallback<{}>) => void;
|
|
60
|
+
[EClientEvent.CREATE_MATCH]: (callback: IEventCallback<{
|
|
61
|
+
match?: IPublicMatch;
|
|
62
|
+
activeMatches?: IPublicMatchInfo[];
|
|
63
|
+
}>) => void;
|
|
64
|
+
[EClientEvent.SET_MATCH_OPTIONS]: (identityJwt: string | null, matchSessionId: string, options: Partial<ILobbyOptions>, callback: IEventCallback<{
|
|
65
|
+
match?: IPublicMatch;
|
|
66
|
+
activeMatches?: IPublicMatchInfo[];
|
|
67
|
+
}>) => void;
|
|
68
|
+
[EClientEvent.SET_PLAYER_READY]: (matchSessionId: string, ready: boolean, callback: IEventCallback<{
|
|
69
|
+
match?: IPublicMatch;
|
|
70
|
+
}>) => void;
|
|
71
|
+
[EClientEvent.JOIN_MATCH]: (matchSessionId: string, teamIdx: 0 | 1 | undefined, callback: IEventCallback<{
|
|
72
|
+
match?: IPublicMatch;
|
|
73
|
+
activeMatches?: IPublicMatchInfo[];
|
|
74
|
+
}>) => void;
|
|
75
|
+
[EClientEvent.START_MATCH]: (identityJwt: string | null, matchSessionId: string, callback: IEventCallback<{
|
|
76
|
+
matchSessionId?: string;
|
|
77
|
+
}>) => void;
|
|
78
|
+
[EClientEvent.KICK_PLAYER]: (matchSessionId: string, key: string, callback: IEventCallback) => void;
|
|
79
|
+
[EClientEvent.FETCH_MATCH]: (matchSessionId: string, callback: IEventCallback<{
|
|
80
|
+
match: IPublicMatch | null;
|
|
81
|
+
}>) => void;
|
|
82
|
+
[EClientEvent.FETCH_MATCH_DETAILS]: (matchId: number, callback: IEventCallback<{
|
|
83
|
+
match: IMatchDetails | null;
|
|
84
|
+
}>) => void;
|
|
85
|
+
[EClientEvent.FETCH_ACCOUNT_DETAILS]: (accountId: number, callback: IEventCallback<IAccountDetails>) => void;
|
|
86
|
+
[EClientEvent.LIST_MATCHES]: (filters: {
|
|
87
|
+
state?: Array<EMatchState>;
|
|
88
|
+
}, callback: IEventCallback<{
|
|
89
|
+
matches: Array<IPublicMatchInfo>;
|
|
90
|
+
}>) => void;
|
|
91
|
+
[EClientEvent.LOGIN]: (user: User, identityToken: string, callback: IEventCallback<{
|
|
92
|
+
activeMatches?: IPublicMatchInfo[];
|
|
93
|
+
}>) => void;
|
|
94
|
+
}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export var EServerEvent;
|
|
2
|
+
(function (EServerEvent) {
|
|
3
|
+
EServerEvent["PONG"] = "PONG";
|
|
4
|
+
EServerEvent["SET_SESSION"] = "SET_SESSION";
|
|
5
|
+
EServerEvent["PREVIOUS_HAND"] = "PREVIOUS_HAND";
|
|
6
|
+
EServerEvent["UPDATE_MATCH"] = "UPDATE_MATCH";
|
|
7
|
+
EServerEvent["MATCH_DELETED"] = "MATCH_DELETED";
|
|
8
|
+
EServerEvent["WAITING_PLAY"] = "WAITING_PLAY";
|
|
9
|
+
EServerEvent["KICK_PLAYER"] = "PLAYER_KICKED";
|
|
10
|
+
EServerEvent["UPDATE_ACTIVE_MATCHES"] = "UPDATE_ACTIVE_MATCHES";
|
|
11
|
+
EServerEvent["PLAYER_USED_CARD"] = "PLAYER_USED_CARD";
|
|
12
|
+
EServerEvent["PLAYER_SAID_COMMAND"] = "PLAYER_SAID_COMMAND";
|
|
13
|
+
EServerEvent["WAITING_POSSIBLE_SAY"] = "WAITING_POSSIBLE_SAY";
|
|
14
|
+
EServerEvent["UPDATE_CHAT"] = "UPDAET_CHAT";
|
|
15
|
+
})(EServerEvent || (EServerEvent = {}));
|
|
16
|
+
export var EClientEvent;
|
|
17
|
+
(function (EClientEvent) {
|
|
18
|
+
EClientEvent["LOGIN"] = "LOGIN";
|
|
19
|
+
EClientEvent["LOGOUT"] = "LOGOUT";
|
|
20
|
+
EClientEvent["LEAVE_MATCH"] = "LEAVE_MATCH";
|
|
21
|
+
EClientEvent["CREATE_MATCH"] = "CREATE_MATCH";
|
|
22
|
+
EClientEvent["FETCH_ACCOUNT_DETAILS"] = "FETCH_ACCOUNT_DETAILS";
|
|
23
|
+
EClientEvent["FETCH_MATCH_DETAILS"] = "FETCH_MATCH_DETAILS";
|
|
24
|
+
EClientEvent["SET_MATCH_OPTIONS"] = "SET_MATCH_OPTIONS";
|
|
25
|
+
EClientEvent["LIST_MATCHES"] = "LIST_MATCHES";
|
|
26
|
+
EClientEvent["JOIN_MATCH"] = "JOIN_MATCH";
|
|
27
|
+
EClientEvent["START_MATCH"] = "START_MATCH";
|
|
28
|
+
EClientEvent["SET_PLAYER_READY"] = "SET_PLAYER_READY";
|
|
29
|
+
EClientEvent["FETCH_MATCH"] = "FETCH_MATCH";
|
|
30
|
+
EClientEvent["KICK_PLAYER"] = "KICK_PLAYER";
|
|
31
|
+
EClientEvent["CHAT"] = "CHAT";
|
|
32
|
+
EClientEvent["PING"] = "PING";
|
|
33
|
+
EClientEvent["SAY"] = "SAY";
|
|
34
|
+
})(EClientEvent || (EClientEvent = {}));
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
export * from "./events";
|
|
2
|
+
export { CARDS, CARDS_HUMAN_READABLE, BURNT_CARD } from "./lib/constants";
|
|
1
3
|
import { User } from "lightning-accounts";
|
|
2
|
-
import { CARDS
|
|
3
|
-
import { SocketError } from "./server/classes/SocketError";
|
|
4
|
+
import { CARDS } from "./lib";
|
|
4
5
|
import { Match, MatchPlayer, MatchHand, UserStats } from "@trucoshi/prisma";
|
|
5
|
-
|
|
6
|
+
import { IHand } from "./truco";
|
|
7
|
+
export declare enum EMatchState {
|
|
8
|
+
UNREADY = "UNREADY",
|
|
9
|
+
READY = "READY",
|
|
10
|
+
STARTED = "STARTED",
|
|
11
|
+
FINISHED = "FINISHED"
|
|
12
|
+
}
|
|
6
13
|
export interface IMatchDetails extends Match {
|
|
7
14
|
players: Array<Pick<MatchPlayer, "id" | "accountId" | "teamIdx" | "name" | "idx">>;
|
|
8
15
|
hands: Array<MatchHand>;
|
|
@@ -12,12 +19,6 @@ export interface IAccountDetails {
|
|
|
12
19
|
account: User | null;
|
|
13
20
|
matches: Array<Match>;
|
|
14
21
|
}
|
|
15
|
-
export declare enum EMatchState {
|
|
16
|
-
UNREADY = "UNREADY",
|
|
17
|
-
READY = "READY",
|
|
18
|
-
STARTED = "STARTED",
|
|
19
|
-
FINISHED = "FINISHED"
|
|
20
|
-
}
|
|
21
22
|
export interface IUserData {
|
|
22
23
|
key: string;
|
|
23
24
|
name: string;
|
|
@@ -44,11 +45,13 @@ export interface IMatchPreviousHand {
|
|
|
44
45
|
matchSessionId: string;
|
|
45
46
|
}
|
|
46
47
|
export interface IPublicMatch {
|
|
48
|
+
id?: number;
|
|
47
49
|
options: ILobbyOptions;
|
|
48
50
|
busy: boolean;
|
|
49
51
|
state: EMatchState;
|
|
50
52
|
winner: ITeam | null;
|
|
51
53
|
matchSessionId: string;
|
|
54
|
+
ownerKey: string;
|
|
52
55
|
teams: Array<IPublicTeam>;
|
|
53
56
|
players: Array<IPublicPlayer>;
|
|
54
57
|
me: IPublicPlayer | null;
|
|
@@ -129,94 +132,6 @@ export type ECommand = ESayCommand | EEnvidoCommand | EAnswerCommand | EEnvidoAn
|
|
|
129
132
|
export type IHandCommands = {
|
|
130
133
|
[key in ECommand]: (hand: IHand, player: IPlayer) => void;
|
|
131
134
|
};
|
|
132
|
-
export type IEventCallback<T = {}> = (args: {
|
|
133
|
-
success: boolean;
|
|
134
|
-
error?: SocketError;
|
|
135
|
-
} & T) => void;
|
|
136
|
-
export declare enum EServerEvent {
|
|
137
|
-
PONG = "PONG",
|
|
138
|
-
SET_SESSION = "SET_SESSION",
|
|
139
|
-
PREVIOUS_HAND = "PREVIOUS_HAND",
|
|
140
|
-
UPDATE_MATCH = "UPDATE_MATCH",
|
|
141
|
-
MATCH_DELETED = "MATCH_DELETED",
|
|
142
|
-
WAITING_PLAY = "WAITING_PLAY",
|
|
143
|
-
KICK_PLAYER = "PLAYER_KICKED",
|
|
144
|
-
UPDATE_ACTIVE_MATCHES = "UPDATE_ACTIVE_MATCHES",
|
|
145
|
-
PLAYER_USED_CARD = "PLAYER_USED_CARD",
|
|
146
|
-
PLAYER_SAID_COMMAND = "PLAYER_SAID_COMMAND",
|
|
147
|
-
WAITING_POSSIBLE_SAY = "WAITING_POSSIBLE_SAY",
|
|
148
|
-
UPDATE_CHAT = "UPDAET_CHAT"
|
|
149
|
-
}
|
|
150
|
-
export interface ServerToClientEvents {
|
|
151
|
-
[EServerEvent.PONG]: (serverTime: number, clientTime: number) => void;
|
|
152
|
-
[EServerEvent.PREVIOUS_HAND]: (value: IMatchPreviousHand, callback: () => void) => void;
|
|
153
|
-
[EServerEvent.UPDATE_CHAT]: (room: IPublicChatRoom, message?: IChatMessage) => void;
|
|
154
|
-
[EServerEvent.UPDATE_ACTIVE_MATCHES]: (activeMatches: IPublicMatchInfo[]) => void;
|
|
155
|
-
[EServerEvent.UPDATE_MATCH]: (match: IPublicMatch, callback?: () => void) => void;
|
|
156
|
-
[EServerEvent.PLAYER_USED_CARD]: (match: IPublicMatch, card: IPlayedCard) => void;
|
|
157
|
-
[EServerEvent.PLAYER_SAID_COMMAND]: (match: IPublicMatch, command: ISaidCommand) => void;
|
|
158
|
-
[EServerEvent.KICK_PLAYER]: (match: IPublicMatch, session: string, reason?: string) => void;
|
|
159
|
-
[EServerEvent.MATCH_DELETED]: (matchSessionId: string) => void;
|
|
160
|
-
[EServerEvent.SET_SESSION]: (userData: IUserData, serverVersion: string, activeMatches: Array<IPublicMatchInfo>) => void;
|
|
161
|
-
[EServerEvent.WAITING_POSSIBLE_SAY]: (match: IPublicMatch, callback: (data: IWaitingSayData) => void) => void;
|
|
162
|
-
[EServerEvent.WAITING_PLAY]: (match: IPublicMatch, callback: (data: IWaitingPlayData) => void) => void;
|
|
163
|
-
}
|
|
164
|
-
export declare enum EClientEvent {
|
|
165
|
-
LOGIN = "LOGIN",
|
|
166
|
-
LOGOUT = "LOGOUT",
|
|
167
|
-
LEAVE_MATCH = "LEAVE_MATCH",
|
|
168
|
-
CREATE_MATCH = "CREATE_MATCH",
|
|
169
|
-
FETCH_ACCOUNT_DETAILS = "FETCH_ACCOUNT_DETAILS",
|
|
170
|
-
FETCH_MATCH_DETAILS = "FETCH_MATCH_DETAILS",
|
|
171
|
-
SET_MATCH_OPTIONS = "SET_MATCH_OPTIONS",
|
|
172
|
-
LIST_MATCHES = "LIST_MATCHES",
|
|
173
|
-
JOIN_MATCH = "JOIN_MATCH",
|
|
174
|
-
START_MATCH = "START_MATCH",
|
|
175
|
-
SET_PLAYER_READY = "SET_PLAYER_READY",
|
|
176
|
-
FETCH_MATCH = "FETCH_MATCH",
|
|
177
|
-
CHAT = "CHAT",
|
|
178
|
-
PING = "PING",
|
|
179
|
-
SAY = "SAY"
|
|
180
|
-
}
|
|
181
|
-
export interface ClientToServerEvents {
|
|
182
|
-
[EClientEvent.LOGOUT]: (callback: IEventCallback<{}>) => void;
|
|
183
|
-
[EClientEvent.PING]: (clientTime: number) => void;
|
|
184
|
-
[EClientEvent.CHAT]: (matchId: string, msg: string, callback: () => void) => void;
|
|
185
|
-
[EClientEvent.LEAVE_MATCH]: (matchId: string, callback?: IEventCallback<{}>) => void;
|
|
186
|
-
[EClientEvent.CREATE_MATCH]: (callback: IEventCallback<{
|
|
187
|
-
match?: IPublicMatch;
|
|
188
|
-
activeMatches?: IPublicMatchInfo[];
|
|
189
|
-
}>) => void;
|
|
190
|
-
[EClientEvent.SET_MATCH_OPTIONS]: (identityJwt: string | null, matchSessionId: string, options: Partial<ILobbyOptions>, callback: IEventCallback<{
|
|
191
|
-
match?: IPublicMatch;
|
|
192
|
-
activeMatches?: IPublicMatchInfo[];
|
|
193
|
-
}>) => void;
|
|
194
|
-
[EClientEvent.SET_PLAYER_READY]: (matchSessionId: string, ready: boolean, callback: IEventCallback<{
|
|
195
|
-
match?: IPublicMatch;
|
|
196
|
-
}>) => void;
|
|
197
|
-
[EClientEvent.JOIN_MATCH]: (matchSessionId: string, teamIdx: 0 | 1 | undefined, callback: IEventCallback<{
|
|
198
|
-
match?: IPublicMatch;
|
|
199
|
-
activeMatches?: IPublicMatchInfo[];
|
|
200
|
-
}>) => void;
|
|
201
|
-
[EClientEvent.START_MATCH]: (identityJwt: string | null, matchSessionId: string, callback: IEventCallback<{
|
|
202
|
-
matchSessionId?: string;
|
|
203
|
-
}>) => void;
|
|
204
|
-
[EClientEvent.FETCH_MATCH]: (matchSessionId: string, callback: IEventCallback<{
|
|
205
|
-
match: IPublicMatch | null;
|
|
206
|
-
}>) => void;
|
|
207
|
-
[EClientEvent.FETCH_MATCH_DETAILS]: (matchId: number, callback: IEventCallback<{
|
|
208
|
-
match: IMatchDetails | null;
|
|
209
|
-
}>) => void;
|
|
210
|
-
[EClientEvent.FETCH_ACCOUNT_DETAILS]: (accountId: number, callback: IEventCallback<IAccountDetails>) => void;
|
|
211
|
-
[EClientEvent.LIST_MATCHES]: (filters: {
|
|
212
|
-
state?: Array<EMatchState>;
|
|
213
|
-
}, callback: IEventCallback<{
|
|
214
|
-
matches: Array<IPublicMatchInfo>;
|
|
215
|
-
}>) => void;
|
|
216
|
-
[EClientEvent.LOGIN]: (user: User, identityToken: string, callback: IEventCallback<{
|
|
217
|
-
activeMatches?: IPublicMatchInfo[];
|
|
218
|
-
}>) => void;
|
|
219
|
-
}
|
|
220
135
|
export type IWaitingPlayData = {
|
|
221
136
|
cardIdx: number;
|
|
222
137
|
card: ICard;
|
|
@@ -226,11 +141,6 @@ export type IWaitingSayData = {
|
|
|
226
141
|
command: ECommand | number;
|
|
227
142
|
};
|
|
228
143
|
export type IWaitingSayCallback = (data: IWaitingSayData) => void | null;
|
|
229
|
-
export declare class TMap<K, V> extends Map<K, V> {
|
|
230
|
-
find(finder: (value: V) => boolean): V | void;
|
|
231
|
-
findAll(finder: (value: V) => boolean): V[];
|
|
232
|
-
getOrThrow(key?: K): NonNullable<V>;
|
|
233
|
-
}
|
|
234
144
|
export declare enum GAME_ERROR {
|
|
235
145
|
UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
|
|
236
146
|
FORBIDDEN = "FORBIDDEN",
|
|
@@ -297,7 +207,7 @@ export interface IRandom {
|
|
|
297
207
|
clients: string[];
|
|
298
208
|
};
|
|
299
209
|
}
|
|
300
|
-
export type IPublicPlayer = Pick<IPlayer, "
|
|
210
|
+
export type IPublicPlayer = Pick<IPlayer, "idx" | "key" | "name" | "disabled" | "abandoned" | "ready" | "hand" | "usedHand" | "prevHand" | "teamIdx" | "isTurn" | "turnExpiresAt" | "turnExtensionExpiresAt" | "isEnvidoTurn" | "isOwner"> & ({
|
|
301
211
|
isMe?: true;
|
|
302
212
|
commands: IPlayer["commands"];
|
|
303
213
|
hasFlor: IPlayer["hasFlor"];
|
|
@@ -315,6 +225,7 @@ export type IPublicTeam = Pick<ITeam, "points" | "id" | "name"> & {
|
|
|
315
225
|
};
|
|
316
226
|
export interface IPlayer {
|
|
317
227
|
idx: number;
|
|
228
|
+
secret: string;
|
|
318
229
|
teamIdx: number;
|
|
319
230
|
accountId: number | undefined;
|
|
320
231
|
matchPlayerId: number | undefined;
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./events";
|
|
1
2
|
export { CARDS, CARDS_HUMAN_READABLE, BURNT_CARD } from "./lib/constants";
|
|
2
3
|
export var EMatchState;
|
|
3
4
|
(function (EMatchState) {
|
|
@@ -50,61 +51,6 @@ export var EHandState;
|
|
|
50
51
|
EHandState["WAITING_ENVIDO_POINTS_ANSWER"] = "WAITING_ENVIDO_POINTS_ANSWER";
|
|
51
52
|
EHandState["FINISHED"] = "FINISHED";
|
|
52
53
|
})(EHandState || (EHandState = {}));
|
|
53
|
-
export var EServerEvent;
|
|
54
|
-
(function (EServerEvent) {
|
|
55
|
-
EServerEvent["PONG"] = "PONG";
|
|
56
|
-
EServerEvent["SET_SESSION"] = "SET_SESSION";
|
|
57
|
-
EServerEvent["PREVIOUS_HAND"] = "PREVIOUS_HAND";
|
|
58
|
-
EServerEvent["UPDATE_MATCH"] = "UPDATE_MATCH";
|
|
59
|
-
EServerEvent["MATCH_DELETED"] = "MATCH_DELETED";
|
|
60
|
-
EServerEvent["WAITING_PLAY"] = "WAITING_PLAY";
|
|
61
|
-
EServerEvent["KICK_PLAYER"] = "PLAYER_KICKED";
|
|
62
|
-
EServerEvent["UPDATE_ACTIVE_MATCHES"] = "UPDATE_ACTIVE_MATCHES";
|
|
63
|
-
EServerEvent["PLAYER_USED_CARD"] = "PLAYER_USED_CARD";
|
|
64
|
-
EServerEvent["PLAYER_SAID_COMMAND"] = "PLAYER_SAID_COMMAND";
|
|
65
|
-
EServerEvent["WAITING_POSSIBLE_SAY"] = "WAITING_POSSIBLE_SAY";
|
|
66
|
-
EServerEvent["UPDATE_CHAT"] = "UPDAET_CHAT";
|
|
67
|
-
})(EServerEvent || (EServerEvent = {}));
|
|
68
|
-
export var EClientEvent;
|
|
69
|
-
(function (EClientEvent) {
|
|
70
|
-
EClientEvent["LOGIN"] = "LOGIN";
|
|
71
|
-
EClientEvent["LOGOUT"] = "LOGOUT";
|
|
72
|
-
EClientEvent["LEAVE_MATCH"] = "LEAVE_MATCH";
|
|
73
|
-
EClientEvent["CREATE_MATCH"] = "CREATE_MATCH";
|
|
74
|
-
EClientEvent["FETCH_ACCOUNT_DETAILS"] = "FETCH_ACCOUNT_DETAILS";
|
|
75
|
-
EClientEvent["FETCH_MATCH_DETAILS"] = "FETCH_MATCH_DETAILS";
|
|
76
|
-
EClientEvent["SET_MATCH_OPTIONS"] = "SET_MATCH_OPTIONS";
|
|
77
|
-
EClientEvent["LIST_MATCHES"] = "LIST_MATCHES";
|
|
78
|
-
EClientEvent["JOIN_MATCH"] = "JOIN_MATCH";
|
|
79
|
-
EClientEvent["START_MATCH"] = "START_MATCH";
|
|
80
|
-
EClientEvent["SET_PLAYER_READY"] = "SET_PLAYER_READY";
|
|
81
|
-
EClientEvent["FETCH_MATCH"] = "FETCH_MATCH";
|
|
82
|
-
EClientEvent["CHAT"] = "CHAT";
|
|
83
|
-
EClientEvent["PING"] = "PING";
|
|
84
|
-
EClientEvent["SAY"] = "SAY";
|
|
85
|
-
})(EClientEvent || (EClientEvent = {}));
|
|
86
|
-
export class TMap extends Map {
|
|
87
|
-
find(finder) {
|
|
88
|
-
let result = undefined;
|
|
89
|
-
for (let value of this.values()) {
|
|
90
|
-
const find = finder(value);
|
|
91
|
-
if (!result && find) {
|
|
92
|
-
result = value;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
findAll(finder) {
|
|
98
|
-
return Array.from(this.values()).filter(finder);
|
|
99
|
-
}
|
|
100
|
-
getOrThrow(key) {
|
|
101
|
-
const result = key && this.get(key);
|
|
102
|
-
if (!result) {
|
|
103
|
-
throw new Error(`getOrThrow(${key}) not found`);
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
54
|
export var GAME_ERROR;
|
|
109
55
|
(function (GAME_ERROR) {
|
|
110
56
|
GAME_ERROR["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trucoshi",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Lightning Truco Server",
|
|
5
5
|
"main": "dist/types.js",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -53,14 +53,19 @@
|
|
|
53
53
|
"dist/lib/constants.d.ts",
|
|
54
54
|
"dist/types.js",
|
|
55
55
|
"dist/types.d.ts",
|
|
56
|
+
"dist/events.js",
|
|
57
|
+
"dist/events.d.ts",
|
|
56
58
|
"dist/server/constants.js",
|
|
57
59
|
"dist/server/constants.d.ts",
|
|
58
|
-
"prisma
|
|
60
|
+
"prisma/client/index.js",
|
|
61
|
+
"prisma/client/index.d.ts",
|
|
62
|
+
"prisma/client/schema.prisma"
|
|
59
63
|
],
|
|
60
64
|
"dependencies": {
|
|
61
65
|
"@prisma/client": "^4.14.1",
|
|
62
66
|
"@socket.io/redis-adapter": "^8.2.1",
|
|
63
67
|
"@types/jsonwebtoken": "^9.0.5",
|
|
68
|
+
"@types/node-forge": "^1.3.11",
|
|
64
69
|
"@types/pino": "^7.0.5",
|
|
65
70
|
"@types/redis": "^4.0.11",
|
|
66
71
|
"axios": "^1.6.3",
|
|
@@ -70,6 +75,7 @@
|
|
|
70
75
|
"form-data": "^4.0.0",
|
|
71
76
|
"jsonwebtoken": "^9.0.2",
|
|
72
77
|
"lightning-accounts": "2.2.0",
|
|
78
|
+
"node-forge": "^1.3.1",
|
|
73
79
|
"path-scurry": "^1.9.2",
|
|
74
80
|
"pino": "^8.11.0",
|
|
75
81
|
"pino-pretty": "^10.0.0",
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
export const __esModule: boolean;
|
|
2
|
-
export namespace Prisma {
|
|
3
|
-
namespace JsonNullValueFilter {
|
|
4
|
-
import DbNull = Prisma.DbNull;
|
|
5
|
-
export { DbNull };
|
|
6
|
-
import JsonNull = Prisma.JsonNull;
|
|
7
|
-
export { JsonNull };
|
|
8
|
-
import AnyNull = Prisma.AnyNull;
|
|
9
|
-
export { AnyNull };
|
|
10
|
-
}
|
|
11
|
-
namespace JsonNullValueInput {
|
|
12
|
-
import JsonNull_1 = Prisma.JsonNull;
|
|
13
|
-
export { JsonNull_1 as JsonNull };
|
|
14
|
-
}
|
|
15
|
-
namespace MatchBetScalarFieldEnum {
|
|
16
|
-
let id: string;
|
|
17
|
-
let createdAt: string;
|
|
18
|
-
let updatedAt: string;
|
|
19
|
-
let matchId: string;
|
|
20
|
-
let satsPerPlayer: string;
|
|
21
|
-
let allPlayersPaid: string;
|
|
22
|
-
let winnerAwarded: string;
|
|
23
|
-
}
|
|
24
|
-
namespace MatchHandScalarFieldEnum {
|
|
25
|
-
let id_1: string;
|
|
26
|
-
export { id_1 as id };
|
|
27
|
-
let createdAt_1: string;
|
|
28
|
-
export { createdAt_1 as createdAt };
|
|
29
|
-
let updatedAt_1: string;
|
|
30
|
-
export { updatedAt_1 as updatedAt };
|
|
31
|
-
export let idx: string;
|
|
32
|
-
export let rounds: string;
|
|
33
|
-
export let results: string;
|
|
34
|
-
let matchId_1: string;
|
|
35
|
-
export { matchId_1 as matchId };
|
|
36
|
-
export let trucoWinnerIdx: string;
|
|
37
|
-
export let envidoWinnerIdx: string;
|
|
38
|
-
export let florWinnerIdx: string;
|
|
39
|
-
}
|
|
40
|
-
namespace MatchPlayerScalarFieldEnum {
|
|
41
|
-
let id_2: string;
|
|
42
|
-
export { id_2 as id };
|
|
43
|
-
let createdAt_2: string;
|
|
44
|
-
export { createdAt_2 as createdAt };
|
|
45
|
-
let updatedAt_2: string;
|
|
46
|
-
export { updatedAt_2 as updatedAt };
|
|
47
|
-
let idx_1: string;
|
|
48
|
-
export { idx_1 as idx };
|
|
49
|
-
export let name: string;
|
|
50
|
-
export let accountId: string;
|
|
51
|
-
export let session: string;
|
|
52
|
-
export let teamIdx: string;
|
|
53
|
-
export let satsPaid: string;
|
|
54
|
-
export let satsReceived: string;
|
|
55
|
-
export let payRequestId: string;
|
|
56
|
-
let matchId_2: string;
|
|
57
|
-
export { matchId_2 as matchId };
|
|
58
|
-
}
|
|
59
|
-
namespace MatchScalarFieldEnum {
|
|
60
|
-
let id_3: string;
|
|
61
|
-
export { id_3 as id };
|
|
62
|
-
let createdAt_3: string;
|
|
63
|
-
export { createdAt_3 as createdAt };
|
|
64
|
-
let updatedAt_3: string;
|
|
65
|
-
export { updatedAt_3 as updatedAt };
|
|
66
|
-
export let sessionId: string;
|
|
67
|
-
export let state: string;
|
|
68
|
-
export let ownerAccountId: string;
|
|
69
|
-
export let options: string;
|
|
70
|
-
let results_1: string;
|
|
71
|
-
export { results_1 as results };
|
|
72
|
-
export let winnerIdx: string;
|
|
73
|
-
}
|
|
74
|
-
namespace QueryMode {
|
|
75
|
-
let _default: string;
|
|
76
|
-
export { _default as default };
|
|
77
|
-
export let insensitive: string;
|
|
78
|
-
}
|
|
79
|
-
namespace SortOrder {
|
|
80
|
-
let asc: string;
|
|
81
|
-
let desc: string;
|
|
82
|
-
}
|
|
83
|
-
namespace TransactionIsolationLevel {
|
|
84
|
-
let ReadUncommitted: string;
|
|
85
|
-
let ReadCommitted: string;
|
|
86
|
-
let RepeatableRead: string;
|
|
87
|
-
let Serializable: string;
|
|
88
|
-
}
|
|
89
|
-
namespace UserStatsScalarFieldEnum {
|
|
90
|
-
let id_4: string;
|
|
91
|
-
export { id_4 as id };
|
|
92
|
-
let accountId_1: string;
|
|
93
|
-
export { accountId_1 as accountId };
|
|
94
|
-
export let win: string;
|
|
95
|
-
export let loss: string;
|
|
96
|
-
export let satsBet: string;
|
|
97
|
-
export let satsWon: string;
|
|
98
|
-
export let satsLost: string;
|
|
99
|
-
}
|
|
100
|
-
namespace ModelName {
|
|
101
|
-
let UserStats: string;
|
|
102
|
-
let Match: string;
|
|
103
|
-
let MatchBet: string;
|
|
104
|
-
let MatchHand: string;
|
|
105
|
-
let MatchPlayer: string;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export namespace EMatchState {
|
|
109
|
-
let UNREADY: string;
|
|
110
|
-
let READY: string;
|
|
111
|
-
let STARTED: string;
|
|
112
|
-
let FINISHED: string;
|
|
113
|
-
}
|
|
114
|
-
export namespace Prisma {
|
|
115
|
-
export namespace prismaVersion {
|
|
116
|
-
let client: string;
|
|
117
|
-
let engine: string;
|
|
118
|
-
}
|
|
119
|
-
export function PrismaClientKnownRequestError(): never;
|
|
120
|
-
export function PrismaClientUnknownRequestError(): never;
|
|
121
|
-
export function PrismaClientRustPanicError(): never;
|
|
122
|
-
export function PrismaClientInitializationError(): never;
|
|
123
|
-
export function PrismaClientValidationError(): never;
|
|
124
|
-
export function NotFoundError(): never;
|
|
125
|
-
export { Decimal };
|
|
126
|
-
/**
|
|
127
|
-
* Re-export of sql-template-tag
|
|
128
|
-
*/
|
|
129
|
-
export function sql(): never;
|
|
130
|
-
export function empty(): never;
|
|
131
|
-
export function join(): never;
|
|
132
|
-
export function raw(): never;
|
|
133
|
-
export function validator(): (val: any) => any;
|
|
134
|
-
let DbNull_1: {
|
|
135
|
-
_getNamespace(): string;
|
|
136
|
-
_getName(): string;
|
|
137
|
-
toString(): string;
|
|
138
|
-
};
|
|
139
|
-
export { DbNull_1 as DbNull };
|
|
140
|
-
let JsonNull_2: {
|
|
141
|
-
_getNamespace(): string;
|
|
142
|
-
_getName(): string;
|
|
143
|
-
toString(): string;
|
|
144
|
-
};
|
|
145
|
-
export { JsonNull_2 as JsonNull };
|
|
146
|
-
let AnyNull_1: {
|
|
147
|
-
_getNamespace(): string;
|
|
148
|
-
_getName(): string;
|
|
149
|
-
toString(): string;
|
|
150
|
-
};
|
|
151
|
-
export { AnyNull_1 as AnyNull };
|
|
152
|
-
export namespace NullTypes {
|
|
153
|
-
let DbNull_2: {
|
|
154
|
-
new (arg?: symbol | undefined): {
|
|
155
|
-
_getNamespace(): string;
|
|
156
|
-
_getName(): string;
|
|
157
|
-
toString(): string;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
export { DbNull_2 as DbNull };
|
|
161
|
-
let JsonNull_3: {
|
|
162
|
-
new (arg?: symbol | undefined): {
|
|
163
|
-
_getNamespace(): string;
|
|
164
|
-
_getName(): string;
|
|
165
|
-
toString(): string;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
export { JsonNull_3 as JsonNull };
|
|
169
|
-
let AnyNull_2: {
|
|
170
|
-
new (arg?: symbol | undefined): {
|
|
171
|
-
_getNamespace(): string;
|
|
172
|
-
_getName(): string;
|
|
173
|
-
toString(): string;
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
export { AnyNull_2 as AnyNull };
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Create the Client
|
|
181
|
-
*/
|
|
182
|
-
export class PrismaClient {
|
|
183
|
-
}
|
|
184
|
-
import { Decimal } from "./runtime/index-browser";
|