@thegeem/protocol 0.1.4 → 0.1.6
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/index.cjs +12 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +12 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -71,13 +71,24 @@ var ClientMsg = import_zod.z.discriminatedUnion("t", [
|
|
|
71
71
|
// Host's IN-PROGRESS category selection in the lobby — a live preview for waiting
|
|
72
72
|
// players. Distinct from startGame.categoryIds, which COMMITS the board. Empty = cleared.
|
|
73
73
|
import_zod.z.object({ t: import_zod.z.literal("setCategories"), categoryIds: import_zod.z.array(import_zod.z.string().max(60)).max(12) }),
|
|
74
|
+
// Host defines the lobby teams players can join (1–12). Resets picks that fall out of range.
|
|
75
|
+
import_zod.z.object({ t: import_zod.z.literal("setTeams"), teams: import_zod.z.array(DisplayName).min(1).max(LIMITS.MAX_PLAYERS) }),
|
|
76
|
+
// A player joins team slot `teamIndex` (0-based, into the host's `setTeams` list).
|
|
77
|
+
import_zod.z.object({ t: import_zod.z.literal("pickTeam"), teamIndex: import_zod.z.number().int().min(0).max(LIMITS.MAX_PLAYERS - 1) }),
|
|
74
78
|
// host game actions
|
|
75
79
|
import_zod.z.object({
|
|
76
80
|
t: import_zod.z.literal("startGame"),
|
|
77
81
|
game: import_zod.z.enum(GAME_IDS).optional(),
|
|
78
82
|
// which game to play; defaults to 'trivia'
|
|
79
83
|
totalRounds: import_zod.z.number().int().min(1).max(50),
|
|
80
|
-
categoryIds: import_zod.z.array(import_zod.z.string().max(60)).min(1).max(12)
|
|
84
|
+
categoryIds: import_zod.z.array(import_zod.z.string().max(60)).min(1).max(12),
|
|
85
|
+
// How to play (maps to the engine). Omit → controller (each player answers from
|
|
86
|
+
// their own device). 'off' = one device drives (Me-Controller); pair with noHost.
|
|
87
|
+
// solo=Solo · race=Snag/buzz · controller=each-player-from-device · off=Me-Controller
|
|
88
|
+
buzzerMode: import_zod.z.enum(["off", "solo", "race", "controller"]).optional(),
|
|
89
|
+
// Only meaningful for 'off' (Me-Controller): false = a referee drives & sees answers
|
|
90
|
+
// (classic); true = the driver is a player, answers stay hidden + auto-reveal (noHost).
|
|
91
|
+
noHost: import_zod.z.boolean().optional()
|
|
81
92
|
}),
|
|
82
93
|
import_zod.z.object({ t: import_zod.z.literal("pickLevel"), categoryId: import_zod.z.string().max(60), level: import_zod.z.number().int().min(1).max(6) }),
|
|
83
94
|
import_zod.z.object({ t: import_zod.z.literal("nextTurn") }),
|
package/dist/index.d.cts
CHANGED
|
@@ -196,21 +196,45 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
196
196
|
}, {
|
|
197
197
|
t: "setCategories";
|
|
198
198
|
categoryIds: string[];
|
|
199
|
+
}>, z.ZodObject<{
|
|
200
|
+
t: z.ZodLiteral<"setTeams">;
|
|
201
|
+
teams: z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
t: "setTeams";
|
|
204
|
+
teams: string[];
|
|
205
|
+
}, {
|
|
206
|
+
t: "setTeams";
|
|
207
|
+
teams: string[];
|
|
208
|
+
}>, z.ZodObject<{
|
|
209
|
+
t: z.ZodLiteral<"pickTeam">;
|
|
210
|
+
teamIndex: z.ZodNumber;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
t: "pickTeam";
|
|
213
|
+
teamIndex: number;
|
|
214
|
+
}, {
|
|
215
|
+
t: "pickTeam";
|
|
216
|
+
teamIndex: number;
|
|
199
217
|
}>, z.ZodObject<{
|
|
200
218
|
t: z.ZodLiteral<"startGame">;
|
|
201
219
|
game: z.ZodOptional<z.ZodEnum<["trivia"]>>;
|
|
202
220
|
totalRounds: z.ZodNumber;
|
|
203
221
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
222
|
+
buzzerMode: z.ZodOptional<z.ZodEnum<["off", "solo", "race", "controller"]>>;
|
|
223
|
+
noHost: z.ZodOptional<z.ZodBoolean>;
|
|
204
224
|
}, "strip", z.ZodTypeAny, {
|
|
205
225
|
t: "startGame";
|
|
206
226
|
categoryIds: string[];
|
|
207
227
|
totalRounds: number;
|
|
208
228
|
game?: "trivia" | undefined;
|
|
229
|
+
buzzerMode?: "off" | "solo" | "race" | "controller" | undefined;
|
|
230
|
+
noHost?: boolean | undefined;
|
|
209
231
|
}, {
|
|
210
232
|
t: "startGame";
|
|
211
233
|
categoryIds: string[];
|
|
212
234
|
totalRounds: number;
|
|
213
235
|
game?: "trivia" | undefined;
|
|
236
|
+
buzzerMode?: "off" | "solo" | "race" | "controller" | undefined;
|
|
237
|
+
noHost?: boolean | undefined;
|
|
214
238
|
}>, z.ZodObject<{
|
|
215
239
|
t: z.ZodLiteral<"pickLevel">;
|
|
216
240
|
categoryId: z.ZodString;
|
|
@@ -308,6 +332,11 @@ interface AvatarView {
|
|
|
308
332
|
emoji: string;
|
|
309
333
|
color: string;
|
|
310
334
|
}
|
|
335
|
+
/** A lobby team slot players can join (`pickTeam` by its index in `lobby.teams`). */
|
|
336
|
+
interface TeamSlotView {
|
|
337
|
+
name: string;
|
|
338
|
+
color: string;
|
|
339
|
+
}
|
|
311
340
|
interface LobbyPlayer {
|
|
312
341
|
id: string;
|
|
313
342
|
name: string;
|
|
@@ -470,6 +499,7 @@ type ServerMsg = {
|
|
|
470
499
|
players: LobbyPlayer[];
|
|
471
500
|
categories: CategoryView[];
|
|
472
501
|
selectedCategoryIds: string[];
|
|
502
|
+
teams: TeamSlotView[];
|
|
473
503
|
you: YouContext;
|
|
474
504
|
} | {
|
|
475
505
|
t: 'state';
|
|
@@ -486,4 +516,4 @@ type ServerMsg = {
|
|
|
486
516
|
message: string;
|
|
487
517
|
};
|
|
488
518
|
|
|
489
|
-
export { type AvatarView, type BuzzerGameMode, type CategoryView, ClientMsg, type Effect, GAME_IDS, type GameId, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamView, type YouContext };
|
|
519
|
+
export { type AvatarView, type BuzzerGameMode, type CategoryView, ClientMsg, type Effect, GAME_IDS, type GameId, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamSlotView, type TeamView, type YouContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -196,21 +196,45 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
196
196
|
}, {
|
|
197
197
|
t: "setCategories";
|
|
198
198
|
categoryIds: string[];
|
|
199
|
+
}>, z.ZodObject<{
|
|
200
|
+
t: z.ZodLiteral<"setTeams">;
|
|
201
|
+
teams: z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
t: "setTeams";
|
|
204
|
+
teams: string[];
|
|
205
|
+
}, {
|
|
206
|
+
t: "setTeams";
|
|
207
|
+
teams: string[];
|
|
208
|
+
}>, z.ZodObject<{
|
|
209
|
+
t: z.ZodLiteral<"pickTeam">;
|
|
210
|
+
teamIndex: z.ZodNumber;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
t: "pickTeam";
|
|
213
|
+
teamIndex: number;
|
|
214
|
+
}, {
|
|
215
|
+
t: "pickTeam";
|
|
216
|
+
teamIndex: number;
|
|
199
217
|
}>, z.ZodObject<{
|
|
200
218
|
t: z.ZodLiteral<"startGame">;
|
|
201
219
|
game: z.ZodOptional<z.ZodEnum<["trivia"]>>;
|
|
202
220
|
totalRounds: z.ZodNumber;
|
|
203
221
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
222
|
+
buzzerMode: z.ZodOptional<z.ZodEnum<["off", "solo", "race", "controller"]>>;
|
|
223
|
+
noHost: z.ZodOptional<z.ZodBoolean>;
|
|
204
224
|
}, "strip", z.ZodTypeAny, {
|
|
205
225
|
t: "startGame";
|
|
206
226
|
categoryIds: string[];
|
|
207
227
|
totalRounds: number;
|
|
208
228
|
game?: "trivia" | undefined;
|
|
229
|
+
buzzerMode?: "off" | "solo" | "race" | "controller" | undefined;
|
|
230
|
+
noHost?: boolean | undefined;
|
|
209
231
|
}, {
|
|
210
232
|
t: "startGame";
|
|
211
233
|
categoryIds: string[];
|
|
212
234
|
totalRounds: number;
|
|
213
235
|
game?: "trivia" | undefined;
|
|
236
|
+
buzzerMode?: "off" | "solo" | "race" | "controller" | undefined;
|
|
237
|
+
noHost?: boolean | undefined;
|
|
214
238
|
}>, z.ZodObject<{
|
|
215
239
|
t: z.ZodLiteral<"pickLevel">;
|
|
216
240
|
categoryId: z.ZodString;
|
|
@@ -308,6 +332,11 @@ interface AvatarView {
|
|
|
308
332
|
emoji: string;
|
|
309
333
|
color: string;
|
|
310
334
|
}
|
|
335
|
+
/** A lobby team slot players can join (`pickTeam` by its index in `lobby.teams`). */
|
|
336
|
+
interface TeamSlotView {
|
|
337
|
+
name: string;
|
|
338
|
+
color: string;
|
|
339
|
+
}
|
|
311
340
|
interface LobbyPlayer {
|
|
312
341
|
id: string;
|
|
313
342
|
name: string;
|
|
@@ -470,6 +499,7 @@ type ServerMsg = {
|
|
|
470
499
|
players: LobbyPlayer[];
|
|
471
500
|
categories: CategoryView[];
|
|
472
501
|
selectedCategoryIds: string[];
|
|
502
|
+
teams: TeamSlotView[];
|
|
473
503
|
you: YouContext;
|
|
474
504
|
} | {
|
|
475
505
|
t: 'state';
|
|
@@ -486,4 +516,4 @@ type ServerMsg = {
|
|
|
486
516
|
message: string;
|
|
487
517
|
};
|
|
488
518
|
|
|
489
|
-
export { type AvatarView, type BuzzerGameMode, type CategoryView, ClientMsg, type Effect, GAME_IDS, type GameId, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamView, type YouContext };
|
|
519
|
+
export { type AvatarView, type BuzzerGameMode, type CategoryView, ClientMsg, type Effect, GAME_IDS, type GameId, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamSlotView, type TeamView, type YouContext };
|
package/dist/index.js
CHANGED
|
@@ -43,13 +43,24 @@ var ClientMsg = z.discriminatedUnion("t", [
|
|
|
43
43
|
// Host's IN-PROGRESS category selection in the lobby — a live preview for waiting
|
|
44
44
|
// players. Distinct from startGame.categoryIds, which COMMITS the board. Empty = cleared.
|
|
45
45
|
z.object({ t: z.literal("setCategories"), categoryIds: z.array(z.string().max(60)).max(12) }),
|
|
46
|
+
// Host defines the lobby teams players can join (1–12). Resets picks that fall out of range.
|
|
47
|
+
z.object({ t: z.literal("setTeams"), teams: z.array(DisplayName).min(1).max(LIMITS.MAX_PLAYERS) }),
|
|
48
|
+
// A player joins team slot `teamIndex` (0-based, into the host's `setTeams` list).
|
|
49
|
+
z.object({ t: z.literal("pickTeam"), teamIndex: z.number().int().min(0).max(LIMITS.MAX_PLAYERS - 1) }),
|
|
46
50
|
// host game actions
|
|
47
51
|
z.object({
|
|
48
52
|
t: z.literal("startGame"),
|
|
49
53
|
game: z.enum(GAME_IDS).optional(),
|
|
50
54
|
// which game to play; defaults to 'trivia'
|
|
51
55
|
totalRounds: z.number().int().min(1).max(50),
|
|
52
|
-
categoryIds: z.array(z.string().max(60)).min(1).max(12)
|
|
56
|
+
categoryIds: z.array(z.string().max(60)).min(1).max(12),
|
|
57
|
+
// How to play (maps to the engine). Omit → controller (each player answers from
|
|
58
|
+
// their own device). 'off' = one device drives (Me-Controller); pair with noHost.
|
|
59
|
+
// solo=Solo · race=Snag/buzz · controller=each-player-from-device · off=Me-Controller
|
|
60
|
+
buzzerMode: z.enum(["off", "solo", "race", "controller"]).optional(),
|
|
61
|
+
// Only meaningful for 'off' (Me-Controller): false = a referee drives & sees answers
|
|
62
|
+
// (classic); true = the driver is a player, answers stay hidden + auto-reveal (noHost).
|
|
63
|
+
noHost: z.boolean().optional()
|
|
53
64
|
}),
|
|
54
65
|
z.object({ t: z.literal("pickLevel"), categoryId: z.string().max(60), level: z.number().int().min(1).max(6) }),
|
|
55
66
|
z.object({ t: z.literal("nextTurn") }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegeem/protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Geem's wire protocol — shared zod schemas + TypeScript types for talking to the Geem game server over Socket.IO. The source of truth all clients implement against.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://geem.tv",
|