@thegeem/protocol 0.1.0 → 0.1.2
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 +3 -0
- package/dist/index.d.cts +23 -10
- package/dist/index.d.ts +23 -10
- package/dist/index.js +3 -0
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -55,6 +55,9 @@ var IdToken = import_zod.z.string().max(4096).optional();
|
|
|
55
55
|
var ClientMsg = import_zod.z.discriminatedUnion("t", [
|
|
56
56
|
// room / lobby
|
|
57
57
|
import_zod.z.object({ t: import_zod.z.literal("createRoom"), name: DisplayName.optional(), pv: Pv, idToken: IdToken }),
|
|
58
|
+
// Host sets/changes their display name AFTER createRoom (for anonymous one-tap
|
|
59
|
+
// hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
|
|
60
|
+
import_zod.z.object({ t: import_zod.z.literal("renameHost"), name: DisplayName }),
|
|
58
61
|
import_zod.z.object({ t: import_zod.z.literal("joinRoom"), code: RoomCode, name: DisplayName, pv: Pv, idToken: IdToken }),
|
|
59
62
|
import_zod.z.object({ t: import_zod.z.literal("resume"), code: RoomCode, token: import_zod.z.string().max(120), pv: Pv, idToken: IdToken }),
|
|
60
63
|
import_zod.z.object({ t: import_zod.z.literal("leaveRoom") }),
|
package/dist/index.d.cts
CHANGED
|
@@ -55,6 +55,15 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
55
55
|
name?: string | undefined;
|
|
56
56
|
pv?: number | undefined;
|
|
57
57
|
idToken?: string | undefined;
|
|
58
|
+
}>, z.ZodObject<{
|
|
59
|
+
t: z.ZodLiteral<"renameHost">;
|
|
60
|
+
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
t: "renameHost";
|
|
63
|
+
name: string;
|
|
64
|
+
}, {
|
|
65
|
+
t: "renameHost";
|
|
66
|
+
name: string;
|
|
58
67
|
}>, z.ZodObject<{
|
|
59
68
|
t: z.ZodLiteral<"joinRoom">;
|
|
60
69
|
code: z.ZodString;
|
|
@@ -244,6 +253,15 @@ interface YouContext {
|
|
|
244
253
|
/** This player's team index once the game has started; null in the lobby / for the host. */
|
|
245
254
|
teamIndex: number | null;
|
|
246
255
|
}
|
|
256
|
+
/** A pickable category shown in the lobby (one column header on the board). */
|
|
257
|
+
interface CategoryView {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
packId: string;
|
|
261
|
+
packName: string;
|
|
262
|
+
icon: string;
|
|
263
|
+
hasImage: boolean;
|
|
264
|
+
}
|
|
247
265
|
type GameStatus = 'setup' | 'categorySelection' | 'inProgress' | 'completed';
|
|
248
266
|
type GameplayFlow = 'classic' | 'openJudged' | 'noHost' | 'buzzer';
|
|
249
267
|
type BuzzerGameMode = 'off' | 'solo' | 'race' | 'controller';
|
|
@@ -292,7 +310,9 @@ interface GameStateView {
|
|
|
292
310
|
stealPointsActive: boolean;
|
|
293
311
|
trippedTeamIndices: number[];
|
|
294
312
|
/** Shared board: per category id, the level numbers already played. */
|
|
295
|
-
usedLevels:
|
|
313
|
+
usedLevels: {
|
|
314
|
+
[categoryId: string]: number[];
|
|
315
|
+
};
|
|
296
316
|
}
|
|
297
317
|
/** Transient presentation effects the relay emits; clients play them once. */
|
|
298
318
|
type Effect = {
|
|
@@ -369,14 +389,7 @@ type ServerMsg = {
|
|
|
369
389
|
hostId: string;
|
|
370
390
|
hostName: string;
|
|
371
391
|
players: LobbyPlayer[];
|
|
372
|
-
categories:
|
|
373
|
-
id: string;
|
|
374
|
-
name: string;
|
|
375
|
-
packId: string;
|
|
376
|
-
packName: string;
|
|
377
|
-
icon: string;
|
|
378
|
-
hasImage: boolean;
|
|
379
|
-
}[];
|
|
392
|
+
categories: CategoryView[];
|
|
380
393
|
you: YouContext;
|
|
381
394
|
} | {
|
|
382
395
|
t: 'state';
|
|
@@ -393,4 +406,4 @@ type ServerMsg = {
|
|
|
393
406
|
message: string;
|
|
394
407
|
};
|
|
395
408
|
|
|
396
|
-
export { type BuzzerGameMode, 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 };
|
|
409
|
+
export { 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,15 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
55
55
|
name?: string | undefined;
|
|
56
56
|
pv?: number | undefined;
|
|
57
57
|
idToken?: string | undefined;
|
|
58
|
+
}>, z.ZodObject<{
|
|
59
|
+
t: z.ZodLiteral<"renameHost">;
|
|
60
|
+
name: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
t: "renameHost";
|
|
63
|
+
name: string;
|
|
64
|
+
}, {
|
|
65
|
+
t: "renameHost";
|
|
66
|
+
name: string;
|
|
58
67
|
}>, z.ZodObject<{
|
|
59
68
|
t: z.ZodLiteral<"joinRoom">;
|
|
60
69
|
code: z.ZodString;
|
|
@@ -244,6 +253,15 @@ interface YouContext {
|
|
|
244
253
|
/** This player's team index once the game has started; null in the lobby / for the host. */
|
|
245
254
|
teamIndex: number | null;
|
|
246
255
|
}
|
|
256
|
+
/** A pickable category shown in the lobby (one column header on the board). */
|
|
257
|
+
interface CategoryView {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
packId: string;
|
|
261
|
+
packName: string;
|
|
262
|
+
icon: string;
|
|
263
|
+
hasImage: boolean;
|
|
264
|
+
}
|
|
247
265
|
type GameStatus = 'setup' | 'categorySelection' | 'inProgress' | 'completed';
|
|
248
266
|
type GameplayFlow = 'classic' | 'openJudged' | 'noHost' | 'buzzer';
|
|
249
267
|
type BuzzerGameMode = 'off' | 'solo' | 'race' | 'controller';
|
|
@@ -292,7 +310,9 @@ interface GameStateView {
|
|
|
292
310
|
stealPointsActive: boolean;
|
|
293
311
|
trippedTeamIndices: number[];
|
|
294
312
|
/** Shared board: per category id, the level numbers already played. */
|
|
295
|
-
usedLevels:
|
|
313
|
+
usedLevels: {
|
|
314
|
+
[categoryId: string]: number[];
|
|
315
|
+
};
|
|
296
316
|
}
|
|
297
317
|
/** Transient presentation effects the relay emits; clients play them once. */
|
|
298
318
|
type Effect = {
|
|
@@ -369,14 +389,7 @@ type ServerMsg = {
|
|
|
369
389
|
hostId: string;
|
|
370
390
|
hostName: string;
|
|
371
391
|
players: LobbyPlayer[];
|
|
372
|
-
categories:
|
|
373
|
-
id: string;
|
|
374
|
-
name: string;
|
|
375
|
-
packId: string;
|
|
376
|
-
packName: string;
|
|
377
|
-
icon: string;
|
|
378
|
-
hasImage: boolean;
|
|
379
|
-
}[];
|
|
392
|
+
categories: CategoryView[];
|
|
380
393
|
you: YouContext;
|
|
381
394
|
} | {
|
|
382
395
|
t: 'state';
|
|
@@ -393,4 +406,4 @@ type ServerMsg = {
|
|
|
393
406
|
message: string;
|
|
394
407
|
};
|
|
395
408
|
|
|
396
|
-
export { type BuzzerGameMode, 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 };
|
|
409
|
+
export { 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 };
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,9 @@ var IdToken = z.string().max(4096).optional();
|
|
|
27
27
|
var ClientMsg = z.discriminatedUnion("t", [
|
|
28
28
|
// room / lobby
|
|
29
29
|
z.object({ t: z.literal("createRoom"), name: DisplayName.optional(), pv: Pv, idToken: IdToken }),
|
|
30
|
+
// Host sets/changes their display name AFTER createRoom (for anonymous one-tap
|
|
31
|
+
// hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
|
|
32
|
+
z.object({ t: z.literal("renameHost"), name: DisplayName }),
|
|
30
33
|
z.object({ t: z.literal("joinRoom"), code: RoomCode, name: DisplayName, pv: Pv, idToken: IdToken }),
|
|
31
34
|
z.object({ t: z.literal("resume"), code: RoomCode, token: z.string().max(120), pv: Pv, idToken: IdToken }),
|
|
32
35
|
z.object({ t: z.literal("leaveRoom") }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegeem/protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
@@ -28,13 +28,15 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsup",
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
|
-
"release": "node scripts/release.mjs"
|
|
31
|
+
"release": "node scripts/release.mjs",
|
|
32
|
+
"gen:native": "npm run build && node scripts/gen-native.mjs"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"zod": "^3.23.8"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"typescript": "^5.5.4"
|
|
38
|
+
"typescript": "^5.5.4",
|
|
39
|
+
"zod-to-json-schema": "^3.23.5"
|
|
38
40
|
},
|
|
39
41
|
"module": "./dist/index.js",
|
|
40
42
|
"types": "./dist/index.d.ts"
|